doublesecretagency / craft-cpcss

Control Panel CSS plugin for Craft CMS
MIT License
117 stars 8 forks source link

Adds JS hack to redirect back to CPCSS settings page on save #7

Closed mmikkel closed 8 years ago

mmikkel commented 8 years ago

This is a proposed fix for issue #6 – basically a hack, but I believe it's the only/best way to do this currently, and also fairly safe (I use the same method in my CP Field Links plugin).

The fix uses jQuery to change the value of the hidden input field redirect from settings/plugins to setting/plugins/cpcss – in effect causing Craft to redirect to the Control Panel CSS settings page whenever the settings form is submitted successfully.

mmikkel commented 8 years ago

Upon request from @lindseydiloreto I just updated this PR to include a "Save and continue editing" option to the Save button (identical to the one found on Entry editing forms etc.). It looks like this: http://g.recordit.co/GVZdBtTRDq.gif

The Save button works like vanilla, and the key shortcut (Cmd/Ctrl+S) is mapped to "Save and continue" – exactly like similar button/submenus in the CP.

To be honest, I guess two Save buttons would be even more effective, however there would be issues w/ the responsive design, and there's also something to be said for consistency.

lindseydiloreto commented 8 years ago

This works absolutely brilliantly!!!

Thanks @mmikkel, this is an excellent addition! :+1: