From 5f24254ae3c197ff78e47303681307bdfe6bad5f Mon Sep 17 00:00:00 2001 From: bohung Date: Wed, 27 Jul 2022 13:52:42 +0800 Subject: [PATCH] Fix bug. --- .../personal_plugin_fields_controller.rb | 62 ++- .../personal_plugin_fields/_form.html.erb | 10 +- .../_render_fields_check_table.html.erb | 6 +- .../plugin_template_relateds_controller.rb | 2 +- .../admin/plugin_templates_controller.rb | 114 ++--- .../personal_plugin_templates_controller.rb | 92 ++-- .../helpers/admin/plugin_templates_helper.rb | 292 ++++++------ .../app/models/plugin_template.rb | 184 ++++---- .../app/models/plugin_template_intro.rb | 3 +- .../app/models/plugin_template_link.rb | 31 +- .../app/models/plugin_template_related.rb | 7 +- .../admin/plugin_templates/_form.html.erb | 420 +++++++++--------- .../plugin_templates/_form_file.html.erb | 102 ++--- .../plugin_templates/_form_link.html.erb | 48 +- .../_plugin_template_related.html.erb | 36 +- .../_plugin_templates.html.erb | 4 +- .../admin/plugin_templates/analysis.html.erb | 97 ++-- .../download_excel.xlsx.axlsx | 120 ++--- .../admin/plugin_templates/edit.html.erb | 6 +- .../frontend_setting.html.erb | 156 +++---- .../admin/plugin_templates/index.html.erb | 2 + .../views/admin/plugin_templates/new.html.erb | 6 +- .../admin/plugin_templates/setting.html.erb | 116 ++--- .../_profile.html.erb | 102 ++--- template_generator/config/routes.rb | 50 +-- 25 files changed, 1048 insertions(+), 1020 deletions(-) diff --git a/app/controllers/admin/personal_plugin_fields_controller.rb b/app/controllers/admin/personal_plugin_fields_controller.rb index 91483ff..63af5f3 100644 --- a/app/controllers/admin/personal_plugin_fields_controller.rb +++ b/app/controllers/admin/personal_plugin_fields_controller.rb @@ -611,21 +611,53 @@ class Admin::PersonalPluginFieldsController < OrbitMemberController break end end - new_text = new_text.gsub(/parse_again_start((?:(?!parse_again_start).)+)parse_again_end/m) do |ff| - parse_content = $1 #last match + new_text = new_text.gsub(/[ \t]*parse_again_start((?:(?!parse_again_start).)+)parse_again_end[ \t]*(\r\n|\n)/m) do |ff| + @parse_again_mode = true + parse_content = $1 #parse_again block contents result = ff - if include_key($1,k) - start_index = 0 - end_index = parse_content.length - start_index = 2 if parse_content[0..1] == "\r\n" - end_index = end_index - 2 if parse_content[(end_index - 2)..(end_index - 1)] == "\r\n" - parse_content = parse_content.slice(start_index,end_index) - if inner - result = (0...vv.count).map {|ii| replace_text_with_pattern(parse_content,false,i,ii,true) }.join("") - else - result = (0...vv.count).map {|ii| replace_text_with_pattern(parse_content,false,ii) }.join("") - end + match_count = parse_content.match(/^ *\* *\d+/m) + match_count = match_count ? match_count[0] : nil + exist_condition = parse_content.split("\n")[0].match(/if[ ]+#{::Regexp.escape(k)}(?=\.| |$)/) + extra_cond = nil + if exist_condition + exist_condition = exist_condition[0] + parse_content = parse_content[ parse_content.index(exist_condition) + exist_condition.length..-1] + extra_cond = parse_content.match(/^\.count *(\!|\<|\>|\=)(\=|) *\d+/) + if extra_cond + extra_cond = extra_cond[0] + exist_condition += extra_cond + parse_content = parse_content[extra_cond.length..-1] + exist_condition = eval("vv"+extra_cond) ? exist_condition : nil + elsif vv.count == 0 + exist_condition = nil + end + if exist_condition.nil? + match_count = nil + parse_content = "" + result = "" + end + elsif match_count + parse_content = parse_content[match_count.length..-1] end + parse_content = parse_content.sub(/[ \t]+\z/m, '').sub(/\A(\r\n|\n)/, '') + if include_key(parse_content,k) + vv_count = vv.count + if match_count + vv_count = [vv_count, match_count.strip[1..-1].to_i].min + end + if inner + result = (0...vv_count).map {|ii| replace_text_with_pattern(parse_content,false,i,ii,true) }.join("") + else + result = (0...vv_count).map {|ii| replace_text_with_pattern(parse_content,false,ii) }.join("") + end + elsif match_count || exist_condition + count = 1 + if match_count + count = match_count.strip[1..-1].to_i + end + result = (0...count).map {|ii| parse_content }.join("") + end + @parse_again_mode = false result end end @@ -637,7 +669,9 @@ class Admin::PersonalPluginFieldsController < OrbitMemberController end def gsub_text_by_key_value(text,k,v) @blank_texts = [] - text.gsub(/\n(\s*)[^\n]*(#{k}|#{k.classify})/m) {|ff| @blank_texts << $1.gsub(/(\r\n|\n)/,'')} + if !@parse_again_mode + text.gsub(/\n(\s+)[^\n]*(#{k}|#{k.classify})/m) {|ff| @blank_texts << $1.gsub(/(\r\n|\n)/,'')} + end i = 0 text = text.gsub(k + "s"){|ff| v.pluralize.gsub("\n","\n#{@blank_texts[i]}")} text = text.gsub(k ){|ff| v.gsub("\n","\n#{@blank_texts[i]}")} diff --git a/app/views/admin/personal_plugin_fields/_form.html.erb b/app/views/admin/personal_plugin_fields/_form.html.erb index aaed93a..7f172e2 100644 --- a/app/views/admin/personal_plugin_fields/_form.html.erb +++ b/app/views/admin/personal_plugin_fields/_form.html.erb @@ -95,7 +95,7 @@
<% f.object.related_modal_name.each_with_index do |related_modal_name,i| %>
- <%= text_field_tag "#{f.object_name}[related_modal_name][]", related_modal_name,placeholder: thead_field("related_modal_name"), class: "related_modal_name" %> + <%= text_field_tag "#{f.object_name}[related_modal_name][]", related_modal_name,placeholder: thead_field("related_modal_name"), class: "related_modal_name", title: thead_field("related_modal_name") %>
<% end %> @@ -162,7 +162,7 @@ $(this).parents('.start-line').hide(); } }); - var related_modal_name_html = '<%= text_field_tag "#{f.object_name}[related_modal_name][]", '',placeholder: thead_field("related_modal_name"), class: "related_modal_name" %>'; + var related_modal_name_html = '<%= text_field_tag "#{f.object_name}[related_modal_name][]", '',placeholder: thead_field("related_modal_name"), class: "related_modal_name", title: thead_field("related_modal_name") %>'; related_modal_name_html = $("
").append(related_modal_name_html); related_modal_name_html.append("") $(".remove_btn").off("click").on("click",function(){ @@ -276,7 +276,11 @@ $('tr >:last-child').css( 'border',''); } }) - + $(document).on('blur', 'input.related_modal_name', function(){ + var _this = $(this); + var idx = _this.index('input.related_modal_name'); + $('span.related_modal_name').eq(idx).text(_this.val()); + }) + <%= stylesheet_link_tag "lib/main-forms" %> + <%= stylesheet_link_tag "lib/fileupload" %> + <%= stylesheet_link_tag "lib/main-list" %> + <%= stylesheet_link_tag "lib/main-form-col2" %> + <% end %> <% content_for :page_specific_javascript do %> - <%= javascript_include_tag "lib/bootstrap-datetimepicker" %> - <%= javascript_include_tag "lib/datetimepicker/datetimepicker.js" %> - <%= javascript_include_tag "lib/bootstrap-fileupload" %> - <%= javascript_include_tag "lib/file-type" %> - <%= javascript_include_tag "lib/module-area" %> + <%= javascript_include_tag "lib/bootstrap-datetimepicker" %> + <%= javascript_include_tag "lib/datetimepicker/datetimepicker.js" %> + <%= javascript_include_tag "lib/bootstrap-fileupload" %> + <%= javascript_include_tag "lib/file-type" %> + <%= javascript_include_tag "lib/module-area" %> <% end %>
- - - + + + - -
+ +
- <% @site_in_use_locales.each_with_index do |locale, i| %> + <% @site_in_use_locales.each_with_index do |locale, i| %> -
"> -parse_again_start - -
- -
- locale_fields_input_fields -
-
-parse_again_end -
- <% end %> - - <% - 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 - %> -
- -
+
"> + parse_again_start + +
+ +
+ locale_fields_input_fields +
+
+ parse_again_end +
+ <% end %> + + <% + 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 + %> +
+ +
- - <% if !@plugin_template.new_record? && hash["count"] > 0 %> -
- <% @plugin_template.send(link.pluralize).each_with_index do |obj, i| %> - <% if !obj.new_record? %> - <%= f.fields_for link.pluralize.to_sym, obj do |f| %> - <%= render :partial => "form_link", :object => obj, :locals => {:f => f, :i => i} %> - <% end %> - <% end %> - <% end %> -
-
- <% end %> + + <% if !@plugin_template.new_record? && hash["count"] > 0 %> +
+ <% @plugin_template.send(link.pluralize).each_with_index do |obj, i| %> + <% if !obj.new_record? %> + <%= f.fields_for link.pluralize.to_sym, obj do |f| %> + <%= render :partial => "form_link", :object => obj, :locals => {:f => f, :i => i} %> + <% end %> + <% end %> + <% end %> +
+
+ <% end %> - -
-
-

- <%= t(:add) %> -

+ +
+
+

+ <%= t(:add) %> +

-
-
- <% end %> - - <% - 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 - %> -
- -
+
+
+ <% end %> + + <% + 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 + %> +
+ +
- - <% if !@plugin_template.new_record? && hash["count"] > 0 %> -
- <% @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 %> + + <% if !@plugin_template.new_record? && hash["count"] > 0 %> +
+ <% @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 %> - -
-
-

- <%= t(:add) %> -

+ +
+
+

+ <%= t(:add) %> +

-
-
- <% end %> -
- - +
+
+ <% end %> +
+ + - -
+ +
- -
+ +
- <% if !@member.nil? %> + <% if !@member.nil? %> -
- -
- <%= @member.name rescue ''%> - <%= f.hidden_field :member_profile_id, :value => @member.id %> -
-
+
+ +
+ <%= @member.name rescue ''%> + <%= f.hidden_field :member_profile_id, :value => @member.id %> +
+
- <% else %> + <% else %> -
- -
- <% members = !@plugin_template.member_profile.nil? ? @plugin_template.member_profile.to_a : [] %> - <%= render partial: 'admin/member_selects/email_selection_box', locals: {field: 'plugin_template[member_profile_id]', email_members: members,index:'0',select_name:'member_profile_id'} %> -
-
+
+ +
+ <% members = !@plugin_template.member_profile.nil? ? @plugin_template.member_profile.to_a : [] %> + <%= render partial: 'admin/member_selects/email_selection_box', locals: {field: 'plugin_template[member_profile_id]', email_members: members,index:'0',select_name:'member_profile_id'} %> +
+
- <% end %> -parse_again_start - -
- -
- none_locale_fields_input_fields -
-
-parse_again_end -parse_again_start - -
- -
- <%= f.select :plugin_template_related_id, PluginTemplateRelated.all.collect {|t| [ t.plugin_template_related_main_field, t.id ]}, { include_blank: true } %> -
-
-parse_again_end -
- -
-
- -
- -
-
-
-
+ <% end %> + parse_again_start + +
+ +
+ none_locale_fields_input_fields +
+
+ parse_again_end + parse_again_start + +
+ +
+ <%= f.select :plugin_template_related_id, PluginTemplateRelated.all.collect {|t| [ t.plugin_template_related_main_field, t.id ]}, { include_blank: true } %> +
+
+ parse_again_end +
+ +
+
+ +
+ +
+
+
+
- <%= f.hidden_field :user_id, :value => params[:user_id] if !params[:user_id].blank? %> - - <%= f.submit t('submit'), class: 'btn btn-primary' %> - <%= link_to t('cancel'), request.referer, :class=>"btn" %> + <%= f.hidden_field :user_id, :value => params[:user_id] if !params[:user_id].blank? %> + + <%= f.submit t('submit'), class: 'btn btn-primary' %> + <%= link_to t('cancel'), request.referer, :class=>"btn" %>
\ No newline at end of file diff --git a/template_generator/app/views/admin/plugin_templates/_form_file.html.erb b/template_generator/app/views/admin/plugin_templates/_form_file.html.erb index 8628623..454adfa 100644 --- a/template_generator/app/views/admin/plugin_templates/_form_file.html.erb +++ b/template_generator/app/views/admin/plugin_templates/_form_file.html.erb @@ -1,55 +1,55 @@ <% if form_file.new_record? %> -
+
<% else %> -
- <% if form_file.file.blank? %> - <%= t(:no_file) %> - <% else %> - <%= link_to content_tag(:i) + form_file.file_identifier, form_file.file.url, {:class => 'file-link file-type', :target => '_blank', :title => form_file.file_identifier} %> - <% end %> +
+ <% if form_file.file.blank? %> + <%= t(:no_file) %> + <% else %> + <%= link_to content_tag(:i) + form_file.file_identifier, form_file.file.url, {:class => 'file-link file-type', :target => '_blank', :title => form_file.file_identifier} %> + <% end %> <% end %> -
- - - - <% @site_in_use_locales.each_with_index do |locale, i| %> - <%= locale %>"> - <%= f.fields_for :title_translations do |f| %> - <%= f.text_field locale, :class => "input-medium", placeholder: t(:alternative), :value => (form_file.title_translations[locale] rescue nil) %> - <% end %> - - <% end %> - - - - <% @site_in_use_locales.each_with_index do |locale, i| %> - <%= locale %>"> - <%= f.fields_for :description_translations do |f| %> - <%= f.text_field locale, :class => "input-medium", placeholder: t(:description), :value => (form_file.description_translations[locale] rescue nil) %> - <% end %> - - <% end %> - - - <% if form_file.new_record? %> - - - - <% else %> - - <%= f.hidden_field :id %> - - <%= f.hidden_field :_destroy, :value => nil, :class => 'should_destroy' %> - - <% end %> -
+
+ + + + <% @site_in_use_locales.each_with_index do |locale, i| %> + <%= locale %>"> + <%= f.fields_for :title_translations do |f| %> + <%= f.text_field locale, :class => "input-medium", placeholder: t(:alternative), :value => (form_file.title_translations[locale] rescue nil) %> + <% end %> + + <% end %> + + + + <% @site_in_use_locales.each_with_index do |locale, i| %> + <%= locale %>"> + <%= f.fields_for :description_translations do |f| %> + <%= f.text_field locale, :class => "input-medium", placeholder: t(:description), :value => (form_file.description_translations[locale] rescue nil) %> + <% end %> + + <% end %> + + + <% if form_file.new_record? %> + + + + <% else %> + + <%= f.hidden_field :id %> + + <%= f.hidden_field :_destroy, :value => nil, :class => 'should_destroy' %> + + <% end %> +
\ No newline at end of file diff --git a/template_generator/app/views/admin/plugin_templates/_form_link.html.erb b/template_generator/app/views/admin/plugin_templates/_form_link.html.erb index 461a3fc..90239ad 100644 --- a/template_generator/app/views/admin/plugin_templates/_form_link.html.erb +++ b/template_generator/app/views/admin/plugin_templates/_form_link.html.erb @@ -1,26 +1,26 @@
- - <%= f.text_field :url, class: "input-large", placeholder: t(:url) %> - - - <% @site_in_use_locales.each_with_index do |locale, i| %> - <%= locale %>"> - <%= f.fields_for :title_translations do |f| %> - <%= f.text_field locale, :class => "input-large", placeholder: t(:url_alt), :value => (form_link.title_translations[locale] rescue nil) %> - <% end %> - - <% end %> - - - <% if form_link.new_record? %> - - - - <% else %> - - <%= f.hidden_field :id %> - - <%= f.hidden_field :_destroy, :value => nil, :class => 'should_destroy' %> - - <% end %> + + <%= f.text_field :url, class: "input-large", placeholder: t(:url) %> + + + <% @site_in_use_locales.each_with_index do |locale, i| %> + <%= locale %>"> + <%= f.fields_for :title_translations do |f| %> + <%= f.text_field locale, :class => "input-large", placeholder: t(:url_alt), :value => (form_link.title_translations[locale] rescue nil) %> + <% end %> + + <% end %> + + + <% if form_link.new_record? %> + + + + <% else %> + + <%= f.hidden_field :id %> + + <%= f.hidden_field :_destroy, :value => nil, :class => 'should_destroy' %> + + <% end %>
diff --git a/template_generator/app/views/admin/plugin_templates/_plugin_template_related.html.erb b/template_generator/app/views/admin/plugin_templates/_plugin_template_related.html.erb index 7ce8dcb..85a5b38 100644 --- a/template_generator/app/views/admin/plugin_templates/_plugin_template_related.html.erb +++ b/template_generator/app/views/admin/plugin_templates/_plugin_template_related.html.erb @@ -1,21 +1,23 @@ - -parse_again_start - <%= t("personal_plugin_template.plugin_template_related.related_backend_index_fields") %> -parse_again_end - <%= t(:action) %> - + + parse_again_start + <%= t("personal_plugin_template.plugin_template_related.related_backend_index_fields") %> + parse_again_end + <%= t(:action) %> + - <% @plugin_template_relateds.each do |plugin_template_related| %> - -parse_again_start - related_backend_index_fields_contents -parse_again_end - - <%= t(:edit) %> - <%= link_to t(:delete_), admin_plugin_template_related_path(plugin_template_related), "data-confirm" => t('sure?'), :method => :delete, :remote => true,:class=>"archive_toggle action" %> - - - <% end %> + <% @plugin_template_relateds.each do |plugin_template_related| %> + + parse_again_start + related_backend_index_fields_contents + parse_again_end + + + <%= t(:edit) %> + + <%= link_to t(:delete_), admin_plugin_template_related_path(plugin_template_related), "data-confirm" => t('sure?'), :method => :delete, :remote => true,:class=>"archive_toggle action" %> + + + <% end %> \ No newline at end of file diff --git a/template_generator/app/views/admin/plugin_templates/_plugin_templates.html.erb b/template_generator/app/views/admin/plugin_templates/_plugin_templates.html.erb index 93818f7..4c07f26 100644 --- a/template_generator/app/views/admin/plugin_templates/_plugin_templates.html.erb +++ b/template_generator/app/views/admin/plugin_templates/_plugin_templates.html.erb @@ -1,7 +1,7 @@ <% @plugin_templates.each do |plugin_template| %> -parse_again_start + parse_again_start backend_index_fields_contents -parse_again_end + parse_again_end <% end %> \ No newline at end of file diff --git a/template_generator/app/views/admin/plugin_templates/analysis.html.erb b/template_generator/app/views/admin/plugin_templates/analysis.html.erb index c93670c..a2c5fbf 100644 --- a/template_generator/app/views/admin/plugin_templates/analysis.html.erb +++ b/template_generator/app/views/admin/plugin_templates/analysis.html.erb @@ -1,59 +1,59 @@ <% # encoding: utf-8 %> <% content_for :page_specific_css do %> - <%= stylesheet_link_tag "lib/main-forms" %> - <%= stylesheet_link_tag "lib/fileupload" %> - <%= stylesheet_link_tag "lib/main-list" %> - <%= stylesheet_link_tag "lib/main-form-col2" %> - + <%= stylesheet_link_tag "lib/main-forms" %> + <%= stylesheet_link_tag "lib/fileupload" %> + <%= stylesheet_link_tag "lib/main-list" %> + <%= stylesheet_link_tag "lib/main-form-col2" %> + <% end %> <% content_for :page_specific_javascript do %> <%= javascript_include_tag "//www.google.com/jsapi", "chartkick"%> <%= javascript_include_tag "justgage.1.0.1.min" %> <%= javascript_include_tag "raphael.2.1.0.min" %> <%= javascript_include_tag "validator" %> - <%= javascript_include_tag "lib/bootstrap-datetimepicker" %> - <%= javascript_include_tag "lib/datetimepicker/datetimepicker.js" %> + <%= javascript_include_tag "lib/bootstrap-datetimepicker" %> + <%= javascript_include_tag "lib/datetimepicker/datetimepicker.js" %> <% end %>
- -
- analysis_field_input_fields + +
+ analysis_field_input_fields
- -
-parse_again_start - <%= t("personal_plugin_template.plugin_template_related.plugin_template_related_main_field") %> - -parse_again_end -
-
+ +
+ parse_again_start + <%= t("personal_plugin_template.plugin_template_related.plugin_template_related_main_field") %> + + parse_again_end +
+
@@ -73,19 +73,18 @@ parse_again_end
- - - - + \ No newline at end of file diff --git a/template_generator/app/views/admin/plugin_templates/download_excel.xlsx.axlsx b/template_generator/app/views/admin/plugin_templates/download_excel.xlsx.axlsx index f67de5d..102f419 100644 --- a/template_generator/app/views/admin/plugin_templates/download_excel.xlsx.axlsx +++ b/template_generator/app/views/admin/plugin_templates/download_excel.xlsx.axlsx @@ -7,66 +7,66 @@ wb = xlsx_package.workbook heading = sheet.styles.add_style(:b => true, :locked => true) - row = [t("personal_plugin_template.member_profile")] -parse_again_start - @site_in_use_locales.each do |locale| - row << t("personal_plugin_template.locale_fields") + " - " + t(locale.to_s) - end -parse_again_end -parse_again_start - row << t("personal_plugin_template.none_locale_fields") -parse_again_end -parse_again_start - row << t("personal_plugin_template.plugin_template_related.plugin_template_related_main_field") -parse_again_end -parse_again_start - row << t("personal_plugin_template.plugin_template_file") - @site_in_use_locales.each do |locale| - row << t("personal_plugin_template.plugin_template_file") + " " + t("description") + " - " + t(locale.to_s) - end - @site_in_use_locales.each do |locale| - row << t("personal_plugin_template.plugin_template_file") + " " + t("alternative") + " - " + t(locale.to_s) - end -parse_again_end -parse_again_start - row << t("personal_plugin_template.plugin_template_link") - @site_in_use_locales.each do |locale| - row << t("personal_plugin_template.plugin_template_link") + " " + t("url_alt") + " - " + t(locale.to_s) - end -parse_again_end - sheet.add_row row, :style => heading + row = [t("personal_plugin_template.member_profile")] + parse_again_start + @site_in_use_locales.each do |locale| + row << t("personal_plugin_template.locale_fields") + " - " + t(locale.to_s) + end + parse_again_end + parse_again_start + row << t("personal_plugin_template.none_locale_fields") + parse_again_end + parse_again_start + row << t("personal_plugin_template.plugin_template_related.plugin_template_related_main_field") + parse_again_end + parse_again_start + row << t("personal_plugin_template.plugin_template_file") + @site_in_use_locales.each do |locale| + row << t("personal_plugin_template.plugin_template_file") + " " + t("description") + " - " + t(locale.to_s) + end + @site_in_use_locales.each do |locale| + row << t("personal_plugin_template.plugin_template_file") + " " + t("alternative") + " - " + t(locale.to_s) + end + parse_again_end + parse_again_start + row << t("personal_plugin_template.plugin_template_link") + @site_in_use_locales.each do |locale| + row << t("personal_plugin_template.plugin_template_link") + " " + t("url_alt") + " - " + t(locale.to_s) + end + parse_again_end + sheet.add_row row, :style => heading - data.each do |plugin_template| - row = [(plugin_template.member_profile.name rescue "")] -parse_again_start - @site_in_use_locales.each do |locale| - row << plugin_template.locale_fields_translations[locale.to_s] - end -parse_again_end -parse_again_start - row << plugin_template.display_field("none_locale_fields",true) -parse_again_end -parse_again_start - row << (plugin_template.plugin_template_related.plugin_template_related_main_field rescue "") -parse_again_end -parse_again_start - plugin_template_files = plugin_template.plugin_template_files.asc(:created_at) - row << plugin_template_files.collect{|f| (@host_url + f.file.url rescue nil)}.join(";") - @site_in_use_locales.each do |locale| - row << plugin_template_files.collect{|l| l.description_translations[locale]}.join(";") - end - @site_in_use_locales.each do |locale| - row << plugin_template_files.collect{|l| l.title_translations[locale]}.join(";") - end -parse_again_end -parse_again_start - plugin_template_links = plugin_template.plugin_template_links.asc(:created_at) - row << plugin_template_links.collect{|l| l.url}.join(";") - @site_in_use_locales.each do |locale| - row << plugin_template_links.collect{|l| l.title_translations[locale]}.join(";") - end -parse_again_end - sheet.add_row row - end + data.each do |plugin_template| + row = [(plugin_template.member_profile.name rescue "")] + parse_again_start + @site_in_use_locales.each do |locale| + row << plugin_template.locale_fields_translations[locale.to_s] + end + parse_again_end + parse_again_start + row << plugin_template.display_field("none_locale_fields",true) + parse_again_end + parse_again_start + row << (plugin_template.plugin_template_related.plugin_template_related_main_field rescue "") + parse_again_end + parse_again_start + plugin_template_files = plugin_template.plugin_template_files.asc(:created_at) + row << plugin_template_files.collect{|f| (@host_url + f.file.url rescue nil)}.join(";") + @site_in_use_locales.each do |locale| + row << plugin_template_files.collect{|l| l.description_translations[locale]}.join(";") + end + @site_in_use_locales.each do |locale| + row << plugin_template_files.collect{|l| l.title_translations[locale]}.join(";") + end + parse_again_end + parse_again_start + plugin_template_links = plugin_template.plugin_template_links.asc(:created_at) + row << plugin_template_links.collect{|l| l.url}.join(";") + @site_in_use_locales.each do |locale| + row << plugin_template_links.collect{|l| l.title_translations[locale]}.join(";") + end + parse_again_end + sheet.add_row row + end end end \ No newline at end of file diff --git a/template_generator/app/views/admin/plugin_templates/edit.html.erb b/template_generator/app/views/admin/plugin_templates/edit.html.erb index edba45c..a383f6e 100644 --- a/template_generator/app/views/admin/plugin_templates/edit.html.erb +++ b/template_generator/app/views/admin/plugin_templates/edit.html.erb @@ -1,5 +1,5 @@ <%= form_for @plugin_template, url: admin_plugin_template_path(@plugin_template), html: {class: "form-horizontal main-forms previewable"} do |f| %> -
- <%= render partial: 'form', locals: {f: f} %> -
+
+ <%= render partial: 'form', locals: {f: f} %> +
<% end %> \ No newline at end of file diff --git a/template_generator/app/views/admin/plugin_templates/frontend_setting.html.erb b/template_generator/app/views/admin/plugin_templates/frontend_setting.html.erb index a3650c8..11ca699 100644 --- a/template_generator/app/views/admin/plugin_templates/frontend_setting.html.erb +++ b/template_generator/app/views/admin/plugin_templates/frontend_setting.html.erb @@ -1,94 +1,82 @@ <% content_for :page_specific_css do %> - <%= stylesheet_link_tag "lib/main-forms" %> - <%= stylesheet_link_tag "lib/main-list" %> + <%= stylesheet_link_tag "lib/main-forms" %> + <%= stylesheet_link_tag "lib/main-list" %> <% end %> <%= form_for(:plugin_template_intro, :url => update_frontend_setting_admin_plugin_templates_path, :method => "post", html: {class: "form-horizontal main-forms previewable"} ) do |f| %> -
- -
+
+ +
- - - + + + - -
- -
- <% if !@member.blank? %> -
- -
- <%= @member.name rescue ''%> - <%= f.hidden_field :member_profile_id, :value => @member.id %> -
-
- <% end %> - -
- -
- <%= f.check_box :brief_intro, :checked => @intro.brief_intro %> <%= t("personal_plugins.brief_intro") %> - <%= f.check_box :complete_list, :checked => @intro.complete_list %> <%= t("personal_plugins.complete_list") %> -
-
-
-
+ +
+ +
+ <% if !@member.blank? %> +
+ +
+ <%= @member.name rescue ''%> + <%= f.hidden_field :member_profile_id, :value => @member.id %> +
+
+ <% end %> + +
+ +
+ <%= f.check_box :brief_intro, :checked => @intro.brief_intro %> <%= t("personal_plugins.brief_intro") %> + <%= f.check_box :complete_list, :checked => @intro.complete_list %> <%= t("personal_plugins.complete_list") %> +
+
+
+
- - - + + + - -
+ +
+ <% @site_in_use_locales.each_with_index do |locale, i| %> +
"> + +
+ +
+
+ <%= f.fields_for :text_translations do |f| %> + <%= f.cktext_area locale, rows: 5, class: "input-block-level", :value => (@intro.text_translations[locale] rescue nil) %> + <% end %> +
+
+
+
+ <% end %> +
+
- <% @site_in_use_locales.each_with_index do |locale, i| %> - -
"> - - -
- -
-
- <%= f.fields_for :text_translations do |f| %> - <%= f.cktext_area locale, rows: 5, class: "input-block-level", :value => (@intro.text_translations[locale] rescue nil) %> - <% end %> -
-
-
- - -
- - <% end %> - - - -
- - - -
- - -
- <%= f.hidden_field :user_id, :value => params[:user_id] if !params[:user_id].blank? %> - <%= hidden_field_tag :member_profile_id, @member.id.to_s %> - <%= f.submit t('submit'), class: 'btn btn-primary' %> - <%= link_to t('cancel'), get_go_back, :class=>"btn" %> -
-
+ +
+ <%= f.hidden_field :user_id, :value => params[:user_id] if !params[:user_id].blank? %> + <%= hidden_field_tag :member_profile_id, @member.id.to_s %> + <%= f.submit t('submit'), class: 'btn btn-primary' %> + <%= link_to t('cancel'), get_go_back, :class=>"btn" %> +
+ <% end %> \ No newline at end of file diff --git a/template_generator/app/views/admin/plugin_templates/index.html.erb b/template_generator/app/views/admin/plugin_templates/index.html.erb index a902b96..e1b30ef 100644 --- a/template_generator/app/views/admin/plugin_templates/index.html.erb +++ b/template_generator/app/views/admin/plugin_templates/index.html.erb @@ -14,7 +14,9 @@
<%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t(:new_), new_admin_plugin_template_path, :class => 'btn btn-primary' %> + parse_again_start * 1 if plugin_template_related.count == 0 <%= link_to content_tag(:i, nil, :class => 'icon-cog icon-white') + t('setting'), admin_plugin_template_setting_path, :class => 'btn btn-primary pull-right' %> + parse_again_end