Show login modal on header buttons if required

This commit is contained in:
Chris Hunt 2013-06-04 15:37:53 -07:00
parent 978785720a
commit 789289a290
2 changed files with 32 additions and 2 deletions

View File

@ -162,6 +162,12 @@ Discourse = Ember.Application.createWithMixins({
return loginController.authenticationComplete(options); return loginController.authenticationComplete(options);
}, },
loginRequired: function() {
return (
Discourse.SiteSettings.login_required && !Discourse.User.current()
);
}.property(),
/** /**
Our own $.ajax method. Makes sure the .then method executes in an Ember runloop Our own $.ajax method. Makes sure the .then method executes in an Ember runloop
for performance reasons. Also automatically adjusts the URL to support installs for performance reasons. Also automatically adjusts the URL to support installs

View File

@ -29,10 +29,34 @@
{{/if}} {{/if}}
</li> </li>
<li> <li>
<a class='icon expand' href='#' data-dropdown="search-dropdown" title='{{i18n search.title}}'><i class='icon-search'></i></a> {{#if Discourse.loginRequired}}
<a class='icon expand' href='#' {{action showLogin}}>
<i class='icon-search'></i>
</a>
{{else}}
<a class='icon expand'
href='#'
data-dropdown="search-dropdown"
title='{{i18n search.title}}'>
<i class='icon-search'></i>
</a>
{{/if}}
</li> </li>
<li class='categories dropdown'> <li class='categories dropdown'>
<a class='icon' data-dropdown="site-map-dropdown" href="#" title='{{i18n site_map}}'><i class='icon-reorder'></i></a> {{#if Discourse.loginRequired}}
<a class='icon'
href="#"
{{action showLogin}}>
<i class='icon-reorder'></i>
</a>
{{else}}
<a class='icon'
data-dropdown="site-map-dropdown"
href="#"
title='{{i18n site_map}}'>
<i class='icon-reorder'></i>
</a>
{{/if}}
{{#if currentUser.site_flagged_posts_count}} {{#if currentUser.site_flagged_posts_count}}
<a href='/admin/flags/active' title='{{i18n notifications.total_flagged}}' class='badge-notification flagged-posts'>{{currentUser.site_flagged_posts_count}}</a> <a href='/admin/flags/active' title='{{i18n notifications.total_flagged}}' class='badge-notification flagged-posts'>{{currentUser.site_flagged_posts_count}}</a>
{{/if}} {{/if}}