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.
Files changed (143) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +0 -25
  3. data/app/assets/config/decidim_core_manifest.js +1 -0
  4. data/app/assets/fonts/decidim/Source_Sans_Pro_400.eot +0 -0
  5. data/app/assets/fonts/decidim/Source_Sans_Pro_400.svg +345 -0
  6. data/app/assets/fonts/decidim/Source_Sans_Pro_400.ttf +0 -0
  7. data/app/assets/fonts/decidim/Source_Sans_Pro_400.woff +0 -0
  8. data/app/assets/fonts/decidim/Source_Sans_Pro_400.woff2 +0 -0
  9. data/app/assets/fonts/decidim/Source_Sans_Pro_600.eot +0 -0
  10. data/app/assets/fonts/decidim/Source_Sans_Pro_600.svg +339 -0
  11. data/app/assets/fonts/decidim/Source_Sans_Pro_600.ttf +0 -0
  12. data/app/assets/fonts/decidim/Source_Sans_Pro_600.woff +0 -0
  13. data/app/assets/fonts/decidim/Source_Sans_Pro_600.woff2 +0 -0
  14. data/app/assets/fonts/decidim/Source_Sans_Pro_900.eot +0 -0
  15. data/app/assets/fonts/decidim/Source_Sans_Pro_900.svg +342 -0
  16. data/app/assets/fonts/decidim/Source_Sans_Pro_900.ttf +0 -0
  17. data/app/assets/fonts/decidim/Source_Sans_Pro_900.woff +0 -0
  18. data/app/assets/fonts/decidim/Source_Sans_Pro_900.woff2 +0 -0
  19. data/app/assets/images/decidim/default-avatar.svg +14 -0
  20. data/app/assets/javascripts/decidim.js.es6 +5 -5
  21. data/app/assets/javascripts/decidim/editor.js.es6 +46 -0
  22. data/app/assets/stylesheets/decidim/_variables.scss +12 -13
  23. data/app/assets/stylesheets/decidim/application.sass +4 -1
  24. data/app/assets/stylesheets/decidim/editor.sass +4 -0
  25. data/app/assets/stylesheets/decidim/modules/_card-grid.scss +4 -1
  26. data/app/assets/stylesheets/decidim/modules/_cards.scss +5 -0
  27. data/app/assets/stylesheets/decidim/modules/_navbar.scss +1 -0
  28. data/app/assets/stylesheets/decidim/modules/_process-header.scss +24 -75
  29. data/app/assets/stylesheets/decidim/modules/_process-nav.scss +0 -1
  30. data/app/assets/stylesheets/decidim/modules/_process-phase.scss +80 -0
  31. data/app/assets/stylesheets/decidim/utils/_fontface.scss +39 -1
  32. data/app/assets/stylesheets/decidim/utils/_helpers.scss +25 -0
  33. data/app/assets/stylesheets/decidim/utils/_keyframes.scss +21 -0
  34. data/app/assets/stylesheets/decidim/utils/_mixins.scss +37 -0
  35. data/app/assets/stylesheets/decidim/utils/_settings.scss +11 -5
  36. data/app/commands/decidim/authorize_user.rb +2 -2
  37. data/app/constraints/decidim/current_feature.rb +48 -0
  38. data/app/controllers/concerns/decidim/form_factory.rb +80 -0
  39. data/app/controllers/concerns/decidim/locale_switcher.rb +17 -10
  40. data/app/controllers/concerns/decidim/needs_participatory_process.rb +33 -0
  41. data/app/controllers/decidim/application_controller.rb +1 -1
  42. data/app/controllers/decidim/devise/confirmations_controller.rb +1 -1
  43. data/app/controllers/decidim/devise/passwords_controller.rb +1 -1
  44. data/app/controllers/decidim/devise/registrations_controller.rb +1 -1
  45. data/app/controllers/decidim/devise/sessions_controller.rb +16 -2
  46. data/app/controllers/decidim/pages_controller.rb +14 -0
  47. data/app/controllers/decidim/participatory_processes_controller.rb +7 -0
  48. data/app/forms/decidim/form.rb +15 -0
  49. data/app/forms/translatable_presence_validator.rb +31 -0
  50. data/app/helpers/decidim/application_helper.rb +17 -2
  51. data/app/helpers/decidim/layout_helper.rb +8 -1
  52. data/app/helpers/decidim/localized_locales_helper.rb +43 -0
  53. data/app/helpers/decidim/participatory_process_helper.rb +16 -0
  54. data/app/helpers/decidim/translations_helper.rb +17 -0
  55. data/app/models/decidim/category.rb +35 -0
  56. data/app/models/decidim/component.rb +51 -0
  57. data/app/models/decidim/feature.rb +30 -0
  58. data/app/models/decidim/organization.rb +20 -1
  59. data/app/models/decidim/participatory_process.rb +43 -4
  60. data/app/models/decidim/participatory_process_attachment.rb +56 -0
  61. data/app/models/decidim/scope.rb +14 -0
  62. data/app/models/decidim/static_page.rb +56 -0
  63. data/app/models/decidim/user.rb +2 -0
  64. data/app/queries/decidim/organization_participatory_processes.rb +17 -0
  65. data/app/services/decidim/authorization_handler.rb +2 -2
  66. data/app/types/decidim/process_step_type.rb +24 -0
  67. data/app/types/decidim/process_type.rb +16 -0
  68. data/app/types/decidim/user_type.rb +14 -0
  69. data/app/uploaders/decidim/attachment_uploader.rb +70 -0
  70. data/app/uploaders/decidim/avatar_uploader.rb +14 -0
  71. data/app/uploaders/decidim/banner_image_uploader.rb +1 -1
  72. data/app/uploaders/decidim/hero_image_uploader.rb +1 -1
  73. data/app/uploaders/decidim/homepage_image_uploader.rb +11 -0
  74. data/app/uploaders/decidim/image_uploader.rb +46 -0
  75. data/app/uploaders/decidim/organization_logo_uploader.rb +9 -0
  76. data/app/views/decidim/devise/registrations/new.html.erb +1 -1
  77. data/app/views/decidim/participatory_processes/_documents.html.erb +26 -0
  78. data/app/views/decidim/participatory_processes/_photos.html.erb +16 -0
  79. data/app/views/decidim/participatory_processes/_promoted_process.html.erb +1 -1
  80. data/app/views/decidim/participatory_processes/show.html.erb +16 -11
  81. data/app/views/kaminari/decidim/_first_page.html.erb +11 -0
  82. data/app/views/kaminari/decidim/_gap.html.erb +8 -0
  83. data/app/views/kaminari/decidim/_last_page.html.erb +11 -0
  84. data/app/views/kaminari/decidim/_next_page.html.erb +11 -0
  85. data/app/views/kaminari/decidim/_page.html.erb +12 -0
  86. data/app/views/kaminari/decidim/_paginator.html.erb +25 -0
  87. data/app/views/kaminari/decidim/_prev_page.html.erb +11 -0
  88. data/app/views/layouts/decidim/_application.html.erb +17 -0
  89. data/app/views/layouts/decidim/_footer.html.erb +5 -3
  90. data/app/views/layouts/decidim/_header.html.erb +8 -21
  91. data/app/views/layouts/decidim/_language_chooser.html.erb +14 -0
  92. data/app/views/layouts/decidim/_logo.html.erb +17 -13
  93. data/app/views/layouts/decidim/_process_header.html.erb +34 -0
  94. data/app/views/layouts/decidim/_process_header_steps.html.erb +26 -0
  95. data/app/views/layouts/decidim/_user_menu.html.erb +2 -0
  96. data/app/views/layouts/decidim/application.html.erb +3 -0
  97. data/app/views/layouts/decidim/participatory_process.html.erb +15 -0
  98. data/app/views/pages/decidim_page.html.erb +12 -0
  99. data/app/views/pages/home.html.erb +106 -2
  100. data/config/i18n-tasks.yml +3 -1
  101. data/config/locales/ca.yml +40 -10
  102. data/config/locales/en.yml +39 -4
  103. data/config/locales/es.yml +44 -14
  104. data/config/routes.rb +14 -1
  105. data/db/migrate/20160919104837_create_decidim_organizations.rb +4 -0
  106. data/db/migrate/20161005153007_add_description_to_organizations.rb +1 -3
  107. data/db/migrate/20161010102356_translate_processes.rb +4 -4
  108. data/db/migrate/20161017085822_add_participatory_process_steps.rb +3 -3
  109. data/db/migrate/20161107152228_remove_not_null_on_step_position.rb +5 -0
  110. data/db/migrate/20161108093802_create_decidim_static_pages.rb +11 -0
  111. data/db/migrate/20161110092735_add_index_for_process_slug_organization.rb +8 -0
  112. data/db/migrate/20161110105712_create_decidim_features.rb +9 -0
  113. data/db/migrate/20161116115156_create_attachments.rb +18 -0
  114. data/db/migrate/20161123085134_add_categories.rb +10 -0
  115. data/db/migrate/20161130105257_create_decidim_scopes.rb +9 -0
  116. data/db/migrate/20161209134715_make_organization_description_optional.rb +5 -0
  117. data/db/migrate/20161213094244_add_avatar_to_users.rb +5 -0
  118. data/db/migrate/20161214152811_add_logo_to_organizations.rb +5 -0
  119. data/db/seeds.rb +36 -6
  120. data/db/seeds/Exampledocument.pdf +0 -0
  121. data/{app/assets/images/decidim/hero-home.jpg → db/seeds/homepage_image.jpg} +0 -0
  122. data/lib/decidim/core.rb +55 -2
  123. data/lib/decidim/core/engine.rb +16 -2
  124. data/lib/decidim/core/version.rb +11 -2
  125. data/lib/decidim/feature_manifest.rb +71 -0
  126. data/lib/decidim/features.rb +8 -0
  127. data/lib/decidim/features/base_controller.rb +32 -0
  128. data/lib/decidim/features/namer.rb +35 -0
  129. data/lib/decidim/form_builder.rb +140 -6
  130. data/lib/decidim/page_finder.rb +48 -0
  131. data/lib/decidim/query_extensions.rb +33 -0
  132. data/lib/decidim/translatable_attributes.rb +1 -24
  133. data/vendor/assets/javascripts/quill.min.js +14 -0
  134. data/vendor/assets/javascripts/quill.min.js.map +1 -0
  135. data/vendor/assets/stylesheets/quill.bubble.css +843 -0
  136. data/vendor/assets/stylesheets/quill.core.css +362 -0
  137. data/vendor/assets/stylesheets/quill.snow.css +881 -0
  138. metadata +164 -32
  139. data/LICENSE.txt +0 -619
  140. data/app/views/decidim/participatory_processes/_process_header_home.html.erb +0 -18
  141. data/app/views/pages/terms.ca.html.erb +0 -4
  142. data/app/views/pages/terms.en.html.erb +0 -4
  143. data/app/views/pages/terms.es.html.erb +0 -4
@@ -1,9 +1,12 @@
1
- @import "variables"
2
1
  @import "utils/*"
3
2
 
4
3
  @import foundation
5
4
  @include foundation-everything
6
5
 
6
+ @import "variables"
7
+
7
8
  @import "modules/*"
8
9
  @import "layouts/*"
9
10
  @import "extras/*"
11
+
12
+ @import "editor"
@@ -0,0 +1,4 @@
1
+ @import "quill.snow"
2
+
3
+ .editor-container
4
+ margin-bottom: 1rem
@@ -17,6 +17,9 @@ $card-grid-margin-bottom: map-get($grid-column-gutter, medium);
17
17
  display: flex;
18
18
  flex-direction: column;
19
19
  height: 100%;
20
- justify-content: space-between;
20
+ }
21
+
22
+ .card__content{
23
+ flex-grow: 1;
21
24
  }
22
25
  }
@@ -12,6 +12,11 @@ $card-margin-bottom: map-get($grid-column-gutter, medium);
12
12
 
13
13
  $card-footer-bg: $light-gray-dark;
14
14
 
15
+ $card-proposal: $proposals;
16
+ $card-action: $actions;
17
+ $card-debate: $debates;
18
+ $card-meeting: $meetings;
19
+
15
20
  $datetime-bg: $primary;
16
21
 
17
22
 
@@ -83,6 +83,7 @@ $navbar-active-shadow-medium: inset 0 4px 0 0 $primary;
83
83
  vertical-align: middle;
84
84
  }
85
85
  .is-dropdown-submenu{
86
+ z-index: 2;
86
87
  text-align: left;
87
88
  padding-left: .3rem;
88
89
  background-color: $white;
@@ -26,100 +26,49 @@
26
26
  .process-header__container{
27
27
  position: relative;
28
28
  z-index: 1;
29
- padding: 2rem 1.5rem 1rem;
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-header__hashtag{
37
- font-weight: 600;
38
- &:after{
39
- content: "·";
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-header__actions{
46
- @include breakpoint(medium down){
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
- display: flex;
49
- flex-wrap: wrap;
50
- }
51
- @include breakpoint(mediumlarge){
52
- text-align: right;
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-header__action{
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
- display: inline-flex;
64
- border: 1px solid rgba($white,.8);
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
- display: flex;
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
- }
@@ -7,7 +7,6 @@
7
7
  background-color: $white;
8
8
  border: $border;
9
9
  padding: .75rem $container-padding-y;
10
- margin-top: 1rem;
11
10
  ul{
12
11
  margin: 0;
13
12
  list-style: none;
@@ -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
- @import url(https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,600,900);
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,21 @@
1
+ // Keyframes
2
+
3
+ @keyframes fadeIn {
4
+ 0% {
5
+ opacity: 0;
6
+ }
7
+
8
+ 100% {
9
+ opacity: 1;
10
+ }
11
+ }
12
+
13
+ @keyframes fadeOut {
14
+ 0% {
15
+ opacity: 1;
16
+ }
17
+
18
+ 100% {
19
+ opacity: 0;
20
+ }
21
+ }
@@ -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: $primary,
53
- secondary: $secondary,
54
- success: $success,
55
- warning: $warning,
56
- alert: $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. Braodcasts these events:
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.valid?
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