Patch #44111 » 0002-Improve-document-list-layout.patch
| app/assets/stylesheets/application.css | ||
|---|---|---|
| 1712 | 1712 |
#document-list .document-group {
|
| 1713 | 1713 |
margin-block-end: 15px; |
| 1714 | 1714 |
} |
| 1715 |
#document-list .document-group h3 {
|
|
| 1716 |
padding: 5px; |
|
| 1717 |
background-color: var(--oc-gray-1); |
|
| 1718 |
margin: 0; |
|
| 1719 |
} |
|
| 1720 |
#document-list .document-group h3 + .document-item {
|
|
| 1721 |
padding-block-start: 8px; |
|
| 1722 |
} |
|
| 1723 |
#document-list .document-item {
|
|
| 1724 |
padding-block-start: 24px; |
|
| 1725 |
} |
|
| 1726 |
#document-list .document-item svg.icon-svg {
|
|
| 1727 |
margin-inline-end: 4px; |
|
| 1728 |
} |
|
| 1729 |
#document-list .document-item h4.title {
|
|
| 1730 |
font-size: 1rem; |
|
| 1731 |
font-weight: normal; |
|
| 1732 |
margin: 0; |
|
| 1733 |
border-block-end: none; |
|
| 1734 |
} |
|
| 1735 |
#document-list .document-item .updated_on {
|
|
| 1736 |
color: var(--oc-gray-6); |
|
| 1737 |
font-size: 0.8125rem; |
|
| 1738 |
padding-inline-start: 1.5rem; |
|
| 1739 |
} |
|
| 1740 |
#document-list .document-item .updated_on em {
|
|
| 1741 |
font-style: normal; |
|
| 1742 |
} |
|
| 1743 |
#document-list .document-item .wiki.description {
|
|
| 1744 |
margin-block-start: 2px; |
|
| 1745 |
padding-inline-start: 1.5rem; |
|
| 1746 |
font-size: 0.8125rem; |
|
| 1747 |
} |
|
| 1748 |
#document-list .document-item .wiki.description > p:first-child {
|
|
| 1749 |
margin-block-start: 0; |
|
| 1750 |
} |
|
| 1751 |
#document-list .document-item .wiki.description > p:last-child {
|
|
| 1752 |
margin-block-end: 0; |
|
| 1753 |
} |
|
| 1715 | 1754 | |
| 1716 | 1755 |
/***** Progress bar *****/ |
| 1717 | 1756 |
table.progress {
|
| app/views/documents/_document.html.erb | ||
|---|---|---|
| 1 | 1 |
<div class="document-item document-<%= document.id %>"> |
| 2 |
<h4 class="title"><%= link_to document.title, document_path(document) %></h4> |
|
| 2 |
<h4 class="title"><%= sprite_icon 'document' %><%= link_to document.title, document_path(document) %></h4>
|
|
| 3 | 3 |
<div class="updated_on"><em><%= format_time(document.updated_on) %></em></div> |
| 4 | 4 | |
| 5 | 5 |
<div class="wiki description"> |
| app/views/documents/index.html.erb | ||
|---|---|---|
| 21 | 21 | |
| 22 | 22 |
<% @grouped.keys.sort.__send__(@sort_by == 'date' ? :reverse_each : :each) do |group| %> |
| 23 | 23 |
<div class="document-group document-group-<%= @sort_by %>"> |
| 24 |
<h3 class="group-name"><%= group %></h3> |
|
| 24 |
<h3 class="group-name"><%= @sort_by == 'date' ? format_activity_day(group) : group %></h3>
|
|
| 25 | 25 |
<%= render :partial => 'documents/document', :collection => @grouped[group] %> |
| 26 | 26 |
</div> |
| 27 | 27 |
<% end %> |
| test/functional/documents_controller_test.rb | ||
|---|---|---|
| 59 | 59 |
end |
| 60 | 60 | |
| 61 | 61 |
def test_index_grouped_by_date |
| 62 |
get( |
|
| 63 |
:index, |
|
| 64 |
:params => {
|
|
| 65 |
:project_id => 'ecookbook', |
|
| 66 |
:sort_by => 'date' |
|
| 67 |
} |
|
| 68 |
) |
|
| 69 |
assert_response :success |
|
| 70 |
assert_select '#content' do |
|
| 71 |
# descending order of date. |
|
| 72 |
['2007-03-05', '2007-02-12'].each_with_index do |text, idx| |
|
| 73 |
assert_select ".document-group:nth-of-type(#{idx + 1}) h3.group-name", :text => text
|
|
| 62 |
with_locale 'en' do |
|
| 63 |
get( |
|
| 64 |
:index, |
|
| 65 |
:params => {
|
|
| 66 |
:project_id => 'ecookbook', |
|
| 67 |
:sort_by => 'date' |
|
| 68 |
} |
|
| 69 |
) |
|
| 70 |
assert_response :success |
|
| 71 |
assert_select '#content' do |
|
| 72 |
# descending order of date. |
|
| 73 |
['03/05/2007', '02/12/2007'].each_with_index do |text, idx| |
|
| 74 |
assert_select ".document-group:nth-of-type(#{idx + 1}) h3.group-name", :text => text
|
|
| 75 |
end |
|
| 74 | 76 |
end |
| 75 | 77 |
end |
| 76 | 78 |
end |