summaryrefslogtreecommitdiffstats
path: root/extensions/ComponentWatching/template/en/default
diff options
context:
space:
mode:
authorByron Jones <glob@mozilla.com>2015-01-05 07:11:48 +0100
committerByron Jones <glob@mozilla.com>2015-01-05 07:11:48 +0100
commit4762c10e99a853f7790b9c651125e251ffaa3f4d (patch)
treeca7a75ab1abd0257bce0db6451e6a58c108ff9df /extensions/ComponentWatching/template/en/default
parentb78ed6c10802fa83bc6eb70729a562866ad8f4c7 (diff)
downloadbugzilla-4762c10e99a853f7790b9c651125e251ffaa3f4d.tar.gz
bugzilla-4762c10e99a853f7790b9c651125e251ffaa3f4d.tar.xz
Bug 696726: automatically create "watch users" for components
Diffstat (limited to 'extensions/ComponentWatching/template/en/default')
-rw-r--r--extensions/ComponentWatching/template/en/default/hook/admin/components/edit-common-rows.html.tmpl52
-rw-r--r--extensions/ComponentWatching/template/en/default/hook/global/messages-component_updated_fields.html.tmpl3
2 files changed, 54 insertions, 1 deletions
diff --git a/extensions/ComponentWatching/template/en/default/hook/admin/components/edit-common-rows.html.tmpl b/extensions/ComponentWatching/template/en/default/hook/admin/components/edit-common-rows.html.tmpl
index 4f92097ff..e6a04f092 100644
--- a/extensions/ComponentWatching/template/en/default/hook/admin/components/edit-common-rows.html.tmpl
+++ b/extensions/ComponentWatching/template/en/default/hook/admin/components/edit-common-rows.html.tmpl
@@ -9,12 +9,62 @@
<tr>
<th class="field_label"><label for="watch_user">Watch User:</label></th>
<td>
+ [% IF !comp.id || !comp.watch_user %]
+ <input type="checkbox" id="watch_user_auto" name="watch_user_auto" value="1" checked>
+ <label for="watch_user_auto">Automatic</label>
+ <span id="watch_user_suggestion"></span>
+ [% edit_size = 44 %]
+ [% ELSE %]
+ [% edit_size = 64 %]
+ [% END %]
[% INCLUDE global/userselect.html.tmpl
name => "watch_user"
id => "watch_user"
value => comp.watch_user.login
- size => 64
+ size => edit_size
emptyok => 1
%]
</td>
</tr>
+
+<script>
+function sanitise_name(name) {
+ return name.toLowerCase()
+ .replace(/[^a-z0-9_]/g, '-')
+ .replace(/-+/g, '-')
+ .replace(/(^-|-$)/g, '');
+}
+
+function update_watch_user() {
+ var Dom = YAHOO.util.Dom;
+ if (Dom.get('watch_user_auto').checked) {
+ Dom.addClass('watch_user', 'bz_default_hidden');
+
+ var component = Dom.get('component').value;
+ var watch = '';
+ if (component == '') {
+ watch = '(no component name)';
+ }
+ else {
+ watch = sanitise_name(component) +
+ '@' + sanitise_name('[% product.name FILTER js %]') + '.bugs';
+ }
+ Dom.get('watch_user_suggestion').innerHTML = ' : <b>' + watch + '</b>';
+ Dom.get('watch_user').value = watch;
+ }
+ else {
+ Dom.removeClass('watch_user', 'bz_default_hidden');
+ Dom.get('watch_user_suggestion').innerHTML = '';
+ if (Dom.get('watch_user').value == '(no component name)')
+ Dom.get('watch_user').value = '';
+ }
+}
+
+YAHOO.util.Event.onDOMReady(function() {
+ if (document.getElementById('watch_user_auto')) {
+ YAHOO.util.Event.addListener('component', 'keyup', update_watch_user);
+ YAHOO.util.Event.addListener('watch_user_auto', 'click', update_watch_user);
+ update_watch_user();
+ }
+});
+</script>
diff --git a/extensions/ComponentWatching/template/en/default/hook/global/messages-component_updated_fields.html.tmpl b/extensions/ComponentWatching/template/en/default/hook/global/messages-component_updated_fields.html.tmpl
index 38c7e8c8a..f9554b072 100644
--- a/extensions/ComponentWatching/template/en/default/hook/global/messages-component_updated_fields.html.tmpl
+++ b/extensions/ComponentWatching/template/en/default/hook/global/messages-component_updated_fields.html.tmpl
@@ -13,3 +13,6 @@
<li>Watch User deleted</li>
[% END %]
[% END %]
+[% IF changes.watch_user_login.defined %]
+ <li>Watch User renamed to '[% comp.watch_user.login FILTER html %]'</li>
+[% END %]