From 98cbc41a13c3954b55bb2cc63d171b048a6df671 Mon Sep 17 00:00:00 2001 From: ishikawa999 <14245262+ishikawa999@users.noreply.github.com> Date: Fri, 22 May 2026 10:28:00 +0900 Subject: [PATCH 2/3] Improve document list layout --- app/assets/stylesheets/application.css | 39 ++++++++++++++++++++ app/views/documents/_document.html.erb | 2 +- app/views/documents/index.html.erb | 2 +- test/functional/documents_controller_test.rb | 26 +++++++------ 4 files changed, 55 insertions(+), 14 deletions(-) diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index 39fefe805..4466d1a02 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -1712,6 +1712,45 @@ img.ui-datepicker-trigger { #document-list .document-group { margin-block-end: 15px; } +#document-list .document-group h3 { + padding: 5px; + background-color: var(--oc-gray-1); + margin: 0; +} +#document-list .document-group h3 + .document-item { + padding-block-start: 8px; +} +#document-list .document-item { + padding-block-start: 24px; +} +#document-list .document-item svg.icon-svg { + margin-inline-end: 4px; +} +#document-list .document-item h4.title { + font-size: 1rem; + font-weight: normal; + margin: 0; + border-block-end: none; +} +#document-list .document-item .updated_on { + color: var(--oc-gray-6); + font-size: 0.8125rem; + padding-inline-start: 1.5rem; +} +#document-list .document-item .updated_on em { + font-style: normal; +} +#document-list .document-item .wiki.description { + margin-block-start: 2px; + padding-inline-start: 1.5rem; + font-size: 0.8125rem; +} +#document-list .document-item .wiki.description > p:first-child { + margin-block-start: 0; +} +#document-list .document-item .wiki.description > p:last-child { + margin-block-end: 0; +} /***** Progress bar *****/ table.progress { diff --git a/app/views/documents/_document.html.erb b/app/views/documents/_document.html.erb index 9e0c57d78..75440eefc 100644 --- a/app/views/documents/_document.html.erb +++ b/app/views/documents/_document.html.erb @@ -1,5 +1,5 @@
-

<%= link_to document.title, document_path(document) %>

+

<%= sprite_icon 'document' %><%= link_to document.title, document_path(document) %>

<%= format_time(document.updated_on) %>
diff --git a/app/views/documents/index.html.erb b/app/views/documents/index.html.erb index 2c726a37f..2fba22f22 100644 --- a/app/views/documents/index.html.erb +++ b/app/views/documents/index.html.erb @@ -21,7 +21,7 @@ <% @grouped.keys.sort.__send__(@sort_by == 'date' ? :reverse_each : :each) do |group| %>
-

<%= group %>

+

<%= @sort_by == 'date' ? format_activity_day(group) : group %>

<%= render :partial => 'documents/document', :collection => @grouped[group] %>
<% end %> diff --git a/test/functional/documents_controller_test.rb b/test/functional/documents_controller_test.rb index cf5c3d62c..f82627f03 100644 --- a/test/functional/documents_controller_test.rb +++ b/test/functional/documents_controller_test.rb @@ -59,18 +59,20 @@ class DocumentsControllerTest < Redmine::ControllerTest end def test_index_grouped_by_date - get( - :index, - :params => { - :project_id => 'ecookbook', - :sort_by => 'date' - } - ) - assert_response :success - assert_select '#content' do - # descending order of date. - ['2007-03-05', '2007-02-12'].each_with_index do |text, idx| - assert_select ".document-group:nth-of-type(#{idx + 1}) h3.group-name", :text => text + with_locale 'en' do + get( + :index, + :params => { + :project_id => 'ecookbook', + :sort_by => 'date' + } + ) + assert_response :success + assert_select '#content' do + # descending order of date. + ['03/05/2007', '02/12/2007'].each_with_index do |text, idx| + assert_select ".document-group:nth-of-type(#{idx + 1}) h3.group-name", :text => text + end end end end -- 2.50.1 (Apple Git-155)