Small improvements.

This commit is contained in:
Martin Edenhofer 2015-07-06 13:44:48 +02:00
parent 8f3d57c0ae
commit 397a289e97
2 changed files with 10 additions and 6 deletions

View file

@ -1,6 +1,6 @@
class Index extends App.Controller class Index extends App.Controller
events: events:
'click [data-type="remove"]': 'remove' 'click .js-remove': 'remove'
constructor: -> constructor: ->
super super
@ -37,7 +37,7 @@ class Index extends App.Controller
} }
auth_providers = [] auth_providers = []
for key, provider of auth_provider_all for key, provider of auth_provider_all
if @Config.get( provider.config ) is true || @Config.get( provider.config ) is "true" if @Config.get( provider.config ) is true || @Config.get( provider.config ) is 'true'
auth_providers.push provider auth_providers.push provider
@html App.view('profile/linked_accounts')( @html App.view('profile/linked_accounts')(
@ -62,12 +62,13 @@ class Index extends App.Controller
) )
success: (data, status, xhr) => success: (data, status, xhr) =>
App.Auth.loginCheck()
@render()
@notify( @notify(
type: 'success' type: 'success'
msg: App.i18n.translateContent( 'Successfully!' ) msg: App.i18n.translateContent( 'Successfully!' )
) )
update = =>
@render()
App.User.full(@Session.get('id'), update, true)
error: (xhr, status, error) => error: (xhr, status, error) =>
@render() @render()
@ -78,4 +79,3 @@ class Index extends App.Controller
) )
App.Config.set( 'LinkedAccounts', { prio: 4000, name: 'Linked Accounts', parent: '#profile', target: '#profile/linked', controller: Index }, 'NavBarProfile' ) App.Config.set( 'LinkedAccounts', { prio: 4000, name: 'Linked Accounts', parent: '#profile', target: '#profile/linked', controller: Index }, 'NavBarProfile' )

View file

@ -5,6 +5,10 @@
</div> </div>
<ul> <ul>
<% for auth_provider in @auth_providers: %> <% for auth_provider in @auth_providers: %>
<li><%- @T( auth_provider.name ) %> <% if !@user['accounts'] || !@user['accounts'][auth_provider.key]: %><a href="<%= auth_provider.url %>"><%- @T('Add') %></a><% else: %>"<%= @user['accounts'][auth_provider.key]['username'] %>" <a href="#" data-uid="<%= @user['accounts'][auth_provider.key]['uid'] %>" data-provider="<%= auth_provider.key %>" data-type="remove"><%- @T('remove') %></a><% end %></li> <li> <%- @T( auth_provider.name ) %>
<% if !@user['accounts'] || !@user['accounts'][auth_provider.key]: %><a href="<%= auth_provider.url %>"><%- @T('Add') %></a>
<% else: %>"<%= @user['accounts'][auth_provider.key]['username'] %>" <a href="#" data-uid="<%= @user['accounts'][auth_provider.key]['uid'] %>" data-provider="<%= auth_provider.key %>" class="js-remove"><%- @T('remove') %></a>
<% end %>
</li>
<% end %> <% end %>
</ul> </ul>