summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2022-02-08 02:40:24 +0000
committerGo MAEDA <maeda@farend.jp>2022-02-08 02:40:24 +0000
commit6f6d380e7425a13a236b5887a431847c48803c6b (patch)
tree6b009872b9286789adc75e0c86e3cf89c3178112
parentd7dd703763283e11df762ff82a52d51c04a7efa4 (diff)
downloadredmine-6f6d380e7425a13a236b5887a431847c48803c6b.tar.gz
redmine-6f6d380e7425a13a236b5887a431847c48803c6b.zip
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
-rw-r--r--app/views/documents/_document.html.erb12
-rw-r--r--app/views/documents/index.html.erb6
-rw-r--r--app/views/my/blocks/_documents.html.erb4
-rw-r--r--public/stylesheets/application.css6
-rw-r--r--test/functional/documents_controller_test.rb8
5 files changed, 25 insertions, 11 deletions
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 @@
-<h4><%= link_to document.title, document_path(document) %></h4>
-<p><em><%= format_time(document.updated_on) %></em></p>
+<div class="document-item document-<%= document.id %>">
+ <h4 class="title"><%= link_to document.title, document_path(document) %></h4>
+ <div class="updated_on"><em><%= format_time(document.updated_on) %></em></div>
-<div class="wiki">
- <%= textilizable(truncate_lines(document.description), :object => document) %>
-</div>
+ <div class="wiki description">
+ <%= textilizable(truncate_lines(document.description), :object => document) %>
+ </div>
+</div> \ 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 @@
<h2><%=l(:label_document_plural)%></h2>
+<div id="document-list">
<% if @grouped.empty? %><p class="nodata"><%= l(:label_no_data) %></p><% end %>
<% @grouped.keys.sort.__send__(@sort_by == 'date' ? :reverse_each : :each) do |group| %>
- <h3><%= group %></h3>
+ <div class="document-group document-group-<%= @sort_by %>">
+ <h3 class="group-name"><%= group %></h3>
<%= render :partial => 'documents/document', :collection => @grouped[group] %>
+ </div>
<% end %>
+</div>
<% content_for :sidebar do %>
<h3><%= l(:label_sort_by, '') %></h3>
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 @@
<h3><%=l(:label_document_plural)%></h3>
-<%= render :partial => 'documents/document', :collection => documents %>
+<div id="document-list">
+ <%= render :partial => 'documents/document', :collection => documents %>
+</div> \ 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