Commits

Olemis Lang  committed eff1835 Merge

BH Theme #146 : Robust assignment of ticket fields values . Respect textarea dimensions

  • Participants
  • Parent commits f7601c6, 4fdf670
  • Branches t146_inline_edit

Comments (0)

Files changed (3)

+t289/t289_r1418195_anchor_pos_v2.diff
 #hgsvn/rm_files.diff
 #t146/t146_r1418195_scrollspy_btn.diff
 t146/t146_r1418195_ticket_header.diff

File t146/t146_r1420132_inplace_ticket_fields.diff

 # HG changeset patch
-# Parent d7d613545ed66cf959b02dc2ba85521d08d779cb
+# Parent 5e69885ad4e2d7587362f4edff211f0e331999bc
 BH Theme #146 : Edit ticket fields in place
 
-diff -r d7d613545ed6 bhtheme/templates/bh_ticket.html
---- a/bhtheme/templates/bh_ticket.html	Tue Dec 11 23:08:14 2012 -0500
-+++ b/bhtheme/templates/bh_ticket.html	Tue Dec 11 23:29:12 2012 -0500
-@@ -41,6 +41,34 @@
+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
+@@ -222,6 +222,11 @@
+   margin-left: 25px;
+ }
+ 
++.ticket textarea {
++  height: auto;
++  width: auto;
++}
++
+ /* @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
+@@ -41,6 +41,32 @@
          $(".local-nav a").click(function() { $($(this).attr('href')).removeClass('collapsed').parent().removeClass("collapsed"); });
          $('.trac-nav').hide();
          $('.trac-topnav').hide();
 +        function modify_ticket() {
 +          $('[data-edit="inplace"]').each(function() {
 +              var fc = $(this);
-+              var fieldval = fc.find('a').text();
 +              var fieldurl = fc.find('a').attr('href');
 +              var fieldnm = fc.attr('id').substr(3);
 +              fc.empty();
 +              var editor = $('#field-' + fieldnm);
 +              if (editor.length == 0)
 +                editor = $('#editor-' + fieldnm);
-+              else
-+                editor.val(fieldval);
-+              editor = editor.clone(true).appendTo(fc);
++              var fieldval = editor.val();
++              editor = editor.clone(false).appendTo(fc).val(fieldval);
 +              if (editor.prop('tagName') == 'TEXTAREA') {
 +                if (editor.is('.wikitext'))
 +                  addWikiFormattingToolbar(editor.get(0));
          $('body').scrollspy({ 
              'target' : '.local-nav' , 
              'offset' : $('.stickyBox').height() + 40
-@@ -173,7 +201,7 @@
+@@ -173,7 +199,7 @@
                          (_('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'),
                      )">
                <div>
                  <small>
-@@ -408,9 +436,10 @@
+@@ -408,9 +434,10 @@
                                field.edit_label or field.label or field.name}:</label>
                            </th>
                            <td class="col${idx + 1}" py:if="idx == 0 or not fullrow"
                                  <option py:if="field.optional"></option>
                                  <option py:for="option in field.options"
                                          selected="${value == option or None}"
-diff -r d7d613545ed6 bhtheme/templates/bh_ticket_box.html
---- a/bhtheme/templates/bh_ticket_box.html	Tue Dec 11 23:08:14 2012 -0500
-+++ b/bhtheme/templates/bh_ticket_box.html	Tue Dec 11 23:29:12 2012 -0500
+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
 @@ -47,7 +47,8 @@
                <py:if test="field"><i18n:msg params="field">${field.label or field.name}:</i18n:msg></py:if>
              </h5>

File t289/t289_r1418195_anchor_pos_v2.diff

+# HG changeset patch
+# Parent d03f19f9bd67468d70da41a62efe0ef09ae003b2
+BH Theme #289 : Revert previous solution for #167 . Fix using onhashchange
+
+diff -r d03f19f9bd67 bhtheme/htdocs/js/theme.js
+--- a/bhtheme/htdocs/js/theme.js	Fri Dec 07 06:20:33 2012 +0000
++++ b/bhtheme/htdocs/js/theme.js	Sat Dec 08 23:53:02 2012 -0500
+@@ -115,28 +115,30 @@
+   var h = target.height();
+   target.parent('.stickyBox').height(h);
+ 
+-  // Create style tag to fix anchor position
+-  function _sticky_offset_rules(_h) {
+-    return '.stickyBox~* form[id], .stickyBox~* div[id] { margin-top:-' +
+-      _h + 'px; padding-top: ' + _h + 'px } ' +
+-      '.stickyBox, .stickyBox [id] { margin-top: 0px ; padding-top: 0px }';
+-  }
+-  $('<style id="sticky-offset" /> ').text( _sticky_offset_rules(h) )
+-      .appendTo('head');
+-
+   target = h = null;
+   $(window).on('scroll.affix.data-api', function() {
+-      var affix_data = $(selector).data('affix');
+       var target = $(selector);
++      var affix_data = target.data('affix');
+ 
+       if (affix_data && !affix_data.affixed) {
+         var h = target.height();
+         target.parent('.stickyBox').height(h);
+-        $('style#sticky-offset').text(_sticky_offset_rules(h))
+       }
+       else {
+         target.parent('.stickyBox').css('height', '');
+       }
+     })
++  $(function() {
++      var prev_onhashchange = window.onhashchange;
++
++      window.onhashchange = function() {
++        prev_onhashchange();
++        var target = $(selector);
++        var affix_data = target.data('affix');
++    
++        if (affix_data && !affix_data.affixed)
++          window.scrollBy(0, -target.height());
++      }
++    })
+ }
+