Commit b428414bef8bb4a91a5a287b7782fc01e6075a73
1 parent
ea3d61ac
check repeat element and page link
Showing
5 changed files
with
18 additions
and
2 deletions
| @@ -142,5 +142,13 @@ module Kanjai | @@ -142,5 +142,13 @@ module Kanjai | ||
| 142 | return '/' | 142 | return '/' |
| 143 | end | 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 | end | 153 | end |
| 146 | end | 154 | end |
| @@ -68,6 +68,10 @@ | @@ -68,6 +68,10 @@ | ||
| 68 | </div> | 68 | </div> |
| 69 | <% end %> | 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 | </div> | 75 | </div> |
| 72 | <% end %> | 76 | <% end %> |
| 73 | <% end %> | 77 | <% end %> |
| @@ -56,7 +56,7 @@ | @@ -56,7 +56,7 @@ | ||
| 56 | <% end %> | 56 | <% end %> |
| 57 | 57 | ||
| 58 | <% if form2.object.get_marker_type(@type_content) == 'page' %> | 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 | <% end %> | 60 | <% end %> |
| 61 | 61 | ||
| 62 | </div> | 62 | </div> |
| @@ -81,6 +81,10 @@ | @@ -81,6 +81,10 @@ | ||
| 81 | </div> | 81 | </div> |
| 82 | <% end %> | 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 | </div> | 88 | </div> |
| 85 | <% end %> | 89 | <% end %> |
| 86 | 90 |