]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 626658 - Add (take) link to bug edit page to allow quick assigning to the current...
authorDavid Lawrence <dlawrence@mozilla.com>
Fri, 21 Jan 2011 04:46:40 +0000 (23:46 -0500)
committerDavid Lawrence <dlawrence@mozilla.com>
Fri, 21 Jan 2011 04:46:40 +0000 (23:46 -0500)
r/a=mkanat

js/field.js
template/en/default/bug/edit.html.tmpl

index 6d78a60ce04990c1f58141bf6fef649f53f35737..aa9cd6c7e078dc352eda31ba31b74ee2540f21bd 100644 (file)
@@ -211,11 +211,11 @@ function setupEditLink(id) {
 }
 
 /* Hide input fields and show the text with (edit) next to it */  
-function hideEditableField( container, input, action, field_id, original_value ) {
+function hideEditableField( container, input, action, field_id, original_value, new_value ) {
     YAHOO.util.Dom.removeClass(container, 'bz_default_hidden');
     YAHOO.util.Dom.addClass(input, 'bz_default_hidden');
     YAHOO.util.Event.addListener(action, 'click', showEditableField,
-                                 new Array(container, input));
+                                 new Array(container, input, new_value));
     if(field_id != ""){
         YAHOO.util.Event.addListener(window, 'load', checkForChangedFieldValues,
                         new Array(container, input, field_id, original_value));
@@ -227,9 +227,9 @@ function hideEditableField( container, input, action, field_id, original_value )
  *
  * var e: the event
  * var ContainerInputArray: An array containing the (edit) and text area and the input being displayed
- * var ContainerInputArray[0]: the conainer that will be hidden usually shows the (edit) text
+ * var ContainerInputArray[0]: the container that will be hidden usually shows the (edit) or (take) text
  * var ContainerInputArray[1]: the input area and label that will be displayed
- *
+ * var ContainerInputArray[2]: the new value to set the input field to when (take) is clicked
  */
 function showEditableField (e, ContainerInputArray) {
     var inputs = new Array();
@@ -246,6 +246,11 @@ function showEditableField (e, ContainerInputArray) {
         inputs = inputArea.getElementsByTagName('input');
     }
     if ( inputs.length > 0 ) {
+        // Change the first field's value to ContainerInputArray[2]
+        // if present before focusing.
+        if (ContainerInputArray[2]) {
+            inputs[0].value = ContainerInputArray[2];
+        }
         // focus on the first field, this makes it easier to edit
         inputs[0].focus();
         inputs[0].select();
index 744afeb2d154b71e1faf600b966ca544a18ac31c..e8eaaad1f019436838df584412e79184c8440727 100644 (file)
             <span>
               [% INCLUDE global/user.html.tmpl who = bug.assigned_to %]
               (<a href="#" id="bz_assignee_edit_action">edit</a>)
+              [% IF bug.assigned_to.id != user.id %]
+                (<a title="Reassign to yourself" 
+                    href="#" id="bz_assignee_take_action">take</a>)
+              [% END %]
             </span>
           </div>
           <div id="bz_assignee_input">
                              'bz_assignee_edit_action', 
                              'assigned_to', 
                              '[% bug.assigned_to.login FILTER js %]' );
+           hideEditableField('bz_assignee_edit_container',
+                             'bz_assignee_input',
+                             'bz_assignee_take_action',
+                             'assigned_to',
+                             '[% bug.assigned_to.login FILTER js %]',
+                             '[% user.login FILTER js %]' );
            initDefaultCheckbox('assignee');                  
           </script>
         [% ELSE %]