From 95f4c0f5835e23716f7335b0a8ea52418ae93157 Mon Sep 17 00:00:00 2001 From: verg Date: Tue, 11 Feb 2014 20:56:49 -0500 Subject: [PATCH] Add User dropdown menu to Header --- .../controllers/user_dropdown_controller.js | 10 ++++++++ .../discourse/templates/header.js.handlebars | 13 +++++++++-- .../templates/user_dropdown.js.handlebars | 11 +++++++++ app/assets/stylesheets/desktop/header.scss | 12 ++++++++++ app/assets/stylesheets/mobile/header.scss | 10 ++++++++ .../user_dropdown_controller_test.js | 23 +++++++++++++++++++ test/javascripts/integration/header_test.js | 19 +++++++++++++++ 7 files changed, 96 insertions(+), 2 deletions(-) create mode 100644 app/assets/javascripts/discourse/controllers/user_dropdown_controller.js create mode 100644 app/assets/javascripts/discourse/templates/user_dropdown.js.handlebars create mode 100644 test/javascripts/controllers/user_dropdown_controller_test.js diff --git a/app/assets/javascripts/discourse/controllers/user_dropdown_controller.js b/app/assets/javascripts/discourse/controllers/user_dropdown_controller.js new file mode 100644 index 00000000000..4110dd01ce2 --- /dev/null +++ b/app/assets/javascripts/discourse/controllers/user_dropdown_controller.js @@ -0,0 +1,10 @@ +Discourse.UserDropdownController = Ember.ArrayController.extend(Discourse.HasCurrentUser, { + showAdminLinks: Em.computed.alias("currentUser.staff"), + + actions: { + logout: function() { + Discourse.logout(); + return false; + } + } +}); diff --git a/app/assets/javascripts/discourse/templates/header.js.handlebars b/app/assets/javascripts/discourse/templates/header.js.handlebars index 0b5601e5a27..e850f5fd803 100644 --- a/app/assets/javascripts/discourse/templates/header.js.handlebars +++ b/app/assets/javascripts/discourse/templates/header.js.handlebars @@ -89,9 +89,16 @@ {{currentUser.site_flagged_posts_count}} {{/if}} -
  • +