Skip to content

Commit

Permalink
Update views
Browse files Browse the repository at this point in the history
  • Loading branch information
JoonasAapro committed Dec 23, 2024
1 parent 7d35dda commit c4b84fb
Show file tree
Hide file tree
Showing 44 changed files with 349 additions and 349 deletions.
2 changes: 1 addition & 1 deletion app/cells/decidim/budgets/project_l_cell.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
module Decidim
module Budgets
# This cell renders a project with its L-size card.
class ProjectLCell < Decidim::Budgets::ProjectGCell
class ProjectLCell < Decidim::Budgets::ProjectCell
def card_classes
classes = super
classes = classes.split unless classes.is_a?(Array)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<%= link_to resource_path, class: "card__link" do %>
<span aria-hidden="true">
<%= t(".more_info") %>
<%= icon "chevron-right", role: "img", "aria-hidden": true %>
<%= icon "arrow-right-s-line", role: "img", "aria-hidden": true %>
</span>
<span class="show-for-sr">
<%= t(".more_info_with_title", title: resource_title) %>
Expand Down
2 changes: 1 addition & 1 deletion app/cells/decidim/budgets/project_m/votes_counter.erb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<%= icon("circle-check", class: "icon--small", aria_label: "#{t("decidim.budgets.project_m.votes_count")}:", role: "img") %>
<%= icon("checkbox-circle-line", class: "icon--small", aria_label: "#{t("decidim.budgets.project_m.votes_count")}:", role: "img") %>
<%= " " %>
<%= votes_count %>
2 changes: 1 addition & 1 deletion app/cells/decidim/budgets/project_m/voting_buttons.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
label: t("view_detailed", scope: "decidim.budgets.projects.project", name: title)
} do %>
<%= t("view", scope: "decidim.budgets.projects.project") %>
<%= icon "chevron-right", role: "img", "aria-hidden": true %>
<%= icon "arrow-right-s-line", role: "img", "aria-hidden": true %>
<% end %>
</div>
<div class="text-center">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def default_filter_params
{
search_text_cont: "",
with_any_status: %w(all),
with_any_scope: default_filter_scope_params,
with_any_scope: nil,
with_any_category: "all",
decidim_budgets_budget_id_eq: nil,
budget_amount_gteq: 0,
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/decidim/budgets/votes_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ def default_filter_params
{
search_text_cont: "",
with_any_status: %w(all),
with_any_scope: default_filter_scope_params,
with_any_scope: nil,
with_any_category: "all",
decidim_budgets_budget_id_eq: nil,
budget_amount_gteq: 0,
Expand Down
37 changes: 22 additions & 15 deletions app/views/decidim/budgets/admin/budgets/_form.html.erb
Original file line number Diff line number Diff line change
@@ -1,33 +1,40 @@
<div class="card">
<div class="card-divider">
<h2 class="card-title"><%= title %></h2>
</div>

<div class="card-section">
<div class="row column">
<%= form.translated :text_field, :title, autofocus: true %>
<div class="form__wrapper">
<div class="card pt-4">
<div class="card-section">
<div class="row column">
<%= form.translated :text_field, :title, autofocus: true, aria: { label: :title } %>
</div>

<%= form.number_field :weight %>
<div class="row column">
<%= form.number_field :weight %>
</div>

<%= form.translated :editor, :description %>
<div class="row column">
<%= form.translated :editor, :description, toolbar: :content, aria: { label: :description } %>
</div>

<div class="row column">
<%= form.upload :list_image %>
<%= form.upload :list_image, button_class: "button button__sm button__transparent-secondary" %>
</div>

<%= form.number_field :total_budget %>
<div class="row column">
<%= form.number_field :total_budget %>
</div>

<% if current_component.settings.geocoding_enabled %>
<%= form.number_field :center_latitude %>
<div class="row column">
<%= form.number_field :center_latitude %>

<%= form.number_field :center_longitude %>
<%= form.number_field :center_longitude %>
</div>
<% end %>

<% if current_component.has_subscopes? %>
<div class="row column">
<%= scopes_picker_field form, :decidim_scope_id, root: current_component.scope %>
<%= scopes_select_field form, :decidim_scope_id, root: current_component.scope %>
</div>
<% end %>
</div>
</div>
</div>
</div>
123 changes: 61 additions & 62 deletions app/views/decidim/budgets/admin/budgets/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,70 +1,69 @@
<div class="card with-overflow">
<div class="card-divider">
<h2 class="card-title flex--sbc">
<div>
<%= t(".title") %>
</div>
<div class="flex--cc flex-gap--1">
<% if allowed_to? :export, :budget %>
<%= export_dropdown %>
<% add_decidim_page_title(t(".title")) %>
<div class="card">
<div class="item_show__header">
<h1 class="item_show__header-title">
<%= t(".title") %>
<% if allowed_to? :export, :budget %>
<%= export_dropdown %>
<% end %>
<div id="js-other-actions-wrapper">
<%= link_to t("actions.new_budget", scope: "decidim.budgets"), new_budget_path, class: "button button__sm button__secondary" if allowed_to? :create, :budget %>
<%= link_to t("decidim.budgets.admin.helps.index.title"), helps_path, class: "button button__sm button__secondary" %>
<% if allowed_to? :export_results, :budgets %>
<%= link_to t("actions.export_results", scope: "decidim.budgets.admin"), new_results_export_path, class: "button button__sm button__secondary" %>
<% end %>
<div id="js-other-actions-wrapper">
<%= link_to t("actions.new", scope: "decidim.budgets", name: t("models.budget.name", scope: "decidim.budgets.admin")), new_budget_path, class: "button tiny button--title" if allowed_to? :create, :budget %>
<%= link_to t("decidim.budgets.admin.helps.index.title"), helps_path, class: "button tiny button--title" %>
<% if allowed_to? :export_results, :budgets %>
<%= link_to t("actions.export_results", scope: "decidim.budgets.admin"), new_results_export_path, class: "button tiny button--title" %>
<% end %>
</div>
</div>
</h2>
<%= render partial: "decidim/admin/components/resource_action" %>
</h1>
</div>
<div class="table-scroll">
<table class="table-list">
<thead>
<tr>
<th><%= t("models.budget.fields.name", scope: "decidim.budgets") %></th>
<th><%= t("models.budget.fields.total_budget", scope: "decidim.budgets") %></th>
<th><%= t("models.budget.fields.projects_count", scope: "decidim.budgets") %></th>
<%= th_resource_scope_label %>
<th class="actions"><%= t("actions.title", scope: "decidim.budgets") %></th>
</tr>
</thead>
<tbody>
<% budgets.each do |budget| %>
<tr data-id="<%= budget.id %>">
<td>
<% if allowed_to? :update, :budget, budget: budget %>
<%= link_to translated_attribute(budget.title), budget_projects_path(budget) %><br>
<% else %>
<%= translated_attribute(budget.title) %>
<% end %>
</td>
<td>
<%= number_to_currency budget.total_budget, unit: Decidim.currency_unit, precision: 0 %>
</td>
<td>
<%= link_to budget.projects.count, budget_projects_path(budget) %>
</td>
<%= td_resource_scope_for(budget.scope) %>
<td class="table-list__actions">
<% if allowed_to? :update, :budget, budget: budget %>
<%= icon_link_to "pencil-line", edit_budget_path(budget), t("actions.edit", scope: "decidim.budgets"), class: "action-icon--edit" %>
<% else %>
<%= icon "pencil-line", class: "action-icon action-icon--disabled", role: "img", aria_label: t("actions.edit", scope: "decidim.budgets") %>
<% end %>

<div class="card-section">
<div class="table-scroll">
<table class="table-list">
<thead>
<tr>
<th><%= t("models.budget.fields.name", scope: "decidim.budgets") %></th>
<th><%= t("models.budget.fields.total_budget", scope: "decidim.budgets") %></th>
<th><%= t("models.budget.fields.projects_count", scope: "decidim.budgets") %></th>
<%= th_resource_scope_label %>
<th class="actions"><%= t("actions.title", scope: "decidim.budgets") %></th>
</tr>
</thead>
<tbody>
<% budgets.each do |budget| %>
<tr data-id="<%= budget.id %>">
<td>
<%= link_to translated_attribute(budget.title), resource_locator(budget).path %>
</td>
<td>
<%= number_to_currency budget.total_budget, unit: Decidim.currency_unit, precision: 0 %>
</td>
<td>
<%= link_to budget.projects.count, budget_projects_path(budget) %>
</td>
<%= td_resource_scope_for(budget.scope) %>
<td class="table-list__actions">
<%= icon_link_to "eye", resource_locator(budget).path, t("actions.preview", scope: "decidim.budgets"), class: "action-icon--preview", target: :blank %>

<%= icon_link_to "list", budget_projects_path(budget), t("actions.edit_projects", scope: "decidim.budgets"), class: "action-icon--edit-projects" %>
<%= icon_link_to "list-check", budget_projects_path(budget), t("actions.edit_projects", scope: "decidim.budgets"), class: "action-icon--edit-projects" %>

<% if allowed_to? :update, :budget, budget: budget %>
<%= icon_link_to "pencil", edit_budget_path(budget), t("actions.edit", scope: "decidim.budgets"), class: "action-icon--edit" %>
<% else %>
<%= icon "pencil", class: "action-icon action-icon--disabled", role: "img", aria_label: t("actions.edit", scope: "decidim.budgets") %>
<% end %>
<%= icon_link_to "eye-line", resource_locator(budget).path, t("actions.preview", scope: "decidim.budgets"), class: "action-icon--preview", target: :blank, data: { "external-link": false } %>

<% if allowed_to? :delete, :budget, budget: budget %>
<%= icon_link_to "circle-x", budget_path(budget), t("actions.destroy", scope: "decidim.budgets"), method: :delete, class: "action-icon--remove", data: { confirm: t("actions.confirm_destroy", scope: "decidim.budgets") } %>
<% else %>
<%= icon "circle-x", class: "action-icon action-icon--disabled", role: "img", aria_label: t("actions.destroy", scope: "decidim.budgets") %>
<% end %>
</td>
</tr>
<% end %>
</tbody>
</table>
</div>
<% if allowed_to? :delete, :budget, budget: budget %>
<%= icon_link_to "delete-bin-line", budget_path(budget), t("actions.destroy", scope: "decidim.budgets"), method: :delete, class: "action-icon--remove", data: { confirm: t("actions.confirm_destroy", scope: "decidim.budgets") } %>
<% else %>
<%= icon "delete-bin-line", class: "action-icon action-icon--disabled", role: "img", aria_label: t("actions.destroy", scope: "decidim.budgets") %>
<% end %>
</td>
</tr>
<% end %>
</tbody>
</table>
</div>
</div>
38 changes: 20 additions & 18 deletions app/views/decidim/budgets/admin/help_sections/_form.html.erb
Original file line number Diff line number Diff line change
@@ -1,27 +1,29 @@
<div class="card">
<div class="card-divider">
<h2 class="card-title">
<div>
<%= link_to t("decidim.budgets.admin.helps.index.title"), helps_path %> &gt;
<%= link_to container.name, help_sections_path(container.key) %> &gt;
<%= title %>
</div>
</h2>
</div>
<div class="form__wrapper">
<div class="card pt-4">
<div class="card-divider">
<h2 class="card-title">
<div>
<%= link_to t("decidim.budgets.admin.helps.index.title"), helps_path %> &gt;
<%= link_to container.name, help_sections_path(container.key) %> &gt;
<%= title %>
</div>
</h2>
</div>

<div class="card-section">
<div class="row column">
<%= form.translated :text_field, :title, autofocus: true %>
<div class="card-section">
<div class="row column">
<%= form.translated :text_field, :title, autofocus: true %>

<%= form.number_field :weight %>
<%= form.number_field :weight %>

<%= form.translated :editor, :description %>
<%= form.translated :editor, :description %>

<%= form.translated :text_field, :link_text %>
<%= form.translated :text_field, :link_text %>

<%= form.text_field :link %>
<%= form.text_field :link %>

<%= form.upload :image %>
<%= form.upload :image, button_class: "button button__sm button__transparent-secondary" %>
</div>
</div>
</div>
</div>
10 changes: 6 additions & 4 deletions app/views/decidim/budgets/admin/help_sections/edit.html.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<%= decidim_form_for(@form, url: help_section_path(container.key, @form), html: { class: "form edit_help_section" }) do |f| %>
<%= decidim_form_for(@form, url: help_section_path(container.key, @form), html: { class: "form form-defaults edit_help_section" }) do |f| %>
<%= render partial: "form", object: f, locals: { title: t(".title") } %>

<div class="button--double form-general-submit">
<%= f.submit t(".update") %>
</div>
<div class="item__edit-sticky">
<div class="item__edit-sticky-container">
<%= f.submit t(".update"), class: "button button__sm button__secondary" %>
</div>
</div>
<% end %>
23 changes: 11 additions & 12 deletions app/views/decidim/budgets/admin/help_sections/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
<div class="card with-overflow">
<div class="card-divider">
<h2 class="card-title flex--sbc">
<% add_decidim_page_title(t("decidim.budgets.admin.helps.index.title")) %>
<div class="card">
<div class="item_show__header">
<h1 class="item_show__header-title">
<div>
<%= link_to t("decidim.budgets.admin.helps.index.title"), helps_path %> &gt;
<%= container.name%>
</div>
<div class="flex--cc flex-gap--1">
<% if allowed_to? :export, :budget %>
<%= export_dropdown %>
<% end %>
<div class="flex items-center gap-x-4">
<%= export_dropdown if allowed_to? :export, :budget %>
<div id="js-other-actions-wrapper">
<%= link_to t("actions.new", scope: "decidim.budgets", name: t("models.help_section.name", scope: "decidim.budgets.admin")), new_help_section_path, class: "button tiny button--title" if allowed_to? :create, :help_section %>
<%= link_to t("help_sections.new.title", scope: "decidim.budgets.admin", name: t("models.help_section.name", scope: "decidim.budgets.admin")), new_help_section_path, class: "button button__sm button__secondary" if allowed_to? :create, :help_section %>
</div>
</div>
</h2>
Expand All @@ -37,15 +36,15 @@
</td>
<td class="table-list__actions">
<% if allowed_to? :update, :help_section, help_section: section %>
<%= icon_link_to "pencil", edit_help_section_path(container.key, section), t("actions.edit", scope: "decidim.budgets"), class: "action-icon--edit" %>
<%= icon_link_to "pencil-line", edit_help_section_path(container.key, section), t("actions.edit", scope: "decidim.budgets"), class: "action-icon--edit" %>
<% else %>
<%= icon "pencil", class: "action-icon action-icon--disabled", role: "img", aria_label: t("actions.edit", scope: "decidim.budgets") %>
<%= icon "pencil-line", class: "action-icon action-icon--disabled", role: "img", aria_label: t("actions.edit", scope: "decidim.budgets") %>
<% end %>

<% if allowed_to? :delete, :help_section, help_section: section %>
<%= icon_link_to "circle-x", help_section_path(container.key, section), t("actions.destroy", scope: "decidim.budgets"), method: :delete, class: "action-icon--remove", data: { confirm: t("actions.confirm_destroy", scope: "decidim.budgets") } %>
<%= icon_link_to "delete-bin-line", help_section_path(container.key, section), t("actions.destroy", scope: "decidim.budgets"), method: :delete, class: "action-icon--remove", data: { confirm: t("actions.confirm_destroy", scope: "decidim.budgets") } %>
<% else %>
<%= icon "circle-x", class: "action-icon action-icon--disabled", role: "img", aria_label: t("actions.destroy", scope: "decidim.budgets") %>
<%= icon "delete-bin-line", class: "action-icon action-icon--disabled", role: "img", aria_label: t("actions.destroy", scope: "decidim.budgets") %>
<% end %>
</td>
</tr>
Expand Down
10 changes: 6 additions & 4 deletions app/views/decidim/budgets/admin/help_sections/new.html.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<%= decidim_form_for(@form, html: { class: "form new_help_section" }) do |f| %>
<%= decidim_form_for(@form, html: { class: "form form-defaults new_help_section" }) do |f| %>
<%= render partial: "form", object: f, locals: { title: t(".title") } %>

<div class="button--double form-general-submit">
<%= f.submit t(".create") %>
</div>
<div class="item__edit-sticky">
<div class="item__edit-sticky-container">
<%= f.submit t(".create"), class: "button button__sm button__secondary" %>
</div>
</div>
<% end %>
11 changes: 6 additions & 5 deletions app/views/decidim/budgets/admin/helps/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<div class="card with-overflow">
<div class="card-divider">
<h2 class="card-title flex--sbc">
<% add_decidim_page_title(t(".title")) %>
<div class="card">
<div class="item_show__header">
<h1 class="item_show__header-title">
<div>
<%= t(".title") %>
</div>
</h2>
</h1>
</div>

<div class="card-section">
Expand All @@ -23,7 +24,7 @@
<%= link_to container.name, help_sections_path(container.key) %>
</td>
<td class="table-list__actions">
<%= icon_link_to "eye", help_sections_path(container.key), t("actions.edit", scope: "decidim.budgets"), class: "action-icon--preview" %>
<%= icon_link_to "eye-line", help_sections_path(container.key), t("actions.edit", scope: "decidim.budgets"), class: "action-icon--preview" %>
</td>
</tr>
<% end %>
Expand Down
Loading

0 comments on commit c4b84fb

Please sign in to comment.