Patch #17924 » 0001-Structure-the-document-list.patch
app/views/documents/_document.html.erb | ||
---|---|---|
1 |
<h4><%= link_to document.title, document_path(document) %></h4> |
|
2 |
<p><em><%= format_time(document.updated_on) %></em></p> |
|
1 |
<div class="document-item document-<%= document.id %>"> |
|
2 |
<h4 class="title"><%= link_to document.title, document_path(document) %></h4> |
|
3 |
<div class="updated-on"><em><%= format_time(document.updated_on) %></em></div> |
|
3 | 4 | |
4 |
<div class="wiki"> |
|
5 |
<%= textilizable(truncate_lines(document.description), :object => document) %> |
|
6 |
</div> |
|
5 |
<div class="wiki description"> |
|
6 |
<%= textilizable(truncate_lines(document.description), :object => document) %> |
|
7 |
</div> |
|
8 |
</div> |
app/views/documents/index.html.erb | ||
---|---|---|
16 | 16 | |
17 | 17 |
<h2><%=l(:label_document_plural)%></h2> |
18 | 18 | |
19 |
<div id="document-list"> |
|
19 | 20 |
<% if @grouped.empty? %><p class="nodata"><%= l(:label_no_data) %></p><% end %> |
20 | 21 | |
21 | 22 |
<% @grouped.keys.sort.__send__(@sort_by == 'date' ? :reverse_each : :each) do |group| %> |
22 |
<h3><%= group %></h3> |
|
23 |
<div class="document-group document-group-<%= group.to_s.parameterize %>"> |
|
24 |
<h3 class="group-name"><%= group %></h3> |
|
23 | 25 |
<%= render :partial => 'documents/document', :collection => @grouped[group] %> |
26 |
</div> |
|
24 | 27 |
<% end %> |
28 |
</div> |
|
25 | 29 | |
26 | 30 |
<% content_for :sidebar do %> |
27 | 31 |
<h3><%= l(:label_sort_by, '') %></h3> |
app/views/my/blocks/_documents.html.erb | ||
---|---|---|
1 | 1 |
<h3><%=l(:label_document_plural)%></h3> |
2 | 2 | |
3 |
<%= render :partial => 'documents/document', :collection => documents %> |
|
3 |
<div id="document-list"> |
|
4 |
<%= render :partial => 'documents/document', :collection => documents %> |
|
5 |
</div> |
public/stylesheets/application.css | ||
---|---|---|
1127 | 1127 |
margin-left: 4px; |
1128 | 1128 |
} |
1129 | 1129 | |
1130 |
/***** Documents *****/ |
|
1131 | ||
1132 |
#document-list .document-group { |
|
1133 |
margin-bottom: 15px; |
|
1134 |
} |
|
1135 | ||
1130 | 1136 |
/***** Progress bar *****/ |
1131 | 1137 |
table.progress { |
1132 | 1138 |
border-collapse: collapse; |
test/functional/documents_controller_test.rb | ||
---|---|---|
57 | 57 |
assert_select '#content' do |
58 | 58 |
# ascending order of DocumentCategory#id. |
59 | 59 |
['Uncategorized', 'Technical documentation'].each_with_index do |text, idx| |
60 |
assert_select "h3:nth-of-type(#{idx + 1})", :text => text
|
|
60 |
assert_select ".document-group:nth-of-type(#{idx + 1}) h3.group-name", :text => text
|
|
61 | 61 |
end |
62 | 62 |
end |
63 | 63 |
end |
... | ... | |
74 | 74 |
assert_select '#content' do |
75 | 75 |
# descending order of date. |
76 | 76 |
['2007-03-05', '2007-02-12'].each_with_index do |text, idx| |
77 |
assert_select "h3:nth-of-type(#{idx + 1})", :text => text
|
|
77 |
assert_select ".document-group:nth-of-type(#{idx + 1}) h3.group-name", :text => text
|
|
78 | 78 |
end |
79 | 79 |
end |
80 | 80 |
end |
... | ... | |
91 | 91 |
assert_select '#content' do |
92 | 92 |
# ascending order of title. |
93 | 93 |
['A', 'T'].each_with_index do |text, idx| |
94 |
assert_select "h3:nth-of-type(#{idx + 1})", :text => text
|
|
94 |
assert_select ".document-group:nth-of-type(#{idx + 1}) h3.group-name", :text => text
|
|
95 | 95 |
end |
96 | 96 |
end |
97 | 97 |
end |
... | ... | |
108 | 108 |
assert_select '#content' do |
109 | 109 |
# ascending order of author. |
110 | 110 |
['John Smith', 'Redmine Admin'].each_with_index do |text, idx| |
111 |
assert_select "h3:nth-of-type(#{idx + 1})", :text => text
|
|
111 |
assert_select ".document-group:nth-of-type(#{idx + 1}) h3.group-name", :text => text
|
|
112 | 112 |
end |
113 | 113 |
end |
114 | 114 |
end |