Compare commits

...

3 Commits

Author SHA1 Message Date
Bernie Chiu aa180dcf7e Refactor the title locale display 2013-12-31 14:08:42 +08:00
Bernie Chiu 090176dcd2 Fix wrong displayed field in current locale 2013-12-31 11:42:14 +08:00
Bernie Chiu c86fb93702 Fix added option field to sync with primary locale 2013-12-31 11:27:49 +08:00
2 changed files with 29 additions and 35 deletions

View File

@ -22,6 +22,8 @@ class Panel::Survey::BackEnd::SurveysController < OrbitBackendController
def new
@survey = ::Survey.new
@primary_locale = I18n.locale.to_s
@secondary_locale = (I18n.locale == :zh_tw) ? "en" : "zh_tw"
respond_to do |format|
format.html # new.html.erb
@ -47,6 +49,8 @@ class Panel::Survey::BackEnd::SurveysController < OrbitBackendController
end
def edit
@primary_locale = I18n.locale.to_s
@secondary_locale = (I18n.locale == :zh_tw) ? "en" : "zh_tw"
@survey = ::Survey.find(params[:id])
@sqs = []
@survey.survey_questions.each do |sq|

View File

@ -7,7 +7,7 @@
{{if _id}}
<input id="${_id[0]}" name="${_id[1]}" type="hidden" value="${_id[2]}">
{{/if}}
<h4><b></b> Q<span>${_length}</span> <i class="icon-caret-up"></i> <span class="questions-title">${_title_translations[3].en}</span></h4>
<h4><b></b> Q<span>${_length}</span> <i class="icon-caret-up"></i> <span class="questions-title">${_title_translations[3].<%= @primary_locale %>}</span></h4>
</div>
<div class="attributes-body">
<div class="control-group">
@ -15,21 +15,16 @@
<div class="controls">
<div class="input-append">
<div class="tab-content">
<div class="tab-pane fade active in" id="${_title_translations[2]+'_en'}">
<input class="span4 q-title" id="${_title_translations[0]+'_en'}" name="${_title_translations[1]+'[en]'}" type="text" value="${_title_translations[3].en}" />
<div class="tab-pane fade active in" id="${_title_translations[2]+'_<%= @primary_locale %>'}">
<input class="span4 q-title" id="${_title_translations[0]+'_<%= @primary_locale %>'}" name="${_title_translations[1]+'[<%= @primary_locale %>]'}" type="text" value="${_title_translations[3].<%= @primary_locale %>}" />
</div>
<div class="tab-pane fade" id="${_title_translations[2]+'_zh_tw'}">
<input class="span4 q-title" id="${_title_translations[0]+'_zh_tw'}" name="${_title_translations[1]+'[zh_tw]'}" type="text" value="${_title_translations[3].zh_tw}" />
<div class="tab-pane fade" id="${_title_translations[2]+'_<%= @secondary_locale %>'}">
<input class="span4 q-title" id="${_title_translations[0]+'_<%= @secondary_locale %>'}" name="${_title_translations[1]+'[<%= @secondary_locale %>]'}" type="text" value="${_title_translations[3].<%= @secondary_locale %>}" />
</div>
</div>
<div class="btn-group" data-toggle="buttons-radio">
<% if I18n.locale == :zh_tw %>
<a class="btn change-title active" href="${'#'+_title_translations[2]+'_zh_tw'}" data-toggle="tab"><%= I18nVariable.from_locale('zh_tw') %></a>
<a class="btn change-title" href="${'#'+_title_translations[2]+'_en'}" data-toggle="tab"><%= I18nVariable.from_locale('en') %></a>
<% else %>
<a class="btn change-title active" href="${'#'+_title_translations[2]+'_en'}" data-toggle="tab"><%= I18nVariable.from_locale('en') %></a>
<a class="btn change-title" href="${'#'+_title_translations[2]+'_zh_tw'}" data-toggle="tab"><%= I18nVariable.from_locale('zh_tw') %></a>
<% end %>
<a class="btn change-title active" href="${'#'+_title_translations[2]+'_<%= @primary_locale %>'}" data-toggle="tab"><%= I18nVariable.from_locale(@primary_locale) %></a>
<a class="btn change-title" href="${'#'+_title_translations[2]+'_<%= @secondary_locale %>'}" data-toggle="tab"><%= I18nVariable.from_locale(@secondary_locale) %></a>
</div>
</div>
</div>
@ -39,19 +34,14 @@
<div class="controls">
<div class="tab-content textarea-lang">
<div class="btn-group" data-toggle="buttons-radio">
<% if I18n.locale == :zh_tw %>
<a class="btn active" href="${'#'+_description_translations[2]+'_zh_tw'}" data-toggle="tab"><%= I18nVariable.from_locale('zh_tw') %></a>
<a class="btn" href="${'#'+_description_translations[2]+'_en'}" data-toggle="tab"><%= I18nVariable.from_locale('en') %></a>
<% else %>
<a class="btn active" href="${'#'+_description_translations[2]+'_en'}" data-toggle="tab"><%= I18nVariable.from_locale('en') %></a>
<a class="btn" href="${'#'+_description_translations[2]+'_zh_tw'}" data-toggle="tab"><%= I18nVariable.from_locale('zh_tw') %></a>
<% end %>
<a class="btn active" href="${'#'+_description_translations[2]+'_<%= @primary_locale %>'}" data-toggle="tab"><%= I18nVariable.from_locale(@primary_locale) %></a>
<a class="btn" href="${'#'+_description_translations[2]+'_<%= @secondary_locale %>'}" data-toggle="tab"><%= I18nVariable.from_locale(@secondary_locale) %></a>
</div>
<div class="tab-pane fade active in" id="${_description_translations[2]+'_en'}">
<textarea class="resizable" id="${_description_translations[0]+'_en'}" name="${_description_translations[1]+'[en]'}" rows="3">${_description_translations[3].en}</textarea>
<div class="tab-pane fade active in" id="${_description_translations[2]+'_<%= @primary_locale %>'}">
<textarea class="resizable" id="${_description_translations[0]+'_<%= @primary_locale %>'}" name="${_description_translations[1]+'[<%= @primary_locale %>]'}" rows="3">${_description_translations[3].<%= @primary_locale %>}</textarea>
</div>
<div class="tab-pane fade" id="${_description_translations[2]+'_zh_tw'}">
<textarea class="resizable" id="${_description_translations[0]+'_zh_tw'}" name="${_description_translations[1]+'[zh_tw]'}" rows="3">${_description_translations[3].zh_tw}</textarea>
<div class="tab-pane fade" id="${_description_translations[2]+'_<%= @secondary_locale %>'}">
<textarea class="resizable" id="${_description_translations[0]+'_<%= @secondary_locale %>'}" name="${_description_translations[1]+'[<%= @secondary_locale %>]'}" rows="3">${_description_translations[3].<%= @secondary_locale %>}</textarea>
</div>
</div>
</div>
@ -139,16 +129,16 @@
<input type="hidden" class="should_destroy_option" name="${_destroy[0]}" />
{{/if}}
<div class="tab-content">
<div class="tab-pane fade active in" id="${_radiogroups[2]+'en'}">
<input type="text" class="span4" id="${_radiogroups[0]+'en'}" name="${_radiogroups[1]+'[en]'}" value="${_radiogroups[3].en}" />
<div class="tab-pane fade active in" id="${_radiogroups[2]+'<%= @primary_locale %>'}">
<input type="text" class="span4" id="${_radiogroups[0]+'<%= @primary_locale %>'}" name="${_radiogroups[1]+'[<%= @primary_locale %>]'}" value="${_radiogroups[3].<%= @primary_locale %>}" />
</div>
<div class="tab-pane fade" id="${_radiogroups[2]+'zh_tw'}">
<input type="text" class="span4" id="${_radiogroups[0]+'zh_tw'}" name="${_radiogroups[1]+'[zh_tw]'}" value="${_radiogroups[3].zh_tw}" />
<div class="tab-pane fade" id="${_radiogroups[2]+'<%= @secondary_locale %>'}">
<input type="text" class="span4" id="${_radiogroups[0]+'<%= @secondary_locale %>'}" name="${_radiogroups[1]+'[<%= @secondary_locale %>]'}" value="${_radiogroups[3].<%= @secondary_locale %>}" />
</div>
</div>
<div class="btn-group" data-toggle="buttons-radio">
<a class="btn active" href="${'#'+_radiogroups[2]+'en'}" data-toggle="tab">English</a>
<a class="btn" href="${'#'+_radiogroups[2]+'zh_tw'}" data-toggle="tab">Chinese</a>
<a class="btn active" href="${'#'+_radiogroups[2]+'<%= @primary_locale %>'}" data-toggle="tab"><%= I18nVariable.from_locale(@primary_locale) %></a>
<a class="btn" href="${'#'+_radiogroups[2]+'<%= @secondary_locale %>'}" data-toggle="tab"><%= I18nVariable.from_locale(@secondary_locale) %></a>
<a href="#" class="btn remove-input">
<i class="icon-trash"></i>
</a>
@ -161,16 +151,16 @@
<input type="hidden" class="should_destroy_option" name="${_destroy[0]}" />
{{/if}}
<div class="tab-content">
<div class="tab-pane fade active in" id="${_option[2]+'en'}">
<input type="text" class="span4" id="${_option[0]+'en'}" name="${_option[1]+'[en]'}" value="${_option[3].en}" />
<div class="tab-pane fade active in" id="${_option[2]+'<%= @primary_locale %>'}">
<input type="text" class="span4" id="${_option[0]+'<%= @primary_locale %>'}" name="${_option[1]+'[<%= @primary_locale %>]'}" value="${_option[3].<%= @primary_locale %>}" />
</div>
<div class="tab-pane fade" id="${_option[2]+'zh_tw'}">
<input type="text" class="span4" id="${_option[0]+'zh_tw'}" name="${_option[1]+'[zh_tw]'}" value="${_option[3].zh_tw}" />
<div class="tab-pane fade" id="${_option[2]+'<%= @secondary_locale %>'}">
<input type="text" class="span4" id="${_option[0]+'<%= @secondary_locale %>'}" name="${_option[1]+'[<%= @secondary_locale %>]'}" value="${_option[3].<%= @secondary_locale %>}" />
</div>
</div>
<div class="btn-group" data-toggle="buttons-radio">
<a class="btn active" href="${'#'+_option[2]+'en'}" data-toggle="tab">English</a>
<a class="btn" href="${'#'+_option[2]+'zh_tw'}" data-toggle="tab">Chinese</a>
<a class="btn active" href="${'#'+_option[2]+'<%= @primary_locale %>'}" data-toggle="tab"><%= I18nVariable.from_locale(@primary_locale) %></a>
<a class="btn" href="${'#'+_option[2]+'<%= @secondary_locale %>'}" data-toggle="tab"><%= I18nVariable.from_locale(@secondary_locale) %></a>
<a href="#" class="btn remove-input">
<i class="icon-trash"></i>
</a>