Skip to content

Commit

Permalink
Improve design of "Related Documents" section (#13705)
Browse files Browse the repository at this point in the history
* Improve design of "Want to find out more?" section

* Added metadata to directory

* fix small CSS issues, fix typo

* Update decidim-core/app/views/decidim/application/_collection.html.erb

Co-authored-by: Alexandru Emil Lupu <contact@alecslupu.ro>

* add translation key

* Normalize locales

* Fix stylelint

* Run erblint

* Update decidim-core/config/locales/en.yml

---------

Co-authored-by: andra-panaite <andra.panaite@tremend.com>
Co-authored-by: Alexandru Emil Lupu <contact@alecslupu.ro>
  • Loading branch information
3 people authored Dec 11, 2024
1 parent 4b15845 commit 3dab13c
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,52 @@
> [id^="html-block"] {
@apply w-full prose max-w-none [&+*]:border-t-0;
}

.content-block {
@apply gap-0;

&__title {
@apply pb-8;
}

.documents {
&__container > div {
@apply border-b border-[#D3D5D9] border-t-0 pb-4 pt-6;
}

&__dropdown-container {
@apply border-b border-[#D3D5D9];
}

&__collection-trigger {
@apply bg-transparent max-w-full mt-0 pb-4 pt-6 px-0 rounded-none;

.documents-details {
@apply flex flex-col gap-2.5;

span {
@apply flex items-center text-lg leading-6 text-[var(--secondary)] font-semibold gap-1.5;
}
}
}

&__collection-content {
@apply w-auto ml-6 my-4 pl-4 lg:pl-8 border-l border-[#D3D5D9];

p {
@apply pt-4;
}

& > .documents__container {
@apply border-t-0 pt-0 mt-0;

& > :last-child {
@apply border-b-0;
}
}
}
}
}
}

&__content-block {
Expand Down
48 changes: 30 additions & 18 deletions decidim-core/app/views/decidim/application/_collection.html.erb
Original file line number Diff line number Diff line change
@@ -1,25 +1,37 @@
<% unless attachment_collection.unused? %>
<button id="dropdown-documents-trigger-<%= attachment_collection.id %>" class="documents__collection-trigger" data-component="dropdown" data-target="dropdown-menu-documents-<%= attachment_collection.id %>" aria-expanded="false">
<span>
<span class="documents__collection-trigger__icon">
<%= icon "folder-line" %>
<%= icon "folder-open-line" %>
</span>
<%= decidim_escape_translated(attachment_collection.name) %>
</span>
<%= icon "arrow-down-s-fill" %>
<%= icon "arrow-up-s-fill" %>
</button>
<div class="documents__dropdown-container">
<button id="dropdown-documents-trigger-<%= attachment_collection.id %>" class="documents__collection-trigger" data-component="dropdown" data-target="dropdown-menu-documents-<%= attachment_collection.id %>" aria-expanded="false">
<div class="documents-details">
<span>
<span class="documents__collection-trigger__icon">
<%= icon "folder-line" %>
<%= icon "folder-open-line" %>
</span>
<%= decidim_escape_translated(attachment_collection.name) %>
</span>

<div id="dropdown-menu-documents-<%= attachment_collection.id %>" class="documents__collection-content" aria-hidden="true">
<% if (description = attachment_collection.description).present? %>
<p><%= decidim_escape_translated(description) %></p>
<% end %>
<div class="card__list-metadata">
<div><%= icon "file-text-line" %><%= t("decidim.documents", count: documents.count) %></div>
<% sum = 0
documents.each { |document| sum += document.file_size.to_i } %>
<div><%= icon "scales-2-line" %><%= number_to_human_size(sum) %></div>
</div>
</div>

<div class="documents__container">
<% documents.each do |document| %>
<%= render partial: "decidim/application/document", formats: [:html], locals: { document: } %>
<%= icon "arrow-down-s-fill" %>
<%= icon "arrow-up-s-fill" %>
</button>

<div id="dropdown-menu-documents-<%= attachment_collection.id %>" class="documents__collection-content" aria-hidden="true">
<% if (description = attachment_collection.description).present? %>
<p><%= decidim_escape_translated(description) %></p>
<% end %>

<div class="documents__container">
<% documents.each do |document| %>
<%= render partial: "decidim/application/document", formats: [:html], locals: { document: } %>
<% end %>
</div>
</div>
</div>
<% end %>
3 changes: 3 additions & 0 deletions decidim-core/config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -677,6 +677,9 @@ en:
show_password: Show password
shown_password: Your password is shown
placeholder_email: hi@example.org
documents:
one: "%{count} document"
other: "%{count} documents"
doorkeeper:
authorizations:
new:
Expand Down

0 comments on commit 3dab13c

Please sign in to comment.