decidim-proposals 0.0.3 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/decidim/proposals/admin/proposal_answers_controller.rb +2 -0
- data/app/controllers/decidim/proposals/admin/proposals_controller.rb +2 -0
- data/app/controllers/decidim/proposals/proposals_controller.rb +42 -5
- data/app/forms/decidim/proposals/proposal_form.rb +3 -1
- data/app/helpers/decidim/proposals/proposal_votes_helper.rb +1 -1
- data/app/models/decidim/proposals/abilities/admin_user.rb +45 -0
- data/app/models/decidim/proposals/abilities/current_user.rb +22 -4
- data/app/models/decidim/proposals/abilities/process_admin_user.rb +57 -0
- data/app/models/decidim/proposals/proposal.rb +23 -2
- data/app/services/decidim/proposals/proposal_search.rb +25 -13
- data/app/views/decidim/proposals/admin/proposal_answers/edit.html.erb +1 -1
- data/app/views/decidim/proposals/admin/proposals/_form.html.erb +1 -1
- data/app/views/decidim/proposals/admin/proposals/index.html.erb +16 -10
- data/app/views/decidim/proposals/admin/proposals/new.html.erb +1 -1
- data/app/views/decidim/proposals/proposal_votes/update_buttons_and_counters.js.erb +4 -4
- data/app/views/decidim/proposals/proposals/_filters.html.erb +15 -3
- data/app/views/decidim/proposals/proposals/_proposal.html.erb +3 -11
- data/app/views/decidim/proposals/proposals/_proposals.html.erb +2 -1
- data/app/views/decidim/proposals/proposals/_remaining_votes_count.html.erb +3 -1
- data/app/views/decidim/proposals/proposals/_tags.html.erb +10 -0
- data/app/views/decidim/proposals/proposals/_vote_button.html.erb +23 -21
- data/app/views/decidim/proposals/proposals/_votes_count.html.erb +9 -6
- data/app/views/decidim/proposals/proposals/_votes_limit.html.erb +1 -3
- data/app/views/decidim/proposals/proposals/index.html.erb +3 -3
- data/app/views/decidim/proposals/proposals/index.js.erb +6 -1
- data/app/views/decidim/proposals/proposals/new.html.erb +2 -2
- data/app/views/decidim/proposals/proposals/show.html.erb +23 -28
- data/config/i18n-tasks.yml +2 -0
- data/config/locales/ca.yml +30 -15
- data/config/locales/en.yml +19 -4
- data/config/locales/es.yml +19 -4
- data/config/locales/eu.yml +5 -0
- data/db/migrate/20170205082832_add_index_to_decidim_proposals_proposals_proposal_votes_count.rb +7 -0
- data/lib/decidim/proposals/admin_engine.rb +7 -0
- data/lib/decidim/proposals/feature.rb +16 -3
- data/lib/decidim/proposals/test/factories.rb +1 -1
- metadata +19 -15
- data/app/views/decidim/proposals/proposals/_share.html.erb +0 -33
data/config/locales/es.yml
CHANGED
@@ -10,10 +10,21 @@ es:
|
|
10
10
|
decidim:
|
11
11
|
features:
|
12
12
|
proposals:
|
13
|
+
actions:
|
14
|
+
create: Crear propuestas
|
15
|
+
vote: Votar
|
13
16
|
name: Propuestas
|
14
17
|
settings:
|
18
|
+
global:
|
19
|
+
comments_enabled: Comentarios habilitados
|
20
|
+
official_proposals_enabled: Propuestas oficiales habilitadas
|
21
|
+
proposal_answering_enabled: Respuesta oficial a propuestas habilitadas
|
22
|
+
scoped_proposals_enabled: Propuestas con ámbito
|
23
|
+
vote_limit: Límite de votos
|
15
24
|
step:
|
25
|
+
comments_blocked: Comentarios bloqueados
|
16
26
|
creation_enabled: Habilitar creación de propuestas
|
27
|
+
proposal_answering_enabled: Respuesta a propuestas activadas
|
17
28
|
votes_blocked: Votación bloqueada
|
18
29
|
votes_enabled: Votos habilitados
|
19
30
|
proposals:
|
@@ -75,6 +86,8 @@ es:
|
|
75
86
|
official: Oficial
|
76
87
|
origin: Origen
|
77
88
|
rejected: Rechazadas
|
89
|
+
related_to: Relacionado con
|
90
|
+
scopes: Ámbitos
|
78
91
|
search: Buscar
|
79
92
|
state: Estado
|
80
93
|
voted: Votado
|
@@ -95,13 +108,15 @@ es:
|
|
95
108
|
select_a_scope: Por favor, seleccione un ámbito
|
96
109
|
send: Enviar
|
97
110
|
title: Nueva propuesta
|
111
|
+
orders:
|
112
|
+
label: 'Ordenar propuestas por:'
|
113
|
+
most_voted: Más votado
|
114
|
+
random: Aleatorio
|
115
|
+
recent: Reciente
|
98
116
|
proposal:
|
99
117
|
view_proposal: Ver propuesta
|
100
|
-
share:
|
101
|
-
close_window: Cerrar ventana
|
102
|
-
share: Compartir
|
103
|
-
share_link: Compartir enlace
|
104
118
|
show:
|
119
|
+
proposal_accepted_reason: 'Esta propuesta ha sido aceptada porque:'
|
105
120
|
proposal_rejected_reason: 'Esta propuesta ha sido rechazada porque:'
|
106
121
|
vote_button:
|
107
122
|
already_voted: Ya votado
|
data/db/migrate/20170205082832_add_index_to_decidim_proposals_proposals_proposal_votes_count.rb
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
class AddIndexToDecidimProposalsProposalsProposalVotesCount < ActiveRecord::Migration[5.0]
|
2
|
+
def change
|
3
|
+
add_index :decidim_proposals_proposals, :proposal_votes_count
|
4
|
+
add_index :decidim_proposals_proposals, :created_at
|
5
|
+
add_index :decidim_proposals_proposals, :state
|
6
|
+
end
|
7
|
+
end
|
@@ -14,6 +14,13 @@ module Decidim
|
|
14
14
|
root to: "proposals#index"
|
15
15
|
end
|
16
16
|
|
17
|
+
initializer "decidim_proposals.inject_abilities_to_user" do |_app|
|
18
|
+
Decidim.configure do |config|
|
19
|
+
config.admin_abilities += ["Decidim::Proposals::Abilities::AdminUser"]
|
20
|
+
config.admin_abilities += ["Decidim::Proposals::Abilities::ProcessAdminUser"]
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
17
24
|
def load_seed
|
18
25
|
nil
|
19
26
|
end
|
@@ -13,16 +13,22 @@ Decidim.register_feature(:proposals) do |feature|
|
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
16
|
+
feature.actions = %w(vote create)
|
17
|
+
|
16
18
|
feature.settings(:global) do |settings|
|
17
19
|
settings.attribute :vote_limit, type: :integer, default: 0
|
18
|
-
settings.attribute :
|
20
|
+
settings.attribute :proposal_answering_enabled, type: :boolean, default: true
|
21
|
+
settings.attribute :official_proposals_enabled, type: :boolean, default: true
|
22
|
+
settings.attribute :scoped_proposals_enabled, type: :boolean, default: true
|
23
|
+
settings.attribute :comments_enabled, type: :boolean, default: true
|
19
24
|
end
|
20
25
|
|
21
26
|
feature.settings(:step) do |settings|
|
22
27
|
settings.attribute :votes_enabled, type: :boolean
|
23
28
|
settings.attribute :votes_blocked, type: :boolean
|
24
|
-
settings.attribute :
|
29
|
+
settings.attribute :comments_blocked, type: :boolean, default: false
|
25
30
|
settings.attribute :creation_enabled, type: :boolean
|
31
|
+
settings.attribute :proposal_answering_enabled, type: :boolean, default: true
|
26
32
|
end
|
27
33
|
|
28
34
|
feature.register_resource do |resource|
|
@@ -37,6 +43,7 @@ Decidim.register_feature(:proposals) do |feature|
|
|
37
43
|
feature = Decidim::Feature.create!(
|
38
44
|
name: Decidim::Features::Namer.new(process.organization.available_locales, :proposals).i18n_name,
|
39
45
|
manifest_name: :proposals,
|
46
|
+
published_at: Time.current,
|
40
47
|
participatory_process: process,
|
41
48
|
settings: {
|
42
49
|
vote_limit: 0
|
@@ -45,10 +52,14 @@ Decidim.register_feature(:proposals) do |feature|
|
|
45
52
|
process.active_step.id => { votes_enabled: true, votes_blocked: false, creation_enabled: true }
|
46
53
|
}
|
47
54
|
)
|
55
|
+
categories = feature.participatory_process.categories
|
56
|
+
scopes = feature.organization.scopes
|
48
57
|
|
49
58
|
20.times do |n|
|
50
59
|
proposal = Decidim::Proposals::Proposal.create!(
|
51
60
|
feature: feature,
|
61
|
+
category: categories.sample,
|
62
|
+
scope: scopes.sample,
|
52
63
|
title: Faker::Lorem.sentence(2),
|
53
64
|
body: Faker::Lorem.paragraphs(2).join("\n"),
|
54
65
|
author: Decidim::User.where(organization: feature.organization).all.sample
|
@@ -75,7 +86,9 @@ Decidim.register_feature(:proposals) do |feature|
|
|
75
86
|
name: name,
|
76
87
|
organization: feature.organization,
|
77
88
|
tos_agreement: "1",
|
78
|
-
confirmed_at: Time.
|
89
|
+
confirmed_at: Time.current,
|
90
|
+
comments_notifications: true,
|
91
|
+
replies_notifications: true)
|
79
92
|
|
80
93
|
Decidim::Proposals::ProposalVote.create!(proposal: proposal,
|
81
94
|
author: author)
|
@@ -7,7 +7,7 @@ require "decidim/results/test/factories"
|
|
7
7
|
require "decidim/budgets/test/factories"
|
8
8
|
|
9
9
|
FactoryGirl.define do
|
10
|
-
factory :proposal_feature,
|
10
|
+
factory :proposal_feature, parent: :feature do
|
11
11
|
name { Decidim::Features::Namer.new(participatory_process.organization.available_locales, :proposals).i18n_name }
|
12
12
|
manifest_name :proposals
|
13
13
|
participatory_process { create(:participatory_process, :with_steps) }
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: decidim-proposals
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
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-02-
|
13
|
+
date: 2017-02-17 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: decidim-core
|
@@ -18,28 +18,28 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - '='
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 0.0.
|
21
|
+
version: 0.0.5
|
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.0.
|
28
|
+
version: 0.0.5
|
29
29
|
- !ruby/object:Gem::Dependency
|
30
30
|
name: decidim-comments
|
31
31
|
requirement: !ruby/object:Gem::Requirement
|
32
32
|
requirements:
|
33
33
|
- - '='
|
34
34
|
- !ruby/object:Gem::Version
|
35
|
-
version: 0.0.
|
35
|
+
version: 0.0.5
|
36
36
|
type: :runtime
|
37
37
|
prerelease: false
|
38
38
|
version_requirements: !ruby/object:Gem::Requirement
|
39
39
|
requirements:
|
40
40
|
- - '='
|
41
41
|
- !ruby/object:Gem::Version
|
42
|
-
version: 0.0.
|
42
|
+
version: 0.0.5
|
43
43
|
- !ruby/object:Gem::Dependency
|
44
44
|
name: rectify
|
45
45
|
requirement: !ruby/object:Gem::Requirement
|
@@ -88,56 +88,56 @@ dependencies:
|
|
88
88
|
requirements:
|
89
89
|
- - '='
|
90
90
|
- !ruby/object:Gem::Version
|
91
|
-
version: 0.0.
|
91
|
+
version: 0.0.5
|
92
92
|
type: :development
|
93
93
|
prerelease: false
|
94
94
|
version_requirements: !ruby/object:Gem::Requirement
|
95
95
|
requirements:
|
96
96
|
- - '='
|
97
97
|
- !ruby/object:Gem::Version
|
98
|
-
version: 0.0.
|
98
|
+
version: 0.0.5
|
99
99
|
- !ruby/object:Gem::Dependency
|
100
100
|
name: decidim-meetings
|
101
101
|
requirement: !ruby/object:Gem::Requirement
|
102
102
|
requirements:
|
103
103
|
- - '='
|
104
104
|
- !ruby/object:Gem::Version
|
105
|
-
version: 0.0.
|
105
|
+
version: 0.0.5
|
106
106
|
type: :development
|
107
107
|
prerelease: false
|
108
108
|
version_requirements: !ruby/object:Gem::Requirement
|
109
109
|
requirements:
|
110
110
|
- - '='
|
111
111
|
- !ruby/object:Gem::Version
|
112
|
-
version: 0.0.
|
112
|
+
version: 0.0.5
|
113
113
|
- !ruby/object:Gem::Dependency
|
114
114
|
name: decidim-results
|
115
115
|
requirement: !ruby/object:Gem::Requirement
|
116
116
|
requirements:
|
117
117
|
- - '='
|
118
118
|
- !ruby/object:Gem::Version
|
119
|
-
version: 0.0.
|
119
|
+
version: 0.0.5
|
120
120
|
type: :development
|
121
121
|
prerelease: false
|
122
122
|
version_requirements: !ruby/object:Gem::Requirement
|
123
123
|
requirements:
|
124
124
|
- - '='
|
125
125
|
- !ruby/object:Gem::Version
|
126
|
-
version: 0.0.
|
126
|
+
version: 0.0.5
|
127
127
|
- !ruby/object:Gem::Dependency
|
128
128
|
name: decidim-budgets
|
129
129
|
requirement: !ruby/object:Gem::Requirement
|
130
130
|
requirements:
|
131
131
|
- - '='
|
132
132
|
- !ruby/object:Gem::Version
|
133
|
-
version: 0.0.
|
133
|
+
version: 0.0.5
|
134
134
|
type: :development
|
135
135
|
prerelease: false
|
136
136
|
version_requirements: !ruby/object:Gem::Requirement
|
137
137
|
requirements:
|
138
138
|
- - '='
|
139
139
|
- !ruby/object:Gem::Version
|
140
|
-
version: 0.0.
|
140
|
+
version: 0.0.5
|
141
141
|
description: A proposals component for decidim's participatory processes.
|
142
142
|
email:
|
143
143
|
- josepjaume@gmail.com
|
@@ -168,7 +168,9 @@ files:
|
|
168
168
|
- app/forms/decidim/proposals/proposal_form.rb
|
169
169
|
- app/helpers/decidim/proposals/application_helper.rb
|
170
170
|
- app/helpers/decidim/proposals/proposal_votes_helper.rb
|
171
|
+
- app/models/decidim/proposals/abilities/admin_user.rb
|
171
172
|
- app/models/decidim/proposals/abilities/current_user.rb
|
173
|
+
- app/models/decidim/proposals/abilities/process_admin_user.rb
|
172
174
|
- app/models/decidim/proposals/application_record.rb
|
173
175
|
- app/models/decidim/proposals/proposal.rb
|
174
176
|
- app/models/decidim/proposals/proposal_vote.rb
|
@@ -186,7 +188,7 @@ files:
|
|
186
188
|
- app/views/decidim/proposals/proposals/_proposal_badge.html.erb
|
187
189
|
- app/views/decidim/proposals/proposals/_proposals.html.erb
|
188
190
|
- app/views/decidim/proposals/proposals/_remaining_votes_count.html.erb
|
189
|
-
- app/views/decidim/proposals/proposals/
|
191
|
+
- app/views/decidim/proposals/proposals/_tags.html.erb
|
190
192
|
- app/views/decidim/proposals/proposals/_vote_button.html.erb
|
191
193
|
- app/views/decidim/proposals/proposals/_votes_count.html.erb
|
192
194
|
- app/views/decidim/proposals/proposals/_votes_limit.html.erb
|
@@ -199,12 +201,14 @@ files:
|
|
199
201
|
- config/locales/ca.yml
|
200
202
|
- config/locales/en.yml
|
201
203
|
- config/locales/es.yml
|
204
|
+
- config/locales/eu.yml
|
202
205
|
- db/migrate/20161212110850_create_decidim_proposals.rb
|
203
206
|
- db/migrate/20170112115253_create_proposal_votes.rb
|
204
207
|
- db/migrate/20170113114245_add_text_search_indexes.rb
|
205
208
|
- db/migrate/20170118120151_add_counter_cache_votes_to_proposals.rb
|
206
209
|
- db/migrate/20170120151202_add_user_group_id_to_proposals.rb
|
207
210
|
- db/migrate/20170131092413_add_answers_to_proposals.rb
|
211
|
+
- db/migrate/20170205082832_add_index_to_decidim_proposals_proposals_proposal_votes_count.rb
|
208
212
|
- lib/decidim/proposals.rb
|
209
213
|
- lib/decidim/proposals/admin.rb
|
210
214
|
- lib/decidim/proposals/admin_engine.rb
|
@@ -1,33 +0,0 @@
|
|
1
|
-
<div class="text-center">
|
2
|
-
<button class="share-link link text-center" data-open="processShare">
|
3
|
-
<%= t(".share") %>
|
4
|
-
<%= icon "share", class: "icon--after"%>
|
5
|
-
</button>
|
6
|
-
</div>
|
7
|
-
<div class="reveal" id="processShare" data-reveal>
|
8
|
-
<div class="reveal__header">
|
9
|
-
<h3 class="reveal__title"><%= t(".share") %>:</h3>
|
10
|
-
<button class="close-button" data-close aria-label="<%= t(".close_window") %>" type="button">
|
11
|
-
<span aria-hidden="true">×</span>
|
12
|
-
</button>
|
13
|
-
</div>
|
14
|
-
<div class="button-group text-center">
|
15
|
-
<%= social_share_button_tag(content_for(:meta_title),
|
16
|
-
url: content_for(:meta_url),
|
17
|
-
image: content_for(:meta_image_url),
|
18
|
-
desc: content_for(:meta_description),
|
19
|
-
via: content_for(:twitter_handler)) %>
|
20
|
-
<a class="button secondary" data-open="urlShare">
|
21
|
-
<%= icon "link-intact" %>
|
22
|
-
</a>
|
23
|
-
</div>
|
24
|
-
</div>
|
25
|
-
<div class="reveal" id="urlShare" data-reveal>
|
26
|
-
<div class="reveal__header">
|
27
|
-
<h3 class="reveal__title"><%= t(".share_link") %>:</h3>
|
28
|
-
<button class="close-button" data-close aria-label="<%= t(".close_window") %>" type="button">
|
29
|
-
<span aria-hidden="true">×</span>
|
30
|
-
</button>
|
31
|
-
</div>
|
32
|
-
<h4 class="heading4"><%= "#{content_for(:meta_url)}" %></h4>
|
33
|
-
</div>
|