Commit e58794ad90eb0d637109874b827a6895ea6efcf9

Authored by Andrey Karpikov
1 parent 3c10a954

check upload template errors

... ... @@ -95,7 +95,9 @@ module Kanjai
95 95 )
96 96
97 97 new_markers_general = item[:field_options].select{|item| item[:attributes]['repeat'] == 'false' }.collect{|item| item[:name] }
  98 + new_markers_general += item[:conditions].select{|item| item[:repeat_id].to_s.empty? }.collect{|item| item[:id] }
98 99 new_markers_repeat = item[:field_options].select{|item| item[:attributes]['repeat'] == 'true' }.collect{|item| item[:name] }
  100 + new_markers_repeat += item[:conditions].select{|item| !item[:repeat_id].to_s.empty? }.collect{|item| item[:id] }
99 101
100 102 Kanjai::PageContent.joins(page: :page_template).where(type_content: item[:code], kanjai_templates: {id: self.id}).each do |page_content|
101 103 if page_content.page_content_markers.count == 0
... ... @@ -117,10 +119,24 @@ module Kanjai
117 119 marker: marker[:name],
118 120 row_item: index,
119 121 marker_name: marker[:itemName],
120   - lang: lang
  122 + lang: lang,
121 123 )
122 124 end
123 125 end
  126 +
  127 +
  128 + item[:conditions].select{|item| index.to_i == 0 ? item[:repeat_id].to_s.empty? : item[:repeat_id].to_s.present? }.each do |marker|
  129 + unless exist_markers.include?(marker[:id])
  130 + page_content.page_content_markers.create(
  131 + marker: marker[:id],
  132 + row_item: index,
  133 + marker_name: marker[:name],
  134 + lang: lang,
  135 + condition: true
  136 + )
  137 + end
  138 + end
  139 +
124 140 end
125 141 end
126 142 end
... ...
... ... @@ -2,7 +2,7 @@
2 2 <% if @row_item.present? %>
3 3 <div class="panel panel-default" data-id="<%= @row_item %>">
4 4
5   - <div class="panel-heading" role="tab" id="heading_<%= @row_item %>">
  5 + <div class="panel-heading" style="margin-top:20px;margin-bottom:20px;" role="tab" id="heading_<%= @row_item %>">
6 6 <h4>
7 7 <div class="row">
8 8 <div class="col-md-10">
... ...
1 1 <% if repeat_element.present? %>
2 2 <div class="wrapper-block" style="margin-left: <%= margin_index * 20 %>px">
3   - <h2><%= repeat_element[:itemName] %></h2>
4   -
5   - <% if repeat_element[:attributes]['count'].nil? %>
6   - <div class="text-right">
7   - <%= link_to 'Add Item', url_for(:controller => 'admin/page_contents', :action => 'add_item', id: @obj.id, parent_id: nil, repeat_id: repeat_element[:id], parent_item_index: parent_item_index, margin_index: margin_index ), class: 'btn btn-default add-repeat-row' %>
8   - </div>
9   - <% end %>
  3 + <div class="row">
  4 + <div class="col-md-8">
  5 + <h2><%= repeat_element[:itemName] %></h2>
  6 + </div>
  7 + <div class="col-md-4">
  8 + <% if repeat_element[:attributes]['count'].nil? %>
  9 + <div class="text-right">
  10 + <%= link_to 'Add Item', url_for(:controller => 'admin/page_contents', :action => 'add_item', id: @obj.id, parent_id: nil, repeat_id: repeat_element[:id], parent_item_index: parent_item_index, margin_index: margin_index ), class: 'btn btn-default add-repeat-row' %>
  11 + </div>
  12 + <% end %>
  13 + </div>
  14 + </div>
10 15 <% uuid = SecureRandom.uuid %>
11 16 <div class="panel-group sortable-list" id="accordion" role="tablist" aria-multiselectable="true" data-update-url="<%= url_for(:controller => 'admin/page_contents', :action => 'sorting', id: @obj.id) %>" >
12 17 <% row_items.sort.each do |index| %>
13 18 <div class="panel panel-default" data-id="<%= uuid %>_<%= index %>" >
14 19
15   - <div class="panel-heading" role="tab" id="heading_<%= uuid %>_<%= index %>">
  20 + <div class="panel-heading" style="margin-top:20px;margin-bottom:20px;" role="tab" id="heading_<%= uuid %>_<%= index %>">
16 21 <h4>
17 22 <div class="row">
18 23 <div class="col-md-10">
... ...
1 1 module Kanjai
2   - VERSION = "0.0.269"
  2 + VERSION = "0.0.270"
3 3 end
... ...