107 lines
4.9 KiB
Plaintext
107 lines
4.9 KiB
Plaintext
|
<%= stylesheet_link_tag "lib/togglebox"%>
|
||
|
<style>
|
||
|
ul.inline > li.control-group{
|
||
|
display: table;
|
||
|
}
|
||
|
.control-group .toggle-control .togglebox{
|
||
|
margin-top: 0;
|
||
|
}
|
||
|
</style>
|
||
|
<%= form_for @video_pro_setting, url: update_settings_admin_video_pros_path, html: {class: "form-horizontal main-forms"} do |f| %>
|
||
|
<fieldset>
|
||
|
<div class="control-group">
|
||
|
<label for="video_pro_post_agency" class="control-label muted">
|
||
|
<%= t("video_pro.post_agency")%>
|
||
|
</label>
|
||
|
<div class="controls">
|
||
|
<div id="post_agencies_block">
|
||
|
<% f.object.post_agencies.to_a.each_with_index do |dept, idx| %>
|
||
|
<div class="post_agency">
|
||
|
<div class="tab-content">
|
||
|
<% @site_in_use_locales.each_with_index do |locale, i| %>
|
||
|
<div class="tab-pane fade <%= ( i == 0 ) ? "active in" : '' %>" id="post_agencies_<%=idx%>_<%= locale %>">
|
||
|
<%= f.fields_for :post_agencies_translations,f.object do |f| %>
|
||
|
<%= f.text_field "#{locale}][", :value => (f.object.post_agencies_translations[locale][idx] rescue ""), :placeholder=>t("video_pro.post_agency", :id=>nil) %>
|
||
|
<% end %>
|
||
|
</div>
|
||
|
<% end %>
|
||
|
</div>
|
||
|
<div class="btn-group" data-toggle="buttons-radio">
|
||
|
<% @site_in_use_locales.each_with_index do |locale, i| %>
|
||
|
<a class="btn <%= ( i == 0 ) ? "active" : '' %>" href="#post_agencies_<%=idx%>_<%= locale %>" data-toggle="tab"><%= t(locale.to_s) %></a>
|
||
|
<% end %>
|
||
|
</div>
|
||
|
<button class="remove_agency btn btn-danger" type="button">X</button>
|
||
|
</div>
|
||
|
<% end %>
|
||
|
<button class="add_agency btn btn-primary" type="button"><%= t(:add) %></button>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div class="control-group">
|
||
|
<label for="video_pro_setting_enable" class="control-label muted">
|
||
|
<%= t("video_pro.enable_name_mapping")%>
|
||
|
</label>
|
||
|
<div class="controls">
|
||
|
<label class="checkbox">
|
||
|
<%= f.check_box :enable_name_mapping, :id => "video_pro_setting_enable", :class => "toggle-check", "data-disabled" => "#{(f.object.enable_name_mapping == false)}" %>
|
||
|
</label>
|
||
|
</div>
|
||
|
</div>
|
||
|
<!-- Language Tabs -->
|
||
|
<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.to_s) %></a>
|
||
|
</li>
|
||
|
<% end %>
|
||
|
</ul>
|
||
|
<!-- Language -->
|
||
|
<div class="tab-content language-area">
|
||
|
<% @site_in_use_locales.each_with_index do |locale, i| %>
|
||
|
<ul class="inline <%= locale %> tab-pane fade <%= ( i == 0 ) ? "in active" : '' %>">
|
||
|
<% User.where(:beta_tester.ne=>true).each do |user| %>
|
||
|
<% user_id = user.id.to_s %>
|
||
|
<li class="control-group">
|
||
|
<label class="control-label"><%= user.member_name %></label>
|
||
|
<div class="controls">
|
||
|
<div class="textarea">
|
||
|
<%= f.fields_for :user_mapping_translations do |f| %>
|
||
|
<%= f.fields_for locale do |f| %>
|
||
|
<%= f.text_field user_id, value: (@video_pro_setting.user_mapping_translations[locale][user_id] rescue nil), class: "input-block-level" %>
|
||
|
<% end %>
|
||
|
<% end %>
|
||
|
</div>
|
||
|
</div>
|
||
|
</li>
|
||
|
<% end %>
|
||
|
</ul>
|
||
|
<% end %>
|
||
|
</div>
|
||
|
<!-- Form Actions -->
|
||
|
<div class="form-actions">
|
||
|
<input type="hidden" name="referer_url" value="<%= request.referer %>">
|
||
|
<%= f.submit t('submit'), class: 'btn btn-primary' %>
|
||
|
</div>
|
||
|
</fieldset>
|
||
|
<% end %>
|
||
|
<script>
|
||
|
$(document).ready(function(){
|
||
|
$(document).on("click",".remove_agency",function(){
|
||
|
if(window.confirm("Are you sure?"))
|
||
|
$(this).parents(".post_agency").eq(0).remove();
|
||
|
})
|
||
|
$(".add_agency").click(function(){
|
||
|
var tmp_text = '<div class="post_agency"><div class="tab-content">';
|
||
|
<% @site_in_use_locales.each_with_index do |locale, i| %>
|
||
|
tmp_text += '<div class="tab-pane fade <%= ( i == 0 ) ? "active in" : '' %>" id="post_agencies_new_idx_<%= locale %>"><input name="video_pro_setting[post_agencies_translations][<%=locale%>][]" placeholder="<%=t('video_pro.post_agency')%>" type="text" title="<%=t('video_pro.post_agency')%>"></div>';
|
||
|
<% end %>
|
||
|
tmp_text += '</div><div class="btn-group" data-toggle="buttons-radio">';
|
||
|
<% @site_in_use_locales.each_with_index do |locale, i| %>
|
||
|
tmp_text += '<a class="btn <%= ( i == 0 ) ? "active" : '' %>" href="#post_agencies_new_idx_<%=locale%>" data-toggle="tab"><%= t(locale.to_s) %></a>';
|
||
|
<% end %>
|
||
|
tmp_text += '</div><button class="remove_agency btn btn-danger" type="button">X</button></div';
|
||
|
$(this).before(tmp_text.replace(/new_idx/g,$(".post_agency").length.toString()));
|
||
|
})
|
||
|
})
|
||
|
</script>
|