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
app/assets/javascripts/discourse
db

@ -6,18 +6,21 @@
<label class='radio'> <label class='radio'>
<input type='radio' id="radio_{{unbound name_key}}" {{action changePostActionType this target="view"}} name='post_action_type_index'> <strong>{{name}}</strong> <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 is_custom_flag}}
{{#if view.isCustomFlag}} {{#unless 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}}
<div class='description'>{{{description}}}</div> <div class='description'>{{{description}}}</div>
{{/if}} {{/unless}}
{{else}} {{else}}
{{#if description}} {{#if description}}
<div class='description'>{{{description}}}</div> <div class='description'>{{{description}}}</div>
{{/if}} {{/if}}
{{/if}} {{/if}}
</label> </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> </div>
{{/each}} {{/each}}
</form> </form>

@ -3,6 +3,8 @@ window.Discourse.FlagView = Ember.View.extend
title: Em.String.i18n('flagging.title') title: Em.String.i18n('flagging.title')
changePostActionType: (action) -> changePostActionType: (action) ->
if @get('postActionTypeId') == action.id
return false
@set('postActionTypeId', action.id) @set('postActionTypeId', action.id)
@set('isCustomFlag', action.is_custom_flag) @set('isCustomFlag', action.is_custom_flag)
Em.run.next -> $("#radio_#{action.name_key}").prop('checked', 'true') 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) message = Em.String.i18n("flagging.custom_message.left", n: 500 - len)
@set("customMessageLengthClasses", "ok custom-message-length") @set("customMessageLengthClasses", "ok custom-message-length")
@set("customMessageLength",message) @set("customMessageLength",message)
return
).observes("customFlagMessage") ).observes("customFlagMessage")
didInsertElement: -> 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 # 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. # in an upcoming release.
$("input[type='radio']", $flagModal).prop('checked', false) $("input[type='radio']", $flagModal).prop('checked', false)
return

@ -71,7 +71,7 @@ CREATE TABLE categories (
-- --
CREATE SEQUENCE categories_id_seq CREATE SEQUENCE categories_id_seq
START WITH 2 START WITH 1
INCREMENT BY 1 INCREMENT BY 1
NO MINVALUE NO MINVALUE
NO MAXVALUE NO MAXVALUE
@ -125,7 +125,7 @@ CREATE TABLE category_featured_users (
-- --
CREATE SEQUENCE category_featured_users_id_seq CREATE SEQUENCE category_featured_users_id_seq
START WITH 247 START WITH 1
INCREMENT BY 1 INCREMENT BY 1
NO MINVALUE NO MINVALUE
NO MAXVALUE NO MAXVALUE
@ -156,7 +156,7 @@ CREATE TABLE draft_sequences (
-- --
CREATE SEQUENCE draft_sequences_id_seq CREATE SEQUENCE draft_sequences_id_seq
START WITH 16 START WITH 1
INCREMENT BY 1 INCREMENT BY 1
NO MINVALUE NO MINVALUE
NO MAXVALUE NO MAXVALUE
@ -190,7 +190,7 @@ CREATE TABLE drafts (
-- --
CREATE SEQUENCE drafts_id_seq CREATE SEQUENCE drafts_id_seq
START WITH 2 START WITH 1
INCREMENT BY 1 INCREMENT BY 1
NO MINVALUE NO MINVALUE
NO MAXVALUE NO MAXVALUE
@ -223,7 +223,7 @@ CREATE TABLE email_logs (
-- --
CREATE SEQUENCE email_logs_id_seq CREATE SEQUENCE email_logs_id_seq
START WITH 3 START WITH 1
INCREMENT BY 1 INCREMENT BY 1
NO MINVALUE NO MINVALUE
NO MAXVALUE NO MAXVALUE
@ -258,7 +258,7 @@ CREATE TABLE email_tokens (
-- --
CREATE SEQUENCE email_tokens_id_seq CREATE SEQUENCE email_tokens_id_seq
START WITH 3 START WITH 1
INCREMENT BY 1 INCREMENT BY 1
NO MINVALUE NO MINVALUE
NO MAXVALUE NO MAXVALUE
@ -505,7 +505,7 @@ CREATE TABLE post_action_types (
-- --
CREATE SEQUENCE post_action_types_id_seq CREATE SEQUENCE post_action_types_id_seq
START WITH 6 START WITH 1
INCREMENT BY 1 INCREMENT BY 1
NO MINVALUE NO MINVALUE
NO MAXVALUE NO MAXVALUE
@ -636,7 +636,7 @@ CREATE TABLE posts (
-- --
CREATE SEQUENCE posts_id_seq CREATE SEQUENCE posts_id_seq
START WITH 12 START WITH 1
INCREMENT BY 1 INCREMENT BY 1
NO MINVALUE NO MINVALUE
NO MAXVALUE NO MAXVALUE
@ -727,7 +727,7 @@ CREATE TABLE site_settings (
-- --
CREATE SEQUENCE site_settings_id_seq CREATE SEQUENCE site_settings_id_seq
START WITH 6 START WITH 1
INCREMENT BY 1 INCREMENT BY 1
NO MINVALUE NO MINVALUE
NO MAXVALUE NO MAXVALUE
@ -759,7 +759,7 @@ CREATE TABLE topic_allowed_users (
-- --
CREATE SEQUENCE topic_allowed_users_id_seq CREATE SEQUENCE topic_allowed_users_id_seq
START WITH 3 START WITH 1
INCREMENT BY 1 INCREMENT BY 1
NO MINVALUE NO MINVALUE
NO MAXVALUE NO MAXVALUE
@ -951,7 +951,7 @@ CREATE TABLE topics (
-- --
CREATE SEQUENCE topics_id_seq CREATE SEQUENCE topics_id_seq
START WITH 14 START WITH 1
INCREMENT BY 1 INCREMENT BY 1
NO MINVALUE NO MINVALUE
NO MAXVALUE NO MAXVALUE
@ -1057,7 +1057,7 @@ CREATE TABLE user_actions (
-- --
CREATE SEQUENCE user_actions_id_seq CREATE SEQUENCE user_actions_id_seq
START WITH 27 START WITH 1
INCREMENT BY 1 INCREMENT BY 1
NO MINVALUE NO MINVALUE
NO MAXVALUE NO MAXVALUE
@ -1121,7 +1121,7 @@ CREATE TABLE user_visits (
-- --
CREATE SEQUENCE user_visits_id_seq CREATE SEQUENCE user_visits_id_seq
START WITH 6 START WITH 1
INCREMENT BY 1 INCREMENT BY 1
NO MINVALUE NO MINVALUE
NO MAXVALUE NO MAXVALUE
@ -1187,7 +1187,7 @@ CREATE TABLE users (
-- --
CREATE SEQUENCE users_id_seq CREATE SEQUENCE users_id_seq
START WITH 3 START WITH 1
INCREMENT BY 1 INCREMENT BY 1
NO MINVALUE NO MINVALUE
NO MAXVALUE NO MAXVALUE
@ -1236,7 +1236,7 @@ CREATE TABLE versions (
-- --
CREATE SEQUENCE versions_id_seq CREATE SEQUENCE versions_id_seq
START WITH 2 START WITH 1
INCREMENT BY 1 INCREMENT BY 1
NO MINVALUE NO MINVALUE
NO MAXVALUE NO MAXVALUE