Patch #44111 » 0002-Improve-document-list-layout.patch
| app/assets/stylesheets/application.css | ||
|---|---|---|
|
#document-list .document-group {
|
||
|
margin-block-end: 15px;
|
||
|
}
|
||
|
#document-list .document-group h3 {
|
||
|
padding: 5px;
|
||
|
background-color: var(--oc-gray-1);
|
||
|
margin: 0;
|
||
|
}
|
||
|
#document-list .document-group h3 + .document-item {
|
||
|
padding-block-start: 8px;
|
||
|
}
|
||
|
#document-list .document-item {
|
||
|
padding-block-start: 24px;
|
||
|
}
|
||
|
#document-list .document-item svg.icon-svg {
|
||
|
margin-inline-end: 4px;
|
||
|
}
|
||
|
#document-list .document-item h4.title {
|
||
|
font-size: 1rem;
|
||
|
font-weight: normal;
|
||
|
margin: 0;
|
||
|
border-block-end: none;
|
||
|
}
|
||
|
#document-list .document-item .updated_on {
|
||
|
color: var(--oc-gray-6);
|
||
|
font-size: 0.8125rem;
|
||
|
padding-inline-start: 1.5rem;
|
||
|
}
|
||
|
#document-list .document-item .updated_on em {
|
||
|
font-style: normal;
|
||
|
}
|
||
|
#document-list .document-item .wiki.description {
|
||
|
margin-block-start: 2px;
|
||
|
padding-inline-start: 1.5rem;
|
||
|
font-size: 0.8125rem;
|
||
|
}
|
||
|
#document-list .document-item .wiki.description > p:first-child {
|
||
|
margin-block-start: 0;
|
||
|
}
|
||
|
#document-list .document-item .wiki.description > p:last-child {
|
||
|
margin-block-end: 0;
|
||
|
}
|
||
|
/***** Progress bar *****/
|
||
|
table.progress {
|
||
| app/views/documents/_document.html.erb | ||
|---|---|---|
|
<div class="document-item document-<%= document.id %>">
|
||
|
<h4 class="title"><%= link_to document.title, document_path(document) %></h4>
|
||
|
<h4 class="title"><%= sprite_icon 'document' %><%= link_to document.title, document_path(document) %></h4>
|
||
|
<div class="updated_on"><em><%= format_time(document.updated_on) %></em></div>
|
||
|
<div class="wiki description">
|
||
| app/views/documents/index.html.erb | ||
|---|---|---|
|
<% @grouped.keys.sort.__send__(@sort_by == 'date' ? :reverse_each : :each) do |group| %>
|
||
|
<div class="document-group document-group-<%= @sort_by %>">
|
||
|
<h3 class="group-name"><%= group %></h3>
|
||
|
<h3 class="group-name"><%= @sort_by == 'date' ? format_activity_day(group) : group %></h3>
|
||
|
<%= render :partial => 'documents/document', :collection => @grouped[group] %>
|
||
|
</div>
|
||
|
<% end %>
|
||
| test/functional/documents_controller_test.rb | ||
|---|---|---|
|
end
|
||
|
def test_index_grouped_by_date
|
||
|
get(
|
||
|
:index,
|
||
|
:params => {
|
||
|
:project_id => 'ecookbook',
|
||
|
:sort_by => 'date'
|
||
|
}
|
||
|
)
|
||
|
assert_response :success
|
||
|
assert_select '#content' do
|
||
|
# descending order of date.
|
||
|
['2007-03-05', '2007-02-12'].each_with_index do |text, idx|
|
||
|
assert_select ".document-group:nth-of-type(#{idx + 1}) h3.group-name", :text => text
|
||
|
with_locale 'en' do
|
||
|
get(
|
||
|
:index,
|
||
|
:params => {
|
||
|
:project_id => 'ecookbook',
|
||
|
:sort_by => 'date'
|
||
|
}
|
||
|
)
|
||
|
assert_response :success
|
||
|
assert_select '#content' do
|
||
|
# descending order of date.
|
||
|
['03/05/2007', '02/12/2007'].each_with_index do |text, idx|
|
||
|
assert_select ".document-group:nth-of-type(#{idx + 1}) h3.group-name", :text => text
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
end
|
||