para 0.8.3.3 → 0.8.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA256:
3
- metadata.gz: 34cf9dd56413ef5e25dc49969075a9cfe6344c04b49bcc2411dac16b58b6f2da
4
- data.tar.gz: 7e6ce611948b6d096f2479a91f451e9ff98708ddca65de0aa3d7cf44aa0b8912
2
+ SHA1:
3
+ metadata.gz: 46dd04d9d028f48edd61932e381aba77607696e2
4
+ data.tar.gz: 7b3c9b9fa4a6d1440879c2cec9561c9ddb36fe8b
5
5
  SHA512:
6
- metadata.gz: a956b05c65552b0c407891a52237e268d2c04d67cce364d7faf1163776d672ff8cc1a6259d2b6f8af024ffe588d6d55f2bd1dcc541c7085f2b7550c8a4f781c9
7
- data.tar.gz: 54fd0283d7cb5e928bf3a5b866feba4a8e2aa1a5978fc0756c6af5e4ff4228f292cc87beb142b0040060cfd1af4f8095a1ea2ce28326bd80524f9d29565d5eb2
6
+ metadata.gz: 21fc22237a68f50fdac07a4fbb8916928735c2d4db73f70aa99debc31992312727ccb0d8cb07991869222795be844148674a50bddebb49af17af0418a7a010b7
7
+ data.tar.gz: 12a8f6e72b4f33d1c2a0c0ebaefb58bb0a59ad698e60a3afb4575799550fb5dee72ea6308977dbb98d3c269864930ac5464ddc77b8bd62a4cc9f5ef2a17eeb10
@@ -21,7 +21,7 @@ module Para
21
21
  allow_adding_resource = options.fetch(:addable, true)
22
22
 
23
23
  partial = :list
24
- partial = :tree if model.respond_to? :roots
24
+ partial = :tree if model.respond_to?(:roots) && can?(:tree, model)
25
25
 
26
26
  render(
27
27
  partial: find_partial_for(relation, partial),
@@ -48,6 +48,8 @@ module Para
48
48
  end
49
49
 
50
50
  def add_button_for(component, relation, model)
51
+ return unless can?(:create, model)
52
+
51
53
  partial_name = if component.subclassable?
52
54
  :subclassable_add_button
53
55
  else
@@ -27,7 +27,9 @@ module Para
27
27
  end
28
28
 
29
29
  def actions_buttons_for(options)
30
- names = [:submit, :submit_and_edit, :submit_and_add_another, :cancel]
30
+ names = [:submit, :submit_and_edit]
31
+ names << :submit_and_add_another if template.can?(:create, object.class)
32
+ names << :cancel
31
33
 
32
34
  names.select! { |name| Array.wrap(options[:only]).include?(name) } if options[:only]
33
35
  names.reject! { |name| Array.wrap(options[:except]).include?(name) } if options[:except]
@@ -2,14 +2,14 @@ module Para
2
2
  module Markup
3
3
  class ResourcesButtons < Para::Markup::Component
4
4
  attr_reader :component
5
-
5
+
6
6
  def initialize(component, view)
7
7
  @component = component
8
8
  super(view)
9
9
  end
10
10
 
11
11
  def clone_button(resource)
12
- return unless resource.class.cloneable?
12
+ return unless resource.class.cloneable? && view.can?(:clone, resource)
13
13
 
14
14
  path = component.relation_path(
15
15
  resource, action: :clone, return_to: view.request.fullpath
@@ -29,6 +29,8 @@ module Para
29
29
  end
30
30
 
31
31
  def edit_button(resource)
32
+ return unless view.can?(:edit, resource)
33
+
32
34
  path = component.relation_path(
33
35
  resource, action: :edit, return_to: view.request.fullpath
34
36
  )
@@ -39,6 +41,8 @@ module Para
39
41
  end
40
42
 
41
43
  def delete_button(resource)
44
+ return unless view.can?(:delete, resource)
45
+
42
46
  path = component.relation_path(resource, return_to: view.request.fullpath)
43
47
 
44
48
  options = {
@@ -5,7 +5,7 @@ module Para
5
5
  self.default_actions = [:edit, :clone, :delete]
6
6
 
7
7
  attr_reader :component, :model, :orderable, :actions
8
-
8
+
9
9
  def initialize(component, view)
10
10
  @component = component
11
11
  super(view)
@@ -15,7 +15,7 @@ module Para
15
15
  @model = options.delete(:model)
16
16
 
17
17
  if !options.key?(:orderable) || options.delete(:orderable)
18
- @orderable = model.orderable?
18
+ @orderable = model.orderable? && view.can?(:order, model)
19
19
  end
20
20
 
21
21
  @actions = build_actions(options.delete(:actions))
@@ -93,7 +93,7 @@ module Para
93
93
 
94
94
  content_tag(:th, options) do
95
95
  if (sort = options.delete(:sort))
96
- view.sort_link(search, *sort, label, hide_indicator: true)
96
+ view.sort_link(search, *sort, label, hide_indicator: true)
97
97
  elsif searchable?(field_name)
98
98
  view.sort_link(search, field_name, label, hide_indicator: true)
99
99
  else
@@ -1,3 +1,3 @@
1
1
  module Para
2
- VERSION = '0.8.3.3'
2
+ VERSION = '0.8.5'
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.3.3
4
+ version: 0.8.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Valentin Ballestrino
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-09-18 00:00:00.000000000 Z
11
+ date: 2020-01-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -168,14 +168,14 @@ dependencies:
168
168
  requirements:
169
169
  - - "~>"
170
170
  - !ruby/object:Gem::Version
171
- version: '1.9'
171
+ version: '3.0'
172
172
  type: :runtime
173
173
  prerelease: false
174
174
  version_requirements: !ruby/object:Gem::Requirement
175
175
  requirements:
176
176
  - - "~>"
177
177
  - !ruby/object:Gem::Version
178
- version: '1.9'
178
+ version: '3.0'
179
179
  - !ruby/object:Gem::Dependency
180
180
  name: kaminari
181
181
  requirement: !ruby/object:Gem::Requirement
@@ -849,7 +849,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
849
849
  - !ruby/object:Gem::Version
850
850
  version: '0'
851
851
  requirements: []
852
- rubygems_version: 3.0.3
852
+ rubyforge_project:
853
+ rubygems_version: 2.6.11
853
854
  signing_key:
854
855
  specification_version: 4
855
856
  summary: Rails admin engine