decidim-core 0.0.1.alpha9 → 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +0 -25
- data/app/assets/config/decidim_core_manifest.js +1 -0
- data/app/assets/fonts/decidim/Source_Sans_Pro_400.eot +0 -0
- data/app/assets/fonts/decidim/Source_Sans_Pro_400.svg +345 -0
- data/app/assets/fonts/decidim/Source_Sans_Pro_400.ttf +0 -0
- data/app/assets/fonts/decidim/Source_Sans_Pro_400.woff +0 -0
- data/app/assets/fonts/decidim/Source_Sans_Pro_400.woff2 +0 -0
- data/app/assets/fonts/decidim/Source_Sans_Pro_600.eot +0 -0
- data/app/assets/fonts/decidim/Source_Sans_Pro_600.svg +339 -0
- data/app/assets/fonts/decidim/Source_Sans_Pro_600.ttf +0 -0
- data/app/assets/fonts/decidim/Source_Sans_Pro_600.woff +0 -0
- data/app/assets/fonts/decidim/Source_Sans_Pro_600.woff2 +0 -0
- data/app/assets/fonts/decidim/Source_Sans_Pro_900.eot +0 -0
- data/app/assets/fonts/decidim/Source_Sans_Pro_900.svg +342 -0
- data/app/assets/fonts/decidim/Source_Sans_Pro_900.ttf +0 -0
- data/app/assets/fonts/decidim/Source_Sans_Pro_900.woff +0 -0
- data/app/assets/fonts/decidim/Source_Sans_Pro_900.woff2 +0 -0
- data/app/assets/images/decidim/default-avatar.svg +14 -0
- data/app/assets/javascripts/decidim.js.es6 +5 -5
- data/app/assets/javascripts/decidim/editor.js.es6 +46 -0
- data/app/assets/stylesheets/decidim/_variables.scss +12 -13
- data/app/assets/stylesheets/decidim/application.sass +4 -1
- data/app/assets/stylesheets/decidim/editor.sass +4 -0
- data/app/assets/stylesheets/decidim/modules/_card-grid.scss +4 -1
- data/app/assets/stylesheets/decidim/modules/_cards.scss +5 -0
- data/app/assets/stylesheets/decidim/modules/_navbar.scss +1 -0
- data/app/assets/stylesheets/decidim/modules/_process-header.scss +24 -75
- data/app/assets/stylesheets/decidim/modules/_process-nav.scss +0 -1
- data/app/assets/stylesheets/decidim/modules/_process-phase.scss +80 -0
- data/app/assets/stylesheets/decidim/utils/_fontface.scss +39 -1
- data/app/assets/stylesheets/decidim/utils/_helpers.scss +25 -0
- data/app/assets/stylesheets/decidim/utils/_keyframes.scss +21 -0
- data/app/assets/stylesheets/decidim/utils/_mixins.scss +37 -0
- data/app/assets/stylesheets/decidim/utils/_settings.scss +11 -5
- data/app/commands/decidim/authorize_user.rb +2 -2
- data/app/constraints/decidim/current_feature.rb +48 -0
- data/app/controllers/concerns/decidim/form_factory.rb +80 -0
- data/app/controllers/concerns/decidim/locale_switcher.rb +17 -10
- data/app/controllers/concerns/decidim/needs_participatory_process.rb +33 -0
- data/app/controllers/decidim/application_controller.rb +1 -1
- data/app/controllers/decidim/devise/confirmations_controller.rb +1 -1
- data/app/controllers/decidim/devise/passwords_controller.rb +1 -1
- data/app/controllers/decidim/devise/registrations_controller.rb +1 -1
- data/app/controllers/decidim/devise/sessions_controller.rb +16 -2
- data/app/controllers/decidim/pages_controller.rb +14 -0
- data/app/controllers/decidim/participatory_processes_controller.rb +7 -0
- data/app/forms/decidim/form.rb +15 -0
- data/app/forms/translatable_presence_validator.rb +31 -0
- data/app/helpers/decidim/application_helper.rb +17 -2
- data/app/helpers/decidim/layout_helper.rb +8 -1
- data/app/helpers/decidim/localized_locales_helper.rb +43 -0
- data/app/helpers/decidim/participatory_process_helper.rb +16 -0
- data/app/helpers/decidim/translations_helper.rb +17 -0
- data/app/models/decidim/category.rb +35 -0
- data/app/models/decidim/component.rb +51 -0
- data/app/models/decidim/feature.rb +30 -0
- data/app/models/decidim/organization.rb +20 -1
- data/app/models/decidim/participatory_process.rb +43 -4
- data/app/models/decidim/participatory_process_attachment.rb +56 -0
- data/app/models/decidim/scope.rb +14 -0
- data/app/models/decidim/static_page.rb +56 -0
- data/app/models/decidim/user.rb +2 -0
- data/app/queries/decidim/organization_participatory_processes.rb +17 -0
- data/app/services/decidim/authorization_handler.rb +2 -2
- data/app/types/decidim/process_step_type.rb +24 -0
- data/app/types/decidim/process_type.rb +16 -0
- data/app/types/decidim/user_type.rb +14 -0
- data/app/uploaders/decidim/attachment_uploader.rb +70 -0
- data/app/uploaders/decidim/avatar_uploader.rb +14 -0
- data/app/uploaders/decidim/banner_image_uploader.rb +1 -1
- data/app/uploaders/decidim/hero_image_uploader.rb +1 -1
- data/app/uploaders/decidim/homepage_image_uploader.rb +11 -0
- data/app/uploaders/decidim/image_uploader.rb +46 -0
- data/app/uploaders/decidim/organization_logo_uploader.rb +9 -0
- data/app/views/decidim/devise/registrations/new.html.erb +1 -1
- data/app/views/decidim/participatory_processes/_documents.html.erb +26 -0
- data/app/views/decidim/participatory_processes/_photos.html.erb +16 -0
- data/app/views/decidim/participatory_processes/_promoted_process.html.erb +1 -1
- data/app/views/decidim/participatory_processes/show.html.erb +16 -11
- data/app/views/kaminari/decidim/_first_page.html.erb +11 -0
- data/app/views/kaminari/decidim/_gap.html.erb +8 -0
- data/app/views/kaminari/decidim/_last_page.html.erb +11 -0
- data/app/views/kaminari/decidim/_next_page.html.erb +11 -0
- data/app/views/kaminari/decidim/_page.html.erb +12 -0
- data/app/views/kaminari/decidim/_paginator.html.erb +25 -0
- data/app/views/kaminari/decidim/_prev_page.html.erb +11 -0
- data/app/views/layouts/decidim/_application.html.erb +17 -0
- data/app/views/layouts/decidim/_footer.html.erb +5 -3
- data/app/views/layouts/decidim/_header.html.erb +8 -21
- data/app/views/layouts/decidim/_language_chooser.html.erb +14 -0
- data/app/views/layouts/decidim/_logo.html.erb +17 -13
- data/app/views/layouts/decidim/_process_header.html.erb +34 -0
- data/app/views/layouts/decidim/_process_header_steps.html.erb +26 -0
- data/app/views/layouts/decidim/_user_menu.html.erb +2 -0
- data/app/views/layouts/decidim/application.html.erb +3 -0
- data/app/views/layouts/decidim/participatory_process.html.erb +15 -0
- data/app/views/pages/decidim_page.html.erb +12 -0
- data/app/views/pages/home.html.erb +106 -2
- data/config/i18n-tasks.yml +3 -1
- data/config/locales/ca.yml +40 -10
- data/config/locales/en.yml +39 -4
- data/config/locales/es.yml +44 -14
- data/config/routes.rb +14 -1
- data/db/migrate/20160919104837_create_decidim_organizations.rb +4 -0
- data/db/migrate/20161005153007_add_description_to_organizations.rb +1 -3
- data/db/migrate/20161010102356_translate_processes.rb +4 -4
- data/db/migrate/20161017085822_add_participatory_process_steps.rb +3 -3
- data/db/migrate/20161107152228_remove_not_null_on_step_position.rb +5 -0
- data/db/migrate/20161108093802_create_decidim_static_pages.rb +11 -0
- data/db/migrate/20161110092735_add_index_for_process_slug_organization.rb +8 -0
- data/db/migrate/20161110105712_create_decidim_features.rb +9 -0
- data/db/migrate/20161116115156_create_attachments.rb +18 -0
- data/db/migrate/20161123085134_add_categories.rb +10 -0
- data/db/migrate/20161130105257_create_decidim_scopes.rb +9 -0
- data/db/migrate/20161209134715_make_organization_description_optional.rb +5 -0
- data/db/migrate/20161213094244_add_avatar_to_users.rb +5 -0
- data/db/migrate/20161214152811_add_logo_to_organizations.rb +5 -0
- data/db/seeds.rb +36 -6
- data/db/seeds/Exampledocument.pdf +0 -0
- data/{app/assets/images/decidim/hero-home.jpg → db/seeds/homepage_image.jpg} +0 -0
- data/lib/decidim/core.rb +55 -2
- data/lib/decidim/core/engine.rb +16 -2
- data/lib/decidim/core/version.rb +11 -2
- data/lib/decidim/feature_manifest.rb +71 -0
- data/lib/decidim/features.rb +8 -0
- data/lib/decidim/features/base_controller.rb +32 -0
- data/lib/decidim/features/namer.rb +35 -0
- data/lib/decidim/form_builder.rb +140 -6
- data/lib/decidim/page_finder.rb +48 -0
- data/lib/decidim/query_extensions.rb +33 -0
- data/lib/decidim/translatable_attributes.rb +1 -24
- data/vendor/assets/javascripts/quill.min.js +14 -0
- data/vendor/assets/javascripts/quill.min.js.map +1 -0
- data/vendor/assets/stylesheets/quill.bubble.css +843 -0
- data/vendor/assets/stylesheets/quill.core.css +362 -0
- data/vendor/assets/stylesheets/quill.snow.css +881 -0
- metadata +164 -32
- data/LICENSE.txt +0 -619
- data/app/views/decidim/participatory_processes/_process_header_home.html.erb +0 -18
- data/app/views/pages/terms.ca.html.erb +0 -4
- data/app/views/pages/terms.en.html.erb +0 -4
- data/app/views/pages/terms.es.html.erb +0 -4
@@ -26,100 +26,49 @@
|
|
26
26
|
.process-header__container{
|
27
27
|
position: relative;
|
28
28
|
z-index: 1;
|
29
|
-
padding:
|
29
|
+
padding: 0 0 0 1rem;
|
30
30
|
@include breakpoint(mediumlarge){
|
31
31
|
display: flex;
|
32
32
|
align-items: center;
|
33
33
|
}
|
34
34
|
}
|
35
35
|
|
36
|
-
.process-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
margin-left: .5rem;
|
41
|
-
margin-right: .5rem;
|
36
|
+
.process-header__info{
|
37
|
+
padding: 2rem 1.5rem 2rem 1rem;
|
38
|
+
@include breakpoint(mediumlarge){
|
39
|
+
padding-left: 2rem;
|
42
40
|
}
|
43
41
|
}
|
44
42
|
|
45
|
-
.process-
|
46
|
-
|
43
|
+
.process-header__phase{
|
44
|
+
background: rgba($dark-gray, .8);
|
45
|
+
color: $white;
|
46
|
+
text-align: center;
|
47
|
+
padding: 2rem 1rem;
|
48
|
+
margin-left: -1rem;
|
49
|
+
.button{
|
47
50
|
margin-top: 1rem;
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
51
|
+
margin-bottom: 0;
|
52
|
+
color: $white;
|
53
|
+
border-color: $white;
|
54
|
+
&:hover{
|
55
|
+
color: $primary;
|
56
|
+
border-color: $primary;
|
57
|
+
}
|
53
58
|
}
|
54
59
|
}
|
55
60
|
|
56
|
-
.process-
|
57
|
-
display: inline-block;
|
58
|
-
//background: rgba($white, .6);
|
59
|
-
margin-bottom: 8px;
|
60
|
-
line-height: 1;
|
61
|
-
color: white;
|
61
|
+
.process-header__hashtag{
|
62
62
|
font-weight: 600;
|
63
|
-
|
64
|
-
|
65
|
-
@include breakpoint(medium down){
|
66
|
-
margin-right: 1rem;
|
67
|
-
}
|
68
|
-
.action-title{
|
69
|
-
padding: .25rem 0 .25rem .5rem;
|
70
|
-
}
|
71
|
-
.action-icon{
|
72
|
-
background-color: rgba($white, .6);
|
73
|
-
fill: $body-font-color;
|
63
|
+
&::after{
|
64
|
+
content: "·";
|
74
65
|
margin-left: .5rem;
|
75
|
-
|
76
|
-
align-items: center;
|
77
|
-
padding: 0 .25rem;
|
78
|
-
}
|
79
|
-
.icon{
|
80
|
-
width: 14px;
|
81
|
-
height: 14px;
|
82
|
-
}
|
83
|
-
&:hover{
|
84
|
-
color: white;
|
85
|
-
border-color: $primary;
|
86
|
-
.action-icon{
|
87
|
-
background-color: $primary;
|
88
|
-
}
|
89
|
-
.icon{
|
90
|
-
fill: $white;
|
91
|
-
}
|
66
|
+
margin-right: .5rem;
|
92
67
|
}
|
93
68
|
}
|
94
69
|
|
70
|
+
|
95
71
|
.process-header__nav{
|
96
72
|
margin-top: auto;
|
97
73
|
z-index: 1;
|
98
74
|
}
|
99
|
-
|
100
|
-
// Process header home
|
101
|
-
|
102
|
-
.process-header--home{
|
103
|
-
.process-header__container{
|
104
|
-
padding-top: 0;
|
105
|
-
padding-bottom: 0;
|
106
|
-
@include breakpoint(mediumlarge){
|
107
|
-
padding: 0 3rem;
|
108
|
-
}
|
109
|
-
}
|
110
|
-
.process-header__main{
|
111
|
-
padding-top: 3rem;
|
112
|
-
padding-bottom: 3rem;
|
113
|
-
}
|
114
|
-
}
|
115
|
-
|
116
|
-
.process-header--home__cta{
|
117
|
-
position: relative;
|
118
|
-
z-index: 1;
|
119
|
-
text-align: center;
|
120
|
-
margin-top: 3rem;
|
121
|
-
.button{
|
122
|
-
margin-bottom: 0;
|
123
|
-
}
|
124
|
-
|
125
|
-
}
|
@@ -0,0 +1,80 @@
|
|
1
|
+
.phase-title{
|
2
|
+
display: block;
|
3
|
+
font-weight: 600;
|
4
|
+
font-size: 1.1rem;
|
5
|
+
line-height: 1;
|
6
|
+
text-transform: uppercase;
|
7
|
+
.is-inactive & {
|
8
|
+
color: $muted;
|
9
|
+
}
|
10
|
+
}
|
11
|
+
|
12
|
+
.phase-date{
|
13
|
+
color: $muted;
|
14
|
+
font-weight: 600;
|
15
|
+
font-size: 90%;
|
16
|
+
}
|
17
|
+
|
18
|
+
|
19
|
+
.process-header__progress{
|
20
|
+
margin-bottom: 1rem;
|
21
|
+
ol{
|
22
|
+
list-style: none;
|
23
|
+
margin: 0;
|
24
|
+
padding: 0;
|
25
|
+
display: flex;
|
26
|
+
justify-content: space-between;
|
27
|
+
}
|
28
|
+
li{
|
29
|
+
margin: 0;
|
30
|
+
padding: 0;
|
31
|
+
position: relative;
|
32
|
+
width: 100%;
|
33
|
+
text-align: center;
|
34
|
+
&::after{
|
35
|
+
content: "";
|
36
|
+
display: block;
|
37
|
+
height: 2px;
|
38
|
+
width: 100%;
|
39
|
+
background-color: $muted;
|
40
|
+
position: absolute;
|
41
|
+
top: 4px;
|
42
|
+
z-index: 0;
|
43
|
+
}
|
44
|
+
span{
|
45
|
+
display: block;
|
46
|
+
width: 10px;
|
47
|
+
height: 10px;
|
48
|
+
border-radius: 50%;
|
49
|
+
background-color: $muted;
|
50
|
+
margin: auto;
|
51
|
+
z-index: 1;
|
52
|
+
}
|
53
|
+
}
|
54
|
+
//Between 11 and 20 elements
|
55
|
+
li:nth-last-child(n+11):nth-last-child(-n+20):first-child,
|
56
|
+
li:nth-last-child(n+11):nth-last-child(-n+20):first-child ~ li {
|
57
|
+
span{
|
58
|
+
width: 5px;
|
59
|
+
height: 5px;
|
60
|
+
}
|
61
|
+
&::after{
|
62
|
+
height: 1px;
|
63
|
+
top: 2px;
|
64
|
+
}
|
65
|
+
}
|
66
|
+
.phase-item--past{
|
67
|
+
&::after{
|
68
|
+
background-color: $primary;
|
69
|
+
}
|
70
|
+
span{
|
71
|
+
background-color: $primary;
|
72
|
+
opacity: 1;
|
73
|
+
}
|
74
|
+
}
|
75
|
+
}
|
76
|
+
|
77
|
+
.phase-current{
|
78
|
+
font-weight: 600;
|
79
|
+
font-size: 90%;
|
80
|
+
}
|
@@ -1 +1,39 @@
|
|
1
|
-
@
|
1
|
+
@font-face {
|
2
|
+
font-family: 'Source Sans Pro';
|
3
|
+
font-style: normal;
|
4
|
+
font-weight: 400;
|
5
|
+
src:
|
6
|
+
local('Source Sans Pro'),
|
7
|
+
local('SourceSansPro-Regular'),
|
8
|
+
font-url('decidim/Source_Sans_Pro_400.eot?#iefix') format('embedded-opentype'),
|
9
|
+
font-url('decidim/Source_Sans_Pro_400.woff') format('woff'),
|
10
|
+
font-url('decidim/Source_Sans_Pro_400.woff2') format('woff2'),
|
11
|
+
font-url('decidim/Source_Sans_Pro_400.svg#SourceSansPro') format('svg'),
|
12
|
+
font-url('decidim/Source_Sans_Pro_400.ttf') format('truetype');
|
13
|
+
}
|
14
|
+
@font-face {
|
15
|
+
font-family: 'Source Sans Pro';
|
16
|
+
font-style: normal;
|
17
|
+
font-weight: 600;
|
18
|
+
src:
|
19
|
+
local('Source Sans Pro Semibold'),
|
20
|
+
local('SourceSansPro-Semibold'),
|
21
|
+
font-url('decidim/Source_Sans_Pro_600.eot?#iefix') format('embedded-opentype'),
|
22
|
+
font-url('decidim/Source_Sans_Pro_600.woff') format('woff'),
|
23
|
+
font-url('decidim/Source_Sans_Pro_600.woff2') format('woff2'),
|
24
|
+
font-url('decidim/Source_Sans_Pro_600.svg#SourceSansPro') format('svg'),
|
25
|
+
font-url('decidim/Source_Sans_Pro_600.ttf') format('truetype');
|
26
|
+
}
|
27
|
+
@font-face {
|
28
|
+
font-family: 'Source Sans Pro';
|
29
|
+
font-style: normal;
|
30
|
+
font-weight: 900;
|
31
|
+
src:
|
32
|
+
local('Source Sans Pro Black'),
|
33
|
+
local('SourceSansPro-Black'),
|
34
|
+
font-url('decidim/Source_Sans_Pro_900.eot?#iefix') format('embedded-opentype'),
|
35
|
+
font-url('decidim/Source_Sans_Pro_900.woff') format('woff'),
|
36
|
+
font-url('decidim/Source_Sans_Pro_900.woff2') format('woff2'),
|
37
|
+
font-url('decidim/Source_Sans_Pro_900.svg#SourceSansPro') format('svg'),
|
38
|
+
font-url('decidim/Source_Sans_Pro_900.ttf') format('truetype');
|
39
|
+
}
|
@@ -0,0 +1,25 @@
|
|
1
|
+
// Helpers
|
2
|
+
|
3
|
+
.list-reset {
|
4
|
+
margin: 0;
|
5
|
+
padding: 0;
|
6
|
+
list-style: none;
|
7
|
+
}
|
8
|
+
|
9
|
+
.list-inline {
|
10
|
+
> li {
|
11
|
+
display: inline-block;
|
12
|
+
vertical-align: top;
|
13
|
+
}
|
14
|
+
|
15
|
+
> dt {
|
16
|
+
clear: both;
|
17
|
+
margin-right: 0.3em;
|
18
|
+
}
|
19
|
+
|
20
|
+
> dt,
|
21
|
+
> dd {
|
22
|
+
float: left;
|
23
|
+
margin-bottom: 0;
|
24
|
+
}
|
25
|
+
}
|
@@ -0,0 +1,37 @@
|
|
1
|
+
// Mixins
|
2
|
+
|
3
|
+
// Media queries, based on: http://alwaystwisted.com/post.php?s=2013-04-01-my-media-query-mixin
|
4
|
+
|
5
|
+
@mixin mq($point, $query1: min, $query2: width) {
|
6
|
+
@media (#{$query1}-#{$query2}: $point) {
|
7
|
+
@content;
|
8
|
+
}
|
9
|
+
}
|
10
|
+
|
11
|
+
// Centered elements
|
12
|
+
|
13
|
+
@mixin centered {
|
14
|
+
position: absolute;
|
15
|
+
top: 50%;
|
16
|
+
left: 50%;
|
17
|
+
transform: translate(-50%, -50%);
|
18
|
+
}
|
19
|
+
|
20
|
+
// Drop Overlays
|
21
|
+
|
22
|
+
@mixin drop-overlay {
|
23
|
+
content: "";
|
24
|
+
position: absolute;
|
25
|
+
z-index: $z2;
|
26
|
+
top: 0;
|
27
|
+
left: 0;
|
28
|
+
bottom: 0;
|
29
|
+
right: 0;
|
30
|
+
background: rgba(#27353B, 0.6);
|
31
|
+
}
|
32
|
+
|
33
|
+
// Usefull Compass mixins
|
34
|
+
|
35
|
+
// +font-face
|
36
|
+
// +ellipsis
|
37
|
+
// +clearfix
|
@@ -49,13 +49,19 @@ $global-font-size: 100%;
|
|
49
49
|
$global-width: rem-calc(1200);
|
50
50
|
$global-lineheight: 1.5;
|
51
51
|
$foundation-palette: (
|
52
|
-
primary:
|
53
|
-
secondary:
|
54
|
-
success:
|
55
|
-
warning:
|
56
|
-
alert:
|
52
|
+
primary: #ef604d,
|
53
|
+
secondary: #599aa6,
|
54
|
+
success: #57d685,
|
55
|
+
warning: #ffae00,
|
56
|
+
alert: #ec5840,
|
57
57
|
);
|
58
|
+
$light-gray: #fafafa;
|
59
|
+
$medium-gray: #e8e8e8;
|
60
|
+
$dark-gray: #2c2930;
|
61
|
+
$black: #1a181d;
|
62
|
+
$white: #fff;
|
58
63
|
$body-background: $light-gray;
|
64
|
+
$body-font-color: #3D393C;
|
59
65
|
$body-font-family: 'Source Sans Pro', Helvetica, Roboto, Arial, sans-serif;
|
60
66
|
$body-antialiased: true;
|
61
67
|
$global-margin: 1rem;
|
@@ -9,14 +9,14 @@ module Decidim
|
|
9
9
|
@handler = handler
|
10
10
|
end
|
11
11
|
|
12
|
-
# Executes the command.
|
12
|
+
# Executes the command. Broadcasts these events:
|
13
13
|
#
|
14
14
|
# - :ok when everything is valid.
|
15
15
|
# - :invalid if the handler wasn't valid and we couldn't proceed.
|
16
16
|
#
|
17
17
|
# Returns nothing.
|
18
18
|
def call
|
19
|
-
return broadcast(:invalid) unless handler.
|
19
|
+
return broadcast(:invalid) unless handler.authorized?
|
20
20
|
|
21
21
|
create_authorization
|
22
22
|
broadcast(:ok)
|
@@ -0,0 +1,48 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
module Decidim
|
3
|
+
# This class infers the current feature we're scoped to by looking at the
|
4
|
+
# request parameters and injects it into the environment.
|
5
|
+
class CurrentFeature
|
6
|
+
# Public: Initializes the class.
|
7
|
+
#
|
8
|
+
# manifest - The manifest of the feature to check against.
|
9
|
+
def initialize(manifest)
|
10
|
+
@manifest = manifest
|
11
|
+
end
|
12
|
+
|
13
|
+
# Public: Injects the current feature into the environment.
|
14
|
+
#
|
15
|
+
# request - The request that holds the current feature relevant
|
16
|
+
# information.
|
17
|
+
#
|
18
|
+
# Returns nothing.
|
19
|
+
def matches?(request)
|
20
|
+
feature = detect_current_feature(request)
|
21
|
+
return false unless feature
|
22
|
+
|
23
|
+
request.env["decidim.current_participatory_process"] ||= feature.participatory_process
|
24
|
+
request.env["decidim.current_feature"] ||= feature
|
25
|
+
true
|
26
|
+
end
|
27
|
+
|
28
|
+
private
|
29
|
+
|
30
|
+
def detect_current_feature(request)
|
31
|
+
params = request.params
|
32
|
+
env = request.env
|
33
|
+
|
34
|
+
return nil unless params[:feature_id]
|
35
|
+
|
36
|
+
organization = env["decidim.current_organization"]
|
37
|
+
|
38
|
+
Feature.includes(:participatory_process).where(
|
39
|
+
id: params[:feature_id],
|
40
|
+
manifest_name: @manifest.name,
|
41
|
+
decidim_participatory_processes: {
|
42
|
+
id: params[:participatory_process_id],
|
43
|
+
decidim_organization_id: organization.id
|
44
|
+
}
|
45
|
+
).first
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|