kaffa / textpattern

Automatically exported from code.google.com/p/textpattern
0 stars 0 forks source link

Integration for jQuery UI's sortable interaction #356

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
The cool stuff in jQuery UI comes in form of interactions, like sortable, e.g. 
sorting. These interactions could be very beneficial for both core (sorting 
lists, load order) and 3rd party plugin developers.

All these widgets need server end point, or more specifically away to get that 
data to the server. Providing a simple wrapper for these interactions would:

1. Make implementation easy, making requirement only adding few attributes to 
the HTML markup.
2. Offer consistent event hooks and attribute names.
3. Since the events, the interactions would itself be extendable by plugins.

For $.ui.sortable() the todo would be;

* Expose public method $.txpSortable() with pre-configured options.
* Expose few attributes for easy interaction; item identifier 
(data-txp-sortable-id) and widget identifier (.txp-sortable).
* On drag updates send the updated order to the server (e.g. 
?event=event&step=sortable_save&order[]=id1&order[]=id2) and receive/process a 
script response as offered.

Furthermore:

* Later on this can be extended to support connected lists, and various event 
bindings which deemed necessary. For simple-single lists only 'update' event is 
needed.

Original issue reported on code.google.com by jukka.m.svahn on 26 Jan 2013 at 2:55

GoogleCodeExporter commented 8 years ago
Do you need any CSS created for this. I'd purposely left specific styling for 
sortables out of the jQuery UI CSS file, because that interaction could be used 
for all manner of things.

However, we can directly style the .txp-sortable within the admin themes 
themselves if you need me to.

Original comment by flaming....@mac.com on 27 Jan 2013 at 9:41

GoogleCodeExporter commented 8 years ago
Yes, please. Sortables should be styled too.

Sortables are part of the jQuery UI specification, and as such they should be 
styled and supported too. Nothing from jQuery UI can be left out.

As .txp-sortable goes, please avoid using it styling. Meaning it should not be 
mentioned even once in any CSS file. It's just for binding and is not part of 
jQuery UI itself.

When you do any styling for jQuery UI specific functionality, you will have to 
use only the jQuery UI's own classes apart from when its entirely Textpattern 
specific custom widget. None of our own classes or additions can be used for 
any jQuery UI specific functionality; These would not comply the specification 
and will not be compatible with any jQuery UI plugin. Making the jQuery UI 
included dead weight and, well, sadly useless in which point we could as well 
remove it from the core.

Anyhow, for sortables the selectors you will be able to target are:

- .ui-sortable
- .ui-sortable-disabled
- .ui-sortable-item
- .ui-sortable-helper
- .ui-sortable-placeholder
- [data-sortable-item]

For sortables you should avoid styles such as:

- Anything typeface and fonts
- Float, position, display
- Anything that affect sizes or page flow
- Cursors (interferes too much)
- Different box-sizing between different states and elements.

Safe styles are (but not necessarily limited) to:

- Background color
- Border color
- Font color
- Shadows

Furthermore with sortables there should be no ID dependencies within 
".ui-sortable > element" (any IDs will have to be able to set freely for 
children). jQuery UI uses IDs for serialization (detecting which item in the 
sortable list is which).

Original comment by jukka.svahn@rahinaa.biz on 27 Jan 2013 at 10:35

GoogleCodeExporter commented 8 years ago
Probably the most common elements where '.ui-sortable' appears, and sortable 
widgets are used, are 'ul', 'ol' and 'tbody'. Potential exceptions and more 
specific styling could be created for at least '.txp-list > .ui-sortable'. When 
you do style sortables, keep in mind that the UI widget supports nesting. If 
you do any special styling, for example for tables, keep Mr. Chevron Key at 
finger reach.

Original comment by jukka.svahn@rahinaa.biz on 27 Jan 2013 at 10:45

GoogleCodeExporter commented 8 years ago
Dumb multi-login resetting to the main Google account address, and dumb me not 
noticing it before too late. Yup, the guy above is me, eh.

Original comment by jukka.m.svahn on 27 Jan 2013 at 10:47