decidim-decidim_awesome 0.6.0 → 0.6.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +38 -14
- data/app/assets/config/decidim_admin_decidim_awesome_manifest.js +1 -0
- data/app/assets/javascripts/decidim/decidim_awesome/admin/form_exit_warn.js.es6 +30 -0
- data/app/assets/javascripts/decidim/decidim_awesome/awesome_map/legacy_map.js.es6 +14 -4
- data/app/assets/javascripts/decidim/decidim_awesome/awesome_map/legacy_proposals.js.es6 +82 -0
- data/app/assets/javascripts/decidim/decidim_awesome/awesome_map/map.js.es6 +13 -2
- data/app/assets/javascripts/decidim/decidim_awesome/awesome_map/meetings.js.es6 +15 -13
- data/app/assets/javascripts/decidim/decidim_awesome/awesome_map/proposals.js.es6 +29 -13
- data/app/assets/javascripts/decidim/decidim_awesome/editors/quill_editor.js.es6 +1 -1
- data/app/assets/stylesheets/decidim/decidim_awesome/admin.scss +4 -0
- data/app/awesome_overrides/presenters/decidim/menu_presenter_override.rb +31 -0
- data/app/awesome_overrides/presenters/decidim/proposals/proposal_presenter_override.rb +31 -5
- data/app/commands/decidim/decidim_awesome/admin/create_menu_hack.rb +51 -0
- data/app/commands/decidim/decidim_awesome/admin/create_scoped_style.rb +34 -0
- data/app/commands/decidim/decidim_awesome/admin/destroy_menu_hack.rb +47 -0
- data/app/commands/decidim/decidim_awesome/admin/destroy_scoped_style.rb +40 -0
- data/app/commands/decidim/decidim_awesome/admin/update_config.rb +1 -1
- data/app/commands/decidim/decidim_awesome/admin/update_menu_hack.rb +47 -0
- data/app/commands/decidim/decidim_awesome/create_editor_image.rb +5 -3
- data/app/controllers/decidim/decidim_awesome/admin/application_controller.rb +4 -3
- data/app/controllers/decidim/decidim_awesome/admin/config_controller.rb +38 -2
- data/app/controllers/decidim/decidim_awesome/admin/constraints_controller.rb +13 -0
- data/app/controllers/decidim/decidim_awesome/admin/menu_hacks_controller.rb +116 -0
- data/app/controllers/decidim/decidim_awesome/editor_images_controller.rb +1 -1
- data/app/forms/decidim/decidim_awesome/admin/config_form.rb +11 -2
- data/app/forms/decidim/decidim_awesome/admin/constraint_form.rb +0 -2
- data/app/forms/decidim/decidim_awesome/admin/intergram_form.rb +0 -2
- data/app/forms/decidim/decidim_awesome/admin/menu_form.rb +39 -0
- data/app/forms/decidim/decidim_awesome/editor_image_form.rb +2 -0
- data/app/helpers/decidim/decidim_awesome/admin/config_constraints_helpers.rb +5 -1
- data/app/helpers/decidim/decidim_awesome/map_helper.rb +11 -1
- data/app/models/decidim/decidim_awesome/editor_image.rb +4 -3
- data/app/permissions/decidim/decidim_awesome/admin/permissions.rb +19 -0
- data/app/permissions/decidim/decidim_awesome/permissions.rb +2 -0
- data/app/uploaders/decidim/decidim_awesome/image_uploader.rb +9 -0
- data/app/views/decidim/decidim_awesome/admin/config/_form_styles.html.erb +27 -0
- data/app/views/decidim/decidim_awesome/admin/config/show.html.erb +1 -1
- data/app/views/decidim/decidim_awesome/admin/menu_hacks/_form.html.erb +7 -0
- data/app/views/decidim/decidim_awesome/admin/menu_hacks/edit.html.erb +13 -0
- data/app/views/decidim/decidim_awesome/admin/menu_hacks/index.html.erb +44 -0
- data/app/views/decidim/decidim_awesome/admin/menu_hacks/new.html.erb +13 -0
- data/app/views/decidim/decidim_awesome/iframe_component/iframe/show.html.erb +6 -1
- data/app/views/decidim/decidim_awesome/map_component/map/show.html.erb +40 -18
- data/app/views/layouts/decidim/admin/decidim_awesome.html.erb +10 -0
- data/app/views/layouts/decidim/decidim_awesome/_awesome_config.html.erb +1 -1
- data/app/views/layouts/decidim/decidim_awesome/_custom_styles.html.erb +3 -0
- data/app/views/v0.22/layouts/decidim/_head.html.erb +1 -0
- data/app/views/v0.23/layouts/decidim/_head.html.erb +1 -0
- data/config/locales/ca.yml +96 -9
- data/config/locales/cs.yml +91 -4
- data/config/locales/en.yml +70 -4
- data/config/locales/es.yml +125 -38
- data/config/locales/eu.yml +212 -0
- data/config/locales/fr.yml +90 -3
- data/config/locales/nl.yml +212 -0
- data/config/locales/sv.yml +90 -3
- data/lib/decidim/decidim_awesome.rb +27 -0
- data/lib/decidim/decidim_awesome/admin_engine.rb +3 -0
- data/lib/decidim/decidim_awesome/awesome_helpers.rb +16 -0
- data/lib/decidim/decidim_awesome/checksums.yml +8 -0
- data/lib/decidim/decidim_awesome/config.rb +13 -12
- data/lib/decidim/decidim_awesome/engine.rb +1 -1
- data/lib/decidim/decidim_awesome/iframe_component/component.rb +3 -3
- data/lib/decidim/decidim_awesome/map_component/component.rb +6 -0
- data/lib/decidim/decidim_awesome/menu_hacker.rb +88 -0
- data/lib/decidim/decidim_awesome/test/factories.rb +1 -1
- data/lib/decidim/decidim_awesome/test/shared_examples/config_examples.rb +4 -2
- data/lib/decidim/decidim_awesome/test/shared_examples/editor_examples.rb +71 -0
- data/lib/decidim/decidim_awesome/test/shared_examples/menu_hack_contexts.rb +71 -0
- data/lib/decidim/decidim_awesome/version.rb +1 -2
- data/vendor/assets/javascripts/jsrender.min.js +4 -0
- metadata +26 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2be39606cbd0f92bc8232bbd4a1c8b04a27aed18e9a0732668af6f37126d66f4
|
4
|
+
data.tar.gz: 5034f9d65042871ec4be47c313e90c46390e40751003666ea8a93166df087d31
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b2219e00f0a35206d772032e1f259e5283e2085a39bf5f45e47af09a784ece3776c0824ed7dc6d191cdcbf036b34a647fb5c9c172e13f86ef21394f54275fc9a
|
7
|
+
data.tar.gz: e2abb579c41c61b11377c986f692cba8b944671e1876616bf771309b8e62900a05b57582f72f1f458ef17309b55d8030c15727993ad99092c40ac4c4e31fd94a
|
data/README.md
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
|
7
7
|
Usability and UX tweaks for Decidim.
|
8
8
|
|
9
|
-
This plugin allows the administrators to expand the possibilities of Decidim beyond some existing limitations.
|
9
|
+
This plugin allows the administrators to expand the possibilities of Decidim beyond some existing limitations.
|
10
10
|
All tweaks are provided in a optional fashion with granular permissions that let the administrator to choose exactly where to apply those mods. Some tweaks can be applied to any assembly, other in an specific participatory process or even in type of component only.
|
11
11
|
|
12
12
|
**This in beta status, we do not accept any responsibility for breaking anything. Feedback is appreciated though.**
|
@@ -16,7 +16,7 @@ All tweaks are provided in a optional fashion with granular permissions that let
|
|
16
16
|
At Platoniq, we like to explore and combine open tools for enriching democracy in many levels. And also for organizations or companies, not only governments.
|
17
17
|
Currently we are working very closely with the team behind [Decidim](https://decidim.org) because we believe that it is a great software.
|
18
18
|
|
19
|
-
However in Platoniq we have this slogan: "Democracy is fun if you take it seriously" (feel free to ask for T-shirts 😉).
|
19
|
+
However in Platoniq we have this slogan: "Democracy is fun if you take it seriously" (feel free to ask for T-shirts 😉).
|
20
20
|
And, let's face it, sometimes we feel that Decidim lacks a bit of the "fun" part so we created this.
|
21
21
|
Because Decidim is awesome and so is this!
|
22
22
|
|
@@ -33,7 +33,7 @@ Each hack can be scoped to one or more specific participatory spaces or componen
|
|
33
33
|
|
34
34
|
#### 1. Image support for the Quill editor
|
35
35
|
|
36
|
-
Modifies the WYSIWYG editor in Decidim by adding the possibility to insert images. When uploading images, Drag & Drop is supported. Images will be uploaded to the server and inserted as external resources (it doesn't use base64
|
36
|
+
Modifies the WYSIWYG editor in Decidim by adding the possibility to insert images. When uploading images, Drag & Drop is supported. Images will be uploaded to the server and inserted as external resources (it doesn't use base64 in-line encoding).
|
37
37
|
|
38
38
|
This feature allows you use images in newsletters as well.
|
39
39
|
|
@@ -71,13 +71,13 @@ Many scopes can be defined for every tweak.
|
|
71
71
|
|
72
72
|
This is a component you can add in any participatory space. It retrieves all the geolocated content in that participatory space (meetings or proposals) and displays it in a big map.
|
73
73
|
|
74
|
-
It also provides a simple search by category, each category is
|
74
|
+
It also provides a simple search by category, each category is assigned to a different color.
|
75
75
|
|
76
76
|
![Awesome map](examples/awesome-map.png)
|
77
77
|
|
78
78
|
#### 7. Allow Decidim to use custom CSS themes for every tenant
|
79
79
|
|
80
|
-
When
|
80
|
+
When customizing CSS for a Decidim installation, each change affects all the organizations (tenant).
|
81
81
|
|
82
82
|
This feature allows to customize each organization css without affecting the others in the same Decidim installation.
|
83
83
|
|
@@ -89,7 +89,7 @@ This feature allows to customize each organization css without affecting the oth
|
|
89
89
|
4. Modify that file as you like, you can use any SASS function available (such as `@import`)
|
90
90
|
5. Restart your server, enjoy!
|
91
91
|
|
92
|
-
See an example here:
|
92
|
+
See an example here:
|
93
93
|
https://github.com/Platoniq/decidim-demo/tree/master/app/assets/themes
|
94
94
|
|
95
95
|
NOTE: Files presents in the `app/assets/themes` folder are added automatically into the precompile list of Rails by this plugin.
|
@@ -106,14 +106,28 @@ With this feature you can have a support chat in Decidim. It is linked to a [Tel
|
|
106
106
|
|
107
107
|
![Intergram screenshot](examples/intergram.png)
|
108
108
|
|
109
|
+
#### 10. Custom CSS applied only according scoped restrictions
|
110
|
+
|
111
|
+
With this feature you can create directly in the admin a CSS snipped that is only applied globally, in a particular assembly or even a single proposal!
|
112
|
+
|
113
|
+
![CSS screenshot](examples/custom_styles.png)
|
114
|
+
|
115
|
+
#### 11. Change the main menu of Decidim entirely!
|
116
|
+
|
117
|
+
Feel free to hide, modify or add items in the Decidim's main menu. You can also change the order, establish some conditions (like showing only for logged users) or open in a new window.
|
118
|
+
|
119
|
+
![Menu hacks screenshot](examples/menu-1.png)
|
120
|
+
![Menu hacks screenshot](examples/menu-2.png)
|
121
|
+
![Menu hacks screenshot](examples/menu-3.png)
|
122
|
+
![Menu hacks screenshot](examples/menu-4.png)
|
109
123
|
|
110
124
|
#### To be continued...
|
111
125
|
|
112
|
-
Some things in the road-map:
|
126
|
+
Some things in the road-map:
|
113
127
|
|
114
128
|
1. Improve the conversation in comments by allowing images
|
115
|
-
1.
|
116
|
-
1.
|
129
|
+
1. Allow to create non-private surveys where the responding user is known by admins
|
130
|
+
1. Manipulate menus (reorder, change texts, add new items)
|
117
131
|
1. Propose something! or even better send a PR!
|
118
132
|
|
119
133
|
## Installation
|
@@ -121,7 +135,7 @@ Some things in the road-map:
|
|
121
135
|
Add this line to your application's Gemfile:
|
122
136
|
|
123
137
|
```ruby
|
124
|
-
gem "decidim-decidim_awesome", "~> 0.6.
|
138
|
+
gem "decidim-decidim_awesome", "~> 0.6.5"
|
125
139
|
```
|
126
140
|
|
127
141
|
And then execute:
|
@@ -141,7 +155,7 @@ Depending on your Decidim version, choose the corresponding Awesome version to e
|
|
141
155
|
|
142
156
|
## Configuration
|
143
157
|
|
144
|
-
Each tweak can be enabled or disabled by default. It also can be deactivated so
|
158
|
+
Each tweak can be enabled or disabled by default. It also can be deactivated so
|
145
159
|
admins do not even see it.
|
146
160
|
|
147
161
|
In order to personalize default values, create an initializer such as:
|
@@ -244,15 +258,23 @@ DATABASE_USERNAME=<username> DATABASE_PASSWORD=<password> bundle exec rake test_
|
|
244
258
|
DATABASE_USERNAME=<username> DATABASE_PASSWORD=<password> bundle exec rspec
|
245
259
|
```
|
246
260
|
|
247
|
-
However, this project also make use of the gem [Appraisals](https://github.com/thoughtbot/appraisal) in order to test
|
261
|
+
However, this project also make use of the gem [Appraisals](https://github.com/thoughtbot/appraisal) in order to test against several versions of Decidim. The idea is to support same supported versions of Decidim.
|
248
262
|
|
249
263
|
You can run run all tests against all Decidim versions by using:
|
264
|
+
|
250
265
|
```bash
|
251
266
|
bundle exec appraisal install
|
252
|
-
DATABASE_USERNAME=<username> DATABASE_PASSWORD=<password> bundle exec rake test_app
|
267
|
+
DATABASE_USERNAME=<username> DATABASE_PASSWORD=<password> bundle exec appraisal rake test_app
|
253
268
|
DATABASE_USERNAME=<username> DATABASE_PASSWORD=<password> bundle exec appraisal rspec
|
254
269
|
```
|
255
270
|
|
271
|
+
To test a specific apprasail configured version do the following:
|
272
|
+
|
273
|
+
```
|
274
|
+
DATABASE_USERNAME=<username> DATABASE_PASSWORD=<password> bundle exec appraisal decidim-0.23 rake test_app
|
275
|
+
DATABASE_USERNAME=<username> DATABASE_PASSWORD=<password> bundle exec appraisal decidim-0.23 rspec
|
276
|
+
```
|
277
|
+
|
256
278
|
Note that the database user has to have rights to create and drop a database in
|
257
279
|
order to create the dummy test app database.
|
258
280
|
|
@@ -276,13 +298,15 @@ the code coverage report.
|
|
276
298
|
|
277
299
|
### Appraisals commands
|
278
300
|
|
301
|
+
The [Appraisals](Appraisals) file contains the supported versions. In i each version defines the changes respect to the main `Gemfile`.
|
302
|
+
|
279
303
|
Appraisal uses custom gems for testing in the folder `gemfiles`, these gemfiles are generated from the file `Appraisals`. To update definitions do:
|
280
304
|
|
281
305
|
```
|
282
306
|
bundle exec appraisal install
|
283
307
|
```
|
284
308
|
|
285
|
-
To update the Appraisal definitions manually do the following:
|
309
|
+
The former command will take care of updating all configured version. To update the Appraisal definitions manually (not usually necessary) do the following:
|
286
310
|
|
287
311
|
```
|
288
312
|
cd gemfiles
|
@@ -0,0 +1,30 @@
|
|
1
|
+
// = require_self
|
2
|
+
|
3
|
+
$(() => {
|
4
|
+
const $form = $("form.awesome-edit-config");
|
5
|
+
if ($form.length > 0) {
|
6
|
+
$form.find("input, textarea, select").on("change", () => {
|
7
|
+
$form.data("changed", true);
|
8
|
+
});
|
9
|
+
|
10
|
+
const safePath = $form.data("safe-path").split("?")[0];
|
11
|
+
$(document).on("click", "a", (event) => {
|
12
|
+
window.exitUrl = event.currentTarget.href;
|
13
|
+
});
|
14
|
+
$(document).on("submit", "form", (event) => {
|
15
|
+
window.exitUrl = event.currentTarget.action;
|
16
|
+
});
|
17
|
+
|
18
|
+
window.addEventListener("beforeunload", (event) => {
|
19
|
+
const exitUrl = window.exitUrl;
|
20
|
+
const hasChanged = $form.data("changed");
|
21
|
+
window.exitUrl = null;
|
22
|
+
|
23
|
+
if (!hasChanged || (exitUrl && exitUrl.includes(safePath))) {
|
24
|
+
return null;
|
25
|
+
}
|
26
|
+
|
27
|
+
event.returnValue = true;
|
28
|
+
});
|
29
|
+
}
|
30
|
+
});
|
@@ -1,7 +1,8 @@
|
|
1
|
+
// = require jsrender.min
|
1
2
|
// = require decidim/map
|
2
3
|
// = require leaflet.featuregroup.subgroup
|
3
4
|
// = require decidim/decidim_awesome/awesome_map/categories
|
4
|
-
// = require decidim/decidim_awesome/awesome_map/
|
5
|
+
// = require decidim/decidim_awesome/awesome_map/legacy_proposals
|
5
6
|
// = require decidim/decidim_awesome/awesome_map/meetings
|
6
7
|
// = require_self
|
7
8
|
|
@@ -9,9 +10,16 @@
|
|
9
10
|
const { fetchProposals, fetchMeetings, getCategory } = exports.AwesomeMap;
|
10
11
|
|
11
12
|
const collapsedMenu = $("#map").data("collapsed");
|
13
|
+
const show = {
|
14
|
+
withdrawn: $("#map").data("show-withdrawn"),
|
15
|
+
accepted: $("#map").data("show-accepted"),
|
16
|
+
evaluating: $("#map").data("show-evaluating"),
|
17
|
+
notAnswered: $("#map").data("show-not-answered"),
|
18
|
+
rejected: $("#map").data("show-rejected")
|
19
|
+
};
|
12
20
|
const components = $("#map").data("components");
|
13
21
|
const popupMeetingTemplateId = "marker-meeting-popup";
|
14
|
-
const popupProposalTemplateId = "marker-proposal-popup";
|
22
|
+
const popupProposalTemplateId = "legacy-marker-proposal-popup";
|
15
23
|
|
16
24
|
const cluster = L.markerClusterGroup();
|
17
25
|
const amendments = [];
|
@@ -30,7 +38,7 @@
|
|
30
38
|
let tmpl = component.type === "proposals" ? popupProposalTemplateId : popupMeetingTemplateId,
|
31
39
|
node = document.createElement("div");
|
32
40
|
|
33
|
-
$.
|
41
|
+
$($.templates(`#${tmpl}`).render(element)).appendTo(node);
|
34
42
|
|
35
43
|
marker.bindPopup(node, {
|
36
44
|
maxwidth: 640,
|
@@ -99,7 +107,9 @@
|
|
99
107
|
}
|
100
108
|
|
101
109
|
fetchProposals(component, '', (element, marker) => {
|
102
|
-
|
110
|
+
if(show[element.state || 'notAnswered']) {
|
111
|
+
drawMarker(element, marker, component).addTo(layers.proposals.group)
|
112
|
+
}
|
103
113
|
}, () => {
|
104
114
|
// finall call
|
105
115
|
map.fitBounds(cluster.getBounds(), { padding: [50, 50] });
|
@@ -0,0 +1,82 @@
|
|
1
|
+
// = require decidim/decidim_awesome/awesome_map/api_fetcher
|
2
|
+
// = require decidim/decidim_awesome/awesome_map/categories
|
3
|
+
|
4
|
+
((exports) => {
|
5
|
+
const { getCategory } = exports.AwesomeMap;
|
6
|
+
const query = `query ($id: ID!, $after: String!) {
|
7
|
+
component(id: $id) {
|
8
|
+
id
|
9
|
+
__typename
|
10
|
+
... on Proposals {
|
11
|
+
proposals(first: 50, after: $after){
|
12
|
+
pageInfo {
|
13
|
+
hasNextPage
|
14
|
+
endCursor
|
15
|
+
}
|
16
|
+
edges {
|
17
|
+
node {
|
18
|
+
id
|
19
|
+
state
|
20
|
+
title
|
21
|
+
body
|
22
|
+
address
|
23
|
+
coordinates {
|
24
|
+
latitude
|
25
|
+
longitude
|
26
|
+
}
|
27
|
+
amendments {
|
28
|
+
emendation {
|
29
|
+
id
|
30
|
+
}
|
31
|
+
}
|
32
|
+
category {
|
33
|
+
id
|
34
|
+
}
|
35
|
+
}
|
36
|
+
}
|
37
|
+
}
|
38
|
+
}
|
39
|
+
}
|
40
|
+
}`;
|
41
|
+
|
42
|
+
const ProposalIcon = L.DivIcon.SVGIcon.DecidimIcon;
|
43
|
+
|
44
|
+
const createMarker = (element, callback) => {
|
45
|
+
const marker = L.marker([element.coordinates.latitude, element.coordinates.longitude], {
|
46
|
+
icon: new ProposalIcon({
|
47
|
+
fillColor: getCategory(element.category).color
|
48
|
+
})
|
49
|
+
});
|
50
|
+
|
51
|
+
element.body = element.body.replace(/\n/g, "<br>");
|
52
|
+
callback(element, marker);
|
53
|
+
};
|
54
|
+
|
55
|
+
const fetchProposals = (component, after, callback, finalCall = () => {}) => {
|
56
|
+
const variables = {
|
57
|
+
"id": component.id,
|
58
|
+
"after": after
|
59
|
+
};
|
60
|
+
const api = new ApiFetcher(query, variables);
|
61
|
+
api.fetchAll((result) => {
|
62
|
+
if(result) {
|
63
|
+
result.component.proposals.edges.forEach((element) => {
|
64
|
+
if(!element.node) return;
|
65
|
+
|
66
|
+
if(element.node.coordinates) {
|
67
|
+
element.node.link = component.url + '/proposals/' + element.node.id;
|
68
|
+
createMarker(element.node, callback);
|
69
|
+
}
|
70
|
+
});
|
71
|
+
if (result.component.proposals.pageInfo.hasNextPage) {
|
72
|
+
fetchProposals(component, result.component.proposals.pageInfo.endCursor, callback, finalCall);
|
73
|
+
} else {
|
74
|
+
finalCall();
|
75
|
+
}
|
76
|
+
}
|
77
|
+
});
|
78
|
+
};
|
79
|
+
|
80
|
+
exports.AwesomeMap = exports.AwesomeMap || {};
|
81
|
+
exports.AwesomeMap.fetchProposals = fetchProposals;
|
82
|
+
})(window);
|
@@ -1,3 +1,4 @@
|
|
1
|
+
// = require jsrender.min
|
1
2
|
// = require leaflet.featuregroup.subgroup
|
2
3
|
// = require decidim/decidim_awesome/awesome_map/categories
|
3
4
|
// = require decidim/decidim_awesome/awesome_map/proposals
|
@@ -8,6 +9,13 @@
|
|
8
9
|
const { fetchProposals, fetchMeetings, getCategory } = exports.AwesomeMap;
|
9
10
|
|
10
11
|
const collapsedMenu = $("#awesome-map").data("collapsed");
|
12
|
+
const show = {
|
13
|
+
withdrawn: $("#awesome-map").data("show-withdrawn"),
|
14
|
+
accepted: $("#awesome-map").data("show-accepted"),
|
15
|
+
evaluating: $("#awesome-map").data("show-evaluating"),
|
16
|
+
notAnswered: $("#awesome-map").data("show-not-answered"),
|
17
|
+
rejected: $("#awesome-map").data("show-rejected")
|
18
|
+
};
|
11
19
|
const components = $("#awesome-map").data("components");
|
12
20
|
const popupMeetingTemplateId = "marker-meeting-popup";
|
13
21
|
const popupProposalTemplateId = "marker-proposal-popup";
|
@@ -29,7 +37,7 @@
|
|
29
37
|
let tmpl = component.type === "proposals" ? popupProposalTemplateId : popupMeetingTemplateId,
|
30
38
|
node = document.createElement("div");
|
31
39
|
|
32
|
-
$.
|
40
|
+
$($.templates(`#${tmpl}`).render(element)).appendTo(node);
|
33
41
|
|
34
42
|
marker.bindPopup(node, {
|
35
43
|
maxwidth: 640,
|
@@ -98,7 +106,10 @@
|
|
98
106
|
}
|
99
107
|
|
100
108
|
fetchProposals(component, '', (element, marker) => {
|
101
|
-
|
109
|
+
console.log(element.state, show[element.state || 'notAnswered'], show, element);
|
110
|
+
if(show[element.state || 'notAnswered']) {
|
111
|
+
drawMarker(element, marker, component).addTo(layers.proposals.group)
|
112
|
+
}
|
102
113
|
}, () => {
|
103
114
|
// finall call
|
104
115
|
map.fitBounds(cluster.getBounds(), { padding: [50, 50] });
|
@@ -93,7 +93,7 @@
|
|
93
93
|
});
|
94
94
|
|
95
95
|
element.title.translation = ApiFetcher.findTranslation(element.title.translations);
|
96
|
-
element.description.translation = ApiFetcher.findTranslation(element.description.translations)
|
96
|
+
element.description.translation = ApiFetcher.findTranslation(element.description.translations).replace(/\n/g, "<br>");;
|
97
97
|
element.location.translation = ApiFetcher.findTranslation(element.location.translations);
|
98
98
|
element.locationHints.translation = ApiFetcher.findTranslation(element.locationHints.translations);
|
99
99
|
callback(element, marker);
|
@@ -107,19 +107,21 @@
|
|
107
107
|
};
|
108
108
|
const api = new ApiFetcher(query, variables);
|
109
109
|
api.fetchAll((result) => {
|
110
|
-
result
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
element.node.
|
115
|
-
|
116
|
-
|
117
|
-
|
110
|
+
if(result) {
|
111
|
+
result.component.meetings.edges.forEach((element) => {
|
112
|
+
if(!element.node) return;
|
113
|
+
|
114
|
+
if(element.node.coordinates) {
|
115
|
+
element.node.link = component.url + '/meetings/' + element.node.id;
|
116
|
+
createMarker(element.node, callback);
|
117
|
+
}
|
118
|
+
});
|
118
119
|
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
120
|
+
if (result.component.meetings.pageInfo.hasNextPage) {
|
121
|
+
fetchMeetings(component, result.component.meetings.pageInfo.endCursor, callback, finalCall);
|
122
|
+
} else {
|
123
|
+
finalCall();
|
124
|
+
}
|
123
125
|
}
|
124
126
|
});
|
125
127
|
};
|
@@ -16,8 +16,19 @@
|
|
16
16
|
edges {
|
17
17
|
node {
|
18
18
|
id
|
19
|
-
|
20
|
-
|
19
|
+
state
|
20
|
+
title {
|
21
|
+
translations {
|
22
|
+
text
|
23
|
+
locale
|
24
|
+
}
|
25
|
+
}
|
26
|
+
body {
|
27
|
+
translations {
|
28
|
+
text
|
29
|
+
locale
|
30
|
+
}
|
31
|
+
}
|
21
32
|
address
|
22
33
|
coordinates {
|
23
34
|
latitude
|
@@ -47,6 +58,9 @@
|
|
47
58
|
})
|
48
59
|
});
|
49
60
|
|
61
|
+
element.title.translation = ApiFetcher.findTranslation(element.title.translations);
|
62
|
+
element.body.translation = ApiFetcher.findTranslation(element.body.translations).replace(/\n/g, "<br>");
|
63
|
+
|
50
64
|
callback(element, marker);
|
51
65
|
};
|
52
66
|
|
@@ -57,18 +71,20 @@
|
|
57
71
|
};
|
58
72
|
const api = new ApiFetcher(query, variables);
|
59
73
|
api.fetchAll((result) => {
|
60
|
-
result
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
element.node.
|
65
|
-
|
74
|
+
if(result) {
|
75
|
+
result.component.proposals.edges.forEach((element) => {
|
76
|
+
if(!element.node) return;
|
77
|
+
|
78
|
+
if(element.node.coordinates) {
|
79
|
+
element.node.link = component.url + '/proposals/' + element.node.id;
|
80
|
+
createMarker(element.node, callback);
|
81
|
+
}
|
82
|
+
});
|
83
|
+
if (result.component.proposals.pageInfo.hasNextPage) {
|
84
|
+
fetchProposals(component, result.component.proposals.pageInfo.endCursor, callback, finalCall);
|
85
|
+
} else {
|
86
|
+
finalCall();
|
66
87
|
}
|
67
|
-
});
|
68
|
-
if (result.component.proposals.pageInfo.hasNextPage) {
|
69
|
-
fetchProposals(component, result.component.proposals.pageInfo.endCursor, callback, finalCall);
|
70
|
-
} else {
|
71
|
-
finalCall();
|
72
88
|
}
|
73
89
|
});
|
74
90
|
};
|