Skip to content

Commit

Permalink
Linked resources, statuses, text changes and a11y fixes
Browse files Browse the repository at this point in the history
- Add the linked resources to the projects
- Add the project status after the voting
- Fix a11y issues with the filters
- Update the texts
  • Loading branch information
ahukkanen committed Feb 8, 2024
1 parent 73c4691 commit 69be09f
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 11 deletions.
2 changes: 1 addition & 1 deletion app/views/decidim/budgets/projects/_filters.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
type_suffix = defined?(type) ? "_#{type}" : ""
%>

<%= filter_form_for filter, projects_path, role: "region", "aria-label": t(".label") do |form| %>
<%= filter_form_for filter, projects_path, "aria-label": t(".label") do |form| %>
<div class="row medium-unstack">
<div class="columns">
<div class="filters__control text_filter">
Expand Down
7 changes: 7 additions & 0 deletions app/views/decidim/budgets/projects/_project_status.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<% callout_class = project.selected? ? "success" : "alert" %>

<div class="callout <%= callout_class %> margin-bottom-2">
<div class="callout__title">
<p class="h6"><%= project.selected? ? t(".selected") : t(".not_selected") %></p>
</div>
</div>
11 changes: 5 additions & 6 deletions app/views/decidim/budgets/projects/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ edit_link(
<% end %>
</div>

<%= render partial: "project_status" if voting_finished? && statuses_available? %>

<% if project.main_image && project.main_image.attached? %>
<%= image_tag project.attached_uploader(:main_image).path(variant: :main), class:"resource-image", alt: strip_tags(translated_attribute(project.title)) %>
<% elsif category_image_path(project.category) %>
Expand All @@ -68,15 +70,12 @@ edit_link(
<% if voting_finished? && current_settings.show_votes? %>
<p><strong><%= t(".votes_amount", count: project.confirmed_orders_count) %></strong></p>
<% end %>

<%= linked_resources_for project, :plans, "included_plans" %>
</div>

<div class="resource__details">
<%= attachments_for project %>

<%# = linked_resources_for project, :proposals, "included_proposals" %>
<%# = linked_resources_for project, :ideas, "included_ideas" %>
<%# = linked_resources_for project, :plans, "included_plans" %>
<%# = linked_resources_for project, :results, "included_projects" %>
<%= attachments_for project %>
</div>
</div>
</div>
Expand Down
12 changes: 12 additions & 0 deletions app/views/decidim/budgets/votes/_project_linked_resources.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<% linked_resources = resource.linked_resources(type, link_name).group_by { |linked_resource| linked_resource.class.name } %>

<% linked_resources.each do |klass, resources| %>
<div class="margin-top-2">
<% resource_manifest = klass.constantize.resource_manifest %>
<% i18n_name = "#{resource.class.name.demodulize.underscore}_#{resource_manifest.name}" %>
<p class="h5"><%= t(i18n_name, scope: "decidim.resource_links.#{link_name}") %></p>
<% resources.each do |resource| %>
<p>#<%= resource.id %> <%== decidim_html_escape(present(resource).title) %></p>
<% end %>
</div>
<% end %>
2 changes: 2 additions & 0 deletions app/views/decidim/budgets/votes/_projects_list.erb
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@
<p><%= translated_attribute(summary) %></p>
<% end %>
<%== translated_attribute(project.description) %>

<%= render partial: "project_linked_resources", locals: { resource: project, type: :plans, link_name: "included_plans" } %>
</div>
<div class="projects-table__row__side">
<div class="details-list">
Expand Down
3 changes: 3 additions & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,9 @@ en:
add_to_vote: Add to vote
remove_descriptive: Remove proposal %{resource_name} from vote
remove_from_vote: Remove from vote
project_status:
not_selected: Unfortunately, this proposal will not be implemented because it did not receive enough votes.
selected: This proposal proceeds to implementation.
projects:
empty: No proposals matching your search criteria. Please change your search criteria and try again.
order_items_amount:
Expand Down
3 changes: 3 additions & 0 deletions config/locales/fi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,9 @@ fi:
add_to_vote: Lisää ääneen
remove_descriptive: Poista ehdotus %{resource_name} äänestä
remove_from_vote: Poista äänestä
project_status:
not_selected: Ehdotus ei valitettavasti etene toteutukseen, koska se ei saanut tarpeeksi ääniä.
selected: Ehdotus etenee toteutukseen.
projects:
empty: Hakuehdoillasi ei löytynyt yhtään ehdotusta. Muuta hakuehtoja löytääksesi lisää ehdotuksia.
order_items_amount:
Expand Down
11 changes: 7 additions & 4 deletions config/locales/sv.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ sv:
fields:
address: Adress
statuses:
not_selected: Går inte vidare till implementering
selected: Fortsätter till implementering
not_selected: Går inte vidare till genomförande
selected: Fortsätter till genomförande
order_summaries_mailer:
order_summaries:
no_selected_projects: Du valde inga förslag från detta område.
Expand Down Expand Up @@ -187,8 +187,8 @@ sv:
search: Sök
selected: Visa mina röstade förslag
status_values:
not_selected: Går inte vidare till implementering
selected: Fortsätter till implementering
not_selected: Går inte vidare till genomförande
selected: Fortsätter till genomförande
term: Nyckelord
title: Sök förslag
index:
Expand All @@ -214,6 +214,9 @@ sv:
add_to_vote: Lägg till i röst
remove_descriptive: Ta bort förslag %{resource_name} från röst
remove_from_vote: Ta bort från röst
project_status:
not_selected: Tyvärr kommer förslaget inte att genomföras eftersom det inte fick tillräckligt många röster.
selected: Förslaget fortsätter till genomförande.
projects:
empty: Inga förslag hittades för dina sökkriterier. Ändra dina sökkriterier för att hitta fler förslag.
order_items_amount:
Expand Down

0 comments on commit 69be09f

Please sign in to comment.