Commit 5ec841e494b4557a11cb97ebf344e9f5ed90d139

Authored by Karpikau Andrei
1 parent fc8b663f

check build content

... ... @@ -476,10 +476,11 @@ jQuery(document).ready(function(){
476 476 $nextItem = $currentItem.next();
477 477
478 478 if($this.hasClass('sort-up') && $prevItem){
479   - $currentItem.insertBefore($prevItem);
  479 + $currentItem.insertBefore($prevItem);
480 480 }
481 481 if($this.hasClass('sort-down') && $nextItem){
482 482 $currentItem.insertAfter($nextItem);
  483 +
483 484 }
484 485
485 486
... ...
... ... @@ -5,7 +5,7 @@ module Kanjai
5 5 @page = @obj.page
6 6 content_type = params[:content_type]
7 7
8   - partial, locals = PageContent.edit_template(content_type)
  8 + partial, locals = PageContent.edit_template(@page, content_type)
9 9
10 10
11 11 @obj.build_markers(content_type)
... ...
... ... @@ -9,14 +9,14 @@ module Kanjai
9 9 has_many :page_content_markers, dependent: :destroy
10 10 accepts_nested_attributes_for :page_content_markers
11 11
12   - def self.edit_template(content_type)
  12 + def self.edit_template(page, content_type)
13 13 case content_type
14 14 when 'rte_editor'
15 15 return ['kanjai/admin/pages/content_types/rte_editor', {}]
16 16 when 'plugin'
17 17 return ['kanjai/admin/pages/content_types/plugin', {}]
18 18 else
19   - template_part = TemplatePart.find_by_code(content_type)
  19 + template_part = page.page_template.template_parts.find_by_code(content_type)
20 20 if (template_part.part_type == 'content')
21 21 return ['kanjai/admin/pages/content_types/content', {template_part: template_part}]
22 22 end
... ... @@ -35,7 +35,7 @@ module Kanjai
35 35
36 36 page_template = self.page.page_template
37 37 if page_template
38   - subpart = TemplatePart.find_by_code(type_content)
  38 + subpart = page_template.template_parts.find_by_code(type_content)
39 39 if subpart
40 40 #find repeat block
41 41 repeat_element = subpart.field_options.select{|item| item[:name] == 'repeat' }.first
... ... @@ -85,7 +85,7 @@ module Kanjai
85 85 if type_content != 'rte_editor'
86 86 page_template = self.page.page_template
87 87 if page_template
88   - subpart = TemplatePart.find_by_code(type_content)
  88 + subpart = page_template.template_parts.find_by_code(type_content)
89 89 if subpart
90 90 #find current max row_item
91 91 row_item = self.page_content_markers.collect(&:row_item).max
... ... @@ -143,7 +143,7 @@ module Kanjai
143 143 self.controller_name.constantize.render self.action_name.to_sym, assigns: hash
144 144 else
145 145 page_template = self.page.page_template
146   - subpart = TemplatePart.find_by_code(self.type_content)
  146 + subpart = page_template.template_parts.find_by_code(self.type_content)
147 147 if subpart
148 148 html = Kanjai::TemplateGenerator.subpart_generate(page_template, 'content', subpart.elements, self.marker_hash, self.id)
149 149 else
... ... @@ -154,7 +154,7 @@ module Kanjai
154 154 end
155 155
156 156 def get_simple_content
157   - subpart = TemplatePart.find_by_code(self.type_content)
  157 + subpart = page.page_template.template_parts.find_by_code(self.type_content)
158 158 subpart.source
159 159 end
160 160
... ...
1 1 <% if @row_item.present? %>
2   - <div class="panel panel-default">
  2 + <div class="panel panel-default" data-id="<%= @row_item %>">
3 3
4 4 <div class="panel-heading" role="tab" id="heading_<%= @row_item %>">
5 5 <h4>
... ... @@ -17,7 +17,9 @@
17 17 <i class="fa fa-arrow-down"></i>
18 18 <% end %>
19 19
20   - <%= link_to 'x', url_for(:controller => 'admin/page_contents', :action => 'delete_item', id: @obj.id, row_item: @row_item), class: 'delete-repeat-row' %>
  20 + <%= link_to url_for(:controller => 'admin/page_contents', :action => 'delete_item', id: @obj.id, row_item: @row_item), class: 'delete-repeat-row' do %>
  21 + <i class="fa fa-trash"></i>
  22 + <% end %>
21 23 </div>
22 24 </div>
23 25
... ...
... ... @@ -89,7 +89,9 @@
89 89 <%= link_to '#', class: 'sort-repeat-row sort-down' do %>
90 90 <i class="fa fa-arrow-down"></i>
91 91 <% end %>
92   - <%= link_to 'x', url_for(:controller => 'admin/page_contents', :action => 'delete_item', id: @obj.id, row_item: index), class: 'delete-repeat-row' %>
  92 + <%= link_to url_for(:controller => 'admin/page_contents', :action => 'delete_item', id: @obj.id, row_item: index), class: 'delete-repeat-row' do %>
  93 + <i class="fa fa-trash"></i>
  94 + <% end %>
93 95
94 96 </div>
95 97 </div>
... ...
... ... @@ -9,7 +9,7 @@
9 9 </div>
10 10
11 11 <div class="clearfix" id="page_content_form">
12   - <% partial, locals = Kanjai::PageContent.edit_template(@obj.type_content) %>
  12 + <% partial, locals = Kanjai::PageContent.edit_template(@obj.page, @obj.type_content) %>
13 13
14 14 <%= render :partial => partial, locals: locals %>
15 15
... ...
1 1 module Kanjai
2   - VERSION = "0.0.194"
  2 + VERSION = "0.0.195"
3 3 end
... ...