Thanks for the module, it really helps on my sites!

If I use a 5 or more templates it would be useful to move some of them to the top of the list, and others to the bottom.

Also, if some templates are buttons and others are columns, the ability to group them would be great!

CommentFileSizeAuthor
#2 wysiwyg_template-1890714-1.patch6.53 KBsun-fire
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

guybedford’s picture

Great suggestion - can't believe I never thought of this!

Unfortunately I just do not have the time to develop new functionality for this module, and can only maintain at this point.

If someone wants to take this on, I'm more than happy to review patches. Perhaps even put a bounty on it if you need someone to do this.

sun-fire’s picture

Hi. This is a patch, that allow to sort templates. I had not a lot of time to write a code with optimisation and according to all coding standarts. Therefore if my solution is the right way, i will rewrite it for all standarts.

Main idea:

1. Original function wysiwyg_template_overview moved to wysiwyg_template_overview_form (now it is a graggable table).
2. I use a variable to save a template weights into it. Maybe it will be better solution (sorting weights into array and save into variable will be faster than save weight per each template into database).

Patch baset on the latest dev

UPD: If you already have a templates into list, press button "Save" to init weight variable. It's need only one time after patch applying. Now it's a small bug.

vabue’s picture

Status: Active » Reviewed & tested by the community

#2 works for me, thank you!

guybedford’s picture

Thanks so much for submitting this - that is a great feature that has been much needed.

The code seems fine to me at a quick glance, but I still need to review in more detail.

Using a variable for weights is fine. I don't think there is a speed roadblock when it comes to the loading of the edit page, so it may have made slightly more conceptual sense to include it in the base table which also would support the export and import features. But that can also be added later if anyone wants. Having the functionality is far more important though.

Hopefully I'll have some time this weekend to review and merge.

guybedford’s picture

Status: Reviewed & tested by the community » Needs work

@sun-fire I just tested this out and it didn't display any of my existing templates!

Backwards compatibility is important for this, otherwise I can't push this change - can you provide an updated patch?

jurgenhaas’s picture

Version: 7.x-2.9 » 7.x-2.x-dev
Assigned: Unassigned » jurgenhaas
Issue summary: View changes
Status: Needs work » Needs review

I have now rewritten this feature so that it stores the weight as a weight field in the database. Defining the order happens by drag and drop in the template overview in the admin area.

Please review and let us know what everybody thinks. We're getting then close to a new official release of this module.

guybedford’s picture

Excellent, this looks great. It worked fine for me.

jurgenhaas’s picture

Status: Needs review » Closed (fixed)