Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2024-10-20 11:52:57

gaekwad
Server grease monkey
From: People's Republic of Cornwall
Registered: 2005-11-19
Posts: 4,226
GitHub

Option to delete an article from its edit page

I’ve revisited a (very old) site today with a bunch of articles that need curating and potentially culling.

For each article, I need to look at the edit page, check some of the elements, then decide whether the elements need updating or the article needs to be deleted.

If the article needs to be deleted, I go back to the article list (1 click / tap), select the article (1 click / tap), select the ‘With 1 selected…’ dropdown (1 click / tap), select ‘Delete’ from the dropdown (1 click / tap), and confirm with the modal (1 click / tap). That’s 5 clicks / taps for an article delete.

Could we consider an option, either in config.php or prefs (ideally) to enable an inline delete button on an article’s edit page? That would make it two clicks / taps to select ‘Delete’ and then confirm. When the article has been deleted, the edit page could go to the next or previous article, or even the articles list (a further preference setting, perhaps).

Offline

#2 2024-10-20 12:11:27

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,422
Website GitHub

Re: Option to delete an article from its edit page

I think the reason we have shied away from deleting articles directly is that there’s no obvious place for a Delete button. In the ‘action’ block it feels a bit close to the Publish/Save button and other actions for comfort, imo.

We got away with it on the Files and Images panels by separating the button. As of last night, Oleg reintroduced the extend block (where the next/previous article nav used to be) so it could potentially go there?

Not averse to the idea but we also need to be cognisant of who can and can’t delete stuff according to privs. And I think I’d prefer to drop back to the Articles list panel on deletion rather than try to go to the ‘next’ one as we don’t know if a filter was in place which could throw things off a bit. We’d still need to track filter params, pass them to the article panel and then pass them back to replay the filter, so maybe jumping to the next (most recent? But what if the list is sorted in decending order?) is possible. Bit of a bind either way, but not insurmountable, as long as we’re careful with edge cases like when we run out of articles in the filtered set.

What do the designers out there think? Any way to do this cleanly?

In the meantime, a slightly less invasive workflow might be multiple tabs, one with the article list, and then pop open each article in an adjacent tab. Decide if you want it, close the tab and check the corresponding box on the list panel. Repeat until you’re happy or you’ve gone through a screenful and multi-edit delete at that point. Not ideal and only marginally fewer clicks, but saves a little finger wear.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#3 2024-10-20 13:50:56

gaekwad
Server grease monkey
From: People's Republic of Cornwall
Registered: 2005-11-19
Posts: 4,226
GitHub

Re: Option to delete an article from its edit page

Thanks, Bloke. I essentially agree with your perspective, for what it’s worth.

The tab approach works well on desktop, not so well on mobile (but that’s not a Textpattern design SNAFU at all). Agreed on the article page destination, sound logic there. I’ll sit tight until I’m more familiar with Oleg’s extend-o-matic© route, perhaps a workable solution will present itself.

Offline

#4 2024-10-20 17:16:55

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,422
Website GitHub

Re: Option to delete an article from its edit page

With the extended-column thing, it should be fairly easy to implement a Delete button down there in a plugin if it’s not deemed core-viable. Same restrictions on privs would apply so there’d be some logic to wire up, and there’d be no sane way to handle passing filters to and from the adticle edit panel unless the edit links were rewritten.

As for managing articles on mobile… that’s cramped at the best of times! Not ideal.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#5 Yesterday 11:21:32

etc
Developer
Registered: 2010-11-11
Posts: 5,135
Website GitHub

Re: Option to delete an article from its edit page

Here is a basic prototype. Caution: no warning on delete!

if (txpinterface == 'admin') {
  global $event;

  register_callback(function($event, $step, $pre, $rs) {
    global $txp_user;

    $can_delete = has_privs('article.delete') || ($rs['authorID'] == $txp_user && has_privs('article.delete.own'));

    return (!$can_delete || empty($rs['ID']) ? '' : '<input form="form_delete" type="hidden" name="selected[]" value="'.$rs['ID'].'" />'.'<input form="form_delete" class="caution" type="submit" value="'.gTxt('delete').'" />');
  }, 'article_ui', 'extend_col_1', 0);

  if ($event =='article') register_callback(function($event, $step) {
    echo '<form id="form_delete" method="post" action="'.ahu.'index.php?event=list">'.n.
      hInput("edit_method", "delete").hInput("step", "list_multi_edit").tInput().n.
    '</form>';
  }, 'admin_side', 'main_content_end');
}

Offline

Board footer

Powered by FluxBB