Commit b428414bef8bb4a91a5a287b7782fc01e6075a73

Authored by Andrey Karpikov
1 parent ea3d61ac

check repeat element and page link

... ... @@ -142,5 +142,13 @@ module Kanjai
142 142 return '/'
143 143 end
144 144
  145 + def self.pages_for_choose(domain)
  146 + [].tap do |n|
  147 + domain.pages.walk_tree do |page, level|
  148 + n << {title: page.lang_attributes(PageLang.default(domain), :title), level: level, id: page.id}
  149 + end
  150 + end
  151 + end
  152 +
145 153 end
146 154 end
\ No newline at end of file
... ...
... ... @@ -68,6 +68,10 @@
68 68 </div>
69 69 <% end %>
70 70
  71 + <% if form2.object.get_marker_type(@obj.type_content) == 'page' %>
  72 + <%= form2.select :text_value, Kanjai::Page.pages_for_choose(@obj.page.domain).collect{|p| ["-" * p[:level]*2 + p[:title], p[:id], :style => "padding-left:#{p[:level]*10}px;"] }, {:include_blank => true}, :class => "form-control" %>
  73 + <% end %>
  74 +
71 75 </div>
72 76 <% end %>
73 77 <% end %>
... ...
... ... @@ -56,7 +56,7 @@
56 56 <% end %>
57 57
58 58 <% if form2.object.get_marker_type(@type_content) == 'page' %>
59   - <%= form2.select :text_value, @pages.collect{|p| ["-" * p[:level]*2 + p[:title], p[:id], :style => "padding-left:#{p[:level]*10}px;"] }, {:include_blank => true}, :class => "form-control" %>
  59 + <%= form2.select :text_value, Kanjai::Page.pages_for_choose(@obj.page.domain).collect{|p| ["-" * p[:level]*2 + p[:title], p[:id], :style => "padding-left:#{p[:level]*10}px;"] }, {:include_blank => true}, :class => "form-control" %>
60 60 <% end %>
61 61
62 62 </div>
... ...
... ... @@ -81,6 +81,10 @@
81 81 </div>
82 82 <% end %>
83 83
  84 + <% if form2.object.get_marker_type(@type_content) == 'page' %>
  85 + <%= form2.select :text_value, Kanjai::Page.pages_for_choose(@obj.page.domain).collect{|p| ["-" * p[:level]*2 + p[:title], p[:id], :style => "padding-left:#{p[:level]*10}px;"] }, {:include_blank => true}, :class => "form-control" %>
  86 + <% end %>
  87 +
84 88 </div>
85 89 <% end %>
86 90
... ...
1 1 module Kanjai
2   - VERSION = "0.0.335"
  2 + VERSION = "0.0.336"
3 3 end
... ...