decidim-core 0.11.2 → 0.12.0.pre
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/decidim/notifications.js.es6 +8 -6
- data/app/assets/javascripts/decidim/user_registrations.js.es6 +25 -1
- data/app/assets/stylesheets/decidim/application.scss.erb +4 -0
- data/app/assets/stylesheets/decidim/layouts/_home.scss +79 -0
- data/app/assets/stylesheets/decidim/modules/_author-avatar.scss +2 -1
- data/app/assets/stylesheets/decidim/modules/_cards.scss +82 -38
- data/app/assets/stylesheets/decidim/modules/_collapsible-list.scss +16 -0
- data/app/assets/stylesheets/decidim/modules/_definition-data.scss +27 -0
- data/app/assets/stylesheets/decidim/modules/_fingerprint.scss +8 -0
- data/app/assets/stylesheets/decidim/modules/_horizontal-tabs.scss +51 -0
- data/app/assets/stylesheets/decidim/modules/_inline-filters.scss +5 -3
- data/app/assets/stylesheets/decidim/modules/_margins.scss +6 -4
- data/app/assets/stylesheets/decidim/modules/_modules.scss +3 -0
- data/app/assets/stylesheets/decidim/modules/_navbar.scss +113 -7
- data/app/assets/stylesheets/decidim/modules/_signup.scss +22 -5
- data/app/assets/stylesheets/decidim/modules/_toggle.scss +9 -0
- data/app/assets/stylesheets/decidim/modules/_typography.scss +5 -1
- data/app/assets/stylesheets/decidim/utils/_helpers.scss +42 -0
- data/app/assets/stylesheets/decidim/utils/_mixins.scss +6 -0
- data/app/assets/stylesheets/decidim/utils/_settings.scss +3 -2
- data/app/cells/decidim/announcement/show.erb +11 -0
- data/app/cells/decidim/announcement_cell.rb +32 -0
- data/app/cells/decidim/author/comments.erb +6 -0
- data/app/cells/decidim/author/contact.erb +3 -0
- data/app/cells/decidim/author/date.erb +5 -0
- data/app/cells/decidim/author/flag.erb +5 -0
- data/app/cells/decidim/author/profile.erb +9 -0
- data/app/cells/decidim/{profile → author}/profile_inline.erb +1 -1
- data/app/cells/decidim/author/show.erb +18 -0
- data/app/cells/decidim/author/withdraw.erb +6 -0
- data/app/cells/decidim/author_cell.rb +109 -0
- data/app/cells/decidim/card/show.erb +18 -16
- data/app/cells/decidim/card_cell.rb +17 -4
- data/app/cells/decidim/card_m/author.erb +3 -0
- data/app/cells/decidim/card_m/badge.erb +1 -0
- data/app/cells/decidim/card_m/comments_counter.erb +3 -0
- data/app/cells/decidim/card_m/data.erb +0 -0
- data/app/cells/decidim/card_m/footer.erb +0 -0
- data/app/cells/decidim/card_m/header.erb +17 -0
- data/app/cells/decidim/card_m/image.erb +5 -0
- data/app/cells/decidim/card_m/label.erb +3 -0
- data/app/cells/decidim/card_m/show.erb +24 -0
- data/app/cells/decidim/card_m/status.erb +9 -0
- data/app/cells/decidim/card_m/tags.erb +0 -0
- data/app/cells/decidim/card_m_cell.rb +136 -0
- data/app/cells/decidim/collapsible_list/show.erb +20 -0
- data/app/cells/decidim/collapsible_list_cell.rb +66 -0
- data/app/cells/decidim/fingerprint/show.erb +22 -0
- data/app/cells/decidim/fingerprint_cell.rb +17 -0
- data/app/cells/decidim/follow_button/show.erb +34 -0
- data/app/cells/decidim/follow_button_cell.rb +40 -0
- data/app/cells/decidim/followers/show.erb +9 -0
- data/app/cells/decidim/followers_cell.rb +18 -0
- data/app/cells/decidim/following/show.erb +9 -0
- data/app/cells/decidim/following_cell.rb +24 -0
- data/app/cells/decidim/notifications/show.erb +48 -0
- data/app/cells/decidim/notifications_cell.rb +21 -0
- data/app/cells/decidim/progress_bar/show.erb +17 -0
- data/app/cells/decidim/progress_bar_cell.rb +68 -0
- data/app/cells/decidim/tags/category.erb +1 -0
- data/app/cells/decidim/tags/scope.erb +1 -0
- data/app/cells/decidim/tags/show.erb +5 -0
- data/app/cells/decidim/tags_cell.rb +62 -0
- data/app/cells/decidim/tos_page/announcement.erb +2 -0
- data/app/cells/decidim/tos_page/refuse_btn_modal.erb +23 -0
- data/app/cells/decidim/tos_page/sticky_form.erb +29 -0
- data/app/cells/decidim/tos_page_cell.rb +39 -0
- data/app/cells/decidim/user_profile/footer.erb +5 -0
- data/app/cells/decidim/user_profile/header.erb +20 -0
- data/app/cells/decidim/user_profile_cell.rb +26 -0
- data/app/commands/decidim/create_omniauth_registration.rb +1 -1
- data/app/commands/decidim/create_registration.rb +2 -1
- data/app/commands/decidim/search.rb +45 -0
- data/app/controllers/concerns/decidim/devise_controllers.rb +15 -12
- data/app/controllers/concerns/decidim/http_caching_disabler.rb +21 -0
- data/app/controllers/concerns/decidim/impersonate_users.rb +1 -6
- data/app/controllers/concerns/decidim/locale_switcher.rb +1 -1
- data/app/controllers/concerns/decidim/needs_permission.rb +70 -0
- data/app/controllers/concerns/decidim/needs_tos_accepted.rb +42 -0
- data/app/controllers/concerns/decidim/participatory_space_context.rb +1 -7
- data/app/controllers/concerns/decidim/user_profile.rb +3 -1
- data/app/controllers/decidim/account_controller.rb +4 -4
- data/app/controllers/decidim/application_controller.rb +17 -8
- data/app/controllers/decidim/components/base_controller.rb +14 -9
- data/app/controllers/decidim/cookie_policy_controller.rb +0 -2
- data/app/controllers/decidim/devise/confirmations_controller.rb +13 -0
- data/app/controllers/decidim/devise/invitations_controller.rb +3 -1
- data/app/controllers/decidim/devise/omniauth_registrations_controller.rb +9 -3
- data/app/controllers/decidim/devise/passwords_controller.rb +1 -1
- data/app/controllers/decidim/devise/registrations_controller.rb +1 -7
- data/app/controllers/decidim/doorkeeper/authorizations_controller.rb +0 -2
- data/app/controllers/decidim/doorkeeper/credentials_controller.rb +0 -1
- data/app/controllers/decidim/errors_controller.rb +0 -2
- data/app/controllers/decidim/follows_controller.rb +4 -2
- data/app/controllers/decidim/locales_controller.rb +1 -1
- data/app/controllers/decidim/messaging/conversations_controller.rb +5 -5
- data/app/controllers/decidim/newsletters_controller.rb +0 -2
- data/app/controllers/decidim/notifications_controller.rb +3 -19
- data/app/controllers/decidim/notifications_settings_controller.rb +2 -2
- data/app/controllers/decidim/pages_controller.rb +12 -10
- data/app/controllers/decidim/profiles_controller.rb +10 -4
- data/app/controllers/decidim/reports_controller.rb +14 -1
- data/app/controllers/decidim/scopes_controller.rb +3 -3
- data/app/controllers/decidim/searches_controller.rb +39 -0
- data/app/controllers/decidim/static_map_controller.rb +0 -2
- data/app/controllers/decidim/tos_controller.rb +20 -0
- data/app/controllers/decidim/widgets_controller.rb +0 -1
- data/app/forms/decidim/follow_form.rb +1 -0
- data/app/forms/decidim/registration_form.rb +2 -1
- data/app/helpers/decidim/card_helper.rb +2 -0
- data/app/helpers/decidim/cells_paginate_helper.rb +16 -0
- data/app/helpers/decidim/cta_button_helper.rb +1 -1
- data/app/helpers/decidim/decidim_form_helper.rb +4 -0
- data/app/helpers/decidim/icon_helper.rb +2 -0
- data/app/helpers/decidim/resource_helper.rb +1 -2
- data/app/helpers/decidim/scopes_helper.rb +17 -10
- data/app/helpers/decidim/searches_helper.rb +16 -0
- data/app/helpers/decidim/tooltip_helper.rb +12 -0
- data/app/models/decidim/organization.rb +10 -0
- data/app/models/decidim/permission_action.rb +40 -0
- data/app/models/decidim/searchable_resource.rb +37 -0
- data/app/models/decidim/static_page.rb +4 -0
- data/app/models/decidim/user.rb +39 -3
- data/app/permissions/decidim/default_permissions.rb +61 -0
- data/app/permissions/decidim/permissions.rb +106 -0
- data/app/permissions/decidim/user_manager_permissions.rb +24 -0
- data/app/presenters/decidim/admin_log/organization_presenter.rb +2 -1
- data/app/presenters/decidim/home_stats_presenter.rb +2 -8
- data/app/presenters/decidim/user_presenter.rb +8 -0
- data/app/services/decidim/traceability.rb +6 -9
- data/app/types/decidim/core/user_type.rb +1 -1
- data/app/views/decidim/devise/invitations/edit.html.erb +56 -10
- data/app/views/decidim/devise/registrations/new.html.erb +36 -14
- data/app/views/decidim/devise/shared/_newsletter_modal.html.erb +25 -0
- data/app/views/decidim/follows/update_button.js.erb +2 -2
- data/app/views/decidim/messaging/conversations/_message.html.erb +1 -1
- data/app/views/{pages → decidim/pages}/decidim_page.html.erb +5 -0
- data/app/views/decidim/pages/home.html.erb +17 -0
- data/app/views/{pages → decidim/pages}/home/_extended.html.erb +0 -0
- data/app/views/{pages → decidim/pages}/home/_footer_sub_hero.html.erb +0 -0
- data/app/views/{pages → decidim/pages}/home/_hero.html.erb +0 -0
- data/app/views/{pages → decidim/pages}/home/_highlighted_content_banner.html.erb +0 -0
- data/app/views/{pages → decidim/pages}/home/_highlighted_processes.html.erb +0 -0
- data/app/views/{pages → decidim/pages}/home/_statistics.html.erb +0 -0
- data/app/views/{pages → decidim/pages}/home/_sub_hero.html.erb +0 -0
- data/app/views/decidim/profiles/_followers.html.erb +5 -0
- data/app/views/decidim/profiles/_following.html.erb +5 -0
- data/app/views/decidim/profiles/_notifications.html.erb +0 -0
- data/app/views/decidim/profiles/_user.html.erb +59 -0
- data/app/views/decidim/profiles/_user_follow.erb +32 -0
- data/app/views/decidim/profiles/show.html.erb +32 -59
- data/app/views/decidim/searches/_count.html.erb +1 -0
- data/app/views/decidim/searches/_filters.html.erb +20 -0
- data/app/views/decidim/searches/_filters_small_view.html.erb +18 -0
- data/app/views/decidim/searches/_results.html.erb +5 -0
- data/app/views/decidim/searches/index.html.erb +20 -0
- data/app/views/decidim/searches/index.js.erb +5 -0
- data/app/views/decidim/shared/_address_details.html.erb +7 -9
- data/app/views/decidim/shared/_announcement.html.erb +1 -6
- data/app/views/decidim/shared/_author_reference.html.erb +1 -1
- data/app/views/decidim/shared/_follow_button.html.erb +1 -34
- data/app/views/decidim/shared/_static_map.html.erb +3 -1
- data/app/views/decidim/shared/_tags.html.erb +1 -11
- data/app/views/kaminari/decidim/_paginator.html.erb +16 -15
- data/app/views/layouts/decidim/_head.html.erb +1 -0
- data/app/views/layouts/decidim/_topbar_search.html.erb +8 -0
- data/app/views/layouts/decidim/_user_menu.html.erb +2 -2
- data/app/views/layouts/decidim/_wrapper.html.erb +3 -2
- data/config/initializers/devise.rb +1 -1
- data/config/initializers/rack_attack.rb +28 -0
- data/config/locales/ca.yml +136 -55
- data/config/locales/en.yml +135 -54
- data/config/locales/es.yml +136 -55
- data/config/locales/eu.yml +136 -54
- data/config/locales/fi.yml +135 -54
- data/config/locales/fr.yml +136 -54
- data/config/locales/gl.yml +136 -54
- data/config/locales/it.yml +136 -54
- data/config/locales/nl.yml +136 -54
- data/config/locales/pl.yml +144 -54
- data/config/locales/pt-BR.yml +136 -54
- data/config/locales/pt.yml +136 -54
- data/config/locales/ru.yml +150 -60
- data/config/locales/sv.yml +136 -54
- data/config/locales/uk.yml +146 -57
- data/config/routes.rb +11 -1
- data/db/migrate/20180209122819_create_decidim_searchable_resource.rb +21 -0
- data/db/migrate/20180508111640_add_tos_version_to_organization.rb +19 -0
- data/db/migrate/20180508111710_add_accepted_tos_version_field_to_users.rb +25 -0
- data/db/seeds.rb +33 -26
- data/lib/decidim/component_manifest.rb +35 -27
- data/lib/decidim/content_processor.rb +21 -3
- data/lib/decidim/core.rb +27 -16
- data/lib/decidim/core/engine.rb +8 -19
- data/lib/decidim/core/test.rb +2 -0
- data/lib/decidim/core/test/factories.rb +34 -4
- data/lib/decidim/core/test/shared_examples/fingerprint_examples.rb +15 -0
- data/lib/decidim/core/test/shared_examples/searchable_results_examples.rb +27 -0
- data/lib/decidim/core/version.rb +1 -1
- data/lib/decidim/events/base_event.rb +5 -1
- data/lib/decidim/fingerprint_calculator.rb +42 -0
- data/lib/decidim/fingerprintable.rb +63 -0
- data/lib/decidim/form_builder.rb +1 -0
- data/lib/decidim/manifest_registry.rb +4 -10
- data/lib/decidim/participable.rb +4 -0
- data/lib/decidim/participatory_space_manifest.rb +36 -0
- data/lib/decidim/participatory_space_resourceable.rb +11 -0
- data/lib/decidim/resource_manifest.rb +10 -11
- data/lib/decidim/resourceable.rb +3 -2
- data/lib/decidim/search_resource_fields_mapper.rb +93 -0
- data/lib/decidim/searchable.rb +85 -0
- data/lib/decidim/settings_manifest.rb +3 -2
- data/lib/decidim/traceable.rb +2 -0
- data/lib/decidim/view_model.rb +9 -0
- data/lib/tasks/decidim_tasks.rake +79 -1
- metadata +149 -76
- data/app/assets/stylesheets/decidim/extras/_register_form.scss +0 -9
- data/app/cells/decidim/author_box/show.erb +0 -10
- data/app/cells/decidim/author_box_cell.rb +0 -21
- data/app/cells/decidim/profile/show.erb +0 -13
- data/app/cells/decidim/profile_cell.rb +0 -17
- data/app/controllers/concerns/decidim/needs_authorization.rb +0 -46
- data/app/models/decidim/abilities/admin_ability.rb +0 -29
- data/app/models/decidim/abilities/base_ability.rb +0 -56
- data/app/models/decidim/abilities/everyone_ability.rb +0 -25
- data/app/models/decidim/abilities/participatory_process_admin_ability.rb +0 -28
- data/app/models/decidim/abilities/participatory_process_collaborator_ability.rb +0 -28
- data/app/models/decidim/abilities/participatory_process_moderator_ability.rb +0 -15
- data/app/models/decidim/abilities/user_manager_ability.rb +0 -35
- data/app/views/decidim/notifications/_notification.html.erb +0 -20
- data/app/views/decidim/notifications/index.html.erb +0 -36
- data/app/views/decidim/shared/_author.html.erb +0 -21
- data/app/views/pages/home.html.erb +0 -17
- data/db/migrate/20180613080638_rename_missing_features_to_components.rb +0 -15
- data/lib/decidim/abilities.rb +0 -7
- data/lib/decidim/abilities/participatory_process_role_ability.rb +0 -60
- data/lib/decidim/page_finder.rb +0 -49
@@ -0,0 +1,20 @@
|
|
1
|
+
<% if collapsible? %>
|
2
|
+
<div id="collapsible-list-<%= seed %>" class="collapsible-list is-filtered <%= list_size_class %>" data-toggler=".is-filtered">
|
3
|
+
<% list.each do |element| %>
|
4
|
+
<%= cell cell_name, element, cell_options %>
|
5
|
+
<% end %>
|
6
|
+
<span class="collapsible-list__see-more">
|
7
|
+
<%= t(hidden_elements_count_i18n_key, count: hidden_elements_count) %>
|
8
|
+
</span>
|
9
|
+
<span class="text-small">
|
10
|
+
<a class="collapsible-list__see-more" data-toggle="collapsible-list-<%= seed %>"><%= t("decidim.collapsible_list.see_more") %></a>
|
11
|
+
<a class="collapsible-list__see-less" data-toggle="collapsible-list-<%= seed %>"><%= t("decidim.collapsible_list.see_less") %></a>
|
12
|
+
</span>
|
13
|
+
</div>
|
14
|
+
<% else %>
|
15
|
+
<div class="collapsible-list">
|
16
|
+
<% list.each do |element| %>
|
17
|
+
<%= cell cell_name, element, cell_options %>
|
18
|
+
<% end %>
|
19
|
+
</div>
|
20
|
+
<% end %>
|
@@ -0,0 +1,66 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
# This cell renders a collapsible list of elements. Each element from the
|
5
|
+
# `model` array will be rendered with the `:cell` cell.
|
6
|
+
#
|
7
|
+
# Available sizes:
|
8
|
+
# - `:small` => collapses after 3 elements.
|
9
|
+
# - `:default` => collapses after 7 elements. If not specified, this one is
|
10
|
+
# used.
|
11
|
+
#
|
12
|
+
# Example:
|
13
|
+
#
|
14
|
+
# cell(
|
15
|
+
# "decidim/collapsible_list",
|
16
|
+
# my_list,
|
17
|
+
# cell_name: "my/cell",
|
18
|
+
# cell_options: { my: :options },
|
19
|
+
# hidden_elements_count_i18n_key: "my.custom.key",
|
20
|
+
# size: :small
|
21
|
+
# )
|
22
|
+
class CollapsibleListCell < Decidim::ViewModel
|
23
|
+
MIN_LENGTH_FOR_SIZE = { small: 3, default: 7 }.freeze
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
def list
|
28
|
+
model
|
29
|
+
end
|
30
|
+
|
31
|
+
def cell_name
|
32
|
+
options[:cell_name]
|
33
|
+
end
|
34
|
+
|
35
|
+
def cell_options
|
36
|
+
options[:cell_options]
|
37
|
+
end
|
38
|
+
|
39
|
+
def size
|
40
|
+
return :small if options[:size].to_s == "small"
|
41
|
+
:default
|
42
|
+
end
|
43
|
+
|
44
|
+
def list_size_class
|
45
|
+
return "small" if size == :small
|
46
|
+
""
|
47
|
+
end
|
48
|
+
|
49
|
+
def collapsible?
|
50
|
+
list.size > MIN_LENGTH_FOR_SIZE[size]
|
51
|
+
end
|
52
|
+
|
53
|
+
def hidden_elements_count
|
54
|
+
return 0 unless collapsible?
|
55
|
+
list.size - MIN_LENGTH_FOR_SIZE[size]
|
56
|
+
end
|
57
|
+
|
58
|
+
def hidden_elements_count_i18n_key
|
59
|
+
options[:hidden_elements_count_i18n_key] || "decidim.collapsible_list.hidden_elements_count"
|
60
|
+
end
|
61
|
+
|
62
|
+
def seed
|
63
|
+
@seed ||= Random.rand(9999)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
<div class="tech-info">
|
2
|
+
<a href="#" onclick="event.preventDefault();" data-open="<%= modal_name %>"><%= t "decidim.fingerprint.check" %></a>
|
3
|
+
</div>
|
4
|
+
|
5
|
+
<div id="<%= modal_name %>" class="reveal fingerprint-dialog" data-reveal aria-labelledby="modalTitle" aria-hidden="true" role="dialog">
|
6
|
+
<h2 id="modalTitle"><%= t "decidim.fingerprint.title" %></h2>
|
7
|
+
<p><%= t "decidim.fingerprint.explanation" %></p>
|
8
|
+
<p>
|
9
|
+
<strong><%= t "decidim.fingerprint.value" %>:</strong>
|
10
|
+
<code class="fingerprint-value"><%= model.fingerprint.value %></code>
|
11
|
+
</p>
|
12
|
+
<p>
|
13
|
+
<strong><%= t "decidim.fingerprint.source" %>:</strong>
|
14
|
+
<code class="fingerprint-source"><%= model.fingerprint.source %></code>
|
15
|
+
</p>
|
16
|
+
|
17
|
+
<p><%= t "decidim.fingerprint.replicate_help", online_calculator_link: link_to(t("decidim.fingerprint.online_calculator_name"), "http://www.md5calc.com/sha256", target: "_blank") %>
|
18
|
+
|
19
|
+
<button class="close-button" data-close type="button">
|
20
|
+
<span aria-hidden="true">×</span>
|
21
|
+
</button>
|
22
|
+
</div>
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
class FingerprintCell < Decidim::ViewModel
|
5
|
+
include ActionView::RecordIdentifier
|
6
|
+
|
7
|
+
def show
|
8
|
+
render
|
9
|
+
end
|
10
|
+
|
11
|
+
private
|
12
|
+
|
13
|
+
def modal_name
|
14
|
+
dom_id(model, :fingerprint_dialog)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
<div id="<%= dom_id(model, :follow) %>">
|
2
|
+
<% if current_user %>
|
3
|
+
<% if current_user.follows?(model) %>
|
4
|
+
<%= button_to decidim.follow_path, class: button_classes, params: { follow: { followable_gid: model.to_sgid.to_s, inline: inline? }}, data: { disable: true }, method: :delete, remote: true do %>
|
5
|
+
<%= icon "bell", icon_options %>
|
6
|
+
<span>
|
7
|
+
<%= t("follows.destroy.button", scope: "decidim") %>
|
8
|
+
</span>
|
9
|
+
<% end %>
|
10
|
+
<% else %>
|
11
|
+
<%= button_to decidim.follow_path, class: button_classes, params: { follow: { followable_gid: model.to_sgid.to_s, inline: inline? }}, data: { disable: true }, remote: true do %>
|
12
|
+
<%= icon "bell", icon_options %>
|
13
|
+
<span>
|
14
|
+
<%= t("follows.create.button", scope: "decidim") %>
|
15
|
+
</span>
|
16
|
+
<% end %>
|
17
|
+
<% end %>
|
18
|
+
<% else %>
|
19
|
+
<%= button_to(
|
20
|
+
decidim.follow_path,
|
21
|
+
class: button_classes,
|
22
|
+
params: { follow: { followable_gid: model.to_sgid.to_s, inline: inline? }},
|
23
|
+
data: { tooltip: true, disable_hover: false },
|
24
|
+
:'aria-haspopup' => true,
|
25
|
+
title: t("decidim.shared.follow_button.sign_in_before_follow"),
|
26
|
+
disabled: true,
|
27
|
+
remote: true) do %>
|
28
|
+
<%= icon "bell", icon_options %>
|
29
|
+
<span>
|
30
|
+
<%= t("follows.create.button", scope: "decidim") %>
|
31
|
+
</span>
|
32
|
+
<% end %>
|
33
|
+
<% end %>
|
34
|
+
</div>
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
# This cell renders the button to follow the given resource.
|
5
|
+
class FollowButtonCell < Decidim::ViewModel
|
6
|
+
include LayoutHelper
|
7
|
+
|
8
|
+
def show
|
9
|
+
return if model == current_user
|
10
|
+
render
|
11
|
+
end
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
def current_user
|
16
|
+
context[:current_user]
|
17
|
+
end
|
18
|
+
|
19
|
+
def decidim
|
20
|
+
Decidim::Core::Engine.routes.url_helpers
|
21
|
+
end
|
22
|
+
|
23
|
+
def button_classes
|
24
|
+
return "card__button secondary text-uppercase follow-button" if inline?
|
25
|
+
"button secondary hollow expanded small button--icon follow-button"
|
26
|
+
end
|
27
|
+
|
28
|
+
def icon_options
|
29
|
+
return { class: "icon--small" } if inline?
|
30
|
+
{}
|
31
|
+
end
|
32
|
+
|
33
|
+
# Checks whether the button will be shown inline or not. Inline buttons will
|
34
|
+
# not have any border, and the icon will be small. This is mostly intended
|
35
|
+
# to be used from cards.
|
36
|
+
def inline?
|
37
|
+
options[:inline]
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
<div class="empty-notifications callout secondary <%= "hide" if followers.any? %>">
|
2
|
+
<p><%= t("decidim.followers.no_followers") %></p>
|
3
|
+
</div>
|
4
|
+
<div class="row small-up-1 medium-up-2 card-grid">
|
5
|
+
<% followers.each do |follower| %>
|
6
|
+
<%= card_for follower %>
|
7
|
+
<% end %>
|
8
|
+
</div>
|
9
|
+
<%= decidim_paginate followers %>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
class FollowersCell < Decidim::ViewModel
|
5
|
+
include Decidim::CellsPaginateHelper
|
6
|
+
include Decidim::ApplicationHelper
|
7
|
+
include Decidim::Core::Engine.routes.url_helpers
|
8
|
+
include Decidim::CardHelper
|
9
|
+
|
10
|
+
def show
|
11
|
+
render :show
|
12
|
+
end
|
13
|
+
|
14
|
+
def followers
|
15
|
+
@followers ||= model.followers.page(params[:page]).per(20)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
<div class="empty-notifications callout secondary <%= "hide" if followings.any? %>">
|
2
|
+
<p><%= t("decidim.following.no_followings") %></p>
|
3
|
+
</div>
|
4
|
+
<div class="row small-up-1 medium-up-2 card-grid">
|
5
|
+
<% followings.each do |following| %>
|
6
|
+
<%= card_for following %>
|
7
|
+
<% end %>
|
8
|
+
</div>
|
9
|
+
<%= decidim_paginate followings %>
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
class FollowingCell < Decidim::ViewModel
|
5
|
+
include Decidim::CellsPaginateHelper
|
6
|
+
include Decidim::ApplicationHelper
|
7
|
+
include Decidim::Core::Engine.routes.url_helpers
|
8
|
+
include Decidim::CardHelper
|
9
|
+
|
10
|
+
def show
|
11
|
+
render :show
|
12
|
+
end
|
13
|
+
|
14
|
+
def followings
|
15
|
+
@followings ||= Kaminari.paginate_array(following_users).page(params[:page]).per(20)
|
16
|
+
end
|
17
|
+
|
18
|
+
def following_users
|
19
|
+
@following_users ||= model.following.select do |following|
|
20
|
+
following.is_a?(Decidim::User)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
<div class="empty-notifications callout secondary <%= "hide" if notifications.any? %>">
|
2
|
+
<p><%= t("decidim.notifications.no_notifications") %></p>
|
3
|
+
</div>
|
4
|
+
<div id="notifications">
|
5
|
+
<div class="mb-s text-right">
|
6
|
+
<% if notifications.any? %>
|
7
|
+
<%= link_to(
|
8
|
+
t("mark_all_as_read", scope: "layouts.decidim.notifications_dashboard"),
|
9
|
+
read_all_notifications_path,
|
10
|
+
class: "button title-action__action hollow mark-all-as-read-button",
|
11
|
+
method: :delete,
|
12
|
+
data: { disable: true },
|
13
|
+
remote: true
|
14
|
+
) %>
|
15
|
+
<% end %>
|
16
|
+
</div>
|
17
|
+
|
18
|
+
<% notifications.select(&:resource).each do |notification| %>
|
19
|
+
<div class="card card--widget">
|
20
|
+
<ul class="card-data">
|
21
|
+
<li class="card-data__item">
|
22
|
+
<div class="card__link text-center">
|
23
|
+
<%= resource_icon notification.resource, class: "icon--large" %>
|
24
|
+
<span class="text-medium mt-xs"><%= notification.created_at.strftime("%a %e") %></span>
|
25
|
+
</div>
|
26
|
+
</li>
|
27
|
+
<li class="card-data__item card-data__item--expand absolutes">
|
28
|
+
<div class="mr-s">
|
29
|
+
<span class="text-small"><%= notification.event_class.constantize.model_name.human %></span>
|
30
|
+
<br />
|
31
|
+
<span>
|
32
|
+
<%= notification.event_class_instance.notification_title %>
|
33
|
+
</span>
|
34
|
+
</div>
|
35
|
+
<div class="right center mr-s">
|
36
|
+
<%= link_to notification, remote: true, method: :delete, class: "mark-as-read-button" do %>
|
37
|
+
<%= icon "circle-x", class: "card__link" %>
|
38
|
+
<% end %>
|
39
|
+
</div>
|
40
|
+
</li>
|
41
|
+
</ul>
|
42
|
+
</div>
|
43
|
+
<% end %>
|
44
|
+
</div>
|
45
|
+
|
46
|
+
<%= javascript_include_tag "decidim/notifications" %>
|
47
|
+
|
48
|
+
<%= decidim_paginate notifications %>
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
class NotificationsCell < Decidim::ViewModel
|
5
|
+
include Decidim::CellsPaginateHelper
|
6
|
+
include Decidim::IconHelper
|
7
|
+
include Decidim::Core::Engine.routes.url_helpers
|
8
|
+
|
9
|
+
helper_method :notifications
|
10
|
+
|
11
|
+
def show
|
12
|
+
render :show
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
def notifications
|
18
|
+
@notifications ||= model.notifications.includes(:resource).order(created_at: :desc).page(params[:page]).per(50)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<div id="<%= element_id %>" class="progress__bar<%= " progress__bar--vertical" unless small? %>">
|
2
|
+
<div class="progress__bar__title">
|
3
|
+
<span class="progress__bar__number"><%= progress %></span><%= "/#{total}" if total != 0 %>
|
4
|
+
<span class="progress__bar__text"><%= units_name_text %></span>
|
5
|
+
</div>
|
6
|
+
<% if total != 0 %>
|
7
|
+
<div class="progress progress__bar__bar" role="progressbar" tabindex="0" aria-valuenow="<%= percentage %>" aria-valuemin="0" aria-valuetext="<%= percentage %> percent" aria-valuemax="100">
|
8
|
+
<div class="progress-meter progress__bar__bar--complete" style="width: <%= percentage %>%"></div>
|
9
|
+
<div class="progress__bar__bar--incomplete" style="width:calc(100% - <%= percentage %>%);"></div>
|
10
|
+
</div>
|
11
|
+
<% if subtitle_text.present? %>
|
12
|
+
<div class="progress__bar__subtitle">
|
13
|
+
<%= subtitle_text %>
|
14
|
+
</div>
|
15
|
+
<% end %>
|
16
|
+
<% end %>
|
17
|
+
</div>
|
@@ -0,0 +1,68 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
# This cell renders a collapsible list of elements. Each element from the
|
5
|
+
# `model` array will be rendered with the `:cell` cell.
|
6
|
+
#
|
7
|
+
# The `model` must be an Integer representing how many elements we have right
|
8
|
+
# now. Can be higher than the `:total` options value.
|
9
|
+
#
|
10
|
+
# Available options:
|
11
|
+
# - `:small` => Whether the progress bar should be small or not.
|
12
|
+
# This will probably be set to `true` if rendered in a collection view.
|
13
|
+
# Defaults to `false`.
|
14
|
+
# - `:total` => The amount that will set the progress bar to 100%, the objective
|
15
|
+
# to reach.
|
16
|
+
# - `:units_name` => The I18n key representing the name of the elements we're
|
17
|
+
# counting (votes, signatures, answers...). Can have the `%{count}` format.
|
18
|
+
# - `:element_id` => A String representing the ID that will be given to the
|
19
|
+
# progress bar HTML element.
|
20
|
+
# - `:subtitle_text` => An I18n key representing a subtitle for the element.
|
21
|
+
#
|
22
|
+
# Example:
|
23
|
+
#
|
24
|
+
# cell(
|
25
|
+
# "decidim/progress_bar_list",
|
26
|
+
# 7,
|
27
|
+
# element_id: "my-id",
|
28
|
+
# units_name: "my.i18n.key",
|
29
|
+
# small: true,
|
30
|
+
# total: 10,
|
31
|
+
# subtitle_text: I18n.t("my.subtitle.key")
|
32
|
+
# )
|
33
|
+
class ProgressBarCell < Decidim::ViewModel
|
34
|
+
private
|
35
|
+
|
36
|
+
def element_id
|
37
|
+
options[:element_id]
|
38
|
+
end
|
39
|
+
|
40
|
+
def units_name
|
41
|
+
options[:units_name]
|
42
|
+
end
|
43
|
+
|
44
|
+
def units_name_text
|
45
|
+
I18n.t(units_name, count: progress)
|
46
|
+
end
|
47
|
+
|
48
|
+
def subtitle_text
|
49
|
+
options[:subtitle_text]
|
50
|
+
end
|
51
|
+
|
52
|
+
def small?
|
53
|
+
options[:small].to_s == "true"
|
54
|
+
end
|
55
|
+
|
56
|
+
def progress
|
57
|
+
model
|
58
|
+
end
|
59
|
+
|
60
|
+
def total
|
61
|
+
options[:total]
|
62
|
+
end
|
63
|
+
|
64
|
+
def percentage
|
65
|
+
(progress.to_f / total) * 100
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= content_tag :li, link_to_category %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= content_tag :li, link_to_scope %>
|