decidim-sortitions 0.11.2 → 0.12.0.pre
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/cells/decidim/sortitions/sortition_cell.rb +21 -0
- data/app/cells/decidim/sortitions/sortition_m/data.erb +15 -0
- data/app/cells/decidim/sortitions/sortition_m/footer.erb +13 -0
- data/app/cells/decidim/sortitions/sortition_m_cell.rb +53 -0
- data/app/controllers/decidim/sortitions/admin/sortitions_controller.rb +13 -11
- data/app/models/decidim/sortitions/sortition.rb +1 -1
- data/app/permissions/decidim/sortitions/admin/permissions.rb +34 -0
- data/app/permissions/decidim/sortitions/permissions.rb +15 -0
- data/app/views/decidim/sortitions/admin/sortitions/index.html.erb +4 -4
- data/app/views/decidim/sortitions/sortitions/_linked_sortitions.html.erb +0 -1
- data/app/views/decidim/sortitions/sortitions/_proposal.html.erb +1 -24
- data/app/views/decidim/sortitions/sortitions/_sortition.html.erb +1 -25
- data/app/views/decidim/sortitions/sortitions/show.html.erb +1 -1
- data/config/locales/ca.yml +15 -9
- data/config/locales/en.yml +17 -11
- data/config/locales/es.yml +16 -10
- data/config/locales/eu.yml +16 -10
- data/config/locales/fi.yml +16 -10
- data/config/locales/fr.yml +16 -10
- data/config/locales/gl.yml +15 -9
- data/config/locales/it.yml +16 -10
- data/config/locales/nl.yml +15 -9
- data/config/locales/pl.yml +19 -11
- data/config/locales/pt-BR.yml +16 -10
- data/config/locales/pt.yml +16 -10
- data/config/locales/ru.yml +53 -0
- data/config/locales/sv.yml +16 -10
- data/config/locales/uk.yml +24 -17
- data/lib/decidim/sortitions/admin_engine.rb +0 -9
- data/lib/decidim/sortitions/component.rb +3 -1
- data/lib/decidim/sortitions/engine.rb +5 -0
- data/lib/decidim/sortitions/version.rb +1 -1
- metadata +20 -16
- data/app/models/decidim/sortitions/abilities/admin/admin_ability.rb +0 -23
- data/app/models/decidim/sortitions/abilities/admin/process_admin_ability.rb +0 -46
@@ -5,6 +5,7 @@ Decidim.register_component(:sortitions) do |component|
|
|
5
5
|
component.admin_engine = Decidim::Sortitions::AdminEngine
|
6
6
|
component.icon = "decidim/sortitions/icon.svg"
|
7
7
|
# component.stylesheet = "decidim/sortitions/sortitions"
|
8
|
+
component.permissions_class_name = "Decidim::Sortitions::Permissions"
|
8
9
|
|
9
10
|
component.on(:before_destroy) do |instance|
|
10
11
|
raise StandardError, "Can't remove this component" if Decidim::Sortitions::Sortition.where(component: instance).any?
|
@@ -18,9 +19,10 @@ Decidim.register_component(:sortitions) do |component|
|
|
18
19
|
end
|
19
20
|
|
20
21
|
# Register an optional resource that can be referenced from other resources.
|
21
|
-
component.register_resource do |resource|
|
22
|
+
component.register_resource(:sortition) do |resource|
|
22
23
|
resource.model_class_name = "Decidim::Sortitions::Sortition"
|
23
24
|
resource.template = "decidim/sortitions/sortitions/linked_sortitions"
|
25
|
+
resource.card = "decidim/sortitions/sortition"
|
24
26
|
end
|
25
27
|
|
26
28
|
component.register_stat :sortitions_count, primary: true, priority: Decidim::StatsRegistry::HIGH_PRIORITY do |components, start_at, end_at|
|
@@ -21,6 +21,11 @@ module Decidim
|
|
21
21
|
initializer "decidim_sorititions.assets" do |app|
|
22
22
|
app.config.assets.precompile += %w(decidim_sortitions_manifest.js decidim_sortitions_manifest.css)
|
23
23
|
end
|
24
|
+
|
25
|
+
initializer "decidim_sortitions.add_cells_view_paths" do
|
26
|
+
Cell::ViewModel.view_paths << File.expand_path("#{Decidim::Sortitions::Engine.root}/app/cells")
|
27
|
+
Cell::ViewModel.view_paths << File.expand_path("#{Decidim::Sortitions::Engine.root}/app/views") # for proposal partials
|
28
|
+
end
|
24
29
|
end
|
25
30
|
end
|
26
31
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: decidim-sortitions
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.12.0.pre
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Juan Salvador Perez Garcia
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-06-
|
11
|
+
date: 2018-06-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: decidim-admin
|
@@ -16,56 +16,56 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: 0.12.0.pre
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.
|
26
|
+
version: 0.12.0.pre
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: decidim-comments
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - '='
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.
|
33
|
+
version: 0.12.0.pre
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - '='
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.
|
40
|
+
version: 0.12.0.pre
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: decidim-core
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - '='
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 0.
|
47
|
+
version: 0.12.0.pre
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - '='
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 0.
|
54
|
+
version: 0.12.0.pre
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: decidim-proposals
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - '='
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 0.
|
61
|
+
version: 0.12.0.pre
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - '='
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 0.
|
68
|
+
version: 0.12.0.pre
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: social-share-button
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -86,14 +86,14 @@ dependencies:
|
|
86
86
|
requirements:
|
87
87
|
- - '='
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: 0.
|
89
|
+
version: 0.12.0.pre
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - '='
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: 0.
|
96
|
+
version: 0.12.0.pre
|
97
97
|
description: This module makes possible to select amont a set of proposal by sortition
|
98
98
|
email:
|
99
99
|
- jsperezg@gmail.com
|
@@ -110,6 +110,10 @@ files:
|
|
110
110
|
- app/assets/javascripts/decidim/sortitions/social_share.js
|
111
111
|
- app/assets/stylesheets/decidim/sortitions/_sortitions.scss
|
112
112
|
- app/assets/stylesheets/decidim/sortitions/social_share.css.scss
|
113
|
+
- app/cells/decidim/sortitions/sortition_cell.rb
|
114
|
+
- app/cells/decidim/sortitions/sortition_m/data.erb
|
115
|
+
- app/cells/decidim/sortitions/sortition_m/footer.erb
|
116
|
+
- app/cells/decidim/sortitions/sortition_m_cell.rb
|
113
117
|
- app/commands/decidim/sortitions/admin/create_sortition.rb
|
114
118
|
- app/commands/decidim/sortitions/admin/destroy_sortition.rb
|
115
119
|
- app/commands/decidim/sortitions/admin/update_sortition.rb
|
@@ -125,10 +129,10 @@ files:
|
|
125
129
|
- app/forms/decidim/sortitions/admin/sortition_form.rb
|
126
130
|
- app/helpers/decidim/sortitions/admin/sortitions_helper.rb
|
127
131
|
- app/helpers/decidim/sortitions/sortitions_helper.rb
|
128
|
-
- app/models/decidim/sortitions/abilities/admin/admin_ability.rb
|
129
|
-
- app/models/decidim/sortitions/abilities/admin/process_admin_ability.rb
|
130
132
|
- app/models/decidim/sortitions/application_record.rb
|
131
133
|
- app/models/decidim/sortitions/sortition.rb
|
134
|
+
- app/permissions/decidim/sortitions/admin/permissions.rb
|
135
|
+
- app/permissions/decidim/sortitions/permissions.rb
|
132
136
|
- app/presenters/decidim/sortitions/admin_log/sortition_presenter.rb
|
133
137
|
- app/queries/decidim/sortitions/admin/participatory_space_proposal_components.rb
|
134
138
|
- app/queries/decidim/sortitions/admin/participatory_space_proposals.rb
|
@@ -209,9 +213,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
209
213
|
version: 2.3.1
|
210
214
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
211
215
|
requirements:
|
212
|
-
- - "
|
216
|
+
- - ">"
|
213
217
|
- !ruby/object:Gem::Version
|
214
|
-
version:
|
218
|
+
version: 1.3.1
|
215
219
|
requirements: []
|
216
220
|
rubyforge_project:
|
217
221
|
rubygems_version: 2.7.6
|
@@ -1,23 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Decidim
|
4
|
-
module Sortitions
|
5
|
-
module Abilities
|
6
|
-
module Admin
|
7
|
-
# Defines the abilities for a user in the admin section. Intended to be
|
8
|
-
# used with `cancancan`.
|
9
|
-
class AdminAbility < Decidim::Abilities::AdminAbility
|
10
|
-
def define_abilities
|
11
|
-
super
|
12
|
-
|
13
|
-
can :manage, Sortition
|
14
|
-
cannot :destroy, Sortition
|
15
|
-
can :destroy, Sortition do |sortition|
|
16
|
-
!sortition.cancelled?
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
@@ -1,46 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Decidim
|
4
|
-
module Sortitions
|
5
|
-
module Abilities
|
6
|
-
module Admin
|
7
|
-
class ProcessAdminAbility
|
8
|
-
include CanCan::Ability
|
9
|
-
|
10
|
-
attr_reader :user, :context
|
11
|
-
|
12
|
-
def initialize(user, context)
|
13
|
-
return unless user
|
14
|
-
return if user.admin?
|
15
|
-
|
16
|
-
@user = user
|
17
|
-
@context = context
|
18
|
-
|
19
|
-
return unless process_administrator?
|
20
|
-
|
21
|
-
can :manage, Sortition
|
22
|
-
cannot :destroy, Sortition
|
23
|
-
can :destroy, Sortition do |sortition|
|
24
|
-
!sortition.cancelled?
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
private
|
29
|
-
|
30
|
-
def process_administrator?
|
31
|
-
return false unless current_participatory_space.is_a? Decidim::ParticipatoryProcess
|
32
|
-
|
33
|
-
Decidim::ParticipatoryProcesses::Admin::AdminUsers
|
34
|
-
.for(current_participatory_space)
|
35
|
-
.where(id: user.id)
|
36
|
-
.any?
|
37
|
-
end
|
38
|
-
|
39
|
-
def current_participatory_space
|
40
|
-
@current_participatory_space ||= @context[:current_participatory_space]
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|