decidim-core 0.13.1 → 0.14.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of decidim-core might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/app/assets/config/decidim_core_manifest.js +1 -1
- data/app/assets/images/decidim/gamification/badges/invitations.svg +117 -0
- data/app/assets/javascripts/decidim.js.es6 +4 -1
- data/app/assets/javascripts/decidim/ajax_modals.js.es6 +17 -0
- data/app/assets/javascripts/decidim/conferences.js.es6 +16 -0
- data/app/assets/javascripts/decidim/input_hashtags.js.es6 +115 -0
- data/app/assets/javascripts/decidim/input_mentions.js.es6 +2 -3
- data/app/assets/javascripts/decidim/vizzs/areachart.js.es6 +226 -0
- data/app/assets/javascripts/decidim/vizzs/metrics.js.es6 +26 -0
- data/app/assets/javascripts/decidim/vizzs/orgchart.js.es6 +701 -0
- data/app/assets/javascripts/decidim/vizzs/renders.js.es6 +11 -0
- data/app/assets/stylesheets/decidim/extras/_proposal_form.scss +3 -1
- data/app/assets/stylesheets/decidim/layouts/_home.scss +1 -1
- data/app/assets/stylesheets/decidim/modules/_areachart.scss +74 -0
- data/app/assets/stylesheets/decidim/modules/_badges.scss +116 -0
- data/app/assets/stylesheets/decidim/modules/_buttons.scss +5 -0
- data/app/assets/stylesheets/decidim/modules/_cards.scss +21 -4
- data/app/assets/stylesheets/decidim/modules/_chart-tooltip.scss +42 -0
- data/app/assets/stylesheets/decidim/modules/_collapsible-list.scss +12 -8
- data/app/assets/stylesheets/decidim/modules/_conference-nav.scss +31 -0
- data/app/assets/stylesheets/decidim/modules/_conference-programme.scss +110 -0
- data/app/assets/stylesheets/decidim/modules/_conference-speaker.scss +86 -0
- data/app/assets/stylesheets/decidim/modules/_conversation.scss +58 -0
- data/app/assets/stylesheets/decidim/modules/_help.scss +38 -0
- data/app/assets/stylesheets/decidim/modules/_hover-section.scss +29 -0
- data/app/assets/stylesheets/decidim/modules/_icons.scss +10 -4
- data/app/assets/stylesheets/decidim/modules/_input-hashtags.scss +124 -0
- data/app/assets/stylesheets/decidim/modules/_loading-spinner.scss +12 -0
- data/app/assets/stylesheets/decidim/modules/_margins.scss +2 -2
- data/app/assets/stylesheets/decidim/modules/_modules.scss +15 -0
- data/app/assets/stylesheets/decidim/modules/_navbar.scss +9 -0
- data/app/assets/stylesheets/decidim/modules/_orgchart.scss +62 -0
- data/app/assets/stylesheets/decidim/modules/_status-labels.scss +2 -1
- data/app/assets/stylesheets/decidim/modules/_typography.scss +9 -0
- data/app/assets/stylesheets/decidim/utils/_helpers.scss +28 -0
- data/app/assets/stylesheets/decidim/utils/_mixins.scss +63 -0
- data/app/cells/decidim/author/withdraw.erb +1 -1
- data/app/cells/decidim/author_cell.rb +1 -1
- data/app/cells/decidim/badge/show.erb +36 -0
- data/app/cells/decidim/badge_cell.rb +53 -0
- data/app/cells/decidim/badges/show.erb +6 -0
- data/app/cells/decidim/badges_cell.rb +14 -0
- data/app/cells/decidim/card_m/header.erb +1 -1
- data/app/cells/decidim/card_m/show.erb +1 -2
- data/app/cells/decidim/card_m/top.erb +7 -0
- data/app/cells/decidim/card_m_cell.rb +14 -17
- data/app/cells/decidim/coauthorships_cell.rb +77 -0
- data/app/cells/decidim/collapsible_authors/show.erb +0 -1
- data/app/cells/decidim/collapsible_authors_cell.rb +4 -4
- data/app/cells/decidim/collapsible_list/show.erb +12 -4
- data/app/cells/decidim/collapsible_list_cell.rb +14 -12
- data/app/cells/decidim/content_blocks/footer_sub_hero/show.erb +14 -0
- data/app/cells/decidim/content_blocks/footer_sub_hero_cell.rb +12 -0
- data/app/{views/decidim/pages/home/_hero.html.erb → cells/decidim/content_blocks/hero/show.erb} +4 -4
- data/app/cells/decidim/content_blocks/hero_cell.rb +25 -0
- data/app/cells/decidim/content_blocks/hero_settings_form/show.erb +7 -0
- data/app/cells/decidim/content_blocks/hero_settings_form_cell.rb +13 -0
- data/app/cells/decidim/content_blocks/highlighted_content_banner/show.erb +24 -0
- data/app/cells/decidim/content_blocks/highlighted_content_banner_cell.rb +16 -0
- data/app/{views/decidim/pages/home/_extended.html.erb → cells/decidim/content_blocks/how_to_participate/show.erb} +10 -10
- data/app/cells/decidim/content_blocks/how_to_participate_cell.rb +9 -0
- data/app/{views/decidim/pages/home/_statistics.html.erb → cells/decidim/content_blocks/stats/show.erb} +2 -2
- data/app/cells/decidim/content_blocks/stats_cell.rb +18 -0
- data/app/{views/decidim/pages/home/_sub_hero.html.erb → cells/decidim/content_blocks/sub_hero/show.erb} +2 -2
- data/app/cells/decidim/content_blocks/sub_hero_cell.rb +17 -0
- data/app/cells/decidim/conversation/show.erb +18 -0
- data/app/cells/decidim/conversation_cell.rb +23 -0
- data/app/cells/decidim/conversation_header/show.erb +17 -0
- data/app/cells/decidim/conversation_header_cell.rb +16 -0
- data/app/cells/decidim/conversations/show.erb +45 -0
- data/app/cells/decidim/conversations_cell.rb +24 -0
- data/app/cells/decidim/follow_button/show.erb +3 -3
- data/app/cells/decidim/follow_button_cell.rb +1 -5
- data/app/cells/decidim/following_cell.rb +1 -7
- data/app/cells/decidim/message/show.erb +15 -0
- data/app/cells/decidim/message_cell.rb +23 -0
- data/app/cells/decidim/new_conversation/show.erb +19 -0
- data/app/cells/decidim/new_conversation_cell.rb +19 -0
- data/app/cells/decidim/notifications/show.erb +1 -1
- data/app/cells/decidim/profile/show.erb +27 -0
- data/app/cells/decidim/profile_cell.rb +33 -0
- data/app/cells/decidim/profile_sidebar/show.erb +57 -0
- data/app/cells/decidim/profile_sidebar_cell.rb +31 -0
- data/app/cells/decidim/tos_page_cell.rb +0 -4
- data/app/cells/decidim/user_profile/header.erb +1 -1
- data/app/controllers/concerns/decidim/action_authorization.rb +13 -38
- data/app/controllers/concerns/decidim/needs_permission.rb +15 -6
- data/app/controllers/decidim/application_controller.rb +1 -0
- data/app/controllers/decidim/authorization_modals_controller.rb +35 -0
- data/app/controllers/decidim/components/base_controller.rb +0 -1
- data/app/controllers/decidim/devise/invitations_controller.rb +2 -1
- data/app/controllers/decidim/messaging/conversations_controller.rb +2 -11
- data/app/controllers/decidim/newsletters_controller.rb +4 -6
- data/app/controllers/decidim/notifications_controller.rb +4 -0
- data/app/controllers/decidim/pages_controller.rb +3 -7
- data/app/controllers/decidim/profiles_controller.rb +17 -7
- data/app/forms/decidim/notifications_settings_form.rb +1 -1
- data/app/forms/decidim/registration_form.rb +1 -1
- data/app/helpers/decidim/action_authorization_helper.rb +51 -46
- data/app/helpers/decidim/application_helper.rb +18 -0
- data/app/helpers/decidim/card_helper.rb +1 -1
- data/app/helpers/decidim/cells_helper.rb +6 -2
- data/app/helpers/decidim/resource_helper.rb +8 -1
- data/app/helpers/decidim/searches_helper.rb +5 -4
- data/app/helpers/decidim/traceability_helper.rb +5 -1
- data/app/models/decidim/authorization.rb +2 -2
- data/app/models/decidim/content_block.rb +144 -0
- data/app/models/decidim/gamification/badge_score.rb +13 -0
- data/app/models/decidim/messaging/message.rb +1 -1
- data/app/models/decidim/messaging/receipt.rb +1 -1
- data/app/models/decidim/organization.rb +1 -5
- data/app/models/decidim/resource_permission.rb +8 -0
- data/app/models/decidim/searchable_resource.rb +1 -1
- data/app/models/decidim/user.rb +17 -1
- data/app/permissions/decidim/default_permissions.rb +4 -3
- data/app/permissions/decidim/permissions.rb +33 -1
- data/app/presenters/decidim/hashtag_presenter.rb +32 -0
- data/app/presenters/decidim/resource_locator_presenter.rb +13 -0
- data/app/presenters/decidim/user_presenter.rb +1 -1
- data/app/queries/decidim/messaging/user_conversations.rb +1 -1
- data/app/resolvers/decidim/hashtags_resolver.rb +15 -0
- data/app/services/decidim/action_authorizer.rb +9 -8
- data/app/types/decidim/core/date_time_type.rb +1 -1
- data/app/types/decidim/core/hashtag_type.rb +13 -0
- data/app/uploaders/decidim/homepage_image_uploader.rb +1 -1
- data/app/uploaders/decidim/image_uploader.rb +1 -0
- data/app/views/decidim/authorization_modals/show.html.erb +32 -0
- data/app/views/decidim/messaging/conversations/create.js.erb +1 -1
- data/app/views/decidim/messaging/conversations/index.html.erb +1 -51
- data/app/views/decidim/messaging/conversations/new.html.erb +1 -5
- data/app/views/decidim/messaging/conversations/show.html.erb +1 -9
- data/app/views/decidim/messaging/conversations/update.js.erb +1 -1
- data/app/views/decidim/notifications/index.html.erb +1 -0
- data/app/views/decidim/pages/decidim_page.html.erb +9 -0
- data/app/views/decidim/pages/home.html.erb +12 -16
- data/app/views/decidim/pages/index.html.erb +8 -0
- data/app/views/decidim/profiles/_user_follow.erb +2 -2
- data/app/views/decidim/profiles/show.html.erb +1 -37
- data/app/views/decidim/searches/_results.html.erb +1 -1
- data/app/views/decidim/shared/_author_reference.html.erb +1 -1
- data/app/views/decidim/shared/_authorization_modal.html.erb +1 -0
- data/app/views/decidim/shared/_tags.html.erb +1 -1
- data/app/views/kaminari/decidim/_page.html.erb +1 -1
- data/app/views/layouts/decidim/_application.html.erb +6 -1
- data/app/views/layouts/decidim/_edit_link.html.erb +8 -0
- data/app/views/layouts/decidim/_impersonation_warning.html.erb +1 -1
- data/app/views/layouts/decidim/_user_menu.html.erb +2 -2
- data/app/views/layouts/decidim/_wrapper.html.erb +14 -1
- data/config/initializers/carrierwave.rb +15 -0
- data/config/locales/ca.yml +78 -30
- data/config/locales/en.yml +78 -30
- data/config/locales/es-PY.yml +78 -30
- data/config/locales/es.yml +78 -30
- data/config/locales/eu.yml +78 -30
- data/config/locales/fi.yml +262 -214
- data/config/locales/fr.yml +78 -30
- data/config/locales/gl.yml +78 -30
- data/config/locales/hu.yml +781 -0
- data/config/locales/it.yml +78 -30
- data/config/locales/nl.yml +78 -30
- data/config/locales/pl.yml +78 -30
- data/config/locales/pt-BR.yml +106 -58
- data/config/locales/pt.yml +78 -30
- data/config/locales/ru.yml +52 -32
- data/config/locales/sv.yml +183 -135
- data/config/locales/uk.yml +60 -40
- data/config/routes.rb +8 -6
- data/db/migrate/20180705091019_create_decidim_resource_permissions.rb +12 -0
- data/db/migrate/20180706104107_add_nickname_to_managed_users.rb +14 -0
- data/db/migrate/20180706111847_fix_result_follows.rb +9 -0
- data/db/migrate/20180724103814_add_content_blocks.rb +22 -0
- data/db/migrate/20180726112510_create_decidim_hashtags.rb +17 -0
- data/db/migrate/20180730071851_add_core_content_blocks.rb +28 -0
- data/db/migrate/20180802132147_rename_content_block_options_to_settings.rb +7 -0
- data/db/migrate/20180806095628_add_badge_scores.rb +11 -0
- data/db/migrate/20180808135006_add_images_to_content_blocks.rb +7 -0
- data/db/migrate/20180810092428_move_organization_fields_to_hero_content_block.rb +23 -0
- data/db/seeds.rb +10 -2
- data/lib/decidim/api/authorable_interface.rb +1 -1
- data/lib/decidim/coauthorable.rb +1 -0
- data/lib/decidim/content_block_manifest.rb +58 -0
- data/lib/decidim/content_block_registry.rb +87 -0
- data/lib/decidim/content_parsers.rb +1 -0
- data/lib/decidim/content_parsers/hashtag_parser.rb +36 -0
- data/lib/decidim/content_processor.rb +11 -0
- data/lib/decidim/content_renderers.rb +1 -0
- data/lib/decidim/content_renderers/hashtag_renderer.rb +43 -0
- data/lib/decidim/core.rb +28 -6
- data/lib/decidim/core/api.rb +1 -0
- data/lib/decidim/core/engine.rb +52 -1
- data/lib/decidim/core/test.rb +3 -0
- data/lib/decidim/core/test/factories.rb +32 -17
- data/lib/decidim/core/test/shared_examples/authorable_interface_examples.rb +10 -0
- data/lib/decidim/core/test/shared_examples/coauthorable.rb +3 -0
- data/lib/decidim/core/test/shared_examples/edit_link_shared_examples.rb +30 -0
- data/lib/decidim/core/test/shared_examples/has_space_in_mcell_examples.rb +15 -0
- data/lib/decidim/core/test/shared_examples/publicable.rb +1 -1
- data/lib/decidim/core/test/shared_examples/railtie_examples.rb +15 -0
- data/lib/decidim/core/test/shared_examples/scope_helper_examples.rb +1 -0
- data/lib/decidim/core/version.rb +1 -1
- data/lib/decidim/events/base_event.rb +2 -1
- data/lib/decidim/form_builder.rb +9 -3
- data/lib/decidim/friendly_dates.rb +1 -1
- data/lib/decidim/gamification.rb +109 -0
- data/lib/decidim/gamification/badge.rb +54 -0
- data/lib/decidim/gamification/badge_earned_event.rb +9 -0
- data/lib/decidim/gamification/badge_registry.rb +63 -0
- data/lib/decidim/gamification/badge_scorer.rb +118 -0
- data/lib/decidim/gamification/badge_status.rb +41 -0
- data/lib/decidim/gamification/base_event.rb +40 -0
- data/lib/decidim/gamification/level_up_event.rb +9 -0
- data/lib/decidim/hashtag.rb +15 -0
- data/lib/decidim/hashtaggable.rb +20 -0
- data/lib/decidim/query_extensions.rb +10 -0
- data/lib/decidim/resource_manifest.rb +10 -0
- data/lib/decidim/resourceable.rb +13 -0
- data/lib/decidim/search_resource_fields_mapper.rb +8 -3
- data/lib/decidim/searchable.rb +8 -0
- data/lib/decidim/translatable_attributes.rb +6 -18
- data/lib/decidim/view_model.rb +6 -0
- data/lib/devise/models/decidim_newsletterable.rb +1 -1
- data/vendor/assets/javascripts/d3.js +17813 -0
- metadata +125 -27
- data/app/cells/decidim/card_m/author.erb +0 -3
- data/app/cells/decidim/card_m/authors.erb +0 -9
- data/app/views/decidim/messaging/conversations/_message.html.erb +0 -14
- data/app/views/decidim/messaging/conversations/_reply.html.erb +0 -11
- data/app/views/decidim/messaging/conversations/_show.html.erb +0 -21
- data/app/views/decidim/messaging/conversations/_start.html.erb +0 -12
- data/app/views/decidim/pages/home/_footer_sub_hero.html.erb +0 -14
- data/app/views/decidim/pages/home/_highlighted_content_banner.html.erb +0 -26
- data/app/views/decidim/pages/home/_highlighted_processes.html.erb +0 -7
- data/app/views/decidim/profiles/_user.html.erb +0 -59
- data/app/views/decidim/shared/_action_authorization_modal.html.erb +0 -39
- data/app/views/layouts/decidim/_component_authorization_modals.html.erb +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b7cf711571767a927e8e52dc56a137eef847a60b7dbad9ab05cea0196e7ec50d
|
4
|
+
data.tar.gz: bf9f986bc797cd8849d6f8aa2b705166d61fc16992e98373dcaad9562c32b7cd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1b126c116b468bad3a2a7e95670c9fca2900ebc38ec24da63b0584d4fe03a3f8690c2278c3ecb7abfc22b4fe3493fa5001e44b465095f1d2b3c6cbc09653bdcd
|
7
|
+
data.tar.gz: b8aba2f40faa11897e52a330da1b17f1fd7e6813c90dcb82aeed9ef0b72ee6338f3370b67d2b07f3ff7f15d7a2c75126c5abb428137bf6cf390831e7f6b1b61b
|
@@ -0,0 +1,117 @@
|
|
1
|
+
<svg version="1.1" id="invitations-svg"
|
2
|
+
xmlns="http://www.w3.org/2000/svg"
|
3
|
+
xmlns:xlink="http://www.w3.org/1999/xlink" x="0px"
|
4
|
+
y="0px" width="1080px" height="1080px" viewBox="0 0 1080 1080" enable-background="new 0 0 1080 1080" xml:space="preserve">
|
5
|
+
<g id="invitations" class="stroke-primary">
|
6
|
+
<path class="stroke-primary fill-primary" id="_x35_0-pct" fill="#31536E" fill-opacity="0.5" stroke="#31536E" stroke-width="16" stroke-miterlimit="10" d="
|
7
|
+
M558.615,484.287c-1.795,13.101-13.868,22.268-26.971,20.475l-430.091-58.867c-13.102-1.793-22.269-13.867-20.476-26.969
|
8
|
+
l25.128-183.588c1.792-13.101,13.867-22.268,26.969-20.475l430.09,58.867c13.104,1.793,22.271,13.867,20.476,26.969
|
9
|
+
L558.615,484.287z"/>
|
10
|
+
<g id="llave-2">
|
11
|
+
<polyline class="stroke-primary fill-primary" id="_x32_5-pct" fill="#31536E" fill-opacity="0.25" stroke="#31536E" stroke-width="8" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" points="
|
12
|
+
725.15,608.29 795.92,631.312 811.343,619.35 951.072,799.492 994.668,765.676 854.939,585.534 870.773,573.253 865.453,489.109
|
13
|
+
785.277,463.028 710.425,521.088 710.771,526.581 "/>
|
14
|
+
<line fill="none" stroke="#31536E" stroke-width="8" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" x1="822.037" y1="611.055" x2="949.643" y2="775.57"/>
|
15
|
+
<circle fill="none" stroke="#31536E" stroke-width="8" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" cx="851.312" cy="618.65" r="4.164"/>
|
16
|
+
<path fill="none" stroke="#31536E" stroke-width="8" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" d="
|
17
|
+
M883.329,641.242c1.41,1.818,1.08,4.435-0.739,5.844c-1.814,1.41-4.432,1.079-5.842-0.738c-1.409-1.815-1.078-4.433,0.738-5.844
|
18
|
+
C879.305,639.096,881.92,639.428,883.329,641.242z"/>
|
19
|
+
<ellipse transform="matrix(0.7902 -0.6129 0.6129 0.7902 -232.4812 702.6757)" fill="#31536E" stroke="#31536E" stroke-width="8" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" cx="909.955" cy="690.856" rx="8.068" ry="8.328"/>
|
20
|
+
<ellipse transform="matrix(0.79 -0.6131 0.6131 0.79 -244.3098 720.8308)" fill="none" stroke="#31536E" stroke-width="8" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" cx="930.024" cy="717.028" rx="2.706" ry="2.793"/>
|
21
|
+
<ellipse transform="matrix(0.7901 -0.6129 0.6129 0.7901 -255.9333 744.3307)" fill="none" stroke="#31536E" stroke-width="8" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" cx="959.021" cy="745.919" rx="2.705" ry="2.793"/>
|
22
|
+
<path fill="#FFFFFF" stroke="#31536E" stroke-width="8" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" d="
|
23
|
+
M748.271,530.445c-2.446-6.905,2.196-17.128,11.607-24.426c10.754-8.342,23.66-9.706,28.829-3.044
|
24
|
+
c5.165,6.66,0.633,18.822-10.12,27.163c-6.389,4.956-13.539,7.449-19.371,7.26"/>
|
25
|
+
</g>
|
26
|
+
<g id="llave-1">
|
27
|
+
<path fill="#FFFFFF" stroke="#31536E" stroke-width="8" stroke-linejoin="round" stroke-miterlimit="10" d="M614.113,522.867
|
28
|
+
c-15.51,13.144-25.266,32.768-25.266,54.689c0,30.556,19.152,56.628,46.152,66.933v53.651l10.41,12.492L635,724.513v29.149
|
29
|
+
l10,13.186v12.491l5.41,12.492L635,805.713v43.375l24.959,20.82L687,849.088v-204.94c26-10.53,45.135-36.366,45.135-66.591
|
30
|
+
c0-39.575-32.113-71.656-71.688-71.656c-13.148,0-25.486,3.542-36.077,9.723"/>
|
31
|
+
<path fill="none" stroke="#31536E" stroke-width="8" stroke-linejoin="round" stroke-miterlimit="10" d="M649.429,535.988
|
32
|
+
c3.556-2.918,8.105-4.671,13.064-4.671c11.378,0,20.603,9.225,20.603,20.604c0,2.6-0.48,5.087-1.359,7.377
|
33
|
+
c-2.968,7.735-10.465,13.226-19.243,13.226c-11.38,0-20.604-9.225-20.604-20.603c0-1.879,0.252-3.699,0.724-5.429"/>
|
34
|
+
<line fill="none" stroke="#31536E" stroke-width="8" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" x1="672" y1="645" x2="672" y2="838"/>
|
35
|
+
</g>
|
36
|
+
<path fill="none" stroke="#31536E" stroke-width="8" stroke-miterlimit="10" d="M590.754,433.03
|
37
|
+
c-21.271,0-38.517-17.245-38.517-38.517c0-21.272,17.245-38.517,38.517-38.517s38.518,17.245,38.518,38.517
|
38
|
+
c0,16.125-9.91,29.936-23.972,35.674"/>
|
39
|
+
<g>
|
40
|
+
<path fill="none" stroke="#31536E" stroke-width="8" stroke-miterlimit="10" d="M681.732,559.303
|
41
|
+
c-52.018-6.146-92.366-50.394-92.366-104.065c0-57.877,46.918-104.795,104.796-104.795c57.875,0,104.793,46.918,104.793,104.795
|
42
|
+
c0,4.064-0.23,8.074-0.68,12.018"/>
|
43
|
+
<path fill="none" stroke="#31536E" stroke-width="8" stroke-miterlimit="10" d="M682.455,546.806
|
44
|
+
c-45.45-5.752-80.598-44.555-80.598-91.568c0-50.978,41.325-92.304,92.305-92.304c50.977,0,92.302,41.326,92.302,92.304
|
45
|
+
c0,2.717-0.117,5.406-0.348,8.063"/>
|
46
|
+
</g>
|
47
|
+
<path fill="#FFFFFF" stroke="#31536E" stroke-width="8" stroke-miterlimit="10" d="M517.327,448.165
|
48
|
+
c-1.794,13.101-13.868,22.268-26.969,20.475l-355.832-48.703c-13.101-1.793-22.268-13.868-20.476-26.969l16.799-122.736
|
49
|
+
c1.793-13.102,13.867-22.269,26.969-20.476l355.831,48.702c13.102,1.794,22.269,13.868,20.475,26.969L517.327,448.165z"/>
|
50
|
+
<g>
|
51
|
+
<path fill="#FFFFFF" stroke="#31536E" stroke-width="8" stroke-linecap="round" stroke-linejoin="bevel" stroke-miterlimit="10" d="
|
52
|
+
M788.189,501.559c-11.944,24.199-32.955,43.123-58.598,52.332l-6.449-10.99c22.528-7.444,41.213-23.33,52.313-43.91
|
53
|
+
L788.189,501.559z"/>
|
54
|
+
</g>
|
55
|
+
<g id="logo-decidim">
|
56
|
+
<path fill="#FFFFFF" d="M403.485,369.949c-35.105-4.969-59.938-37.072-55.925-72.299l-1.195-0.152
|
57
|
+
c-4.971,35.104-37.074,59.937-72.301,55.924l-0.153,1.196c35.135,4.73,59.968,36.834,55.924,72.301l1.196,0.152
|
58
|
+
c4.731-35.136,36.835-59.968,72.301-55.925L403.485,369.949z"/>
|
59
|
+
<path class="fill-primary" fill="#31536E" d="M403.485,369.949c4.013-35.227-20.819-67.33-55.925-72.299
|
60
|
+
C343.547,332.877,368.379,364.98,403.485,369.949z"/>
|
61
|
+
<path class="fill-primary" fill="#31536E" d="M403.332,371.146c-35.196-4.252-67.3,20.58-72.301,55.925
|
62
|
+
C366.259,431.084,398.362,406.251,403.332,371.146z"/>
|
63
|
+
<path class="fill-primary" fill="#31536E" d="M282.252,289.309l-8.189,64.113l0,0c35.197,4.252,67.301-20.581,72.301-55.924L282.252,289.309z"/>
|
64
|
+
<path class="fill-primary" fill="#31536E" d="M273.911,354.618L273.911,354.618l-8.188,64.112l64.111,8.189
|
65
|
+
C333.849,391.691,309.016,359.587,273.911,354.618z"/>
|
66
|
+
<path class="fill-primary" fill="#31536E" d="M273.911,354.618c-4.252,35.196,20.58,67.3,55.924,72.301
|
67
|
+
C333.849,391.691,309.016,359.587,273.911,354.618z"/>
|
68
|
+
<path class="fill-primary" fill="#31536E" d="M274.063,353.421c35.197,4.252,67.301-20.581,72.301-55.924
|
69
|
+
C310.897,293.453,278.794,318.285,274.063,353.421z"/>
|
70
|
+
</g>
|
71
|
+
<g id="stars-1" class="stars">
|
72
|
+
<path fill="#FFD92B" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" d="
|
73
|
+
M429,158.355C429,143.667,410.333,123,393.645,123C409,123,429,102.667,429,87.645C429,102.667,445.666,123,464.355,123
|
74
|
+
C445.333,123,429,143.667,429,158.355z"/>
|
75
|
+
<g>
|
76
|
+
<circle fill="#FFD92B" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" cx="860.382" cy="125.411" r="13.5"/>
|
77
|
+
<line fill="#FFD92B" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" x1="843.883" y1="108.676" x2="822.67" y2="87.463"/>
|
78
|
+
<line fill="#FFD92B" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" x1="877.824" y1="142.617" x2="899.037" y2="163.83"/>
|
79
|
+
<line fill="#FFD92B" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" x1="877.117" y1="109.383" x2="898.33" y2="88.17"/>
|
80
|
+
<line fill="#FFD92B" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" x1="843.883" y1="142.617" x2="822.67" y2="163.83"/>
|
81
|
+
</g>
|
82
|
+
<g>
|
83
|
+
<line fill="#FFD92B" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" x1="798.612" y1="927.094" x2="772.45" y2="953.258"/>
|
84
|
+
<line fill="#FFD92B" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" x1="763.258" y1="962.449" x2="737.095" y2="988.613"/>
|
85
|
+
<line fill="#FFD92B" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" x1="797.905" y1="988.613" x2="771.742" y2="962.449"/>
|
86
|
+
<line fill="#FFD92B" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" x1="762.551" y1="953.258" x2="736.388" y2="927.094"/>
|
87
|
+
</g>
|
88
|
+
<path fill="#FFD92B" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" d="
|
89
|
+
M1028.592,902.609c0,0-21.566,4.035-26.516,8.983c-4.948,4.948-8.982,26.515-8.982,26.515s-4.035-21.566-8.984-26.515
|
90
|
+
c-4.948-4.948-26.514-8.983-26.514-8.983s22.077-4.546,26.514-8.983c4.438-4.438,8.984-26.515,8.984-26.515
|
91
|
+
s4.034,21.566,8.982,26.515C1007.025,898.574,1028.592,902.609,1028.592,902.609z"/>
|
92
|
+
<g>
|
93
|
+
<circle fill="#FFD92B" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" cx="188.501" cy="902.667" r="16.604"/>
|
94
|
+
<circle fill="#FFD92B" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" cx="152.6" cy="902.667" r="6.432"/>
|
95
|
+
<circle fill="#FFD92B" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" cx="188.501" cy="938.568" r="6.432"/>
|
96
|
+
<circle fill="#FFD92B" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" cx="224.402" cy="902.667" r="6.432"/>
|
97
|
+
<circle fill="#FFD92B" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" cx="188.501" cy="866.766" r="6.432"/>
|
98
|
+
</g>
|
99
|
+
<g>
|
100
|
+
<line fill="#FFD92B" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" x1="358.746" y1="617.973" x2="413.649" y2="672.878"/>
|
101
|
+
<line fill="#FFD92B" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" x1="413.649" y1="617.973" x2="358.746" y2="672.878"/>
|
102
|
+
<line fill="#FFD92B" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" x1="368" y1="645" x2="341" y2="645"/>
|
103
|
+
<line fill="#FFD92B" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" x1="406" y1="645" x2="433" y2="645"/>
|
104
|
+
<line fill="#FFD92B" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" x1="387" y1="664" x2="387" y2="691"/>
|
105
|
+
<line fill="#FFD92B" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" x1="387" y1="626" x2="387" y2="599"/>
|
106
|
+
</g>
|
107
|
+
<g>
|
108
|
+
<line fill="#FFD92B" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" x1="133" y1="98" x2="133" y2="177"/>
|
109
|
+
<line fill="#FFD92B" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" x1="172" y1="138" x2="93" y2="138"/>
|
110
|
+
<circle fill="#FFD92B" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" cx="113" cy="157.5" r="7.039"/>
|
111
|
+
<circle fill="#FFD92B" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" cx="113" cy="117.5" r="7.039"/>
|
112
|
+
<circle fill="#FFD92B" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" cx="153" cy="157.5" r="7.039"/>
|
113
|
+
<circle fill="#FFD92B" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" cx="153" cy="117.5" r="7.039"/>
|
114
|
+
</g>
|
115
|
+
</g>
|
116
|
+
</g>
|
117
|
+
</svg>
|
@@ -16,7 +16,10 @@
|
|
16
16
|
// = require decidim/append_redirect_url_to_modals
|
17
17
|
// = require decidim/editor
|
18
18
|
// = require decidim/input_tags
|
19
|
-
// = require decidim/
|
19
|
+
// = require decidim/input_hashtags
|
20
|
+
// = require decidim/ajax_modals
|
21
|
+
// = require decidim/conferences
|
22
|
+
// = require_tree ./decidim/vizzs
|
20
23
|
|
21
24
|
/* globals svg4everybody */
|
22
25
|
|
@@ -0,0 +1,17 @@
|
|
1
|
+
$(() => {
|
2
|
+
$(document).on("click", "a[data-open-url],button[data-open-url]", (event) => {
|
3
|
+
event.preventDefault();
|
4
|
+
const $link = $(event.currentTarget);
|
5
|
+
const $modal = $(`#${$link.data("open")}`);
|
6
|
+
$modal.html("<div class='loading-spinner'></div>");
|
7
|
+
$.ajax({
|
8
|
+
type: "get",
|
9
|
+
url: $link.data("open-url"),
|
10
|
+
success: (html) => {
|
11
|
+
const $html = $(html);
|
12
|
+
$modal.html($html);
|
13
|
+
$html.foundation();
|
14
|
+
}
|
15
|
+
});
|
16
|
+
});
|
17
|
+
});
|
@@ -0,0 +1,16 @@
|
|
1
|
+
/* eslint-disable no-invalid-this */
|
2
|
+
((exports) => {
|
3
|
+
const { Foundation } = exports;
|
4
|
+
|
5
|
+
$(() => {
|
6
|
+
// True if small devices
|
7
|
+
if (!Foundation.MediaQuery.atLeast("medium")) {
|
8
|
+
const $speaker = $(".js-conference")
|
9
|
+
|
10
|
+
$speaker.hover(function () {
|
11
|
+
const top = $(window).scrollTop() + ($(window).height() * 0.1)
|
12
|
+
$(this).find(".js-bio").css("top", top)
|
13
|
+
})
|
14
|
+
}
|
15
|
+
});
|
16
|
+
})(window)
|
@@ -0,0 +1,115 @@
|
|
1
|
+
// = require tribute
|
2
|
+
|
3
|
+
$(() => {
|
4
|
+
const $hashtagContainer = $(".js-hashtags");
|
5
|
+
const nodatafound = $hashtagContainer.attr("data-noresults");
|
6
|
+
|
7
|
+
// Listener for the event triggered by quilljs
|
8
|
+
let cursor = "";
|
9
|
+
$hashtagContainer.on("quill-position", function(event) {
|
10
|
+
if (event.detail !== null) {
|
11
|
+
cursor = event.detail.index;
|
12
|
+
}
|
13
|
+
});
|
14
|
+
|
15
|
+
/* eslint no-use-before-define: ["error", { "variables": false }]*/
|
16
|
+
let remoteSearch = function(text, cb) {
|
17
|
+
$.post("/api", {query: `{hashtags(name:${text}) {name}}`}).
|
18
|
+
|
19
|
+
then((response) => {
|
20
|
+
let data = response.data.hashtags || {};
|
21
|
+
cb(data)
|
22
|
+
}).fail(function() {
|
23
|
+
cb([])
|
24
|
+
}).always(() => {
|
25
|
+
// This function runs Tribute every single time you type something
|
26
|
+
// So we must evalute DOM properties after each
|
27
|
+
const $parent = $(tribute.current.element).parent()
|
28
|
+
$parent.addClass("is-active")
|
29
|
+
|
30
|
+
// We need to move the container to the wrapper selected
|
31
|
+
const $tribute = $parent.find(".tribute-container");
|
32
|
+
// Remove the inline styles, relative to absolute positioning
|
33
|
+
$tribute.removeAttr("style");
|
34
|
+
})
|
35
|
+
};
|
36
|
+
|
37
|
+
// tribute.js docs - http://github.com/zurb/tribute
|
38
|
+
/* global Tribute*/
|
39
|
+
let tribute = new Tribute({
|
40
|
+
trigger: "#",
|
41
|
+
values: function (text, cb) {
|
42
|
+
remoteSearch(text, (hashtags) => cb(hashtags));
|
43
|
+
},
|
44
|
+
positionMenu: true,
|
45
|
+
menuContainer: null,
|
46
|
+
fillAttr: "name",
|
47
|
+
noMatchTemplate: () => `<li>${nodatafound}</li>`,
|
48
|
+
lookup: (item) => item.name,
|
49
|
+
selectTemplate: function(item) {
|
50
|
+
if (typeof item === "undefined") {
|
51
|
+
return null;
|
52
|
+
}
|
53
|
+
if (this.range.isContentEditable(this.current.element)) {
|
54
|
+
// Check quill.js
|
55
|
+
if ($(this.current.element).hasClass("editor-container")) {
|
56
|
+
let quill = this.current.element.__quill;
|
57
|
+
quill.insertText(cursor - 1, `#${item.original.name} `, Quill.sources.API);
|
58
|
+
// cursor position + hashtag length + "#" sign + space
|
59
|
+
let position = cursor + item.original.name.length + 2;
|
60
|
+
|
61
|
+
let next = 0;
|
62
|
+
if (quill.getLength() > position) {
|
63
|
+
next = position
|
64
|
+
} else {
|
65
|
+
next = quill.getLength() - 1
|
66
|
+
}
|
67
|
+
// Workaround https://github.com/quilljs/quill/issues/731
|
68
|
+
setTimeout(function () {
|
69
|
+
quill.setSelection(next, 0);
|
70
|
+
}, 500);
|
71
|
+
|
72
|
+
return ""
|
73
|
+
}
|
74
|
+
return `<span contenteditable="false">#${item.original.name}</span>`;
|
75
|
+
}
|
76
|
+
return `#${item.original.name}`;
|
77
|
+
},
|
78
|
+
menuItemTemplate: function(item) {
|
79
|
+
let tpl = `<strong>${item.original.name}</strong>`;
|
80
|
+
return tpl;
|
81
|
+
}
|
82
|
+
});
|
83
|
+
|
84
|
+
tribute.attach($hashtagContainer);
|
85
|
+
|
86
|
+
// DOM manipulation
|
87
|
+
$hashtagContainer.on("focusin", (event) => {
|
88
|
+
// Set the parent container relative to the current element
|
89
|
+
|
90
|
+
tribute.menuContainer = event.target.parentNode;
|
91
|
+
});
|
92
|
+
$hashtagContainer.on("focusout", (event) => {
|
93
|
+
let $parent = $(event.target).parent();
|
94
|
+
|
95
|
+
if ($parent.hasClass("is-active")) {
|
96
|
+
$parent.removeClass("is-active");
|
97
|
+
}
|
98
|
+
});
|
99
|
+
$hashtagContainer.on("input", (event) => {
|
100
|
+
let $parent = $(event.target).parent();
|
101
|
+
$parent.removeAttr("style");
|
102
|
+
|
103
|
+
if (tribute.isActive) {
|
104
|
+
// We need to move the container to the wrapper selected
|
105
|
+
let $tribute = $(".tribute-container");
|
106
|
+
$tribute.removeAttr("style");
|
107
|
+
$tribute.appendTo($parent);
|
108
|
+
// Remove the inline styles, relative to absolute positioning
|
109
|
+
// Parent adaptation
|
110
|
+
$parent.addClass("is-active");
|
111
|
+
} else {
|
112
|
+
$parent.removeClass("is-active");
|
113
|
+
}
|
114
|
+
});
|
115
|
+
});
|
@@ -8,15 +8,14 @@ $(() => {
|
|
8
8
|
// EXAMPLE DATA
|
9
9
|
// tag & name properties are mandatory
|
10
10
|
//
|
11
|
-
// sources = [{
|
11
|
+
// const sources = [{
|
12
12
|
// "tag": "barrera",
|
13
13
|
// "name": "Collins Franklin",
|
14
14
|
// },
|
15
15
|
// {
|
16
16
|
// "tag": "woods",
|
17
17
|
// "name": "Nadine Buck",
|
18
|
-
// }
|
19
|
-
// ...]
|
18
|
+
// }]
|
20
19
|
|
21
20
|
// Listener for the event triggered by quilljs
|
22
21
|
let cursor = "";
|
@@ -0,0 +1,226 @@
|
|
1
|
+
/* global d3, DATACHARTS, fetchDatacharts */
|
2
|
+
/* eslint-disable id-length, no-unused-vars, multiline-ternary, no-ternary, no-nested-ternary, no-invalid-this */
|
3
|
+
/* eslint prefer-reflect: ["error", { "exceptions": ["call"] }] */
|
4
|
+
/* eslint dot-location: ["error", "property"] */
|
5
|
+
|
6
|
+
// = require d3
|
7
|
+
|
8
|
+
const renderAreaCharts = () => {
|
9
|
+
// lib
|
10
|
+
const areachart = (opts = {}) => {
|
11
|
+
// parse opts
|
12
|
+
let data = opts.data
|
13
|
+
let title = opts.title
|
14
|
+
let container = d3.select(opts.container)
|
15
|
+
let showAxis = opts.axis
|
16
|
+
let ratio = opts.ratio
|
17
|
+
let showTooltip = opts.tip !== "false"
|
18
|
+
|
19
|
+
// set the dimensions and margins of the graph
|
20
|
+
let margin = {
|
21
|
+
top: 0,
|
22
|
+
right: 0,
|
23
|
+
bottom: 0,
|
24
|
+
left: 0
|
25
|
+
}
|
26
|
+
|
27
|
+
let width = Number(container.node().getBoundingClientRect().width) - margin.left - margin.right
|
28
|
+
let height = (width / ratio) - margin.top - margin.bottom
|
29
|
+
let titlePadding = d3.min([width / 10, 32])
|
30
|
+
|
31
|
+
// set the ranges
|
32
|
+
let x = d3.scaleTime().range([0, width]);
|
33
|
+
let y = d3.scaleLinear().range([height, 0]);
|
34
|
+
|
35
|
+
// define the area
|
36
|
+
let area = d3.area()
|
37
|
+
.x((d) => x(d.key))
|
38
|
+
.y0(height)
|
39
|
+
.y1((d) => y(d.value));
|
40
|
+
|
41
|
+
// define the line
|
42
|
+
let valueline = d3.line()
|
43
|
+
.x((d) => x(d.key))
|
44
|
+
.y((d) => y(d.value));
|
45
|
+
|
46
|
+
let svg = container.append("svg")
|
47
|
+
.attr("width", width + margin.left + margin.right)
|
48
|
+
.attr("height", height + margin.top + margin.bottom)
|
49
|
+
.append("g")
|
50
|
+
.attr("transform", `translate(${margin.left},${margin.top})`);
|
51
|
+
|
52
|
+
// scale the range of the data
|
53
|
+
x.domain(d3.extent(data, (d) => d.key));
|
54
|
+
y.domain([0, d3.max(data, (d) => d.value)]).nice();
|
55
|
+
|
56
|
+
// add the valueline path.
|
57
|
+
let topLine = svg.append("path")
|
58
|
+
.data([data])
|
59
|
+
.attr("class", "line")
|
60
|
+
.attr("d", valueline)
|
61
|
+
|
62
|
+
// add the area
|
63
|
+
svg.append("path")
|
64
|
+
.data([data])
|
65
|
+
.attr("class", "area")
|
66
|
+
.attr("d", area)
|
67
|
+
|
68
|
+
if (showTooltip) {
|
69
|
+
// tooltip
|
70
|
+
let circle = svg.append("circle")
|
71
|
+
.attr("class", "circle")
|
72
|
+
.attr("r", 6)
|
73
|
+
.style("display", "none")
|
74
|
+
|
75
|
+
let tooltip = d3.select("body").append("div")
|
76
|
+
.attr("id", `${container.node().id}-tooltip`)
|
77
|
+
.attr("class", "chart-tooltip")
|
78
|
+
.style("opacity", 0)
|
79
|
+
|
80
|
+
svg
|
81
|
+
.on("mouseover", () => {
|
82
|
+
circle.style("display", null)
|
83
|
+
tooltip.style("opacity", 1)
|
84
|
+
})
|
85
|
+
.on("mouseout", () => {
|
86
|
+
circle.style("display", "none")
|
87
|
+
tooltip.style("opacity", 0)
|
88
|
+
})
|
89
|
+
.on("mousemove", function() {
|
90
|
+
let x0 = x.invert(d3.mouse(this)[0])
|
91
|
+
let i = d3.bisector((d) => d.key).left(data, x0, 1)
|
92
|
+
let d0 = data[i - 1]
|
93
|
+
let d1 = data[i]
|
94
|
+
let d = (x0 - d0.key > d1.key - x0) ? d1 : d0
|
95
|
+
|
96
|
+
// svg position relative to document
|
97
|
+
let coords = {
|
98
|
+
x: window.pageXOffset + container.node().getBoundingClientRect().left,
|
99
|
+
y: window.pageYOffset + container.node().getBoundingClientRect().top
|
100
|
+
}
|
101
|
+
|
102
|
+
let tooltipContent = `
|
103
|
+
<div class="tooltip-content">
|
104
|
+
${d3.timeFormat("%e %B %Y")(d.key)}<br />
|
105
|
+
${d.value.toLocaleString()} propuestas
|
106
|
+
</div>`
|
107
|
+
|
108
|
+
circle.attr("transform", `translate(${x(d.key)},${y(d.value)})`)
|
109
|
+
tooltip.html(tooltipContent)
|
110
|
+
.style("left", `${coords.x + x(d.key)}px`)
|
111
|
+
.style("top", `${coords.y + y(d.value)}px`)
|
112
|
+
})
|
113
|
+
}
|
114
|
+
|
115
|
+
if (showAxis) {
|
116
|
+
let xAxis = d3.axisBottom(x)
|
117
|
+
.ticks(d3.timeMonth)
|
118
|
+
.tickFormat(d3.timeFormat("%b %y"))
|
119
|
+
.tickSize(-height)
|
120
|
+
let yAxis = d3.axisLeft(y)
|
121
|
+
.ticks(5)
|
122
|
+
.tickSize(8)
|
123
|
+
|
124
|
+
let _xAxis = (g) => {
|
125
|
+
g.call(xAxis)
|
126
|
+
g.select(".domain").remove()
|
127
|
+
g.selectAll(".tick line").attr("class", "dashed")
|
128
|
+
g.selectAll(".tick text").attr("y", 6)
|
129
|
+
}
|
130
|
+
let _yAxis = (g) => {
|
131
|
+
g.call(yAxis)
|
132
|
+
g.select(".domain").remove()
|
133
|
+
g.select(".tick:first-of-type").remove()
|
134
|
+
g.selectAll(".tick text").attr("text-anchor", "start").attr("x", 6)
|
135
|
+
}
|
136
|
+
|
137
|
+
// custom X-Axis
|
138
|
+
svg.append("g")
|
139
|
+
.attr("transform", `translate(0,${height})`)
|
140
|
+
.call(_xAxis);
|
141
|
+
|
142
|
+
// custom Y-Axis
|
143
|
+
svg.append("g")
|
144
|
+
.call(_yAxis)
|
145
|
+
|
146
|
+
// last circle (current value)
|
147
|
+
let g = svg.append("g")
|
148
|
+
.data([data])
|
149
|
+
.attr("transform", (d) => `translate(${x(d[d.length - 1].key)},${y(d[d.length - 1].value)})`)
|
150
|
+
|
151
|
+
g.append("circle")
|
152
|
+
.attr("class", "circle")
|
153
|
+
.attr("r", 8)
|
154
|
+
|
155
|
+
g.append("text")
|
156
|
+
.attr("class", "sum")
|
157
|
+
.attr("text-anchor", "end")
|
158
|
+
.attr("dx", -8 * 2)
|
159
|
+
.text((d) => d[d.length - 1].value.toLocaleString())
|
160
|
+
|
161
|
+
} else {
|
162
|
+
// add the title group
|
163
|
+
let g = svg.append("g")
|
164
|
+
.attr("text-anchor", "start")
|
165
|
+
.attr("transform", `translate(${titlePadding},${titlePadding})`)
|
166
|
+
|
167
|
+
g.append("text")
|
168
|
+
.attr("x", 0)
|
169
|
+
.attr("y", 0)
|
170
|
+
.attr("class", "title")
|
171
|
+
.text(title)
|
172
|
+
|
173
|
+
g.append("text")
|
174
|
+
.attr("x", 0)
|
175
|
+
.attr("dy", titlePadding * 2)
|
176
|
+
.attr("class", "sum")
|
177
|
+
.text(Number(data.map((r) => r.value).reduce((a, b) => a + b, 0)).toLocaleString())
|
178
|
+
}
|
179
|
+
}
|
180
|
+
|
181
|
+
return $(".areachart:visible").each((i, container) => {
|
182
|
+
|
183
|
+
// OPTIONAL: Helper function to preprocess the data
|
184
|
+
const parseData = (data) => {
|
185
|
+
// format the data
|
186
|
+
data.forEach((d) => {
|
187
|
+
d.key = d3.isoParse(d.key)
|
188
|
+
d.value = Number(d.value)
|
189
|
+
});
|
190
|
+
|
191
|
+
// order by date
|
192
|
+
return data.sort((x, y) => d3.ascending(x.key, y.key))
|
193
|
+
}
|
194
|
+
|
195
|
+
// OPTIONAL: Helper function to accumulates all data values
|
196
|
+
const aggregate = (agg) => agg.map((item, index, array) => {
|
197
|
+
if (index > 0) {
|
198
|
+
item.value += array[index - 1].value
|
199
|
+
}
|
200
|
+
return item
|
201
|
+
})
|
202
|
+
|
203
|
+
// If there's no data, fetch it
|
204
|
+
if (!DATACHARTS || !DATACHARTS[container.dataset.metric]) {
|
205
|
+
fetchDatacharts()
|
206
|
+
}
|
207
|
+
|
208
|
+
// MANDATORY: HTML must contain which metric should it display
|
209
|
+
let data = DATACHARTS[container.dataset.metric].map((d) => {
|
210
|
+
return { ...d }
|
211
|
+
})
|
212
|
+
|
213
|
+
if (data) {
|
214
|
+
let dataModified = aggregate(parseData(data))
|
215
|
+
|
216
|
+
areachart({
|
217
|
+
container: `#${container.id}`,
|
218
|
+
title: container.dataset.title,
|
219
|
+
data: dataModified,
|
220
|
+
axis: (container.dataset.axis === "true") || false,
|
221
|
+
ratio: container.dataset.ratio.split(":").reduce((a, b) => a / b) || (4 / 3),
|
222
|
+
tip: container.dataset.tip
|
223
|
+
})
|
224
|
+
}
|
225
|
+
})
|
226
|
+
}
|