From d2bb8ef503901b05a34a7d24ddd32c8a5b7524fc Mon Sep 17 00:00:00 2001 From: Andrey Nering Date: Tue, 17 Jan 2017 23:18:55 -0200 Subject: [PATCH] Notifications: trying to get a better layout (#660) * i18n button titles * Improvements on notification page layout * Notification count badge fixes * Make table clickable * Fix octicon aligment * Fix use of AppSubUrl --- options/locale/locale_en-US.ini | 3 + options/locale/locale_pt-BR.ini | 3 + public/css/index.css | 11 +- public/js/index.js | 5 + public/less/_user.less | 12 +- routers/user/notification.go | 4 +- templates/base/head.tmpl | 2 +- templates/user/notification/notification.tmpl | 143 +++++++++--------- 8 files changed, 103 insertions(+), 80 deletions(-) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 7ea227b8c1b..9b9e25ba812 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -1275,3 +1275,6 @@ unread = Unread read = Read no_unread = You have no unread notifications. no_read = You have no read notifications. +pin = Pin +mark_as_read = Mark as read +mark_as_unread = Mark as unread diff --git a/options/locale/locale_pt-BR.ini b/options/locale/locale_pt-BR.ini index 4893a7644d5..0623fbb1351 100644 --- a/options/locale/locale_pt-BR.ini +++ b/options/locale/locale_pt-BR.ini @@ -1205,3 +1205,6 @@ unread = Não lidas read = Lidas no_unread = Você não possui notificações não lidas. no_read = Você não possui notificações lidas. +pin = Fixar +mark_as_read = Marcar como lida +mark_as_unread = Marcar como não lida diff --git a/public/css/index.css b/public/css/index.css index c569209e49a..7c84cf8517a 100644 --- a/public/css/index.css +++ b/public/css/index.css @@ -2712,12 +2712,15 @@ footer .ui.language .menu { float: left; margin-left: 7px; } -.user.notification .buttons-panel button { - padding: 3px; -} -.user.notification .buttons-panel form { +.user.notification table form { display: inline-block; } +.user.notification table button { + padding: 3px 3px 3px 5px; +} +.user.notification table tr { + cursor: pointer; +} .user.notification .octicon-issue-opened, .user.notification .octicon-git-pull-request { color: #21ba45; diff --git a/public/js/index.js b/public/js/index.js index bd22442e5fd..8674993261e 100644 --- a/public/js/index.js +++ b/public/js/index.js @@ -1243,6 +1243,11 @@ $(document).ready(function () { $($(this).data('target')).slideToggle(100); }); + // make table element clickable like a link + $('tr[data-href]').click(function(event) { + window.location = $(this).data('href'); + }); + // Highlight JS if (typeof hljs != 'undefined') { hljs.initHighlightingOnLoad(); diff --git a/public/less/_user.less b/public/less/_user.less index 38b73f78535..d63b9b3de9d 100644 --- a/public/less/_user.less +++ b/public/less/_user.less @@ -85,13 +85,17 @@ margin-left: 7px; } - .buttons-panel { + table { + form { + display: inline-block; + } + button { - padding: 3px; + padding: 3px 3px 3px 5px; } - form { - display: inline-block; + tr { + cursor: pointer; } } diff --git a/routers/user/notification.go b/routers/user/notification.go index 74a33f7e2c3..7bc2da18db9 100644 --- a/routers/user/notification.go +++ b/routers/user/notification.go @@ -73,8 +73,8 @@ func Notifications(c *context.Context) { } title := c.Tr("notifications") - if count := len(notifications); count > 0 { - title = fmt.Sprintf("(%d) %s", count, title) + if status == models.NotificationStatusUnread && total > 0 { + title = fmt.Sprintf("(%d) %s", total, title) } c.Data["Title"] = title c.Data["Keyword"] = keyword diff --git a/templates/base/head.tmpl b/templates/base/head.tmpl index e2304362095..176dd51cc02 100644 --- a/templates/base/head.tmpl +++ b/templates/base/head.tmpl @@ -82,7 +82,7 @@ {{if .IsSigned}}