fix firefox focus bug on flagging dialog

This commit is contained in:
Sam Saffron
2013-02-06 11:47:08 +11:00
parent 1a7e2f14d4
commit 3fd019c6bd
3 changed files with 27 additions and 21 deletions

View File

@@ -6,18 +6,21 @@
<label class='radio'>
<input type='radio' id="radio_{{unbound name_key}}" {{action changePostActionType this target="view"}} name='post_action_type_index'> <strong>{{name}}</strong>
{{#if is_custom_flag}}
{{#if view.isCustomFlag}}
{{view Ember.TextArea name="message" class="flag-message" placeholderBinding="view.customPlaceholder" valueBinding="view.customFlagMessage"}}
<div {{bindAttr class="view.customMessageLengthClasses"}}>{{view.customMessageLength}}</div>
{{else}}
{{#unless view.isCustomFlag}}
<div class='description'>{{{description}}}</div>
{{/if}}
{{/unless}}
{{else}}
{{#if description}}
<div class='description'>{{{description}}}</div>
{{/if}}
{{/if}}
</label>
{{#if is_custom_flag}}
{{#if view.isCustomFlag}}
{{view Ember.TextArea name="message" class="flag-message" placeholderBinding="view.customPlaceholder" valueBinding="view.customFlagMessage"}}
<div {{bindAttr class="view.customMessageLengthClasses"}}>{{view.customMessageLength}}</div>
{{/if}}
{{/if}}
</div>
{{/each}}
</form>

View File

@@ -3,6 +3,8 @@ window.Discourse.FlagView = Ember.View.extend
title: Em.String.i18n('flagging.title')
changePostActionType: (action) ->
if @get('postActionTypeId') == action.id
return false
@set('postActionTypeId', action.id)
@set('isCustomFlag', action.is_custom_flag)
Em.run.next -> $("#radio_#{action.name_key}").prop('checked', 'true')
@@ -40,7 +42,7 @@ window.Discourse.FlagView = Ember.View.extend
message = Em.String.i18n("flagging.custom_message.left", n: 500 - len)
@set("customMessageLengthClasses", "ok custom-message-length")
@set("customMessageLength",message)
return
).observes("customFlagMessage")
didInsertElement: ->
@@ -51,3 +53,4 @@ window.Discourse.FlagView = Ember.View.extend
# Would be nice if there were an EmberJs radio button to do this for us. Oh well, one should be coming
# in an upcoming release.
$("input[type='radio']", $flagModal).prop('checked', false)
return