decidim-core 0.0.7 → 0.0.8.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/config/decidim_core_manifest.js +3 -0
  3. data/app/assets/javascripts/decidim.js.es6 +8 -0
  4. data/app/assets/javascripts/decidim/widget.js.es6 +14 -0
  5. data/app/assets/stylesheets/decidim/extras/_embed.scss +11 -0
  6. data/app/assets/stylesheets/decidim/modules/_datepicker.scss +224 -0
  7. data/app/assets/stylesheets/decidim/modules/_modules.scss +1 -0
  8. data/app/assets/stylesheets/decidim/modules/_share.scss +1 -1
  9. data/app/assets/stylesheets/decidim/widget.scss.erb +25 -0
  10. data/app/controllers/decidim/participatory_process_widgets_controller.rb +17 -0
  11. data/app/controllers/decidim/participatory_processes_controller.rb +1 -0
  12. data/app/controllers/decidim/widgets_controller.rb +30 -0
  13. data/app/helpers/decidim/widget_urls_helper.rb +10 -0
  14. data/app/views/decidim/participatory_process_widgets/show.html.erb +28 -0
  15. data/app/views/decidim/participatory_processes/show.html.erb +1 -0
  16. data/app/views/decidim/shared/_embed_modal.html.erb +19 -0
  17. data/app/views/decidim/widgets/show.js.erb +22 -0
  18. data/app/views/layouts/decidim/_application.html.erb +1 -1
  19. data/app/views/layouts/decidim/widget.html.erb +17 -0
  20. data/config/locales/ca.yml +9 -1
  21. data/config/locales/en.yml +9 -1
  22. data/config/locales/es.yml +9 -1
  23. data/config/locales/eu.yml +0 -2
  24. data/config/locales/fi.yml +0 -2
  25. data/config/locales/fr.yml +9 -0
  26. data/config/locales/nl.yml +373 -0
  27. data/config/routes.rb +1 -0
  28. data/db/migrate/20170404132616_change_steps_end_and_start_date_to_date.rb +6 -0
  29. data/lib/decidim/core/version.rb +2 -2
  30. data/lib/decidim/form_builder.rb +33 -0
  31. data/lib/decidim/has_reference.rb +3 -2
  32. data/lib/tasks/decidim_tasks.rake +0 -5
  33. data/vendor/assets/javascripts/datepicker-locales/foundation-datepicker.ca.js +17 -0
  34. data/vendor/assets/javascripts/datepicker-locales/foundation-datepicker.es.js +14 -0
  35. data/vendor/assets/javascripts/datepicker-locales/foundation-datepicker.eu.js +15 -0
  36. data/vendor/assets/javascripts/datepicker-locales/foundation-datepicker.fi.js +14 -0
  37. data/vendor/assets/javascripts/form_datepicker.js.es6 +30 -0
  38. data/vendor/assets/javascripts/foundation-datepicker.js +1417 -0
  39. metadata +32 -12
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 59aba1722a03f74a972774bc6023125925137b79
4
- data.tar.gz: 71a97c8c7e3b669e142897d9aaf6a6e9f09067be
3
+ metadata.gz: 3668d75cf2fd8dbfe3c88982c0a7aa8593a75cb4
4
+ data.tar.gz: acc926a4029093ffe432873e2098a147873dc478
5
5
  SHA512:
6
- metadata.gz: 2b793c229ce33485dc9ddf1efc8e1af7c5d85fff82b7aa5c959f71b6d6ce2aef597a3ad59234bdcea636eeba942921e1756fa9b30061ec559b2eb044a15ebc63
7
- data.tar.gz: 467bd6ed6b3f823671ea15fa871641779d345a3d6336774d28665a67046799ca613d8c17fd4c7b84f5270d6392c0a6030151564993f977281f78de5a3780a637
6
+ metadata.gz: 3a06d36ae7005c0e40ead54624635638e0c5f21a07049a68ab35f050d79fe96dc4be797c18065cc6abef48422feb397aa745549a0bb2c9d5964b3a1cd1d85a43
7
+ data.tar.gz: 75ebe0193d06c570996545553101d291d77727e4c53bd5944d8845214cd7f68f66a9907e83c1ffe9961ae2d65c9722e0c062cb37c9b9c13da1655230cd99bf74
@@ -5,3 +5,6 @@
5
5
  //= link decidim/orders
6
6
  //= link decidim/map.js
7
7
  //= link decidim/map.css
8
+ //= link_directory ../../../vendor/assets/javascripts/datepicker-locales
9
+ //= link decidim/widget.css
10
+ //= link decidim/widget.js
@@ -2,13 +2,21 @@
2
2
  // = require modernizr
3
3
  // = require svg4everybody.min
4
4
  // = require morphdom
5
+ // = require moment.min
6
+ // = require foundation-datepicker
7
+ // = require form_datepicker
5
8
  // = require decidim/history
6
9
  // = require decidim/append_elements
7
10
  // = require decidim/user_registrations
8
11
 
9
12
  /* globals svg4everybody */
10
13
 
14
+ window.Decidim = window.Decidim || {};
15
+
11
16
  $(() => {
12
17
  $(document).foundation();
13
18
  svg4everybody();
19
+ if (window.Decidim.formDatePicker) {
20
+ window.Decidim.formDatePicker();
21
+ }
14
22
  });
@@ -0,0 +1,14 @@
1
+ window.addEventListener("message", (event) => {
2
+ if (event.data.type === "GET_HEIGHT") {
3
+ const body = document.body;
4
+ const html = document.documentElement;
5
+ const height = Math.max(body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight);
6
+
7
+ parent.postMessage({ type: "SET_HEIGHT", height: height }, "*");
8
+ }
9
+ });
10
+
11
+ $(() => {
12
+ // Set target blank for all widget links.
13
+ $('a').attr('target', '_blank');
14
+ });
@@ -0,0 +1,11 @@
1
+ .reveal--embed {
2
+ overflow-y: hidden;
3
+ .embed__code {
4
+ font-family: monospace;
5
+ background: $light-gray-dark;
6
+ padding: 1em;
7
+ border-radius: .3em;
8
+ font-size: 1em;
9
+ overflow-y: auto;
10
+ }
11
+ }
@@ -0,0 +1,224 @@
1
+ $calendar-bg-color: $white;
2
+ $calendar-border: 1px solid rgba(0, 0, 0, 0.1);
3
+ $calendar-border-color: rgba(0, 0, 0, 0.1);
4
+ $calendar-active-color: $primary-color;
5
+ $calendar-bg-hover: $light-gray;
6
+ $calendar-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
7
+ $calendar-color-old: $medium-gray;
8
+ $calendar-color-disabled: $light-gray;
9
+ $calendar-radius: $global-radius;
10
+ $calendar-font-size: $global-font-size * .9;
11
+
12
+ .datepicker {
13
+ display: none;
14
+ position: absolute;
15
+ padding: 4px;
16
+ margin-top: 1px;
17
+ direction: ltr;
18
+ }
19
+
20
+ .datepicker.dropdown-menu {
21
+ position: absolute;
22
+ top: 100%;
23
+ left: 0;
24
+ z-index: 1000;
25
+ float: left;
26
+ display: none;
27
+ min-width: 160px;
28
+ list-style: none;
29
+ background-color: $calendar-bg-color;
30
+ border: $calendar-border;
31
+ border-radius: $calendar-radius;
32
+ box-shadow: $calendar-shadow;
33
+ background-clip: padding-box;
34
+ font-size: $calendar-font-size;
35
+ line-height: 18px;
36
+ }
37
+
38
+ .datepicker.dropdown-menu th {
39
+ padding: 4px 5px;
40
+ }
41
+
42
+ .datepicker.dropdown-menu td {
43
+ padding: 6px 9px;
44
+ }
45
+
46
+ .datepicker table {
47
+ border: 0;
48
+ margin: 0;
49
+ width: auto;
50
+ }
51
+
52
+ .datepicker table tr td span {
53
+ display: block;
54
+ width: 23%;
55
+ height: 54px;
56
+ line-height: 54px;
57
+ float: left;
58
+ margin: 1%;
59
+ cursor: pointer;
60
+ }
61
+
62
+ .datepicker td {
63
+ text-align: center;
64
+ width: 20px;
65
+ height: 20px;
66
+ border: 0;
67
+ font-size: $calendar-font-size;
68
+ padding: 4px 8px;
69
+ background: $calendar-bg-color;
70
+ cursor: pointer;
71
+ }
72
+
73
+ .datepicker td.active.day,
74
+ .datepicker td.active.year {
75
+ background: $calendar-active-color;
76
+ }
77
+
78
+ .datepicker .day:hover,
79
+ .datepicker .date-switch:hover,
80
+ .datepicker .prev:hover,
81
+ .datepicker .next:hover,
82
+ .datepicker .month:hover,
83
+ .datepicker .year:hover{
84
+ background-color: $calendar-bg-hover;
85
+ &.active{
86
+ background: $calendar-active-color;
87
+ }
88
+ }
89
+
90
+
91
+ .datepicker td.new,
92
+ .datepicker td.old {
93
+ color: $calendar-color-old;
94
+ }
95
+
96
+ .datepicker td span.active {
97
+ background: $calendar-active-color;
98
+ }
99
+
100
+ .datepicker td.day.disabled {
101
+ color: $calendar-color-disabled;
102
+ }
103
+
104
+ .datepicker td span.month.disabled,
105
+ .datepicker td span.year.disabled {
106
+ color: $calendar-color-disabled;
107
+ }
108
+
109
+ .datepicker th {
110
+ text-align: center;
111
+ width: 20px;
112
+ height: 20px;
113
+ border: 0;
114
+ font-size: $calendar-font-size;
115
+ padding: 4px 8px;
116
+ background: $calendar-bg-color;
117
+ cursor: pointer;
118
+ }
119
+
120
+ .datepicker th.active.day,
121
+ .datepicker th.active.year {
122
+ background: $calendar-active-color;
123
+ }
124
+
125
+ .datepicker th.date-switch {
126
+ width: 145px;
127
+ }
128
+
129
+ .datepicker th span.active {
130
+ background: $calendar-active-color;
131
+ }
132
+
133
+ .datepicker .cw {
134
+ font-size: 10px;
135
+ width: 12px;
136
+ padding: 0 2px 0 5px;
137
+ vertical-align: middle;
138
+ }
139
+
140
+ .datepicker.days div.datepicker-days {
141
+ display: block;
142
+ }
143
+
144
+ .datepicker.months div.datepicker-months {
145
+ display: block;
146
+ }
147
+
148
+ .datepicker.years div.datepicker-years {
149
+ display: block;
150
+ }
151
+
152
+ .datepicker thead tr:first-child th {
153
+ cursor: pointer;
154
+ }
155
+
156
+ .datepicker thead tr:first-child th.cw {
157
+ cursor: default;
158
+ background-color: transparent;
159
+ }
160
+
161
+ .datepicker tfoot tr:first-child th {
162
+ cursor: pointer;
163
+ }
164
+
165
+ .datepicker-inline {
166
+ width: 220px;
167
+ }
168
+
169
+ .datepicker-rtl {
170
+ direction: rtl;
171
+ }
172
+
173
+ .datepicker-rtl table tr td span {
174
+ float: right;
175
+ }
176
+
177
+ .datepicker-dropdown {
178
+ top: 0;
179
+ left: 0;
180
+ }
181
+
182
+ .datepicker-dropdown:before {
183
+ content: '';
184
+ display: inline-block;
185
+ border-left: 7px solid transparent;
186
+ border-right: 7px solid transparent;
187
+ border-bottom: 7px solid #ccc;
188
+ border-bottom-color: $calendar-border-color;
189
+ position: absolute;
190
+ top: -7px;
191
+ left: 6px;
192
+ }
193
+
194
+ .datepicker-dropdown:after {
195
+ content: '';
196
+ display: inline-block;
197
+ border-left: 6px solid transparent;
198
+ border-right: 6px solid transparent;
199
+ border-bottom: 6px solid $calendar-bg-color;
200
+ position: absolute;
201
+ top: -6px;
202
+ left: 7px;
203
+ }
204
+
205
+ .datepicker > div,
206
+ .datepicker-dropdown::after,
207
+ .datepicker-dropdown::before {
208
+ display: none;
209
+ }
210
+
211
+ .datepicker-close {
212
+ position: absolute;
213
+ top: -30px;
214
+ right: 0;
215
+ width: 15px;
216
+ height: 30px;
217
+ padding: 0;
218
+ display: none;
219
+ }
220
+
221
+ .table-striped .datepicker table tr td,
222
+ .table-striped .datepicker table tr th {
223
+ background-color: transparent;
224
+ }
@@ -33,6 +33,7 @@
33
33
  @import "order-by";
34
34
  @import "tags";
35
35
  @import "list-docs";
36
+ @import "datepicker";
36
37
 
37
38
  //Process elements
38
39
  @import "process-header";
@@ -25,4 +25,4 @@ $share-color: $muted;
25
25
  text-align: center;
26
26
  padding: .1em 0 0;
27
27
  margin-right: .5em;
28
- }
28
+ }
@@ -0,0 +1,25 @@
1
+ @import "variables";
2
+ @import "utils/*";
3
+
4
+ @import "foundation";
5
+ @include foundation-everything;
6
+
7
+ @import "modules/typography";
8
+ @import "modules/cards";
9
+ @import "modules/author-avatar";
10
+ @import "modules/tags";
11
+
12
+ <% Decidim.feature_manifests.map(&:stylesheet).compact.each do |stylesheet| %>
13
+ @import "<%= stylesheet %>";
14
+ <% end %>
15
+
16
+ body, .column, .card {
17
+ padding: 0;
18
+ margin: 0;
19
+ }
20
+
21
+ .organization {
22
+ margin: 15px 5px 0 5px;
23
+ text-align: right;
24
+ }
25
+
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ class ParticipatoryProcessWidgetsController < Decidim::WidgetsController
5
+ helper_method :model
6
+
7
+ private
8
+
9
+ def model
10
+ @model ||= ParticipatoryProcess.find(params[:participatory_process_id])
11
+ end
12
+
13
+ def iframe_url
14
+ @iframe_url ||= participatory_process_participatory_process_widget_url(model)
15
+ end
16
+ end
17
+ end
@@ -13,6 +13,7 @@ module Decidim
13
13
 
14
14
  helper Decidim::AttachmentsHelper
15
15
  helper Decidim::ParticipatoryProcessHelper
16
+ helper Decidim::WidgetUrlsHelper
16
17
  helper_method :collection, :promoted_participatory_processes, :participatory_processes
17
18
 
18
19
  def index
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ class WidgetsController < Decidim::ApplicationController
5
+ skip_authorization_check only: :show
6
+ skip_before_filter :verify_authenticity_token
7
+ after_action :allow_iframe, only: :show
8
+
9
+ layout 'decidim/widget'
10
+
11
+ helper_method :iframe_url
12
+
13
+ def show
14
+ respond_to do |format|
15
+ format.js { render "decidim/widgets/show" }
16
+ format.html
17
+ end
18
+ end
19
+
20
+ private
21
+
22
+ def iframe_url
23
+ raise NotImplementedError
24
+ end
25
+
26
+ def allow_iframe
27
+ response.headers.delete "X-Frame-Options"
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+ module Decidim
3
+ module WidgetUrlsHelper
4
+ def embed_modal_for(url)
5
+ js_embed_code = "#{content_tag(:script, '', src: url)}"
6
+ embed_code = "#{content_tag(:noscript, content_tag(:iframe, '', src: url.gsub(".js", ".html"), frameborder: 0, scrolling: "vertical"))}"
7
+ render partial: "decidim/shared/embed_modal", locals: { js_embed_code: js_embed_code, embed_code: embed_code }
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,28 @@
1
+ <div class="column">
2
+ <article class="card card--process">
3
+ <%= link_to participatory_process_path(model), class: "card__link" do %>
4
+ <div class="card__image-top"
5
+ style="background-image:url(<%= model.hero_image.url %>)"></div>
6
+ <% end %>
7
+ <div class="card__content">
8
+ <%= link_to participatory_process_path(model), class: "card__link" do %>
9
+ <h4 class="card__title"><%= translated_attribute model.title %></h4>
10
+ <% end %>
11
+ <p class="card__desc"><%== html_truncate(translated_attribute(model.short_description), length: 630, separator: '...') %></p>
12
+ </div>
13
+ <div class="card__footer">
14
+ <div class="card__support">
15
+ <% if model.active_step %>
16
+ <span class="card--process__small">
17
+ <%= t(".active_step", scope: "layouts") %>
18
+ <strong><%= translated_attribute model.active_step.title %></strong>
19
+ </span>
20
+ <% end %>
21
+ <span class="card--process__small"></span>
22
+ <%= link_to participatory_process_path(model), class: "card__button button small" do %>
23
+ <%= t(".take_part", scope: "layouts") %>
24
+ <% end %>
25
+ </div>
26
+ </div>
27
+ </article>
28
+ </div>
@@ -73,6 +73,7 @@
73
73
  <div class="row">
74
74
  <div class="columns section view-side mediumlarge-4 mediumlarge-push-8 large-3 large-push-9">
75
75
  <%= render partial: "decidim/shared/share_modal" %>
76
+ <%= embed_modal_for participatory_process_participatory_process_widget_url(current_participatory_process, format: :js) %>
76
77
  </div>
77
78
  </div>
78
79