Commit f9af834816e46af11edf902c364b3512f75439b2
1 parent
b428414b
check repeat element and page link
Showing
3 changed files
with
25 additions
and
2 deletions
| @@ -13,6 +13,7 @@ module Kanjai | @@ -13,6 +13,7 @@ module Kanjai | ||
| 13 | page_content = self.page_content | 13 | page_content = self.page_content |
| 14 | template = page_content.page.page_template | 14 | template = page_content.page.page_template |
| 15 | subpart = template.template_parts.find_by_code(type_content) | 15 | subpart = template.template_parts.find_by_code(type_content) |
| 16 | + p subpart.field_options | ||
| 16 | obj = subpart.field_options.select{|item| item[:name] == self.marker }.first | 17 | obj = subpart.field_options.select{|item| item[:name] == self.marker }.first |
| 17 | if obj | 18 | if obj |
| 18 | obj[:attributes]['type'] | 19 | obj[:attributes]['type'] |
| @@ -250,7 +250,19 @@ module Kanjai | @@ -250,7 +250,19 @@ module Kanjai | ||
| 250 | row_index = scope.pluck(:row_item).uniq.sort | 250 | row_index = scope.pluck(:row_item).uniq.sort |
| 251 | 251 | ||
| 252 | row_index.each_with_index do |row_index, position| | 252 | row_index.each_with_index do |row_index, position| |
| 253 | - value = scope.where(row_item: row_index).collect{|item| [item.marker, item.text_value] }.to_h | 253 | + value = scope.where(row_item: row_index).collect do |item| |
| 254 | + marker_type = item.get_marker_type(item.page_content.type_content) | ||
| 255 | + marker_value = item.text_value | ||
| 256 | + | ||
| 257 | + if marker_type.to_s == 'page' | ||
| 258 | + page = Kanjai::Page.find_by(id: marker_value) | ||
| 259 | + if page | ||
| 260 | + marker_value = page.menu_url('https://') | ||
| 261 | + end | ||
| 262 | + end | ||
| 263 | + | ||
| 264 | + [item.marker, marker_value] | ||
| 265 | + end.to_h | ||
| 254 | value ||= {} | 266 | value ||= {} |
| 255 | hash_value ||= {} | 267 | hash_value ||= {} |
| 256 | value = value.merge(hash_value) | 268 | value = value.merge(hash_value) |
| @@ -267,6 +279,16 @@ module Kanjai | @@ -267,6 +279,16 @@ module Kanjai | ||
| 267 | value['###REPEAT_CYCLE_COUNT###'] = @repeat_type_index[repeat_id].to_s | 279 | value['###REPEAT_CYCLE_COUNT###'] = @repeat_type_index[repeat_id].to_s |
| 268 | value['PARENT_ITEM_ID'] = scope.where(row_item: row_index).first.uuid.to_s | 280 | value['PARENT_ITEM_ID'] = scope.where(row_item: row_index).first.uuid.to_s |
| 269 | 281 | ||
| 282 | + p '!!!!!!!!!!!!!!!!!!!' | ||
| 283 | + p item[:children] | ||
| 284 | + p value | ||
| 285 | + value.each do |key, value| | ||
| 286 | + element = item[:children].find{|element| element[:name] == key} | ||
| 287 | + if element && element[:attributes] && element[:attributes]['type'] == 'page' | ||
| 288 | + value[key] = 'page link' | ||
| 289 | + end | ||
| 290 | + end | ||
| 291 | + | ||
| 270 | @repeat_type_index[repeat_id] += 1 | 292 | @repeat_type_index[repeat_id] += 1 |
| 271 | self.content_generator(session, domain, item[:children], subparts, value) | 293 | self.content_generator(session, domain, item[:children], subparts, value) |
| 272 | 294 |