decidim-extra_blocks 0.1.3 → 0.1.4
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 +4 -4
- data/CONTRIBUTING.md +3 -24
- data/README.md +4 -16
- data/app/cells/decidim/extra_blocks/layouts/base_cell.rb +55 -1
- data/app/cells/decidim/extra_blocks/layouts/base_settings_form_cell.rb +15 -0
- data/app/cells/decidim/extra_blocks/layouts/brand_story/show.erb +1 -0
- data/app/cells/decidim/extra_blocks/layouts/brand_story_settings_form/show.erb +4 -3
- data/app/cells/decidim/extra_blocks/layouts/dual_path_cta/show.erb +1 -6
- data/app/cells/decidim/extra_blocks/layouts/dual_path_cta_cell.rb +1 -1
- data/app/cells/decidim/extra_blocks/layouts/dual_path_cta_settings_form/show.erb +4 -14
- data/app/cells/decidim/extra_blocks/layouts/editorial_prose/show.erb +1 -0
- data/app/cells/decidim/extra_blocks/layouts/editorial_prose_settings_form/show.erb +4 -3
- data/app/cells/decidim/extra_blocks/layouts/fast_proposal_form_cell.rb +1 -1
- data/app/cells/decidim/extra_blocks/layouts/focused_quick_proposal/show.erb +1 -6
- data/app/cells/decidim/extra_blocks/layouts/focused_quick_proposal_settings_form/show.erb +1 -1
- data/app/cells/decidim/extra_blocks/layouts/image/show.erb +1 -0
- data/app/cells/decidim/extra_blocks/layouts/image_settings_form/show.erb +4 -3
- data/app/cells/decidim/extra_blocks/layouts/impact_milestones/show.erb +1 -0
- data/app/cells/decidim/extra_blocks/layouts/impact_milestones_settings_form/show.erb +4 -3
- data/app/cells/decidim/extra_blocks/layouts/join_steps_cta/show.erb +1 -6
- data/app/cells/decidim/extra_blocks/layouts/join_steps_cta_settings_form/show.erb +4 -14
- data/app/cells/decidim/extra_blocks/layouts/logo_showcase/show.erb +1 -0
- data/app/cells/decidim/extra_blocks/layouts/logo_showcase_settings_form/show.erb +4 -3
- data/app/cells/decidim/extra_blocks/layouts/media_aside/show.erb +1 -0
- data/app/cells/decidim/extra_blocks/layouts/media_aside_settings_form/show.erb +4 -3
- data/app/cells/decidim/extra_blocks/layouts/outcome_stats_hero/show.erb +1 -0
- data/app/cells/decidim/extra_blocks/layouts/outcome_stats_hero_settings_form/show.erb +4 -3
- data/app/cells/decidim/extra_blocks/layouts/photo_mission_hero/show.erb +1 -6
- data/app/cells/decidim/extra_blocks/layouts/photo_mission_hero_settings_form/show.erb +4 -14
- data/app/cells/decidim/extra_blocks/layouts/proposals_aside_fast_proposal/show.erb +1 -6
- data/app/cells/decidim/extra_blocks/layouts/proposals_aside_fast_proposal_settings_form/show.erb +1 -1
- data/app/cells/decidim/extra_blocks/layouts/roadmap/show.erb +1 -0
- data/app/cells/decidim/extra_blocks/layouts/roadmap_settings_form/show.erb +4 -3
- data/app/cells/decidim/extra_blocks/layouts/shared/_background_fit_fieldset.erb +2 -2
- data/app/cells/decidim/extra_blocks/layouts/shared/_fast_proposal_settings_fields.erb +3 -14
- data/app/cells/decidim/extra_blocks/layouts/shared/_section_background.erb +26 -0
- data/app/cells/decidim/extra_blocks/layouts/shared/_section_background_fields.erb +71 -0
- data/app/cells/decidim/extra_blocks/layouts/spacer/show.erb +1 -0
- data/app/cells/decidim/extra_blocks/layouts/spacer_settings_form/show.erb +4 -3
- data/app/cells/decidim/extra_blocks/layouts/split_fast_proposal/show.erb +1 -6
- data/app/cells/decidim/extra_blocks/layouts/split_fast_proposal_settings_form/show.erb +2 -2
- data/app/cells/decidim/extra_blocks/layouts/split_story_hero/show.erb +1 -0
- data/app/cells/decidim/extra_blocks/layouts/split_story_hero_settings_form/show.erb +4 -3
- data/app/cells/decidim/extra_blocks/layouts/topic_trio/show.erb +1 -0
- data/app/cells/decidim/extra_blocks/layouts/topic_trio_settings_form/show.erb +4 -3
- data/app/cells/decidim/extra_blocks/layouts/trust_quote_cta/show.erb +1 -0
- data/app/cells/decidim/extra_blocks/layouts/trust_quote_cta_settings_form/show.erb +4 -3
- data/app/cells/decidim/extra_blocks/layouts/verbose_cta/show.erb +1 -0
- data/app/cells/decidim/extra_blocks/layouts/verbose_cta_settings_form/show.erb +4 -3
- data/app/cells/decidim/extra_blocks/layouts/video/show.erb +1 -0
- data/app/cells/decidim/extra_blocks/layouts/video_fast_proposal/show.erb +1 -7
- data/app/cells/decidim/extra_blocks/layouts/video_fast_proposal_settings_form/show.erb +1 -17
- data/app/cells/decidim/extra_blocks/layouts/video_hero/show.erb +1 -7
- data/app/cells/decidim/extra_blocks/layouts/video_hero_settings_form/show.erb +4 -21
- data/app/cells/decidim/extra_blocks/layouts/video_settings_form/show.erb +4 -21
- data/app/commands/decidim/extra_blocks/create_fast_proposal.rb +18 -24
- data/app/forms/decidim/extra_blocks/admin/config_form.rb +29 -3
- data/app/forms/decidim/extra_blocks/fast_proposal_form.rb +2 -2
- data/app/overrides/extra_blocks_admin_body_data_attributes.rb +6 -2
- data/app/packs/entrypoints/decidim_extra_blocks.js +1 -0
- data/app/packs/src/decidim/extra_blocks/background_video.js +1 -1
- data/app/packs/stylesheets/decidim/extra_blocks/availability.scss +16 -5
- data/app/packs/stylesheets/decidim/extra_blocks/dynamic_events_settings.scss +2 -0
- data/app/packs/stylesheets/decidim/extra_blocks/dynamic_logos_settings.scss +2 -0
- data/app/packs/stylesheets/decidim/extra_blocks/dynamic_slot_list_settings.scss +2 -0
- data/app/packs/stylesheets/decidim/extra_blocks/extra_blocks.scss +40 -3
- data/app/packs/stylesheets/decidim/extra_blocks/gallery.scss +2 -0
- data/app/packs/stylesheets/decidim/extra_blocks/section_background_settings.scss +46 -0
- data/app/services/decidim/extra_blocks/dummy_ephemeral_authorization_handler.rb +1 -0
- data/app/views/decidim/extra_blocks/admin/landing_page_content_blocks/unauthorized_edit.html.erb +23 -0
- data/config/assets.rb +2 -2
- data/config/locales/en.yml +58 -0
- data/config/locales/pt-BR.yml +58 -0
- data/lib/decidim/extra_blocks/admin/landing_page_content_blocks_extensions.rb +33 -0
- data/lib/decidim/extra_blocks/application_mailer_override.rb +1 -3
- data/lib/decidim/extra_blocks/availability.rb +30 -1
- data/lib/decidim/extra_blocks/content_blocks/registry_manager.rb +5 -5
- data/lib/decidim/extra_blocks/engine.rb +3 -22
- data/lib/decidim/extra_blocks/fast_proposal/ephemeral_gate.rb +19 -16
- data/lib/decidim/extra_blocks/layouts/layout_registry.rb +1 -1
- data/lib/decidim/extra_blocks/layouts/register_defaults.rb +37 -0
- data/lib/decidim/extra_blocks/seed_hook.rb +1 -1
- data/lib/decidim/extra_blocks/seeds.rb +5 -14
- data/lib/decidim/extra_blocks/version.rb +2 -2
- data/package.json +1 -1
- metadata +18 -15
- data/app/services/decidim/extra_blocks/authorization_handler_extensions.rb +0 -20
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/* Hide Extra Blocks when Toggle disables the module or a layout category.
|
|
2
|
-
* Public flags:
|
|
3
|
-
*
|
|
4
|
-
* Cell / list markers: layout cells + admin content_block list Deface. */
|
|
2
|
+
* Public flags: body/layout-container data attrs. Admin: body data attrs.
|
|
3
|
+
* List markers: data-extra-blocks-manifest / category on the content-block cell. */
|
|
5
4
|
|
|
6
5
|
[data-extra-blocks-enabled="false"] {
|
|
7
6
|
a[href*="manifest_name=extra_block"],
|
|
@@ -12,6 +11,16 @@
|
|
|
12
11
|
}
|
|
13
12
|
}
|
|
14
13
|
|
|
14
|
+
/* Domain gate (UI only): hide add menu + trash; keep drag card and pencil. */
|
|
15
|
+
[data-extra-blocks-domain-authorized="false"] {
|
|
16
|
+
a[href*="manifest_name=extra_block"],
|
|
17
|
+
li:has(a[href*="manifest_name=extra_block"]),
|
|
18
|
+
[data-extra-blocks-manifest="extra_block"] a[data-method="delete"],
|
|
19
|
+
[data-extra-blocks-manifest="extra_block"] a[data-turbo-method="delete"] {
|
|
20
|
+
display: none !important;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
15
24
|
[data-extra-blocks-cta-enabled="false"] [data-extra-blocks-category="cta"] {
|
|
16
25
|
display: none !important;
|
|
17
26
|
}
|
|
@@ -24,7 +33,8 @@
|
|
|
24
33
|
display: none !important;
|
|
25
34
|
}
|
|
26
35
|
|
|
27
|
-
[data-extra-blocks-fast-proposal-enabled="false"]
|
|
36
|
+
[data-extra-blocks-fast-proposal-enabled="false"]
|
|
37
|
+
[data-extra-blocks-category="fast_proposal"] {
|
|
28
38
|
display: none !important;
|
|
29
39
|
}
|
|
30
40
|
|
|
@@ -32,6 +42,7 @@
|
|
|
32
42
|
display: none !important;
|
|
33
43
|
}
|
|
34
44
|
|
|
35
|
-
[data-extra-blocks-timelines-enabled="false"]
|
|
45
|
+
[data-extra-blocks-timelines-enabled="false"]
|
|
46
|
+
[data-extra-blocks-category="timelines"] {
|
|
36
47
|
display: none !important;
|
|
37
48
|
}
|
|
@@ -82,6 +82,45 @@ p.extra-blocks__eyebrow {
|
|
|
82
82
|
max-width: 100%;
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
+
/* Shared section background stack (color via --eb-bg, then image, then video). */
|
|
86
|
+
section[id^="extra-block-"] {
|
|
87
|
+
position: relative;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.extra-blocks-section-background {
|
|
91
|
+
position: absolute;
|
|
92
|
+
inset: 0;
|
|
93
|
+
z-index: 0;
|
|
94
|
+
overflow: hidden;
|
|
95
|
+
pointer-events: none;
|
|
96
|
+
|
|
97
|
+
> picture,
|
|
98
|
+
> img,
|
|
99
|
+
> video {
|
|
100
|
+
position: absolute;
|
|
101
|
+
inset: 0;
|
|
102
|
+
width: 100%;
|
|
103
|
+
height: 100%;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
&__image {
|
|
107
|
+
object-fit: var(--eb-bg-fit, cover);
|
|
108
|
+
object-position: center;
|
|
109
|
+
display: block;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
&__video {
|
|
113
|
+
z-index: 1;
|
|
114
|
+
object-fit: var(--eb-bg-fit, cover);
|
|
115
|
+
object-position: center;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
section[id^="extra-block-"] > :not(.extra-blocks-section-background) {
|
|
120
|
+
position: relative;
|
|
121
|
+
z-index: 2;
|
|
122
|
+
}
|
|
123
|
+
|
|
85
124
|
.extra-blocks__card {
|
|
86
125
|
background: var(--eb-color-paper);
|
|
87
126
|
color: var(--eb-color-ink);
|
|
@@ -101,9 +140,7 @@ a.extra-blocks__card {
|
|
|
101
140
|
.extra-blocks-split-fast-proposal,
|
|
102
141
|
.extra-blocks-video-fast-proposal,
|
|
103
142
|
.extra-blocks-proposals-aside-fast-proposal {
|
|
104
|
-
&:has(>
|
|
105
|
-
&:has(> video)::before,
|
|
106
|
-
&:has(> img)::before {
|
|
143
|
+
&:has(> .extra-blocks-section-background)::before {
|
|
107
144
|
content: "";
|
|
108
145
|
position: absolute;
|
|
109
146
|
inset: 0;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/* Admin Extra Block settings: Color / Image / Video background tabs.
|
|
2
|
+
* Tab chrome stays Decidim `.tabs--lang`; this file only fixes panel field layout. */
|
|
3
|
+
|
|
4
|
+
.extra-blocks-background-fields {
|
|
5
|
+
.tabs-content > .tabs-panel {
|
|
6
|
+
margin-top: 0.5rem;
|
|
7
|
+
padding: 0.75rem 1rem;
|
|
8
|
+
border: 1px solid rgb(229 229 229);
|
|
9
|
+
border-radius: 3px;
|
|
10
|
+
background-color: rgb(250 251 252);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/* color_field renders label wrapping the swatch; keep them on one centered row */
|
|
14
|
+
.tabs-panel label:has(input[type="color"]) {
|
|
15
|
+
display: flex;
|
|
16
|
+
align-items: center;
|
|
17
|
+
gap: 0.5rem;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.tabs-panel input[type="color"] {
|
|
21
|
+
margin: 0;
|
|
22
|
+
flex-shrink: 0;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/* Fit radios sit under the image upload without Foundation row gutters */
|
|
26
|
+
&__fit {
|
|
27
|
+
margin: 0.75rem 0 0;
|
|
28
|
+
padding: 0;
|
|
29
|
+
border: 0;
|
|
30
|
+
min-width: 0;
|
|
31
|
+
|
|
32
|
+
/* Title is a <label> so it matches upload field labels under .form__wrapper */
|
|
33
|
+
> label:first-child {
|
|
34
|
+
display: block;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.radio-label {
|
|
38
|
+
padding-right: 0.75rem;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/* Second video upload (MP4) — same vertical rhythm as Decidim form rows */
|
|
43
|
+
.upload-container-for-background_video {
|
|
44
|
+
margin-top: 1rem;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -5,6 +5,7 @@ module Decidim
|
|
|
5
5
|
# Demo ephemeral authorization: phone number only (for Fast Proposal demos).
|
|
6
6
|
class DummyEphemeralAuthorizationHandler < Decidim::AuthorizationHandler
|
|
7
7
|
attribute :phone_number, String
|
|
8
|
+
attribute :tos_agreement, Boolean
|
|
8
9
|
|
|
9
10
|
validates :phone_number, presence: true
|
|
10
11
|
validate :valid_phone_number
|
data/app/views/decidim/extra_blocks/admin/landing_page_content_blocks/unauthorized_edit.html.erb
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<% add_decidim_page_title(t("decidim.admin.content_blocks.edit.title", default: "Extra Block")) %>
|
|
2
|
+
|
|
3
|
+
<div class="item_show__wrapper">
|
|
4
|
+
<div class="item_show__header">
|
|
5
|
+
<h1 class="item_show__header-title">
|
|
6
|
+
<%= t("decidim.admin.content_blocks.edit.title", default: "Extra Block") %>
|
|
7
|
+
</h1>
|
|
8
|
+
</div>
|
|
9
|
+
|
|
10
|
+
<div class="card">
|
|
11
|
+
<div class="card-section space-y-4">
|
|
12
|
+
<%= cell(
|
|
13
|
+
"decidim/announcement",
|
|
14
|
+
t("decidim.extra_blocks.admin.edit.unauthorized"),
|
|
15
|
+
callout_class: "warning"
|
|
16
|
+
) %>
|
|
17
|
+
|
|
18
|
+
<%= link_to t("decidim.extra_blocks.admin.edit.back"),
|
|
19
|
+
@extra_blocks_back_path,
|
|
20
|
+
class: "button button__sm button__transparent-secondary" %>
|
|
21
|
+
</div>
|
|
22
|
+
</div>
|
|
23
|
+
</div>
|
data/config/assets.rb
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
base_path = File.expand_path("..", __dir__)
|
|
4
4
|
|
|
5
|
-
Decidim::
|
|
6
|
-
Decidim::
|
|
5
|
+
Decidim::Shakapacker.register_path("#{base_path}/app/packs")
|
|
6
|
+
Decidim::Shakapacker.register_entrypoints(
|
|
7
7
|
decidim_extra_blocks: "#{base_path}/app/packs/entrypoints/decidim_extra_blocks.js"
|
|
8
8
|
)
|
data/config/locales/en.yml
CHANGED
|
@@ -2,6 +2,46 @@
|
|
|
2
2
|
en:
|
|
3
3
|
activemodel:
|
|
4
4
|
attributes:
|
|
5
|
+
content_block_attachment:
|
|
6
|
+
aside_1_image: Aside image 1
|
|
7
|
+
aside_2_image: Aside image 2
|
|
8
|
+
aside_3_image: Aside image 3
|
|
9
|
+
aside_4_image: Aside image 4
|
|
10
|
+
aside_5_image: Aside image 5
|
|
11
|
+
aside_6_image: Aside image 6
|
|
12
|
+
background_image: Background image
|
|
13
|
+
background_video: Background video (MP4)
|
|
14
|
+
background_video_webm: Background video (WebM)
|
|
15
|
+
block_image: Block image
|
|
16
|
+
event_1_image: Event 1 image
|
|
17
|
+
event_2_image: Event 2 image
|
|
18
|
+
event_3_image: Event 3 image
|
|
19
|
+
event_4_image: Event 4 image
|
|
20
|
+
event_5_image: Event 5 image
|
|
21
|
+
event_6_image: Event 6 image
|
|
22
|
+
event_7_image: Event 7 image
|
|
23
|
+
event_8_image: Event 8 image
|
|
24
|
+
lead_image: Lead image
|
|
25
|
+
logo_1: Logo 1
|
|
26
|
+
logo_2: Logo 2
|
|
27
|
+
logo_3: Logo 3
|
|
28
|
+
logo_4: Logo 4
|
|
29
|
+
logo_5: Logo 5
|
|
30
|
+
logo_6: Logo 6
|
|
31
|
+
logo_7: Logo 7
|
|
32
|
+
logo_8: Logo 8
|
|
33
|
+
logo_9: Logo 9
|
|
34
|
+
logo_10: Logo 10
|
|
35
|
+
logo_11: Logo 11
|
|
36
|
+
logo_12: Logo 12
|
|
37
|
+
portrait: Portrait
|
|
38
|
+
side_image: Side image
|
|
39
|
+
topic_1_image: Topic 1 image
|
|
40
|
+
topic_2_image: Topic 2 image
|
|
41
|
+
topic_3_image: Topic 3 image
|
|
42
|
+
topic_4_image: Topic 4 image
|
|
43
|
+
topic_5_image: Topic 5 image
|
|
44
|
+
topic_6_image: Topic 6 image
|
|
5
45
|
dummy_ephemeral_authorization_handler:
|
|
6
46
|
phone_number: Phone number
|
|
7
47
|
decidim/extra_blocks/dummy_ephemeral_authorization_handler:
|
|
@@ -23,6 +63,7 @@ en:
|
|
|
23
63
|
decidim_extra_blocks:
|
|
24
64
|
tab: Extra Blocks
|
|
25
65
|
enabled: Enable Extra Blocks
|
|
66
|
+
allowed_domain: Allowed email domain
|
|
26
67
|
cta_enabled: Enable CTA layouts
|
|
27
68
|
hero_enabled: Enable Hero layouts
|
|
28
69
|
text_enabled: Enable Text layouts
|
|
@@ -31,6 +72,7 @@ en:
|
|
|
31
72
|
timelines_enabled: Enable Timelines layouts
|
|
32
73
|
helptext:
|
|
33
74
|
enabled: When disabled, Extra Blocks are hidden from the content block library and existing Extra Blocks are hidden on landing pages.
|
|
75
|
+
allowed_domain: One hostname (for example octree.ch). Organization admins whose account email matches can create, edit, and delete Extra Blocks. Leave blank to lock create, edit, and delete for every admin. Drag-and-drop stays available.
|
|
34
76
|
cta_enabled: When disabled, CTA layouts are hidden from the gallery and existing CTA Extra Blocks are hidden.
|
|
35
77
|
hero_enabled: When disabled, Hero layouts are hidden from the gallery and existing Hero Extra Blocks are hidden.
|
|
36
78
|
text_enabled: When disabled, Text layouts are hidden from the gallery and existing Text Extra Blocks are hidden.
|
|
@@ -139,6 +181,16 @@ en:
|
|
|
139
181
|
name: Logo showcase
|
|
140
182
|
description: Greyscale partner logo grid (up to 12) that fades to color on hover.
|
|
141
183
|
shared:
|
|
184
|
+
background: Background
|
|
185
|
+
background_tab_color: Color
|
|
186
|
+
background_tab_image: Image
|
|
187
|
+
background_tab_video: Video
|
|
188
|
+
background_color: Background color
|
|
189
|
+
background_image: Background image
|
|
190
|
+
background_video_webm: Background video (WebM)
|
|
191
|
+
background_video_webm_help: Optional. Prefer WebM for modern browsers. Formats are independent; nothing is converted.
|
|
192
|
+
background_video: Background video (MP4)
|
|
193
|
+
background_video_help: Optional. MP4 fallback for broader browser support. Color and image stay under the video when it is set.
|
|
142
194
|
background_fit: Background fit
|
|
143
195
|
background_fit_cover: Cover
|
|
144
196
|
background_fit_contain: Contain
|
|
@@ -465,8 +517,14 @@ en:
|
|
|
465
517
|
admin:
|
|
466
518
|
edit:
|
|
467
519
|
back: Back
|
|
520
|
+
unauthorized: You are not authorized to edit this extra block
|
|
521
|
+
create:
|
|
522
|
+
unauthorized: You are not authorized to create extra-blocks
|
|
468
523
|
update:
|
|
469
524
|
success: Extra Block successfully updated.
|
|
525
|
+
unauthorized: You are not authorized to edit this extra block
|
|
526
|
+
destroy:
|
|
527
|
+
unauthorized: You are not authorized to delete extra-blocks
|
|
470
528
|
errors:
|
|
471
529
|
layout_frozen: The layout for this Extra Block cannot be changed. Delete the block and create a new one to pick another layout.
|
|
472
530
|
layout_unknown: The selected layout is not registered.
|
data/config/locales/pt-BR.yml
CHANGED
|
@@ -2,6 +2,46 @@
|
|
|
2
2
|
pt-BR:
|
|
3
3
|
activemodel:
|
|
4
4
|
attributes:
|
|
5
|
+
content_block_attachment:
|
|
6
|
+
aside_1_image: Imagem lateral 1
|
|
7
|
+
aside_2_image: Imagem lateral 2
|
|
8
|
+
aside_3_image: Imagem lateral 3
|
|
9
|
+
aside_4_image: Imagem lateral 4
|
|
10
|
+
aside_5_image: Imagem lateral 5
|
|
11
|
+
aside_6_image: Imagem lateral 6
|
|
12
|
+
background_image: Imagem de fundo
|
|
13
|
+
background_video: Vídeo de fundo (MP4)
|
|
14
|
+
background_video_webm: Vídeo de fundo (WebM)
|
|
15
|
+
block_image: Imagem do bloco
|
|
16
|
+
event_1_image: Imagem do evento 1
|
|
17
|
+
event_2_image: Imagem do evento 2
|
|
18
|
+
event_3_image: Imagem do evento 3
|
|
19
|
+
event_4_image: Imagem do evento 4
|
|
20
|
+
event_5_image: Imagem do evento 5
|
|
21
|
+
event_6_image: Imagem do evento 6
|
|
22
|
+
event_7_image: Imagem do evento 7
|
|
23
|
+
event_8_image: Imagem do evento 8
|
|
24
|
+
lead_image: Imagem de abertura
|
|
25
|
+
logo_1: Logo 1
|
|
26
|
+
logo_2: Logo 2
|
|
27
|
+
logo_3: Logo 3
|
|
28
|
+
logo_4: Logo 4
|
|
29
|
+
logo_5: Logo 5
|
|
30
|
+
logo_6: Logo 6
|
|
31
|
+
logo_7: Logo 7
|
|
32
|
+
logo_8: Logo 8
|
|
33
|
+
logo_9: Logo 9
|
|
34
|
+
logo_10: Logo 10
|
|
35
|
+
logo_11: Logo 11
|
|
36
|
+
logo_12: Logo 12
|
|
37
|
+
portrait: Retrato
|
|
38
|
+
side_image: Imagem lateral
|
|
39
|
+
topic_1_image: Imagem do tema 1
|
|
40
|
+
topic_2_image: Imagem do tema 2
|
|
41
|
+
topic_3_image: Imagem do tema 3
|
|
42
|
+
topic_4_image: Imagem do tema 4
|
|
43
|
+
topic_5_image: Imagem do tema 5
|
|
44
|
+
topic_6_image: Imagem do tema 6
|
|
5
45
|
dummy_ephemeral_authorization_handler:
|
|
6
46
|
phone_number: Número de telefone
|
|
7
47
|
decidim/extra_blocks/dummy_ephemeral_authorization_handler:
|
|
@@ -23,6 +63,7 @@ pt-BR:
|
|
|
23
63
|
decidim_extra_blocks:
|
|
24
64
|
tab: Extra Blocks
|
|
25
65
|
enabled: Ativar Extra Blocks
|
|
66
|
+
allowed_domain: Domínio de e-mail permitido
|
|
26
67
|
cta_enabled: Ativar layouts de CTA
|
|
27
68
|
hero_enabled: Ativar layouts de Hero
|
|
28
69
|
text_enabled: Ativar layouts de Texto
|
|
@@ -31,6 +72,7 @@ pt-BR:
|
|
|
31
72
|
timelines_enabled: Ativar layouts de Linha do tempo
|
|
32
73
|
helptext:
|
|
33
74
|
enabled: Quando desativado, Extra Blocks ficam ocultos na biblioteca de blocos de conteúdo e Extra Blocks existentes ficam ocultos nas páginas iniciais.
|
|
75
|
+
allowed_domain: Um hostname (por exemplo octree.ch). Admins da organização cujo e-mail corresponde podem criar, editar e excluir Extra Blocks. Deixe em branco para bloquear criar, editar e excluir para todos. Arrastar e soltar continua disponível.
|
|
34
76
|
cta_enabled: Quando desativado, layouts de CTA ficam ocultos na galeria e Extra Blocks de CTA existentes ficam ocultos.
|
|
35
77
|
hero_enabled: Quando desativado, layouts de Hero ficam ocultos na galeria e Extra Blocks de Hero existentes ficam ocultos.
|
|
36
78
|
text_enabled: Quando desativado, layouts de Texto ficam ocultos na galeria e Extra Blocks de Texto existentes ficam ocultos.
|
|
@@ -139,6 +181,16 @@ pt-BR:
|
|
|
139
181
|
name: Vitrine de logos
|
|
140
182
|
description: Grade de logos de parceiros em tons de cinza (até 12) que ganham cor ao passar o mouse.
|
|
141
183
|
shared:
|
|
184
|
+
background: Fundo
|
|
185
|
+
background_tab_color: Cor
|
|
186
|
+
background_tab_image: Imagem
|
|
187
|
+
background_tab_video: Vídeo
|
|
188
|
+
background_color: Cor de fundo
|
|
189
|
+
background_image: Imagem de fundo
|
|
190
|
+
background_video_webm: Vídeo de fundo (WebM)
|
|
191
|
+
background_video_webm_help: Opcional. Prefira WebM para navegadores modernos. Os formatos são independentes; nada é convertido.
|
|
192
|
+
background_video: Vídeo de fundo (MP4)
|
|
193
|
+
background_video_help: Opcional. MP4 como alternativa para maior compatibilidade. Cor e imagem permanecem sob o vídeo quando ele estiver definido.
|
|
142
194
|
background_fit: Ajuste do fundo
|
|
143
195
|
background_fit_cover: Cobrir
|
|
144
196
|
background_fit_contain: Conter
|
|
@@ -465,8 +517,14 @@ pt-BR:
|
|
|
465
517
|
admin:
|
|
466
518
|
edit:
|
|
467
519
|
back: Voltar
|
|
520
|
+
unauthorized: Você não tem autorização para editar este Extra Block
|
|
521
|
+
create:
|
|
522
|
+
unauthorized: Você não tem autorização para criar Extra Blocks
|
|
468
523
|
update:
|
|
469
524
|
success: Extra Block atualizado com sucesso.
|
|
525
|
+
unauthorized: Você não tem autorização para editar este Extra Block
|
|
526
|
+
destroy:
|
|
527
|
+
unauthorized: Você não tem autorização para excluir Extra Blocks
|
|
470
528
|
errors:
|
|
471
529
|
layout_frozen: O layout deste Extra Block não pode ser alterado. Exclua o bloco e crie um novo para escolher outro layout.
|
|
472
530
|
layout_unknown: O layout selecionado não está registrado.
|
|
@@ -6,6 +6,7 @@ module Decidim
|
|
|
6
6
|
module LandingPageContentBlocksExtensions
|
|
7
7
|
def create
|
|
8
8
|
return super unless params[:manifest_name].to_s == "extra_block"
|
|
9
|
+
return redirect_unauthorized_extra_block(:create) unless domain_authorized_for_extra_blocks?
|
|
9
10
|
|
|
10
11
|
enforce_permission_to_update_resource
|
|
11
12
|
|
|
@@ -31,14 +32,31 @@ module Decidim
|
|
|
31
32
|
end
|
|
32
33
|
end
|
|
33
34
|
|
|
35
|
+
def edit
|
|
36
|
+
return super unless content_block.manifest_name.to_s == "extra_block"
|
|
37
|
+
return render_unauthorized_extra_block_edit unless domain_authorized_for_extra_blocks?
|
|
38
|
+
|
|
39
|
+
enforce_permission_to_update_resource
|
|
40
|
+
@form = form(Decidim::Admin::ContentBlockForm).from_model(content_block)
|
|
41
|
+
render "decidim/admin/shared/landing_page_content_blocks/edit"
|
|
42
|
+
end
|
|
43
|
+
|
|
34
44
|
def update
|
|
35
45
|
return super unless content_block.manifest_name.to_s == "extra_block"
|
|
46
|
+
return redirect_unauthorized_extra_block(:update) unless domain_authorized_for_extra_blocks?
|
|
36
47
|
|
|
37
48
|
enforce_permission_to_update_resource
|
|
38
49
|
@form = form(Decidim::Admin::ContentBlockForm).from_params(params, content_block:)
|
|
39
50
|
update_extra_block
|
|
40
51
|
end
|
|
41
52
|
|
|
53
|
+
def destroy
|
|
54
|
+
return super unless content_block.manifest_name.to_s == "extra_block"
|
|
55
|
+
return redirect_unauthorized_extra_block(:destroy) unless domain_authorized_for_extra_blocks?
|
|
56
|
+
|
|
57
|
+
super
|
|
58
|
+
end
|
|
59
|
+
|
|
42
60
|
# Public wrapper: upstream keeps edit_resource_landing_page_path private.
|
|
43
61
|
def extra_blocks_edit_resource_landing_page_path
|
|
44
62
|
edit_resource_landing_page_path
|
|
@@ -46,6 +64,21 @@ module Decidim
|
|
|
46
64
|
|
|
47
65
|
private
|
|
48
66
|
|
|
67
|
+
def domain_authorized_for_extra_blocks?
|
|
68
|
+
Decidim::ExtraBlocks::Availability.domain_authorized?(current_organization, current_user)
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
def redirect_unauthorized_extra_block(action)
|
|
72
|
+
flash[:error] = I18n.t("decidim.extra_blocks.admin.#{action}.unauthorized")
|
|
73
|
+
redirect_to edit_resource_landing_page_path
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
def render_unauthorized_extra_block_edit
|
|
77
|
+
enforce_permission_to_update_resource
|
|
78
|
+
@extra_blocks_back_path = edit_resource_landing_page_path
|
|
79
|
+
render "decidim/extra_blocks/admin/landing_page_content_blocks/unauthorized_edit"
|
|
80
|
+
end
|
|
81
|
+
|
|
49
82
|
def update_extra_block
|
|
50
83
|
Decidim::Admin::ContentBlocks::UpdateContentBlock.call(@form, content_block, content_block_scope) do
|
|
51
84
|
on(:ok) do
|
|
@@ -14,9 +14,7 @@ module Decidim
|
|
|
14
14
|
return mail_object unless headers[:to]
|
|
15
15
|
|
|
16
16
|
recipients = Array(headers[:to]).map(&:to_s)
|
|
17
|
-
if recipients.any? { |address| address.end_with?("example.org") }
|
|
18
|
-
mail_object.perform_deliveries = false
|
|
19
|
-
end
|
|
17
|
+
mail_object.perform_deliveries = false if recipients.any? { |address| address.end_with?("example.org") }
|
|
20
18
|
|
|
21
19
|
mail_object
|
|
22
20
|
end
|
|
@@ -4,6 +4,7 @@ module Decidim
|
|
|
4
4
|
module ExtraBlocks
|
|
5
5
|
# Org-scoped enablement for the Extra Blocks module and layout categories.
|
|
6
6
|
# Missing JSON keys default to enabled (backward compatible).
|
|
7
|
+
# Domain authorization requires organization admin + exact email domain match.
|
|
7
8
|
module Availability
|
|
8
9
|
module_function
|
|
9
10
|
|
|
@@ -29,10 +30,38 @@ module Decidim
|
|
|
29
30
|
:"#{category}_enabled"
|
|
30
31
|
end
|
|
31
32
|
|
|
33
|
+
# True when +user+ is an organization admin and their email domain exactly
|
|
34
|
+
# matches the org's stored +allowed_domain+. Empty domain locks everyone.
|
|
35
|
+
def domain_authorized?(organization, user)
|
|
36
|
+
return false unless user&.admin?
|
|
37
|
+
return false if organization.blank?
|
|
38
|
+
|
|
39
|
+
allowed = allowed_domain(organization)
|
|
40
|
+
return false if allowed.blank?
|
|
41
|
+
|
|
42
|
+
email_domain = email_domain_for(user)
|
|
43
|
+
return false if email_domain.blank?
|
|
44
|
+
|
|
45
|
+
email_domain == allowed
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def allowed_domain(organization)
|
|
49
|
+
Decidim::ExtraBlocks::Admin::ConfigForm.normalize_allowed_domain(
|
|
50
|
+
raw_config(organization)["allowed_domain"]
|
|
51
|
+
)
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def email_domain_for(user)
|
|
55
|
+
email = user.email.to_s.strip.downcase
|
|
56
|
+
return if email.count("@") != 1
|
|
57
|
+
|
|
58
|
+
email.split("@", 2).last.presence
|
|
59
|
+
end
|
|
60
|
+
|
|
32
61
|
def flag_enabled?(organization, key)
|
|
33
62
|
raw = raw_config(organization)
|
|
34
63
|
key_s = key.to_s
|
|
35
|
-
return true unless raw.
|
|
64
|
+
return true unless raw.has_key?(key_s)
|
|
36
65
|
|
|
37
66
|
ActiveModel::Type::Boolean.new.cast(raw[key_s])
|
|
38
67
|
end
|
|
@@ -4,11 +4,11 @@ module Decidim
|
|
|
4
4
|
module ExtraBlocks
|
|
5
5
|
module ContentBlocks
|
|
6
6
|
class RegistryManager
|
|
7
|
-
SCOPES =
|
|
8
|
-
homepage
|
|
9
|
-
participatory_process_homepage
|
|
10
|
-
participatory_process_group_homepage
|
|
11
|
-
assembly_homepage
|
|
7
|
+
SCOPES = [
|
|
8
|
+
:homepage,
|
|
9
|
+
:participatory_process_homepage,
|
|
10
|
+
:participatory_process_group_homepage,
|
|
11
|
+
:assembly_homepage
|
|
12
12
|
].freeze
|
|
13
13
|
|
|
14
14
|
def self.register!
|
|
@@ -6,14 +6,6 @@ require "decidim/core"
|
|
|
6
6
|
require "decidim/proposals"
|
|
7
7
|
require "decidim/toggle"
|
|
8
8
|
|
|
9
|
-
# Decidim 0.29: host installs decidim-ephemeral_participation from gitlab.
|
|
10
|
-
# Decidim >= 0.32: ephemeral users live in decidim-core / decidim-verifications.
|
|
11
|
-
begin
|
|
12
|
-
require "decidim/ephemeral_participation"
|
|
13
|
-
rescue LoadError
|
|
14
|
-
# optional on 0.32+
|
|
15
|
-
end
|
|
16
|
-
|
|
17
9
|
module Decidim
|
|
18
10
|
module ExtraBlocks
|
|
19
11
|
class Engine < ::Rails::Engine
|
|
@@ -38,9 +30,9 @@ module Decidim
|
|
|
38
30
|
initializer "decidim_extra_blocks.dummy_ephemeral_authorization" do
|
|
39
31
|
Decidim::Verifications.register_workflow(:dummy_ephemeral_authorization_handler) do |workflow|
|
|
40
32
|
workflow.form = "Decidim::ExtraBlocks::DummyEphemeralAuthorizationHandler"
|
|
41
|
-
# 0.
|
|
42
|
-
workflow.ephemerable = true if workflow.respond_to?(:ephemerable=)
|
|
33
|
+
# Decidim 0.32+ workflow flag for ephemeral users in verifications.
|
|
43
34
|
workflow.ephemeral = true if workflow.respond_to?(:ephemeral=)
|
|
35
|
+
workflow.ephemerable = true if workflow.respond_to?(:ephemerable=)
|
|
44
36
|
end
|
|
45
37
|
end
|
|
46
38
|
|
|
@@ -77,15 +69,6 @@ module Decidim
|
|
|
77
69
|
Cell::ViewModel.view_paths << File.expand_path("#{Decidim::ExtraBlocks::Engine.root}/app/views")
|
|
78
70
|
end
|
|
79
71
|
|
|
80
|
-
initializer "decidim_extra_blocks.authorization_handler_extensions" do
|
|
81
|
-
config.to_prepare do
|
|
82
|
-
extension = Decidim::ExtraBlocks::AuthorizationHandlerExtensions
|
|
83
|
-
next if Decidim::AuthorizationHandler.included_modules.include?(extension)
|
|
84
|
-
|
|
85
|
-
Decidim::AuthorizationHandler.include(extension)
|
|
86
|
-
end
|
|
87
|
-
end
|
|
88
|
-
|
|
89
72
|
initializer "decidim_extra_blocks.direct_upload", after: "decidim_core.direct_uploader_paths" do
|
|
90
73
|
config.to_prepare do
|
|
91
74
|
extension = Decidim::ExtraBlocks::DirectUploadExtensions
|
|
@@ -134,9 +117,7 @@ module Decidim
|
|
|
134
117
|
Decidim::ContentBlockAttachment.prepend(attachment_extension) unless Decidim::ContentBlockAttachment.ancestors.include?(attachment_extension)
|
|
135
118
|
|
|
136
119
|
mailer_extension = Decidim::ExtraBlocks::ApplicationMailerOverride
|
|
137
|
-
unless Decidim::ApplicationMailer.included_modules.include?(mailer_extension)
|
|
138
|
-
Decidim::ApplicationMailer.include(mailer_extension)
|
|
139
|
-
end
|
|
120
|
+
Decidim::ApplicationMailer.include(mailer_extension) unless Decidim::ApplicationMailer.included_modules.include?(mailer_extension)
|
|
140
121
|
|
|
141
122
|
# BetterHtml rejects Decidim core `_wrapper.html.erb` interpolation; keep validating our gem templates.
|
|
142
123
|
if defined?(BetterHtml)
|
|
@@ -4,6 +4,8 @@ module Decidim
|
|
|
4
4
|
module ExtraBlocks
|
|
5
5
|
module FastProposal
|
|
6
6
|
# Fail-closed gate for Fast Proposal public UI and create command.
|
|
7
|
+
# On Decidim 0.32+, ephemeral create uses a workflow marked ephemeral=true
|
|
8
|
+
# in component create permissions (no separate component setting).
|
|
7
9
|
module EphemeralGate
|
|
8
10
|
module_function
|
|
9
11
|
|
|
@@ -12,15 +14,16 @@ module Decidim
|
|
|
12
14
|
end
|
|
13
15
|
|
|
14
16
|
# Returns i18n reason keys for admin callouts. Empty when the block may render.
|
|
15
|
-
# ponytail: closed_reasons mirrors open? only; upgrade if admin needs rich remediation links per reason
|
|
16
17
|
def closed_reasons(component)
|
|
17
18
|
return [:missing_component] if component.blank?
|
|
18
19
|
|
|
19
20
|
reasons = []
|
|
20
21
|
reasons << :creation_disabled unless creation_enabled?(component)
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
unless organization_authorization(component)
|
|
23
|
+
reasons << :ephemeral_creation_disabled
|
|
24
|
+
reasons << :missing_organization_ephemeral_authorization
|
|
25
|
+
reasons << :missing_ephemeral_authorization_in_permissions
|
|
26
|
+
end
|
|
24
27
|
reasons
|
|
25
28
|
end
|
|
26
29
|
|
|
@@ -28,25 +31,25 @@ module Decidim
|
|
|
28
31
|
component.current_settings.creation_enabled?
|
|
29
32
|
end
|
|
30
33
|
|
|
31
|
-
|
|
32
|
-
component.settings.try(:ephemeral_participation_enabled) == true
|
|
33
|
-
end
|
|
34
|
-
|
|
34
|
+
# Authorization handler name for ephemeral create, or nil when unavailable.
|
|
35
35
|
def organization_authorization(component)
|
|
36
|
-
component.organization.try(:ephemeral_participation_authorization)
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
def create_permission?(component)
|
|
40
|
-
auth = organization_authorization(component)
|
|
41
|
-
return false if auth.blank?
|
|
42
|
-
|
|
43
36
|
handlers = permissions_handlers(component)
|
|
44
|
-
|
|
37
|
+
return if handlers.blank?
|
|
38
|
+
|
|
39
|
+
available = Array(component.organization.available_authorizations).map(&:to_s)
|
|
40
|
+
handlers.keys.map(&:to_s).find do |name|
|
|
41
|
+
available.include?(name) && ephemeral_workflow?(name)
|
|
42
|
+
end
|
|
45
43
|
end
|
|
46
44
|
|
|
47
45
|
def permissions_handlers(component)
|
|
48
46
|
(component.permissions || {}).with_indifferent_access.dig("create", "authorization_handlers")
|
|
49
47
|
end
|
|
48
|
+
|
|
49
|
+
def ephemeral_workflow?(name)
|
|
50
|
+
workflow = Decidim.authorization_workflows.find { |item| item.name.to_s == name.to_s }
|
|
51
|
+
workflow.respond_to?(:ephemeral?) && workflow.ephemeral?
|
|
52
|
+
end
|
|
50
53
|
end
|
|
51
54
|
end
|
|
52
55
|
end
|