From 86819f08c3294313b9b414f3c38644e4a60284c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20Hanol?= Date: Thu, 11 Feb 2016 18:48:09 +0100 Subject: [PATCH 1/2] FIX: use RFC-compliant previous replies separator --- app/mailers/user_notifications.rb | 2 +- lib/email/receiver.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/mailers/user_notifications.rb b/app/mailers/user_notifications.rb index 9029341d900..6f2345137bc 100644 --- a/app/mailers/user_notifications.rb +++ b/app/mailers/user_notifications.rb @@ -275,7 +275,7 @@ class UserNotifications < ActionMailer::Base context_posts = context_posts.to_a if context_posts.present? - context << "---\n*#{I18n.t('user_notifications.previous_discussion')}*\n" + context << "-- \n*#{I18n.t('user_notifications.previous_discussion')}*\n" context_posts.each do |cp| context << email_post_markdown(cp) end diff --git a/lib/email/receiver.rb b/lib/email/receiver.rb index fdaaddea354..cb45b7d8ba9 100644 --- a/lib/email/receiver.rb +++ b/lib/email/receiver.rb @@ -143,7 +143,7 @@ module Email end def previous_replies_regex - @previous_replies_regex ||= /^---\n\*#{I18n.t("user_notifications.previous_discussion")}\*\n/im + @previous_replies_regex ||= /^--[- ]\n\*#{I18n.t("user_notifications.previous_discussion")}\*\n/im end def trim_discourse_markers(reply) From 3e872502150d697b0a35c27486aa67adbe88a504 Mon Sep 17 00:00:00 2001 From: Sam Date: Fri, 12 Feb 2016 17:51:08 +1100 Subject: [PATCH 2/2] UX: initial take at collapsing mobile nav on user page --- .../discourse/components/mobile-nav.js.es6 | 38 +++++++++++ .../controllers/user-activity.js.es6 | 2 +- .../controllers/user-notifications.js.es6 | 2 + .../controllers/user-private-messages.js.es6 | 6 +- .../discourse/controllers/user.js.es6 | 3 +- .../templates/components/mobile-nav.hbs | 1 + .../mobile/components/mobile-nav.hbs | 4 ++ .../discourse/templates/user/activity.hbs | 9 +-- .../discourse/templates/user/messages.hbs | 5 +- .../templates/user/notifications.hbs | 4 +- .../discourse/templates/user/user.hbs | 7 +- app/assets/stylesheets/mobile/discourse.scss | 66 +++++++++++++++++++ 12 files changed, 127 insertions(+), 20 deletions(-) create mode 100644 app/assets/javascripts/discourse/components/mobile-nav.js.es6 create mode 100644 app/assets/javascripts/discourse/templates/components/mobile-nav.hbs create mode 100644 app/assets/javascripts/discourse/templates/mobile/components/mobile-nav.hbs diff --git a/app/assets/javascripts/discourse/components/mobile-nav.js.es6 b/app/assets/javascripts/discourse/components/mobile-nav.js.es6 new file mode 100644 index 00000000000..939e3010fa4 --- /dev/null +++ b/app/assets/javascripts/discourse/components/mobile-nav.js.es6 @@ -0,0 +1,38 @@ +export default Ember.Component.extend({ + + _init: function(){ + if (!this.get('site.mobileView')) { + var classes = this.get('desktopClass'); + if (classes) { + classes = classes.split(' '); + this.set('classNames', classes); + } + } + }.on('init'), + + tagName: 'ul', + + classNames: ['mobile-nav'], + + currentPathChanged: function(){ + this.set('expanded', false); + Em.run.next(() => this._updateSelectedHtml()); + }.observes('currentPath'), + + _updateSelectedHtml(){ + const active = this.$('.active'); + if (active && active.html) { + this.set('selectedHtml', active.html()); + } + }, + + didInsertElement(){ + this._updateSelectedHtml(); + }, + + actions: { + toggleExpanded(){ + this.toggleProperty('expanded'); + } + } +}); diff --git a/app/assets/javascripts/discourse/controllers/user-activity.js.es6 b/app/assets/javascripts/discourse/controllers/user-activity.js.es6 index 59c6b6dd81d..55ab7846cae 100644 --- a/app/assets/javascripts/discourse/controllers/user-activity.js.es6 +++ b/app/assets/javascripts/discourse/controllers/user-activity.js.es6 @@ -3,7 +3,7 @@ import { exportUserArchive } from 'discourse/lib/export-csv'; export default Ember.Controller.extend({ userActionType: null, needs: ["application", "user"], - + currentPath: Em.computed.alias('controllers.application.currentPath'), viewingSelf: Em.computed.alias("controllers.user.viewingSelf"), showBookmarks: Em.computed.alias("controllers.user.showBookmarks"), diff --git a/app/assets/javascripts/discourse/controllers/user-notifications.js.es6 b/app/assets/javascripts/discourse/controllers/user-notifications.js.es6 index 85865c16e50..c06137a9e1b 100644 --- a/app/assets/javascripts/discourse/controllers/user-notifications.js.es6 +++ b/app/assets/javascripts/discourse/controllers/user-notifications.js.es6 @@ -7,6 +7,8 @@ export default Ember.ArrayController.extend({ showDismissButton: Ember.computed.gt('user.total_unread_notifications', 0), + currentPath: Em.computed.alias('controllers.application.currentPath'), + actions: { resetNew: function() { Discourse.ajax('/notifications/mark-read', { method: 'PUT' }).then(() => { diff --git a/app/assets/javascripts/discourse/controllers/user-private-messages.js.es6 b/app/assets/javascripts/discourse/controllers/user-private-messages.js.es6 index eb8d13c7213..73c8ff293a9 100644 --- a/app/assets/javascripts/discourse/controllers/user-private-messages.js.es6 +++ b/app/assets/javascripts/discourse/controllers/user-private-messages.js.es6 @@ -3,11 +3,11 @@ import Topic from 'discourse/models/topic'; export default Ember.Controller.extend({ - needs: ["user-topics-list", "user"], + needs: ["application", "user-topics-list", "user"], pmView: false, - viewingSelf: Em.computed.alias("controllers.user.viewingSelf"), + viewingSelf: Em.computed.alias('controllers.user.viewingSelf'), isGroup: Em.computed.equal('pmView', 'groups'), - + currentPath: Em.computed.alias('controllers.application.currentPath'), selected: Em.computed.alias('controllers.user-topics-list.selected'), bulkSelectEnabled: Em.computed.alias('controllers.user-topics-list.bulkSelectEnabled'), diff --git a/app/assets/javascripts/discourse/controllers/user.js.es6 b/app/assets/javascripts/discourse/controllers/user.js.es6 index 64202d09858..24b26957da3 100644 --- a/app/assets/javascripts/discourse/controllers/user.js.es6 +++ b/app/assets/javascripts/discourse/controllers/user.js.es6 @@ -6,7 +6,8 @@ import User from 'discourse/models/user'; export default Ember.Controller.extend(CanCheckEmails, { indexStream: false, userActionType: null, - needs: ['user-notifications', 'user-topics-list'], + needs: ['application','user-notifications', 'user-topics-list'], + currentPath: Em.computed.alias('controllers.application.currentPath'), @computed("content.username") viewingSelf(username) { diff --git a/app/assets/javascripts/discourse/templates/components/mobile-nav.hbs b/app/assets/javascripts/discourse/templates/components/mobile-nav.hbs new file mode 100644 index 00000000000..889d9eeadc1 --- /dev/null +++ b/app/assets/javascripts/discourse/templates/components/mobile-nav.hbs @@ -0,0 +1 @@ +{{yield}} diff --git a/app/assets/javascripts/discourse/templates/mobile/components/mobile-nav.hbs b/app/assets/javascripts/discourse/templates/mobile/components/mobile-nav.hbs new file mode 100644 index 00000000000..6b46d500ee7 --- /dev/null +++ b/app/assets/javascripts/discourse/templates/mobile/components/mobile-nav.hbs @@ -0,0 +1,4 @@ +
  • {{{selectedHtml}}}
  • + diff --git a/app/assets/javascripts/discourse/templates/user/activity.hbs b/app/assets/javascripts/discourse/templates/user/activity.hbs index e94b740c9c4..4eb0971cc14 100644 --- a/app/assets/javascripts/discourse/templates/user/activity.hbs +++ b/app/assets/javascripts/discourse/templates/user/activity.hbs @@ -1,26 +1,21 @@
    - + {{/mobile-nav}} {{#if viewingSelf}}
    diff --git a/app/assets/javascripts/discourse/templates/user/messages.hbs b/app/assets/javascripts/discourse/templates/user/messages.hbs index 9b02cc4f234..afc7d0f4278 100644 --- a/app/assets/javascripts/discourse/templates/user/messages.hbs +++ b/app/assets/javascripts/discourse/templates/user/messages.hbs @@ -4,7 +4,8 @@ {{d-button class="btn-primary new-private-message" action="composePrivateMessage" icon="envelope" label="user.new_private_message"}} {{/if}} {{/unless}} - + {{/mobile-nav}}
    diff --git a/app/assets/javascripts/discourse/templates/user/notifications.hbs b/app/assets/javascripts/discourse/templates/user/notifications.hbs index aece3ca5ca2..385e029b6b2 100644 --- a/app/assets/javascripts/discourse/templates/user/notifications.hbs +++ b/app/assets/javascripts/discourse/templates/user/notifications.hbs @@ -1,6 +1,6 @@
    - + {{/mobile-nav}}
    diff --git a/app/assets/javascripts/discourse/templates/user/user.hbs b/app/assets/javascripts/discourse/templates/user/user.hbs index 6d9ac7af346..39718247396 100644 --- a/app/assets/javascripts/discourse/templates/user/user.hbs +++ b/app/assets/javascripts/discourse/templates/user/user.hbs @@ -148,13 +148,12 @@ {{/unless}}
    - + {{/mobile-nav}}
    diff --git a/app/assets/stylesheets/mobile/discourse.scss b/app/assets/stylesheets/mobile/discourse.scss index a023c2e7ef8..acc5ab256c5 100644 --- a/app/assets/stylesheets/mobile/discourse.scss +++ b/app/assets/stylesheets/mobile/discourse.scss @@ -93,3 +93,69 @@ h2#site-text-logo .badge-wrapper { font-weight: normal; } + +.user-table { + position: relative; +} + +.mobile-view .mobile-nav { + &.messages-nav, &.notifications-nav, &.activity-nav { + position: absolute; + right: 0px; + top: -55px; + } +} + + +.mobile-view .mobile-nav { + a .fa { + margin-right: 8px; + } + a { + color: $primary; + } + margin: 0; + padding: 0; + background: dark-light-diff($primary, $secondary, 90%, -65%); + list-style: none; + overflow: visible; + position: relative; + width: 40%; + + > li > a { + padding: 8px 10px; + height: 100%; + width: 100%; + display: block; + } + .fa-caret-down { + position: absolute; + right: 0px; + } + + .drop { + display: none; + } + .drop.expanded { + left: 0; + display: block; + position: absolute; + z-index: 10000000; + background-color: $secondary; + width: 98%; + list-style: none; + margin: 0; + padding: 5px; + border: 1px solid #eaeaea; + li { + margin: 5px 0; + padding: 0; + a { + width: 100%; + height: 100%; + display: block; + padding: 5px 8px; + } + } + } +}