Commit 5ec841e494b4557a11cb97ebf344e9f5ed90d139

Authored by Karpikau Andrei
1 parent fc8b663f

check build content

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