This commit is contained in:
BoHung Chiu 2023-08-05 20:59:32 +08:00
parent e16fc6a9b7
commit b6e0913fab
1 changed files with 51 additions and 36 deletions

View File

@ -20,7 +20,7 @@
<!-- Input Area -->
<div class="input-area">
parse_again_start * 1 if locale_fields_input_fields
<!-- Language Tabs -->
<div class="nav-name"><strong><%= t(:language) %></strong></div>
<ul class="nav nav-pills language-nav">
@ -33,13 +33,15 @@
<%= copy_to_all_language_button(".language-nav", ".language-area") %>
</li>
</ul>
parse_again_end
parse_again_start * 1 if locale_fields_input_fields
<!-- 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" : '' %>">
parse_again_end
parse_again_start
<!-- locale_fields -->
<div class="control-group input-title">
@ -49,16 +51,19 @@
</div>
</div>
parse_again_end
parse_again_start * 1 if locale_fields_input_fields
</div>
<% end %>
parse_again_end
parse_again_start * 1 if module_modal_template_link
<!-- Link -->
<%
links_hash = {}
plugin_template_related_links_text.each do |link|
hash = {}
hash["html"] = add_attribute("form_link", f, link.pluralize.to_sym)
hash["count"] = @plugin_template.send(link.pluralize).count rescue 0
links_hash[link] = hash
hash = {}
hash["html"] = add_attribute("form_link", f, link.pluralize.to_sym)
hash["count"] = @plugin_template.send(link.pluralize).count rescue 0
links_hash[link] = hash
%>
<div class="control-group">
<label class="control-label muted"><%= t("personal_plugin_template.#{link}") %></label>
@ -88,44 +93,49 @@
</div>
</div>
<% end %>
parse_again_end
parse_again_start * 1 if module_modal_template_file
<!-- File -->
<%
files_hash = {}
plugin_template_related_files_text.each do |file|
hash = {}
hash["html"] = add_attribute("form_file", f, file.pluralize.to_sym)
hash["count"] = @plugin_template.send(file.pluralize).count rescue 0
files_hash[file] = hash
hash = {}
hash["html"] = add_attribute("form_file", f, file.pluralize.to_sym)
hash["count"] = @plugin_template.send(file.pluralize).count rescue 0
files_hash[file] = hash
%>
<div class="control-group">
<label class="control-label muted"><%= t("personal_plugin_template.#{file}") %></label>
<div class="controls">
<div class="control-group">
<label class="control-label muted"><%= t("personal_plugin_template.#{file}") %></label>
<div class="controls">
<!-- Exist -->
<% if !@plugin_template.new_record? && hash["count"] > 0 %>
<div class="exist">
<% @plugin_template.send(file.pluralize).each_with_index do |obj, i| %>
<% if !obj.new_record? %>
<%= f.fields_for file.pluralize.to_sym, obj do |f| %>
<%= render :partial => "form_file", :object => obj, :locals => {:f => f, :i => i} %>
<!-- Exist -->
<% if !@plugin_template.new_record? && hash["count"] > 0 %>
<div class="exist">
<% @plugin_template.send(file.pluralize).each_with_index do |obj, i| %>
<% if !obj.new_record? %>
<%= f.fields_for file.pluralize.to_sym, obj do |f| %>
<%= render :partial => "form_file", :object => obj, :locals => {:f => f, :i => i} %>
<% end %>
<% end %>
<% end %>
<% end %>
<hr>
<% end %>
<hr>
</div>
<% end %>
<!-- Add -->
<div class="add-target" for="<%= file %>">
</div>
<% end %>
<p class="add-btn">
<a class="add_file trigger btn btn-small btn-primary" for="<%= file %>"><i class="icons-plus"></i> <%= t(:add) %></a>
</p>
<!-- Add -->
<div class="add-target" for="<%= file %>">
</div>
<p class="add-btn">
<a class="add_file trigger btn btn-small btn-primary" for="<%= file %>"><i class="icons-plus"></i> <%= t(:add) %></a>
</p>
</div>
</div>
<% end %>
parse_again_end
parse_again_start * 1 if locale_fields_input_fields
</div>
parse_again_end
<div class="nav-name"><strong><%= t(:module) %></strong></div>
<ul class="nav nav-pills module-nav">
<li></li>
@ -204,6 +214,7 @@
<%= link_to t('cancel'), request.referer, :class=>"btn" %>
</div>
<script type="text/javascript">
parse_again_start * 1 if module_modal_template_file
var files = <%= files_hash.to_json.html_safe %>;
$("a.add_file").on("click",function(){
var type = $(this).attr("for"),
@ -216,7 +227,11 @@
files[type].count = count;
return false;
})
$(document).on('click', '.delete_file', function(){
$(this).parents('.input-prepend').remove();
});
parse_again_end
parse_again_start * 1 if module_modal_template_link
var links = <%= links_hash.to_json.html_safe %>;
$("a.add_link").on("click",function(){
var type = $(this).attr("for"),
@ -229,10 +244,10 @@
links[type].count = count;
return false;
})
$(document).on('click', '.delete_file', function(){
$(this).parents('.input-prepend').remove();
});
$(document).on('click', '.delete_link', function(){
$(this).parents('.input-prepend').remove();
});
parse_again_end
$(document).on('click', '.remove_existing_record', function(){
if(confirm("<%= I18n.t(:sure?)%>")){
$(this).children('.should_destroy').attr('value', 1);