Align admin progress bars form fields with new translations interface
Add new js method to recover selected language to disable correctly default language fields.
This commit is contained in:
committed by
Senén Rodero Rodríguez
parent
c1a72e7169
commit
12089282c8
@@ -40,7 +40,8 @@ App.Forms =
|
||||
hideOrShowFieldsAfterSelection: ->
|
||||
$("[name='progress_bar[kind]']").on
|
||||
change: ->
|
||||
title_field = $("[name^='progress_bar'][name$='[title]']").parent()
|
||||
locale = App.Globalize.selected_language()
|
||||
title_field = $(".translatable-fields[data-locale=#{locale}]")
|
||||
|
||||
if this.value == "primary"
|
||||
title_field.hide()
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
App.Globalize =
|
||||
|
||||
selected_language: ->
|
||||
$("#select_language").val()
|
||||
|
||||
display_locale: (locale) ->
|
||||
App.Globalize.enable_locale(locale)
|
||||
App.Globalize.add_language(locale)
|
||||
|
||||
@@ -2,30 +2,39 @@
|
||||
|
||||
<%= translatable_form_for [:tracking, *resource_hierarchy_for(@progress_bar)] do |f| %>
|
||||
|
||||
<div class="small-12 medium-6">
|
||||
<%= f.enum_select :kind %>
|
||||
<div class="row">
|
||||
<div class="small-12 medium-6 column">
|
||||
<%= f.enum_select :kind %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%= f.translatable_fields do |translations_form| %>
|
||||
<div class="small-12 medium-6">
|
||||
<%= translations_form.text_field :title %>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="row">
|
||||
<%= f.translatable_fields do |translations_form| %>
|
||||
<div class="small-12 medium-6 column end">
|
||||
<%= translations_form.text_field :title %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<% progress_options = { min: ProgressBar::RANGE.min, max: ProgressBar::RANGE.max, step: 1 } %>
|
||||
<div class="small-12 medium-6 large-2">
|
||||
<%= f.text_field :percentage, { type: :range,
|
||||
id: "percentage_range",
|
||||
class: "column" }.merge(progress_options) %>
|
||||
</div>
|
||||
<div class="small-12 medium-6 large-2">
|
||||
<div class="input-group">
|
||||
<%= f.text_field :percentage, { type: :number,
|
||||
label: false,
|
||||
class: "input-group-field" }.merge(progress_options) %>
|
||||
<span class="input-group-label">%</span>
|
||||
<div class="row">
|
||||
<div class="small-12 medium-6 large-2 column">
|
||||
<%= f.text_field :percentage, { type: :range,
|
||||
id: "percentage_range",
|
||||
class: "column" }.merge(progress_options) %>
|
||||
</div>
|
||||
|
||||
<div class="small-12 medium-6 large-2 column">
|
||||
<div class="input-group">
|
||||
<%= f.text_field :percentage, { type: :number,
|
||||
label: false,
|
||||
class: "input-group-field" }.merge(progress_options) %>
|
||||
<span class="input-group-label">%</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="column">
|
||||
<%= f.submit nil, class: "button success" %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%= f.submit nil, class: "button success" %>
|
||||
<% end %>
|
||||
|
||||
Reference in New Issue
Block a user