##// END OF EJS Templates
Changed the notifications to use a hierarchy UI...
Eric Davis -
r4108:26ef9da02b7e
parent child
Show More
@@ -71,4 +71,14 module SettingsHelper
71 label = options.delete(:label)
71 label = options.delete(:label)
72 label != false ? content_tag("label", l(label || "setting_#{setting}")) : ''
72 label != false ? content_tag("label", l(label || "setting_#{setting}")) : ''
73 end
73 end
74
75 # Renders a notification field for a Redmine::Notifiable option
76 def notification_field(notifiable)
77 return content_tag(:label,
78 check_box_tag('settings[notified_events][]',
79 notifiable.name,
80 Setting.notified_events.include?(notifiable.name)) +
81 l_or_humanize(notifiable.name, :prefix => 'label_'),
82 :class => notifiable.parent.present? ? "parent" : '')
83 end
74 end
84 end
@@ -12,11 +12,13
12
12
13 </div>
13 </div>
14
14
15 <fieldset class="box settings" id="notified_events"><legend><%=l(:text_select_mail_notifications)%></legend>
15 <fieldset class="box" id="notified_events"><legend><%=l(:text_select_mail_notifications)%></legend>
16 <%= setting_multiselect(:notified_events,
16 <%= hidden_field_tag 'settings[notified_events][]', '' %>
17 @notifiables.collect {|notifiable| [l_or_humanize(notifiable, :prefix => 'label_'), notifiable]}, :label => false) %>
17 <% @notifiables.each do |notifiable| %>
18
18 <%= notification_field notifiable %>
19 <p><%= check_all_links('notified_events') %></p>
19 <br />
20 <% end %>
21 <p><%= check_all_links('notified_events') %></p>
20 </fieldset>
22 </fieldset>
21
23
22 <fieldset class="box"><legend><%= l(:setting_emails_footer) %></legend>
24 <fieldset class="box"><legend><%= l(:setting_emails_footer) %></legend>
@@ -1,22 +1,25
1 module Redmine
1 module Redmine
2 class Notifiable
2 class Notifiable < Struct.new(:name, :parent)
3 CoreNotifications = [
4 'issue_added',
5 'issue_updated',
6 'issue_note_added',
7 'issue_status_updated',
8 'issue_priority_updated',
9 'news_added',
10 'document_added',
11 'file_added',
12 'message_posted',
13 'wiki_content_added',
14 'wiki_content_updated'
15 ]
16
3
4 def to_s
5 name
6 end
7
17 # TODO: Plugin API for adding a new notification?
8 # TODO: Plugin API for adding a new notification?
18 def self.all
9 def self.all
19 CoreNotifications
10 notifications = []
11 notifications << Notifiable.new('issue_added')
12 notifications << Notifiable.new('issue_updated')
13 notifications << Notifiable.new('issue_note_added', 'issue_updated')
14 notifications << Notifiable.new('issue_status_updated', 'issue_updated')
15 notifications << Notifiable.new('issue_priority_updated', 'issue_updated')
16 notifications << Notifiable.new('news_added')
17 notifications << Notifiable.new('document_added')
18 notifications << Notifiable.new('file_added')
19 notifications << Notifiable.new('message_posted')
20 notifications << Notifiable.new('wiki_content_added')
21 notifications << Notifiable.new('wiki_content_updated')
22 notifications
20 end
23 end
21 end
24 end
22 end
25 end
@@ -17,6 +17,13 function toggleCheckboxesBySelector(selector) {
17 for (i = 0; i < boxes.length; i++) { boxes[i].checked = !all_checked; }
17 for (i = 0; i < boxes.length; i++) { boxes[i].checked = !all_checked; }
18 }
18 }
19
19
20 function setCheckboxesBySelector(checked, selector) {
21 var boxes = $$(selector);
22 boxes.each(function(ele) {
23 ele.checked = checked;
24 });
25 }
26
20 function showAndScrollTo(id, focus) {
27 function showAndScrollTo(id, focus) {
21 Element.show(id);
28 Element.show(id);
22 if (focus!=null) { Form.Element.focus(focus); }
29 if (focus!=null) { Form.Element.focus(focus); }
@@ -56,7 +63,6 function addFileField() {
56 dLabel.addClassName('inline');
63 dLabel.addClassName('inline');
57 // Pulls the languge value used for Optional Description
64 // Pulls the languge value used for Optional Description
58 dLabel.update($('attachment_description_label_content').innerHTML)
65 dLabel.update($('attachment_description_label_content').innerHTML)
59
60 p = document.getElementById("attachments_fields");
66 p = document.getElementById("attachments_fields");
61 p.appendChild(document.createElement("br"));
67 p.appendChild(document.createElement("br"));
62 p.appendChild(f);
68 p.appendChild(f);
@@ -419,6 +419,7 input#time_entry_comments { width: 90%;}
419 .tabular.settings textarea { width: 99%; }
419 .tabular.settings textarea { width: 99%; }
420
420
421 fieldset.settings label { display: block; }
421 fieldset.settings label { display: block; }
422 .parent { padding-left: 20px; }
422
423
423 .required {color: #bb0000;}
424 .required {color: #bb0000;}
424 .summary {font-style: italic;}
425 .summary {font-style: italic;}
@@ -21,18 +21,11 class Redmine::NotifiableTest < ActiveSupport::TestCase
21 def setup
21 def setup
22 end
22 end
23
23
24 def test_included_core_notifications
24 def test_all
25 assert_equal 11, Redmine::Notifiable::CoreNotifications.length
25 assert_equal 11, Redmine::Notifiable.all.length
26 Redmine::Notifiable::CoreNotifications.length
27
26
28 %w(issue_added issue_updated issue_note_added issue_status_updated issue_priority_updated news_added document_added file_added message_posted wiki_content_added wiki_content_updated).each do |notifiable|
27 %w(issue_added issue_updated issue_note_added issue_status_updated issue_priority_updated news_added document_added file_added message_posted wiki_content_added wiki_content_updated).each do |notifiable|
29 assert Redmine::Notifiable::CoreNotifications.include?(notifiable), "missing #{notifiable}"
28 assert Redmine::Notifiable.all.collect(&:name).include?(notifiable), "missing #{notifiable}"
30 end
31 end
32
33 def test_all_should_include_all_of_the_core_notifications
34 Redmine::Notifiable::CoreNotifications.each do |notifiable|
35 assert Redmine::Notifiable.all.include?(notifiable), "missing #{notifiable} in #all"
36 end
29 end
37 end
30 end
38 end
31 end
General Comments 0
You need to be logged in to leave comments. Login now