From: Go MAEDA Date: Tue, 8 Feb 2022 02:40:24 +0000 (+0000) Subject: Structured Document list for more flexible UI design with CSS (#17924). X-Git-Tag: 5.0.0~75 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=6f6d380e7425a13a236b5887a431847c48803c6b;p=redmine.git Structured Document list for more flexible UI design with CSS (#17924). Patch by Yonghwan SO and Mizuki ISHIKAWA. git-svn-id: http://svn.redmine.org/redmine/trunk@21403 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- diff --git a/app/views/documents/_document.html.erb b/app/views/documents/_document.html.erb index 9a96d5d32..9e0c57d78 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 c0458f8bf..aa5e5200d 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 560adca1e..f60cb5dbb 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 0ca4f48db..f837a710e 100644 --- a/public/stylesheets/application.css +++ b/public/stylesheets/application.css @@ -1129,6 +1129,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 6feed0103..43e5d1b24 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