mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-02 07:27:04 +00:00
[notice, account] modification
This commit is contained in:
@@ -1197,23 +1197,22 @@ textarea:-moz-placeholder {/* for FF */
|
|||||||
margin:4px 0 0;
|
margin:4px 0 0;
|
||||||
}
|
}
|
||||||
.popover-con {
|
.popover-con {
|
||||||
|
padding:0 10px;
|
||||||
overflow:auto;
|
overflow:auto;
|
||||||
}
|
}
|
||||||
a.popover-item {
|
a.popover-item {
|
||||||
|
display:block;
|
||||||
color:#444;
|
color:#444;
|
||||||
font-weight:normal;
|
font-weight:normal;
|
||||||
text-decoration:none;
|
|
||||||
display:block;
|
|
||||||
padding-left:10px;
|
|
||||||
padding-right:10px;
|
|
||||||
line-height:31px;
|
line-height:31px;
|
||||||
cursor:pointer;
|
text-decoration:none;
|
||||||
margin:5px 0;
|
padding:0 10px;
|
||||||
|
margin:5px -10px;
|
||||||
}
|
}
|
||||||
/**** user-item ****/ /* e.g. group member in 'group members' panel */
|
/**** user-item ****/ /* e.g. group member in 'group members' panel */
|
||||||
.user-item {
|
.user-item {
|
||||||
margin:5px 0;
|
padding:0 10px;
|
||||||
padding-left:10px;
|
margin:5px -10px;
|
||||||
}
|
}
|
||||||
.user-item .txt {
|
.user-item .txt {
|
||||||
margin-left:40px;
|
margin-left:40px;
|
||||||
@@ -1445,7 +1444,7 @@ button.dropdown-toggle:focus {
|
|||||||
/* top-bar */
|
/* top-bar */
|
||||||
#notifications {
|
#notifications {
|
||||||
position:relative;
|
position:relative;
|
||||||
margin:10px 32px 0 25px;
|
margin:10px 0 0 25px;
|
||||||
}
|
}
|
||||||
#notifications .sf2-icon-bell {
|
#notifications .sf2-icon-bell {
|
||||||
font-size:24px;
|
font-size:24px;
|
||||||
@@ -1474,13 +1473,15 @@ button.dropdown-toggle:focus {
|
|||||||
font-weight:normal;
|
font-weight:normal;
|
||||||
}
|
}
|
||||||
#notice-popover li {
|
#notice-popover li {
|
||||||
padding:9px 10px 3px 8px;
|
padding:9px 0 3px;
|
||||||
border-bottom:1px solid #dfdfe1;
|
border-bottom:1px solid #dfdfe1;
|
||||||
}
|
}
|
||||||
#notice-popover li.unread {
|
#notice-popover li.unread {
|
||||||
background:#f5f5f7;
|
background:#f5f5f7;
|
||||||
|
padding-right:10px;
|
||||||
|
padding-left:8px;
|
||||||
border-left:2px solid #feac74;
|
border-left:2px solid #feac74;
|
||||||
padding-left:6px;
|
margin:0 -10px;
|
||||||
}
|
}
|
||||||
#notice-popover .avatar {
|
#notice-popover .avatar {
|
||||||
border-radius:1000px;
|
border-radius:1000px;
|
||||||
@@ -1494,12 +1495,14 @@ button.dropdown-toggle:focus {
|
|||||||
color:#999;
|
color:#999;
|
||||||
text-align:right;
|
text-align:right;
|
||||||
margin:0;
|
margin:0;
|
||||||
|
clear:both;
|
||||||
}
|
}
|
||||||
#notice-popover .all {
|
#notice-popover .all {
|
||||||
color:#a4a4a4;
|
color:#a4a4a4;
|
||||||
}
|
}
|
||||||
#account {
|
#account {
|
||||||
position:relative;
|
position:relative;
|
||||||
|
margin-left:32px;
|
||||||
}
|
}
|
||||||
#account .avatar {
|
#account .avatar {
|
||||||
vertical-align:middle;
|
vertical-align:middle;
|
||||||
@@ -1516,7 +1519,6 @@ button.dropdown-toggle:focus {
|
|||||||
margin-left:45px;
|
margin-left:45px;
|
||||||
}
|
}
|
||||||
.account-popup {
|
.account-popup {
|
||||||
text-align:left;
|
|
||||||
right:0;
|
right:0;
|
||||||
top:48px;
|
top:48px;
|
||||||
font-size:13px;
|
font-size:13px;
|
||||||
@@ -1525,8 +1527,8 @@ button.dropdown-toggle:focus {
|
|||||||
top:-10px;
|
top:-10px;
|
||||||
left:200px;
|
left:200px;
|
||||||
}
|
}
|
||||||
.account-popup > .item:last-child {
|
.account-popup .popover-con {
|
||||||
border-bottom:none;
|
padding:0;
|
||||||
}
|
}
|
||||||
.account-popup .item {
|
.account-popup .item {
|
||||||
display:block;
|
display:block;
|
||||||
|
@@ -58,8 +58,6 @@ $(document).click(function(e) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
closePopup($('#user-info-popup'), $('#my-info'));
|
closePopup($('#user-info-popup'), $('#my-info'));
|
||||||
closePopup($('#top-nav-grp-info'), $('#top-nav-grp'));
|
|
||||||
closePopup($('#notice-popup'), $('#notice-icon'));
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// search: disable submit when input nothing
|
// search: disable submit when input nothing
|
||||||
|
@@ -46,12 +46,6 @@
|
|||||||
{% include 'snippets/search_form.html' %}
|
{% include 'snippets/search_form.html' %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<div data-url="{% url 'unseen_notices_count' %}" id="notifications" class="fleft">
|
|
||||||
<a href="#" class="no-deco" id="notice-icon" title="{% trans "Notifications" %}" aria-label="{% trans "Notifications" %}">
|
|
||||||
<span class="sf2-icon-bell"></span>
|
|
||||||
<span class="num hide">0</span>
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="account" class="fright">
|
<div id="account" class="fright">
|
||||||
<a id="my-info" href="#" class="no-deco" aria-label="{% trans "View profile and more" %}">
|
<a id="my-info" href="#" class="no-deco" aria-label="{% trans "View profile and more" %}">
|
||||||
|
@@ -1426,9 +1426,9 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="popover-con">
|
<div class="popover-con">
|
||||||
<span class="loading-icon loading-tip"></span>
|
<span class="loading-icon loading-tip"></span>
|
||||||
|
<p class="error alc hide"></p>
|
||||||
<ul class="hide notice-list"></ul>
|
<ul class="hide notice-list"></ul>
|
||||||
<p class="alc"><a href="{% url 'user_notification_list' %}" class="all">{% trans "See All Notifications" %}</a></p>
|
<p class="alc"><a href="{% url 'user_notification_list' %}" class="all">{% trans "See All Notifications" %}</a></p>
|
||||||
<p class="error alc hide"></p>
|
|
||||||
</div>
|
</div>
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -1444,7 +1444,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="loading-icon loading-tip"></div>
|
<div class="loading-icon loading-tip"></div>
|
||||||
<p class="error alc hide"></p>
|
<p class="error alc hide"></p>
|
||||||
<div id="space-traffic" class="hide" data-url="{% url 'space_and_traffic' %}"></div>
|
<div id="space-traffic" class="hide"></div>
|
||||||
<a class="item" href="{{ SITE_ROOT }}profile/">{% trans "Settings" %}</a>
|
<a class="item" href="{{ SITE_ROOT }}profile/">{% trans "Settings" %}</a>
|
||||||
<a href="{{ SITE_ROOT }}accounts/logout/" class="item" id="logout">{% trans "Log out" %}</a>
|
<a href="{{ SITE_ROOT }}accounts/logout/" class="item" id="logout">{% trans "Log out" %}</a>
|
||||||
</div>
|
</div>
|
||||||
|
@@ -47,8 +47,6 @@ define([
|
|||||||
|
|
||||||
Common.prepareApiCsrf();
|
Common.prepareApiCsrf();
|
||||||
Common.initLocale();
|
Common.initLocale();
|
||||||
//Common.initAccountPopup();
|
|
||||||
//Common.initNoticePopup();
|
|
||||||
|
|
||||||
this.sideNavView = new SideNavView();
|
this.sideNavView = new SideNavView();
|
||||||
app.ui.sideNavView = this.sideNavView;
|
app.ui.sideNavView = this.sideNavView;
|
||||||
|
@@ -42,7 +42,7 @@ define([
|
|||||||
this.$space.addClass('hide');
|
this.$space.addClass('hide');
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: this.$space.data('url'),
|
url: Common.getUrl({'name': 'space_and_traffic'}),
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
cache: false,
|
cache: false,
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
@@ -62,7 +62,6 @@ define([
|
|||||||
});
|
});
|
||||||
|
|
||||||
this.$account.append(this.$el);
|
this.$account.append(this.$el);
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@@ -17,13 +17,17 @@ define([
|
|||||||
PopoverView.prototype.initialize.call(this);
|
PopoverView.prototype.initialize.call(this);
|
||||||
|
|
||||||
this.render();
|
this.render();
|
||||||
|
|
||||||
this.$loadingTip = this.$('.loading-tip');
|
this.$loadingTip = this.$('.loading-tip');
|
||||||
this.$error = this.$('.error');
|
this.$error = this.$('.error');
|
||||||
this.$noticeList = this.$('.notice-list');
|
this.$noticeList = this.$('.notice-list');
|
||||||
|
|
||||||
this.$notifications = $("#notifications");
|
this.$notifications = $("#notifications");
|
||||||
|
this.$num = $('.num', this.$notifications);
|
||||||
this.orig_doc_title = document.title;
|
this.orig_doc_title = document.title;
|
||||||
|
|
||||||
var _this = this;
|
var _this = this;
|
||||||
|
|
||||||
var reqUnreadNum = function() {
|
var reqUnreadNum = function() {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: Common.getUrl({name: 'get_unseen_notices_num'}),
|
url: Common.getUrl({name: 'get_unseen_notices_num'}),
|
||||||
@@ -31,13 +35,13 @@ define([
|
|||||||
cache: false,
|
cache: false,
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
var count = data['count'],
|
var count = data['count'],
|
||||||
num = $('.num', _this.$notifications);
|
$num = _this.$num;
|
||||||
num.html(count);
|
$num.html(count);
|
||||||
if (count > 0) {
|
if (count > 0) {
|
||||||
num.removeClass('hide');
|
$num.removeClass('hide');
|
||||||
document.title = '(' + count + ')' + _this.orig_doc_title;
|
document.title = '(' + count + ')' + _this.orig_doc_title;
|
||||||
} else {
|
} else {
|
||||||
num.addClass('hide');
|
$num.addClass('hide');
|
||||||
document.title = _this.orig_doc_title;
|
document.title = _this.orig_doc_title;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -58,6 +62,35 @@ define([
|
|||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
events: {
|
||||||
|
'click .detail': 'viewDetail',
|
||||||
|
'click .unread a': 'visitUnread'
|
||||||
|
},
|
||||||
|
|
||||||
|
viewDetail: function(e) {
|
||||||
|
var $el = $(e.currentTarget);
|
||||||
|
location.href = $('.brief a', $el.parent()).attr('href');
|
||||||
|
},
|
||||||
|
|
||||||
|
visitUnread: function(e) {
|
||||||
|
var $el = $(e.currentTarget);
|
||||||
|
var notice_id = $el.closest('.unread').data('id');
|
||||||
|
var link_href = $el.attr('href');
|
||||||
|
$.ajax({
|
||||||
|
url: Common.getUrl({name: 'set_notice_seen_by_id'}) + '?notice_id=' + encodeURIComponent(notice_id),
|
||||||
|
type: 'POST',
|
||||||
|
dataType: 'json',
|
||||||
|
beforeSend: Common.prepareCSRFToken,
|
||||||
|
success: function(data) {
|
||||||
|
location.href = link_href;
|
||||||
|
},
|
||||||
|
error: function() {
|
||||||
|
location.href = link_href;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
|
||||||
// override hide function
|
// override hide function
|
||||||
hide: function() {
|
hide: function() {
|
||||||
var _this = this;
|
var _this = this;
|
||||||
@@ -72,7 +105,7 @@ define([
|
|||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
beforeSend: Common.prepareCSRFToken,
|
beforeSend: Common.prepareCSRFToken,
|
||||||
success: function() {
|
success: function() {
|
||||||
$('.num', _this.$notifications).html(0).addClass('hide');
|
_this.$num.html(0).addClass('hide');
|
||||||
document.title = _this.orig_doc_title;
|
document.title = _this.orig_doc_title;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -94,28 +127,6 @@ define([
|
|||||||
success: function(data) {
|
success: function(data) {
|
||||||
_this.$loadingTip.hide();
|
_this.$loadingTip.hide();
|
||||||
_this.$noticeList.html(data['notice_html']).show();
|
_this.$noticeList.html(data['notice_html']).show();
|
||||||
|
|
||||||
// set a notice to be read when <a> in it is clicked
|
|
||||||
$('.unread a', _this.$noticeList).click(function() {
|
|
||||||
var notice_id = $(this).parents('.unread').data('id');
|
|
||||||
var link_href = $(this).attr('href');
|
|
||||||
$.ajax({
|
|
||||||
url: Common.getUrl({name: 'set_notice_seen_by_id'}) + '?notice_id=' + encodeURIComponent(notice_id),
|
|
||||||
type: 'POST',
|
|
||||||
dataType: 'json',
|
|
||||||
beforeSend: Common.prepareCSRFToken,
|
|
||||||
success: function(data) {
|
|
||||||
location.href = link_href;
|
|
||||||
},
|
|
||||||
error: function() {
|
|
||||||
location.href = link_href;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
$('.detail', _this.$noticeList).click(function() {
|
|
||||||
location.href = $('.brief a', $(this).parent()).attr('href');
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
error: function (xhr, textStatus, errorThrown) {
|
error: function (xhr, textStatus, errorThrown) {
|
||||||
_this.$loadingTip.hide();
|
_this.$loadingTip.hide();
|
||||||
@@ -130,7 +141,6 @@ define([
|
|||||||
});
|
});
|
||||||
|
|
||||||
this.$notifications.append(this.$el);
|
this.$notifications.append(this.$el);
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@@ -20,8 +20,7 @@ define([
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!view.$el.is(target)
|
if (!view.$el.is(target)
|
||||||
&& !view.$el.find('*').is(target))
|
&& !view.$el.find('*').is(target)) {
|
||||||
{
|
|
||||||
view.hide();
|
view.hide();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@@ -153,6 +153,7 @@ define([
|
|||||||
case 'events': return siteRoot + 'api2/events/';
|
case 'events': return siteRoot + 'api2/events/';
|
||||||
case 'search_user': return siteRoot + 'api2/search-user/';
|
case 'search_user': return siteRoot + 'api2/search-user/';
|
||||||
case 'user_profile': return siteRoot + 'profile/' + options.username + '/';
|
case 'user_profile': return siteRoot + 'profile/' + options.username + '/';
|
||||||
|
case 'space_and_traffic': return siteRoot + 'ajax/space_and_traffic/';
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user