diff --git a/journals/templates/journals/publication_list.html b/journals/templates/journals/publication_list.html index c145a6a52310bc9f61beefda4fa205bdb7a0f4bd..c57705078285e0cc593ed42217f58ccf109d555b 100644 --- a/journals/templates/journals/publication_list.html +++ b/journals/templates/journals/publication_list.html @@ -20,18 +20,17 @@ <div class="row"> <div class="col-12 ordering"> + <h1 class="mt-4">Publications</h1> <p> - Found {{ page_obj.paginator.count }} Publications - <br> Order by: <a href="?{% url_replace orderby='date' page='' %}" class="d-inline-block mb-1 ml-2 {% active_get_request 'orderby' 'date' %}">publication date</a> <a href="?{% url_replace orderby='citations' page='' %}" class="d-inline-block mb-1 ml-2 {% active_get_request 'orderby' 'citations' %}">number of citations</a> </p> - <hr class="divider"> + <ul class="list-unstyled"> {% for publication in object_list %} - <li class="my-3"> + <li class=""> <div class="card card-gray card-publication"> {% include 'journals/_publication_card_content.html' with publication=publication include_citation_rate=1 %} </div> diff --git a/notifications/templatetags/notifications_tags.py b/notifications/templatetags/notifications_tags.py index 5694968bd269a2c50b8da240e7a89ef8e48da3d7..347616c83b90b205300b7c2d3abf04eef36a693b 100644 --- a/notifications/templatetags/notifications_tags.py +++ b/notifications/templatetags/notifications_tags.py @@ -12,7 +12,7 @@ register = Library() @register.simple_tag(takes_context=True) def live_notify_badge(context, classes=''): - html = "<span class='live_notify_badge {classes}'>0</span>".format(classes=classes) + html = "<span id='live_notify_badge' class='live_notify_badge {classes}'>0</span>".format(classes=classes) return format_html(html) diff --git a/notifications/views.py b/notifications/views.py index 8fdb0ac508309cf437ebabbc9b5abaf2acbe0cc6..e4d895876cf27273a2129d3018030c1fbb3b0765 100644 --- a/notifications/views.py +++ b/notifications/views.py @@ -57,8 +57,8 @@ def live_unread_notification_count(request): def live_notification_list(request): if not request.user.is_authenticated(): data = { - 'unread_count': 0, - 'list': [] + 'unread_count': 0, + 'list': [] } return JsonResponse(data) @@ -69,11 +69,16 @@ def live_notification_list(request): except ValueError: num_to_fetch = 5 + try: + offset = int(request.GET.get('offset', 0)) + except ValueError: + offset = 0 + list = [] - for n in request.user.notifications.all()[:num_to_fetch]: + for n in request.user.notifications.all()[offset:offset + num_to_fetch]: struct = model_to_dict(n) - struct['unread'] = struct['pseudo_unread'] + # struct['unread'] = struct['pseudo_unread'] struct['slug'] = id2slug(n.id) if n.actor: if isinstance(n.actor, User): diff --git a/scipost/static/scipost/assets/config/preconfig.scss b/scipost/static/scipost/assets/config/preconfig.scss index a8acc17f7993f546b0f331718cdcbe15c30a6168..9ec10fb470015fde0d5c1f4dd2357a5ac4a12d79 100644 --- a/scipost/static/scipost/assets/config/preconfig.scss +++ b/scipost/static/scipost/assets/config/preconfig.scss @@ -72,7 +72,7 @@ $card-gray-border-color: $scipost-lightblue $gray-100 $gray-100; // breadcrumb // -$breadcrumb-bg: #e5e5e5; +$breadcrumb-bg: #f0f0f0; $breadcrumb-active-color: $scipost-darkblue; $breadcrumb-divider-color: $scipost-orange; @@ -115,12 +115,12 @@ $font-size-base: 0.8rem; $font-size-sm: 0.7rem; $font-size-lg: 1.0rem; -$h1-font-size: 1.8em; -$h2-font-size: 1.5em; -$h3-font-size: 1.25em; -$h4-font-size: 1.2em; -$h5-font-size: 1.0em; -$h6-font-size: 1.0em; +$h1-font-size: 1.5rem; +$h2-font-size: 1.25rem; +$h3-font-size: 1.1rem; +$h4-font-size: 1.0rem; +$h5-font-size: 1.0rem; +$h6-font-size: 1.0rem; $close-font-weight: 100; diff --git a/scipost/static/scipost/assets/css/_cards.scss b/scipost/static/scipost/assets/css/_cards.scss index 8cefffe09812b4db8aa9e6f9750bb7295f55f202..2b37d0e4dbcd4d4d0193dfbc0515e64a70d938f5 100644 --- a/scipost/static/scipost/assets/css/_cards.scss +++ b/scipost/static/scipost/assets/css/_cards.scss @@ -1,51 +1,3 @@ -// .card { -// margin-bottom: 10px; -// -// &.card-gray { -// background-color: $card-gray-bg; -// border: 0; -// border-top: 2px solid $scipost-lightblue; -// box-shadow: 0 1px 0 0 $card-shadow-color; -// -// .card-header { -// background: transparent; -// border-bottom-color: #fff; -// } -// -// .card-footer { -// background: transparent; -// } -// } -// -// &.card-publication { -// box-shadow: 0 1px 0 0 #ddd; -// border: 1px solid #ddd; -// -// .card-header { -// background-color: #eee; -// border-bottom: 1px solid #ddd; -// } -// -// .card-body { -// border-top: 1px solid #fff; -// background-color: #f8f8f8; -// } -// } -// } - -// .card-outline-secondary { -// border-color: #f1f1f1; -// } - -// .card-header { -// padding: 0.5rem 0; -// margin: 0 0.75rem; -// } - -// .card-footer { -// padding: 0.75rem 0 0 0; -// margin: 0 0.75rem 0.75rem 0.75rem; -// } .list-group-item > .card-body { padding: 0.5rem; @@ -64,39 +16,6 @@ border-top: 3px solid $scipost-lightblue !important; } -// .card-news { -// .news-item .card-title { -// color: $scipost-darkblue; -// padding: 0.5rem 0 0.25rem 0; -// border-bottom: 3px solid $scipost-light; -// display: inline-block; -// margin-bottom: 0.5rem; -// } -// -// .news-item .date { -// margin-bottom: 1.5rem; -// } -// } -// -// .card-publication { -// width: 100%; -// -// &.card-gray { -// background-color: #f8f8f8; -// } -// -// .card-body { -// padding-top: 0.5rem; -// padding-bottom: 0.5rem; -// -// .card-title { -// background-color: #f4f4f4; -// margin: -0.5rem -0.75rem 0.5rem -0.75rem; -// padding: .75rem 0.75rem; -// } -// } -// } - .card.radio-option { label { cursor: pointer; @@ -107,3 +26,18 @@ border-color: $scipost-darkblue; } } + + +.card-publication { + margin-bottom: 0.5rem; + + .card-header { + background-color: rgba(0, 0, 0, 0.05); + } + + .card-body { + padding-top: 0.5rem; + padding-bottom: 0.5rem; + background-color: #f9f9f9; + } +} diff --git a/scipost/static/scipost/assets/css/_navbar.scss b/scipost/static/scipost/assets/css/_navbar.scss index 28cd591a870bdc25cf859447140b8187ba3bb350..e507e4ab6b876496a05ab101a4419dd49409f5cc 100644 --- a/scipost/static/scipost/assets/css/_navbar.scss +++ b/scipost/static/scipost/assets/css/_navbar.scss @@ -2,32 +2,6 @@ * Navbar * */ -// .navbar { -// a:hover { -// text-decoration: underline; -// } -// -// .nav-item.active a { -// font-weight: 700; -// text-decoration: underline; -// } -// -// .nav-link { -// color: $white; -// } -// -// .navbar-nav { -// flex-direction: row; -// overflow: auto; -// -webkit-overflow-scrolling: touch; -// -// .nav-link { -// padding-left: .5rem; -// padding-right: .5rem; -// white-space: nowrap; -// } -// } -// } .navbar { padding-left: 1rem; diff --git a/scipost/static/scipost/assets/css/_notifications.scss b/scipost/static/scipost/assets/css/_notifications.scss index 5ee0ee68c21b01cb8a01ed338355ef27a1c39b78..eebb90ae6e0090d8af5ab974f1b772280305103a 100644 --- a/scipost/static/scipost/assets/css/_notifications.scss +++ b/scipost/static/scipost/assets/css/_notifications.scss @@ -1,6 +1,10 @@ .notifications_container { + > a { + position: relative; + } + .fa-inbox { vertical-align: bottom; margin: 0 0.25rem; @@ -24,6 +28,20 @@ display: inline-block; } } + + .badge { + position: absolute; + right: -5px; + top: -6px; + display: none; + + &.positive_count { + display: inline-block; + background-color: $scipost-orange; + border: 2px solid $scipost-lightblue; + color: $white; + } + } } @@ -136,31 +154,6 @@ } } - // .actions { - // // display: none; - // opacity: 0.0; - // transition: opacity 0.1s; - // width: 20px; - // height: 100%; - // padding-left: 1rem; - // padding-right: 0.5rem; - // padding-bottom: 0.1rem; - // - // .fa[data-toggle="tooltip"] { - // font-size: 1em; - // } - // - // a:hover { - // .fa-circle-o:before { - // content: '\f111'; - // } - // - // .fa-circle:before { - // content: '\f10c'; - // } - // } - // } - .links .item { &.active, @@ -242,7 +235,7 @@ } &.unread { - background-color: rgba(114, 141, 199, 0.05); + background-color: rgba(114, 141, 199, 0.2); .show-unread { display: inherit; @@ -280,3 +273,18 @@ } } } + +.loading-link { + .fa { + display: none; + } + + &.loading { + .fa { + display: inline-block; + } + a { + display: none; + } + } +} diff --git a/scipost/static/scipost/assets/css/_typography.scss b/scipost/static/scipost/assets/css/_typography.scss index e0103457b4c4c4b5c17b8066f497fb655acd8656..5db9273cb20bd46fd6c18e0a908e127877f77484 100644 --- a/scipost/static/scipost/assets/css/_typography.scss +++ b/scipost/static/scipost/assets/css/_typography.scss @@ -149,3 +149,7 @@ hr.sm { .fa[data-toggle="tooltip"] { font-size: 1.5em; } + +p { + line-height: 1.4rem; +} diff --git a/scipost/static/scipost/assets/js/notifications.js b/scipost/static/scipost/assets/js/notifications.js index b047e7c71186c96173c32feaf2c60341bd7256cc..1798c13578e311e5033a79b1547b08e6d7ade237 100644 --- a/scipost/static/scipost/assets/js/notifications.js +++ b/scipost/static/scipost/assets/js/notifications.js @@ -13,14 +13,32 @@ function fetch_api_data(url, callback, args) { } } }) - r.open("GET", url + '?max=5', true); + r.open("GET", url, true); r.send(); } } +function update_count(el) { + fetch_api_data("/notifications/api/unread_count/", update_count_callback, {'element': el}); +} + +function update_count_callback(data, args) { + var el = $(args['element']); + var count = data['unread_count']; + if( count > 0 ) { + el.html(count).addClass('positive_count'); + } else { + el.html(count).removeClass('positive_count'); + } +} + + function update_list(el) { - fetch_api_data("/notifications/api/list/?mark_as_read=1", update_list_callback, {'element': el}); + var el = $(el); + var offset = typeof el.data('count') == 'undefined' ? 0 : el.data('count'); + $('#load-notifications').addClass('loading'); + fetch_api_data("/notifications/api/list/?mark_as_read=1&offset=" + offset, update_list_callback, {'element': el}); } function update_list_callback(data, args) { @@ -58,16 +76,29 @@ function update_list_callback(data, args) { } // Fill DOM - el.append(messages).trigger('refresh-notifications'); + var count = typeof el.data('count') == 'undefined' ? 0 : el.data('count'); + el.append(messages).data('count', count + items.length).trigger('refresh-notifications'); + $('#load-notifications').removeClass('loading'); } $(function(){ + update_count('#live_notify_badge'); + $('#notification_center').on('show.bs.modal', function(e) { - update_list('#notifications-list'); + if( typeof $('#notification_center').data('reload') == 'undefined' ) { + update_list('#notifications-list'); + update_count('#live_notify_badge'); + $('#notification_center').data('reload', 1); + } }).on('hide.bs.modal', function() { $('body > .tooltip').remove(); }); + $('#load-notifications a').on('click', function(e) { + e.preventDefault(); + update_list('#notifications-list'); + }); + $('body').on('refresh-notifications', function(e) { var list = $(e.target.children).filter('[data-refresh=1]'); diff --git a/scipost/templates/partials/scipost/notification_center_modal.html b/scipost/templates/partials/scipost/notification_center_modal.html index f0a80be594b8a7ec8bb24eac682bd29a90315584..a1a4597a281a55b333a326136d83a8ba15404f7d 100644 --- a/scipost/templates/partials/scipost/notification_center_modal.html +++ b/scipost/templates/partials/scipost/notification_center_modal.html @@ -60,6 +60,11 @@ </li> </div> </ul> + + <p class="text-center loading-link" id="load-notifications"> + <a href="javascript:;">Load more...</a> + <i class="fa fa-circle-o-notch fa-spin fa-3x fa-fw" id="#loading-notifications"></i> + </p> </div> <div class="modal-footer py-2"> <button type="button" class="btn btn-link" data-dismiss="modal">Close</button> diff --git a/scipost/templates/scipost/navbar.html b/scipost/templates/scipost/navbar.html index bec29bfe6a551c5c6522e658314d0665020cf610..4bce705cdecbf53563f3996bde95a743f4ac6240 100644 --- a/scipost/templates/scipost/navbar.html +++ b/scipost/templates/scipost/navbar.html @@ -16,11 +16,6 @@ <div class="collapse navbar-collapse" id="main-navbar"> <ul class="navbar-nav mr-auto"> - - <!-- <div class="container-outside main-nav"> --> - <!-- <div class="container"> --> - <!-- <nav class="navbar main-nav navbar-expand-lg"> --> - <!-- <ul id="menu-navbar" class="navbar-nav"> --> <li class="nav-item{% if request.path == '/' %} active{% endif %}"> <a href="{% url 'scipost:index' %}" class="nav-link">Home</a> </li> @@ -53,7 +48,7 @@ <a href="javascript:;" class="d-inline-block ml-lg-1 badge_link" id="notifications_badge" data-toggle="modal" data-target="#notification_center"> <span class="user d-inline d-lg-none d-xl-inline">{% if user.last_name %}{% if user.contributor %}{{ user.contributor.get_title_display }} {% endif %}{{ user.first_name }} {{ user.last_name }}{% else %}{{ user.username }}{% endif %}</span> <i class="fa fa-inbox" aria-hidden="true" style="min-width: 16px;"></i> - {% live_notify_badge classes="badge badge-pill badge-primary" %} + {% live_notify_badge classes="badge badge-pill" %} </a> {% live_notify_list %} </div> @@ -88,14 +83,6 @@ </li> {% endif %} - <!-- </ul> --> - <!-- <form action="{% url 'scipost:search' %}" method="get" class="form-inline search-nav-form"> --> - <!-- <input class="form-control mr-sm-2" id="id_q" maxlength="100" name="q" type="text" aria-label="Search" value="{{ search_query|default:'' }}"> --> - <!-- <button class="btn my-0" type="submit"><i class="fa fa-search"></i> Search</button> --> - <!-- </form> --> - <!-- </nav> --> - <!-- </div> --> - <!-- </div> --> diff --git a/submissions/templates/submissions/submission_detail.html b/submissions/templates/submissions/submission_detail.html index 4a7a148322ab1a9e4e1ed7cb22924efdb7313725..1b7ee9b6ddddf84b6f3570d6f4be06094925e8b8 100644 --- a/submissions/templates/submissions/submission_detail.html +++ b/submissions/templates/submissions/submission_detail.html @@ -30,21 +30,22 @@ <h3>- Published as <a href="{{submission.publication.get_absolute_url}}">{{submission.publication.in_issue.in_volume.in_journal.abbreviation_citation}} <strong>{{submission.publication.in_issue.in_volume.number}}</strong>, {{submission.publication.get_paper_nr}} ({{submission.publication.publication_date|date:'Y'}})</a></h3> {% endif %} + <p> + {% if submission.editor_in_charge and request.user.contributor == submission.editor_in_charge %} + - You are the Editor-in-charge, go to the <a href="{% url 'submissions:editorial_page' arxiv_identifier_w_vn_nr=submission.arxiv_identifier_w_vn_nr %}">Editorial Page</a> to take editorial actions<br> + {% endif %} - {% if submission.editor_in_charge and request.user.contributor == submission.editor_in_charge %} - <h3>- You are the Editor-in-charge, go to the <a href="{% url 'submissions:editorial_page' arxiv_identifier_w_vn_nr=submission.arxiv_identifier_w_vn_nr %}">Editorial Page</a> to take editorial actions</h3> - {% endif %} - - {% if unfinished_report_for_user %} - <h3>- <span class="circle text-danger border-danger">!</span> You have an unfinished report for this submission, <a href="{% url 'submissions:submit_report' arxiv_identifier_w_vn_nr=submission.arxiv_identifier_w_vn_nr %}">finish your report here.</a></h3> - {% endif %} + {% if unfinished_report_for_user %} + - <span class="circle text-danger border-danger">!</span> You have an unfinished report for this submission, <a href="{% url 'submissions:submit_report' arxiv_identifier_w_vn_nr=submission.arxiv_identifier_w_vn_nr %}">finish your report here.</a><br> + {% endif %} - {% if not submission.is_current %} - <h3><span class="text-danger">- This is not the current version.</span></h3> - {% endif %} + {% if not submission.is_current %} + <span class="text-danger">- This is not the current version.</span><br> + {% endif %} + </p> </div> - <h3 class="mt-2">Submission summary</h3> + <h3 class="mt-4">Submission summary</h3> {% include 'partials/submissions/submission_summary.html' with submission=submission hide_title=1 show_abstract=1 %} {% include 'partials/submissions/submission_status.html' with submission=submission %}