[Git][noosfero/noosfero][master] 2 commits: notifications: permanent notifications option for environment

Rodrigo Souto gitlab at mg.gitlab.com
Mon Oct 24 15:23:07 BRST 2016


Rodrigo Souto pushed to branch master at Noosfero / noosfero


Commits:
cfafd04d by Rodrigo Souto at 2016-10-17T14:26:26-03:00
notifications: permanent notifications option for environment

Adding this option without any configuration interface for now.

- - - - -
e0511a8a by Rodrigo Souto at 2016-10-24T17:22:54+00:00
Merge branch 'permanent-notifications' into 'master'

notifications: permanent notifications option for environment

Adding this option without any configuration interface for now.

See merge request !1029
- - - - -


3 changed files:

- app/models/environment.rb
- app/views/layouts/application-ng.html.erb
- public/javascripts/application.js


Changes:

=====================================
app/models/environment.rb
=====================================
--- a/app/models/environment.rb
+++ b/app/models/environment.rb
@@ -356,6 +356,8 @@ class Environment < ApplicationRecord
   settings_items :members_whitelist_enabled, :type => :boolean, :default => false
   settings_items :members_whitelist, :type => Array, :default => []
 
+  settings_items :permanent_notifications, :type => :boolean, :default => false
+
   def in_whitelist?(person)
     !members_whitelist_enabled || members_whitelist.include?(person.id)
   end


=====================================
app/views/layouts/application-ng.html.erb
=====================================
--- a/app/views/layouts/application-ng.html.erb
+++ b/app/views/layouts/application-ng.html.erb
@@ -32,6 +32,7 @@
 
     <script type="text/javascript">
       DEFAULT_LOADING_MESSAGE = <%="'#{ _('loading...') }'".html_safe %>;
+      PERMANENT_NOTIFICATIONS = <%= @environment.permanent_notifications %>;
       noosfero.profile = <%= (@profile.identifier if @profile).to_json.html_safe %>
     </script>
 


=====================================
public/javascripts/application.js
=====================================
--- a/public/javascripts/application.js
+++ b/public/javascripts/application.js
@@ -1159,7 +1159,9 @@ function notifyMe(title, options) {
     });
   }
 
-  setTimeout(function() {notification.close()}, 5000);
+  if(!PERMANENT_NOTIFICATIONS)
+    setTimeout(function() {notification.close()}, 5000);
+
   notification.onclick = function(){
     notification.close();
     // Chromium tweak



View it on GitLab: https://gitlab.com/noosfero/noosfero/compare/3757c1d92b3a13a057cb4fb82ee24d616da18964...e0511a8a331da5fef6695fdc9f45e71eb8bbd089
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listas.softwarelivre.org/pipermail/noosfero-dev/attachments/20161024/b178f588/attachment-0001.html>


More information about the Noosfero-dev mailing list