decidim-surveys 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/decidim/surveys/abilities/admin_ability.rb +17 -0
- data/app/models/decidim/surveys/abilities/{current_user.rb → current_user_ability.rb} +1 -1
- data/app/models/decidim/surveys/abilities/participatory_process_admin_ability.rb +19 -0
- data/config/locales/ca.yml +1 -1
- data/lib/decidim/surveys/admin_engine.rb +4 -2
- data/lib/decidim/surveys/engine.rb +1 -1
- metadata +9 -9
- data/app/models/decidim/surveys/abilities/admin_user.rb +0 -34
- data/app/models/decidim/surveys/abilities/process_admin_user.rb +0 -44
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7398eacc5fa2795d7160a478220c2a5f8a9f61df
|
4
|
+
data.tar.gz: ab007daf3c31a48347381a4c62321116b011f954
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f8151f263e185ae8b81216fc4cf8d4c29aec8f8239e39a1a804486cd5b62a145afadfb99620c30a0c03843e38adcef32ee308d4a93d81c9cf417f8c1b051857b
|
7
|
+
data.tar.gz: '0282749f7bfe9e267ec17c88caac0e77d4ebcc6359053cff78680c2ada7b62f123bec3be3ac8e5106044e52eb54d87afdf6222e32010ba0de84b5b406848e08e'
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Surveys
|
5
|
+
module Abilities
|
6
|
+
# Defines the abilities related to surveys for a logged in admin user.
|
7
|
+
# Intended to be used with `cancancan`.
|
8
|
+
class AdminAbility < Decidim::Abilities::AdminAbility
|
9
|
+
def define_abilities
|
10
|
+
super
|
11
|
+
|
12
|
+
can :manage, Survey
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Surveys
|
5
|
+
module Abilities
|
6
|
+
# Defines the abilities related to surveys for a logged in process admin user.
|
7
|
+
# Intended to be used with `cancancan`.
|
8
|
+
class ParticipatoryProcessAdminAbility < Decidim::Abilities::ParticipatoryProcessAdminAbility
|
9
|
+
def define_participatory_process_abilities
|
10
|
+
super
|
11
|
+
|
12
|
+
can :manage, Survey do |survey|
|
13
|
+
can_manage_process?(survey.feature.participatory_process)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
data/config/locales/ca.yml
CHANGED
@@ -58,7 +58,7 @@ ca:
|
|
58
58
|
answer_survey:
|
59
59
|
anonymous_user_message: <a href="%{sign_in_link}">Entra amb el teu compte</a> o <a href="%{sign_up_link}">dona't d'alta</a> per contestar l'enquesta.
|
60
60
|
title: Respon a l'enquesta
|
61
|
-
are_you_sure: Aquesta acció no es pot desfer i no podràs editar les respostes.
|
61
|
+
are_you_sure: Aquesta acció no es pot desfer i no podràs editar les respostes. Segur que vols seguir?
|
62
62
|
submit: Enviar
|
63
63
|
survey_answered:
|
64
64
|
body: Ja ha respost a aquesta enquesta.
|
@@ -21,8 +21,10 @@ module Decidim
|
|
21
21
|
|
22
22
|
initializer "decidim_surveys.inject_abilities_to_user" do |_app|
|
23
23
|
Decidim.configure do |config|
|
24
|
-
config.admin_abilities += [
|
25
|
-
|
24
|
+
config.admin_abilities += [
|
25
|
+
"Decidim::Surveys::Abilities::AdminAbility",
|
26
|
+
"Decidim::Surveys::Abilities::ParticipatoryProcessAdminAbility"
|
27
|
+
]
|
26
28
|
end
|
27
29
|
end
|
28
30
|
|
@@ -17,7 +17,7 @@ module Decidim
|
|
17
17
|
|
18
18
|
initializer "decidim_surveys.inject_abilities_to_user" do |_app|
|
19
19
|
Decidim.configure do |config|
|
20
|
-
config.abilities += ["Decidim::Surveys::Abilities::
|
20
|
+
config.abilities += ["Decidim::Surveys::Abilities::CurrentUserAbility"]
|
21
21
|
end
|
22
22
|
end
|
23
23
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: decidim-surveys
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josep Jaume Rey Peroy
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2017-
|
13
|
+
date: 2017-08-02 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: decidim-core
|
@@ -18,14 +18,14 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - '='
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 0.4.
|
21
|
+
version: 0.4.1
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
25
|
requirements:
|
26
26
|
- - '='
|
27
27
|
- !ruby/object:Gem::Version
|
28
|
-
version: 0.4.
|
28
|
+
version: 0.4.1
|
29
29
|
- !ruby/object:Gem::Dependency
|
30
30
|
name: jquery-tmpl-rails
|
31
31
|
requirement: !ruby/object:Gem::Requirement
|
@@ -46,14 +46,14 @@ dependencies:
|
|
46
46
|
requirements:
|
47
47
|
- - '='
|
48
48
|
- !ruby/object:Gem::Version
|
49
|
-
version: 0.4.
|
49
|
+
version: 0.4.1
|
50
50
|
type: :development
|
51
51
|
prerelease: false
|
52
52
|
version_requirements: !ruby/object:Gem::Requirement
|
53
53
|
requirements:
|
54
54
|
- - '='
|
55
55
|
- !ruby/object:Gem::Version
|
56
|
-
version: 0.4.
|
56
|
+
version: 0.4.1
|
57
57
|
description: A component for decidim's participatory processes.
|
58
58
|
email:
|
59
59
|
- josepjaume@gmail.com
|
@@ -84,9 +84,9 @@ files:
|
|
84
84
|
- app/forms/decidim/surveys/survey_answer_form.rb
|
85
85
|
- app/forms/decidim/surveys/survey_form.rb
|
86
86
|
- app/helpers/decidim/surveys/admin/application_helper.rb
|
87
|
-
- app/models/decidim/surveys/abilities/
|
88
|
-
- app/models/decidim/surveys/abilities/
|
89
|
-
- app/models/decidim/surveys/abilities/
|
87
|
+
- app/models/decidim/surveys/abilities/admin_ability.rb
|
88
|
+
- app/models/decidim/surveys/abilities/current_user_ability.rb
|
89
|
+
- app/models/decidim/surveys/abilities/participatory_process_admin_ability.rb
|
90
90
|
- app/models/decidim/surveys/application_record.rb
|
91
91
|
- app/models/decidim/surveys/survey.rb
|
92
92
|
- app/models/decidim/surveys/survey_answer.rb
|
@@ -1,34 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Decidim
|
4
|
-
module Surveys
|
5
|
-
module Abilities
|
6
|
-
# Defines the abilities related to surveys for a logged in admin user.
|
7
|
-
# Intended to be used with `cancancan`.
|
8
|
-
class AdminUser
|
9
|
-
include CanCan::Ability
|
10
|
-
|
11
|
-
attr_reader :user, :context
|
12
|
-
|
13
|
-
def initialize(user, context)
|
14
|
-
return unless user && user.role?(:admin)
|
15
|
-
|
16
|
-
@user = user
|
17
|
-
@context = context
|
18
|
-
|
19
|
-
can :manage, Survey
|
20
|
-
end
|
21
|
-
|
22
|
-
private
|
23
|
-
|
24
|
-
def current_settings
|
25
|
-
context.fetch(:current_settings, nil)
|
26
|
-
end
|
27
|
-
|
28
|
-
def feature_settings
|
29
|
-
context.fetch(:feature_settings, nil)
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
@@ -1,44 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Decidim
|
4
|
-
module Surveys
|
5
|
-
module Abilities
|
6
|
-
# Defines the abilities related to surveys for a logged in process admin user.
|
7
|
-
# Intended to be used with `cancancan`.
|
8
|
-
class ProcessAdminUser
|
9
|
-
include CanCan::Ability
|
10
|
-
|
11
|
-
attr_reader :user, :context
|
12
|
-
|
13
|
-
def initialize(user, context)
|
14
|
-
return unless user && !user.role?(:admin)
|
15
|
-
|
16
|
-
@user = user
|
17
|
-
@context = context
|
18
|
-
|
19
|
-
can :manage, Survey do |survey|
|
20
|
-
participatory_processes.include?(survey.feature.participatory_process)
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
private
|
25
|
-
|
26
|
-
def current_settings
|
27
|
-
context.fetch(:current_settings, nil)
|
28
|
-
end
|
29
|
-
|
30
|
-
def feature_settings
|
31
|
-
context.fetch(:feature_settings, nil)
|
32
|
-
end
|
33
|
-
|
34
|
-
def current_feature
|
35
|
-
context.fetch(:current_feature, nil)
|
36
|
-
end
|
37
|
-
|
38
|
-
def participatory_processes
|
39
|
-
@participatory_processes ||= Decidim::Admin::ManageableParticipatoryProcessesForUser.for(@user)
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|