decidim-core 0.19.1 → 0.20.0

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.

Files changed (67) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +19 -0
  3. data/app/assets/javascripts/decidim.js.es6 +2 -1
  4. data/app/assets/javascripts/decidim/input_hashtags.js.es6 +1 -1
  5. data/app/assets/javascripts/decidim/input_mentions.js.es6 +112 -50
  6. data/app/assets/stylesheets/decidim/modules/_signup.scss +57 -0
  7. data/app/cells/decidim/coauthorships_cell.rb +2 -6
  8. data/app/cells/decidim/diff_cell.rb +3 -7
  9. data/app/controllers/decidim/application_controller.rb +0 -8
  10. data/app/controllers/decidim/devise/unlocks_controller.rb +25 -0
  11. data/app/controllers/decidim/searches_controller.rb +0 -1
  12. data/app/jobs/decidim/export_participatory_space_job.rb +20 -0
  13. data/app/models/decidim/category.rb +2 -0
  14. data/app/models/decidim/component.rb +2 -0
  15. data/app/models/decidim/user.rb +9 -2
  16. data/app/models/decidim/user_group.rb +7 -0
  17. data/app/presenters/decidim/attachment_presenter.rb +21 -0
  18. data/app/resolvers/decidim/core/user_resolver.rb +61 -0
  19. data/app/scrubbers/decidim/user_input_scrubber.rb +2 -2
  20. data/app/serializers/decidim/exporters/participatory_space_components_serializer.rb +46 -0
  21. data/{lib → app/serializers}/decidim/exporters/serializer.rb +0 -0
  22. data/app/serializers/decidim/importers/importer.rb +25 -0
  23. data/app/serializers/decidim/importers/participatory_space_components_importer.rb +67 -0
  24. data/app/services/decidim/open_data_exporter.rb +1 -1
  25. data/app/uploaders/decidim/banner_image_uploader.rb +0 -1
  26. data/app/views/decidim/devise/invitations/edit.html.erb +4 -2
  27. data/app/views/decidim/devise/registrations/new.html.erb +2 -2
  28. data/app/views/decidim/devise/unlocks/new.html.erb +33 -0
  29. data/app/views/decidim/searches/_filters.html.erb +3 -19
  30. data/app/views/decidim/searches/_resources_filter_block.html.erb +20 -0
  31. data/app/views/devise/mailer/unlock_instructions.html.erb +7 -0
  32. data/app/views/layouts/decidim/_main_footer.html.erb +26 -0
  33. data/app/views/layouts/decidim/_mini_footer.html.erb +21 -0
  34. data/app/views/layouts/decidim/_wrapper.html.erb +7 -50
  35. data/config/initializers/devise.rb +6 -6
  36. data/config/locales/en.yml +0 -10
  37. data/config/routes.rb +1 -0
  38. data/db/migrate/20191028135718_add_lockable_to_users.rb +10 -0
  39. data/db/migrate/20191118120529_add_weight_to_categories.rb +7 -0
  40. data/db/migrate/20191212102051_remove_continuity_badges.rb +13 -0
  41. data/db/seeds.rb +18 -0
  42. data/lib/decidim/acts_as_author.rb +21 -0
  43. data/lib/decidim/component_manifest.rb +45 -4
  44. data/lib/decidim/core.rb +1 -0
  45. data/lib/decidim/core/engine.rb +0 -4
  46. data/lib/decidim/core/test.rb +3 -0
  47. data/lib/decidim/core/test/factories.rb +5 -0
  48. data/lib/decidim/core/test/shared_examples/acts_as_author_examples.rb +12 -0
  49. data/lib/decidim/core/test/shared_examples/comments_examples.rb +41 -2
  50. data/lib/decidim/core/test/shared_examples/searchable_participatory_space_examples.rb +145 -0
  51. data/lib/decidim/core/test/shared_examples/searchable_resources_shared_context.rb +12 -0
  52. data/lib/decidim/core/version.rb +1 -1
  53. data/lib/decidim/exporters.rb +0 -1
  54. data/lib/decidim/exporters/export_manifest.rb +72 -0
  55. data/lib/decidim/faker/localized.rb +10 -0
  56. data/lib/decidim/form_builder.rb +2 -3
  57. data/lib/decidim/participatory_space_manifest.rb +33 -0
  58. data/lib/decidim/participatory_space_resourceable.rb +8 -0
  59. data/lib/decidim/query_extensions.rb +16 -0
  60. data/lib/decidim/resourceable.rb +1 -1
  61. data/lib/decidim/searchable.rb +19 -1
  62. data/vendor/assets/javascripts/tribute.js +1683 -1621
  63. metadata +29 -13
  64. data/app/assets/images/decidim/gamification/badges/continuity.svg +0 -73
  65. data/app/models/decidim/continuity_badge_status.rb +0 -9
  66. data/app/services/decidim/continuity_badge_tracker.rb +0 -64
  67. data/lib/decidim/components/export_manifest.rb +0 -63
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: decidim-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.19.1
4
+ version: 0.20.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josep Jaume Rey Peroy
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2019-12-13 00:00:00.000000000 Z
13
+ date: 2020-01-08 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: active_link_to
@@ -338,14 +338,14 @@ dependencies:
338
338
  requirements:
339
339
  - - "~>"
340
340
  - !ruby/object:Gem::Version
341
- version: '2.2'
341
+ version: 2.3.1
342
342
  type: :runtime
343
343
  prerelease: false
344
344
  version_requirements: !ruby/object:Gem::Requirement
345
345
  requirements:
346
346
  - - "~>"
347
347
  - !ruby/object:Gem::Version
348
- version: '2.2'
348
+ version: 2.3.1
349
349
  - !ruby/object:Gem::Dependency
350
350
  name: mini_magick
351
351
  requirement: !ruby/object:Gem::Requirement
@@ -788,28 +788,28 @@ dependencies:
788
788
  requirements:
789
789
  - - '='
790
790
  - !ruby/object:Gem::Version
791
- version: 0.19.1
791
+ version: 0.20.0
792
792
  type: :runtime
793
793
  prerelease: false
794
794
  version_requirements: !ruby/object:Gem::Requirement
795
795
  requirements:
796
796
  - - '='
797
797
  - !ruby/object:Gem::Version
798
- version: 0.19.1
798
+ version: 0.20.0
799
799
  - !ruby/object:Gem::Dependency
800
800
  name: decidim-dev
801
801
  requirement: !ruby/object:Gem::Requirement
802
802
  requirements:
803
803
  - - '='
804
804
  - !ruby/object:Gem::Version
805
- version: 0.19.1
805
+ version: 0.20.0
806
806
  type: :development
807
807
  prerelease: false
808
808
  version_requirements: !ruby/object:Gem::Requirement
809
809
  requirements:
810
810
  - - '='
811
811
  - !ruby/object:Gem::Version
812
- version: 0.19.1
812
+ version: 0.20.0
813
813
  description: Adds core features so other engines can hook into the framework.
814
814
  email:
815
815
  - josepjaume@gmail.com
@@ -840,7 +840,6 @@ files:
840
840
  - app/assets/images/decidim/cc-badge.png
841
841
  - app/assets/images/decidim/decidim-logo.svg
842
842
  - app/assets/images/decidim/default-avatar.svg
843
- - app/assets/images/decidim/gamification/badges/continuity.svg
844
843
  - app/assets/images/decidim/gamification/badges/followers.svg
845
844
  - app/assets/images/decidim/gamification/badges/invitations.svg
846
845
  - app/assets/images/decidim/icons.svg
@@ -1199,6 +1198,7 @@ files:
1199
1198
  - app/controllers/decidim/devise/passwords_controller.rb
1200
1199
  - app/controllers/decidim/devise/registrations_controller.rb
1201
1200
  - app/controllers/decidim/devise/sessions_controller.rb
1201
+ - app/controllers/decidim/devise/unlocks_controller.rb
1202
1202
  - app/controllers/decidim/doorkeeper/authorizations_controller.rb
1203
1203
  - app/controllers/decidim/doorkeeper/credentials_controller.rb
1204
1204
  - app/controllers/decidim/doorkeeper/token_info_controller.rb
@@ -1320,6 +1320,7 @@ files:
1320
1320
  - app/jobs/decidim/email_notification_generator_job.rb
1321
1321
  - app/jobs/decidim/event_publisher_job.rb
1322
1322
  - app/jobs/decidim/export_job.rb
1323
+ - app/jobs/decidim/export_participatory_space_job.rb
1323
1324
  - app/jobs/decidim/metric_job.rb
1324
1325
  - app/jobs/decidim/newsletters_opt_in_job.rb
1325
1326
  - app/jobs/decidim/notification_generator_for_recipient_job.rb
@@ -1349,7 +1350,6 @@ files:
1349
1350
  - app/models/decidim/component.rb
1350
1351
  - app/models/decidim/content_block.rb
1351
1352
  - app/models/decidim/contextual_help_section.rb
1352
- - app/models/decidim/continuity_badge_status.rb
1353
1353
  - app/models/decidim/follow.rb
1354
1354
  - app/models/decidim/gamification/badge_score.rb
1355
1355
  - app/models/decidim/identity.rb
@@ -1399,6 +1399,7 @@ files:
1399
1399
  - app/presenters/decidim/admin_log/user_presenter.rb
1400
1400
  - app/presenters/decidim/area_presenter.rb
1401
1401
  - app/presenters/decidim/area_type_presenter.rb
1402
+ - app/presenters/decidim/attachment_presenter.rb
1402
1403
  - app/presenters/decidim/category_presenter.rb
1403
1404
  - app/presenters/decidim/hashtag_presenter.rb
1404
1405
  - app/presenters/decidim/home_stats_presenter.rb
@@ -1442,13 +1443,17 @@ files:
1442
1443
  - app/queries/decidim/user_groups/manageable_user_groups.rb
1443
1444
  - app/queries/decidim/user_groups/member_memberships.rb
1444
1445
  - app/resolvers/decidim/core/metric_resolver.rb
1446
+ - app/resolvers/decidim/core/user_resolver.rb
1445
1447
  - app/resolvers/decidim/hashtags_resolver.rb
1446
1448
  - app/scrubbers/decidim/user_input_scrubber.rb
1449
+ - app/serializers/decidim/exporters/participatory_space_components_serializer.rb
1450
+ - app/serializers/decidim/exporters/serializer.rb
1451
+ - app/serializers/decidim/importers/importer.rb
1452
+ - app/serializers/decidim/importers/participatory_space_components_importer.rb
1447
1453
  - app/services/decidim/action_authorizer.rb
1448
1454
  - app/services/decidim/action_logger.rb
1449
1455
  - app/services/decidim/activity_search.rb
1450
1456
  - app/services/decidim/base_diff_renderer.rb
1451
- - app/services/decidim/continuity_badge_tracker.rb
1452
1457
  - app/services/decidim/email_notification_generator.rb
1453
1458
  - app/services/decidim/events_manager.rb
1454
1459
  - app/services/decidim/home_activity_search.rb
@@ -1529,6 +1534,7 @@ files:
1529
1534
  - app/views/decidim/devise/shared/_newsletter_modal.html.erb
1530
1535
  - app/views/decidim/devise/shared/_omniauth_buttons.html.erb
1531
1536
  - app/views/decidim/devise/shared/_omniauth_buttons_mini.html.erb
1537
+ - app/views/decidim/devise/unlocks/new.html.erb
1532
1538
  - app/views/decidim/doorkeeper/authorizations/new.html.erb
1533
1539
  - app/views/decidim/errors/internal_server_error.html.erb
1534
1540
  - app/views/decidim/errors/not_found.html.erb
@@ -1581,6 +1587,7 @@ files:
1581
1587
  - app/views/decidim/searches/_count.html.erb
1582
1588
  - app/views/decidim/searches/_filters.html.erb
1583
1589
  - app/views/decidim/searches/_filters_small_view.html.erb
1590
+ - app/views/decidim/searches/_resources_filter_block.html.erb
1584
1591
  - app/views/decidim/searches/index.html.erb
1585
1592
  - app/views/decidim/searches/index.js.erb
1586
1593
  - app/views/decidim/shared/_address_details.html.erb
@@ -1624,6 +1631,7 @@ files:
1624
1631
  - app/views/devise/mailer/organization_admin_invitation_instructions.text.erb
1625
1632
  - app/views/devise/mailer/password_change.html.erb
1626
1633
  - app/views/devise/mailer/reset_password_instructions.html.erb
1634
+ - app/views/devise/mailer/unlock_instructions.html.erb
1627
1635
  - app/views/kaminari/decidim/_first_page.html.erb
1628
1636
  - app/views/kaminari/decidim/_gap.html.erb
1629
1637
  - app/views/kaminari/decidim/_last_page.html.erb
@@ -1640,6 +1648,8 @@ files:
1640
1648
  - app/views/layouts/decidim/_language_chooser.html.erb
1641
1649
  - app/views/layouts/decidim/_logo.html.erb
1642
1650
  - app/views/layouts/decidim/_mailer_logo.html.erb
1651
+ - app/views/layouts/decidim/_main_footer.html.erb
1652
+ - app/views/layouts/decidim/_mini_footer.html.erb
1643
1653
  - app/views/layouts/decidim/_omnipresent_banner.html.erb
1644
1654
  - app/views/layouts/decidim/_organization_colors.html.erb
1645
1655
  - app/views/layouts/decidim/_social_media_links.html.erb
@@ -1830,8 +1840,12 @@ files:
1830
1840
  - db/migrate/20190610093742_add_force_users_to_authenticate_before_access_organization.rb
1831
1841
  - db/migrate/20190618075906_add_confidential_to_doorkeeper_application.rb
1832
1842
  - db/migrate/20190829092826_add_uniq_index_to_decidim_metrics.rb
1843
+ - db/migrate/20191028135718_add_lockable_to_users.rb
1844
+ - db/migrate/20191118120529_add_weight_to_categories.rb
1845
+ - db/migrate/20191212102051_remove_continuity_badges.rb
1833
1846
  - db/seeds.rb
1834
1847
  - db/seeds/homepage_image.jpg
1848
+ - lib/decidim/acts_as_author.rb
1835
1849
  - lib/decidim/amendable.rb
1836
1850
  - lib/decidim/api/attachable_interface.rb
1837
1851
  - lib/decidim/api/author_interface.rb
@@ -1850,7 +1864,6 @@ files:
1850
1864
  - lib/decidim/component_manifest.rb
1851
1865
  - lib/decidim/component_validator.rb
1852
1866
  - lib/decidim/components.rb
1853
- - lib/decidim/components/export_manifest.rb
1854
1867
  - lib/decidim/components/namer.rb
1855
1868
  - lib/decidim/content_block_manifest.rb
1856
1869
  - lib/decidim/content_block_registry.rb
@@ -1871,6 +1884,7 @@ files:
1871
1884
  - lib/decidim/core/engine.rb
1872
1885
  - lib/decidim/core/test.rb
1873
1886
  - lib/decidim/core/test/factories.rb
1887
+ - lib/decidim/core/test/shared_examples/acts_as_author_examples.rb
1874
1888
  - lib/decidim/core/test/shared_examples/amendable/accept_amendment_examples.rb
1875
1889
  - lib/decidim/core/test/shared_examples/amendable/amendment_accepted_event_examples.rb
1876
1890
  - lib/decidim/core/test/shared_examples/amendable/amendment_created_event_examples.rb
@@ -1916,6 +1930,8 @@ files:
1916
1930
  - lib/decidim/core/test/shared_examples/resourceable.rb
1917
1931
  - lib/decidim/core/test/shared_examples/scopable_interface_examples.rb
1918
1932
  - lib/decidim/core/test/shared_examples/scope_helper_examples.rb
1933
+ - lib/decidim/core/test/shared_examples/searchable_participatory_space_examples.rb
1934
+ - lib/decidim/core/test/shared_examples/searchable_resources_shared_context.rb
1919
1935
  - lib/decidim/core/test/shared_examples/searchable_results_examples.rb
1920
1936
  - lib/decidim/core/test/shared_examples/simple_event.rb
1921
1937
  - lib/decidim/core/test/shared_examples/space_cell_changes_button_text_cta.rb
@@ -1946,9 +1962,9 @@ files:
1946
1962
  - lib/decidim/exporters/csv.rb
1947
1963
  - lib/decidim/exporters/excel.rb
1948
1964
  - lib/decidim/exporters/export_data.rb
1965
+ - lib/decidim/exporters/export_manifest.rb
1949
1966
  - lib/decidim/exporters/exporter.rb
1950
1967
  - lib/decidim/exporters/json.rb
1951
- - lib/decidim/exporters/serializer.rb
1952
1968
  - lib/decidim/faker/localized.rb
1953
1969
  - lib/decidim/file_zipper.rb
1954
1970
  - lib/decidim/filter_form_builder.rb
@@ -1,73 +0,0 @@
1
- <svg version="1.1" id="continuity-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="continuity" class="stroke-primary">
6
- <g id="battery">
7
- <rect x="331.5" y="244.5" fill="none" stroke="#31536E" stroke-width="16" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" width="417" height="642"/>
8
- <polygon class="fill-primary" fill="#31536E" points="331.5,244.5 331.5,408.5 748.5,408.5 748.5,244.5 "/>
9
- </g>
10
- <path class="fill-primary" id="_x35_0-pct_1_" fill="#31536E" fill-opacity="0.5" stroke="#31536E" stroke-width="16" stroke-miterlimit="10" d="
11
- M461.5,244.5v-21c0-16.016,12.984-29,29-29h98c16.017,0,29,12.984,29,29v21"/>
12
- <g id="logo">
13
- <circle class="fill-primary" id="_x35_0-pct_2_" fill="#31536E" fill-opacity="0.5" cx="540" cy="595.5" r="126.584"/>
14
- <g id="disc">
15
- <path fill="none" stroke="#31536E" stroke-width="8" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" d="
16
- M468.726,700.476c-34.152-22.929-56.629-61.906-56.629-106.135c0-57.949,38.585-106.885,91.466-122.519"/>
17
- <path fill="none" stroke="#31536E" stroke-width="8" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" d="
18
- M661.436,555.076c3.992,12.37,6.148,25.564,6.148,39.265c0,70.551-57.192,127.743-127.744,127.743
19
- c-8.941,0-17.67-0.919-26.095-2.668"/>
20
- <path fill="none" stroke="#31536E" stroke-width="8" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" d="
21
- M582.435,473.871c20.134,7.118,37.948,19.14,52.013,34.63"/>
22
- </g>
23
- <polygon id="ray" fill="#FFFFFF" stroke="#31536E" stroke-width="8" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" points="
24
- 633.544,318.861 433.096,589.5 553.5,589.5 433.096,794.533 667.584,526.5 542.5,526.5 "/>
25
- </g>
26
- <rect class="fill-primary" id="_x32_5-pct" x="331.5" y="814" fill="#31536E" fill-opacity="0.25" width="417" height="72.5"/>
27
- <g id="stars_6" class="stars">
28
- <path fill="#FFD92B" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" d="
29
- M429.205,157.817c0-14.688-18.667-35.355-35.355-35.355c15.355,0,35.355-20.333,35.355-35.355
30
- c0,15.022,16.666,35.355,35.355,35.355C445.538,122.462,429.205,143.129,429.205,157.817z"/>
31
- <g>
32
- <circle fill="#FFD92B" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" cx="860.587" cy="124.874" r="13.5"/>
33
- <line fill="none" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" x1="844.088" y1="108.138" x2="822.875" y2="86.925"/>
34
- <line fill="none" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" x1="878.029" y1="142.08" x2="899.242" y2="163.292"/>
35
- <line fill="none" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" x1="877.322" y1="108.845" x2="898.535" y2="87.632"/>
36
- <line fill="none" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" x1="844.088" y1="142.08" x2="822.875" y2="163.292"/>
37
- </g>
38
- <g>
39
- <line fill="none" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" x1="244.817" y1="931.557" x2="218.655" y2="957.721"/>
40
- <line fill="none" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" x1="209.463" y1="966.912" x2="183.3" y2="993.076"/>
41
- <line fill="none" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" x1="244.11" y1="993.076" x2="217.947" y2="966.912"/>
42
- <line fill="none" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" x1="208.756" y1="957.721" x2="182.593" y2="931.557"/>
43
- </g>
44
- <path fill="#FFD92B" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" d="
45
- M1028.797,902.071c0,0-21.566,4.035-26.516,8.983c-4.948,4.947-8.982,26.515-8.982,26.515s-4.035-21.565-8.984-26.515
46
- c-4.947-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
47
- s4.034,21.565,8.982,26.515C1007.23,898.037,1028.797,902.071,1028.797,902.071z"/>
48
- <g>
49
- <circle fill="#FFD92B" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" cx="705.706" cy="938.129" r="16.604"/>
50
- <circle fill="#FFD92B" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" cx="669.805" cy="938.129" r="6.432"/>
51
- <circle fill="#FFD92B" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" cx="705.706" cy="974.03" r="6.433"/>
52
- <circle fill="#FFD92B" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" cx="741.607" cy="938.129" r="6.432"/>
53
- <circle fill="#FFD92B" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" cx="705.706" cy="902.229" r="6.432"/>
54
- </g>
55
- <g>
56
- <line fill="none" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" x1="68.951" y1="617.436" x2="123.854" y2="672.34"/>
57
- <line fill="none" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" x1="123.854" y1="617.436" x2="68.951" y2="672.34"/>
58
- <line fill="none" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" x1="78.205" y1="644.463" x2="51.205" y2="644.463"/>
59
- <line fill="none" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" x1="116.205" y1="644.463" x2="143.205" y2="644.463"/>
60
- <line fill="none" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" x1="97.205" y1="663.463" x2="97.205" y2="690.463"/>
61
- <line fill="none" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" x1="97.205" y1="625.463" x2="97.205" y2="598.463"/>
62
- </g>
63
- <g>
64
- <line fill="none" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" x1="143.205" y1="197.462" x2="143.205" y2="276.462"/>
65
- <line fill="none" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" x1="182.205" y1="237.462" x2="103.205" y2="237.462"/>
66
- <circle fill="#FFD92B" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" cx="123.205" cy="256.962" r="7.039"/>
67
- <circle fill="#FFD92B" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" cx="123.205" cy="216.962" r="7.039"/>
68
- <circle fill="#FFD92B" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" cx="163.205" cy="256.962" r="7.039"/>
69
- <circle fill="#FFD92B" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" cx="163.205" cy="216.962" r="7.039"/>
70
- </g>
71
- </g>
72
- </g>
73
- </svg>
@@ -1,9 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Decidim
4
- class ContinuityBadgeStatus < ApplicationRecord
5
- belongs_to :subject, polymorphic: true
6
-
7
- validates :subject, :current_streak, :last_session_at, presence: true
8
- end
9
- end
@@ -1,64 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Decidim
4
- # This class keeps tabs on a user's consecutive days streak
5
- # so it can update the score of their continuity badge.
6
- class ContinuityBadgeTracker
7
- # Initializes the class with a polymorphic subject
8
- #
9
- # subject - A in instance of a subclass of ActiveRecord::Base to be tracked
10
- #
11
- def initialize(subject)
12
- @subject = subject
13
- end
14
-
15
- # Public: Tracks the past activity of a user to update the continuity badge's
16
- # score. It will set it to the amount of consecutive days a user has logged into
17
- # the system.
18
- #
19
- # date - The date of the last user's activity. Usually `Time.zone.today`.
20
- #
21
- # Returns nothing.
22
- def track!(date)
23
- @subject.with_lock do
24
- last_session_at = status.try(:last_session_at) || date
25
- current_streak = status.try(:current_streak) || 1
26
-
27
- streak = if last_session_at == date
28
- current_streak
29
- elsif last_session_at == date - 1.day
30
- current_streak + 1
31
- else
32
- 1
33
- end
34
-
35
- update_status(date, streak)
36
- update_badge(streak)
37
- end
38
- end
39
-
40
- private
41
-
42
- def update_badge(streak)
43
- score = Decidim::Gamification.status_for(@subject, :continuity).score
44
- return unless streak > 1 && streak > score
45
-
46
- Decidim::Gamification.set_score(@subject, :continuity, streak)
47
- end
48
-
49
- def status
50
- @status ||= ContinuityBadgeStatus.find_by(
51
- subject: @subject
52
- )
53
- end
54
-
55
- def update_status(date, streak)
56
- @status = ContinuityBadgeStatus.find_or_initialize_by(
57
- subject: @subject
58
- ).update(
59
- last_session_at: date,
60
- current_streak: streak
61
- )
62
- end
63
- end
64
- end
@@ -1,63 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Decidim
4
- module Components
5
- # This class serves as a DSL to declarative specify which artifacts are
6
- # exportable in a component. It is used via the `ComponentManifest`.
7
- #
8
- class ExportManifest
9
- include ActiveModel::Model
10
- include Virtus.model
11
-
12
- attr_reader :name, :component_manifest
13
-
14
- # An setting to choose if the collection exported by this manifest should
15
- # be included in the open data export available for all users.
16
- attribute :include_in_open_data, Boolean, default: false
17
-
18
- # Initializes the manifest.
19
- #
20
- # name - The name of the export artifact. It should be unique in the
21
- # component.
22
- #
23
- # component_manifest - The parent ComponentManifest where this export
24
- # manifest belongs to.
25
- #
26
- def initialize(name, component_manifest)
27
- @name = name.to_sym
28
- @component_manifest = component_manifest
29
- end
30
-
31
- # Public: Sets the collection when a block is given, or returns it if
32
- # no block is provided.
33
- #
34
- # The collection will get passed an instance of `Decidim::Component` when
35
- # it's evaluated so you can easily find the elements to export.
36
- #
37
- # &block - An optional block that returns the collection once evaluated.
38
- #
39
- # Returns the stored collection.
40
- def collection(&block)
41
- if block_given?
42
- @collection = block
43
- else
44
- @collection
45
- end
46
- end
47
-
48
- # Public: Sets the serializer when an argument is provided, returns the
49
- # stored serializer otherwise.
50
- #
51
- # A `Serializer` will be run against each and every element of the collection
52
- # in order to extract and process the relevant fields.
53
- #
54
- # serializer - A subclass of `Decidim::Exporters::Serializer`.
55
- #
56
- # Returns the stored serializer if previously stored, or
57
- # `Decidim::Exporters::Serializer` as a default implementation.
58
- def serializer(serializer = nil)
59
- @serializer ||= serializer || Decidim::Exporters::Serializer
60
- end
61
- end
62
- end
63
- end