Commits

Olemis Lang committed 68a6509

BH Theme #146 : Workflow drop down visible on affix

  • Participants
  • Parent commits 0122048
  • Branches t146_inline_edit

Comments (0)

Files changed (2)

File t146/t146_r1420132_inplace_ticket_fields.diff

 # HG changeset patch
-# Parent 5e69885ad4e2d7587362f4edff211f0e331999bc
+# Parent eceb6a79bbafe3fb94d6b4d5efee3d46187f8356
 BH Theme #146 : Edit ticket fields in place
 
-diff -r 5e69885ad4e2 bhtheme/htdocs/bloodhound.css
---- a/bhtheme/htdocs/bloodhound.css	Tue Dec 11 23:37:48 2012 -0500
-+++ b/bhtheme/htdocs/bloodhound.css	Wed Dec 12 00:31:39 2012 -0500
+diff -r eceb6a79bbaf bhtheme/htdocs/bloodhound.css
+--- a/bhtheme/htdocs/bloodhound.css	Fri Dec 14 04:37:59 2012 -0500
++++ b/bhtheme/htdocs/bloodhound.css	Fri Dec 14 04:41:15 2012 -0500
 @@ -222,6 +222,11 @@
    margin-left: 25px;
  }
  /* @end */
  
  /* @group Quick Ticket fieldset */
-diff -r 5e69885ad4e2 bhtheme/templates/bh_ticket.html
---- a/bhtheme/templates/bh_ticket.html	Tue Dec 11 23:37:48 2012 -0500
-+++ b/bhtheme/templates/bh_ticket.html	Wed Dec 12 00:31:39 2012 -0500
+diff -r eceb6a79bbaf bhtheme/templates/bh_ticket.html
+--- a/bhtheme/templates/bh_ticket.html	Fri Dec 14 04:37:59 2012 -0500
++++ b/bhtheme/templates/bh_ticket.html	Fri Dec 14 04:41:15 2012 -0500
 @@ -41,6 +41,32 @@
          $(".local-nav a").click(function() { $($(this).attr('href')).removeClass('collapsed').parent().removeClass("collapsed"); });
          $('.trac-nav').hide();
 +              var fieldurl = fc.find('a').attr('href');
 +              var fieldnm = fc.attr('id').substr(3);
 +              fc.empty();
-+              var editor = $('#field-' + fieldnm);
++              var editor = $('#properties #field-' + fieldnm);
 +              if (editor.length == 0)
 +                editor = $('#editor-' + fieldnm);
 +              var fieldval = editor.val();
                                  <option py:if="field.optional"></option>
                                  <option py:for="option in field.options"
                                          selected="${value == option or None}"
-diff -r 5e69885ad4e2 bhtheme/templates/bh_ticket_box.html
---- a/bhtheme/templates/bh_ticket_box.html	Tue Dec 11 23:37:48 2012 -0500
-+++ b/bhtheme/templates/bh_ticket_box.html	Wed Dec 12 00:31:39 2012 -0500
+diff -r eceb6a79bbaf bhtheme/templates/bh_ticket_box.html
+--- a/bhtheme/templates/bh_ticket_box.html	Fri Dec 14 04:37:59 2012 -0500
++++ b/bhtheme/templates/bh_ticket_box.html	Fri Dec 14 04:41:15 2012 -0500
 @@ -47,7 +47,8 @@
                <py:if test="field"><i18n:msg params="field">${field.label or field.name}:</i18n:msg></py:if>
              </h5>

File t146/t146_r1420132_inplace_ticket_form.diff

 
 diff -r c5495961f386 bhtheme/htdocs/bloodhound.css
 --- a/bhtheme/htdocs/bloodhound.css	Fri Dec 14 02:02:35 2012 -0500
-+++ b/bhtheme/htdocs/bloodhound.css	Fri Dec 14 03:17:28 2012 -0500
++++ b/bhtheme/htdocs/bloodhound.css	Fri Dec 14 04:37:37 2012 -0500
 @@ -202,10 +202,6 @@
    width: 505px;
  }
  }
 diff -r c5495961f386 bhtheme/templates/bh_ticket.html
 --- a/bhtheme/templates/bh_ticket.html	Fri Dec 14 02:02:35 2012 -0500
-+++ b/bhtheme/templates/bh_ticket.html	Fri Dec 14 03:17:28 2012 -0500
-@@ -58,10 +58,17 @@
++++ b/bhtheme/templates/bh_ticket.html	Fri Dec 14 04:37:37 2012 -0500
+@@ -58,10 +58,43 @@
                  editor = $('#editor-' + fieldnm);
                var fieldval = editor.val();
                editor = editor.clone(false).appendTo(fc).val(fieldval);
 +                submit_ticket = $(submit_ticket).prepend(editor)
 +                    .appendTo(fc);
 +                editor.wrap('<div class="btn-group"></div>')
++
++                // Workflow actions
++                var actions_box = submit_ticket.find('#workflow-actions')
++                    .click(function(e) { e.stopPropagation(); });
++                $('#action').children('div').each(function() {
++                    var action_ui = $(this).clone(false).prependTo(actions_box)
++                        .wrap('<li style="padding: 5px 10px"></li>');
++                    var action_trigger = action_ui.find('input[name=action]');
++                    function action_click() {
++                        var newlabel = action_ui.find('label[for^=action_]')
++                            .text();
++                        $('#submit-action-label').text(newlabel);
++
++                        // Enabled | disable action controls
++                        actions_box.find('input[name=action]').each(function() {
++                            $(this).siblings().find("*[id]")
++                                .enable($(this).checked());
++                            $(this).siblings().filter("*[id]")
++                                .enable($(this).checked());
++                          });
++                      }
++                    action_trigger.click(action_click);
++                    if (action_trigger.attr('checked')) {
++                      action_click();
++                    }
++                  })
 +              }
              });
          }
    
-@@ -397,7 +404,8 @@
+@@ -397,7 +430,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 +601,28 @@
+@@ -593,5 +627,24 @@
          </bh:widget>
        </div>
      </div>
 +    <script type="text/x-tmpl" id="tmpl-inplace-submit">
 +      <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">Update</button>
-+      <button class="btn btn-primary dropdown-toggle" data-toggle="dropdown">
++        <button 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">
 +          <span class="caret"></span>
 +        </button>
-+        <ul class="dropdown-menu" id="workflow-actions">
-+          <li class="divider"></li>
-+          <li style="padding: 5px 10px">
-+            <div class="btn-group">
-+              <button 
-+                  value="Submit changes" name="submit" class="btn">
-+                Change ticket status</button>
-+            </div>
-+          </li>
++        <ul class="dropdown-menu">
++          <fieldset id="workflow-actions">
++          </fieldset>
 +        </ul>
 +      </div>
-+      <div class="btn-group">
++      <div class="btn-group pull-right">
 +      <button class="btn-link">Discard changes</button></div>
 +      </div>
 +    </script>