Defect #32704 » 32704.patch
| app/views/documents/index.html.erb | ||
|---|---|---|
|
<h2><%=l(:label_document_plural)%></h2>
|
||
|
<div id="document-list">
|
||
|
<% if @grouped.empty? %><p class="nodata"><%= l(:label_no_data) %></p><% end %>
|
||
|
<% group_keys = @grouped.keys.compact %>
|
||
|
<% if @grouped.empty? || group_keys.empty? %><p class="nodata"><%= l(:label_no_data) %></p><% end %>
|
||
|
<% @grouped.keys.sort.__send__(@sort_by == 'date' ? :reverse_each : :each) do |group| %>
|
||
|
<% group_keys.compact.sort.__send__(@sort_by == 'date' ? :reverse_each : :each) do |group| %>
|
||
|
<div class="document-group document-group-<%= @sort_by %>">
|
||
|
<h3 class="group-name"><%= group %></h3>
|
||
|
<%= render :partial => 'documents/document', :collection => @grouped[group] %>
|
||
| test/functional/documents_controller_test.rb | ||
|---|---|---|
|
end
|
||
|
end
|
||
|
def test_index_grouped_by_category_should_ignore_invalid_document_category
|
||
|
# Delete a document category skipping callbacks
|
||
|
DocumentCategory.find_by(name: 'Technical documentation').delete
|
||
|
get(
|
||
|
:index,
|
||
|
:params => {
|
||
|
:project_id => 'ecookbook',
|
||
|
:sort_by => 'category'
|
||
|
}
|
||
|
)
|
||
|
assert_response :success
|
||
|
assert_select 'h3.group-name', :text => 'Uncategorized', :count => 1
|
||
|
assert_select 'h3.group-name', :text => 'Technical documentation', :count => 0
|
||
|
end
|
||
|
def test_index_grouped_by_date
|
||
|
get(
|
||
|
:index,
|
||
- « Previous
- 1
- 2
- Next »