Hi,
sdumitriu (SVN) wrote:
> Author: sdumitriu
> Date: 2009-04-20 22:25:52 +0200 (Mon, 20 Apr 2009)
> New Revision: 18869
>
> Added:
> platform/web/trunk/standard/src/main/webapp/resources/icons/xwiki/
>
> platform/web/trunk/standard/src/main/webapp/resources/icons/xwiki/ajax-loader-large.gif
>
> platform/web/trunk/standard/src/main/webapp/resources/icons/xwiki/ajax-loader-white.gif
>
> platform/web/trunk/standard/src/main/webapp/resources/js/xwiki/actionbuttons/
>
> platform/web/trunk/standard/src/main/webapp/resources/js/xwiki/actionbuttons/actionButtons.js
> Modified:
> platform/web/trunk/standard/src/main/webapp/templates/edit.vm
> platform/web/trunk/standard/src/main/webapp/templates/editactions.vm
> platform/web/trunk/standard/src/main/webapp/templates/inline.vm
> platform/web/trunk/standard/src/main/webapp/templates/macros.vm
> platform/web/trunk/standard/src/main/webapp/templates/preview.vm
> platform/web/trunk/standard/src/main/webapp/templates/previewactions.vm
> Log:
> XWIKI-3654: Improve editor and preview buttons
> XWIKI-2597: Hitting 'Back to edit' after previewing an in-line form does not
> return to inline editing
> XWIKI-3653: Edit comment and Minor edit settings lost when going to the
> preview and back to edit
> Done.
>
> [snip]
>
> Added:
> platform/web/trunk/standard/src/main/webapp/resources/js/xwiki/actionbuttons/actionButtons.js
> ===================================================================
> ---
> platform/web/trunk/standard/src/main/webapp/resources/js/xwiki/actionbuttons/actionButtons.js
> (rev 0)
> +++
> platform/web/trunk/standard/src/main/webapp/resources/js/xwiki/actionbuttons/actionButtons.js
> 2009-04-20 20:25:52 UTC (rev 18869)
> @@ -0,0 +1,218 @@
> +// ======================================
> +// Form buttons: shortcuts, AJAX improvements and form validation
> +// To be completed.
> +if (typeof(XWiki) == 'undefined') {
> + XWiki = new Object();
> +}
> +if (typeof(XWiki.actionButtons) == 'undefined') {
> + XWiki.actionButtons = new Object();
> +}
> +
> +XWiki.actionButtons.EditActions = Class.create({
Why do you make this a class and not an object ? It looks like it will
never be instanciated more than once
> + initialize : function() {
> + this.addListeners();
> + this.addShortcuts();
> + this.saveAndContinueListener = new
> XWiki.actionButtons.EditActions.AjaxSaveAndContinue(this);
> + },
> [snip]
> + onCancel : function(evt) {
> + evt.stop();
> + var location = evt.element().form.action;
> + if (location.indexOf('?' == -1)) {
> + location += '?';
> + }
> + window.location = location + 'action_cancel=true';
> + },
> + onPreview : function(evt) {
> + if (!this.validateForm(evt.element().form)) {
> + evt.stop();
> + }
> + },
> + onSaveAndView : function(evt) {
> + if (!this.validateForm(evt.element().form)) {
> + evt.stop();
> + }
> + }
> +});
Maybe we could fire custom events here for code that want to listen to
cancel/preview/save clicks. I faced the case several times, and ended up
using some wicked CSS selectors to find the buttons to observe.
We could do something like :
onSaveAndView : function(evt) {
if (!this.validateForm(evt.element().form)) {
evt.stop();
}
else {
document.fire("xwiki:actions:save:before");
}
}
Jerome.
>
> _______________________________________________
> notifications mailing list
> [email protected]
> http://lists.xwiki.org/mailman/listinfo/notifications
_______________________________________________
devs mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/devs