Sha256: f5c014fdec425511dc017e75e9ddff2d1fe190357067ff38242865ace19a721d
Contents?: true
Size: 1.66 KB
Versions: 10
Compression:
Stored size: 1.66 KB
Contents
<% require 'smalruby_editor' require 'smalruby_editor/blockly_message_helper' %> # signin dialog view Smalruby.SigninModalView = Backbone.View.extend events: 'click #signin-modal-ok-button': 'onOk' # FIXME: 本当は#signin-modal .ok-buttonを指定したいができなかった initialize: -> Smalruby.ignoreEnterKey(@$el) Smalruby.removeBackdropOnHidden(@$el) @$el.on 'shown', => @$el.find('#signin-modal-username') .focus() render: -> @$el.find('#signin-modal-username') .val($('#username-label').text()) modalOptions = { backdrop: 'static' } if Smalruby.isEnabled('enabled_must_signin') @$el.find('#signin-modal-cancel-button').hide() modalOptions['keyboard'] = false else @$el.find('#signin-modal-cancel-button').show() modalOptions['keyboard'] = true @$el.modal(modalOptions) @$el.modal('show') onOk: (e) -> username = @$el.find('input[name=username]').val() if $.trim(username).length > 0 $.post('/sessions/', { username: username }) .then( (data) -> Smalruby.setPreferences(data) Smalruby.username = username $('#signin-button').hide() $('.signed-in-menu').show() $('#username-label').text(username) $('#username-button').show() successMessage(<%= bm('.signed_in') %>) new $.Deferred().resolve().promise() -> errorMessage(<%= bm('.error') %>) new $.Deferred().resolve().promise() ) .done => if Smalruby.username != null || !Smalruby.isEnabled('enabled_must_signin') @$el.modal('hide')
Version data entries
10 entries across 10 versions & 1 rubygems