Commits

Olemis Lang committed 1f8e494

BH Theme #146 : In-place submit form . Sticky panel relocated and other minor changes

Comments (0)

Files changed (1)

t146/t146_r1420132_inplace_ticket_form.diff

 # HG changeset patch
-# Parent da551ebf15e9b37a196f868db05517def4a65f36
+# Parent f47b231e80501b7916de7d10374b856cbf7a1a81
 BH Theme #146 : In-place editing form
 
-diff -r da551ebf15e9 bhtheme/htdocs/bloodhound.css
---- a/bhtheme/htdocs/bloodhound.css	Fri Dec 14 04:41:19 2012 -0500
-+++ b/bhtheme/htdocs/bloodhound.css	Fri Dec 14 13:11:33 2012 -0500
+diff -r f47b231e8050 bhtheme/htdocs/bloodhound.css
+--- a/bhtheme/htdocs/bloodhound.css	Fri Dec 14 23:44:28 2012 -0500
++++ b/bhtheme/htdocs/bloodhound.css	Sat Dec 15 00:10:16 2012 -0500
 @@ -202,10 +202,6 @@
    width: 505px;
  }
  /* Revert some changes introduced in 2.1.0 */
  
  h6 {
-diff -r da551ebf15e9 bhtheme/templates/bh_ticket.html
---- a/bhtheme/templates/bh_ticket.html	Fri Dec 14 04:41:19 2012 -0500
-+++ b/bhtheme/templates/bh_ticket.html	Fri Dec 14 13:11:33 2012 -0500
-@@ -48,20 +48,70 @@
+diff -r f47b231e8050 bhtheme/templates/bh_ticket.html
+--- a/bhtheme/templates/bh_ticket.html	Fri Dec 14 23:44:28 2012 -0500
++++ b/bhtheme/templates/bh_ticket.html	Sat Dec 15 00:10:16 2012 -0500
+@@ -25,7 +25,16 @@
+       xmlns:py="http://genshi.edgewall.org/"
+       xmlns:i18n="http://genshi.edgewall.org/i18n"
+       xmlns:bh="http://issues.apache.org/bloodhound/wiki/Ui/Dashboard"
+-      py:with="preview_mode = 'preview' in req.args">
++      py:with="preview_mode = 'preview' in req.args;
++          can_append = 'TICKET_APPEND' in perm(ticket.resource);
++          can_create = 'TICKET_CREATE' in perm(ticket.resource) and not ticket.exists;
++          can_modify = 'TICKET_CHGPROP' in perm(ticket.resource);
++          can_edit = 'TICKET_EDIT_DESCRIPTION' in perm(ticket.resource);
++          only_for_admin = 'TICKET_ADMIN' in perm(ticket.resource);
++          has_edit_comment = 'TICKET_EDIT_COMMENT' in perm(ticket.resource);
++          has_property_editor = not version and version != 0 and not cnum_edit
++                                and (can_append or can_modify or can_edit or can_create);
++          colspan = 'span8' if bhdb else 'span12'">
+   <xi:include href="layout.html" />
+   <xi:include href="widget_macros.html" />
+ 
+@@ -42,30 +51,82 @@
+         $('.trac-nav').hide();
+         $('.trac-topnav').hide();
+ 
++        <py:if test="has_property_editor">
+         // Install in place editing
+ 
+         var modify_elem = $('#modify');
          modify_elem.parent().hide();
    
          function modify_ticket() {
 +                            .attr('title', action_help);
 +                  })
 +              }
-+            });
-+        }
+             });
+         }
+-  
 +
 +        function revert_ticket() {
 +          $('[data-edit="inplace"]').each(function() {
 +              var fc = $(this).removeClass('edit-active');
 +              fc.html(fc.attr('data-edit-orig'));
-             });
-         }
-   
-@@ -397,7 +447,8 @@
++            });
++        }
++
+         $('.local-nav a[href = "#inplace-edit"]').click(modify_ticket);
++        </py:if>
+ 
+         $('body').scrollspy({ 
+             'target' : '.local-nav' , 
+@@ -143,88 +204,89 @@
+       <a href="#comment:$cnum" class="$cls">$prefix$cnum</a>
+     </py:def>
+ 
+-    <div id="content" class="ticket row"
+-         py:with="can_append = 'TICKET_APPEND' in perm(ticket.resource);
+-                  can_create = 'TICKET_CREATE' in perm(ticket.resource) and not ticket.exists;
+-                  can_modify = 'TICKET_CHGPROP' in perm(ticket.resource);
+-                  can_edit = 'TICKET_EDIT_DESCRIPTION' in perm(ticket.resource);
+-                  only_for_admin = 'TICKET_ADMIN' in perm(ticket.resource);
+-                  has_edit_comment = 'TICKET_EDIT_COMMENT' in perm(ticket.resource);
+-                  has_property_editor = not version and version != 0 and not cnum_edit
+-                                        and (can_append or can_modify or can_edit or can_create);
+-                  colspan = 'span8' if bhdb else 'span12'">
++    <div id="content" class="ticket row">
+       <div class="trac-topnav span2" py:if="ticket.exists and has_property_editor">
+         <a href="#propertyform" title="Go to the ticket editor">Modify</a> &darr;
+       </div>
+       <br/>
+ 
+       <div class="$colspan">
+-        <div class="stickyBox">
+-          <div id="overview" class="stickyStatus $colspan">
+-            <div class="whitebox"></div>
+-            <div class="properties">
+-              <h2 class="summary searchable clip-affix" py:choose=""
+-                  data-edit="${'inplace' if can_modify or can_create else None}"
+-                  id="vc-summary">
+-                <py:when test="ticket.exists">&#9734; $ticket.summary</py:when>
+-                <py:otherwise>Create Ticket</py:otherwise>
+-              </h2>
+-            </div>
+-            <div class="row">
+-              <span class="ownership">
+-                <py:choose test="">
+-                  <py:when test="ticket.exists">
+-                    <a href="${href.ticket(ticket.id)}"
+-                        i18n:msg="id">Ticket #${ticket.id}</a>
+-                  </py:when>
+-                  <py:otherwise>
+-                    New Ticket <small><span py:if="preview_mode and ticket.type" class="status">(${ticket.type})</span></small>
+-                  </py:otherwise>
+-                </py:choose>
+-                <py:if test="ticket.exists"> - 
+-                  <py:if test="ticket.changetime != ticket.time">
+-                    <span i18n:msg="modified">Last modified 
+-                      <time datetime="${ticket.changetime.strftime('%Y-%m-%d')}">
+-                        ${pretty_dateinfo(ticket.changetime)}
+-                      </time>.
+-                    </span>
+-                  </py:if>
+-                </py:if>
+-                <span id="h_owner">Assigned to
+-                  ${(owner_link if defined('owner_link') else authorinfo(ticket.owner)) if ticket.owner else ''}.
+-                </span>
+-              </span>
+-            </div>
+-            <div class="local-nav" py:if="ticket.exists"
+-                py:with="sections = (
+-                        (_('Overview'), 'content', True, _('View ticket fields and description'), 'icon-list'),
+-                        (_('Attachments'), 'attachments', attachments.attachments or attachments.can_create, _('Go to the list of attachments'), 'icon-file'),
+-                        (_('Comments'), 'changelog', True, _('Go to the changelog'), 'icon-comment'),
+-                        (_('Add comment'), 'propertyform', ticket.exists and can_append, _('Go to the ticket editor'), 'icon-plus-sign'),
+-                        (_('Modify Ticket'), 'inplace-edit', can_modify or can_edit or can_create, _('Modify ticket fields and description'), 'icon-edit'),
+-                    )">
+-              <div>
+-                <small>
+-                  <ul class="nav btn-group">
+-                    <li py:for="s in sections" py:if="s[2]" class="btn">
+-                      <a href="#${s[1]}" title="${s[3]}">
+-                        <i class="${s[4]}"></i>
+-                        ${s[0]}
+-                      </a>
+-                    </li>
+-                  </ul>
+-                </small>
+-              </div>
+-            </div>
+-            <div class="stickyEndMark"></div>
+-          </div>
+-        </div>
+-        <script type="text/javascript">
+-          setup_sticky_panel('#overview');
+-        </script>
+         <py:if test="ticket.exists">
+           <div class="row">
+-            <div class="$colspan">
++            <div class="$colspan"><form py:strip="not has_property_editor" method="post" 
++                id="inplace-propertyform"
++                action="${href.ticket(ticket.id) + '#trac-add-comment' if ticket.exists
++                          else href.newticket() + '#ticket'}">
++              <py:if test="has_property_editor">
++                <input type="hidden" name="start_time" 
++                    value="${to_utimestamp(start_time)}" />
++                <input type="hidden" name="view_time" 
++                    value="${to_utimestamp(ticket['changetime'])}" />
++              </py:if>
++              <div class="stickyBox">
++                <div id="overview" class="stickyStatus $colspan">
++                  <div class="whitebox"></div>
++                  <div class="properties">
++                    <h2 class="summary searchable clip-affix" py:choose=""
++                        data-edit="${'inplace' if can_modify or can_create else None}"
++                        id="vc-summary">
++                      <py:when test="ticket.exists">&#9734; $ticket.summary</py:when>
++                      <py:otherwise>Create Ticket</py:otherwise>
++                    </h2>
++                  </div>
++                  <div class="row">
++                    <span class="ownership">
++                      <py:choose test="">
++                        <py:when test="ticket.exists">
++                          <a href="${href.ticket(ticket.id)}"
++                              i18n:msg="id">Ticket #${ticket.id}</a>
++                        </py:when>
++                        <py:otherwise>
++                          New Ticket <small><span py:if="preview_mode and ticket.type" class="status">(${ticket.type})</span></small>
++                        </py:otherwise>
++                      </py:choose>
++                      <py:if test="ticket.exists"> - 
++                        <py:if test="ticket.changetime != ticket.time">
++                          <span i18n:msg="modified">Last modified 
++                            <time datetime="${ticket.changetime.strftime('%Y-%m-%d')}">
++                              ${pretty_dateinfo(ticket.changetime)}
++                            </time>.
++                          </span>
++                        </py:if>
++                      </py:if>
++                      <span id="h_owner">Assigned to
++                        ${(owner_link if defined('owner_link') else authorinfo(ticket.owner)) if ticket.owner else ''}.
++                      </span>
++                    </span>
++                  </div>
++                  <div class="local-nav" py:if="ticket.exists"
++                      py:with="sections = (
++                              (_('Overview'), 'content', True, _('View ticket fields and description'), 'icon-list'),
++                              (_('Attachments'), 'attachments', attachments.attachments or attachments.can_create, _('Go to the list of attachments'), 'icon-file'),
++                              (_('Comments'), 'changelog', True, _('Go to the changelog'), 'icon-comment'),
++                              (_('Add comment'), 'propertyform', ticket.exists and can_append, _('Go to the ticket editor'), 'icon-plus-sign'),
++                              (_('Modify Ticket'), 'inplace-edit', can_modify or can_edit or can_create, _('Modify ticket fields and description'), 'icon-edit'),
++                          )">
++                    <div>
++                      <small>
++                        <ul class="nav btn-group">
++                          <li py:for="s in sections" py:if="s[2]" class="btn">
++                            <a href="#${s[1]}" title="${s[3]}">
++                              <i class="${s[4]}"></i>
++                              ${s[0]}
++                            </a>
++                          </li>
++                        </ul>
++                      </small>
++                    </div>
++                  </div>
++                  <div class="stickyEndMark"></div>
++                </div>
++              </div>
++              <script type="text/javascript">
++                setup_sticky_panel('#overview');
++              </script>
++
+               <div>
+                 <div class="row">
+                   <div class="span4">
+@@ -291,7 +353,7 @@
+               <xi:include href="bh_ticket_box.html"
+                   py:with="preview_mode = change_preview.fields ; 
+                       colcount = 4 if bhdb else 6"/>
+-            </div>
++            </form></div>
+ 
+             <!--! do not show attachments for old versions of this ticket or for new tickets -->
+             <div class="$colspan" py:if="not version and version != 0 and ticket.exists">
+@@ -397,7 +459,8 @@
                          <th><label for="field-summary">Summary:</label></th>
                          <td class="fullrow" colspan="3">
                            <input type="text" id="field-summary" name="field_summary"
                          </td>
                        </tr>
                        <py:if test="only_for_admin">
-@@ -593,5 +644,27 @@
+@@ -593,5 +656,28 @@
          </bh:widget>
        </div>
      </div>
 +
-+    <script type="text/x-tmpl" id="tmpl-inplace-submit">
++    <script type="text/x-tmpl" id="tmpl-inplace-submit" py:if="has_property_editor">
 +      <div class="btn-toolbar" style="margin: 0px">
 +      <div class="btn-group input-append">
-+        <button class="btn btn-primary" type="submit" value="Submit changes" name="submit">
++        <button id="edit-submit" class="btn btn-primary" type="submit" 
++            value="Submit changes" name="submit">
 +          Update (<span id="submit-action-label"></span>)
 +        </button>
 +        <button class="btn btn-primary dropdown-toggle" data-toggle="dropdown">