From 863a0772d1fdc816522cece6914764f32d55f343 Mon Sep 17 00:00:00 2001 From: ishikawa999 Date: Tue, 17 Aug 2021 00:03:59 +0000 Subject: [PATCH 1/2] Structure the document list --- app/views/documents/_document.html.erb | 12 +++++++----- app/views/documents/index.html.erb | 6 +++++- app/views/my/blocks/_documents.html.erb | 4 +++- public/stylesheets/application.css | 6 ++++++ test/functional/documents_controller_test.rb | 8 ++++---- 5 files changed, 25 insertions(+), 11 deletions(-) diff --git a/app/views/documents/_document.html.erb b/app/views/documents/_document.html.erb index 9a96d5d323..d10497b895 100644 --- a/app/views/documents/_document.html.erb +++ b/app/views/documents/_document.html.erb @@ -1,6 +1,8 @@ -

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

-

<%= format_time(document.updated_on) %>

+
+

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

+
<%= format_time(document.updated_on) %>
-
- <%= textilizable(truncate_lines(document.description), :object => document) %> -
+
+ <%= textilizable(truncate_lines(document.description), :object => document) %> +
+
\ No newline at end of file diff --git a/app/views/documents/index.html.erb b/app/views/documents/index.html.erb index c0458f8bfd..0235288eea 100644 --- a/app/views/documents/index.html.erb +++ b/app/views/documents/index.html.erb @@ -16,12 +16,16 @@

<%=l(:label_document_plural)%>

+
<% if @grouped.empty? %>

<%= l(:label_no_data) %>

<% end %> <% @grouped.keys.sort.__send__(@sort_by == 'date' ? :reverse_each : :each) do |group| %> -

<%= group %>

+
+

<%= group %>

<%= render :partial => 'documents/document', :collection => @grouped[group] %> +
<% end %> +
<% content_for :sidebar do %>

<%= l(:label_sort_by, '') %>

diff --git a/app/views/my/blocks/_documents.html.erb b/app/views/my/blocks/_documents.html.erb index 560adca1ed..f60cb5dbb2 100644 --- a/app/views/my/blocks/_documents.html.erb +++ b/app/views/my/blocks/_documents.html.erb @@ -1,3 +1,5 @@

<%=l(:label_document_plural)%>

-<%= render :partial => 'documents/document', :collection => documents %> +
+ <%= render :partial => 'documents/document', :collection => documents %> +
\ No newline at end of file diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css index b0e50c886a..a73fcfdb37 100644 --- a/public/stylesheets/application.css +++ b/public/stylesheets/application.css @@ -1127,6 +1127,12 @@ img.ui-datepicker-trigger { margin-left: 4px; } +/***** Documents *****/ + +#document-list .document-group { + margin-bottom: 15px; +} + /***** Progress bar *****/ table.progress { border-collapse: collapse; diff --git a/test/functional/documents_controller_test.rb b/test/functional/documents_controller_test.rb index 3d49b5da8c..8a5d425cbd 100644 --- a/test/functional/documents_controller_test.rb +++ b/test/functional/documents_controller_test.rb @@ -57,7 +57,7 @@ class DocumentsControllerTest < Redmine::ControllerTest assert_select '#content' do # ascending order of DocumentCategory#id. ['Uncategorized', 'Technical documentation'].each_with_index do |text, idx| - assert_select "h3:nth-of-type(#{idx + 1})", :text => text + assert_select ".document-group:nth-of-type(#{idx + 1}) h3.group-name", :text => text end end end @@ -74,7 +74,7 @@ class DocumentsControllerTest < Redmine::ControllerTest assert_select '#content' do # descending order of date. ['2007-03-05', '2007-02-12'].each_with_index do |text, idx| - assert_select "h3:nth-of-type(#{idx + 1})", :text => text + assert_select ".document-group:nth-of-type(#{idx + 1}) h3.group-name", :text => text end end end @@ -91,7 +91,7 @@ class DocumentsControllerTest < Redmine::ControllerTest assert_select '#content' do # ascending order of title. ['A', 'T'].each_with_index do |text, idx| - assert_select "h3:nth-of-type(#{idx + 1})", :text => text + assert_select ".document-group:nth-of-type(#{idx + 1}) h3.group-name", :text => text end end end @@ -108,7 +108,7 @@ class DocumentsControllerTest < Redmine::ControllerTest assert_select '#content' do # ascending order of author. ['John Smith', 'Redmine Admin'].each_with_index do |text, idx| - assert_select "h3:nth-of-type(#{idx + 1})", :text => text + assert_select ".document-group:nth-of-type(#{idx + 1}) h3.group-name", :text => text end end end -- 2.11.0