decidim-admin 0.21.0 → 0.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/assets/javascripts/decidim/admin/application.js.es6 +4 -0
- data/app/assets/javascripts/decidim/admin/budget_rule_toggler.component.js.es6 +52 -0
- data/app/assets/javascripts/decidim/admin/bundle.js +7 -7
- data/app/assets/javascripts/decidim/admin/bundle.js.map +1 -1
- data/app/assets/javascripts/decidim/admin/dynamic_fields.component.js.es6 +24 -5
- data/app/assets/javascripts/decidim/admin/form.js.es6 +23 -10
- data/app/assets/javascripts/decidim/admin/gallery.js.es6 +5 -0
- data/app/assets/javascripts/decidim/admin/officializations.js.es6 +20 -0
- data/app/assets/stylesheets/decidim/admin/_decidim.scss +2 -0
- data/app/assets/stylesheets/decidim/admin/_variables.scss +1 -1
- data/app/assets/stylesheets/decidim/admin/extra/_newsletter-templates-gallery.scss +3 -0
- data/app/assets/stylesheets/decidim/admin/extra/_organization-appearance.scss +141 -0
- data/app/assets/stylesheets/decidim/admin/extra/_show_email.scss +31 -0
- data/app/assets/stylesheets/decidim/admin/extra/_title_bar.scss +4 -0
- data/app/assets/stylesheets/decidim/admin/modules/_buttons.scss +10 -1
- data/app/assets/stylesheets/decidim/admin/modules/_cards.scss +2 -2
- data/app/assets/stylesheets/decidim/admin/modules/_filters.scss +2 -2
- data/app/assets/stylesheets/decidim/admin/modules/_forms.scss +2 -2
- data/app/assets/stylesheets/decidim/admin/modules/_import_result.scss +10 -0
- data/app/assets/stylesheets/decidim/admin/modules/_loading-spinner.scss +11 -0
- data/app/assets/stylesheets/decidim/admin/modules/_main-nav.scss +0 -1
- data/app/assets/stylesheets/decidim/admin/modules/_modules.scss +5 -1
- data/app/assets/stylesheets/decidim/admin/modules/_process-header.scss +0 -1
- data/app/assets/stylesheets/decidim/admin/modules/_secondary-nav.scss +0 -1
- data/app/assets/stylesheets/decidim/admin/modules/_table-list.scss +0 -5
- data/app/assets/stylesheets/decidim/admin/modules/_users_statistics.scss +18 -0
- data/app/assets/stylesheets/decidim/admin/utils/_mixins.scss +42 -0
- data/app/assets/stylesheets/decidim/admin/utils/_settings.scss +4 -1
- data/app/cells/decidim/admin/content_block/show.erb +2 -2
- data/app/commands/decidim/admin/create_newsletter.rb +34 -9
- data/app/commands/decidim/admin/reorder_content_blocks.rb +1 -1
- data/app/commands/decidim/admin/update_component.rb +27 -3
- data/app/commands/decidim/admin/update_content_block.rb +2 -1
- data/app/commands/decidim/admin/update_newsletter.rb +31 -9
- data/app/commands/decidim/admin/update_organization_appearance.rb +3 -1
- data/app/controllers/decidim/admin/authorization_workflows_controller.rb +6 -0
- data/app/controllers/decidim/admin/components_controller.rb +6 -5
- data/app/controllers/decidim/admin/dashboard_controller.rb +33 -1
- data/app/controllers/decidim/admin/metrics_controller.rb +22 -0
- data/app/controllers/decidim/admin/newsletter_templates_controller.rb +41 -0
- data/app/controllers/decidim/admin/newsletters_controller.rb +22 -4
- data/app/controllers/decidim/admin/officializations_controller.rb +8 -0
- data/app/controllers/decidim/admin/organization_appearance_controller.rb +1 -0
- data/app/controllers/decidim/admin/organization_controller.rb +4 -3
- data/app/controllers/decidim/admin/organization_homepage_content_blocks_controller.rb +1 -1
- data/app/forms/decidim/admin/component_form.rb +0 -23
- data/app/forms/decidim/admin/newsletter_form.rb +15 -3
- data/app/forms/decidim/admin/organization_appearance_form.rb +2 -0
- data/app/helpers/decidim/admin/filterable_helper.rb +35 -27
- data/app/helpers/decidim/admin/icon_link_helper.rb +1 -1
- data/app/helpers/decidim/admin/settings_helper.rb +47 -59
- data/app/helpers/decidim/admin/uploader_image_dimensions_helper.rb +30 -0
- data/app/models/decidim/admin/fake_newsletter.rb +49 -0
- data/app/permissions/decidim/admin/permissions.rb +6 -0
- data/app/presenters/decidim/admin/dashboard_metric_charts_presenter.rb +57 -0
- data/app/queries/decidim/admin/active_users_counter.rb +35 -0
- data/app/views/decidim/admin/attachment_collections/index.html.erb +1 -1
- data/app/views/decidim/admin/authorization_workflows/index.html.erb +1 -0
- data/app/views/decidim/admin/categories/index.html.erb +1 -1
- data/app/views/decidim/admin/components/_settings_fields.html.erb +2 -2
- data/app/views/decidim/admin/dashboard/show.html.erb +35 -10
- data/app/views/decidim/admin/impersonatable_users/index.html.erb +2 -2
- data/app/views/decidim/admin/metrics/_metrics.html.erb +21 -0
- data/app/views/decidim/admin/metrics/index.html.erb +7 -0
- data/app/views/decidim/admin/newsletter_templates/index.html.erb +28 -0
- data/app/views/decidim/admin/newsletter_templates/show.html.erb +12 -0
- data/app/views/decidim/admin/newsletters/_form.html.erb +1 -7
- data/app/views/decidim/admin/newsletters/edit.html.erb +1 -1
- data/app/views/decidim/admin/newsletters/index.html.erb +1 -1
- data/app/views/decidim/admin/newsletters/new.html.erb +1 -1
- data/app/views/decidim/admin/officializations/_show_email_modal.html.erb +31 -0
- data/app/views/decidim/admin/officializations/index.html.erb +7 -3
- data/app/views/decidim/admin/officializations/show_email.html.erb +2 -0
- data/app/views/decidim/admin/organization_appearance/_form.html.erb +2 -72
- data/app/views/decidim/admin/organization_appearance/form/_colors.html.erb +23 -0
- data/app/views/decidim/admin/organization_appearance/form/_images.html.erb +38 -0
- data/app/views/decidim/admin/organization_appearance/form/_minimap.html.erb +46 -0
- data/app/views/decidim/admin/resource_permissions/_options_form.html.erb +1 -1
- data/app/views/decidim/admin/shared/_filters.html.erb +3 -3
- data/app/views/decidim/admin/shared/_gallery.html.erb +21 -0
- data/app/views/decidim/admin/user_groups/index.html.erb +4 -4
- data/app/views/decidim/admin/users_statistics/_users_count.html.erb +39 -0
- data/app/views/layouts/decidim/admin/_application.html.erb +1 -0
- data/app/views/layouts/decidim/admin/_header.html.erb +2 -0
- data/app/views/layouts/decidim/admin/_title_bar.html.erb +20 -10
- data/app/views/layouts/decidim/admin/newsletters.erb +1 -1
- data/config/locales/ar.yml +12 -6
- data/config/locales/bg-BG.yml +16 -0
- data/config/locales/ca.yml +46 -6
- data/config/locales/cs.yml +89 -49
- data/config/locales/da-DK.yml +1 -0
- data/config/locales/de.yml +102 -6
- data/config/locales/el.yml +848 -0
- data/config/locales/en.yml +46 -6
- data/config/locales/eo-UY.yml +0 -1
- data/config/locales/es-MX.yml +46 -6
- data/config/locales/es-PY.yml +46 -6
- data/config/locales/es.yml +46 -6
- data/config/locales/et-EE.yml +1 -0
- data/config/locales/eu.yml +12 -6
- data/config/locales/fi-plain.yml +46 -6
- data/config/locales/fi.yml +61 -21
- data/config/locales/fr-CA.yml +849 -0
- data/config/locales/fr.yml +83 -6
- data/config/locales/ga-IE.yml +1 -0
- data/config/locales/gl.yml +12 -6
- data/config/locales/hr-HR.yml +1 -0
- data/config/locales/hu.yml +46 -6
- data/config/locales/id-ID.yml +12 -6
- data/config/locales/is-IS.yml +10 -5
- data/config/locales/it.yml +78 -38
- data/config/locales/ja-JP.yml +849 -0
- data/config/locales/lt-LT.yml +1 -0
- data/config/locales/lv-LV.yml +835 -0
- data/config/locales/mt-MT.yml +1 -0
- data/config/locales/nl.yml +63 -6
- data/config/locales/no.yml +80 -43
- data/config/locales/pl.yml +309 -185
- data/config/locales/pt-BR.yml +13 -7
- data/config/locales/pt.yml +331 -207
- data/config/locales/ro-RO.yml +844 -0
- data/config/locales/ru.yml +11 -5
- data/config/locales/sk-SK.yml +823 -0
- data/config/locales/sk.yml +842 -0
- data/config/locales/sl.yml +175 -0
- data/config/locales/sr-CS.yml +625 -0
- data/config/locales/sv.yml +94 -12
- data/config/locales/tr-TR.yml +12 -6
- data/config/locales/uk.yml +10 -5
- data/config/routes.rb +13 -2
- data/lib/decidim/admin/engine.rb +2 -1
- data/lib/decidim/admin/version.rb +1 -1
- metadata +53 -18
|
@@ -9,7 +9,8 @@ module Decidim
|
|
|
9
9
|
boolean: :check_box,
|
|
10
10
|
integer: :number_field,
|
|
11
11
|
string: :text_field,
|
|
12
|
-
text: :text_area
|
|
12
|
+
text: :text_area,
|
|
13
|
+
enum: :collection_radio_buttons
|
|
13
14
|
}.freeze
|
|
14
15
|
|
|
15
16
|
# Public: Renders a form field that matches a settings attribute's
|
|
@@ -22,67 +23,65 @@ module Decidim
|
|
|
22
23
|
# options - Extra options to be passed to the field helper.
|
|
23
24
|
#
|
|
24
25
|
# Returns a rendered form field.
|
|
25
|
-
def settings_attribute_input(form, attribute, name, options = {})
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
form.send(:translated, form_method, name, options.merge(extra_options))
|
|
33
|
-
else
|
|
34
|
-
form_method = form_method_for_attribute(attribute)
|
|
35
|
-
extra_options = extra_options_for(name).merge(extra_options_for_type(form_method))
|
|
36
|
-
form.send(form_method, name, options.merge(extra_options))
|
|
26
|
+
def settings_attribute_input(form, attribute, name, i18n_scope, options = {})
|
|
27
|
+
form_method = form_method_for_attribute(attribute)
|
|
28
|
+
|
|
29
|
+
container_class = "#{name}_container"
|
|
30
|
+
if options[:readonly]
|
|
31
|
+
container_class += " readonly_container"
|
|
32
|
+
help_text = text_for_setting(name, "readonly", i18n_scope)
|
|
37
33
|
end
|
|
38
|
-
|
|
34
|
+
help_text ||= text_for_setting(name, "help", i18n_scope)
|
|
35
|
+
help_text_options = help_text ? { help_text: help_text } : {}
|
|
39
36
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
37
|
+
options = { label: t(name, scope: i18n_scope) }
|
|
38
|
+
.merge(help_text_options)
|
|
39
|
+
.merge(extra_options_for_type(form_method))
|
|
40
|
+
.merge(options)
|
|
41
|
+
|
|
42
|
+
content_tag(:div, class: container_class) do
|
|
43
|
+
if attribute.translated?
|
|
44
|
+
options[:tabs_id] = "#{options.delete(:tabs_prefix)}-#{name}-tabs"
|
|
45
|
+
form.send(:translated, form_method, name, options)
|
|
46
|
+
elsif form_method == :collection_radio_buttons
|
|
47
|
+
render_enum_form_field(form, attribute, name, i18n_scope, options)
|
|
48
|
+
else
|
|
49
|
+
form.send(form_method, name, options)
|
|
50
|
+
end
|
|
51
|
+
end.html_safe
|
|
44
52
|
end
|
|
45
53
|
|
|
46
54
|
private
|
|
47
55
|
|
|
48
|
-
# Returns a radio buttons collection input for the
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
html = label_tag(:amendments_visibility) do
|
|
56
|
+
# Returns a radio buttons collection input for the given attribute
|
|
57
|
+
def render_enum_form_field(form, attribute, name, i18n_scope, options)
|
|
58
|
+
html = label_tag(name) do
|
|
52
59
|
concat options[:label]
|
|
53
60
|
concat tag(:br)
|
|
54
|
-
concat form.collection_radio_buttons(
|
|
55
|
-
|
|
61
|
+
concat form.collection_radio_buttons(name,
|
|
62
|
+
build_enum_choices(name, i18n_scope, attribute.build_choices),
|
|
56
63
|
:last,
|
|
57
64
|
:first,
|
|
58
|
-
{ checked: form.object.
|
|
59
|
-
|
|
65
|
+
{ checked: form.object.send(name) },
|
|
66
|
+
options) { |b| b.label { b.radio_button + b.text } }
|
|
60
67
|
end
|
|
61
|
-
html << content_tag(:p,
|
|
62
|
-
html
|
|
68
|
+
html << content_tag(:p, options[:help_text], class: "help-text") if options[:help_text]
|
|
69
|
+
html
|
|
63
70
|
end
|
|
64
71
|
|
|
72
|
+
# Returns a translation or nil. If nil, ZURB Foundation won't add the help_text.
|
|
73
|
+
def text_for_setting(name, suffix, i18n_scope)
|
|
74
|
+
key = "#{i18n_scope}.#{name}_#{suffix}"
|
|
75
|
+
return t(key) if I18n.exists?(key)
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
# Returns the FormBuilder's method used to render
|
|
65
79
|
def form_method_for_attribute(attribute)
|
|
66
80
|
return :editor if attribute.type.to_sym == :text && attribute.editor?
|
|
67
81
|
|
|
68
82
|
TYPES[attribute.type.to_sym]
|
|
69
83
|
end
|
|
70
84
|
|
|
71
|
-
# Handles special cases.
|
|
72
|
-
# Returns an empty Hash or a Hash with extra HTML options.
|
|
73
|
-
def extra_options_for(field_name)
|
|
74
|
-
case field_name
|
|
75
|
-
when :participatory_texts_enabled
|
|
76
|
-
participatory_texts_extra_options
|
|
77
|
-
when :amendment_creation_enabled,
|
|
78
|
-
:amendment_reaction_enabled,
|
|
79
|
-
:amendment_promotion_enabled
|
|
80
|
-
amendments_extra_options
|
|
81
|
-
else
|
|
82
|
-
{}
|
|
83
|
-
end
|
|
84
|
-
end
|
|
85
|
-
|
|
86
85
|
# Handles special cases.
|
|
87
86
|
# Returns an empty Hash or a Hash with extra HTML options.
|
|
88
87
|
def extra_options_for_type(input_type)
|
|
@@ -94,22 +93,11 @@ module Decidim
|
|
|
94
93
|
end
|
|
95
94
|
end
|
|
96
95
|
|
|
97
|
-
#
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
{
|
|
104
|
-
class: "participatory_texts_disabled",
|
|
105
|
-
help_text: help_text_for_component_setting(:participatory_texts_disabled, :global, :proposals)
|
|
106
|
-
}
|
|
107
|
-
end
|
|
108
|
-
|
|
109
|
-
# Marks component_step_settings related to amendments with a CSS class,
|
|
110
|
-
# so they can be identified in "decidim/admin/form.js".
|
|
111
|
-
def amendments_extra_options
|
|
112
|
-
{ class: "amendments_step_settings" }
|
|
96
|
+
# Build options for enum attributes
|
|
97
|
+
def build_enum_choices(name, i18n_scope, choices)
|
|
98
|
+
choices.map do |choice|
|
|
99
|
+
[t("#{name}_choices.#{choice}", scope: i18n_scope), choice]
|
|
100
|
+
end
|
|
113
101
|
end
|
|
114
102
|
end
|
|
115
103
|
end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Decidim
|
|
4
|
+
module Admin
|
|
5
|
+
# This class contains helpers needed to obtain information about
|
|
6
|
+
# image dimensions from the processors defined in the specific image's Uploader class
|
|
7
|
+
module UploaderImageDimensionsHelper
|
|
8
|
+
# Find the dimensions info of a model's image field and get the first value for dimensions ([w, h])
|
|
9
|
+
#
|
|
10
|
+
# model - The model to which the image belongs (An instance of `ActiveRecord`)
|
|
11
|
+
# image_name - The attribute name for the image (either a `symbol` or a `string`)
|
|
12
|
+
#
|
|
13
|
+
# Returns an integer array with [width, height]
|
|
14
|
+
def image_dimensions(model, image_name)
|
|
15
|
+
versions = model.send(image_name).dimensions_info
|
|
16
|
+
[:small, :medium, :default].map { |v| versions.dig(v, :dimensions) }.compact.first
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
# Find the first value for the processed image width
|
|
20
|
+
def image_width(model, image_name)
|
|
21
|
+
image_dimensions(model, image_name)[0]
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
# Find the first value for the processed image height
|
|
25
|
+
def image_height(model, image_name)
|
|
26
|
+
image_dimensions(model, image_name)[1]
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Decidim
|
|
4
|
+
module Admin
|
|
5
|
+
# This class is used to generate fake newsletters and data to preview
|
|
6
|
+
# newsletter templates.
|
|
7
|
+
class FakeNewsletter
|
|
8
|
+
def initialize(organization, manifest)
|
|
9
|
+
@organization = organization
|
|
10
|
+
@manifest = manifest
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def id
|
|
14
|
+
1
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def template
|
|
18
|
+
@template ||= Decidim::ContentBlock.new(
|
|
19
|
+
in_preview: true,
|
|
20
|
+
manifest_name: manifest.name,
|
|
21
|
+
scope_name: :newsletter_template,
|
|
22
|
+
settings: manifest.settings.attributes.inject({}) do |acc, (name, attrs)|
|
|
23
|
+
value = if attrs.preview.respond_to?(:call)
|
|
24
|
+
attrs.preview.call
|
|
25
|
+
else
|
|
26
|
+
attrs.preview
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
acc.update(name => value)
|
|
30
|
+
end
|
|
31
|
+
)
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def subject
|
|
35
|
+
organization.available_locales.inject({}) do |acc, locale|
|
|
36
|
+
acc.update(locale => "Lorem ipsum")
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def sent_at
|
|
41
|
+
nil
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
private
|
|
45
|
+
|
|
46
|
+
attr_reader :organization, :manifest
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
@@ -31,6 +31,7 @@ module Decidim
|
|
|
31
31
|
|
|
32
32
|
if user.admin? && admin_terms_accepted?
|
|
33
33
|
allow! if read_admin_log_action?
|
|
34
|
+
allow! if read_metrics_action?
|
|
34
35
|
allow! if static_page_action?
|
|
35
36
|
allow! if organization_action?
|
|
36
37
|
allow! if user_action?
|
|
@@ -96,6 +97,11 @@ module Decidim
|
|
|
96
97
|
end
|
|
97
98
|
end
|
|
98
99
|
|
|
100
|
+
def read_metrics_action?
|
|
101
|
+
permission_action.subject == :metrics &&
|
|
102
|
+
permission_action.action == :read
|
|
103
|
+
end
|
|
104
|
+
|
|
99
105
|
def read_admin_log_action?
|
|
100
106
|
permission_action.subject == :admin_log &&
|
|
101
107
|
permission_action.action == :read
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Decidim
|
|
4
|
+
module Admin
|
|
5
|
+
class DashboardMetricChartsPresenter < Decidim::MetricChartsPresenter
|
|
6
|
+
attribute :summary, Boolean
|
|
7
|
+
|
|
8
|
+
def render_not_highlighted(metrics)
|
|
9
|
+
safe_join(
|
|
10
|
+
metrics.map do |metric|
|
|
11
|
+
render_metrics_data(metric.metric_name, klass: not_highlighted_classes, graph_klass: "small")
|
|
12
|
+
end
|
|
13
|
+
)
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def highlighted_metrics
|
|
17
|
+
return super unless summary?
|
|
18
|
+
|
|
19
|
+
Decidim.metrics_registry.filtered(
|
|
20
|
+
highlight: true,
|
|
21
|
+
scope: "home"
|
|
22
|
+
).select do |registry|
|
|
23
|
+
%w(users proposals).include? registry.metric_name
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def not_highlighted_metrics
|
|
28
|
+
return super unless summary?
|
|
29
|
+
|
|
30
|
+
Decidim.metrics_registry.filtered(
|
|
31
|
+
highlight: false,
|
|
32
|
+
scope: "home"
|
|
33
|
+
).select do |registry|
|
|
34
|
+
%w(comments meetings accepted_proposals results).include? registry.metric_name
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
private
|
|
39
|
+
|
|
40
|
+
def highlighted_classes
|
|
41
|
+
return "cell medium-6" if summary?
|
|
42
|
+
|
|
43
|
+
"cell medium-4"
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def not_highlighted_classes
|
|
47
|
+
return "cell medium-3" if summary?
|
|
48
|
+
|
|
49
|
+
"cell medium-2"
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def not_highlighted_wrapper_classes
|
|
53
|
+
"grid-x grid-margin-x"
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Decidim
|
|
4
|
+
module Admin
|
|
5
|
+
# Counts active users making a distinction between whether they are admins or participants
|
|
6
|
+
class ActiveUsersCounter < Rectify::Query
|
|
7
|
+
# Initializes the class.
|
|
8
|
+
#
|
|
9
|
+
# @param organization [Organization] Current organization
|
|
10
|
+
# @param date [Date] Period time to make users count check
|
|
11
|
+
# @param admin [boolean] Possible values : t for Admin or f for participant
|
|
12
|
+
def initialize(organization:, date:, admin: false)
|
|
13
|
+
@organization = organization
|
|
14
|
+
@date = date
|
|
15
|
+
@admin = admin
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
# Count the user's number who have logged in since given date
|
|
19
|
+
#
|
|
20
|
+
# Returns an ActiveRecord::Relation
|
|
21
|
+
def query
|
|
22
|
+
return Decidim::User.none unless organization && date
|
|
23
|
+
|
|
24
|
+
query = Decidim::User.left_outer_joins(:organization).where(decidim_organizations: { id: organization.id })
|
|
25
|
+
query = query.where("#{Decidim::User.table_name}.current_sign_in_at >= ?", date)
|
|
26
|
+
query = query.where(admin: admin)
|
|
27
|
+
query
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
private
|
|
31
|
+
|
|
32
|
+
attr_reader :organization, :date, :admin
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
<%= icon_link_to "circle-x", polymorphic_path([collection_for, attachment_collection]), t("actions.destroy", scope: "decidim.admin"), class: "action-icon--remove", method: :delete, data: { confirm: t("actions.confirm_destroy", scope: "decidim.admin") } %>
|
|
35
35
|
<% else %>
|
|
36
36
|
<span class="action-icon" title="<%= t("attachment_collections.index.attachment_collection_used", scope: "decidim.admin") %>" data-tooltip="true" data-disable-hover="false">
|
|
37
|
-
<%= icon "circle-x", class: "action-icon action-icon--disabled" %>
|
|
37
|
+
<%= icon "circle-x", class: "action-icon action-icon--disabled", role: "img" %>
|
|
38
38
|
</span>
|
|
39
39
|
<% end %>
|
|
40
40
|
<% end %>
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
<%= icon_link_to "circle-x", category_path(current_participatory_space, category), t("actions.destroy", scope: "decidim.admin"), class: "action-icon--remove", method: :delete, data: { confirm: t("actions.confirm_destroy", scope: "decidim.admin") } %>
|
|
35
35
|
<% else %>
|
|
36
36
|
<span class="action-icon" title="<%= t("categories.index.category_used", scope: "decidim.admin") %>" data-tooltip="true" data-disable-hover="false">
|
|
37
|
-
<%= icon "circle-x", class: "action-icon action-icon--disabled" %>
|
|
37
|
+
<%= icon "circle-x", class: "action-icon action-icon--disabled", role: "img" %>
|
|
38
38
|
</span>
|
|
39
39
|
<% end %>
|
|
40
40
|
<% end %>
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
form,
|
|
4
4
|
settings_attribute,
|
|
5
5
|
field_name,
|
|
6
|
-
|
|
6
|
+
"decidim.components.#{manifest.name}.settings.#{settings_name}",
|
|
7
7
|
tabs_prefix: tabs_prefix,
|
|
8
|
-
|
|
8
|
+
readonly: settings_attribute.readonly?(component: @component)
|
|
9
9
|
) %>
|
|
10
10
|
<% end %>
|
|
@@ -10,16 +10,41 @@
|
|
|
10
10
|
<%= cell("decidim/announcement", admin_terms_announcement_args ) %>
|
|
11
11
|
<% end %>
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
<
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
13
|
+
<div class="grid-x grid-margin-x">
|
|
14
|
+
<% if current_user.admin? && current_user.organization&.id == current_organization.id %>
|
|
15
|
+
<div class="cell small-12 medium-6 large-4">
|
|
16
|
+
<%= render(
|
|
17
|
+
partial: "decidim/admin/users_statistics/users_count",
|
|
18
|
+
locals: {
|
|
19
|
+
result: users_counter
|
|
20
|
+
}
|
|
21
|
+
) %>
|
|
22
|
+
</div>
|
|
23
|
+
<% end %>
|
|
24
|
+
</div>
|
|
25
|
+
|
|
26
|
+
<div class="grid-x grid-margin-x">
|
|
27
|
+
<% if allowed_to? :read, :metrics %>
|
|
28
|
+
<div class="cell small-6">
|
|
29
|
+
<%= render(
|
|
30
|
+
partial: "decidim/admin/metrics/metrics",
|
|
31
|
+
locals: {
|
|
32
|
+
metrics_presenter: metrics_presenter,
|
|
33
|
+
show_link_to_more: true
|
|
34
|
+
}
|
|
35
|
+
) %>
|
|
36
|
+
</div>
|
|
37
|
+
<% end %>
|
|
38
|
+
|
|
39
|
+
<% if allowed_to? :read, :admin_log %>
|
|
40
|
+
<div class="cell small-6">
|
|
41
|
+
<%= render partial: "decidim/admin/logs/logs_list", locals: { logs: latest_action_logs } %>
|
|
42
|
+
<% if latest_action_logs.any? %>
|
|
43
|
+
<div class="text-center"><%= link_to t(".view_more_logs"), logs_path %></div>
|
|
44
|
+
<% end %>
|
|
45
|
+
</div>
|
|
46
|
+
<% end %>
|
|
47
|
+
</div>
|
|
23
48
|
|
|
24
49
|
<% if current_user.admin_terms_accepted? %>
|
|
25
50
|
<p class="text-right">
|
|
@@ -33,8 +33,8 @@
|
|
|
33
33
|
<%= search_field_tag :q, @query,label: false, class: "input-group-field", placeholder: t(".search") %>
|
|
34
34
|
<%= hidden_field_tag :state, @state %>
|
|
35
35
|
<div class="input-group-button">
|
|
36
|
-
<button type="submit" class="button
|
|
37
|
-
<%= icon "magnifying-glass", aria_label: t(".search") %>
|
|
36
|
+
<button type="submit" class="button">
|
|
37
|
+
<%= icon "magnifying-glass", aria_label: t(".search"), role: "img" %>
|
|
38
38
|
</button>
|
|
39
39
|
</div>
|
|
40
40
|
</div>
|