lookbook 1.3.4 → 1.4.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (93) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +11 -11
  3. data/app/assets/lookbook/css/themes/blue.css +1 -1
  4. data/app/assets/lookbook/css/themes/green.css +1 -1
  5. data/app/assets/lookbook/css/themes/indigo.css +1 -1
  6. data/app/assets/lookbook/css/themes/rose.css +1 -1
  7. data/app/assets/lookbook/css/themes/zinc.css +1 -1
  8. data/app/components/lookbook/code/component.rb +2 -4
  9. data/app/components/lookbook/header/component.html.erb +1 -1
  10. data/app/components/lookbook/inspector_panel/component.rb +1 -1
  11. data/app/components/lookbook/nav/component.rb +8 -15
  12. data/app/components/lookbook/nav/directory/component.html.erb +28 -0
  13. data/app/components/lookbook/nav/directory/component.rb +4 -0
  14. data/app/components/lookbook/nav/{item → entity}/component.html.erb +7 -7
  15. data/app/components/lookbook/nav/entity/component.rb +49 -0
  16. data/app/components/lookbook/nav/item/component.css +15 -0
  17. data/app/components/lookbook/nav/item/component.js +4 -0
  18. data/app/components/lookbook/nav/item/component.rb +13 -56
  19. data/app/controllers/concerns/lookbook/targetable_concern.rb +13 -38
  20. data/app/controllers/lookbook/application_controller.rb +9 -7
  21. data/app/controllers/lookbook/page_controller.rb +2 -2
  22. data/app/controllers/lookbook/pages_controller.rb +9 -15
  23. data/app/helpers/lookbook/application_helper.rb +1 -1
  24. data/app/helpers/lookbook/page_helper.rb +7 -4
  25. data/app/views/layouts/lookbook/application.html.erb +3 -4
  26. data/app/views/layouts/lookbook/page.html.erb +2 -2
  27. data/app/views/layouts/lookbook/shell.html.erb +2 -2
  28. data/app/views/layouts/lookbook/skeleton.html.erb +7 -7
  29. data/app/views/lookbook/index.html.erb +3 -3
  30. data/app/views/lookbook/inspector/panels/_params.html.erb +2 -2
  31. data/config/languages.yml +41 -0
  32. data/config/panels.yml +1 -1
  33. data/config/tags.yml +4 -0
  34. data/lib/lookbook/engine.rb +65 -43
  35. data/lib/lookbook/entities/collections/component_collection.rb +4 -0
  36. data/lib/lookbook/entities/collections/concerns/hierarchical_collection.rb +23 -0
  37. data/lib/lookbook/entities/collections/entity_collection.rb +61 -0
  38. data/lib/lookbook/entities/collections/page_collection.rb +30 -0
  39. data/lib/lookbook/entities/collections/preview_collection.rb +35 -0
  40. data/lib/lookbook/entities/collections/preview_example_collection.rb +4 -0
  41. data/lib/lookbook/entities/component.rb +31 -0
  42. data/lib/lookbook/entities/concerns/annotatable.rb +58 -0
  43. data/lib/lookbook/entities/concerns/inspectable.rb +44 -0
  44. data/lib/lookbook/entities/concerns/locatable.rb +73 -0
  45. data/lib/lookbook/entities/concerns/navigable.rb +43 -0
  46. data/lib/lookbook/entities/entity.rb +53 -0
  47. data/lib/lookbook/entities/page.rb +80 -0
  48. data/lib/lookbook/entities/page_section.rb +43 -0
  49. data/lib/lookbook/entities/preview.rb +87 -0
  50. data/lib/lookbook/entities/preview_example.rb +100 -0
  51. data/lib/lookbook/entities/preview_group.rb +48 -0
  52. data/lib/lookbook/file_watcher.rb +1 -1
  53. data/lib/lookbook/lang.rb +12 -35
  54. data/lib/lookbook/param.rb +2 -2
  55. data/lib/lookbook/preview_parser.rb +1 -1
  56. data/lib/lookbook/rendered_example.rb +37 -0
  57. data/lib/lookbook/services/code/code_indenter.rb +14 -0
  58. data/lib/lookbook/services/data/resolvers/data_resolver.rb +2 -2
  59. data/lib/lookbook/services/data/resolvers/file_resolver.rb +1 -1
  60. data/lib/lookbook/services/data/resolvers/method_resolver.rb +1 -1
  61. data/lib/lookbook/services/entities/entity_tree_builder.rb +45 -0
  62. data/lib/lookbook/services/position_prefix_parser.rb +16 -0
  63. data/lib/lookbook/support/store.rb +0 -33
  64. data/lib/lookbook/support/tree_node.rb +87 -0
  65. data/lib/lookbook/support/utils/path_utils.rb +26 -2
  66. data/lib/lookbook/support/utils/utils.rb +24 -0
  67. data/lib/lookbook/tags/component_tag.rb +6 -0
  68. data/lib/lookbook/tags/custom_tag.rb +2 -0
  69. data/lib/lookbook/tags/id_tag.rb +1 -1
  70. data/lib/lookbook/tags/logical_path_tag.rb +3 -0
  71. data/lib/lookbook/tags/param_tag.rb +2 -0
  72. data/lib/lookbook/tags/source_tag.rb +7 -0
  73. data/lib/lookbook/tags/yard_tag.rb +35 -7
  74. data/lib/lookbook/version.rb +1 -1
  75. data/lib/lookbook.rb +11 -7
  76. data/public/lookbook-assets/css/lookbook.css +33 -21
  77. data/public/lookbook-assets/css/lookbook.css.map +1 -1
  78. data/public/lookbook-assets/js/lookbook.js +56 -55
  79. data/public/lookbook-assets/js/lookbook.js.map +1 -1
  80. metadata +35 -18
  81. data/lib/lookbook/collection.rb +0 -161
  82. data/lib/lookbook/component.rb +0 -34
  83. data/lib/lookbook/entity.rb +0 -47
  84. data/lib/lookbook/page.rb +0 -194
  85. data/lib/lookbook/page_collection.rb +0 -19
  86. data/lib/lookbook/page_section.rb +0 -29
  87. data/lib/lookbook/preview.rb +0 -181
  88. data/lib/lookbook/preview_collection.rb +0 -23
  89. data/lib/lookbook/preview_example.rb +0 -93
  90. data/lib/lookbook/preview_group.rb +0 -58
  91. data/lib/lookbook/source_inspector.rb +0 -76
  92. data/lib/lookbook/support/utils/attribute_utils.rb +0 -14
  93. data/lib/lookbook/utils.rb +0 -65
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lookbook
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.4
4
+ version: 1.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mark Perkins
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-11-17 00:00:00.000000000 Z
11
+ date: 2022-11-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: css_parser
@@ -266,7 +266,11 @@ files:
266
266
  - app/components/lookbook/nav/component.html.erb
267
267
  - app/components/lookbook/nav/component.js
268
268
  - app/components/lookbook/nav/component.rb
269
- - app/components/lookbook/nav/item/component.html.erb
269
+ - app/components/lookbook/nav/directory/component.html.erb
270
+ - app/components/lookbook/nav/directory/component.rb
271
+ - app/components/lookbook/nav/entity/component.html.erb
272
+ - app/components/lookbook/nav/entity/component.rb
273
+ - app/components/lookbook/nav/item/component.css
270
274
  - app/components/lookbook/nav/item/component.js
271
275
  - app/components/lookbook/nav/item/component.rb
272
276
  - app/components/lookbook/page_tabs/component.html.erb
@@ -344,31 +348,41 @@ files:
344
348
  - config/app.yml
345
349
  - config/hooks.yml
346
350
  - config/inputs.yml
351
+ - config/languages.yml
347
352
  - config/panels.yml
348
353
  - config/routes.rb
349
354
  - config/tags.yml
350
355
  - lib/lookbook.rb
351
- - lib/lookbook/collection.rb
352
- - lib/lookbook/component.rb
353
356
  - lib/lookbook/engine.rb
354
- - lib/lookbook/entity.rb
357
+ - lib/lookbook/entities/collections/component_collection.rb
358
+ - lib/lookbook/entities/collections/concerns/hierarchical_collection.rb
359
+ - lib/lookbook/entities/collections/entity_collection.rb
360
+ - lib/lookbook/entities/collections/page_collection.rb
361
+ - lib/lookbook/entities/collections/preview_collection.rb
362
+ - lib/lookbook/entities/collections/preview_example_collection.rb
363
+ - lib/lookbook/entities/component.rb
364
+ - lib/lookbook/entities/concerns/annotatable.rb
365
+ - lib/lookbook/entities/concerns/inspectable.rb
366
+ - lib/lookbook/entities/concerns/locatable.rb
367
+ - lib/lookbook/entities/concerns/navigable.rb
368
+ - lib/lookbook/entities/entity.rb
369
+ - lib/lookbook/entities/page.rb
370
+ - lib/lookbook/entities/page_section.rb
371
+ - lib/lookbook/entities/preview.rb
372
+ - lib/lookbook/entities/preview_example.rb
373
+ - lib/lookbook/entities/preview_group.rb
355
374
  - lib/lookbook/error.rb
356
375
  - lib/lookbook/features.rb
357
376
  - lib/lookbook/file_watcher.rb
358
377
  - lib/lookbook/lang.rb
359
- - lib/lookbook/page.rb
360
- - lib/lookbook/page_collection.rb
361
- - lib/lookbook/page_section.rb
362
378
  - lib/lookbook/param.rb
363
- - lib/lookbook/preview.rb
364
379
  - lib/lookbook/preview_actions.rb
365
- - lib/lookbook/preview_collection.rb
366
- - lib/lookbook/preview_example.rb
367
- - lib/lookbook/preview_group.rb
368
380
  - lib/lookbook/preview_parser.rb
369
381
  - lib/lookbook/process.rb
382
+ - lib/lookbook/rendered_example.rb
370
383
  - lib/lookbook/services/code/code_beautifier.rb
371
384
  - lib/lookbook/services/code/code_highlighter.rb
385
+ - lib/lookbook/services/code/code_indenter.rb
372
386
  - lib/lookbook/services/config_loader.rb
373
387
  - lib/lookbook/services/data/parsers/data_parser.rb
374
388
  - lib/lookbook/services/data/parsers/json_parser.rb
@@ -378,7 +392,9 @@ files:
378
392
  - lib/lookbook/services/data/resolvers/file_resolver.rb
379
393
  - lib/lookbook/services/data/resolvers/method_resolver.rb
380
394
  - lib/lookbook/services/data/resolvers/yaml_resolver.rb
395
+ - lib/lookbook/services/entities/entity_tree_builder.rb
381
396
  - lib/lookbook/services/markdown_renderer.rb
397
+ - lib/lookbook/services/position_prefix_parser.rb
382
398
  - lib/lookbook/services/string_value_caster.rb
383
399
  - lib/lookbook/services/tags/key_value_tag_parser.rb
384
400
  - lib/lookbook/services/tags/tag_options_parser.rb
@@ -388,7 +404,6 @@ files:
388
404
  - lib/lookbook/services/templates/styles_extractor.rb
389
405
  - lib/lookbook/services/urls/search_param_builder.rb
390
406
  - lib/lookbook/services/urls/search_param_parser.rb
391
- - lib/lookbook/source_inspector.rb
392
407
  - lib/lookbook/stores/config_store.rb
393
408
  - lib/lookbook/stores/hook_store.rb
394
409
  - lib/lookbook/stores/input_store.rb
@@ -400,8 +415,9 @@ files:
400
415
  - lib/lookbook/support/null_object.rb
401
416
  - lib/lookbook/support/service.rb
402
417
  - lib/lookbook/support/store.rb
403
- - lib/lookbook/support/utils/attribute_utils.rb
418
+ - lib/lookbook/support/tree_node.rb
404
419
  - lib/lookbook/support/utils/path_utils.rb
420
+ - lib/lookbook/support/utils/utils.rb
405
421
  - lib/lookbook/tags/component_tag.rb
406
422
  - lib/lookbook/tags/custom_tag.rb
407
423
  - lib/lookbook/tags/display_tag.rb
@@ -411,10 +427,10 @@ files:
411
427
  - lib/lookbook/tags/logical_path_tag.rb
412
428
  - lib/lookbook/tags/param_tag.rb
413
429
  - lib/lookbook/tags/position_tag.rb
430
+ - lib/lookbook/tags/source_tag.rb
414
431
  - lib/lookbook/tags/tag_provider.rb
415
432
  - lib/lookbook/tags/yard_tag.rb
416
433
  - lib/lookbook/theme.rb
417
- - lib/lookbook/utils.rb
418
434
  - lib/lookbook/version.rb
419
435
  - lib/lookbook/websocket.rb
420
436
  - lib/tasks/lookbook_tasks.rake
@@ -441,10 +457,11 @@ files:
441
457
  - public/lookbook-assets/js/embed.js.map
442
458
  - public/lookbook-assets/js/lookbook.js
443
459
  - public/lookbook-assets/js/lookbook.js.map
444
- homepage: https://github.com/allmarkedup/lookbook
460
+ homepage: https://github.com/ViewComponent/lookbook
445
461
  licenses:
446
462
  - MIT
447
- metadata: {}
463
+ metadata:
464
+ rubygems_mfa_required: 'true'
448
465
  post_install_message:
449
466
  rdoc_options: []
450
467
  require_paths:
@@ -1,161 +0,0 @@
1
- module Lookbook
2
- class Collection < Entity
3
- include Enumerable
4
-
5
- delegate :size, :each, to: :items
6
-
7
- def initialize(path = "", items = [])
8
- @items = []
9
- if path.is_a?(Array)
10
- items = path
11
- path = ""
12
- end
13
-
14
- @path = path.delete_prefix("/").delete_suffix("/")
15
- super(@path)
16
-
17
- items.each { |item| add(item) }
18
- end
19
-
20
- def id
21
- lookup_path.present? ? super : "root"
22
- end
23
-
24
- def name
25
- @name ||= remove_position_prefix(basename)
26
- end
27
-
28
- def label
29
- name&.titleize
30
- end
31
-
32
- def position
33
- @position ||= parse_position_prefix(basename).first
34
- end
35
-
36
- def items
37
- @items.sort_by { |item| [item.hierarchy_depth, item&.position, item.label] }
38
- end
39
-
40
- def clear
41
- @items = []
42
- end
43
-
44
- def visible_items
45
- reject { |i| i.hidden? }
46
- end
47
-
48
- def non_empty_items
49
- items.select do |item|
50
- !item.is_a?(Lookbook::Collection) || item.items.any?
51
- end
52
- end
53
-
54
- def add(item)
55
- @ordered_entities = nil
56
- @tree = nil
57
- if item.is_a?(String)
58
- item = Collection.new([@path, item].join("/"))
59
- end
60
- @items << item
61
- item
62
- end
63
-
64
- def get(name)
65
- name = name.underscore
66
- items.find { |item| item.name.underscore == name }
67
- end
68
-
69
- def get_or_create(name)
70
- get(remove_position_prefix(name)).presence || add(name)
71
- end
72
-
73
- def find(lookup = nil, &block)
74
- if lookup
75
- lookup.is_a?(Symbol) ? find_by_id(lookup) : find_by_path(lookup)
76
- elsif block
77
- items.find(&block)
78
- end
79
- end
80
-
81
- def find_by_id(id)
82
- id = id.to_s.tr("_", "-")
83
- items.find { |i| i.id.to_s == id }
84
- end
85
-
86
- def find_by_path(path)
87
- items.find { |i| i.lookup_path == path }
88
- end
89
-
90
- def find_parent(child)
91
- parent_path = child.lookup_path.split("/").pop.join("/")
92
- find_by_path(parent_path)
93
- end
94
-
95
- def ordered_entities
96
- return @ordered_entities if @ordered_entities.present?
97
- entities = []
98
- as_tree.items.each do |item|
99
- entities.append(item.is_a?(Collection) ? item.ordered_entities : item)
100
- end
101
- @ordered_entities ||= entities.flatten
102
- end
103
-
104
- def find_first
105
- ordered_entities.first
106
- end
107
-
108
- def find_next(item)
109
- index = ordered_entities.find_index { |i| i.lookup_path == item.lookup_path }
110
- ordered_entities[index + 1] unless index.nil?
111
- end
112
-
113
- def find_previous(item)
114
- index = ordered_entities.find_index { |i| i.lookup_path == item.lookup_path }
115
- ordered_entities[index - 1] if !index.nil? && index > 0
116
- end
117
-
118
- def as_tree(filter_hidden: true)
119
- return self if hierarchy_depth > 0
120
- return @tree if @tree.present?
121
- @tree = self.class.new
122
- candidates = filter_hidden ? visible_items : items
123
- candidates.each do |item|
124
- current = @tree
125
- if item.hierarchy_depth == 1
126
- current.add(item)
127
- else
128
- item.parent_collections_names.each.with_index(1) do |name, i|
129
- target = current.get_or_create(name)
130
- if item.hierarchy_depth == i + 1
131
- target.add(item)
132
- else
133
- current = target
134
- end
135
- end
136
- end
137
- end
138
- @tree
139
- end
140
-
141
- def collapsible?
142
- false
143
- end
144
-
145
- def type
146
- :collection
147
- end
148
-
149
- protected
150
-
151
- def basename
152
- @path.present? ? @path.split("/").last : ""
153
- end
154
-
155
- class << self
156
- def describe_as
157
- "items"
158
- end
159
- end
160
- end
161
- end
@@ -1,34 +0,0 @@
1
- module Lookbook
2
- class Component < Entity
3
- attr_accessor :name
4
-
5
- def initialize(name)
6
- @name = name
7
- super(path)
8
- end
9
-
10
- def path
11
- name.underscore
12
- end
13
-
14
- def rel_path
15
- Pathname.new("#{path}.rb")
16
- end
17
-
18
- def full_path
19
- Pathname.new("#{Lookbook.config.components_path}/#{path}.rb")
20
- end
21
-
22
- def dir_path
23
- full_path.dirname
24
- end
25
-
26
- def template_path
27
- Dir.glob("#{Lookbook.config.components_path}/#{path}.*.erb").first
28
- end
29
-
30
- def inline?
31
- template_path.present?
32
- end
33
- end
34
- end
@@ -1,47 +0,0 @@
1
- module Lookbook
2
- class Entity
3
- include Utils
4
-
5
- def initialize(reference_path)
6
- @refpath = reference_path
7
- end
8
-
9
- def id
10
- generate_id(lookup_path)
11
- end
12
-
13
- def label
14
- lookup_path.split("/").last.titleize
15
- end
16
-
17
- def type
18
- :item
19
- end
20
-
21
- def path
22
- @refpath
23
- end
24
-
25
- def lookup_path
26
- @lookup_path ||= to_lookup_path(@refpath)
27
- end
28
-
29
- def hierarchy_depth
30
- @refpath.present? ? @refpath.split("/").size : 0
31
- end
32
-
33
- def position
34
- 0
35
- end
36
-
37
- def hidden?
38
- false
39
- end
40
-
41
- def matchers
42
- nil
43
- end
44
-
45
- alias_method :url_path, :lookup_path
46
- end
47
- end
data/lib/lookbook/page.rb DELETED
@@ -1,194 +0,0 @@
1
- module Lookbook
2
- class Page < Entity
3
- FRONTMATTER_FIELDS = [
4
- :id,
5
- :label,
6
- :title,
7
- :hidden,
8
- :landing,
9
- :position,
10
- :markdown,
11
- :header,
12
- :footer,
13
- :data
14
- ]
15
-
16
- attr_reader :errors, :rel_path, :content, :frontmatter
17
- attr_accessor :sections
18
-
19
- def initialize(path, base_path)
20
- @pathname = Pathname.new path
21
- @base_path = Pathname.new base_path
22
- @options = nil
23
- @errors = []
24
- @sections = []
25
- @frontmatter = {}
26
- @content = ""
27
- @page_name = remove_position_prefix(path_name)
28
- @rel_path = @pathname.relative_path_from(@base_path)
29
- page_path = (@rel_path.dirname.to_s == ".") ? @page_name : "#{@rel_path.dirname}/#{@page_name}"
30
- extract_frontmatter(file_contents)
31
- super(page_path)
32
- end
33
-
34
- def url_path
35
- lookbook_page_path lookup_path
36
- end
37
-
38
- def full_path
39
- Pathname.new Rails.root.join(@pathname.to_s)
40
- end
41
-
42
- def name
43
- @page_name
44
- end
45
-
46
- def hidden?
47
- options[:hidden] == true
48
- end
49
-
50
- def markdown?
51
- options[:markdown] == true
52
- end
53
-
54
- def header?
55
- options[:header] == true
56
- end
57
-
58
- def footer?
59
- options[:footer] == true
60
- end
61
-
62
- def get(key)
63
- options[key]
64
- end
65
-
66
- def matchers
67
- normalize_matchers(label)
68
- end
69
-
70
- def parent_collections_names
71
- File.dirname(path).split("/")
72
- end
73
-
74
- def type
75
- :page
76
- end
77
-
78
- def id
79
- options[:id]
80
- end
81
-
82
- def position
83
- options[:position]
84
- end
85
-
86
- def hidden
87
- options[:hidden]
88
- end
89
-
90
- def label
91
- options[:label]
92
- end
93
-
94
- def method_missing(method_name, *args, &block)
95
- if args.none? && !block
96
- options[method_name]
97
- else
98
- super
99
- end
100
- end
101
-
102
- def respond_to_missing?(method_name, include_private = false)
103
- FRONTMATTER_FIELDS.include? method_name
104
- end
105
-
106
- protected
107
-
108
- def file_contents
109
- File.read(full_path)
110
- end
111
-
112
- def options
113
- return @options if @options
114
- @options = Lookbook.config.page_options.deep_merge(frontmatter).with_indifferent_access
115
- @options[:id] = generate_id(@options[:id] || lookup_path)
116
- @options[:label] ||= name.titleize
117
- @options[:title] ||= @options[:label]
118
- @options[:hidden] ||= false
119
- @options[:landing] ||= false
120
- @options[:position] = @options[:position] ? @options[:position].to_i : get_position_prefix(path_name)
121
- @options[:markdown] ||= markdown_file?
122
- @options[:header] = true unless @options.key? :header
123
- @options[:footer] = true unless @options.key? :footer
124
- @options
125
- end
126
-
127
- def extract_frontmatter(content)
128
- @frontmatter, @content = FrontmatterExtractor.call(content)
129
- rescue => exception
130
- line_number_match = exception.message.match(/.*line\s(\d+)/)
131
- @errors.push(Lookbook::Error.new(exception, **{
132
- title: "YAML frontmatter parsing error",
133
- file_path: @pathname.to_s,
134
- line_number: line_number_match ? line_number_match[1] : false
135
- }))
136
- end
137
-
138
- def path_name
139
- @pathname.basename(@pathname.extname).to_s.gsub(/\.(html|md)$/, "")
140
- end
141
-
142
- def markdown_file?
143
- @pathname.basename(@pathname.extname).to_s.end_with?(".md")
144
- end
145
-
146
- class << self
147
- def find(path)
148
- all.find { |p| p.lookup_path == path }
149
- end
150
-
151
- def exists?(path)
152
- !!find(path)
153
- end
154
-
155
- def any?
156
- all.any?
157
- end
158
-
159
- def all
160
- pages, sections =
161
- Array(page_paths).flat_map do |dir|
162
- Dir["#{dir}/**/*.html.*", "#{dir}/**/*.md.*"].sort.map do |path|
163
- create(path, dir)
164
- end
165
- end.partition { |page| page.type == :page }
166
-
167
- sorted_pages = pages
168
- .uniq { |page| page.path }
169
- .sort_by { |page| [page.position, page.label] }
170
-
171
- page_dict = sorted_pages.index_by(&:path)
172
- sorted_sections = sections.sort_by { |section| [section.position, section.label] }
173
-
174
- sorted_sections.each do |section|
175
- page_dict[section.path].sections << section
176
- end
177
-
178
- PageCollection.new(sorted_pages)
179
- end
180
-
181
- def page_paths
182
- PathUtils.normalize_all(Lookbook.config.page_paths)
183
- end
184
-
185
- def section_path?(path)
186
- !!path.match(%r{\[(.*?\w+)\]})
187
- end
188
-
189
- def create(path, base_path)
190
- (section_path?(path) ? PageSection : Page).new(path, base_path)
191
- end
192
- end
193
- end
194
- end
@@ -1,19 +0,0 @@
1
- module Lookbook
2
- class PageCollection < Collection
3
- def id
4
- generate_id("page-collection", lookup_path || "root")
5
- end
6
-
7
- def label
8
- "Pages"
9
- end
10
-
11
- def type
12
- :page_collection
13
- end
14
-
15
- def self.describe_as
16
- "pages"
17
- end
18
- end
19
- end
@@ -1,29 +0,0 @@
1
- module Lookbook
2
- class PageSection < Page
3
- def name
4
- return @name if @name.present?
5
- matches = full_path.to_s.match(%r{\[(?<name>\w+)\]})
6
- @name ||= matches[:name]
7
- end
8
-
9
- def id
10
- "#{super}-#{name}"
11
- end
12
-
13
- def url_path
14
- nil
15
- end
16
-
17
- def path
18
- super.gsub("[#{name}]", "")
19
- end
20
-
21
- def type
22
- :page_section
23
- end
24
-
25
- def lookup_path
26
- "#{super}/#{name}"
27
- end
28
- end
29
- end