decidim-anonymous_proposals 0.24.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/LICENSE-AGPLv3.txt +661 -0
- data/README.md +55 -0
- data/Rakefile +9 -0
- data/app/assets/config/decidim_anonymous_proposals_manifest.js +0 -0
- data/app/assets/images/decidim/anonymous_proposals/icon.svg +1 -0
- data/app/commands/decidim/anonymous_proposals/create_proposal_command_overrides.rb +31 -0
- data/app/commands/decidim/anonymous_proposals/publish_proposal_command_overrides.rb +26 -0
- data/app/commands/decidim/anonymous_proposals/update_proposal_command_overrides.rb +32 -0
- data/app/controllers/decidim/anonymous_proposals/admin/application_controller.rb +12 -0
- data/app/controllers/decidim/anonymous_proposals/proposals_controller_additions.rb +24 -0
- data/app/controllers/decidim/anonymous_proposals/proposals_controller_overrides.rb +19 -0
- data/app/helpers/decidim/anonymous_proposals/application_helper.rb +10 -0
- data/app/models/concerns/decidim/anonymous_proposals/has_anonymous.rb +13 -0
- data/app/models/decidim/anonymous_proposals/application_record.rb +10 -0
- data/app/overrides/decidim/proposals/proposals/_wizard_header/contextual_info.html.erb.deface +4 -0
- data/app/overrides/decidim/proposals/proposals/index/contextual_info.html.erb.deface +2 -0
- data/app/overrides/decidim/proposals/proposals/index/new_anonymous_proposal.html.erb.deface +2 -0
- data/app/permissions/decidim/anonymous_proposals/permissions_overrides.rb +43 -0
- data/app/queries/decidim/anonymous_proposals/manageable_user_groups_overrides.rb +19 -0
- data/app/views/decidim/anonymous_proposals/shared/_anonymous_proposals_announcement.html.erb +10 -0
- data/app/views/decidim/anonymous_proposals/shared/_anonymous_proposals_new_announcement.html.erb +10 -0
- data/config/i18n-tasks.yml +10 -0
- data/config/locales/de.yml +30 -0
- data/config/locales/en.yml +31 -0
- data/config/locales/es.yml +30 -0
- data/config/locales/eu.yml +30 -0
- data/lib/decidim/anonymous_proposals/admin.rb +10 -0
- data/lib/decidim/anonymous_proposals/admin_engine.rb +27 -0
- data/lib/decidim/anonymous_proposals/engine.rb +62 -0
- data/lib/decidim/anonymous_proposals/test/factories.rb +13 -0
- data/lib/decidim/anonymous_proposals/version.rb +14 -0
- data/lib/decidim/anonymous_proposals.rb +11 -0
- data/lib/tasks/anonymous_proposals.rake +21 -0
- metadata +105 -0
data/README.md
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
# Decidim::AnonymousProposals
|
2
|
+
|
3
|
+
Transform proposals component to allow not signed in users creation of
|
4
|
+
proposals. For this the proposals created anonymously will be linked with
|
5
|
+
a special anonymous users group. There is a task to create/update anonymous
|
6
|
+
groups in organizations explained in Installation section.
|
7
|
+
|
8
|
+
The creation of anonymous proposals can be disabled for each proposals
|
9
|
+
component individually. Once you have installed this module and added an
|
10
|
+
anonymous group, anonymous proposals will be enabled by default on all
|
11
|
+
proposal components.
|
12
|
+
|
13
|
+
## Installation
|
14
|
+
|
15
|
+
Add this line to your application's Gemfile:
|
16
|
+
|
17
|
+
For Decidim 0.24:
|
18
|
+
```ruby
|
19
|
+
gem "decidim-anonymous_proposals", git: "https://github.com/PopulateTools/decidim-module-anonymous_proposals", branch: "release/0.24-stable"
|
20
|
+
|
21
|
+
```
|
22
|
+
|
23
|
+
And then execute:
|
24
|
+
|
25
|
+
```bash
|
26
|
+
bundle
|
27
|
+
```
|
28
|
+
|
29
|
+
To have the functionality available there must be at least one anonymous user group.
|
30
|
+
An anonymous user group is a user group with `{ anonymous: true }` present in the
|
31
|
+
`extended_data` attribute. There is a task to create automatically or update the
|
32
|
+
first anonymous group of organizations (or a specific organization if its id is
|
33
|
+
provided).
|
34
|
+
|
35
|
+
The task accepts the following arguments:
|
36
|
+
|
37
|
+
1. Name of the group (default: "Anonymous")
|
38
|
+
2. Nickname of the group (default: "anonymous")
|
39
|
+
3. Email of the group (default: "anonymous@example.org")
|
40
|
+
4. organization_id. This argument is optional, if not provided a group is generated
|
41
|
+
with the previous configurations for each organization
|
42
|
+
|
43
|
+
Example of use:
|
44
|
+
|
45
|
+
```bash
|
46
|
+
rake decidim_anonymous_proposals:generate_anonymous_group["Aportaciones anónimas",anonima,anonymous@example.org]
|
47
|
+
```
|
48
|
+
|
49
|
+
## Contributing
|
50
|
+
|
51
|
+
See [Decidim](https://github.com/decidim/decidim).
|
52
|
+
|
53
|
+
## License
|
54
|
+
|
55
|
+
This engine is distributed under the GNU AFFERO GENERAL PUBLIC LICENSE.
|
data/Rakefile
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "decidim/dev/common_rake"
|
4
|
+
|
5
|
+
desc "Generates a dummy app for testing"
|
6
|
+
task test_app: "decidim:generate_external_test_app"
|
7
|
+
|
8
|
+
desc "Generates a development app."
|
9
|
+
task development_app: "decidim:generate_external_development_app"
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 35 35"><path d="M17.5 35A17.5 17.5 0 1 1 35 17.5 17.52 17.52 0 0 1 17.5 35zm0-33.06A15.56 15.56 0 1 0 33.06 17.5 15.57 15.57 0 0 0 17.5 1.94zm9.5 13.7H8a1 1 0 0 1 0-1.94h19a1 1 0 0 1 0 1.94zm0 3.68H8a1 1 0 0 1 0-1.94h19a1 1 0 0 1 0 1.94zM22.26 23H8a1 1 0 0 1 0-1.94h14.26a1 1 0 0 1 0 1.94z"/></svg>
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module AnonymousProposals
|
5
|
+
# Method overrides to avoid errors when current_user is not present
|
6
|
+
module CreateProposalCommandOverrides
|
7
|
+
extend ActiveSupport::Concern
|
8
|
+
|
9
|
+
def initialize(form, current_user, coauthorships = nil)
|
10
|
+
@form = form
|
11
|
+
@current_user = current_user
|
12
|
+
@current_user ||= anonymous_group if allow_anonymous_proposals?
|
13
|
+
@coauthorships = coauthorships
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
def anonymous_group
|
19
|
+
Decidim::UserGroup.where(organization: organization).anonymous.first
|
20
|
+
end
|
21
|
+
|
22
|
+
def allow_anonymous_proposals?
|
23
|
+
form.current_component.settings.anonymous_proposals_enabled?
|
24
|
+
end
|
25
|
+
|
26
|
+
def organization
|
27
|
+
@organization ||= form.current_organization
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module AnonymousProposals
|
5
|
+
# Method overrides to avoid errors when current_user is not present
|
6
|
+
module PublishProposalCommandOverrides
|
7
|
+
extend ActiveSupport::Concern
|
8
|
+
|
9
|
+
def initialize(proposal, current_user)
|
10
|
+
@proposal = proposal
|
11
|
+
@current_user = current_user
|
12
|
+
@current_user ||= anonymous_group if allow_anonymous_proposals?
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
def anonymous_group
|
18
|
+
Decidim::UserGroup.where(organization: @proposal.organization).anonymous.first
|
19
|
+
end
|
20
|
+
|
21
|
+
def allow_anonymous_proposals?
|
22
|
+
@proposal.component.settings.anonymous_proposals_enabled?
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module AnonymousProposals
|
5
|
+
# Method overrides to avoid errors when current_user is not present
|
6
|
+
module UpdateProposalCommandOverrides
|
7
|
+
extend ActiveSupport::Concern
|
8
|
+
|
9
|
+
def initialize(form, current_user, proposal)
|
10
|
+
@form = form
|
11
|
+
@current_user = current_user
|
12
|
+
@current_user ||= anonymous_group if allow_anonymous_proposals?
|
13
|
+
@proposal = proposal
|
14
|
+
@attached_to = proposal
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
def anonymous_group
|
20
|
+
Decidim::UserGroup.where(organization: organization).anonymous.first
|
21
|
+
end
|
22
|
+
|
23
|
+
def allow_anonymous_proposals?
|
24
|
+
form.current_component.settings.anonymous_proposals_enabled?
|
25
|
+
end
|
26
|
+
|
27
|
+
def organization
|
28
|
+
@organization ||= form.current_organization
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module AnonymousProposals
|
5
|
+
module Admin
|
6
|
+
# This controller is the abstract class from which all other controllers of
|
7
|
+
# this engine inherit.
|
8
|
+
class ApplicationController < Decidim::Admin::ApplicationController
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module AnonymousProposals
|
5
|
+
# Additions to disable filters
|
6
|
+
module ProposalsControllerAdditions
|
7
|
+
extend ActiveSupport::Concern
|
8
|
+
|
9
|
+
included do
|
10
|
+
skip_before_action :authenticate_user!, if: :allow_anonymous_proposals?
|
11
|
+
end
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
def allow_anonymous_proposals?
|
16
|
+
anonymous_group_present? && component_settings.anonymous_proposals_enabled?
|
17
|
+
end
|
18
|
+
|
19
|
+
def anonymous_group_present?
|
20
|
+
Decidim::UserGroup.where(organization: current_organization).anonymous.exists?
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module AnonymousProposals
|
5
|
+
# Method overrides to avoid errors when current_user is not present
|
6
|
+
module ProposalsControllerOverrides
|
7
|
+
extend ActiveSupport::Concern
|
8
|
+
|
9
|
+
private
|
10
|
+
|
11
|
+
def proposal_draft
|
12
|
+
return unless signed_in?
|
13
|
+
|
14
|
+
Decidim::Proposals::Proposal.from_all_author_identities(current_user).not_hidden.only_amendables
|
15
|
+
.where(component: current_component).find_by(published_at: nil)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module AnonymousProposals
|
5
|
+
# Method overrides to avoid errors when current_user is not present
|
6
|
+
module PermissionsOverrides
|
7
|
+
extend ActiveSupport::Concern
|
8
|
+
|
9
|
+
def permissions
|
10
|
+
return permission_action unless user_or_anonymous_action?(permission_action)
|
11
|
+
|
12
|
+
# Delegate the admin permission checks to the admin permissions class
|
13
|
+
return Decidim::Proposals::Admin::Permissions.new(user, permission_action, context).permissions if permission_action.scope == :admin
|
14
|
+
return permission_action if permission_action.scope != :public
|
15
|
+
|
16
|
+
case permission_action.subject
|
17
|
+
when :proposal
|
18
|
+
apply_proposal_permissions(permission_action)
|
19
|
+
when :collaborative_draft
|
20
|
+
apply_collaborative_draft_permissions(permission_action)
|
21
|
+
else
|
22
|
+
permission_action
|
23
|
+
end
|
24
|
+
|
25
|
+
permission_action
|
26
|
+
end
|
27
|
+
|
28
|
+
private
|
29
|
+
|
30
|
+
def user_or_anonymous_action?(permission_action)
|
31
|
+
user || [:create, :edit].include?(permission_action.action) && allow_anonymous_proposals?
|
32
|
+
end
|
33
|
+
|
34
|
+
def allow_anonymous_proposals?
|
35
|
+
Decidim::UserGroup.where(organization: organization).anonymous.exists? && component_settings.anonymous_proposals_enabled?
|
36
|
+
end
|
37
|
+
|
38
|
+
def organization
|
39
|
+
@organization ||= context.fetch(:organization, nil) || context.fetch(:current_organization, nil)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module AnonymousProposals
|
5
|
+
# Additions to disable filters
|
6
|
+
module ManageableUserGroupsOverrides
|
7
|
+
extend ActiveSupport::Concern
|
8
|
+
|
9
|
+
def query
|
10
|
+
return Decidim::UserGroup.none if user.blank?
|
11
|
+
|
12
|
+
user
|
13
|
+
.user_groups
|
14
|
+
.includes(:memberships)
|
15
|
+
.where(decidim_user_group_memberships: { role: %w(admin creator) })
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
<% if current_settings.creation_enabled && !user_signed_in? && component_settings.anonymous_proposals_enabled? %>
|
2
|
+
<%= cell(
|
3
|
+
"decidim/announcement",
|
4
|
+
I18n.locale => t(
|
5
|
+
".text_html",
|
6
|
+
registration_link: link_to(t("register", scope: "decidim.anonymous_proposals"), decidim.new_user_registration_path, target: "_blank", class: "external-link-container"),
|
7
|
+
new_session_link: link_to(t("new_session", scope: "decidim.anonymous_proposals"), decidim.new_user_session_path, target: "_blank", class: "external-link-container")
|
8
|
+
)
|
9
|
+
) %>
|
10
|
+
<% end %>
|
data/app/views/decidim/anonymous_proposals/shared/_anonymous_proposals_new_announcement.html.erb
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
<% unless user_signed_in? %>
|
2
|
+
<%= cell(
|
3
|
+
"decidim/announcement",
|
4
|
+
I18n.locale => t(
|
5
|
+
".text_html",
|
6
|
+
registration_link: link_to(t("register", scope: "decidim.anonymous_proposals"), decidim.new_user_registration_path, target: "_blank", class: "external-link-container"),
|
7
|
+
new_session_link: link_to(t("new_session", scope: "decidim.anonymous_proposals"), decidim.new_user_session_path, target: "_blank", class: "external-link-container")
|
8
|
+
)
|
9
|
+
) %>
|
10
|
+
<% end %>
|
@@ -0,0 +1,30 @@
|
|
1
|
+
---
|
2
|
+
de:
|
3
|
+
decidim:
|
4
|
+
anonymous_proposals:
|
5
|
+
new_session: loggen Sie sich ein
|
6
|
+
register: Registrieren Sie sich
|
7
|
+
shared:
|
8
|
+
anonymous_proposals_announcement:
|
9
|
+
text_html: "<p><strong> %{registration_link} oder %{new_session_link} damit Sie
|
10
|
+
keine Neuigkeiten des Prozesses verpassen</strong>. Wenn Sie Ihren Vorschlag
|
11
|
+
als registrierten Benutzer veröffentlichen, können Sie anderen Teilnehmern folgen,
|
12
|
+
mit ihnen interagieren, bei allen Vorschlägen kommentieren, am
|
13
|
+
Meinungsaustausch teilnehmen und Ihre Unterstützung für Vorschläge zeigen.
|
14
|
+
Sie können auch entscheiden, ob Sie Benachrichtigungen empfangen wollen wenn
|
15
|
+
jemand ihren Vorschlag unterstützt oder kommentiert. Zusätzlich haben Sie die
|
16
|
+
Möglichkeit, einen Newsletter mit allen Updates zu bekommen.</p> <p><em>“Aber
|
17
|
+
ich möchte nicht dass mein Name erkannt wird”</em>:
|
18
|
+
In diesem Fall können Sie sich mit einem Decknamen registrieren, unter dem Sie
|
19
|
+
Ihren Vorschlag veröffentlichen. So können Sie dennoch alle Vorteile einer
|
20
|
+
Registrierung auf der Plattform geniessen.</p>"
|
21
|
+
anonymous_proposals_new_announcement:
|
22
|
+
text_html: "<p>Möchten Sie dass andere Teilnehmer ihnen folgen und auf Ihren
|
23
|
+
Vorschlag kommentieren? <strong>%{registration_link} oder %{new_session_link}</strong>.</p>"
|
24
|
+
components:
|
25
|
+
anonymous_proposals:
|
26
|
+
name: AnonymousProposals
|
27
|
+
proposals:
|
28
|
+
settings:
|
29
|
+
global:
|
30
|
+
anonymous_proposals_enabled: Anonyme Benutzer können Vorschläge erstellen
|
@@ -0,0 +1,31 @@
|
|
1
|
+
---
|
2
|
+
en:
|
3
|
+
decidim:
|
4
|
+
anonymous_proposals:
|
5
|
+
new_session: sign in
|
6
|
+
register: Register
|
7
|
+
shared:
|
8
|
+
anonymous_proposals_announcement:
|
9
|
+
text_html: "<p><strong> %{registration_link} or %{new_session_link} on the
|
10
|
+
platform to not miss any news of the participatory process</strong>. If
|
11
|
+
you publish your proposal as registered user, you will be able to follow
|
12
|
+
other participants and interact with them, comment and participate in
|
13
|
+
the exchange of opinions of each proposal, and show your support or interest
|
14
|
+
by adhering to the proposals that you consider. You can also decide whether
|
15
|
+
to receive notifications every time someone supports or comments on your
|
16
|
+
proposal. In addition, you will have the option of receiving a newsletter
|
17
|
+
with all the updates.</p> <p><em>“But I don't want my name to be recognized”</em>:
|
18
|
+
In this case, you can register with an anonymous identity with which to
|
19
|
+
publish your proposal and with all the advantages of being registered
|
20
|
+
on the platform.</p>"
|
21
|
+
anonymous_proposals_new_announcement:
|
22
|
+
text_html: "<p>Do you want other participants to follow you and comment
|
23
|
+
on your proposal?<strong> %{registration_link} or %{new_session_link}
|
24
|
+
on the platform</strong>.</p>"
|
25
|
+
components:
|
26
|
+
anonymous_proposals:
|
27
|
+
name: AnonymousProposals
|
28
|
+
proposals:
|
29
|
+
settings:
|
30
|
+
global:
|
31
|
+
anonymous_proposals_enabled: Allow anonymous users to create proposals
|
@@ -0,0 +1,30 @@
|
|
1
|
+
---
|
2
|
+
es:
|
3
|
+
decidim:
|
4
|
+
anonymous_proposals:
|
5
|
+
new_session: inicia sesión
|
6
|
+
register: Regístrate
|
7
|
+
shared:
|
8
|
+
anonymous_proposals_announcement:
|
9
|
+
text_html: "<p><strong>%{registration_link} o %{new_session_link} en la
|
10
|
+
plataforma para no perderte ninguna novedad del proceso participativo</strong>.
|
11
|
+
Si publicas tu propuesta estando registrado podrás seguir a otros participantes
|
12
|
+
e interactuar con ellos, comentar y participar en los intercambios de
|
13
|
+
opiniones de cada propuesta, y mostrar tu apoyo o interés adhiriéndote
|
14
|
+
a las propuestas que consideres. También podrás decidir si recibir avisos
|
15
|
+
cada vez que alguien apoye o comente tu propuesta. Además, tendrás la
|
16
|
+
opción de recibir una newsletter con todas las actualizaciones.</p> <p><em>“Pero
|
17
|
+
no quiero que se reconozca mi nombre”</em>: En ese caso, puedes registrarte
|
18
|
+
con una identidad anónima con la que publicar tu propuesta y con todas
|
19
|
+
las ventajas de estar registrado en la plataforma.</p>"
|
20
|
+
anonymous_proposals_new_announcement:
|
21
|
+
text_html: "<p>¿Quieres que otros participantes puedan seguirte y comentar
|
22
|
+
tu propuesta? <strong>%{registration_link} o %{new_session_link} en la
|
23
|
+
plataforma</strong>.</p>"
|
24
|
+
components:
|
25
|
+
anonymous_proposals:
|
26
|
+
name: AnonymousProposals
|
27
|
+
proposals:
|
28
|
+
settings:
|
29
|
+
global:
|
30
|
+
anonymous_proposals_enabled: Permitir la creación de propuestas a usuarios anónimos
|
@@ -0,0 +1,30 @@
|
|
1
|
+
---
|
2
|
+
eu:
|
3
|
+
decidim:
|
4
|
+
anonymous_proposals:
|
5
|
+
new_session: saioa hasi
|
6
|
+
register: Erregistratu
|
7
|
+
shared:
|
8
|
+
anonymous_proposals_announcement:
|
9
|
+
text_html: "<p><strong>%{registration_link} edo plataforman %{new_session_link}
|
10
|
+
prozesu partizipatiboari buruz sarrera berririk ez galtzeko</strong>.
|
11
|
+
Behin izena emanda, zure proposamena egitean beste partehartzaileak jarraitu
|
12
|
+
ahal izango dituzu eta haiekin elkarri eragin. Gainera, proposamen bakoitzari
|
13
|
+
buruz zure iritzia partekatu dezakezu, eta zure interesekoak diren proposamenak
|
14
|
+
babestu. Horrez gain, zure proposamena komentariorik edo babesik jasotzekotan
|
15
|
+
ohartarazpenak bidaltzeko aukera daukazu. Bestalde, newsletter bat jasotzeko
|
16
|
+
aukera izango duzu eguneratze guztiekin.</p> <p><em>“PBaina ez dut nire
|
17
|
+
izena ezagutaraztea nahi”</em>: Kasu horretan, identitate anonimo batekin
|
18
|
+
izena eman dezakezu eta zure proposamena horrela aurkeztu, plataformako
|
19
|
+
abantaila guztiak aprobetxatuz.</p>"
|
20
|
+
anonymous_proposals_new_announcement:
|
21
|
+
text_html: "<p>Nahi duzu beste parte-hartzaile batzuek zuri jarraitzea eta
|
22
|
+
zure proposamena komentatzea? <strong>%{registration_link} edo %{new_session_link}
|
23
|
+
plataforman</strong>.</p>"
|
24
|
+
components:
|
25
|
+
anonymous_proposals:
|
26
|
+
name: AnonymousProposals
|
27
|
+
proposals:
|
28
|
+
settings:
|
29
|
+
global:
|
30
|
+
anonymous_proposals_enabled: Erabiltzaile anonimoei proposamenak sortzea baimendu
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module AnonymousProposals
|
5
|
+
# This is the engine that runs on the public interface of `AnonymousProposals`.
|
6
|
+
class AdminEngine < ::Rails::Engine
|
7
|
+
isolate_namespace Decidim::AnonymousProposals::Admin
|
8
|
+
|
9
|
+
paths["db/migrate"] = nil
|
10
|
+
paths["lib/tasks"] = nil
|
11
|
+
|
12
|
+
routes do
|
13
|
+
# Add admin engine routes here
|
14
|
+
# resources :anonymous_proposals do
|
15
|
+
# collection do
|
16
|
+
# resources :exports, only: [:create]
|
17
|
+
# end
|
18
|
+
# end
|
19
|
+
# root to: "anonymous_proposals#index"
|
20
|
+
end
|
21
|
+
|
22
|
+
def load_seed
|
23
|
+
nil
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "rails"
|
4
|
+
require "decidim/core"
|
5
|
+
require "deface"
|
6
|
+
|
7
|
+
module Decidim
|
8
|
+
module AnonymousProposals
|
9
|
+
# This is the engine that runs on the public interface of anonymous_proposals.
|
10
|
+
class Engine < ::Rails::Engine
|
11
|
+
isolate_namespace Decidim::AnonymousProposals
|
12
|
+
|
13
|
+
routes do
|
14
|
+
# Add engine routes here
|
15
|
+
# resources :anonymous_proposals
|
16
|
+
# root to: "anonymous_proposals#index"
|
17
|
+
end
|
18
|
+
|
19
|
+
initializer "decidim_anonymous_proposals.proposal_component_settings" do
|
20
|
+
component = Decidim.find_component_manifest(:proposals)
|
21
|
+
component.settings(:global) do |settings|
|
22
|
+
settings.attribute :anonymous_proposals_enabled, type: :boolean, default: true
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
initializer "decidim_anonymous_proposals.assets" do |app|
|
27
|
+
app.config.assets.precompile += %w(decidim_anonymous_proposals_manifest.js decidim_anonymous_proposals_manifest.css)
|
28
|
+
end
|
29
|
+
|
30
|
+
initializer "decidim_anonymous_proposals.proposals_additions" do
|
31
|
+
Decidim::UserGroup.class_eval do
|
32
|
+
include Decidim::AnonymousProposals::HasAnonymous
|
33
|
+
end
|
34
|
+
|
35
|
+
Decidim::Proposals::Permissions.class_eval do
|
36
|
+
prepend Decidim::AnonymousProposals::PermissionsOverrides
|
37
|
+
end
|
38
|
+
|
39
|
+
Decidim::Proposals::ProposalsController.class_eval do
|
40
|
+
prepend Decidim::AnonymousProposals::ProposalsControllerOverrides
|
41
|
+
include Decidim::AnonymousProposals::ProposalsControllerAdditions
|
42
|
+
end
|
43
|
+
|
44
|
+
Decidim::UserGroups::ManageableUserGroups.class_eval do
|
45
|
+
prepend Decidim::AnonymousProposals::ManageableUserGroupsOverrides
|
46
|
+
end
|
47
|
+
|
48
|
+
Decidim::Proposals::CreateProposal.class_eval do
|
49
|
+
prepend Decidim::AnonymousProposals::CreateProposalCommandOverrides
|
50
|
+
end
|
51
|
+
|
52
|
+
Decidim::Proposals::UpdateProposal.class_eval do
|
53
|
+
prepend Decidim::AnonymousProposals::UpdateProposalCommandOverrides
|
54
|
+
end
|
55
|
+
|
56
|
+
Decidim::Proposals::PublishProposal.class_eval do
|
57
|
+
prepend Decidim::AnonymousProposals::PublishProposalCommandOverrides
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "decidim/core/test/factories"
|
4
|
+
|
5
|
+
FactoryBot.define do
|
6
|
+
factory :anonymous_proposals_component, parent: :component do
|
7
|
+
name { Decidim::Components::Namer.new(participatory_space.organization.available_locales, :anonymous_proposals).i18n_name }
|
8
|
+
manifest_name :anonymous_proposals
|
9
|
+
participatory_space { create(:participatory_process, :with_steps) }
|
10
|
+
end
|
11
|
+
|
12
|
+
# Add engine factories here
|
13
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "decidim/anonymous_proposals/admin"
|
4
|
+
require "decidim/anonymous_proposals/engine"
|
5
|
+
require "decidim/anonymous_proposals/admin_engine"
|
6
|
+
|
7
|
+
module Decidim
|
8
|
+
# This namespace holds the logic of the `AnonymousProposals` module
|
9
|
+
module AnonymousProposals
|
10
|
+
end
|
11
|
+
end
|