r9465 - in apps/gobi/trunk/code: Comment Page Page/skins

[email protected]
Newsgroups gmane.comp.java.helma.cvs
Message-ID <[email protected]>
Author: hannes
Date: 2008-12-22 17:13:35 +0100 (Mon, 22 Dec 2008)
New Revision: 9465

Modified:
   apps/gobi/trunk/code/Comment/edit.skin
   apps/gobi/trunk/code/Comment/embed.skin
   apps/gobi/trunk/code/Page/PageActions.js
   apps/gobi/trunk/code/Page/skins/commentForm.skin
   apps/gobi/trunk/code/Page/skins/create.skin
   apps/gobi/trunk/code/Page/skins/edit.skin
   apps/gobi/trunk/code/Page/skins/javascript.skin
Log:
More fixes and tweaks.

Details at http://dev.helma.org/trac/helma/changeset/9465

Modified: apps/gobi/trunk/code/Comment/edit.skin
===================================================================
--- apps/gobi/trunk/code/Comment/edit.skin	2008-12-22 15:11:33 UTC (rev 9464)
+++ apps/gobi/trunk/code/Comment/edit.skin	2008-12-22 16:13:35 UTC (rev 9465)
@@ -9,11 +9,11 @@
   <input type="submit" value="<% msg name='comment_preview' %>" name="preview"
     onclick="return pagePreview(this.form);"/>
   <input type="submit" value="<% msg name='comment_save' %>" name="save" />
-  <a href="<% page.href %>" class="commentLink"><% msg name='cancel' %></a>
+  <a href="<% page.href %>" class="commentLink" onclick="return editCommentCancel(this)"><% msg name='cancel' %></a>
 </p>
 <div class="previewToggle" style="display: none;">
-    <div id="pagePreview"></div>
-    <a href="#" onclick="return continueEditing()"><% msg 'edit_continue' %></a>
+    <div class="pagePreview"></div>
+    <!-- a href="#" onclick="return continueEditing('#editForm')"><% msg 'edit_continue' %></a -->
 </div>
 </form>
 

Modified: apps/gobi/trunk/code/Comment/embed.skin
===================================================================
--- apps/gobi/trunk/code/Comment/embed.skin	2008-12-22 15:11:33 UTC (rev 9464)
+++ apps/gobi/trunk/code/Comment/embed.skin	2008-12-22 16:13:35 UTC (rev 9465)
@@ -4,5 +4,5 @@
 <% this.createtime prefix=" at " %></b>
 <% this.actionlink action="edit" onclick="return editCommentShow(this);" prefix="&nbsp;..." %>
 <% this.actionlink action="delete" onclick="return deleteCommentShow(this);" prefix="&nbsp;..." %>
-<div class="deleteConfirm"></div>
+<div class="commentScratchpad"></div>
 <div class="commentBody"><% this.body %></div>
\ No newline at end of file

Modified: apps/gobi/trunk/code/Page/PageActions.js
===================================================================
--- apps/gobi/trunk/code/Page/PageActions.js	2008-12-22 15:11:33 UTC (rev 9464)
+++ apps/gobi/trunk/code/Page/PageActions.js	2008-12-22 16:13:35 UTC (rev 9465)
@@ -241,7 +241,7 @@
             res.message = msg("preview_message")
             this.renderSkin("page");
             return;
-        } else if (req.data.ajax) {
+        } else if (req.data.ajaxpreview) {
             it.renderSkin("body#preview");
             return;
         }
@@ -284,12 +284,12 @@
             res.data.body += p.renderSkinAsString("edit");
             this.renderSkin("page");
             return;
-        } else if (req.data.ajax) {
+        } else if (req.data.ajaxpreview) {
             var p = newInstance(this.name, this._prototype);
             p.readEditForm(false);
             p.renderSkin("body#preview");
             return;
-        } else if (req.data.edit) {
+        } else if (req.data.ajaxedit) {
             this.renderSkin("edit");
             return;
         }
@@ -447,7 +447,7 @@
             res.message = msg("comment_preview_message")
             this.renderSkin("page");
             return;            
-        } else if (req.data.ajax) {
+        } else if (req.data.ajaxpreview) {
             cmt.renderSkin("body#preview");
             return;
         }

Modified: apps/gobi/trunk/code/Page/skins/commentForm.skin
===================================================================
--- apps/gobi/trunk/code/Page/skins/commentForm.skin	2008-12-22 15:11:33 UTC (rev 9464)
+++ apps/gobi/trunk/code/Page/skins/commentForm.skin	2008-12-22 16:13:35 UTC (rev 9465)
@@ -12,7 +12,7 @@
         class="commentLink"><% msg 'cancel' %></a>
     </p>
     <div class="previewToggle" style="display: none;">
-       <div id="pagePreview"></div>
+       <div class="pagePreview"></div>
        <a href="#" onclick="return continueEditing('#commentForm')"><% msg 'edit_continue' %></a>
     </div>
 </form>

Modified: apps/gobi/trunk/code/Page/skins/create.skin
===================================================================
--- apps/gobi/trunk/code/Page/skins/create.skin	2008-12-22 15:11:33 UTC (rev 9464)
+++ apps/gobi/trunk/code/Page/skins/create.skin	2008-12-22 16:13:35 UTC (rev 9465)
@@ -27,11 +27,11 @@
           onclick="return pagePreview(this.form);">
     <input type="submit" name="save"
           value="<% msg name='create_button' %>">
-    <a href="<% page.href %>" class="commentLink">
+    <a href="./" class="commentLink">
           <% msg name='cancel' %></a>
 </p>
 <div class="previewToggle" style="display: none;">
-   <div id="pagePreview"></div>
+   <div class="pagePreview"></div>
    <a href="#" onclick="return continueEditing()"><% msg 'edit_continue' %></a>
 </div>
 </form>
\ No newline at end of file

Modified: apps/gobi/trunk/code/Page/skins/edit.skin
===================================================================
--- apps/gobi/trunk/code/Page/skins/edit.skin	2008-12-22 15:11:33 UTC (rev 9464)
+++ apps/gobi/trunk/code/Page/skins/edit.skin	2008-12-22 16:13:35 UTC (rev 9465)
@@ -20,7 +20,7 @@
 
 </p>
 <div class="previewToggle" style="display: none;">
-   <div id="pagePreview"></div>
+   <div class="pagePreview"></div>
    <a href="#" onclick="return continueEditing()"><% msg 'edit_continue' %></a>
 </div>
 </form>

Modified: apps/gobi/trunk/code/Page/skins/javascript.skin
===================================================================
--- apps/gobi/trunk/code/Page/skins/javascript.skin	2008-12-22 15:11:33 UTC (rev 9464)
+++ apps/gobi/trunk/code/Page/skins/javascript.skin	2008-12-22 16:13:35 UTC (rev 9465)
@@ -167,36 +167,63 @@
   }
 
   function deleteCommentShow(link) {
-      $(link).next().load(link.href, {ajax: true});
+      var scratchpad = $(link).nextAll('.commentScratchpad:first');
+      scratchpad.html('').hide().load(link.href, { ajax: true }, function() {
+          scratchpad.show('normal', function() {
+              scratchpad.next().show();
+          });
+      });
       return false;
   }
 
   function deleteCommentCancel(link) {
-      var parent = $(link).parents('.deleteConfirm');
-
+      var parent = $(link).parents('.commentScratchpad');
       if (parent.length > 0) {
-          parent.html('');
+          parent.hide('normal', function() {
+              $(this).html('');
+          });
           return false;
       }
       return true;
   }
 
   function editCommentShow(link) {
-      $(link).nextAll('.commentBody:first').load(link.href, {edit: true});
+      var scratchpad = $(link).nextAll('.commentScratchpad:first');
+      var toggle = scratchpad.next().add(scratchpad);
+      scratchpad.html('').hide().load(link.href, { ajaxedit: true }, function() {
+          toggle.toggle('normal', function() {
+              $('html,body').animate({
+                  scrollTop: $(link).offset().top
+              });
+              scratchpad.find('textarea').focus();
+          });
+      });
       return false;
   }
 
+  function editCommentCancel(link) {
+      var parent = $(link).parents('.commentScratchpad');
+      if (parent.length > 0) {
+          parent.next().show();
+          parent.hide('normal');
+          return false;
+      }
+      return true;
+  }
+
+
   function pagePreview(form) {
       var input = $(form).find('[name=body]');
       var action = form.action || location.href;
-      $('#pagePreview').load(action, {
-          ajax: true,
+      var preview = $(form).find('.pagePreview:first') 
+      preview.load(action, {
+          ajaxpreview: true,
           name: $(form).find('[name=name]').val(),
           body: input.val()
       }, function() {
-          $('.previewToggle').show('fast', function() {
+          $('.previewToggle').show('normal', function() {
               $('html,body').animate({
-                  scrollTop: $('#pagePreview').offset().top
+                  scrollTop: preview.offset().top
               });
           });
       });
@@ -205,7 +232,7 @@
   }
 
   function continueEditing(form) {
-      // $('.previewToggle').hide('fast');
+      // $('.previewToggle').hide('normal');
       var scrollTarget = $(form || 'html,body');
       $('html,body').animate({
           scrollTop: scrollTarget.offset().top
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.