diff --git a/app/assets/javascripts/admin/dashboard/actions/form.js b/app/assets/javascripts/admin/dashboard/actions/form.js new file mode 100644 index 000000000..1ef7f4dc1 --- /dev/null +++ b/app/assets/javascripts/admin/dashboard/actions/form.js @@ -0,0 +1,21 @@ +(function() { + "use strict"; + App.AdminDashboardActionsForm = { + initialize: function() { + $("input[name='dashboard_action[action_type]']").on({ + change: function() { + switch ($(this).val()) { + case "proposed_action": + $("#request_to_administrators").hide(); + $("#short_description").hide(); + break; + case "resource": + $("#request_to_administrators").show(); + $("#short_description").show(); + } + } + }).filter("[checked]").trigger("change"); + } + }; +}).call(this); + diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index c2c3c8cfa..d1070d56a 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -169,6 +169,7 @@ var initialize_modules = function() { App.ColumnsSelector.initialize(); } App.AdminBudgetsWizardCreationStep.initialize(); + App.AdminDashboardActionsForm.initialize(); App.AdminMachineLearningScripts.initialize(); App.AdminPollShiftsForm.initialize(); App.AdminTenantsForm.initialize(); diff --git a/app/assets/stylesheets/admin/budgets_wizard/headings/group_switcher.scss b/app/assets/stylesheets/admin/budgets_wizard/headings/group_switcher.scss index c873c0e69..8f5490280 100644 --- a/app/assets/stylesheets/admin/budgets_wizard/headings/group_switcher.scss +++ b/app/assets/stylesheets/admin/budgets_wizard/headings/group_switcher.scss @@ -1,50 +1,8 @@ .budget-group-switcher { margin-bottom: $line-height; - p { + p, + ul { margin-bottom: 0; } - - > .menu > li { - - > button { - align-items: center; - border: $admin-border; - border-radius: $button-radius; - display: inline-flex; - padding: rem-calc(11) rem-calc(16); - - &:active { - color: inherit; - } - - &::after { - @include css-triangle($dropdownmenu-arrow-size, currentcolor, down); - margin-left: 0.2em; - } - } - } - - .menu.is-dropdown-submenu { - margin: 0; - min-width: 100%; - padding: 0; - - li { - margin-bottom: 0; - } - - a { - cursor: default; - padding: rem-calc(11) rem-calc(16); - width: 100%; - - &:focus, - &:hover { - @include brand-background; - @include no-outline; - text-decoration: none; - } - } - } } diff --git a/app/components/admin/budgets_wizard/headings/group_switcher_component.html.erb b/app/components/admin/budgets_wizard/headings/group_switcher_component.html.erb index 1c04c5af5..28e260f57 100644 --- a/app/components/admin/budgets_wizard/headings/group_switcher_component.html.erb +++ b/app/components/admin/budgets_wizard/headings/group_switcher_component.html.erb @@ -2,20 +2,10 @@ <% if other_groups.one? %>

<%= currently_showing_text %> - <%= link_to t("admin.budget_headings.group_switcher.the_other_group", group: other_groups.first.name), - headings_path(other_groups.first) %> + <%= link_to_group(other_groups.first) %>

<% else %>

<%= currently_showing_text %>

- + <%= link_list(*other_groups.map { |group| link_to_group(group) }) %> <% end %> diff --git a/app/components/admin/budgets_wizard/headings/group_switcher_component.rb b/app/components/admin/budgets_wizard/headings/group_switcher_component.rb index ffb85ffda..c6cc6f183 100644 --- a/app/components/admin/budgets_wizard/headings/group_switcher_component.rb +++ b/app/components/admin/budgets_wizard/headings/group_switcher_component.rb @@ -1,5 +1,6 @@ class Admin::BudgetsWizard::Headings::GroupSwitcherComponent < ApplicationComponent attr_reader :group + use_helpers :link_list def initialize(group) @group = group @@ -26,4 +27,12 @@ class Admin::BudgetsWizard::Headings::GroupSwitcherComponent < ApplicationCompon def currently_showing_text sanitize(t("admin.budget_headings.group_switcher.currently_showing", group: group.name)) end + + def link_to_group(group) + link_to(link_to_group_text(group), headings_path(group)) + end + + def link_to_group_text(group) + sanitize(t("admin.budget_headings.group_switcher.the_other_group", group: tag.strong(group.name))) + end end diff --git a/app/helpers/admin/proposal_dashboard_actions_helper.rb b/app/helpers/admin/proposal_dashboard_actions_helper.rb index 2b0cbddf2..17efbd100 100644 --- a/app/helpers/admin/proposal_dashboard_actions_helper.rb +++ b/app/helpers/admin/proposal_dashboard_actions_helper.rb @@ -8,8 +8,4 @@ module Admin::ProposalDashboardActionsHelper def default_actions %w[polls email poster] end - - def css_for_resource(action) - "hide" if action == "proposed_action" - end end diff --git a/app/views/admin/dashboard/actions/_form.html.erb b/app/views/admin/dashboard/actions/_form.html.erb index 3dd147172..a3a4301ea 100644 --- a/app/views/admin/dashboard/actions/_form.html.erb +++ b/app/views/admin/dashboard/actions/_form.html.erb @@ -5,9 +5,7 @@ <%= f.label :action_type %> <% ::Dashboard::Action.action_types.keys.each do |action_type_value| %> - <%= f.radio_button :action_type, - action_type_value, - data: { toggle: "request_to_administrators short_description" } %> + <%= f.radio_button :action_type, action_type_value %> <% end %> @@ -16,9 +14,7 @@ <%= f.check_box :active %> -
+
<%= f.check_box :request_to_administrators %>
@@ -28,7 +24,7 @@
<%= f.text_field :title %> -
+
<%= f.text_field :short_description %>
diff --git a/app/views/admin/site_customization/information_texts/index.html.erb b/app/views/admin/site_customization/information_texts/index.html.erb index c6a2fea43..39af0f84b 100644 --- a/app/views/admin/site_customization/information_texts/index.html.erb +++ b/app/views/admin/site_customization/information_texts/index.html.erb @@ -1,9 +1,9 @@

<%= t("admin.menu.site_customization.information_texts") %>

-
- <%= render "tabs" %> +<%= render "tabs" %> -