decidim-proposals 0.6.1 → 0.6.2

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
2
  SHA1:
3
- metadata.gz: 9786ad14568feca83e19bdd3b0cc001ca23831c5
4
- data.tar.gz: 1d274299ef0d2a2e3346adfb283955e1d794bd88
3
+ metadata.gz: 7ba6d89c8d072f52bc311080478b50c62ba12ea0
4
+ data.tar.gz: d75a974073d4f6f5d345b9b78bd2ebee9796a587
5
5
  SHA512:
6
- metadata.gz: f1e481504696f80834dba25c7718bec58ac86347b280c54de34b8bacdcd66d59d838c2bd1c5a1be97e7340e7ed2df8eed03dc2a230d335812e20db0e2b7e63e5
7
- data.tar.gz: 075b2cd87b304a6e3acfb23d6f77b77f4276d28bcc2c155fbbf7174ba56c06f74eba5def12bf50a8394151077f2ed10f55d007fa6223fd105333b09d6f94f1ea
6
+ metadata.gz: 30421dcd0ea2c98258d743a60f15f715c642c56a4b318325224f3517ff7e8e1fb05083bd8b1af9e35178899ac36cc3cea4e066e3ebe36f0ff32ea50fe10584b6
7
+ data.tar.gz: c4a1b51c4384edd5729d7ce6a845edebfca6bc76b485b8111acf5fd1a137b71f995dff77fa63e6e48c240fa6a3fbd08468eca0e3a0ddecb06b2098334f3ef60a
@@ -61,21 +61,21 @@ module Decidim
61
61
  #
62
62
  # Returns Boolean.
63
63
  def accepted?
64
- state == "accepted"
64
+ answered? && state == "accepted"
65
65
  end
66
66
 
67
67
  # Public: Checks if the organization has rejected a proposal.
68
68
  #
69
69
  # Returns Boolean.
70
70
  def rejected?
71
- state == "rejected"
71
+ answered? && state == "rejected"
72
72
  end
73
73
 
74
74
  # Public: Checks if the organization has marked the proposal as evaluating it.
75
75
  #
76
76
  # Returns Boolean.
77
77
  def evaluating?
78
- state == "evaluating"
78
+ answered? && state == "evaluating"
79
79
  end
80
80
 
81
81
  # Public: Overrides the `commentable?` Commentable concern method.
@@ -9,6 +9,7 @@ module Decidim
9
9
 
10
10
  validates :proposal, uniqueness: { scope: :author }
11
11
  validate :author_and_proposal_same_organization
12
+ validate :proposal_not_rejected
12
13
 
13
14
  private
14
15
 
@@ -17,6 +18,11 @@ module Decidim
17
18
  return if !proposal || !author
18
19
  errors.add(:proposal, :invalid) unless author.organization == proposal.organization
19
20
  end
21
+
22
+ def proposal_not_rejected
23
+ return unless proposal
24
+ errors.add(:proposal, :invalid) if proposal.rejected?
25
+ end
20
26
  end
21
27
  end
22
28
  end
@@ -1,23 +1,25 @@
1
- <div id="proposal-<%= proposal.id %>-vote-button">
2
- <% if !current_user %>
3
- <% if current_settings.votes_blocked? %>
4
- <%= action_authorized_button_to :vote, t('.votes_blocked'), proposal_proposal_vote_path(proposal_id: proposal, from_proposals_list: from_proposals_list), class: "card__button button #{vote_button_classes(from_proposals_list)} disabled", disabled: true %>
5
- <% else %>
6
- <%= action_authorized_button_to :vote, t('.vote'), proposal_proposal_vote_path(proposal_id: proposal, from_proposals_list: from_proposals_list), class: "card__button button #{vote_button_classes(from_proposals_list)}" %>
7
- <% end %>
8
- <% else %>
9
- <% if @voted_proposals ? @voted_proposals.include?(proposal.id) : proposal.voted_by?(current_user) %>
10
- <%= action_authorized_button_to :vote, t('.already_voted'), proposal_proposal_vote_path(proposal_id: proposal, from_proposals_list: from_proposals_list), method: :delete, remote: true, data: { disable: true }, class: "card__button button #{vote_button_classes(from_proposals_list)} success" %>
1
+ <% unless proposal.rejected? %>
2
+ <div id="proposal-<%= proposal.id %>-vote-button">
3
+ <% if !current_user %>
4
+ <% if current_settings.votes_blocked? %>
5
+ <%= action_authorized_button_to :vote, t('.votes_blocked'), proposal_proposal_vote_path(proposal_id: proposal, from_proposals_list: from_proposals_list), class: "card__button button #{vote_button_classes(from_proposals_list)} disabled", disabled: true %>
6
+ <% else %>
7
+ <%= action_authorized_button_to :vote, t('.vote'), proposal_proposal_vote_path(proposal_id: proposal, from_proposals_list: from_proposals_list), class: "card__button button #{vote_button_classes(from_proposals_list)}" %>
8
+ <% end %>
11
9
  <% else %>
12
- <% if vote_limit_enabled? && remaining_votes_count_for(current_user) == 0 %>
13
- <%= action_authorized_button_to :vote, t('.no_votes_remaining'), proposal_proposal_vote_path(proposal_id: proposal, from_proposals_list: from_proposals_list), remote: true, data: { disable: true }, class: "card__button button #{vote_button_classes(from_proposals_list)}", disabled: true %>
14
- <% elsif current_settings.votes_blocked? %>
15
- <button class="card__button button <%= vote_button_classes(from_proposals_list) %> disabled" disabled>
16
- <%= t('.votes_blocked') %>
17
- </button>
10
+ <% if @voted_proposals ? @voted_proposals.include?(proposal.id) : proposal.voted_by?(current_user) %>
11
+ <%= action_authorized_button_to :vote, t('.already_voted'), proposal_proposal_vote_path(proposal_id: proposal, from_proposals_list: from_proposals_list), method: :delete, remote: true, data: { disable: true }, class: "card__button button #{vote_button_classes(from_proposals_list)} success" %>
18
12
  <% else %>
19
- <%= action_authorized_button_to :vote, t('.vote'), proposal_proposal_vote_path(proposal_id: proposal, from_proposals_list: from_proposals_list), remote: true, data: { disable: true }, class: "card__button button #{vote_button_classes(from_proposals_list)}" %>
13
+ <% if vote_limit_enabled? && remaining_votes_count_for(current_user) == 0 %>
14
+ <%= action_authorized_button_to :vote, t('.no_votes_remaining'), proposal_proposal_vote_path(proposal_id: proposal, from_proposals_list: from_proposals_list), remote: true, data: { disable: true }, class: "card__button button #{vote_button_classes(from_proposals_list)}", disabled: true %>
15
+ <% elsif current_settings.votes_blocked? %>
16
+ <button class="card__button button <%= vote_button_classes(from_proposals_list) %> disabled" disabled>
17
+ <%= t('.votes_blocked') %>
18
+ </button>
19
+ <% else %>
20
+ <%= action_authorized_button_to :vote, t('.vote'), proposal_proposal_vote_path(proposal_id: proposal, from_proposals_list: from_proposals_list), remote: true, data: { disable: true }, class: "card__button button #{vote_button_classes(from_proposals_list)}" %>
21
+ <% end %>
20
22
  <% end %>
21
23
  <% end %>
22
- <% end %>
23
- </div>
24
+ </div>
25
+ <% end %>
@@ -21,9 +21,13 @@
21
21
  <% if current_settings.votes_enabled? || current_user %>
22
22
  <div class="card extra">
23
23
  <div class="card__content">
24
- <%= render partial: "votes_count", locals: { proposal: @proposal, from_proposals_list: false } %>
25
- <%= render partial: "vote_button", locals: { proposal: @proposal, from_proposals_list: false } %>
26
- <%= render partial: "decidim/shared/follow_button", locals: { followable: @proposal } %>
24
+ <% if current_settings.votes_enabled? %>
25
+ <%= render partial: "votes_count", locals: { proposal: @proposal, from_proposals_list: false } %>
26
+ <%= render partial: "vote_button", locals: { proposal: @proposal, from_proposals_list: false } %>
27
+ <% end %>
28
+ <% if current_user %>
29
+ <%= render partial: "decidim/shared/follow_button", locals: { followable: @proposal } %>
30
+ <% end %>
27
31
  </div>
28
32
  </div>
29
33
  <% end %>
@@ -24,7 +24,7 @@ fr:
24
24
  geocoding_enabled: Géocodage activé
25
25
  new_proposal_help_text: Nouveau texte d'aide à la proposition
26
26
  official_proposals_enabled: Propositions officielles activées
27
- proposal_answering_enabled: Réponses aux propositions activées
27
+ proposal_answering_enabled: '"Réponses aux propositions" activé'
28
28
  vote_limit: Limite de vote
29
29
  step:
30
30
  announcement: Annonce
@@ -50,10 +50,10 @@ fr:
50
50
  name: Proposition
51
51
  proposal_answers:
52
52
  edit:
53
- accepted: Retenues
53
+ accepted: Retenue
54
54
  answer_proposal: Répondre
55
55
  evaluating: En cours d'évaluation
56
- rejected: Refusé
56
+ rejected: Refusée
57
57
  title: Réponse à la proposition %{title}
58
58
  proposals:
59
59
  answer:
@@ -71,10 +71,10 @@ fr:
71
71
  create: Créer
72
72
  title: Créer une proposition
73
73
  answers:
74
- accepted: Retenue
74
+ accepted: Retenues
75
75
  evaluating: En cours d'évaluation
76
76
  not_answered: Resté sans réponse
77
- rejected: Refusé
77
+ rejected: Refusée
78
78
  create:
79
79
  error: Il y a eu des erreurs lors de la sauvegarde de la proposition.
80
80
  success: Proposition créée avec succès.
@@ -85,7 +85,7 @@ fr:
85
85
  id: ID
86
86
  official_proposal: Proposition officielle
87
87
  scope: Zone d'application
88
- state: État
88
+ state: Etat
89
89
  title: Titre
90
90
  proposal_votes:
91
91
  create:
@@ -101,19 +101,19 @@ fr:
101
101
  filters:
102
102
  accepted: Retenues
103
103
  activity: Activité
104
- all: Tous
104
+ all: Toutes
105
105
  category: Catégorie
106
106
  category_prompt: Sélectionner une catégorie
107
107
  citizenship: Citoyens
108
108
  evaluating: En cours d'évaluation
109
109
  official: Elu-e-s
110
110
  origin: Auteurs
111
- rejected: Refusé
111
+ rejected: Refusée
112
112
  related_to: Liée à
113
113
  scope_prompt: Sélectionnez une portée
114
- scopes: Zone d'application
114
+ scopes: Zones d'application
115
115
  search: Rechercher
116
- state: Etat
116
+ state: État
117
117
  voted: Votées
118
118
  filters_small_view:
119
119
  close_modal: Fermer la fenêtre de dialogue
@@ -4,7 +4,7 @@ uk:
4
4
  proposal:
5
5
  body: Основний текст
6
6
  category_id: Розділ
7
- scope_id: Обсяг
7
+ scope_id: Терен
8
8
  title: Назва
9
9
  user_group_id: Створити пропозицію як
10
10
  proposal_answer:
@@ -84,7 +84,7 @@ uk:
84
84
  category: Розділ
85
85
  id: Ідентифікатор
86
86
  official_proposal: Офіційна пропозиція
87
- scope: Обсяг
87
+ scope: Терен
88
88
  state: Стан
89
89
  title: Назва
90
90
  proposal_votes:
@@ -92,7 +92,7 @@ uk:
92
92
  error: При голосуванні пропозиції сталися помилки.
93
93
  proposals:
94
94
  author:
95
- deleted: Видалений користувач
95
+ deleted: Видалений учасник
96
96
  verified_user_group: Перевірена організація
97
97
  count:
98
98
  proposals_count:
@@ -112,8 +112,8 @@ uk:
112
112
  origin: Джерело
113
113
  rejected: Відхилено
114
114
  related_to: Пов'язане з
115
- scope_prompt: Оберіть обсяг
116
- scopes: Обсяги
115
+ scope_prompt: Оберіть терен
116
+ scopes: Терени
117
117
  search: Шукати
118
118
  state: Стан
119
119
  voted: Проголосоване
@@ -141,8 +141,7 @@ Decidim.register_feature(:proposals) do |feature|
141
141
  confirmed_at: Time.current
142
142
  )
143
143
 
144
- Decidim::Proposals::ProposalVote.create!(proposal: proposal,
145
- author: author)
144
+ Decidim::Proposals::ProposalVote.create!(proposal: proposal, author: author) unless proposal.answered? && proposal.rejected?
146
145
  end
147
146
 
148
147
  Decidim::Comments::Seed.comments_for(proposal)
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.6.1
4
+ version: 0.6.2
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-09-15 00:00:00.000000000 Z
13
+ date: 2017-09-19 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.6.1
21
+ version: 0.6.2
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.6.1
28
+ version: 0.6.2
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.6.1
35
+ version: 0.6.2
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.6.1
42
+ version: 0.6.2
43
43
  - !ruby/object:Gem::Dependency
44
44
  name: rectify
45
45
  requirement: !ruby/object:Gem::Requirement
@@ -88,84 +88,84 @@ dependencies:
88
88
  requirements:
89
89
  - - '='
90
90
  - !ruby/object:Gem::Version
91
- version: 0.6.1
91
+ version: 0.6.2
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.6.1
98
+ version: 0.6.2
99
99
  - !ruby/object:Gem::Dependency
100
100
  name: decidim-admin
101
101
  requirement: !ruby/object:Gem::Requirement
102
102
  requirements:
103
103
  - - '='
104
104
  - !ruby/object:Gem::Version
105
- version: 0.6.1
105
+ version: 0.6.2
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.6.1
112
+ version: 0.6.2
113
113
  - !ruby/object:Gem::Dependency
114
114
  name: decidim-participatory_processes
115
115
  requirement: !ruby/object:Gem::Requirement
116
116
  requirements:
117
117
  - - '='
118
118
  - !ruby/object:Gem::Version
119
- version: 0.6.1
119
+ version: 0.6.2
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.6.1
126
+ version: 0.6.2
127
127
  - !ruby/object:Gem::Dependency
128
128
  name: decidim-meetings
129
129
  requirement: !ruby/object:Gem::Requirement
130
130
  requirements:
131
131
  - - '='
132
132
  - !ruby/object:Gem::Version
133
- version: 0.6.1
133
+ version: 0.6.2
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.6.1
140
+ version: 0.6.2
141
141
  - !ruby/object:Gem::Dependency
142
142
  name: decidim-results
143
143
  requirement: !ruby/object:Gem::Requirement
144
144
  requirements:
145
145
  - - '='
146
146
  - !ruby/object:Gem::Version
147
- version: 0.6.1
147
+ version: 0.6.2
148
148
  type: :development
149
149
  prerelease: false
150
150
  version_requirements: !ruby/object:Gem::Requirement
151
151
  requirements:
152
152
  - - '='
153
153
  - !ruby/object:Gem::Version
154
- version: 0.6.1
154
+ version: 0.6.2
155
155
  - !ruby/object:Gem::Dependency
156
156
  name: decidim-budgets
157
157
  requirement: !ruby/object:Gem::Requirement
158
158
  requirements:
159
159
  - - '='
160
160
  - !ruby/object:Gem::Version
161
- version: 0.6.1
161
+ version: 0.6.2
162
162
  type: :development
163
163
  prerelease: false
164
164
  version_requirements: !ruby/object:Gem::Requirement
165
165
  requirements:
166
166
  - - '='
167
167
  - !ruby/object:Gem::Version
168
- version: 0.6.1
168
+ version: 0.6.2
169
169
  description: A proposals component for decidim's participatory processes.
170
170
  email:
171
171
  - josepjaume@gmail.com