decidim-core 0.14.4 → 0.15.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.
- checksums.yaml +4 -4
- data/README.md +20 -0
- data/app/assets/images/decidim/cc-badge.png +0 -0
- data/app/assets/images/decidim/gamification/badges/continuity.svg +73 -0
- data/app/assets/images/decidim/gamification/badges/followers.svg +115 -0
- data/app/assets/images/decidim/icons.svg +1 -0
- data/app/assets/javascripts/decidim/vizzs/areachart.js.es6 +186 -208
- data/app/assets/javascripts/decidim/vizzs/linechart.js.es6 +263 -0
- data/app/assets/javascripts/decidim/vizzs/metrics.js.es6 +36 -26
- data/app/assets/javascripts/decidim/vizzs/orgchart.js.es6 +3 -2
- data/app/assets/javascripts/decidim/vizzs/rowchart.js.es6 +324 -0
- data/app/assets/stylesheets/decidim/_decidim.scss +1 -0
- data/app/assets/stylesheets/decidim/modules/_cards.scss +1 -0
- data/app/assets/stylesheets/decidim/modules/_conference-diploma.scss +75 -0
- data/app/assets/stylesheets/decidim/modules/_conference-media.scss +44 -0
- data/app/assets/stylesheets/decidim/modules/_conference-programme.scss +5 -1
- data/app/assets/stylesheets/decidim/modules/_conference-registration.scss +34 -0
- data/app/assets/stylesheets/decidim/modules/_list-request.scss +16 -0
- data/app/assets/stylesheets/decidim/modules/_modules.scss +4 -4
- data/app/assets/stylesheets/decidim/modules/_process-phase.scss +1 -0
- data/app/assets/stylesheets/decidim/modules/_reveal.scss +6 -1
- data/app/assets/stylesheets/decidim/utils/_helpers.scss +1 -1
- data/app/assets/stylesheets/decidim/{modules → vizzs}/_areachart.scss +8 -11
- data/app/assets/stylesheets/decidim/{modules → vizzs}/_chart-tooltip.scss +0 -0
- data/app/assets/stylesheets/decidim/vizzs/_linechart.scss +115 -0
- data/app/assets/stylesheets/decidim/vizzs/_rowchart.scss +77 -0
- data/app/cells/decidim/activities/show.erb +3 -0
- data/app/cells/decidim/activities_cell.rb +38 -0
- data/app/cells/decidim/activity/show.erb +21 -0
- data/app/cells/decidim/activity_cell.rb +85 -0
- data/app/cells/decidim/address/details.erb +7 -0
- data/app/cells/decidim/address/show.erb +14 -0
- data/app/cells/decidim/address_cell.rb +19 -0
- data/app/cells/decidim/author/contact.erb +1 -1
- data/app/cells/decidim/author_cell.rb +1 -0
- data/app/cells/decidim/badge/show.erb +2 -2
- data/app/cells/decidim/badge/small.erb +5 -0
- data/app/cells/decidim/badge_cell.rb +36 -14
- data/app/cells/decidim/badges/show.erb +6 -3
- data/app/cells/decidim/badges_cell.rb +4 -4
- data/app/cells/decidim/coauthorships_cell.rb +8 -2
- data/app/cells/decidim/collapsible_authors/show.erb +9 -7
- data/app/cells/decidim/content_blocks/html/show.erb +3 -0
- data/app/cells/decidim/content_blocks/html_cell.rb +11 -0
- data/app/cells/decidim/content_blocks/html_settings_form/show.erb +3 -0
- data/app/cells/decidim/content_blocks/html_settings_form_cell.rb +17 -0
- data/app/cells/decidim/content_blocks/last_activity/show.erb +17 -0
- data/app/cells/decidim/content_blocks/last_activity_cell.rb +60 -0
- data/app/cells/decidim/content_blocks/metrics/show.erb +13 -0
- data/app/cells/decidim/content_blocks/metrics_cell.rb +18 -0
- data/app/cells/decidim/content_blocks/stats/show.erb +2 -1
- data/app/cells/decidim/groups/show.erb +10 -0
- data/app/cells/decidim/groups_cell.rb +19 -0
- data/app/cells/decidim/members/show.erb +9 -0
- data/app/cells/decidim/members_cell.rb +32 -0
- data/app/cells/decidim/profile/show.erb +3 -11
- data/app/cells/decidim/profile/user_group_tabs.erb +5 -0
- data/app/cells/decidim/profile/user_tabs.erb +12 -0
- data/app/cells/decidim/profile_cell.rb +7 -2
- data/app/cells/decidim/profile_sidebar/show.erb +108 -23
- data/app/cells/decidim/profile_sidebar_cell.rb +36 -2
- data/app/cells/decidim/user_group_admin_membership_profile/footer.erb +29 -0
- data/app/cells/decidim/user_group_admin_membership_profile_cell.rb +14 -0
- data/app/cells/decidim/user_group_membership_profile/tags.erb +1 -0
- data/app/cells/decidim/user_group_membership_profile_cell.rb +8 -0
- data/app/cells/decidim/user_group_pending_invitations_list/show.erb +23 -0
- data/app/cells/decidim/user_group_pending_invitations_list_cell.rb +26 -0
- data/app/cells/decidim/user_group_pending_requests_list/show.erb +23 -0
- data/app/cells/decidim/user_group_pending_requests_list_cell.rb +26 -0
- data/app/cells/decidim/user_profile/header.erb +1 -1
- data/app/cells/decidim/user_profile_cell.rb +15 -9
- data/app/commands/decidim/accept_group_invitation.rb +43 -0
- data/app/commands/decidim/accept_user_group_join_request.rb +53 -0
- data/app/commands/decidim/create_follow.rb +6 -0
- data/app/commands/decidim/create_registration.rb +13 -23
- data/app/commands/decidim/create_user_group.rb +57 -0
- data/app/commands/decidim/delete_follow.rb +7 -0
- data/app/commands/decidim/demote_membership.rb +57 -0
- data/app/commands/decidim/destroy_account.rb +6 -0
- data/app/commands/decidim/invite_user.rb +1 -3
- data/app/commands/decidim/invite_user_to_group.rb +62 -0
- data/app/commands/decidim/join_user_group.rb +63 -0
- data/app/commands/decidim/leave_user_group.rb +41 -0
- data/app/commands/decidim/promote_membership.rb +55 -0
- data/app/commands/decidim/reject_group_invitation.rb +42 -0
- data/app/commands/decidim/reject_user_group_join_request.rb +53 -0
- data/app/commands/decidim/remove_user_from_group.rb +53 -0
- data/app/commands/decidim/update_user_group.rb +53 -0
- data/app/controllers/concerns/decidim/locale_switcher.rb +3 -3
- data/app/controllers/concerns/decidim/paginable.rb +1 -0
- data/app/controllers/decidim/application_controller.rb +7 -0
- data/app/controllers/decidim/devise/omniauth_registrations_controller.rb +1 -1
- data/app/controllers/decidim/devise/sessions_controller.rb +1 -1
- data/app/controllers/decidim/gamification/badges_controller.rb +11 -0
- data/app/controllers/decidim/group_admins_controller.rb +41 -0
- data/app/controllers/decidim/group_invites_controller.rb +74 -0
- data/app/controllers/decidim/group_members_controller.rb +59 -0
- data/app/controllers/decidim/groups_controller.rb +85 -0
- data/app/controllers/decidim/last_activities_controller.rb +46 -0
- data/app/controllers/decidim/pages_controller.rb +9 -1
- data/app/controllers/decidim/profiles_controller.rb +35 -5
- data/app/controllers/decidim/user_group_join_requests_controller.rb +69 -0
- data/app/events/decidim/demoted_membership_event.rb +28 -0
- data/app/events/decidim/invited_to_group_event.rb +33 -0
- data/app/events/decidim/join_request_accepted_event.rb +28 -0
- data/app/events/decidim/join_request_created_event.rb +28 -0
- data/app/events/decidim/join_request_rejected_event.rb +28 -0
- data/app/events/decidim/promoted_to_admin_event.rb +28 -0
- data/app/events/decidim/removed_from_group_event.rb +28 -0
- data/app/forms/decidim/account_form.rb +1 -1
- data/app/forms/decidim/invite_user_to_group_form.rb +29 -0
- data/app/forms/decidim/notifications_settings_form.rb +4 -0
- data/app/forms/decidim/registration_form.rb +0 -27
- data/app/forms/decidim/user_group_form.rb +81 -0
- data/app/helpers/decidim/component_path_helper.rb +10 -0
- data/app/helpers/decidim/filters_helper.rb +3 -2
- data/app/helpers/decidim/icon_helper.rb +3 -1
- data/app/helpers/decidim/map_helper.rb +1 -1
- data/app/jobs/decidim/metric_job.rb +14 -0
- data/app/mailers/decidim/newsletter_mailer.rb +2 -0
- data/app/mailers/decidim/notification_mailer.rb +1 -1
- data/app/models/decidim/action_log.rb +66 -0
- data/app/models/decidim/coauthorship.rb +9 -0
- data/app/models/decidim/component.rb +5 -0
- data/app/models/decidim/continuity_badge_status.rb +9 -0
- data/app/models/decidim/gamification/badge_score.rb +1 -1
- data/app/models/decidim/messaging/message.rb +1 -0
- data/app/models/decidim/metric.rb +13 -0
- data/app/models/decidim/participatory_space_private_user.rb +4 -0
- data/app/models/decidim/user.rb +14 -38
- data/app/models/decidim/user_base_entity.rb +52 -0
- data/app/models/decidim/user_group.rb +48 -9
- data/app/models/decidim/user_group_membership.rb +8 -0
- data/app/permissions/decidim/permissions.rb +21 -0
- data/app/presenters/decidim/admin_log/organization_presenter.rb +0 -2
- data/app/presenters/decidim/admin_log/participatory_space_private_user_presenter.rb +38 -0
- data/app/presenters/decidim/metric_charts_presenter.rb +53 -0
- data/app/presenters/decidim/metric_object_presenter.rb +28 -0
- data/app/presenters/decidim/user_group_presenter.rb +16 -8
- data/app/presenters/decidim/user_presenter.rb +14 -0
- data/app/queries/decidim/metric_manage.rb +59 -0
- data/app/queries/decidim/metrics/users_metric_manage.rb +26 -0
- data/app/queries/decidim/user_groups/accepted_memberships.rb +36 -0
- data/app/queries/decidim/user_groups/accepted_user_groups.rb +38 -0
- data/app/queries/decidim/user_groups/accepted_users.rb +36 -0
- data/app/queries/decidim/user_groups/admin_memberships.rb +37 -0
- data/app/queries/decidim/user_groups/invited_memberships.rb +36 -0
- data/app/queries/decidim/user_groups/manageable_user_groups.rb +39 -0
- data/app/queries/decidim/user_groups/member_memberships.rb +37 -0
- data/app/resolvers/decidim/core/metric_resolver.rb +38 -0
- data/app/services/decidim/action_logger.rb +4 -2
- data/app/services/decidim/activity_search.rb +76 -0
- data/app/services/decidim/continuity_badge_tracker.rb +64 -0
- data/app/services/decidim/resource_search.rb +0 -1
- data/app/types/decidim/core/metric_history_type.rb +17 -0
- data/app/types/decidim/core/metric_type.rb +14 -0
- data/app/types/decidim/core/session_type.rb +1 -1
- data/app/types/decidim/core/user_group_type.rb +2 -2
- data/app/views/decidim/authorization_modals/show.html.erb +40 -27
- data/app/views/decidim/devise/registrations/new.html.erb +0 -19
- data/app/views/decidim/gamification/badges/index.html.erb +42 -0
- data/app/views/decidim/group_admins/index.html.erb +18 -0
- data/app/views/decidim/group_invites/index.html.erb +27 -0
- data/app/views/decidim/group_members/index.html.erb +19 -0
- data/app/views/decidim/groups/_form.html.erb +23 -0
- data/app/views/decidim/groups/edit.html.erb +26 -0
- data/app/views/decidim/groups/new.html.erb +26 -0
- data/app/views/decidim/last_activities/_activities.html.erb +13 -0
- data/app/views/decidim/last_activities/index.html.erb +18 -0
- data/app/views/decidim/last_activities/index.js.erb +6 -0
- data/app/views/decidim/profiles/show.html.erb +1 -1
- data/app/views/layouts/decidim/_user_menu.html.erb +0 -1
- data/app/views/layouts/decidim/_wrapper.html.erb +1 -1
- data/config/initializers/devise.rb +1 -1
- data/config/initializers/foundation_rails_helper.rb +1 -0
- data/config/locales/ca.yml +325 -32
- data/config/locales/de.yml +325 -32
- data/config/locales/en.yml +325 -32
- data/config/locales/es-PY.yml +325 -32
- data/config/locales/es.yml +325 -32
- data/config/locales/eu.yml +325 -32
- data/config/locales/fi.yml +330 -37
- data/config/locales/fr.yml +325 -32
- data/config/locales/gl.yml +325 -32
- data/config/locales/hu.yml +327 -34
- data/config/locales/it.yml +325 -32
- data/config/locales/nl.yml +325 -32
- data/config/locales/pl.yml +329 -32
- data/config/locales/pt-BR.yml +326 -33
- data/config/locales/pt.yml +325 -32
- data/config/locales/ru.yml +4 -33
- data/config/locales/sv.yml +346 -53
- data/config/locales/uk.yml +4 -33
- data/config/routes.rb +27 -1
- data/db/migrate/20170128112958_change_user_groups_verified_to_timestamp.rb +11 -0
- data/db/migrate/20180705134647_create_decidim_metrics.rb +16 -0
- data/db/migrate/20180730071851_add_core_content_blocks.rb +3 -3
- data/db/migrate/20180810092428_move_organization_fields_to_hero_content_block.rb +4 -2
- data/db/migrate/20180918072506_add_visibility_to_action_logs.rb +8 -0
- data/db/migrate/20181001124950_move_users_groups_to_users_table.rb +84 -0
- data/db/migrate/20181008102144_add_badge_switch_to_organizations.rb +8 -0
- data/db/migrate/20181010044613_create_decidim_continuity_badge_statuses.rb +11 -0
- data/db/migrate/20181011080252_add_roles_to_memberships.rb +24 -0
- data/db/migrate/20181016091601_make_authors_polymorphic.rb +31 -0
- data/db/migrate/20181029112820_fix_user_follows.rb +18 -0
- data/db/migrate/20181030090144_destroy_deleted_users_follows.rb +16 -0
- data/db/seeds.rb +18 -4
- data/lib/decidim/attributes.rb +1 -0
- data/lib/decidim/attributes/localized_date.rb +16 -0
- data/lib/decidim/attributes/time_with_zone.rb +3 -1
- data/lib/decidim/authorable.rb +5 -4
- data/lib/decidim/authorization_form_builder.rb +2 -2
- data/lib/decidim/coauthorable.rb +68 -18
- data/lib/decidim/content_block_manifest.rb +7 -0
- data/lib/decidim/content_processor.rb +17 -7
- data/lib/decidim/core.rb +12 -0
- data/lib/decidim/core/engine.rb +54 -6
- data/lib/decidim/core/test/factories.rb +63 -17
- data/lib/decidim/core/test/shared_examples/coauthorable.rb +27 -9
- data/lib/decidim/core/test/shared_examples/coauthorable_interface_examples.rb +2 -2
- data/lib/decidim/core/version.rb +1 -1
- data/lib/decidim/data_portability.rb +3 -1
- data/lib/decidim/data_portability_file_reader.rb +1 -1
- data/lib/decidim/events/author_event.rb +4 -1
- data/lib/decidim/events/coauthor_event.rb +4 -1
- data/lib/decidim/faker/localized.rb +5 -4
- data/lib/decidim/form_builder.rb +18 -17
- data/lib/decidim/gamification.rb +8 -2
- data/lib/decidim/gamification/badge.rb +34 -0
- data/lib/decidim/gamification/badge_scorer.rb +29 -14
- data/lib/decidim/gamification/badge_status.rb +2 -0
- data/lib/decidim/hashtaggable.rb +1 -1
- data/lib/decidim/manifest_registry.rb +5 -3
- data/lib/decidim/metric_manifest.rb +20 -0
- data/lib/decidim/metric_registry.rb +71 -0
- data/lib/decidim/participable.rb +1 -1
- data/lib/decidim/participatory_space_resourceable.rb +0 -1
- data/lib/decidim/query_extensions.rb +19 -0
- data/lib/decidim/resourceable.rb +1 -0
- data/lib/decidim/searchable.rb +2 -1
- data/lib/tasks/decidim_metrics_tasks.rake +41 -0
- data/lib/tasks/decidim_tasks.rake +1 -0
- data/vendor/assets/javascripts/datepicker-locales/foundation-datepicker.ca.js +1 -2
- data/vendor/assets/javascripts/datepicker-locales/foundation-datepicker.es.js +1 -2
- data/vendor/assets/javascripts/datepicker-locales/foundation-datepicker.fr.js +1 -2
- data/vendor/assets/javascripts/datepicker-locales/foundation-datepicker.gl.js +1 -2
- data/vendor/assets/javascripts/datepicker-locales/foundation-datepicker.pt.js +1 -2
- data/vendor/assets/javascripts/datepicker-locales/foundation-datepicker.ru.js +1 -2
- data/vendor/assets/javascripts/datepicker-locales/foundation-datepicker.uk.js +1 -2
- data/vendor/assets/javascripts/form_datepicker.js.es6 +1 -11
- metadata +144 -23
- data/app/cells/decidim/invitations_toggle/content.erb +0 -1
- data/app/cells/decidim/invitations_toggle/label.erb +0 -1
- data/app/cells/decidim/invitations_toggle_cell.rb +0 -27
- data/app/cells/decidim/toggle/show.erb +0 -8
- data/app/cells/decidim/toggle_cell.rb +0 -42
- data/app/commands/decidim/invite_friends.rb +0 -48
- data/app/controllers/decidim/invitations_controller.rb +0 -32
- data/app/forms/decidim/invitations_form.rb +0 -37
- data/app/views/decidim/invitations/index.html.erb +0 -48
- data/app/views/devise/mailer/invite_friend.html.erb +0 -27
- data/app/views/devise/mailer/invite_friend.text.erb +0 -19
- data/lib/decidim/rectify_ext.rb +0 -32
@@ -0,0 +1,77 @@
|
|
1
|
+
.rowchart{
|
2
|
+
//common
|
3
|
+
.background{
|
4
|
+
fill: darken($body-background, 2.5);
|
5
|
+
}
|
6
|
+
|
7
|
+
.title{
|
8
|
+
fill: $muted;
|
9
|
+
text-transform: uppercase;
|
10
|
+
font-weight: 600;
|
11
|
+
font-size: rem-calc(24);
|
12
|
+
}
|
13
|
+
|
14
|
+
.subtitle{
|
15
|
+
fill: $muted;
|
16
|
+
font-size: rem-calc(14);
|
17
|
+
}
|
18
|
+
|
19
|
+
.tick{
|
20
|
+
opacity: .5;
|
21
|
+
|
22
|
+
.dashed{
|
23
|
+
stroke-dasharray: 3;
|
24
|
+
}
|
25
|
+
}
|
26
|
+
|
27
|
+
// helper to colors
|
28
|
+
@mixin loop-colors-types($color, $max: 12){
|
29
|
+
@for $i from 0 through ($max - 1){
|
30
|
+
$interval: ($i % 4) * 24 + 1;
|
31
|
+
$tints: tint($color, $interval);
|
32
|
+
$shades: shade($color, $interval);
|
33
|
+
$adjusts: adjust-color($color, $lightness: $interval, $hue: -$interval);
|
34
|
+
|
35
|
+
.type-#{$i}{
|
36
|
+
@if $i < 4{
|
37
|
+
fill: $tints;
|
38
|
+
|
39
|
+
&:hover{
|
40
|
+
cursor: pointer;
|
41
|
+
fill: complement($tints);
|
42
|
+
}
|
43
|
+
}
|
44
|
+
|
45
|
+
@else if $i >= 4 and $i < 8{
|
46
|
+
fill: $shades;
|
47
|
+
|
48
|
+
&:hover{
|
49
|
+
cursor: pointer;
|
50
|
+
fill: complement($shades);
|
51
|
+
}
|
52
|
+
}
|
53
|
+
|
54
|
+
@else{
|
55
|
+
fill: $adjusts;
|
56
|
+
|
57
|
+
&:hover{
|
58
|
+
cursor: pointer;
|
59
|
+
fill: complement($adjusts);
|
60
|
+
}
|
61
|
+
}
|
62
|
+
}
|
63
|
+
}
|
64
|
+
}
|
65
|
+
|
66
|
+
// default color
|
67
|
+
@include loop-colors-types($proposals);
|
68
|
+
|
69
|
+
// colors modifiers
|
70
|
+
$map: $foundation-palette;
|
71
|
+
|
72
|
+
@each $key, $value in $map{
|
73
|
+
&.#{$key}{
|
74
|
+
@include loop-colors-types($value);
|
75
|
+
}
|
76
|
+
}
|
77
|
+
}
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
# Renders a collection of activities using a different cell for
|
5
|
+
# each one.
|
6
|
+
class ActivitiesCell < Decidim::ViewModel
|
7
|
+
include Decidim::CardHelper
|
8
|
+
include Decidim::IconHelper
|
9
|
+
include Decidim::Core::Engine.routes.url_helpers
|
10
|
+
|
11
|
+
delegate :current_organization, to: :controller
|
12
|
+
|
13
|
+
# Since we're rendering each activity separatedly we need to trigger
|
14
|
+
# BatchLoader in order to accumulate all the ids to be found later.
|
15
|
+
def show
|
16
|
+
return if activities.blank?
|
17
|
+
|
18
|
+
activities.map do |activity|
|
19
|
+
activity.organization_lazy
|
20
|
+
activity.resource_lazy
|
21
|
+
activity.participatory_space_lazy
|
22
|
+
activity.component_lazy
|
23
|
+
end
|
24
|
+
|
25
|
+
render
|
26
|
+
end
|
27
|
+
|
28
|
+
def activity_cell_for(activity)
|
29
|
+
cell "#{activity.resource_type.constantize.name.underscore}_activity", activity
|
30
|
+
rescue NameError
|
31
|
+
cell "decidim/activity", activity
|
32
|
+
end
|
33
|
+
|
34
|
+
def activities
|
35
|
+
model
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
<article class="card">
|
2
|
+
<div class="card__content">
|
3
|
+
<% if title.present? %>
|
4
|
+
<div class="card__text">
|
5
|
+
<div class="text-medium">
|
6
|
+
<span class="icon--container">
|
7
|
+
<%= resource_icon resource, class: "primary" %>
|
8
|
+
<%= title %>
|
9
|
+
</span>
|
10
|
+
</div>
|
11
|
+
</div>
|
12
|
+
<% end %>
|
13
|
+
<div class="card__header mb-none">
|
14
|
+
<%= link_to resource_link_path, class: "card__link" do %>
|
15
|
+
<h5 class="card__title mb-none">
|
16
|
+
<%= html_truncate resource_link_text, length: 100 %>
|
17
|
+
</h5>
|
18
|
+
<% end %>
|
19
|
+
</div>
|
20
|
+
</div>
|
21
|
+
</article>
|
@@ -0,0 +1,85 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
# This cell is used to render public activities performed by users.
|
5
|
+
#
|
6
|
+
# Each model that we want to represent should inherit from this cell and
|
7
|
+
# tweak the necessary methods (usually `title` is enough).
|
8
|
+
class ActivityCell < Decidim::ViewModel
|
9
|
+
include Cell::ViewModel::Partial
|
10
|
+
include Decidim::IconHelper
|
11
|
+
include Decidim::ApplicationHelper
|
12
|
+
|
13
|
+
def show
|
14
|
+
return unless renderable?
|
15
|
+
render
|
16
|
+
end
|
17
|
+
|
18
|
+
# Since activity logs could be linked to resource no longer available
|
19
|
+
# this method is added in order to skip rendering a cell if there's
|
20
|
+
# not enough data.
|
21
|
+
def renderable?
|
22
|
+
resource.present? && participatory_space.present? && published?
|
23
|
+
end
|
24
|
+
|
25
|
+
# The resource linked to the activity.
|
26
|
+
def resource
|
27
|
+
model.resource_lazy
|
28
|
+
end
|
29
|
+
|
30
|
+
# The title to show at the card.
|
31
|
+
#
|
32
|
+
# The card will also be displayed OK if there's no title.
|
33
|
+
def title
|
34
|
+
return unless resource.respond_to?(:title)
|
35
|
+
|
36
|
+
if resource.title.is_a?(String)
|
37
|
+
resource.title
|
38
|
+
elsif resource.title.is_a?(Hash)
|
39
|
+
translated_attribute(resource.title)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
# The link to the resource linked to the activity.
|
44
|
+
def resource_link_path
|
45
|
+
resource_locator(resource).path
|
46
|
+
end
|
47
|
+
|
48
|
+
# The text to show as the link to the resource.
|
49
|
+
def resource_link_text
|
50
|
+
translated_attribute(resource.title)
|
51
|
+
end
|
52
|
+
|
53
|
+
private
|
54
|
+
|
55
|
+
def published?
|
56
|
+
return true unless resource.respond_to?(:published?)
|
57
|
+
resource.published?
|
58
|
+
end
|
59
|
+
|
60
|
+
def component
|
61
|
+
model.component_lazy
|
62
|
+
end
|
63
|
+
|
64
|
+
def organization
|
65
|
+
model.organization_lazy
|
66
|
+
end
|
67
|
+
|
68
|
+
def user
|
69
|
+
model.user_lazy
|
70
|
+
end
|
71
|
+
|
72
|
+
def participatory_space
|
73
|
+
return resource if resource.is_a?(Decidim::Participable)
|
74
|
+
|
75
|
+
model.participatory_space_lazy
|
76
|
+
end
|
77
|
+
|
78
|
+
def participatory_space_link
|
79
|
+
link_to(
|
80
|
+
translated_attribute(participatory_space.title),
|
81
|
+
resource_locator(participatory_space).path
|
82
|
+
)
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
<% if model.respond_to? :location %>
|
2
|
+
<strong><%= translated_attribute model.location %></strong><br />
|
3
|
+
<% end %>
|
4
|
+
<span><%= model.address %></span><br />
|
5
|
+
<% if model.respond_to? :location_hints %>
|
6
|
+
<span><%= translated_attribute model.location_hints %></span>
|
7
|
+
<% end %>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<div class="card__icondata">
|
2
|
+
<ul class="card-data">
|
3
|
+
<li class="card-data__item">
|
4
|
+
<%= resource_icon %>
|
5
|
+
</li>
|
6
|
+
<li class="card-data__item">
|
7
|
+
<div class="text-left">
|
8
|
+
<div class="card__icondata--address">
|
9
|
+
<%= render :details %>
|
10
|
+
</div>
|
11
|
+
</div>
|
12
|
+
</li>
|
13
|
+
</ul>
|
14
|
+
</div>
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
# This cell renders the address of a meeting.
|
5
|
+
class AddressCell < Decidim::ViewModel
|
6
|
+
include Cell::ViewModel::Partial
|
7
|
+
include LayoutHelper
|
8
|
+
|
9
|
+
def details
|
10
|
+
render
|
11
|
+
end
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
def resource_icon
|
16
|
+
icon "meetings", class: "icon--big"
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -6,7 +6,7 @@
|
|
6
6
|
</div>
|
7
7
|
</div>
|
8
8
|
<div class="card__content">
|
9
|
-
<div class="card__header">
|
9
|
+
<div class="card__header" style="opacity: <%= opacity %>;">
|
10
10
|
<div class="badge-container">
|
11
11
|
<%= image_tag badge.image, class: "badge__logo" %>
|
12
12
|
</div>
|
@@ -22,7 +22,7 @@
|
|
22
22
|
<div class="p-xs">
|
23
23
|
<div class="flex--sbc">
|
24
24
|
<strong class="text-uppercase muted">
|
25
|
-
<%=
|
25
|
+
<%= level_title %>
|
26
26
|
</strong>
|
27
27
|
<div class="badge-level">
|
28
28
|
<% badge.levels.each_with_index do |_threshold, level| %>
|
@@ -8,46 +8,68 @@ module Decidim
|
|
8
8
|
|
9
9
|
delegate :current_user, to: :controller
|
10
10
|
|
11
|
+
def small
|
12
|
+
render "small"
|
13
|
+
end
|
14
|
+
|
11
15
|
def badge
|
12
16
|
@options[:badge]
|
13
17
|
end
|
14
18
|
|
15
|
-
def
|
16
|
-
|
19
|
+
def level_title
|
20
|
+
t "decidim.gamification.level", level: status.level
|
21
|
+
end
|
22
|
+
|
23
|
+
def own_profile?
|
24
|
+
return @own_profile if defined?(@own_profile)
|
25
|
+
|
26
|
+
@own_profile = if model.is_a?(User)
|
27
|
+
model == current_user
|
28
|
+
elsif model.is_a?(UserGroup) && current_user
|
29
|
+
current_user.user_groups.include?(model)
|
30
|
+
end
|
17
31
|
end
|
18
32
|
|
19
33
|
def description
|
20
|
-
if
|
21
|
-
|
22
|
-
elsif
|
23
|
-
|
24
|
-
elsif
|
25
|
-
|
26
|
-
elsif
|
27
|
-
|
34
|
+
if own_profile? && status.level.zero?
|
35
|
+
score_descriptions[:unearned_own]
|
36
|
+
elsif own_profile? && status.level.positive?
|
37
|
+
score_descriptions[:description_own]
|
38
|
+
elsif !own_profile? && status.level.zero?
|
39
|
+
score_descriptions[:unearned_another]
|
40
|
+
elsif !own_profile? && status.level.positive?
|
41
|
+
score_descriptions[:description_another]
|
28
42
|
end
|
29
43
|
end
|
30
44
|
|
31
45
|
def tooltip
|
32
|
-
if
|
46
|
+
if own_profile?
|
33
47
|
if status.next_level_in
|
34
48
|
t "decidim.gamification.badges.#{badge.name}.next_level_in", score: status.next_level_in
|
35
49
|
else
|
36
50
|
t "decidim.gamification.reached_top"
|
37
51
|
end
|
38
52
|
else
|
39
|
-
|
53
|
+
badge.description(controller.current_organization.name)
|
40
54
|
end
|
41
55
|
end
|
42
56
|
|
43
57
|
def badge_name
|
44
|
-
|
58
|
+
badge.translated_name
|
59
|
+
end
|
60
|
+
|
61
|
+
def opacity
|
62
|
+
status.level < 1 ? 0.2 : 1
|
45
63
|
end
|
46
64
|
|
47
65
|
private
|
48
66
|
|
67
|
+
def score_descriptions
|
68
|
+
badge.score_descriptions(status.score)
|
69
|
+
end
|
70
|
+
|
49
71
|
def status
|
50
|
-
@status ||= Decidim::Gamification.status_for(
|
72
|
+
@status ||= options[:status] || Decidim::Gamification.status_for(model, badge.name)
|
51
73
|
end
|
52
74
|
end
|
53
75
|
end
|
@@ -1,6 +1,9 @@
|
|
1
|
-
<p
|
1
|
+
<p>
|
2
|
+
<%= t "decidim.gamification.description" %>
|
3
|
+
<%= link_to t("decidim.gamification.all_badges_link"), gamification_badges_path %>
|
4
|
+
</p>
|
2
5
|
<div class="row small-up-2 medium-up-4 card-grid badges">
|
3
|
-
<%
|
4
|
-
<%= cell "decidim/badge",
|
6
|
+
<% available_badges.each do |badge| %>
|
7
|
+
<%= cell "decidim/badge", model, badge: badge %>
|
5
8
|
<% end %>
|
6
9
|
</div>
|
@@ -5,10 +5,10 @@ module Decidim
|
|
5
5
|
include Decidim::ApplicationHelper
|
6
6
|
include Decidim::Core::Engine.routes.url_helpers
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
8
|
+
def available_badges
|
9
|
+
Decidim::Gamification.badges.select do |badge|
|
10
|
+
badge.valid_for?(model)
|
11
|
+
end.sort_by(&:name)
|
12
12
|
end
|
13
13
|
end
|
14
14
|
end
|
@@ -19,7 +19,7 @@ module Decidim
|
|
19
19
|
include Decidim::ApplicationHelper
|
20
20
|
|
21
21
|
def show
|
22
|
-
if authorable?
|
22
|
+
if authorable?
|
23
23
|
cell "decidim/author", presenter_for_author(model), extra_classes.merge(has_actions: has_actions?, from: model)
|
24
24
|
else
|
25
25
|
cell(
|
@@ -41,7 +41,13 @@ module Decidim
|
|
41
41
|
end
|
42
42
|
|
43
43
|
def presenters_for_identities(coauthorable)
|
44
|
-
coauthorable.identities.map
|
44
|
+
coauthorable.identities.map do |identity|
|
45
|
+
if identity.is_a?(Decidim::Organization)
|
46
|
+
"#{model.class.parent}::OfficialAuthorPresenter".constantize.new
|
47
|
+
else
|
48
|
+
present(identity)
|
49
|
+
end
|
50
|
+
end
|
45
51
|
end
|
46
52
|
|
47
53
|
def presenter_for_author(authorable)
|