Commit 17f103fb4575d844df6da378d256a1a3ffcf6a89

Authored by Arthur Esposte
Committed by Daniela Feitosa
1 parent 9f3e7562

Add environment_notification plugin's more specify classes name

(cherry picked from commit c838edfa0058fe706784fa5085f9570984b68373)
plugins/environment_notification/lib/ext/application_controller.rb
@@ -3,7 +3,7 @@ require_dependency 'application_controller' @@ -3,7 +3,7 @@ require_dependency 'application_controller'
3 class ApplicationController 3 class ApplicationController
4 def hide_notifications 4 def hide_notifications
5 invalid_id = -1 5 invalid_id = -1
6 - hide_notifications_ids = [-1] 6 + hide_notifications_ids = [invalid_id]
7 hide_notifications_ids = JSON.parse(cookies[:hide_notifications]) unless cookies[:hide_notifications].blank? 7 hide_notifications_ids = JSON.parse(cookies[:hide_notifications]) unless cookies[:hide_notifications].blank?
8 hide_notifications_ids 8 hide_notifications_ids
9 end 9 end
plugins/environment_notification/public/environment_notification_plugin.js
@@ -5,7 +5,7 @@ @@ -5,7 +5,7 @@
5 5
6 6
7 notificationBar: function() { 7 notificationBar: function() {
8 - var completeMessage = $(".notification-bar").remove(); 8 + var completeMessage = $(".environment-notification-plugin-notification-bar").remove();
9 $("#content-inner").before(completeMessage); 9 $("#content-inner").before(completeMessage);
10 }, 10 },
11 11
@@ -80,18 +80,18 @@ @@ -80,18 +80,18 @@
80 80
81 $(document).ready(function(){ 81 $(document).ready(function(){
82 environment_notification_plugin.notificationBar(); 82 environment_notification_plugin.notificationBar();
83 - $(".notification-close").on("click", environment_notification_plugin.closeNotification);  
84 - $(".notification-hide").on("click", environment_notification_plugin.hideNotification); 83 + $(".environment-notification-plugin-notification-bar .notification-close").on("click", environment_notification_plugin.closeNotification);
  84 + $(".environment-notification-plugin-notification-bar .notification-hide").on("click", environment_notification_plugin.hideNotification);
85 85
86 if($('.environment-notification-plugin-message').length > 0){ 86 if($('.environment-notification-plugin-message').length > 0){
87 environment_notification_plugin.mceRestrict(); 87 environment_notification_plugin.mceRestrict();
88 } 88 }
89 89
90 - if($('.notification-bar').length > 0){ 90 + if($('.environment-notification-plugin-notification-bar').length > 0){
91 environment_notification_plugin.hideUserNotification(); 91 environment_notification_plugin.hideUserNotification();
92 } 92 }
93 93
94 - if($('[notification-display-popup="true"]').length > 0){ 94 + if($('.environment-notification-plugin-notification-bar [notification-display-popup="true"]').length > 0){
95 environment_notification_plugin.showPopup(); 95 environment_notification_plugin.showPopup();
96 } 96 }
97 }); 97 });
plugins/environment_notification/style.css
1 -.notification-bar { 1 +.environment-notification-plugin-notification-bar{
2 display: block; 2 display: block;
3 } 3 }
4 4
5 -.notification:hover { 5 +.environment-notification-plugin-notification-bar .notification:hover,
  6 +.environment-notification-plugin-notification-notification-modal .notification:hover{
6 opacity: 0.8; 7 opacity: 0.8;
7 } 8 }
8 9
9 -#notification-manager { 10 +#environment-notification-plugin-notification-manager{
10 overflow: auto; 11 overflow: auto;
11 } 12 }
12 13
13 -.notification .notification-close { 14 +.environment-notification-plugin-notification-bar .notification .notification-close,
  15 +.environment-notification-plugin-notification-notification-modal .notification .notification-close{
14 background: url(public/images/close.png) no-repeat; 16 background: url(public/images/close.png) no-repeat;
15 background-position: center; 17 background-position: center;
16 width: 20px; 18 width: 20px;
17 height: 20px; 19 height: 20px;
18 } 20 }
19 21
20 -.warningnotification,  
21 -.informationnotification,  
22 -.successnotification,  
23 -.dangernotification,  
24 -.adminnotification { 22 +.environment-notification-plugin-notification-bar .warningnotification,
  23 +.environment-notification-plugin-notification-bar .informationnotification,
  24 +.environment-notification-plugin-notification-bar .successnotification,
  25 +.environment-notification-plugin-notification-bar .dangernotification,
  26 +.environment-notification-plugin-notification-bar .adminnotification,
  27 +.environment-notification-plugin-notification-notification-modal .warningnotification,
  28 +.environment-notification-plugin-notification-notification-modal .informationnotification,
  29 +.environment-notification-plugin-notification-notification-modal .successnotification,
  30 +.environment-notification-plugin-notification-notification-modal .dangernotification{
25 margin-bottom: 10px; 31 margin-bottom: 10px;
26 padding: 7px 10px; 32 padding: 7px 10px;
27 border-radius: 5px; 33 border-radius: 5px;
@@ -31,87 +37,101 @@ @@ -31,87 +37,101 @@
31 overflow: auto; 37 overflow: auto;
32 } 38 }
33 39
34 -.warningnotification p,  
35 -.informationnotification p,  
36 -.successnotification p,  
37 -.dangernotification p,  
38 -.adminnotification p { 40 +.environment-notification-plugin-notification-bar .warningnotification p,
  41 +.environment-notification-plugin-notification-bar .informationnotification p,
  42 +.environment-notification-plugin-notification-bar .successnotification p,
  43 +.environment-notification-plugin-notification-bar .dangernotification p,
  44 +.environment-notification-plugin-notification-bar .adminnotification p,
  45 +.environment-notification-plugin-notification-notification-modal .warningnotification p,
  46 +.environment-notification-plugin-notification-notification-modal .informationnotification p,
  47 +.environment-notification-plugin-notification-notification-modal .successnotification p,
  48 +.environment-notification-plugin-notification-notification-modal .dangernotification p{
39 margin: 0px; 49 margin: 0px;
40 } 50 }
41 51
42 -.warningnotification { 52 +.environment-notification-plugin-notification-bar .warningnotification,
  53 +.environment-notification-plugin-notification-notification-modal .warningnotification{
43 background: #fcf8e3; 54 background: #fcf8e3;
44 border: 1px solid #faebcc; 55 border: 1px solid #faebcc;
45 color: #8a6d3b; 56 color: #8a6d3b;
46 } 57 }
47 58
48 -.warningnotification p a{ 59 +.environment-notification-plugin-notification-bar .warningnotification p a,
  60 +.environment-notification-plugin-notification-notification-modal .warningnotification p a{
49 font-weight: bold; 61 font-weight: bold;
50 color: #8a6d3b; 62 color: #8a6d3b;
51 } 63 }
52 64
53 65
54 -.informationnotification { 66 +.environment-notification-plugin-notification-bar .informationnotification,
  67 +.environment-notification-plugin-notification-notification-modal .informationnotification{
55 background: #d9edf7; 68 background: #d9edf7;
56 border: 1px solid #bce8f1; 69 border: 1px solid #bce8f1;
57 color: #31708f; 70 color: #31708f;
58 } 71 }
59 72
60 -.informationnotification p a{ 73 +.environment-notification-plugin-notification-bar .informationnotification p a,
  74 +.environment-notification-plugin-notification-notification-modal .informationnotification p a{
61 font-weight: bold; 75 font-weight: bold;
62 color: #31708f; 76 color: #31708f;
63 } 77 }
64 78
65 -.successnotification { 79 +.environment-notification-plugin-notification-bar .successnotification,
  80 +.environment-notification-plugin-notification-notification-modal .successnotification{
66 background: #dff0d8; 81 background: #dff0d8;
67 border: 1px solid #d6e9c6; 82 border: 1px solid #d6e9c6;
68 color: #3c763d; 83 color: #3c763d;
69 } 84 }
70 85
71 -.successnotification p a{ 86 +.environment-notification-plugin-notification-bar .successnotification p a
  87 +.environment-notification-plugin-notification-notification-modal .successnotification p a{
72 font-weight: bold; 88 font-weight: bold;
73 color: #3c763d; 89 color: #3c763d;
74 } 90 }
75 91
76 -.dangernotification { 92 +.environment-notification-plugin-notification-bar .dangernotification,
  93 +.environment-notification-plugin-notification-notification-modal .dangernotification{
77 background: #f2dede; 94 background: #f2dede;
78 border: 1px solid #ebccd1; 95 border: 1px solid #ebccd1;
79 color: #a94442; 96 color: #a94442;
80 } 97 }
81 98
82 -.dangernotification p a{ 99 +.environment-notification-plugin-notification-bar .dangernotification p a,
  100 +.environment-notification-plugin-notification-notification-modal .dangernotification p a{
83 font-weight: bold; 101 font-weight: bold;
84 color: #a94442; 102 color: #a94442;
85 } 103 }
86 104
87 -.adminnotification { 105 +.environment-notification-plugin-notification-bar .adminnotification,
  106 +.environment-notification-plugin-notification-notification-modal .adminnotification{
88 background: #9a959a; 107 background: #9a959a;
89 border: 1px solid #9a959a; 108 border: 1px solid #9a959a;
90 } 109 }
91 110
92 -.adminnotification p a{ 111 +.environment-notification-plugin-notification-bar .adminnotification p a,
  112 +.environment-notification-plugin-notification-notification-modal .adminnotification p a{
93 font-weight: bold; 113 font-weight: bold;
94 color: white; 114 color: white;
95 } 115 }
96 116
97 -a.button.icon-deactivate { 117 +#environment-notification-plugin-notification-manager a.button.icon-deactivate{
98 background: url(public/images/hide.png) no-repeat; 118 background: url(public/images/hide.png) no-repeat;
99 background-position: center; 119 background-position: center;
100 } 120 }
101 121
102 -a.button.icon-activate { 122 +#environment-notification-plugin-notification-manager a.button.icon-activate{
103 background: url(public/images/show.png) no-repeat; 123 background: url(public/images/show.png) no-repeat;
104 background-position: center; 124 background-position: center;
105 } 125 }
106 126
107 -.notification-line { 127 +#environment-notification-plugin-notification-manager .notification-line{
108 display: inline; 128 display: inline;
109 padding-top: 10px; 129 padding-top: 10px;
110 vertical-align: middle; 130 vertical-align: middle;
111 border-bottom: 1px solid #ccc; 131 border-bottom: 1px solid #ccc;
112 } 132 }
113 133
114 -.notification-title-bar { 134 +#environment-notification-plugin-notification-manager .notification-title-bar{
115 float: left; 135 float: left;
116 width: 100%; 136 width: 100%;
117 font-style: 14px; 137 font-style: 14px;
@@ -120,24 +140,24 @@ a.button.icon-activate { @@ -120,24 +140,24 @@ a.button.icon-activate {
120 padding: 9px 0; 140 padding: 9px 0;
121 } 141 }
122 142
123 -.notification-title { 143 +#environment-notification-plugin-notification-manager .notification-title{
124 width: 80%; 144 width: 80%;
125 float: left; 145 float: left;
126 text-align: center; 146 text-align: center;
127 } 147 }
128 148
129 -.notification-modal .notification-with-title { 149 +.environment-notification-plugin-notification-notification-modal .notification-with-title{
130 margin-bottom: 0px; 150 margin-bottom: 0px;
131 } 151 }
132 152
133 -.notification-modal .notification .notification-title { 153 +.environment-notification-plugin-notification-notification-modal .notification .notification-title{
134 width: 100%; 154 width: 100%;
135 float: left; 155 float: left;
136 font-weight: bold; 156 font-weight: bold;
137 text-align: left; 157 text-align: left;
138 } 158 }
139 159
140 -.notification-modal .notification-with-title-message { 160 +.environment-notification-plugin-notification-notification-modal .notification-with-title-message{
141 width: 100%; 161 width: 100%;
142 float: left; 162 float: left;
143 border-radius: 3px; 163 border-radius: 3px;
@@ -147,59 +167,60 @@ a.button.icon-activate { @@ -147,59 +167,60 @@ a.button.icon-activate {
147 overflow: auto; 167 overflow: auto;
148 } 168 }
149 169
150 -.notification-modal .notification-with-title-message p{ 170 +.environment-notification-plugin-notification-notification-modal .notification-with-title-message p{
151 padding: 0px 7px; 171 padding: 0px 7px;
152 } 172 }
153 173
154 -.notification-modal .notification-with-title-message p a{ 174 +.environment-notification-plugin-notification-notification-modal .notification-with-title-message p a{
155 color: black; 175 color: black;
156 font-weight: bold; 176 font-weight: bold;
157 } 177 }
158 178
159 179
160 -.action-title { 180 +#environment-notification-plugin-notification-manager .action-title{
161 width: 20%; 181 width: 20%;
162 float: left; 182 float: left;
163 text-align: center; 183 text-align: center;
164 } 184 }
165 185
166 -.notification-action { 186 +#environment-notification-plugin-notification-manager .notification-action{
167 width: 18%; 187 width: 18%;
168 float: left; 188 float: left;
169 height: 30px; 189 height: 30px;
170 padding-top: 9px; 190 padding-top: 9px;
171 } 191 }
172 192
173 -.main-bar .button,  
174 -.notification-action .button { 193 +#environment-notification-plugin-notification-manager .main-bar .button,
  194 +#environment-notification-plugin-notification-manager .notification-action .button{
175 border-radius: 3px; 195 border-radius: 3px;
176 } 196 }
177 197
178 -.notification-message { 198 +#environment-notification-plugin-notification-manager .notification-message{
179 width: 82%; 199 width: 82%;
180 float: left; 200 float: left;
181 } 201 }
182 202
183 -.new-notification { 203 +#environment-notification-plugin-notification-manager .new-notification{
184 float: right; 204 float: right;
185 width: auto; 205 width: auto;
186 } 206 }
187 207
188 -.back-button { 208 +#environment-notification-plugin-notification-manager .back-button{
189 float: left; 209 float: left;
190 } 210 }
191 211
192 -.main-bar { 212 +#environment-notification-plugin-notification-manager .main-bar{
193 display: inline; 213 display: inline;
194 width: 100%; 214 width: 100%;
195 } 215 }
196 216
197 -.notification-bar .notification .notification-message { 217 +.environment-notification-plugin-notification-bar .notification .notification-message,
  218 +.environment-notification-plugin-notification-notification-modal .notification .notification-message{
198 width: 90%; 219 width: 90%;
199 float: left; 220 float: left;
200 } 221 }
201 222
202 -.notification-bar .notification .notification-close { 223 +.environment-notification-plugin-notification-bar .notification .notification-close{
203 background: url(public/images/redclose.png) no-repeat; 224 background: url(public/images/redclose.png) no-repeat;
204 background-position: center; 225 background-position: center;
205 width: 20px; 226 width: 20px;
@@ -208,7 +229,7 @@ a.button.icon-activate { @@ -208,7 +229,7 @@ a.button.icon-activate {
208 cursor: pointer; 229 cursor: pointer;
209 } 230 }
210 231
211 -.notification-bar .notification .notification-hide { 232 +.environment-notification-plugin-notification-bar .notification .notification-hide{
212 background: url(public/images/greenhide.png) no-repeat; 233 background: url(public/images/greenhide.png) no-repeat;
213 background-position: center; 234 background-position: center;
214 width: 20px; 235 width: 20px;
@@ -217,8 +238,13 @@ a.button.icon-activate { @@ -217,8 +238,13 @@ a.button.icon-activate {
217 cursor: pointer; 238 cursor: pointer;
218 } 239 }
219 240
220 -.notification-modal { 241 +.environment-notification-plugin-notification-notification-modal{
221 display: block; 242 display: block;
222 min-width: 400px; 243 min-width: 400px;
223 max-width: 700px; 244 max-width: 700px;
  245 +}
  246 +
  247 +.environment-notification-plugin-form .notification-variables-options{
  248 + font-style: italic;
  249 + color: red;
224 } 250 }
225 \ No newline at end of file 251 \ No newline at end of file
plugins/environment_notification/views/environment_notification_plugin_admin/_form.html.erb
1 -<% abstract_options = {:value => @notification.message, :style => 'width: 100%; height: 200px;', :class => "environment-notification-plugin-message" } %> 1 +<div class="environment-notification-plugin-form">
  2 + <% abstract_options = {:value => @notification.message, :style => 'width: 100%; height: 200px;', :class => "environment-notification-plugin-message" } %>
2 3
3 -<%= button :back, _('Back'), :controller => 'environment_notification_plugin_admin' %> 4 + <%= button :back, _('Back'), :controller => 'environment_notification_plugin_admin' %>
4 5
5 -<%= form_for :notifications do |f| %> 6 + <%= form_for :notifications do |f| %>
6 7
7 - <%= render :file => 'shared/tiny_mce' %> 8 + <%= render :file => 'shared/tiny_mce' %>
8 9
9 - <%= labelled_form_field(_("Optional Title:"), f.text_field(:title, value: @notification.title)) %> 10 + <%= labelled_form_field(_("Optional Title:"), f.text_field(:title, value: @notification.title)) %>
10 11
11 - <%= labelled_form_field(_("Enter your message here:"), f.text_area(:message, abstract_options)) %>  
12 - <small>  
13 - <%= _("Obs: You can use %{name} and %{email} variables to put the user's name and email in the message.") %>  
14 - </small> 12 + <%= labelled_form_field(_("Enter your message here:"), f.text_area(:message, abstract_options)) %>
  13 + <small class="notification-variables-options">
  14 + <%= _("Obs: You can use %{name} and %{email} variables to put the user's name and email in the message.") %>
  15 + </small>
15 16
16 - <%= labelled_form_field(_('Notifications Status'), select(:notifications, :active, options_for_select_with_title({"Active" => true, "Inactive" => false}, @notification.active))) %> 17 + <%= labelled_form_field(_('Notifications Status'), select(:notifications, :active, options_for_select_with_title({"Active" => true, "Inactive" => false}, @notification.active))) %>
17 18
18 - <%= labelled_form_field(_('Notifications Color/Type'), select(:notifications, :type, options_for_select_with_title({_("Blue - Information") => "EnvironmentNotificationPlugin::InformationNotification", _("Yellow - Warning") => "EnvironmentNotificationPlugin::WarningNotification", _("Green - Success") => "EnvironmentNotificationPlugin::SuccessNotification", _("Red - Danger") => "EnvironmentNotificationPlugin::DangerNotification"}, @notification.type))) %> 19 + <%= labelled_form_field(_('Notifications Color/Type'), select(:notifications, :type, options_for_select_with_title({_("Blue - Information") => "EnvironmentNotificationPlugin::InformationNotification", _("Yellow - Warning") => "EnvironmentNotificationPlugin::WarningNotification", _("Green - Success") => "EnvironmentNotificationPlugin::SuccessNotification", _("Red - Danger") => "EnvironmentNotificationPlugin::DangerNotification"}, @notification.type))) %>
19 20
20 - <div>  
21 - <%= labelled_check_box(_("Display only in the homepage"), 'notifications[display_only_in_homepage]', '1', @notification.display_only_in_homepage?) %>  
22 - </div> 21 + <div>
  22 + <%= labelled_check_box(_("Display only in the homepage"), 'notifications[display_only_in_homepage]', '1', @notification.display_only_in_homepage?) %>
  23 + </div>
23 24
24 - <div>  
25 - <%= labelled_check_box(_("Display to not logged users too"), 'notifications[display_to_all_users]', '1', @notification.display_to_all_users?) %>  
26 - </div> 25 + <div>
  26 + <%= labelled_check_box(_("Display to not logged users too"), 'notifications[display_to_all_users]', '1', @notification.display_to_all_users?) %>
  27 + </div>
27 28
28 - <div>  
29 - <%= labelled_check_box(_("Display popup until user close the notification"), 'notifications[display_popup]', '1', @notification.display_popup?) %>  
30 - </div> 29 + <div>
  30 + <%= labelled_check_box(_("Display popup until user close the notification"), 'notifications[display_popup]', '1', @notification.display_popup?) %>
  31 + </div>
31 32
32 - <% button_bar do %>  
33 - <%= submit_button 'save', _('Save'), :cancel => { :action => 'index' } %>  
34 - <% end %> 33 + <% button_bar do %>
  34 + <%= submit_button 'save', _('Save'), :cancel => { :action => 'index' } %>
  35 + <% end %>
35 36
36 -<% end %> 37 + <% end %>
  38 +</div>
plugins/environment_notification/views/environment_notification_plugin_admin/index.html.erb
1 -<div id="notification-manager"> 1 +<div id="environment-notification-plugin-notification-manager">
2 <div class="notification-manager-title"> 2 <div class="notification-manager-title">
3 <h1><%= _("Environment Notifications") %></h1> 3 <h1><%= _("Environment Notifications") %></h1>
4 </div> 4 </div>
plugins/environment_notification/views/environment_notification_plugin_admin/show_notification.html.erb
1 <% if current_user && current_user.person.is_admin? %> 1 <% if current_user && current_user.person.is_admin? %>
2 <% active_notifications = EnvironmentNotificationPlugin::EnvironmentNotification.active(environment) %> 2 <% active_notifications = EnvironmentNotificationPlugin::EnvironmentNotification.active(environment) %>
3 <% unless active_notifications.blank? %> 3 <% unless active_notifications.blank? %>
4 - <div class="notification-bar"> 4 + <div class="environment-notification-plugin-notification-bar">
5 <div class="adminnotification notification"> 5 <div class="adminnotification notification">
6 <div class="notification-message"> 6 <div class="notification-message">
7 <p> 7 <p>
@@ -18,7 +18,7 @@ @@ -18,7 +18,7 @@
18 18
19 <% @notifications = EnvironmentNotificationPlugin::EnvironmentNotification.visibles(environment, current_user, controller_path).where("id NOT IN (?)", hide_notifications) %> 19 <% @notifications = EnvironmentNotificationPlugin::EnvironmentNotification.visibles(environment, current_user, controller_path).where("id NOT IN (?)", hide_notifications) %>
20 20
21 -<div class="notification-bar"> 21 +<div class="environment-notification-plugin-notification-bar">
22 <% @notifications.each do |notification| %> 22 <% @notifications.each do |notification| %>
23 <div class="<%= notification.type.gsub("EnvironmentNotificationPlugin::", "").downcase %> notification" data-notification="<%=notification.id%>" notification-display-popup="<%=notification.display_popup?%>"> 23 <div class="<%= notification.type.gsub("EnvironmentNotificationPlugin::", "").downcase %> notification" data-notification="<%=notification.id%>" notification-display-popup="<%=notification.display_popup?%>">
24 <div class="notification-message"> 24 <div class="notification-message">
plugins/environment_notification/views/environment_notification_plugin_public/notifications_with_popup.html.erb
1 <% @notifications = EnvironmentNotificationPlugin::EnvironmentNotification.with_popup(environment, current_user, @previous_path).where("id NOT IN (?)", @hide_notifications) %> 1 <% @notifications = EnvironmentNotificationPlugin::EnvironmentNotification.with_popup(environment, current_user, @previous_path).where("id NOT IN (?)", @hide_notifications) %>
2 2
3 -<div class="notification-modal"> 3 +<div class="environment-notification-plugin-notification-notification-modal">
4 <% @notifications.each do |notification| %> 4 <% @notifications.each do |notification| %>
5 <% if !notification.title.blank? %> 5 <% if !notification.title.blank? %>
6 <div class="<%= notification.type.gsub("EnvironmentNotificationPlugin::", "").downcase %> notification notification-with-title" data-notification="<%=notification.id%>"> 6 <div class="<%= notification.type.gsub("EnvironmentNotificationPlugin::", "").downcase %> notification notification-with-title" data-notification="<%=notification.id%>">