calendar/app/views/admin/calendars/calendar_setting.html.erb

79 lines
3.8 KiB
Plaintext

<style>
.disable_block{
display: none;
}
</style>
<%= stylesheet_link_tag "lib/togglebox"%>
<%= form_for @calendar_setting, url: update_calendar_setting_admin_calendars_path, html: {class: "form-horizontal main-forms"} do |f| %>
<div class="input-area">
<div class="control-group">
<%= f.label :enable, t("calendar.enable"), :class => "control-label muted", :for=>'calendar_setting_enable' %>
<div class="controls">
<%= f.check_box :enable , :class=>"toggle-check", :data=> { disabled: true }, :id=>'calendar_setting_enable' %>
</div>
</div>
<div id="calendar_setting_block" class="<%= 'disable_block' unless f.object.enable %>">
<!-- Language Tabs -->
<div class="nav-name"><strong><%= t(:language) %></strong></div>
<ul class="nav nav-pills language-nav">
<% @site_in_use_locales.each_with_index do |locale, i| %>
<li class="<%= 'active' if i == 0 %>">
<a data-toggle="tab" href=".<%= locale %>"><%= t(locale) %></a>
</li>
<% end %>
</ul>
<!-- Language -->
<div class="tab-content language-area">
<% @site_in_use_locales.each_with_index do |locale, i| %>
<div class="<%= locale %> tab-pane fade <%= ( i == 0 ) ? "in active" : '' %>">
<%= f.label :sunday_first, t("calendar.sunday_first"), :class => "control-label muted" %>
<div class="controls">
<%= f.fields_for :sunday_first_translations ,f.object do |f| %>
<%= hidden_field_tag "#{f.object_name}[#{locale}]" , "0" %>
<%= check_box_tag "#{f.object_name}[#{locale}]" , "1", f.object.get_sunday_first(locale) , :class=>"toggle-check", :data=> { disabled: true } %>
<% end %>
</div>
<%= f.label :date_type, t("calendar.date_type"), :class => "control-label muted" %>
<div class="controls">
<%= f.fields_for :date_type_translations ,f.object do |f| %>
<%
tmp = CalendarSetting::DateTypes[locale.to_s]
tmp = CalendarSetting::DateTypes["en"] if tmp.nil?
%>
<%= select_tag "#{f.object_name}[#{locale}]" , options_for_select(tmp.map.with_index{|t, idx| [t, idx]}, f.object.date_type_translations[locale]), {style: "width: auto;"} %>
<% end %>
</div>
<hr style="margin: 5px 0;border-top: 2px solid black;clear: left;">
<h4><%= t('calendar.calendar_mode') %></h4>
<% CalendarSetting::All_modes.each do |mode| %>
<%= f.label mode, t("calendar.mode.#{mode}"), :class => "control-label muted" %>
<div class="controls">
<%= f.fields_for :modes_translations ,f.object do |f| %>
<%= text_field_tag "#{f.object_name}[#{locale}][#{mode}]" , f.object.get_mode(mode, locale) %>
<% end %>
</div>
<% end %>
<hr style="margin: 5px 0;border-top: 2px solid black;clear: left;">
<h4><%= t('calendar.day_of_the_week') %></h4>
<% CalendarSetting::All_days.each do |idx| %>
<%= f.label "days_#{locale}_#{idx}", t("calendar.day.#{idx}"), :class => "control-label muted" %>
<% week_title = f.object.get_week_title(locale) %>
<div class="controls">
<%= f.fields_for :days_translations ,f.object do |f| %>
<%= text_field_tag "#{f.object_name}[#{locale}][]" , week_title[idx] %>
<% end %>
</div>
<% end %>
</div>
<% end %>
<div class="form-actions">
<%= f.submit t('submit'), class: 'btn btn-primary' %>
</div>
</div>
<% end %>
<script>
$('#calendar_setting_enable').change(function(){
$('#calendar_setting_block').toggleClass('disable_block');
})
</script>