diff --git a/plugins/environment_notification/lib/ext/application_controller.rb b/plugins/environment_notification/lib/ext/application_controller.rb index 445bf0e..19c7472 100644 --- a/plugins/environment_notification/lib/ext/application_controller.rb +++ b/plugins/environment_notification/lib/ext/application_controller.rb @@ -3,7 +3,7 @@ require_dependency 'application_controller' class ApplicationController def hide_notifications invalid_id = -1 - hide_notifications_ids = [-1] + hide_notifications_ids = [invalid_id] hide_notifications_ids = JSON.parse(cookies[:hide_notifications]) unless cookies[:hide_notifications].blank? hide_notifications_ids end diff --git a/plugins/environment_notification/public/environment_notification_plugin.js b/plugins/environment_notification/public/environment_notification_plugin.js index 24df861..d11b622 100644 --- a/plugins/environment_notification/public/environment_notification_plugin.js +++ b/plugins/environment_notification/public/environment_notification_plugin.js @@ -5,7 +5,7 @@ notificationBar: function() { - var completeMessage = $(".notification-bar").remove(); + var completeMessage = $(".environment-notification-plugin-notification-bar").remove(); $("#content-inner").before(completeMessage); }, @@ -80,18 +80,18 @@ $(document).ready(function(){ environment_notification_plugin.notificationBar(); - $(".notification-close").on("click", environment_notification_plugin.closeNotification); - $(".notification-hide").on("click", environment_notification_plugin.hideNotification); + $(".environment-notification-plugin-notification-bar .notification-close").on("click", environment_notification_plugin.closeNotification); + $(".environment-notification-plugin-notification-bar .notification-hide").on("click", environment_notification_plugin.hideNotification); if($('.environment-notification-plugin-message').length > 0){ environment_notification_plugin.mceRestrict(); } - if($('.notification-bar').length > 0){ + if($('.environment-notification-plugin-notification-bar').length > 0){ environment_notification_plugin.hideUserNotification(); } - if($('[notification-display-popup="true"]').length > 0){ + if($('.environment-notification-plugin-notification-bar [notification-display-popup="true"]').length > 0){ environment_notification_plugin.showPopup(); } }); diff --git a/plugins/environment_notification/style.css b/plugins/environment_notification/style.css index e2f6c37..d8c0bb0 100644 --- a/plugins/environment_notification/style.css +++ b/plugins/environment_notification/style.css @@ -1,27 +1,33 @@ -.notification-bar { +.environment-notification-plugin-notification-bar{ display: block; } -.notification:hover { +.environment-notification-plugin-notification-bar .notification:hover, +.environment-notification-plugin-notification-notification-modal .notification:hover{ opacity: 0.8; } -#notification-manager { +#environment-notification-plugin-notification-manager{ overflow: auto; } -.notification .notification-close { +.environment-notification-plugin-notification-bar .notification .notification-close, +.environment-notification-plugin-notification-notification-modal .notification .notification-close{ background: url(public/images/close.png) no-repeat; background-position: center; width: 20px; height: 20px; } -.warningnotification, -.informationnotification, -.successnotification, -.dangernotification, -.adminnotification { +.environment-notification-plugin-notification-bar .warningnotification, +.environment-notification-plugin-notification-bar .informationnotification, +.environment-notification-plugin-notification-bar .successnotification, +.environment-notification-plugin-notification-bar .dangernotification, +.environment-notification-plugin-notification-bar .adminnotification, +.environment-notification-plugin-notification-notification-modal .warningnotification, +.environment-notification-plugin-notification-notification-modal .informationnotification, +.environment-notification-plugin-notification-notification-modal .successnotification, +.environment-notification-plugin-notification-notification-modal .dangernotification{ margin-bottom: 10px; padding: 7px 10px; border-radius: 5px; @@ -31,87 +37,101 @@ overflow: auto; } -.warningnotification p, -.informationnotification p, -.successnotification p, -.dangernotification p, -.adminnotification p { +.environment-notification-plugin-notification-bar .warningnotification p, +.environment-notification-plugin-notification-bar .informationnotification p, +.environment-notification-plugin-notification-bar .successnotification p, +.environment-notification-plugin-notification-bar .dangernotification p, +.environment-notification-plugin-notification-bar .adminnotification p, +.environment-notification-plugin-notification-notification-modal .warningnotification p, +.environment-notification-plugin-notification-notification-modal .informationnotification p, +.environment-notification-plugin-notification-notification-modal .successnotification p, +.environment-notification-plugin-notification-notification-modal .dangernotification p{ margin: 0px; } -.warningnotification { +.environment-notification-plugin-notification-bar .warningnotification, +.environment-notification-plugin-notification-notification-modal .warningnotification{ background: #fcf8e3; border: 1px solid #faebcc; color: #8a6d3b; } -.warningnotification p a{ +.environment-notification-plugin-notification-bar .warningnotification p a, +.environment-notification-plugin-notification-notification-modal .warningnotification p a{ font-weight: bold; color: #8a6d3b; } -.informationnotification { +.environment-notification-plugin-notification-bar .informationnotification, +.environment-notification-plugin-notification-notification-modal .informationnotification{ background: #d9edf7; border: 1px solid #bce8f1; color: #31708f; } -.informationnotification p a{ +.environment-notification-plugin-notification-bar .informationnotification p a, +.environment-notification-plugin-notification-notification-modal .informationnotification p a{ font-weight: bold; color: #31708f; } -.successnotification { +.environment-notification-plugin-notification-bar .successnotification, +.environment-notification-plugin-notification-notification-modal .successnotification{ background: #dff0d8; border: 1px solid #d6e9c6; color: #3c763d; } -.successnotification p a{ +.environment-notification-plugin-notification-bar .successnotification p a +.environment-notification-plugin-notification-notification-modal .successnotification p a{ font-weight: bold; color: #3c763d; } -.dangernotification { +.environment-notification-plugin-notification-bar .dangernotification, +.environment-notification-plugin-notification-notification-modal .dangernotification{ background: #f2dede; border: 1px solid #ebccd1; color: #a94442; } -.dangernotification p a{ +.environment-notification-plugin-notification-bar .dangernotification p a, +.environment-notification-plugin-notification-notification-modal .dangernotification p a{ font-weight: bold; color: #a94442; } -.adminnotification { +.environment-notification-plugin-notification-bar .adminnotification, +.environment-notification-plugin-notification-notification-modal .adminnotification{ background: #9a959a; border: 1px solid #9a959a; } -.adminnotification p a{ +.environment-notification-plugin-notification-bar .adminnotification p a, +.environment-notification-plugin-notification-notification-modal .adminnotification p a{ font-weight: bold; color: white; } -a.button.icon-deactivate { +#environment-notification-plugin-notification-manager a.button.icon-deactivate{ background: url(public/images/hide.png) no-repeat; background-position: center; } -a.button.icon-activate { +#environment-notification-plugin-notification-manager a.button.icon-activate{ background: url(public/images/show.png) no-repeat; background-position: center; } -.notification-line { +#environment-notification-plugin-notification-manager .notification-line{ display: inline; padding-top: 10px; vertical-align: middle; border-bottom: 1px solid #ccc; } -.notification-title-bar { +#environment-notification-plugin-notification-manager .notification-title-bar{ float: left; width: 100%; font-style: 14px; @@ -120,24 +140,24 @@ a.button.icon-activate { padding: 9px 0; } -.notification-title { +#environment-notification-plugin-notification-manager .notification-title{ width: 80%; float: left; text-align: center; } -.notification-modal .notification-with-title { +.environment-notification-plugin-notification-notification-modal .notification-with-title{ margin-bottom: 0px; } -.notification-modal .notification .notification-title { +.environment-notification-plugin-notification-notification-modal .notification .notification-title{ width: 100%; float: left; font-weight: bold; text-align: left; } -.notification-modal .notification-with-title-message { +.environment-notification-plugin-notification-notification-modal .notification-with-title-message{ width: 100%; float: left; border-radius: 3px; @@ -147,59 +167,60 @@ a.button.icon-activate { overflow: auto; } -.notification-modal .notification-with-title-message p{ +.environment-notification-plugin-notification-notification-modal .notification-with-title-message p{ padding: 0px 7px; } -.notification-modal .notification-with-title-message p a{ +.environment-notification-plugin-notification-notification-modal .notification-with-title-message p a{ color: black; font-weight: bold; } -.action-title { +#environment-notification-plugin-notification-manager .action-title{ width: 20%; float: left; text-align: center; } -.notification-action { +#environment-notification-plugin-notification-manager .notification-action{ width: 18%; float: left; height: 30px; padding-top: 9px; } -.main-bar .button, -.notification-action .button { +#environment-notification-plugin-notification-manager .main-bar .button, +#environment-notification-plugin-notification-manager .notification-action .button{ border-radius: 3px; } -.notification-message { +#environment-notification-plugin-notification-manager .notification-message{ width: 82%; float: left; } -.new-notification { +#environment-notification-plugin-notification-manager .new-notification{ float: right; width: auto; } -.back-button { +#environment-notification-plugin-notification-manager .back-button{ float: left; } -.main-bar { +#environment-notification-plugin-notification-manager .main-bar{ display: inline; width: 100%; } -.notification-bar .notification .notification-message { +.environment-notification-plugin-notification-bar .notification .notification-message, +.environment-notification-plugin-notification-notification-modal .notification .notification-message{ width: 90%; float: left; } -.notification-bar .notification .notification-close { +.environment-notification-plugin-notification-bar .notification .notification-close{ background: url(public/images/redclose.png) no-repeat; background-position: center; width: 20px; @@ -208,7 +229,7 @@ a.button.icon-activate { cursor: pointer; } -.notification-bar .notification .notification-hide { +.environment-notification-plugin-notification-bar .notification .notification-hide{ background: url(public/images/greenhide.png) no-repeat; background-position: center; width: 20px; @@ -217,8 +238,13 @@ a.button.icon-activate { cursor: pointer; } -.notification-modal { +.environment-notification-plugin-notification-notification-modal{ display: block; min-width: 400px; max-width: 700px; +} + +.environment-notification-plugin-form .notification-variables-options{ + font-style: italic; + color: red; } \ No newline at end of file diff --git a/plugins/environment_notification/views/environment_notification_plugin_admin/_form.html.erb b/plugins/environment_notification/views/environment_notification_plugin_admin/_form.html.erb index d8327f5..418f420 100644 --- a/plugins/environment_notification/views/environment_notification_plugin_admin/_form.html.erb +++ b/plugins/environment_notification/views/environment_notification_plugin_admin/_form.html.erb @@ -1,36 +1,38 @@ -<% abstract_options = {:value => @notification.message, :style => 'width: 100%; height: 200px;', :class => "environment-notification-plugin-message" } %> +
+ <% abstract_options = {:value => @notification.message, :style => 'width: 100%; height: 200px;', :class => "environment-notification-plugin-message" } %> -<%= button :back, _('Back'), :controller => 'environment_notification_plugin_admin' %> + <%= button :back, _('Back'), :controller => 'environment_notification_plugin_admin' %> -<%= form_for :notifications do |f| %> + <%= form_for :notifications do |f| %> - <%= render :file => 'shared/tiny_mce' %> + <%= render :file => 'shared/tiny_mce' %> - <%= labelled_form_field(_("Optional Title:"), f.text_field(:title, value: @notification.title)) %> + <%= labelled_form_field(_("Optional Title:"), f.text_field(:title, value: @notification.title)) %> - <%= labelled_form_field(_("Enter your message here:"), f.text_area(:message, abstract_options)) %> - - <%= _("Obs: You can use %{name} and %{email} variables to put the user's name and email in the message.") %> - + <%= labelled_form_field(_("Enter your message here:"), f.text_area(:message, abstract_options)) %> + + <%= _("Obs: You can use %{name} and %{email} variables to put the user's name and email in the message.") %> + - <%= labelled_form_field(_('Notifications Status'), select(:notifications, :active, options_for_select_with_title({"Active" => true, "Inactive" => false}, @notification.active))) %> + <%= labelled_form_field(_('Notifications Status'), select(:notifications, :active, options_for_select_with_title({"Active" => true, "Inactive" => false}, @notification.active))) %> - <%= 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))) %> + <%= 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))) %> -
- <%= labelled_check_box(_("Display only in the homepage"), 'notifications[display_only_in_homepage]', '1', @notification.display_only_in_homepage?) %> -
+
+ <%= labelled_check_box(_("Display only in the homepage"), 'notifications[display_only_in_homepage]', '1', @notification.display_only_in_homepage?) %> +
-
- <%= labelled_check_box(_("Display to not logged users too"), 'notifications[display_to_all_users]', '1', @notification.display_to_all_users?) %> -
+
+ <%= labelled_check_box(_("Display to not logged users too"), 'notifications[display_to_all_users]', '1', @notification.display_to_all_users?) %> +
-
- <%= labelled_check_box(_("Display popup until user close the notification"), 'notifications[display_popup]', '1', @notification.display_popup?) %> -
+
+ <%= labelled_check_box(_("Display popup until user close the notification"), 'notifications[display_popup]', '1', @notification.display_popup?) %> +
- <% button_bar do %> - <%= submit_button 'save', _('Save'), :cancel => { :action => 'index' } %> - <% end %> + <% button_bar do %> + <%= submit_button 'save', _('Save'), :cancel => { :action => 'index' } %> + <% end %> -<% end %> + <% end %> +
diff --git a/plugins/environment_notification/views/environment_notification_plugin_admin/index.html.erb b/plugins/environment_notification/views/environment_notification_plugin_admin/index.html.erb index 6978526..f91fc60 100644 --- a/plugins/environment_notification/views/environment_notification_plugin_admin/index.html.erb +++ b/plugins/environment_notification/views/environment_notification_plugin_admin/index.html.erb @@ -1,4 +1,4 @@ -
+

<%= _("Environment Notifications") %>

diff --git a/plugins/environment_notification/views/environment_notification_plugin_admin/show_notification.html.erb b/plugins/environment_notification/views/environment_notification_plugin_admin/show_notification.html.erb index 189e42d..463cd17 100644 --- a/plugins/environment_notification/views/environment_notification_plugin_admin/show_notification.html.erb +++ b/plugins/environment_notification/views/environment_notification_plugin_admin/show_notification.html.erb @@ -1,7 +1,7 @@ <% if current_user && current_user.person.is_admin? %> <% active_notifications = EnvironmentNotificationPlugin::EnvironmentNotification.active(environment) %> <% unless active_notifications.blank? %> -
+

@@ -18,7 +18,7 @@ <% @notifications = EnvironmentNotificationPlugin::EnvironmentNotification.visibles(environment, current_user, controller_path).where("id NOT IN (?)", hide_notifications) %> -

+
<% @notifications.each do |notification| %>
notification" data-notification="<%=notification.id%>" notification-display-popup="<%=notification.display_popup?%>">
diff --git a/plugins/environment_notification/views/environment_notification_plugin_public/notifications_with_popup.html.erb b/plugins/environment_notification/views/environment_notification_plugin_public/notifications_with_popup.html.erb index 8f232cf..5ab872f 100644 --- a/plugins/environment_notification/views/environment_notification_plugin_public/notifications_with_popup.html.erb +++ b/plugins/environment_notification/views/environment_notification_plugin_public/notifications_with_popup.html.erb @@ -1,6 +1,6 @@ <% @notifications = EnvironmentNotificationPlugin::EnvironmentNotification.with_popup(environment, current_user, @previous_path).where("id NOT IN (?)", @hide_notifications) %> -
+
<% @notifications.each do |notification| %> <% if !notification.title.blank? %>
notification notification-with-title" data-notification="<%=notification.id%>"> -- libgit2 0.21.2