para 0.8.11 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 61c7a5614276ef1baeb61bc3374e309f17b3316e87bcf4694a3fdd5fb57ac3ed
4
- data.tar.gz: 7af31c4c81ba3c3ac2b925ee719914e3d781e67c1033d225d668033d2a27243a
3
+ metadata.gz: 0d193279195926cf9c9d771bc66d9d0087bfe61ff9e7662f1c66833278088dc1
4
+ data.tar.gz: deaba7951bc96c94bf6175bf55061b2d14f988d9f992d538e27774ad21587a78
5
5
  SHA512:
6
- metadata.gz: 3c0c2d1301ee1cf60438125c8067062809d05ca5ed5a61d8884f60ff72986bf10f1682a40c2f1fa3c00df81188f8530e950d8eda484d8cd4a179ea41e0843110
7
- data.tar.gz: 518d36587de3461721498f6a76660a7c85ffb96eed5f3a8724cd7056855a21e83e509351b444538b6fe101792239ab908540603f9027fbe7960c908f286fb264
6
+ metadata.gz: '0584c068c6a24a3a8a9c9a608f4c2288644df56ca6b34007c98da511ab22ec55178ff1462d43e411a43ecf4b00cc0dcbc05b7529ba6c2643302b8b8930c96810'
7
+ data.tar.gz: 54d4160767fce3095334d2d81c370cf3fc103d07ef0db5afe1b180c2325fde2cd727d3db5c541bfe49395f607d69667b4fa83b33df22c1a06b22a619ecfa2981
@@ -5,8 +5,10 @@ module Para
5
5
  #
6
6
  def admin_component_sections
7
7
  @admin_component_sections ||= begin
8
- Para::ComponentSection.ordered.includes(:components).tap do |sections|
9
- sections.flat_map(&:components).each(&method(:decorate))
8
+ sections = Para::ComponentSection.ordered.includes(:components, :parent_component)
9
+
10
+ sections.tap do |loaded_sections|
11
+ loaded_sections.flat_map(&:components).each(&method(:decorate))
10
12
  end
11
13
  end
12
14
  end
@@ -23,5 +25,11 @@ module Para
23
25
  config = Para.components.component_configuration_for(component.identifier)
24
26
  !config.shown_if || instance_exec(&config.shown_if)
25
27
  end
28
+
29
+ def current_component_or_parent?(component)
30
+ return false unless @component
31
+
32
+ @component == component || @component.parent_component == component
33
+ end
26
34
  end
27
35
  end
@@ -36,7 +36,7 @@ module Para
36
36
  end
37
37
 
38
38
  def component_navigation
39
- parent_component = (
39
+ parent_component = @component && (
40
40
  @component.parent_component ||
41
41
  @component.child_components.any? && @component
42
42
  )
@@ -19,9 +19,13 @@ module Para
19
19
  attributes = model_field_mappings(model).fields
20
20
  relation = options.fetch(:relation, model.name.to_s.underscore.pluralize)
21
21
  allow_adding_resource = options.fetch(:addable, true)
22
+ force_list = options.fetch(:force_list, false)
22
23
 
23
- partial = :list
24
- partial = :tree if model.respond_to?(:roots) && can?(:tree, model)
24
+ partial = if !force_list && model.respond_to?(:roots) && can?(:tree, model)
25
+ :tree
26
+ else
27
+ :list
28
+ end
25
29
 
26
30
  render(
27
31
  partial: find_partial_for(relation, partial),
@@ -15,7 +15,7 @@
15
15
  %ul.component-section-list-items.collapse.in{ id: "collapse-section-#{index}" }
16
16
  - component_section.components.each do |component|
17
17
  - if can?(:manage, component) && show_component?(component)
18
- %li.component-item{ class: (@component == component) && 'active' }
18
+ %li.component-item{ class: ('active' if current_component_or_parent?(component)) }
19
19
  = link_to component.main_navigation_name, component.path
20
20
 
21
21
  - else
@@ -13,14 +13,14 @@ en:
13
13
  error: "Could not delete %{model}"
14
14
  clone:
15
15
  success: "%{model} cloned"
16
- error: "Could not clone %{model}"
17
-
16
+ error: "Could not clone %{model}"
17
+
18
18
  jobs:
19
19
  para/importer/base:
20
20
  progressing: "The file is being imported, please wait a few moments ..."
21
21
  success: "The import of the file was successfully completed"
22
22
  success_with_errors: |
23
- The import of the file was done, but some lines
23
+ The import of the file was done, but some lines
24
24
  were not taken into account due to errors :
25
25
  other_errors: "<br>And <b>%{count}</b> others errors ..."
26
26
  error: "The selected file contains errors and could not be imported"
@@ -40,9 +40,6 @@ en:
40
40
  confirmation:
41
41
  shared:
42
42
  destroy: 'Are you sure that you want to delete %{model} ?'
43
-
44
- component:
45
- none_created: "No components yet ..."
46
43
 
47
44
  component:
48
45
  create: "Create a component"
@@ -146,7 +143,7 @@ en:
146
143
  type: "Type"
147
144
  model_type: "Resource"
148
145
  namespaced: "Only list component's resources"
149
-
146
+
150
147
  activemodel:
151
148
  models:
152
149
  settings_rails/form:
@@ -92,9 +92,9 @@ module Para
92
92
  end
93
93
 
94
94
  content_tag(:th, options) do
95
- if (sort = options.delete(:sort))
95
+ if search && (sort = options.delete(:sort))
96
96
  view.sort_link(search, *sort, label, hide_indicator: true)
97
- elsif searchable?(field_name)
97
+ elsif search && searchable?(field_name)
98
98
  view.sort_link(search, field_name, label, hide_indicator: true)
99
99
  else
100
100
  label
@@ -1,3 +1,3 @@
1
1
  module Para
2
- VERSION = '0.8.11'
2
+ VERSION = '0.9.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: para
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.11
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Valentin Ballestrino
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-12-10 00:00:00.000000000 Z
11
+ date: 2021-01-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -19,7 +19,7 @@ dependencies:
19
19
  version: '4.0'
20
20
  - - "<="
21
21
  - !ruby/object:Gem::Version
22
- version: '6.0'
22
+ version: '7.0'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -29,7 +29,7 @@ dependencies:
29
29
  version: '4.0'
30
30
  - - "<="
31
31
  - !ruby/object:Gem::Version
32
- version: '6.0'
32
+ version: '7.0'
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: rails-i18n
35
35
  requirement: !ruby/object:Gem::Requirement
@@ -152,16 +152,22 @@ dependencies:
152
152
  name: paperclip
153
153
  requirement: !ruby/object:Gem::Requirement
154
154
  requirements:
155
- - - "~>"
155
+ - - ">="
156
156
  - !ruby/object:Gem::Version
157
157
  version: '4.2'
158
+ - - "<"
159
+ - !ruby/object:Gem::Version
160
+ version: '7.0'
158
161
  type: :runtime
159
162
  prerelease: false
160
163
  version_requirements: !ruby/object:Gem::Requirement
161
164
  requirements:
162
- - - "~>"
165
+ - - ">="
163
166
  - !ruby/object:Gem::Version
164
167
  version: '4.2'
168
+ - - "<"
169
+ - !ruby/object:Gem::Version
170
+ version: '7.0'
165
171
  - !ruby/object:Gem::Dependency
166
172
  name: cancancan
167
173
  requirement: !ruby/object:Gem::Requirement
@@ -334,16 +340,22 @@ dependencies:
334
340
  name: bootstrap-sass
335
341
  requirement: !ruby/object:Gem::Requirement
336
342
  requirements:
337
- - - "~>"
343
+ - - ">="
344
+ - !ruby/object:Gem::Version
345
+ version: '3.3'
346
+ - - "<"
338
347
  - !ruby/object:Gem::Version
339
- version: 3.3.0
348
+ version: '3.5'
340
349
  type: :runtime
341
350
  prerelease: false
342
351
  version_requirements: !ruby/object:Gem::Requirement
343
352
  requirements:
344
- - - "~>"
353
+ - - ">="
354
+ - !ruby/object:Gem::Version
355
+ version: '3.3'
356
+ - - "<"
345
357
  - !ruby/object:Gem::Version
346
- version: 3.3.0
358
+ version: '3.5'
347
359
  - !ruby/object:Gem::Dependency
348
360
  name: font-awesome-rails
349
361
  requirement: !ruby/object:Gem::Requirement