summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Lawrence <dlawrence@mozilla.com>2013-05-10 16:57:48 +0200
committerDave Lawrence <dlawrence@mozilla.com>2013-05-10 16:57:48 +0200
commit380a0f8742e23868e01cd31aca113efb8ceb72f5 (patch)
treeaa98a2729a611a5ecaf55f8c910e6427e8977133
parentb5075fdb03efc8732e9d8ba767e8043f577bdbce (diff)
downloadbugzilla-380a0f8742e23868e01cd31aca113efb8ceb72f5.tar.gz
bugzilla-380a0f8742e23868e01cd31aca113efb8ceb72f5.tar.xz
Bug 850135 - hide the textarea custom fields by default with an (edit) link
-rw-r--r--js/field.js15
-rw-r--r--skins/standard/global.css17
-rw-r--r--template/en/default/bug/field.html.tmpl25
3 files changed, 47 insertions, 10 deletions
diff --git a/js/field.js b/js/field.js
index bfb8a8244..6f42fe8a4 100644
--- a/js/field.js
+++ b/js/field.js
@@ -219,14 +219,14 @@ function setupEditLink(id) {
}
/* Hide input/select fields and show the text with (edit) next to it */
-function hideEditableField( container, input, action, field_id, original_value, new_value ) {
+function hideEditableField( container, input, action, field_id, original_value, new_value, hide_input ) {
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, field_id, new_value));
if(field_id != ""){
YAHOO.util.Event.addListener(window, 'load', checkForChangedFieldValues,
- new Array(container, input, field_id, original_value));
+ new Array(container, input, field_id, original_value, hide_input ));
}
}
@@ -276,7 +276,7 @@ function showEditableField (e, ContainerInputArray) {
}
// focus on the first field, this makes it easier to edit
inputs[0].focus();
- if ( type == "input" ) {
+ if ( type == "input" || type == "textarea" ) {
inputs[0].select();
}
}
@@ -300,8 +300,11 @@ function checkForChangedFieldValues(e, ContainerInputArray ) {
var el = document.getElementById(ContainerInputArray[2]);
var unhide = false;
if ( el ) {
- if ( el.value != ContainerInputArray[3] ||
- ( el.value == "" && el.id != "alias" && el.id != "qa_contact" ) ) {
+ if ( !ContainerInputArray[4]
+ && (el.value != ContainerInputArray[3]
+ || (el.value == "" && el.id != "alias" && el.id != "qa_contact")) )
+ {
+
unhide = true;
}
else {
@@ -310,7 +313,7 @@ function checkForChangedFieldValues(e, ContainerInputArray ) {
if ( set_default ) {
if(set_default.checked){
unhide = true;
- }
+ }
}
}
}
diff --git a/skins/standard/global.css b/skins/standard/global.css
index f50ccd02d..325b82ca3 100644
--- a/skins/standard/global.css
+++ b/skins/standard/global.css
@@ -536,8 +536,23 @@ input.required, select.required, span.required_explanation {
list-style-type: none;
}
+.field_textarea_readonly {
+ margin: 2px;
+ padding: 4px;
+ overflow: auto;
+ float: left;
+ max-width: 30em;
+ max-height: 7em;
+ border: 1px solid #CCC;
+}
+
+.field_textarea_readonly pre {
+ font-family: monospace;
+ white-space: pre-wrap;
+}
+
/* custom styles for inline instances of autocomplete input fields */
-.yui-skin-sam .yui-ac-input { position:static !important;
+.yui-skin-sam .yui-ac-input { position:static !important;
vertical-align:middle !important; }
.yui-skin-sam .yui-ac-container { left:0px !important; }
.yui-skin-sam .yui-ac { display: inline-block; }
diff --git a/template/en/default/bug/field.html.tmpl b/template/en/default/bug/field.html.tmpl
index e157a80ed..74f632c54 100644
--- a/template/en/default/bug/field.html.tmpl
+++ b/template/en/default/bug/field.html.tmpl
@@ -181,9 +181,28 @@
</script>
[% CASE constants.FIELD_TYPE_TEXTAREA %]
- [% INCLUDE global/textarea.html.tmpl
- id = field.name name = field.name minrows = 4 maxrows = 8
- cols = 60 defaultcontent = value mandatory = field.is_mandatory %]
+ <div id="[% field.name FILTER html %]_edit_container" class="bz_default_hidden">
+ <div>
+ (<a href="#" id="[% field.name FILTER html %]_edit_action">edit</a>)
+ </div>
+ [% IF value %]
+ <pre class="field_textarea_readonly">[% value FILTER html %]</pre>
+ [% END %]
+ </div>
+ <div id="[% field.name FILTER html %]_input">
+ [% INCLUDE global/textarea.html.tmpl
+ id = field.name name = field.name minrows = 4 maxrows = 8
+ cols = 60 defaultcontent = value mandatory = field.is_mandatory %]
+ </div>
+ <script type="text/javascript">
+ hideEditableField('[% field.name FILTER js %]_edit_container',
+ '[% field.name FILTER js %]_input',
+ '[% field.name FILTER js %]_edit_action',
+ '[% field.name FILTER js %]',
+ '[% value FILTER js %]',
+ '',
+ true);
+ </script>
[% CASE constants.FIELD_TYPE_BUG_URLS %]
[% '<ul class="bug_urls">' IF value.size %]
[% FOREACH bug_url = value %]