decidim-external_newsletter 0.1.0
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 +124 -0
- data/Rakefile +81 -0
- data/app/controllers/decidim/external_newsletter/admin/application_controller.rb +15 -0
- data/app/controllers/decidim/external_newsletter/application_controller.rb +13 -0
- data/app/helpers/decidim/external_newsletter/application_helper.rb +11 -0
- data/app/models/decidim/external_newsletter/application_record.rb +10 -0
- data/app/packs/entrypoints/decidim-exernal_newsletter.js +2 -0
- data/app/packs/images/decidim/external_newsletter/icon.svg +1 -0
- data/app/packs/src/external_newsletter/remove_newsletter_modal.js.es6 +1 -0
- data/app/packs/stylesheets/decidim/external_newsletter/components/_inline-form-footer.scss +3 -0
- data/app/packs/stylesheets/decidim/external_newsletter/external_newsletter.scss +4 -0
- data/app/views/decidim/devise/invitations/edit.html.erb +67 -0
- data/app/views/decidim/devise/registrations/new.html.erb +96 -0
- data/app/views/decidim/notifications_settings/show.html.erb +76 -0
- data/app/views/decidim/notifications_settings/show.html.erb.026 +53 -0
- data/app/views/layouts/decidim/_external_newsletter.html.erb +56 -0
- data/app/views/layouts/decidim/_main_footer.html.erb +32 -0
- data/config/i18n-tasks.yml +10 -0
- data/config/locales/en.yml +8 -0
- data/config/locales/fr.yml +8 -0
- data/lib/decidim/external_newsletter/admin.rb +10 -0
- data/lib/decidim/external_newsletter/admin_engine.rb +29 -0
- data/lib/decidim/external_newsletter/engine.rb +23 -0
- data/lib/decidim/external_newsletter/test/factories.rb +9 -0
- data/lib/decidim/external_newsletter/version.rb +14 -0
- data/lib/decidim/external_newsletter.rb +12 -0
- metadata +91 -0
data/README.md
ADDED
@@ -0,0 +1,124 @@
|
|
1
|
+
<h1 align="center"><img src="https://github.com/octree-gva/meta/blob/main/decidim/static/header.png?raw=true" alt="Decidim - Octree Participatory democracy on a robust and open source solution" /></h1>
|
2
|
+
<h4 align="center">
|
3
|
+
<a href="https://www.octree.ch">Octree</a> |
|
4
|
+
<a href="https://octree.ch/en/contact-us/">Contact Us</a> |
|
5
|
+
<a href="https://blog.octree.ch">Our Blog (FR)</a><br/><br/>
|
6
|
+
<a href="https://decidim.org">Decidim</a> |
|
7
|
+
<a href="https://docs.decidim.org/en/">Decidim Docs</a> |
|
8
|
+
<a href="https://meta.decidim.org">Participatory Governance (meta decidim)</a><br/><br/>
|
9
|
+
<a href="https://matrix.to/#/+decidim:matrix.org">Decidim Community (Matrix+Element.io)</a>
|
10
|
+
</h4>
|
11
|
+
<p align="center">
|
12
|
+
<a href="https://participer.lausanne.ch">
|
13
|
+
<img
|
14
|
+
src="https://github.com/octree-gva/meta/blob/main/decidim/static/participer_lausanne/chip.png?raw=true"
|
15
|
+
alt="Lausanne Participe — Une plateforme de participation pour imaginer et réaliser ensemble" />
|
16
|
+
</a>
|
17
|
+
<a href="https://opencollective.com/voca">
|
18
|
+
<img
|
19
|
+
src="https://github.com/octree-gva/meta/blob/main/decidim/static/opencollective_chip.png?raw=true"
|
20
|
+
alt="Voca – Open-Source SaaS platform for Decidim" />
|
21
|
+
</a>
|
22
|
+
</p>
|
23
|
+
|
24
|
+
|
25
|
+
# Decidim: Use External Newsletter
|
26
|
+
|
27
|
+
This module removes newsletters from Decidim, to use external newsletters, sponsored by the [Lausanne Participe](https://participer.lausanne.ch) platform.
|
28
|
+
|
29
|
+
## Why it's needed?
|
30
|
+
Participation is wide, and can use many digital tools. To have a broader newsletter, that includes the whole participation space of the city we need:
|
31
|
+
|
32
|
+
- Subscribers to the newsletters don't need an account to subscribe, just an email
|
33
|
+
- The newsletter sending need to be managed by a restricted group of persons.
|
34
|
+
- The form to register to the newsletter needs to be included in every digital spaces involving participation.
|
35
|
+
|
36
|
+
## Usage
|
37
|
+
|
38
|
+
This gem removes functionnalities, and add very little to the instance.
|
39
|
+
The database is not afftected, but we give some Rake Tasks to comply to RGPD and clean previously installed Decidim.
|
40
|
+
|
41
|
+
## Installation
|
42
|
+
|
43
|
+
Add this line to your application's Gemfile:
|
44
|
+
|
45
|
+
```ruby
|
46
|
+
gem "decidim-external_newsletter"
|
47
|
+
```
|
48
|
+
|
49
|
+
And then execute:
|
50
|
+
|
51
|
+
```bash
|
52
|
+
bundle
|
53
|
+
```
|
54
|
+
|
55
|
+
## Testing
|
56
|
+
```
|
57
|
+
bundle exec rake test_app
|
58
|
+
```
|
59
|
+
|
60
|
+
## Local development
|
61
|
+
First, you need to run an empty database with a decidim dev container which runs nothing.
|
62
|
+
```
|
63
|
+
docker-compose down -v --remove-orphans
|
64
|
+
docker-compose up -d
|
65
|
+
```
|
66
|
+
Once created, you access the decidim container
|
67
|
+
```
|
68
|
+
# Get the id of the decidim dev container
|
69
|
+
docker ps --format {{.ID}} --filter=label=org.label-schema.name=dec
|
70
|
+
idim
|
71
|
+
# f16bd5314386
|
72
|
+
docker exec -it f16bd5314386 bash
|
73
|
+
```
|
74
|
+
You are now in bash, run manually `docker-entrypoint`.
|
75
|
+
```
|
76
|
+
# Will check your environment and do migrations if needed
|
77
|
+
docker-entrypoint
|
78
|
+
```
|
79
|
+
You are now ready to use your container in the way you want for development:
|
80
|
+
|
81
|
+
* Run a rails server: `bundle exec rails s -b 0.0.0.0`
|
82
|
+
* Have live-reload on your assets: `bin/webpack-dev-server`
|
83
|
+
* Execute tasks, like `bundle exec rails g migration AddSomeColumn`
|
84
|
+
* etc.
|
85
|
+
```
|
86
|
+
bundle exec rails s -b 0.0.0.0 # rails server
|
87
|
+
bin/webpack-dev-server
|
88
|
+
etc.
|
89
|
+
```
|
90
|
+
|
91
|
+
To stop everything, uses:
|
92
|
+
- `docker-compose down` to stop the containers
|
93
|
+
- `docker-compose down -v` to stop the containers and remove all previously saved data.
|
94
|
+
|
95
|
+
### Debugging
|
96
|
+
To debug something on the container:
|
97
|
+
1. Ensure `decidim-app` is running
|
98
|
+
```bash
|
99
|
+
docker ps --all
|
100
|
+
# CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
101
|
+
# 511c5048485c decidim-module-external_newsletter-decidim-app "sleep infinity" 28 minutes ago Up 28 minutes 0.0.0.0:3000->3000/tcp, :::3000->3000/tcp, 0.0.0.0:3035->3035/tcp, :::3035->3035/tcp decidim-external_newsletter-app
|
102
|
+
# a08934c17b68 postgres:14-alpine "docker-entrypoint.s…" 28 minutes ago Up 28 minutes (healthy) 0.0.0.0:5432->5432/tcp, :::5432->5432/tcp decidim-module-external_newsletter-pg-1
|
103
|
+
|
104
|
+
```
|
105
|
+
|
106
|
+
2. Run `docker exec -it decidim-app bash`
|
107
|
+
3. Run
|
108
|
+
- `tail -f $ROOT/log/development.log` to **access logs**
|
109
|
+
- `bundle exec rails restart` to **restart rails server AND keeps webpacker running**
|
110
|
+
- `cd $ROOT` to access the `development_app`
|
111
|
+
- `cd $ROOT/../decidim_module_external_newsletter` to access the module directory
|
112
|
+
|
113
|
+
## Contributing
|
114
|
+
|
115
|
+
See [Decidim](https://github.com/decidim/decidim).
|
116
|
+
|
117
|
+
## License
|
118
|
+
|
119
|
+
This engine is distributed under the [GNU AFFERO GENERAL PUBLIC LICENSE](LICENSE-AGPLv3.txt)
|
120
|
+
|
121
|
+
<br /><br />
|
122
|
+
<p align="center">
|
123
|
+
<img src="https://raw.githubusercontent.com/octree-gva/meta/main/decidim/static/octree_and_decidim.png" height="90" alt="Decidim Installation by Octree" />
|
124
|
+
</p>
|
data/Rakefile
ADDED
@@ -0,0 +1,81 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "decidim/dev/common_rake"
|
4
|
+
|
5
|
+
def install_module(path)
|
6
|
+
Dir.chdir(path) do
|
7
|
+
# system("bundle exec rake decidim_vocacity_gem_tasks:install:migrations")
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
def seed_db(path)
|
12
|
+
Dir.chdir(path) do
|
13
|
+
system("bundle exec rake db:seed")
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
desc "Prepare for testing"
|
18
|
+
task :prepare_tests do
|
19
|
+
# Remove previous existing db, and recreate one.
|
20
|
+
disable_docker_compose = ENV.fetch("DISABLED_DOCKER_COMPOSE", "false") == "true"
|
21
|
+
unless disable_docker_compose
|
22
|
+
system("docker-compose down -v")
|
23
|
+
system("docker-compose up -d --remove-orphans")
|
24
|
+
end
|
25
|
+
ENV["RAILS_ENV"] = "test"
|
26
|
+
databaseYml = {
|
27
|
+
"test" => {
|
28
|
+
"adapter" => "postgresql",
|
29
|
+
"encoding" => "unicode",
|
30
|
+
"host" => ENV.fetch("DATABASE_HOST", "localhost"),
|
31
|
+
"port" => ENV.fetch("DATABASE_PORT", "5432").to_i,
|
32
|
+
"username" => ENV.fetch("DATABASE_USERNAME", "decidim"),
|
33
|
+
"password" => ENV.fetch("DATABASE_PASSWORD", "TEST-insecure-password"),
|
34
|
+
"database" => "decidim_test"
|
35
|
+
}
|
36
|
+
}
|
37
|
+
config_file = File.expand_path("spec/dummy/config/database.yml", __dir__)
|
38
|
+
File.open(config_file, "w") { |f| YAML.dump(databaseYml, f) }
|
39
|
+
Dir.chdir("spec/dummy") do
|
40
|
+
system("bundle exec rails db:migrate")
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
desc "Generates a dummy app for testing"
|
45
|
+
task :test_app do
|
46
|
+
Bundler.with_original_env do
|
47
|
+
generate_decidim_app(
|
48
|
+
"spec/dummy",
|
49
|
+
"--app_name",
|
50
|
+
"decidim_test",
|
51
|
+
"--path",
|
52
|
+
"../..",
|
53
|
+
"--skip_spring",
|
54
|
+
"--demo",
|
55
|
+
"--force_ssl",
|
56
|
+
"false",
|
57
|
+
"--locales",
|
58
|
+
"en,fr,es"
|
59
|
+
)
|
60
|
+
end
|
61
|
+
install_module("spec/dummy")
|
62
|
+
Rake::Task["prepare_tests"].invoke
|
63
|
+
end
|
64
|
+
|
65
|
+
desc "Generates a development app"
|
66
|
+
task :development_app do
|
67
|
+
Bundler.with_original_env do
|
68
|
+
generate_decidim_app(
|
69
|
+
"development_app",
|
70
|
+
"--app_name",
|
71
|
+
"#{base_app_name}_development_app",
|
72
|
+
"--path",
|
73
|
+
"..",
|
74
|
+
"--recreate_db",
|
75
|
+
"--demo"
|
76
|
+
)
|
77
|
+
end
|
78
|
+
|
79
|
+
install_module("development_app")
|
80
|
+
seed_db("development_app")
|
81
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module ExternalNewsletter
|
5
|
+
module Admin
|
6
|
+
# This controller is the abstract class from which all other controllers of
|
7
|
+
# this engine inherit.
|
8
|
+
#
|
9
|
+
# Note that it inherits from `Decidim::Admin::Components::BaseController`, which
|
10
|
+
# override its layout and provide all kinds of useful methods.
|
11
|
+
class ApplicationController < Decidim::Admin::Components::BaseController
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module ExternalNewsletter
|
5
|
+
# This controller is the abstract class from which all other controllers of
|
6
|
+
# this engine inherit.
|
7
|
+
#
|
8
|
+
# Note that it inherits from `Decidim::Components::BaseController`, which
|
9
|
+
# override its layout and provide all kinds of useful methods.
|
10
|
+
class ApplicationController < Decidim::Components::BaseController
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -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 @@
|
|
1
|
+
alert("HERE")
|
@@ -0,0 +1,67 @@
|
|
1
|
+
<div class="wrapper">
|
2
|
+
<div class="row collapse">
|
3
|
+
<div class="row collapse">
|
4
|
+
<div class="columns large-8 large-centered text-center page-title">
|
5
|
+
<h1><%= t "devise.invitations.edit.header" %></h1>
|
6
|
+
|
7
|
+
<p><%= t("devise.invitations.edit.subtitle").html_safe %></p>
|
8
|
+
</div>
|
9
|
+
</div>
|
10
|
+
|
11
|
+
<div class="row">
|
12
|
+
<div class="columns large-6 medium-10 medium-centered">
|
13
|
+
<%= decidim_form_for resource, namespace: "invitation", as: resource_name, url: invitation_path(resource_name, invite_redirect: params[:invite_redirect]), html: { method: :put, class: "register-form new_user" } do |f| %>
|
14
|
+
<div class="card">
|
15
|
+
<div class="card__content">
|
16
|
+
<legend><%= t("sign_up_as.legend", scope: "decidim.devise.registrations.new") %></legend>
|
17
|
+
|
18
|
+
<%= form_required_explanation %>
|
19
|
+
|
20
|
+
<%= f.hidden_field :invitation_token %>
|
21
|
+
|
22
|
+
<div class="user-nickname">
|
23
|
+
<div class="field">
|
24
|
+
<%= f.text_field :nickname, help_text: t("devise.invitations.edit.nickname_help", organization: current_organization.name), required: "required", prefix: { value: "@", small: 1, large: 1 } %>
|
25
|
+
</div>
|
26
|
+
</div>
|
27
|
+
|
28
|
+
<% if f.object.class.require_password_on_accepting %>
|
29
|
+
<div class="field">
|
30
|
+
<p><%= f.password_field :password, required: "required", minlength: ::Devise.password_length.min, maxlength: ::Devise.password_length.max %></p>
|
31
|
+
</div>
|
32
|
+
|
33
|
+
<div class="field">
|
34
|
+
<p><%= f.password_field :password_confirmation, required: "required", minlength: ::Devise.password_length.min, maxlength: ::Devise.password_length.max %></p>
|
35
|
+
</div>
|
36
|
+
<% end %>
|
37
|
+
</div>
|
38
|
+
</div>
|
39
|
+
|
40
|
+
<div class="card" id="card__tos">
|
41
|
+
<div class="card__content">
|
42
|
+
<fieldset>
|
43
|
+
<legend><%= t("tos_title", scope: "decidim.devise.registrations.new") %></legend>
|
44
|
+
<p class="tos-text"><%= strip_tags(translated_attribute(terms_and_conditions_page.content)) %></p>
|
45
|
+
</fieldset>
|
46
|
+
|
47
|
+
<div class="field">
|
48
|
+
<% link = link_to t("terms", scope: "decidim.devise.registrations.new"), page_path("terms-and-conditions"), target: "_blank" %>
|
49
|
+
<% label = t("tos_agreement", scope: "decidim.devise.registrations.new", link: link) %>
|
50
|
+
<%= f.check_box :tos_agreement, label: label, required: "required" %>
|
51
|
+
</div>
|
52
|
+
</div>
|
53
|
+
</div>
|
54
|
+
|
55
|
+
<div class="card">
|
56
|
+
<div class="card__content">
|
57
|
+
<div class="actions">
|
58
|
+
<%= f.submit t("devise.invitations.edit.submit_button"), class: "button expanded" %>
|
59
|
+
</div>
|
60
|
+
</div>
|
61
|
+
</div>
|
62
|
+
|
63
|
+
<% end %>
|
64
|
+
</div>
|
65
|
+
</div>
|
66
|
+
</div>
|
67
|
+
</div>
|
@@ -0,0 +1,96 @@
|
|
1
|
+
<% add_decidim_page_title(t(".sign_up")) %>
|
2
|
+
|
3
|
+
<% content_for :devise_links do %>
|
4
|
+
<%= render "decidim/devise/shared/links" %>
|
5
|
+
<% end %>
|
6
|
+
|
7
|
+
<div class="wrapper">
|
8
|
+
<div class="row collapse">
|
9
|
+
<div class="row collapse">
|
10
|
+
<div class="columns large-8 large-centered text-center page-title">
|
11
|
+
<h1><%= t(".sign_up") %></h1>
|
12
|
+
<p>
|
13
|
+
<%= t(".subtitle") %>
|
14
|
+
</p>
|
15
|
+
<p>
|
16
|
+
<%= t(".already_have_an_account?") %>
|
17
|
+
<%= link_to t(".sign_in"), new_user_session_path %>
|
18
|
+
</p>
|
19
|
+
</div>
|
20
|
+
</div>
|
21
|
+
|
22
|
+
<% cache current_organization do %>
|
23
|
+
<%= render "decidim/devise/shared/omniauth_buttons" %>
|
24
|
+
<% end %>
|
25
|
+
|
26
|
+
<div class="row">
|
27
|
+
<div class="columns large-6 medium-10 medium-centered">
|
28
|
+
|
29
|
+
<%= decidim_form_for(@form, namespace: "registration", as: resource_name, url: registration_path(resource_name), html: { class: "register-form new_user", id: "register-form" }) do |f| %>
|
30
|
+
<%= invisible_captcha %>
|
31
|
+
<div class="card">
|
32
|
+
<div class="card__content">
|
33
|
+
<%= form_required_explanation %>
|
34
|
+
|
35
|
+
<div class="user-person">
|
36
|
+
<div class="field">
|
37
|
+
<%= f.text_field :name, help_text: t(".username_help") %>
|
38
|
+
</div>
|
39
|
+
</div>
|
40
|
+
|
41
|
+
<div class="user-nickname">
|
42
|
+
<div class="field">
|
43
|
+
<%= f.text_field :nickname, help_text: t(".nickname_help", organization: current_organization.name), prefix: { value: "@", small: 1, large: 1 } %>
|
44
|
+
</div>
|
45
|
+
</div>
|
46
|
+
|
47
|
+
<div class="field">
|
48
|
+
<%= f.email_field :email %>
|
49
|
+
</div>
|
50
|
+
|
51
|
+
<div class="field">
|
52
|
+
<%= f.password_field :password, help_text: t("decidim.external_newsletter.devise.registrations.new.password_help", deep_interpolation: true, minimun_characters: ::PasswordValidator::MINIMUM_LENGTH), autocomplete: "off" %>
|
53
|
+
</div>
|
54
|
+
|
55
|
+
<div class="field">
|
56
|
+
<%= f.password_field :password_confirmation %>
|
57
|
+
</div>
|
58
|
+
</div>
|
59
|
+
</div>
|
60
|
+
|
61
|
+
<div class="card" id="card__tos">
|
62
|
+
<div class="card__content">
|
63
|
+
<h3><%= t(".tos_title") %></h3>
|
64
|
+
|
65
|
+
<p class="tos-text">
|
66
|
+
<%= strip_tags(translated_attribute(terms_and_conditions_page.content)) %>
|
67
|
+
</p>
|
68
|
+
|
69
|
+
<div class="field">
|
70
|
+
<%= f.check_box :tos_agreement, label: t(".tos_agreement", link: link_to(t(".terms"), page_path("terms-and-conditions"))) %>
|
71
|
+
</div>
|
72
|
+
</div>
|
73
|
+
</div>
|
74
|
+
|
75
|
+
<div class="card" id="card__newsletter" style="display:none">
|
76
|
+
<div class="card__content">
|
77
|
+
<h3><%= t(".newsletter_title") %></h3>
|
78
|
+
<div class="field">
|
79
|
+
<%= f.check_box :newsletter, label: t(".newsletter"), checked: true %>
|
80
|
+
</div>
|
81
|
+
</div>
|
82
|
+
</div>
|
83
|
+
|
84
|
+
<div class="card">
|
85
|
+
<div class="card__content">
|
86
|
+
<div class="actions">
|
87
|
+
<%= f.submit t("devise.registrations.new.sign_up"), class: "button expanded" %>
|
88
|
+
</div>
|
89
|
+
<%= yield :devise_links %>
|
90
|
+
</div>
|
91
|
+
</div>
|
92
|
+
<% end %>
|
93
|
+
</div>
|
94
|
+
</div>
|
95
|
+
</div>
|
96
|
+
</div>
|
@@ -0,0 +1,76 @@
|
|
1
|
+
<% add_decidim_page_title(t("notifications_settings", scope: "layouts.decidim.user_profile")) %>
|
2
|
+
<% content_for(:subtitle) { t("notifications_settings", scope: "layouts.decidim.user_profile") } %>
|
3
|
+
|
4
|
+
<%= form_for(@notifications_settings, url: notifications_settings_path, method: :put, class: "user-form") do |f| %>
|
5
|
+
<p><strong><%= t(".receive_notifications_about") %></strong></p>
|
6
|
+
<div class="switch tiny switch-with-label notifications_from_own_activity">
|
7
|
+
<%= f.label :notifications_from_own_activity do %>
|
8
|
+
<%= f.check_box :notifications_from_own_activity, label: false, class: "switch-input" %>
|
9
|
+
<span class="switch-paddle"></span>
|
10
|
+
<span class="switch-label"><%= t(".own_activity") %></span>
|
11
|
+
<% end %>
|
12
|
+
</div>
|
13
|
+
<div class="switch tiny switch-with-label notifications_from_followed">
|
14
|
+
<%= f.label :notifications_from_followed do %>
|
15
|
+
<%= f.check_box :notifications_from_followed, label: false, class: "switch-input" %>
|
16
|
+
<span class="switch-paddle"></span>
|
17
|
+
<span class="switch-label"><%= t(".everything_followed") %></span>
|
18
|
+
<% end %>
|
19
|
+
</div>
|
20
|
+
|
21
|
+
<p><strong><%= t(".notifications_sending_frequency") %></strong></p>
|
22
|
+
<%= f.collection_radio_buttons :notifications_sending_frequency, frequencies_collection, :first, :last, { checked: @notifications_settings.notifications_sending_frequency || "daily" } %>
|
23
|
+
|
24
|
+
<p><strong><%= t(".direct_messages") %></strong></p>
|
25
|
+
<div class="switch tiny switch-with-label allow_public_contact">
|
26
|
+
<label>
|
27
|
+
<%= f.check_box :allow_public_contact, label: false, class: "switch-input" %>
|
28
|
+
<span class="switch-paddle"></span>
|
29
|
+
<span class="switch-label"><%= t(".allow_public_contact") %></span>
|
30
|
+
</label>
|
31
|
+
</div>
|
32
|
+
|
33
|
+
<% if current_user.moderator? %>
|
34
|
+
<p><strong><%= t(".administrators") %></strong></p>
|
35
|
+
<div class="switch tiny switch-with-label email_on_moderations">
|
36
|
+
<label>
|
37
|
+
<%= f.check_box :email_on_moderations, label: false, class: "switch-input" %>
|
38
|
+
<span class="switch-paddle"></span>
|
39
|
+
<span class="switch-label"><%= t(".email_on_moderations") %></span>
|
40
|
+
</label>
|
41
|
+
</div>
|
42
|
+
|
43
|
+
<% Decidim.notification_settings_registry.manifests.filter{ |a| a.settings_area == :administrators }.each do |manifest| %>
|
44
|
+
<div class="switch tiny switch-with-label notification_settings">
|
45
|
+
<label>
|
46
|
+
<%= f.check_box "notification_settings[#{manifest.name}]",
|
47
|
+
checked: ["1", true].include?(current_user.notification_settings.fetch(manifest.name.to_s, manifest.default_value)),
|
48
|
+
label: false,
|
49
|
+
class: "switch-input" %>
|
50
|
+
<span class="switch-paddle"></span>
|
51
|
+
<span class="switch-label"><%= t(".notification_settings.#{manifest.name}") %></span>
|
52
|
+
</label>
|
53
|
+
</div>
|
54
|
+
<% end %>
|
55
|
+
|
56
|
+
<% end %>
|
57
|
+
|
58
|
+
<% if @notifications_settings.meet_push_notifications_requirements? %>
|
59
|
+
<div class="push-notifications js-sw-mandatory">
|
60
|
+
<p><strong><%= t(".push_notifications") %></strong></p>
|
61
|
+
<p id="push-notifications-reminder" class="push-notifications__reminder"><i><%= t(".push_notifications_reminder") %></i></p>
|
62
|
+
<div class="switch tiny switch-with-label allow_push_notifications">
|
63
|
+
<label>
|
64
|
+
<%= check_box_tag :allow_push_notifications, 0, false, class: "switch-input" %>
|
65
|
+
<span class="switch-paddle"></span>
|
66
|
+
<span class="switch-label"><%= t(".allow_push_notifications") %></span>
|
67
|
+
</label>
|
68
|
+
</div>
|
69
|
+
</div>
|
70
|
+
|
71
|
+
<input id="vapidPublicKey" name="vapid_public_key" type="hidden" value="<%= Base64.urlsafe_decode64(Rails.application.secrets.vapid[:public_key]).bytes %>">
|
72
|
+
<input id="subKeys" name="sub_key" type="hidden" value="<%= current_user.notifications_subscriptions.keys %>">
|
73
|
+
<% end %>
|
74
|
+
|
75
|
+
<%= f.submit t(".update_notifications_settings") %>
|
76
|
+
<% end %>
|
@@ -0,0 +1,53 @@
|
|
1
|
+
<% add_decidim_page_title(t("notifications_settings", scope: "layouts.decidim.user_profile")) %>
|
2
|
+
<% content_for(:subtitle) { t("notifications_settings", scope: "layouts.decidim.user_profile") } %>
|
3
|
+
|
4
|
+
<div class="row">
|
5
|
+
<%= form_for(@notifications_settings, url: notifications_settings_path, method: :put, class: "user-form") do |f| %>
|
6
|
+
<p><strong><%= t(".receive_notifications_about") %></strong></p>
|
7
|
+
<div class="switch tiny switch-with-label notifications_from_own_activity">
|
8
|
+
<%= f.label :notifications_from_own_activity do %>
|
9
|
+
<%= f.check_box :notifications_from_own_activity, label: false, class: "switch-input" %>
|
10
|
+
<span class="switch-paddle"></span>
|
11
|
+
<span class="switch-label"><%= t(".own_activity") %></span>
|
12
|
+
<% end %>
|
13
|
+
</div>
|
14
|
+
<div class="switch tiny switch-with-label notifications_from_followed">
|
15
|
+
<%= f.label :notifications_from_followed do %>
|
16
|
+
<%= f.check_box :notifications_from_followed, label: false, class: "switch-input" %>
|
17
|
+
<span class="switch-paddle"></span>
|
18
|
+
<span class="switch-label"><%= t(".everything_followed") %></span>
|
19
|
+
<% end %>
|
20
|
+
</div>
|
21
|
+
|
22
|
+
<p><strong><%= t(".send_notifications_by_email") %></strong></p>
|
23
|
+
<div class="switch tiny switch-with-label email_on_notification">
|
24
|
+
<%= f.label :email_on_notification do %>
|
25
|
+
<%= f.check_box :email_on_notification, label: false, class: "switch-input" %>
|
26
|
+
<span class="switch-paddle"></span>
|
27
|
+
<span class="switch-label"><%= t(".email_on_notification") %></span>
|
28
|
+
<% end %>
|
29
|
+
</div>
|
30
|
+
|
31
|
+
<p><strong><%= t(".direct_messages") %></strong></p>
|
32
|
+
<div class="switch tiny switch-with-label allow_public_contact">
|
33
|
+
<label>
|
34
|
+
<%= f.check_box :allow_public_contact, label: false, class: "switch-input" %>
|
35
|
+
<span class="switch-paddle"></span>
|
36
|
+
<span class="switch-label"><%= t(".allow_public_contact") %></span>
|
37
|
+
</label>
|
38
|
+
</div>
|
39
|
+
|
40
|
+
<% if @notifications_settings.user_is_moderator?(current_user) %>
|
41
|
+
<p><strong><%= t(".administrators") %></strong></p>
|
42
|
+
<div class="switch tiny switch-with-label email_on_moderations">
|
43
|
+
<label>
|
44
|
+
<%= f.check_box :email_on_moderations, label: false, class: "switch-input" %>
|
45
|
+
<span class="switch-paddle"></span>
|
46
|
+
<span class="switch-label"><%= t(".email_on_moderations") %></span>
|
47
|
+
</label>
|
48
|
+
</div>
|
49
|
+
<% end %>
|
50
|
+
|
51
|
+
<%= f.submit t(".update_notifications_settings") %>
|
52
|
+
<% end %>
|
53
|
+
</div>
|
@@ -0,0 +1,56 @@
|
|
1
|
+
<% if ENV.fetch('DECIDIM_EXTERNAL_NEWSLETTER', nil).present? %>
|
2
|
+
<style>
|
3
|
+
#newsletter_subscription .inf-form {
|
4
|
+
padding: 2rem 1.2rem;
|
5
|
+
background: #EEE;
|
6
|
+
text-align: center;
|
7
|
+
}
|
8
|
+
#newsletter_subscription .inf-form h4 {
|
9
|
+
font-size: 1.375rem;
|
10
|
+
color: inherit;
|
11
|
+
font-weight: inherit;
|
12
|
+
}
|
13
|
+
#newsletter_subscription .inf-form > div {
|
14
|
+
background: transparent;
|
15
|
+
margin: 0;
|
16
|
+
padding: 0;
|
17
|
+
text-align: center;
|
18
|
+
font-family: "Source Sans Pro", Helvetica, Roboto, Arial, sans-serif;
|
19
|
+
}
|
20
|
+
#newsletter_subscription .inf-form .inf-input{
|
21
|
+
max-width:25rem;
|
22
|
+
margin: 0 auto;
|
23
|
+
}
|
24
|
+
#newsletter_subscription .inf-form .inf-input.inf-error span.inf-message {
|
25
|
+
color: var(--alert);
|
26
|
+
transform: translateY(-16px);
|
27
|
+
}
|
28
|
+
#newsletter_subscription .inf-form .inf-submit {
|
29
|
+
text-align: center;
|
30
|
+
}
|
31
|
+
#newsletter_subscription .inf-form .inf-submit input,
|
32
|
+
#newsletter_subscription .inf-form .inf-submit input:hover {
|
33
|
+
display: inline-block;
|
34
|
+
vertical-align: middle;
|
35
|
+
margin: 0 0 1rem 0;
|
36
|
+
padding: 0.85em 1em;
|
37
|
+
border: 1px solid transparent;
|
38
|
+
border-radius: 4px;
|
39
|
+
transition: background-color 0.25s ease-out, color 0.25s ease-out;
|
40
|
+
font-family: inherit;
|
41
|
+
font-size: 1rem;
|
42
|
+
-webkit-appearance: none;
|
43
|
+
line-height: 1;
|
44
|
+
text-align: center;
|
45
|
+
cursor: pointer;
|
46
|
+
background: var(--primary);
|
47
|
+
}
|
48
|
+
#newsletter_subscription .inf-form .inf-submit input:hover {
|
49
|
+
opacity:0.8
|
50
|
+
}
|
51
|
+
</style>
|
52
|
+
<div id="newsletter_subscription">
|
53
|
+
<script type="text/javascript" src="<%= ENV.fetch("DECIDIM_EXTERNAL_NEWSLETTER") %>"></script>
|
54
|
+
</div>
|
55
|
+
<% end %>
|
56
|
+
|
@@ -0,0 +1,32 @@
|
|
1
|
+
<%= render partial: "layouts/decidim/external_newsletter" %>
|
2
|
+
|
3
|
+
<div class="main-footer">
|
4
|
+
<% if current_organization.official_img_footer.attached? %>
|
5
|
+
<%= link_to current_organization.official_url, class: "main-footer__badge" do %>
|
6
|
+
<%= image_tag current_organization.attached_uploader(:official_img_footer).path, alt: current_organization.name %>
|
7
|
+
<% end %>
|
8
|
+
<% end %>
|
9
|
+
<div class="row">
|
10
|
+
<div class="medium-8 large-6 large-offset-3 column">
|
11
|
+
<nav class="main__footer__nav">
|
12
|
+
<ul class="footer-nav">
|
13
|
+
<% organization_pages = current_organization.static_pages_accessible_for(current_user) %>
|
14
|
+
<% if organization_pages.any? %>
|
15
|
+
<% current_organization.static_page_topics.where(show_in_footer: true).each do |page_topic| %>
|
16
|
+
<% topic_pages = page_topic.accessible_pages_for(current_user) %>
|
17
|
+
<% if topic_pages.any? %>
|
18
|
+
<li><%= link_to translated_attribute(page_topic.title), decidim.page_path(topic_pages.first) %></li>
|
19
|
+
<% end %>
|
20
|
+
<% end %>
|
21
|
+
|
22
|
+
<% organization_pages.where(show_in_footer: true).each do |page| %>
|
23
|
+
<li><%= link_to translated_attribute(page.title), decidim.page_path(page) %></li>
|
24
|
+
<% end %>
|
25
|
+
<% end %>
|
26
|
+
<li><%= link_to t("layouts.decidim.footer.download_open_data"), decidim.open_data_download_path %></li>
|
27
|
+
</ul>
|
28
|
+
</nav>
|
29
|
+
</div>
|
30
|
+
<%= render partial: "layouts/decidim/social_media_links" %>
|
31
|
+
</div>
|
32
|
+
</div>
|