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