diff --git a/seahub/templates/base_for_backbone.html b/seahub/templates/base_for_backbone.html index feead557b1..cfa1341964 100644 --- a/seahub/templates/base_for_backbone.html +++ b/seahub/templates/base_for_backbone.html @@ -29,7 +29,7 @@ {% if request.user.is_authenticated and request.cur_note %}

{{ request.cur_note.message|urlize|url_target_blank }}

- +
{% endif %} {% endblock info_bar_message %} diff --git a/seahub/templates/libraries.html b/seahub/templates/libraries.html index e5854cb3e6..eac8e8c5fd 100644 --- a/seahub/templates/libraries.html +++ b/seahub/templates/libraries.html @@ -285,7 +285,8 @@ app["pageOptions"] = { guide_enabled: {% if guide_enabled %} true {% else %} false {% endif %}, enable_upload_folder: {% if enable_upload_folder %} true {% else %} false {% endif %}, max_upload_file_size: {% if max_upload_file_size %} {{ max_upload_file_size }} {% else %} '' {% endif %}, - folder_perm_enabled: {% if folder_perm_enabled %} true {% else %} false {% endif %} + folder_perm_enabled: {% if folder_perm_enabled %} true {% else %} false {% endif %}, + cur_note: {% if request.cur_note %} {'id': '{{ request.cur_note.id }}'} {% else %} null {% endif %} }; {% if debug %} diff --git a/static/scripts/app/router.js b/static/scripts/app/router.js index 226ea60c94..8b5dcc64bc 100644 --- a/static/scripts/app/router.js +++ b/static/scripts/app/router.js @@ -48,6 +48,8 @@ define([ if (app.pageOptions.top_nav_groups.length > 0) { this.topGroupNavView = new GroupNavView(); } + + $('#info-bar .close').click(Common.closeTopNoticeBar); }, switchCurrentView: function(newView) { diff --git a/static/scripts/common.js b/static/scripts/common.js index e8c535e65b..96ae4514ec 100644 --- a/static/scripts/common.js +++ b/static/scripts/common.js @@ -477,6 +477,31 @@ define([ }); }, + closeTopNoticeBar: function () { + if (!app.pageOptions.cur_note) { + return false; + } + var new_info_id = app.pageOptions.cur_note.id; + $('#info-bar').addClass('hide'); + if (navigator.cookieEnabled) { + var date = new Date(), + cookies = document.cookie.split('; '), + info_id_exist = false; + date.setTime(date.getTime() + 14*24*60*60*1000); + new_info_id += '; expires=' + date.toGMTString() + '; path=' + app.config.siteRoot; + for (var i = 0, len = cookies.length; i < len; i++) { + if (cookies[i].split('=')[0] == 'info_id') { + info_id_exist = true; + document.cookie = 'info_id=' + cookies[i].split('=')[1] + new_info_id; + break; + } + } + if (!info_id_exist) { + document.cookie = 'info_id=' + new_info_id; + } + } + }, + contactInputOptionsForSelect2: function() { var _this = this; return {