diff options
Diffstat (limited to 'app/models')
| -rw-r--r-- | app/models/page.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/app/models/page.rb b/app/models/page.rb index 4d1e94a..6fff7d6 100644 --- a/app/models/page.rb +++ b/app/models/page.rb | |||
| @@ -63,6 +63,12 @@ class Page < ApplicationRecord | |||
| 63 | end | 63 | end |
| 64 | end | 64 | end |
| 65 | 65 | ||
| 66 | if options[:node] && options[:children] == "direct" | ||
| 67 | scope = scope.where(nodes: { parent_id: options[:node].id }) | ||
| 68 | elsif options[:node] && options[:children] == "all" | ||
| 69 | scope = scope.where(nodes: { id: options[:node].descendants.pluck(:id) }) | ||
| 70 | end | ||
| 71 | |||
| 66 | direction = %w[ASC DESC].include?(options[:order_direction]&.upcase) ? options[:order_direction].upcase : "ASC" | 72 | direction = %w[ASC DESC].include?(options[:order_direction]&.upcase) ? options[:order_direction].upcase : "ASC" |
| 67 | 73 | ||
| 68 | if options[:order_by] == "title" | 74 | if options[:order_by] == "title" |
