Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#25 2012-06-26 20:38:47

philwareham
Core designer
From: Haslemere, Surrey, UK
Registered: 2009-06-11
Posts: 3,564
Website GitHub Mastodon

Re: New sections tab, multi-edit control block

Well, I’ve put a .selected class into Hive theme in readiness for this, I’ll do the same for other core themes soon.

Last edited by philwareham (2012-06-26 20:39:05)

Offline

#26 2012-06-26 20:40:54

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: New sections tab, multi-edit control block

Since I didn’t come up better way of putting it out there for a feedback and so on, I threw the written multi-edit jQuery plugin to a git repository on GitHub; jquery.txpMultiEditForm.js. Temporarily of course, just for a feedback and so on. Plus I need a place to commit to.

Offline

#27 2012-06-26 21:10:50

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: New sections tab, multi-edit control block

Phil, Robert, Stef, and all, if you want to see it in action, you can just throw the two files to your /textpattern directory. For example clone the repository somewhere and then symlink the two files. After done (symlinked, copied or outright cloned to the textpattern dir), just open up the html file.

Yeah, yeah. I could have just cloned the whole textpattern repository for a two static files, but meh. I’m price winning idiot.

Last edited by Gocom (2012-06-26 21:12:38)

Offline

#28 2012-06-26 21:54:38

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

Re: New sections tab, multi-edit control block

Gocom

Looooooooooooovely.

Feels so good to get rid of the select_buttons(). And I love the fact that it auto-submits if you choose ‘delete’. One less unnecessary click is always welcome.

For some reason in my version the Show details works backwards (checked = hide stuff) but it’s not part of the demo (is it?) so that’s probably just a quirk of being a potted HTML file.

Question: will it work on the Categories panel as it stands today and, if not, what markup do we need to change on the panel to enable this? If we can work up a patch to stuff this masterpiece into core in the next few days I can work on moving all the panels over to the new tfoot / multi-edit structure and then I’d love to use the power of the new multi-edit tool to add changeparent to the four category multi-edits. It’s the last missing piece of multi-edit goodness imo.

Also, does this render all the horrible $edit['blahblah'] multi-edit code in txplib_head redundant?

Hats off to you, sir. An awesome bit of work.

Last edited by Bloke (2012-06-26 21:56:07)


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

#29 2012-06-26 22:41:43

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: New sections tab, multi-edit control block

Bloke wrote:

For some reason in my version the Show details works backwards (checked = hide stuff) but it’s not part of the demo (is it?) so that’s probably just a quirk of being a potted HTML file.

Yeah. The checkbox is checked in the HTML file.

Question: will it work on the Categories panel as it stands today and, if not, what markup do we need to change on the panel to enable this?

Each and every panel will need the new editing method options markup. As of the latest commit I’ve increased the scripts supports to paragraphs from just tables rows. Also I’ve added an option for changing the element that makes a row. So now it should probably work.

Also, does this render all the horrible $edit['blahblah'] multi-edit code in txplib_head redundant?

That’s essentially why the .multi-option things are there. Those should work as replacement to those. Each panel needs new markup tho.

Offline

#30 2012-06-26 22:50:08

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

Re: New sections tab, multi-edit control block

Gocom wrote:

I’ve added an option for changing the element that makes a row. So now it should probably work.

Sweet, thanks.

Each panel needs new markup tho.

I’m not averse to some graft in this area. As long as I’ve seen it working on one page I can replicate the functionality fairly quickly throughout the admin side. Should give me something to do as the country slides towards a post-Olympics financial abyss!


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

#31 2012-06-26 22:50:28

philwareham
Core designer
From: Haslemere, Surrey, UK
Registered: 2009-06-11
Posts: 3,564
Website GitHub Mastodon

Re: New sections tab, multi-edit control block

Love it!

I’m not sure I’m keen on simply clicking anywhere in the row to make it selected state though, to me that might cause UX problems. Is it wise to make that only happen via holding alt key with click instead? I know you want that click feature for smartphones but it might drive users mad if they keep selecting rows when they don’t want to.

Otherwise, it’s a huge improvement on what was previously available.

Last edited by philwareham (2012-06-26 22:52:21)

Offline

#32 2012-06-26 23:31:28

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: New sections tab, multi-edit control block

I want it on desktops personally. Clicking tiny checkboxes is hard, and unless you are selecting the row, you won’t be clicking the rows. It will ignore clicks on links and likes.

If it’s toggled by key combo, you are going all Apple with hidden features. In which point, in my opinion, you can as well almost remove it. Nobody is going to find it. Yeah. As a example, Apple’s App Store was the first time I had to Google how to cancel downloads. Second time was when I hid an application. Gotta love those hidden Options (see what I did there ;).

But sure, toggling it to alt button is likely technically possible. Well, to alt, control and shift. Windows users don’t use Alt (Option). Which then reserves control for it, which is used to do joined selections (which is what checkboxes do by default for the better or worst).

Last edited by Gocom (2012-06-26 23:33:01)

Offline

#33 2012-06-26 23:40:34

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: New sections tab, multi-edit control block

Bloke wrote:

I’m not averse to some graft in this area. As long as I’ve seen it working on one page I can replicate the functionality fairly quickly throughout the admin side. Should give me something to do as the country slides towards a post-Olympics financial abyss!

Dunno about the PHP. The example template has a working HTML markup, which could be replicated 1on1. Spawning such markup probably would need some PHP functions dedicated to it. Or maybe a class even. Having OOP base would make adding the edit_method options easier as you don’t need to write a function that takes huge multidimensional arrays or something. Either of the two designs could work.

As the last resort, one could just write the markup to the panels as it is, but that isn’t probably what Robert would prefer.

Suggestions? I can look into writing some sort of PHP stuff for it too. If I just know what I should write. Something as this?

multi_edit(array(
	'value' => array('label' => gTxt('label'), 'html' => ''),
	'value' => array('label' => gTxt('label'), 'html' => ''),
));

Last edited by Gocom (2012-06-26 23:50:05)

Offline

#34 2012-06-26 23:49:59

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

Re: New sections tab, multi-edit control block

Gocom wrote:

one could just write the markup to the panels as it is, but that isn’t probably what Robert would prefer.

Nor me! If I have to write the same line of code more than once, it’s a design problem in my book :-D

A class would probably be best, as you say. Will think about the approach that requires least coding pain and RSI inducement.

EDIT: if you wanna write some PHP functions / classes for it too, be my guest. Your OO beats my OO any day.

Last edited by Bloke (2012-06-26 23:52:13)


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

#35 2012-06-27 00:26:46

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: New sections tab, multi-edit control block

What about… derp. Multidimensional arrays:

/**
 * Generates multi-edit method options
 * @param array $options array('value' => array( 'label' => '', 'html' => '' ),...)
 * @param string $event Event
 * @param string $step Step
 * @param int $page Page number
 * @param string $sort Column sorted by
 * @param string $dir Sorting direction
 * @param string $crit Search criterion
 * @parma string $search_method Search method
 * @return string HTML markup
 */

	function multi_edit($options, $event, $step, $page, $sort, $dir, $crit, $search_method)
	{
		$method = ps('edit_method');
		$html = $methods = array();
		$methods[''] = gTxt('with_selected_option');

		foreach($options as $value => $option)
		{
			$methods[$value] = $option['title'];
			$html[$value] = '<div class="multi-option" id="multi-option-'.
				txpspecialchars($value).'">'.$option['html'].'</div>';
		}

		return '<div class="multi-edit">'.
			n.selectInput('edit_method', $methods, $method).
			n.eInput($event).
			n.sInput($step).
			n.hInput('page', $page).
			($sort ? n.hInput('sort', $sort).n.hInput('dir', $dir) : '' ).
			($crit !== '' ? n.hInput('crit', $crit).n.hInput('search_method', $search_method) : '').
			n.implode('', $html).
			n.fInput('submit', '', gTxt('go')).
			n.'</div>';
	}

Last edited by Gocom (2012-06-27 08:16:38)

Offline

#36 2012-06-27 01:33:07

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 3,189
Website

Re: New sections tab, multi-edit control block

Regarding the div surrounding the edit options: please bear in mind this suggestion I made.

After a brief play with this, it is quite nice. I share with philwareham a bit of uneasiness with the default click behaviour on rows. Mostly about a user accidentally clicking a row, scrolling it out of view and then accidentally editing it (together with an other row). I’m not sure adding a modifier key will help much (hidden options as noted by Gocom) though (and btw using the Control key won’t work on OS X – used to trigger context menus, and I really don’t like scripts that kill off the default behaviour of meta keys).


Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern

Offline

Board footer

Powered by FluxBB