decidim-initiatives 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/README.md +6 -6
- data/app/assets/config/decidim_initiatives_manifest.css +4 -0
- data/app/assets/config/decidim_initiatives_manifest.js +0 -2
- data/app/assets/stylesheet/decidim/initiatives/{application.css.scss → initiatives.scss} +0 -1
- data/app/cells/decidim/initiatives/initiative_cell.rb +19 -0
- data/app/cells/decidim/initiatives/initiative_m/author.erb +10 -0
- data/app/cells/decidim/initiatives/initiative_m/footer.erb +28 -0
- data/app/cells/decidim/initiatives/initiative_m/tags.erb +9 -0
- data/app/cells/decidim/initiatives/initiative_m_cell.rb +45 -0
- data/app/commands/decidim/initiatives/vote_initiative.rb +22 -0
- data/app/controllers/concerns/decidim/initiatives/admin/initiative_admin.rb +0 -4
- data/app/controllers/concerns/decidim/initiatives/needs_initiative.rb +18 -23
- data/app/controllers/decidim/initiatives/admin/application_controller.rb +13 -0
- data/app/controllers/decidim/initiatives/admin/committee_requests_controller.rb +4 -4
- data/app/controllers/decidim/initiatives/admin/initiative_attachments_controller.rb +1 -1
- data/app/controllers/decidim/initiatives/admin/initiatives_controller.rb +11 -11
- data/app/controllers/decidim/initiatives/admin/initiatives_type_scopes_controller.rb +5 -5
- data/app/controllers/decidim/initiatives/admin/initiatives_types_controller.rb +7 -7
- data/app/controllers/decidim/initiatives/application_controller.rb +30 -0
- data/app/controllers/decidim/initiatives/committee_requests_controller.rb +4 -5
- data/app/controllers/decidim/initiatives/create_initiative_controller.rb +3 -3
- data/app/controllers/decidim/initiatives/initiative_types_controller.rb +2 -2
- data/app/controllers/decidim/initiatives/initiative_votes_controller.rb +3 -17
- data/app/controllers/decidim/initiatives/initiatives_controller.rb +3 -7
- data/app/controllers/decidim/initiatives/initiatives_type_scopes_controller.rb +2 -2
- data/app/events/decidim/initiatives/endorse_initiative_event.rb +4 -45
- data/app/events/decidim/initiatives/milestone_completed_event.rb +17 -0
- data/app/models/decidim/initiative.rb +5 -4
- data/app/models/decidim/initiatives_committee_member.rb +1 -0
- data/app/permissions/decidim/initiatives/admin/permissions.rb +188 -0
- data/app/permissions/decidim/initiatives/permissions.rb +139 -0
- data/app/presenters/decidim/initiative_presenter.rb +16 -0
- data/app/views/decidim/initiatives/_initiative.html.erb +1 -35
- data/app/views/decidim/initiatives/admin/committee_requests/index.html.erb +2 -3
- data/app/views/decidim/initiatives/admin/initiatives/_form.html.erb +3 -3
- data/app/views/decidim/initiatives/admin/initiatives/edit.html.erb +8 -8
- data/app/views/decidim/initiatives/admin/initiatives/index.html.erb +4 -4
- data/app/views/decidim/initiatives/admin/initiatives_type_scopes/edit.html.erb +1 -1
- data/app/views/decidim/initiatives/admin/initiatives_types/_form.html.erb +0 -2
- data/app/views/decidim/initiatives/admin/initiatives_types/_initiative_type_scopes.html.erb +2 -2
- data/app/views/decidim/initiatives/admin/initiatives_types/edit.html.erb +1 -1
- data/app/views/decidim/initiatives/admin/initiatives_types/index.html.erb +2 -2
- data/app/views/decidim/initiatives/committee_requests/new.html.erb +3 -5
- data/app/views/decidim/initiatives/initiatives/_index_header.html.erb +2 -2
- data/app/views/decidim/initiatives/initiatives/_vote_button.html.erb +17 -15
- data/app/views/decidim/initiatives/initiatives/_vote_cabin.html.erb +1 -1
- data/app/views/decidim/initiatives/initiatives/index.html.erb +0 -1
- data/app/views/decidim/initiatives/initiatives/show.html.erb +0 -1
- data/app/views/decidim/initiatives/initiatives/signature_identities.html.erb +15 -13
- data/app/views/layouts/decidim/admin/initiative.html.erb +9 -6
- data/app/views/layouts/decidim/admin/initiatives.html.erb +11 -3
- data/app/views/layouts/decidim/initiative_creation.html.erb +0 -1
- data/config/locales/ca.yml +31 -11
- data/config/locales/en.yml +32 -11
- data/config/locales/es.yml +33 -12
- data/config/locales/eu.yml +32 -11
- data/config/locales/fi.yml +32 -11
- data/config/locales/fr.yml +32 -11
- data/config/locales/gl.yml +32 -11
- data/config/locales/it.yml +32 -11
- data/config/locales/nl.yml +32 -11
- data/config/locales/pl.yml +42 -13
- data/config/locales/pt-BR.yml +32 -11
- data/config/locales/pt.yml +32 -11
- data/config/locales/sv.yml +32 -11
- data/config/locales/uk.yml +43 -14
- data/db/migrate/20171109132011_enable_pg_trgm_extension_for_initiatives.rb +18 -0
- data/lib/decidim/initiatives/admin_engine.rb +1 -15
- data/lib/decidim/initiatives/engine.rb +6 -11
- data/lib/decidim/initiatives/participatory_space.rb +12 -4
- data/lib/decidim/initiatives/test/factories.rb +17 -1
- data/lib/decidim/initiatives/version.rb +1 -1
- metadata +27 -29
- data/app/controllers/concerns/decidim/initiatives/action_authorization.rb +0 -38
- data/app/models/decidim/initiatives/abilities/admin/attachments_ability.rb +0 -55
- data/app/models/decidim/initiatives/abilities/admin/committee_admin_ability.rb +0 -36
- data/app/models/decidim/initiatives/abilities/admin/committee_user_ability.rb +0 -50
- data/app/models/decidim/initiatives/abilities/admin/components_ability.rb +0 -24
- data/app/models/decidim/initiatives/abilities/admin/initiative_admin_ability.rb +0 -65
- data/app/models/decidim/initiatives/abilities/admin/initiative_type_ability.rb +0 -42
- data/app/models/decidim/initiatives/abilities/admin/initiative_user_ability.rb +0 -68
- data/app/models/decidim/initiatives/abilities/current_user_ability.rb +0 -58
- data/app/models/decidim/initiatives/abilities/everyone_ability.rb +0 -22
- data/app/models/decidim/initiatives/abilities/non_logged_user_ability.rb +0 -33
- data/app/models/decidim/initiatives/abilities/vote_ability.rb +0 -57
- data/app/views/decidim/initiatives/initiatives/_supports_count.html.erb +0 -6
- data/db/migrate/20171109132011_enable_pg_extensions.rb +0 -9
@@ -0,0 +1,139 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Initiatives
|
5
|
+
class Permissions < Decidim::DefaultPermissions
|
6
|
+
def permissions
|
7
|
+
if read_admin_dashboard_action?
|
8
|
+
user_can_read_admin_dashboard?
|
9
|
+
return permission_action
|
10
|
+
end
|
11
|
+
|
12
|
+
# Delegate the admin permission checks to the admin permissions class
|
13
|
+
return Decidim::Initiatives::Admin::Permissions.new(user, permission_action, context).permissions if permission_action.scope == :admin
|
14
|
+
return permission_action if permission_action.scope != :public
|
15
|
+
|
16
|
+
# Non-logged users permissions
|
17
|
+
list_public_initiatives?
|
18
|
+
read_public_initiative?
|
19
|
+
search_initiative_types_and_scopes?
|
20
|
+
|
21
|
+
return permission_action unless user
|
22
|
+
|
23
|
+
create_initiative?
|
24
|
+
request_membership?
|
25
|
+
|
26
|
+
vote_initiative?
|
27
|
+
unvote_initiative?
|
28
|
+
|
29
|
+
permission_action
|
30
|
+
end
|
31
|
+
|
32
|
+
private
|
33
|
+
|
34
|
+
def initiative
|
35
|
+
@initiative ||= context.fetch(:initiative, nil) || context.fetch(:current_participatory_space, nil)
|
36
|
+
end
|
37
|
+
|
38
|
+
def list_public_initiatives?
|
39
|
+
allow! if permission_action.subject == :initiative &&
|
40
|
+
permission_action.action == :list
|
41
|
+
end
|
42
|
+
|
43
|
+
def read_public_initiative?
|
44
|
+
return unless [:initiative, :participatory_space].include?(permission_action.subject) &&
|
45
|
+
permission_action.action == :read
|
46
|
+
|
47
|
+
return allow! if initiative.published? || initiative.rejected? || initiative.accepted?
|
48
|
+
return allow! if user && (initiative.has_authorship?(user) || user.admin?)
|
49
|
+
disallow!
|
50
|
+
end
|
51
|
+
|
52
|
+
def search_initiative_types_and_scopes?
|
53
|
+
return unless permission_action.action == :search
|
54
|
+
return unless [:initiative_type, :initiative_type_scope].include?(permission_action.subject)
|
55
|
+
|
56
|
+
allow!
|
57
|
+
end
|
58
|
+
|
59
|
+
def create_initiative?
|
60
|
+
return unless permission_action.subject == :initiative &&
|
61
|
+
permission_action.action == :create
|
62
|
+
|
63
|
+
toggle_allow(creation_enabled?)
|
64
|
+
end
|
65
|
+
|
66
|
+
def creation_enabled?
|
67
|
+
Decidim::Initiatives.creation_enabled && (
|
68
|
+
Decidim::Initiatives.do_not_require_authorization ||
|
69
|
+
UserAuthorizations.for(user).any? ||
|
70
|
+
user.user_groups.verified.any?
|
71
|
+
)
|
72
|
+
end
|
73
|
+
|
74
|
+
def request_membership?
|
75
|
+
return unless permission_action.subject == :initiative &&
|
76
|
+
permission_action.action == :request_membership
|
77
|
+
|
78
|
+
can_request = !initiative.published? &&
|
79
|
+
!initiative.has_authorship?(user) &&
|
80
|
+
(
|
81
|
+
Decidim::Initiatives.do_not_require_authorization ||
|
82
|
+
UserAuthorizations.for(user).any? ||
|
83
|
+
user.user_groups.verified.any?
|
84
|
+
)
|
85
|
+
|
86
|
+
toggle_allow(can_request)
|
87
|
+
end
|
88
|
+
|
89
|
+
def has_initiatives?
|
90
|
+
(InitiativesCreated.by(user) | InitiativesPromoted.by(user)).any?
|
91
|
+
end
|
92
|
+
|
93
|
+
def read_admin_dashboard_action?
|
94
|
+
permission_action.action == :read &&
|
95
|
+
permission_action.subject == :admin_dashboard
|
96
|
+
end
|
97
|
+
|
98
|
+
def user_can_read_admin_dashboard?
|
99
|
+
return unless user
|
100
|
+
allow! if has_initiatives?
|
101
|
+
end
|
102
|
+
|
103
|
+
def vote_initiative?
|
104
|
+
return unless permission_action.action == :vote &&
|
105
|
+
permission_action.subject == :initiative
|
106
|
+
|
107
|
+
can_vote = initiative.votes_enabled? &&
|
108
|
+
initiative.organization&.id == user.organization&.id &&
|
109
|
+
initiative.votes.where(decidim_author_id: user.id, decidim_user_group_id: decidim_user_group_id).empty? &&
|
110
|
+
(can_user_support?(initiative) || user.user_groups.verified.any?)
|
111
|
+
|
112
|
+
toggle_allow(can_vote)
|
113
|
+
end
|
114
|
+
|
115
|
+
def unvote_initiative?
|
116
|
+
return unless permission_action.action == :unvote &&
|
117
|
+
permission_action.subject == :initiative
|
118
|
+
|
119
|
+
can_unvote = initiative.votes_enabled? &&
|
120
|
+
initiative.organization&.id == user.organization&.id &&
|
121
|
+
initiative.votes.where(decidim_author_id: user.id, decidim_user_group_id: decidim_user_group_id).any? &&
|
122
|
+
(can_user_support?(initiative) || user.user_groups.verified.any?)
|
123
|
+
|
124
|
+
toggle_allow(can_unvote)
|
125
|
+
end
|
126
|
+
|
127
|
+
def decidim_user_group_id
|
128
|
+
context.fetch(:group_id, nil)
|
129
|
+
end
|
130
|
+
|
131
|
+
def can_user_support?(initiative)
|
132
|
+
!initiative.offline? && (
|
133
|
+
Decidim::Initiatives.do_not_require_authorization ||
|
134
|
+
UserAuthorizations.for(user).any?
|
135
|
+
)
|
136
|
+
end
|
137
|
+
end
|
138
|
+
end
|
139
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
#
|
5
|
+
# Decorator for initiatives
|
6
|
+
#
|
7
|
+
class InitiativePresenter < SimpleDelegator
|
8
|
+
def author
|
9
|
+
@author ||= if user_group
|
10
|
+
Decidim::UserGroupPresenter.new(user_group)
|
11
|
+
else
|
12
|
+
Decidim::UserPresenter.new(super)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -1,35 +1 @@
|
|
1
|
-
|
2
|
-
<article class="card card--initiative">
|
3
|
-
<div class="card__content">
|
4
|
-
<div class="card__header">
|
5
|
-
<%= link_to initiative do %>
|
6
|
-
<h5 class="card__title"><%= translated_attribute initiative.title %></h5>
|
7
|
-
<% end %>
|
8
|
-
<%= render partial: "decidim/initiatives/initiatives/author", locals: { initiative: initiative } %>
|
9
|
-
</div>
|
10
|
-
<%= render partial: "decidim/initiatives/initiatives/initiative_badge", locals: { initiative: initiative } %>
|
11
|
-
<%= simple_format Truncato.truncate(translated_attribute(initiative.description), max_length: 100, separator: "...") %>
|
12
|
-
<%= render partial: "decidim/initiatives/initiatives/tags", locals: { resource: initiative } %>
|
13
|
-
</div>
|
14
|
-
|
15
|
-
<div class="card__footer">
|
16
|
-
<div class="card__support">
|
17
|
-
<% if initiative.published? %>
|
18
|
-
<%= render partial: "decidim/initiatives/initiatives/supports_count", locals: { initiative: initiative } %>
|
19
|
-
<% else %>
|
20
|
-
<div class="card__support__data"></div>
|
21
|
-
<% end %>
|
22
|
-
|
23
|
-
<% if initiative.closed? || initiative.offline? %>
|
24
|
-
<%= link_to t("initiatives.initiative.check", scope: "layouts.decidim"),
|
25
|
-
initiative,
|
26
|
-
class: "card__button button small secondary" %>
|
27
|
-
<% else %>
|
28
|
-
<%= link_to t("initiatives.initiative.check_and_support", scope: "layouts.decidim"),
|
29
|
-
initiative,
|
30
|
-
class: "card__button button small secondary" %>
|
31
|
-
<% end %>
|
32
|
-
</div>
|
33
|
-
</div>
|
34
|
-
</article>
|
35
|
-
</div>
|
1
|
+
<%= card_for initiative %>
|
@@ -39,14 +39,14 @@
|
|
39
39
|
<%= link_to request.user.name, "mailto:#{request.user.email}" %>
|
40
40
|
</td>
|
41
41
|
<td class="table-list__actions">
|
42
|
-
<% if
|
42
|
+
<% if allowed_to? :approve, :initiative_committee_member, request: request %>
|
43
43
|
<%= icon_link_to "check",
|
44
44
|
approve_initiative_committee_request_path(current_initiative, request),
|
45
45
|
t(".approve"),
|
46
46
|
class: "action-icon--check" %>
|
47
47
|
<% end %>
|
48
48
|
|
49
|
-
<% if
|
49
|
+
<% if allowed_to? :revoke, :initiative_committee_member, request: request %>
|
50
50
|
<%= icon_link_to "circle-x",
|
51
51
|
revoke_initiative_committee_request_path(current_initiative, request),
|
52
52
|
t(".revoke"),
|
@@ -64,4 +64,3 @@
|
|
64
64
|
</div>
|
65
65
|
|
66
66
|
<%= javascript_include_tag "decidim/initiatives/admin/invite_users.js" %>
|
67
|
-
<%= stylesheet_link_tag "decidim/initiatives/application.css" %>
|
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
<div class="card-section">
|
7
7
|
<div class="row column">
|
8
|
-
<%= form.translated :text_field, :title, autofocus: true, disabled:
|
8
|
+
<%= form.translated :text_field, :title, autofocus: true, disabled: !allowed_to?(:update, :initiative, initiative: current_initiative) %>
|
9
9
|
</div>
|
10
10
|
|
11
11
|
<div class="row column">
|
12
|
-
<%= form.translated :editor, :description, toolbar: :full, lines: 8, disabled:
|
12
|
+
<%= form.translated :editor, :description, toolbar: :full, lines: 8, disabled: !allowed_to?(:update, :initiative, initiative: current_initiative) %>
|
13
13
|
</div>
|
14
14
|
|
15
15
|
<div class="row">
|
@@ -44,7 +44,7 @@
|
|
44
44
|
|
45
45
|
<div class="row">
|
46
46
|
<div class="columns xlarge-6">
|
47
|
-
<%= form.text_field :hashtag, disabled:
|
47
|
+
<%= form.text_field :hashtag, disabled: !allowed_to?(:update, :initiative, initiative: current_initiative) %>
|
48
48
|
</div>
|
49
49
|
|
50
50
|
<div class="columns xlarge-6">
|
@@ -1,9 +1,9 @@
|
|
1
1
|
<%= decidim_form_for @form, html: { class: "form edit_initiative" } do |f| %>
|
2
2
|
<%= render partial: "form", object: f %>
|
3
3
|
<div class="button--double form-general-submit">
|
4
|
-
<%= f.submit t(".update"), class: "button" if
|
4
|
+
<%= f.submit t(".update"), class: "button" if allowed_to? :update, :initiative, initiative: current_initiative %>
|
5
5
|
|
6
|
-
<% if
|
6
|
+
<% if allowed_to? :send_to_technical_validation, :initiative, initiative: current_initiative %>
|
7
7
|
<%= link_to t(".send_to_technical_validation"),
|
8
8
|
send_to_technical_validation_initiative_path(current_initiative),
|
9
9
|
class: "button muted",
|
@@ -12,7 +12,7 @@
|
|
12
12
|
<%= link_to t(".send_to_technical_validation"), "#", class: "button muted disabled" if current_initiative.created? %>
|
13
13
|
<% end %>
|
14
14
|
|
15
|
-
<% if
|
15
|
+
<% if allowed_to? :publish, :initiative, initiative: current_initiative %>
|
16
16
|
<%= link_to t("actions.publish", scope: "decidim.admin"),
|
17
17
|
publish_initiative_path(current_initiative),
|
18
18
|
method: :post,
|
@@ -20,7 +20,7 @@
|
|
20
20
|
data: { confirm: t(".confirm") } %>
|
21
21
|
<% end %>
|
22
22
|
|
23
|
-
<% if
|
23
|
+
<% if allowed_to? :unpublish, :initiative, initiative: current_initiative %>
|
24
24
|
<%= link_to t("actions.unpublish", scope: "decidim.admin"),
|
25
25
|
unpublish_initiative_path(current_initiative),
|
26
26
|
method: :delete,
|
@@ -28,7 +28,7 @@
|
|
28
28
|
data: { confirm: t(".confirm") } %>
|
29
29
|
<% end %>
|
30
30
|
|
31
|
-
<% if
|
31
|
+
<% if allowed_to? :accept, :initiative, initiative: current_initiative %>
|
32
32
|
<%= link_to t(".accept"),
|
33
33
|
accept_initiative_path(current_initiative),
|
34
34
|
method: :post,
|
@@ -36,7 +36,7 @@
|
|
36
36
|
data: { confirm: t(".confirm") } %>
|
37
37
|
<% end %>
|
38
38
|
|
39
|
-
<% if
|
39
|
+
<% if allowed_to? :reject, :initiative, initiative: current_initiative %>
|
40
40
|
<%= link_to t(".reject"),
|
41
41
|
reject_initiative_path(current_initiative),
|
42
42
|
method: :delete,
|
@@ -44,7 +44,7 @@
|
|
44
44
|
data: { confirm: t(".confirm") } %>
|
45
45
|
<% end %>
|
46
46
|
|
47
|
-
<% if
|
47
|
+
<% if allowed_to? :discard, :initiative, initiative: current_initiative %>
|
48
48
|
<%= link_to t(".discard"),
|
49
49
|
discard_initiative_path(current_initiative),
|
50
50
|
method: :delete,
|
@@ -52,7 +52,7 @@
|
|
52
52
|
data: { confirm: t(".confirm") } %>
|
53
53
|
<% end %>
|
54
54
|
|
55
|
-
<% if
|
55
|
+
<% if allowed_to? :export_votes, :initiative, initiative: current_initiative %>
|
56
56
|
<%= link_to t(".export_votes"),
|
57
57
|
export_votes_initiative_path(current_initiative, format: :csv),
|
58
58
|
class: "button alert",
|
@@ -61,7 +61,7 @@
|
|
61
61
|
<% @initiatives.each do |initiative| %>
|
62
62
|
<tr>
|
63
63
|
<td>
|
64
|
-
<% if
|
64
|
+
<% if allowed_to? :edit, :initiative, initiative: initiative %>
|
65
65
|
<%= link_to translated_attribute(initiative.title),
|
66
66
|
decidim_admin_initiatives.edit_initiative_path(initiative.to_param) %>
|
67
67
|
<% else %>
|
@@ -72,7 +72,7 @@
|
|
72
72
|
<td><%= initiative.supports_count %>/<%= initiative.scoped_type.supports_required %></td>
|
73
73
|
<td><%= l initiative.created_at, format: :short %></td>
|
74
74
|
<td class="table-list__actions">
|
75
|
-
<% if
|
75
|
+
<% if allowed_to? :preview, :initiative, initiative: initiative %>
|
76
76
|
<%= icon_link_to "eye",
|
77
77
|
decidim_initiatives.initiative_path(initiative.to_param),
|
78
78
|
t(".preview"),
|
@@ -80,14 +80,14 @@
|
|
80
80
|
target: "_blank" %>
|
81
81
|
<% end %>
|
82
82
|
|
83
|
-
<% if
|
83
|
+
<% if allowed_to? :edit, :initiative, initiative: initiative %>
|
84
84
|
<%= icon_link_to "pencil",
|
85
85
|
decidim_admin_initiatives.edit_initiative_path(initiative.to_param),
|
86
86
|
t("actions.configure", scope: "decidim.admin"),
|
87
87
|
class: "action-icon--edit" %>
|
88
88
|
<% end %>
|
89
89
|
|
90
|
-
<% if
|
90
|
+
<% if allowed_to? :read, :initiative, initiative: initiative %>
|
91
91
|
<%= icon_link_to "print",
|
92
92
|
decidim_admin_initiatives.initiative_path(initiative.to_param),
|
93
93
|
t(".print",),
|
@@ -9,7 +9,7 @@
|
|
9
9
|
<div class="button--double form-general-submit">
|
10
10
|
<%= f.submit t(".update"), class: "button" %>
|
11
11
|
|
12
|
-
<% if
|
12
|
+
<% if allowed_to? :destroy, :initiative_type_scope, initiative_type_scope: current_initiative_type_scope %>
|
13
13
|
<%= link_to t(".destroy"), initiatives_type_initiatives_type_scope_path(params[:initiatives_type_id], current_initiative_type_scope),
|
14
14
|
method: :delete,
|
15
15
|
class: "alert button",
|
@@ -4,7 +4,7 @@
|
|
4
4
|
<%= t ".title" %>
|
5
5
|
<%= link_to t("actions.new", scope: "decidim.admin", name: t("models.initiatives_type_scope.name", scope: "decidim.admin")),
|
6
6
|
new_initiatives_type_initiatives_type_scope_path(initiative_type),
|
7
|
-
class: "button tiny button--title" if
|
7
|
+
class: "button tiny button--title" if allowed_to? :create, :initiative_type_scope %>
|
8
8
|
</h2>
|
9
9
|
</div>
|
10
10
|
<div class="row column">
|
@@ -28,7 +28,7 @@
|
|
28
28
|
<%= icon_link_to "pencil",
|
29
29
|
decidim_admin_initiatives.edit_initiatives_type_initiatives_type_scope_path(initiative_type, s),
|
30
30
|
t("actions.configure", scope: "decidim.admin"),
|
31
|
-
class: "action-icon--new" if
|
31
|
+
class: "action-icon--new" if allowed_to? :edit, :initiative_type_scope, initiative_type_scope: s %>
|
32
32
|
</td>
|
33
33
|
</tr>
|
34
34
|
<% end %>
|
@@ -3,7 +3,7 @@
|
|
3
3
|
<div class="button--double form-general-submit">
|
4
4
|
<%= f.submit t(".update"), class: "button" %>
|
5
5
|
|
6
|
-
<% if
|
6
|
+
<% if allowed_to? :destroy, :initiative_type, initiative_type: current_initiative_type %>
|
7
7
|
<%= link_to t(".destroy"), current_initiative_type,
|
8
8
|
method: :delete,
|
9
9
|
class: "alert button",
|
@@ -4,7 +4,7 @@
|
|
4
4
|
<%= t "decidim.admin.titles.initiatives_types" %>
|
5
5
|
<%= link_to t("actions.new", scope: "decidim.admin", name: t("models.initiatives_types.name", scope: "decidim.admin")),
|
6
6
|
["new", "initiatives_type"],
|
7
|
-
class: "button tiny button--title" if
|
7
|
+
class: "button tiny button--title" if allowed_to? :create, :initiative_type %>
|
8
8
|
</h2>
|
9
9
|
</div>
|
10
10
|
<div class="card-section">
|
@@ -20,7 +20,7 @@
|
|
20
20
|
<% @initiatives_types.each do |initiative_type| %>
|
21
21
|
<tr>
|
22
22
|
<td>
|
23
|
-
<% if
|
23
|
+
<% if allowed_to? :update, :initiative_type, initiative_type: initiative_type %>
|
24
24
|
<%= link_to translated_attribute(initiative_type.title), edit_initiatives_type_path(initiative_type) %>
|
25
25
|
<% else %>
|
26
26
|
<%= translated_attribute initiative_type.title %></td>
|
@@ -27,11 +27,9 @@
|
|
27
27
|
spawn_initiative_committee_requests_path(current_initiative),
|
28
28
|
class: "title-action__action button small hollow" if current_user %>
|
29
29
|
|
30
|
-
<%=
|
31
|
-
|
32
|
-
|
33
|
-
class: "title-action__action button small hollow" unless current_user %>
|
30
|
+
<%= link_to t(".continue"),
|
31
|
+
spawn_initiative_committee_requests_path(current_initiative),
|
32
|
+
class: "title-action__action button small hollow" unless current_user %>
|
34
33
|
</div>
|
35
34
|
</div>
|
36
35
|
</div>
|
37
|
-
<%= stylesheet_link_tag "decidim/initiatives/application" %>
|
@@ -2,8 +2,8 @@
|
|
2
2
|
<h2 id="initiatives-count" class="title-action__title section-heading">
|
3
3
|
<%= render partial: "count" %>
|
4
4
|
</h2>
|
5
|
-
<% if
|
6
|
-
<%=
|
5
|
+
<% if allowed_to? :create, :initiative %>
|
6
|
+
<%= link_to create_initiative_path(:select_initiative_type), class: "title-action__action button small hollow" do %>
|
7
7
|
<%= t(".new_initiative") %>
|
8
8
|
<%= icon "plus" %>
|
9
9
|
<% end %>
|
@@ -1,18 +1,20 @@
|
|
1
|
-
<% if
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
1
|
+
<% if allowed_to? :vote, :initiative, initiative: initiative %>
|
2
|
+
<%= button_to(
|
3
|
+
vote_label,
|
4
|
+
initiative_initiative_vote_path(initiative_slug: current_initiative.slug),
|
5
|
+
remote: true,
|
6
|
+
data: { disable: true },
|
7
|
+
class: "card__button button expanded button--sc"
|
8
|
+
) %>
|
8
9
|
<% end %>
|
9
10
|
|
10
|
-
<% if
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
11
|
+
<% if allowed_to? :unvote, :initiative, initiative: initiative %>
|
12
|
+
<%= button_to(
|
13
|
+
vote_label,
|
14
|
+
initiative_initiative_vote_path(initiative_slug: current_initiative.slug),
|
15
|
+
method: :delete,
|
16
|
+
remote: true,
|
17
|
+
data: { disable: true },
|
18
|
+
class: "card__button button expanded button--sc success"
|
19
|
+
) %>
|
18
20
|
<% end %>
|