Commit dac23bdccd2c667e789049c3727f4faee690fe36

Authored by Andrey Karpikov
1 parent 9f3d290b

check sitemap and language

1 1 PATH
2 2 remote: .
3 3 specs:
4   - kanjai (0.0.342)
  4 + kanjai (0.0.355)
5 5 acts-as-taggable-on (~> 6.5)
6 6 acts_as_list
7 7 acts_as_tree
... ...
... ... @@ -302,7 +302,7 @@ module Kanjai
302 302 private
303 303
304 304 def permitted_params
305   - params.permit(:page => [:parent_id, :domain_id, :page_template_id, :title, :private_flag, :default_private_page, :root_page, :show_public_only,
  305 + params.permit(:page => [:parent_id, :domain_id, :page_template_id, :title, :private_flag, :default_private_page, :root_page, :show_public_only, :exclude_sitemap,
306 306 :page_data_attributes => [:id, :title, :url, :meta_title, :meta_description, :meta_keywords]],
307 307 :page_content => [:type_content, :text_html, :controller_name, :action_name,
308 308 page_content_markers_attributes: [:id, :page_content_id, :marker, :text_value, :attachment_file_name, :form_subject, :form_body, :from_mail, :to_mail, :form_answer_text, :_destroy],
... ...
... ... @@ -93,6 +93,15 @@ module Kanjai
93 93 layer.gsub!('<meta name="csrf-token" content="###CSRF_TOKEN###"/>', '')
94 94 end
95 95
  96 + domain.page_langs.each do |item|
  97 + if item.code.to_s != I18n.locale.to_s
  98 + layer.gsub!(/<language code=\"#{item.code}\">(.*?)<\/language>/m, '')
  99 + end
  100 + end
  101 +
  102 +
  103 +
  104 +
96 105 layer.scan(/(<element name="([\w\W]*?)" type="([\w\W]+?)"><\/element>)/).each do |item|
97 106 content = item[0]
98 107 name = item[1].to_s
... ...
... ... @@ -134,7 +134,7 @@ module Kanjai
134 134 url = self.lang_attributes(lang, :url)
135 135 count_contents = page_data.joins(:page_contents).where(lang: lang)
136 136
137   - url != ":param" && count_contents.any?
  137 + url != ":param" && count_contents.any? && !exclude_sitemap
138 138 end
139 139
140 140 def plugin_sitemap_pages
... ...
... ... @@ -58,6 +58,14 @@
58 58 <label class="switch switch-lg"><%= form.check_box :show_public_only %><span></span></label>
59 59 </div>
60 60 </div>
  61 +
  62 + <div class="form-group row mt-2">
  63 + <%= form.label :exclude_sitemap, Kanjai::Page.human_attribute_name(:exclude_sitemap), class: 'col-md-2 col-form-label' %>
  64 + <div class="col-md-10">
  65 + <label class="switch switch-lg"><%= form.check_box :exclude_sitemap %><span></span></label>
  66 + </div>
  67 + </div>
  68 +
61 69 </fieldset>
62 70 <% unless @page.new_record? %>
63 71 <fieldset>
... ...
... ... @@ -78,6 +78,7 @@ en:
78 78 page_name: "Page Name"
79 79 template_name: "Used Template"
80 80 title_url: "URL"
  81 + exclude_sitemap: "Exclude from Sitemap"
81 82 page_content:
82 83 type_content: "Content Type"
83 84 kanjai/page_lang:
... ...
  1 +class AddExcludeSitemapToPage < ActiveRecord::Migration[5.2]
  2 + def change
  3 + add_column :kanjai_pages, :exclude_sitemap, :boolean, default: false
  4 + end
  5 +end
... ...
... ... @@ -279,9 +279,6 @@ module Kanjai
279 279 value['###REPEAT_CYCLE_COUNT###'] = @repeat_type_index[repeat_id].to_s
280 280 value['PARENT_ITEM_ID'] = scope.where(row_item: row_index).first.uuid.to_s
281 281
282   - p '!!!!!!!!!!!!!!!!!!!'
283   - p item[:children]
284   - p value
285 282 value.each do |key, value|
286 283 element = item[:children].find{|element| element[:name] == key}
287 284 if element && element[:attributes] && element[:attributes]['type'] == 'page'
... ...
1 1 module Kanjai
2   - VERSION = "0.0.355"
  2 + VERSION = "0.0.356"
3 3 end
... ...