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 3 class ApplicationController
4 4 def hide_notifications
5 5 invalid_id = -1
6   - hide_notifications_ids = [-1]
  6 + hide_notifications_ids = [invalid_id]
7 7 hide_notifications_ids = JSON.parse(cookies[:hide_notifications]) unless cookies[:hide_notifications].blank?
8 8 hide_notifications_ids
9 9 end
... ...
plugins/environment_notification/public/environment_notification_plugin.js
... ... @@ -5,7 +5,7 @@
5 5  
6 6  
7 7 notificationBar: function() {
8   - var completeMessage = $(".notification-bar").remove();
  8 + var completeMessage = $(".environment-notification-plugin-notification-bar").remove();
9 9 $("#content-inner").before(completeMessage);
10 10 },
11 11  
... ... @@ -80,18 +80,18 @@
80 80  
81 81 $(document).ready(function(){
82 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 86 if($('.environment-notification-plugin-message').length > 0){
87 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 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 95 environment_notification_plugin.showPopup();
96 96 }
97 97 });
... ...
plugins/environment_notification/style.css
1   -.notification-bar {
  1 +.environment-notification-plugin-notification-bar{
2 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 7 opacity: 0.8;
7 8 }
8 9  
9   -#notification-manager {
  10 +#environment-notification-plugin-notification-manager{
10 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 16 background: url(public/images/close.png) no-repeat;
15 17 background-position: center;
16 18 width: 20px;
17 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 31 margin-bottom: 10px;
26 32 padding: 7px 10px;
27 33 border-radius: 5px;
... ... @@ -31,87 +37,101 @@
31 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 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 54 background: #fcf8e3;
44 55 border: 1px solid #faebcc;
45 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 61 font-weight: bold;
50 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 68 background: #d9edf7;
56 69 border: 1px solid #bce8f1;
57 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 75 font-weight: bold;
62 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 81 background: #dff0d8;
67 82 border: 1px solid #d6e9c6;
68 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 88 font-weight: bold;
73 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 94 background: #f2dede;
78 95 border: 1px solid #ebccd1;
79 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 101 font-weight: bold;
84 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 107 background: #9a959a;
89 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 113 font-weight: bold;
94 114 color: white;
95 115 }
96 116  
97   -a.button.icon-deactivate {
  117 +#environment-notification-plugin-notification-manager a.button.icon-deactivate{
98 118 background: url(public/images/hide.png) no-repeat;
99 119 background-position: center;
100 120 }
101 121  
102   -a.button.icon-activate {
  122 +#environment-notification-plugin-notification-manager a.button.icon-activate{
103 123 background: url(public/images/show.png) no-repeat;
104 124 background-position: center;
105 125 }
106 126  
107   -.notification-line {
  127 +#environment-notification-plugin-notification-manager .notification-line{
108 128 display: inline;
109 129 padding-top: 10px;
110 130 vertical-align: middle;
111 131 border-bottom: 1px solid #ccc;
112 132 }
113 133  
114   -.notification-title-bar {
  134 +#environment-notification-plugin-notification-manager .notification-title-bar{
115 135 float: left;
116 136 width: 100%;
117 137 font-style: 14px;
... ... @@ -120,24 +140,24 @@ a.button.icon-activate {
120 140 padding: 9px 0;
121 141 }
122 142  
123   -.notification-title {
  143 +#environment-notification-plugin-notification-manager .notification-title{
124 144 width: 80%;
125 145 float: left;
126 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 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 154 width: 100%;
135 155 float: left;
136 156 font-weight: bold;
137 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 161 width: 100%;
142 162 float: left;
143 163 border-radius: 3px;
... ... @@ -147,59 +167,60 @@ a.button.icon-activate {
147 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 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 175 color: black;
156 176 font-weight: bold;
157 177 }
158 178  
159 179  
160   -.action-title {
  180 +#environment-notification-plugin-notification-manager .action-title{
161 181 width: 20%;
162 182 float: left;
163 183 text-align: center;
164 184 }
165 185  
166   -.notification-action {
  186 +#environment-notification-plugin-notification-manager .notification-action{
167 187 width: 18%;
168 188 float: left;
169 189 height: 30px;
170 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 195 border-radius: 3px;
176 196 }
177 197  
178   -.notification-message {
  198 +#environment-notification-plugin-notification-manager .notification-message{
179 199 width: 82%;
180 200 float: left;
181 201 }
182 202  
183   -.new-notification {
  203 +#environment-notification-plugin-notification-manager .new-notification{
184 204 float: right;
185 205 width: auto;
186 206 }
187 207  
188   -.back-button {
  208 +#environment-notification-plugin-notification-manager .back-button{
189 209 float: left;
190 210 }
191 211  
192   -.main-bar {
  212 +#environment-notification-plugin-notification-manager .main-bar{
193 213 display: inline;
194 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 219 width: 90%;
199 220 float: left;
200 221 }
201 222  
202   -.notification-bar .notification .notification-close {
  223 +.environment-notification-plugin-notification-bar .notification .notification-close{
203 224 background: url(public/images/redclose.png) no-repeat;
204 225 background-position: center;
205 226 width: 20px;
... ... @@ -208,7 +229,7 @@ a.button.icon-activate {
208 229 cursor: pointer;
209 230 }
210 231  
211   -.notification-bar .notification .notification-hide {
  232 +.environment-notification-plugin-notification-bar .notification .notification-hide{
212 233 background: url(public/images/greenhide.png) no-repeat;
213 234 background-position: center;
214 235 width: 20px;
... ... @@ -217,8 +238,13 @@ a.button.icon-activate {
217 238 cursor: pointer;
218 239 }
219 240  
220   -.notification-modal {
  241 +.environment-notification-plugin-notification-notification-modal{
221 242 display: block;
222 243 min-width: 400px;
223 244 max-width: 700px;
  245 +}
  246 +
  247 +.environment-notification-plugin-form .notification-variables-options{
  248 + font-style: italic;
  249 + color: red;
224 250 }
225 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 2 <div class="notification-manager-title">
3 3 <h1><%= _("Environment Notifications") %></h1>
4 4 </div>
... ...
plugins/environment_notification/views/environment_notification_plugin_admin/show_notification.html.erb
1 1 <% if current_user && current_user.person.is_admin? %>
2 2 <% active_notifications = EnvironmentNotificationPlugin::EnvironmentNotification.active(environment) %>
3 3 <% unless active_notifications.blank? %>
4   - <div class="notification-bar">
  4 + <div class="environment-notification-plugin-notification-bar">
5 5 <div class="adminnotification notification">
6 6 <div class="notification-message">
7 7 <p>
... ... @@ -18,7 +18,7 @@
18 18  
19 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 22 <% @notifications.each do |notification| %>
23 23 <div class="<%= notification.type.gsub("EnvironmentNotificationPlugin::", "").downcase %> notification" data-notification="<%=notification.id%>" notification-display-popup="<%=notification.display_popup?%>">
24 24 <div class="notification-message">
... ...
plugins/environment_notification/views/environment_notification_plugin_public/notifications_with_popup.html.erb
1 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 4 <% @notifications.each do |notification| %>
5 5 <% if !notification.title.blank? %>
6 6 <div class="<%= notification.type.gsub("EnvironmentNotificationPlugin::", "").downcase %> notification notification-with-title" data-notification="<%=notification.id%>">
... ...