Project

General

Profile

Feature #26081 » 0001-Show-full-width-layout-custom-fields-as-block-column.patch

Marius BĂLTEANU, 2019-02-03 20:42

View differences:

app/models/query.rb
self.sortable = custom_field.order_statement || false
self.groupable = custom_field.group_statement || false
self.totalable = options.key?(:totalable) ? !!options[:totalable] : custom_field.totalable?
@inline = true
@inline = custom_field.full_width_layout? ? false : true
@cf = custom_field
end
app/views/issues/_list.html.erb
<% query.block_columns.each do |column|
if (text = column_content(column, issue)) && text.present? -%>
<tr class="<%= current_cycle %>">
<td colspan="<%= query.inline_columns.size + 2 %>" class="<%= column.css_classes %>">
<td colspan="<%= query.inline_columns.size + 2 %>" class="<%= column.css_classes %> block_column">
<% if query.block_columns.count > 1 %>
<span><%= column.caption %></span>
<% end %>
public/stylesheets/application.css
tr.issue td.relations { text-align: left; }
tr.issue td.done_ratio table.progress { margin-left:auto; margin-right: auto;}
tr.issue td.relations span {white-space: nowrap;}
table.issues td.description, table.issues td.last_notes {color:#777; font-size:90%; padding:4px 4px 4px 24px; text-align:left; white-space:normal;}
table.issues td.description pre, table.issues td.last_notes pre {white-space:normal;}
table.issues td.block_column {color:#777; font-size:90%; padding:4px 4px 4px 24px; text-align:left; white-space:normal;}
table.issues td.block_column pre {white-space:normal;}
tr.issue.idnt td.subject {background: url(../images/arrow_right.png) no-repeat 2px 50%;}
tr.issue.idnt-1 td.subject {padding-left: 24px; background-position: 8px 50%;}
test/functional/issues_controller_test.rb
def test_index_grouped_by_created_on
skip unless IssueQuery.new.groupable_columns.detect {|c| c.name == :created_on}
get :index, :params => {
:set_filter => 1,
:group_by => 'created_on'
}
assert_response :success
assert_select 'tr.group span.name', :text => '07/19/2006' do
assert_select '+ span.count', :text => '2'
end
end
def test_index_grouped_by_created_on_as_pdf
skip unless IssueQuery.new.groupable_columns.detect {|c| c.name == :created_on}
get :index, :params => {
:set_filter => 1,
:group_by => 'created_on',
......
assert_select 'td.description[colspan="4"] span', :text => 'Description'
end
def test_index_with_full_width_layout_custom_field_column_should_show_column_as_block_column
field = IssueCustomField.create!(:name => 'Long text', :field_format => 'text', :full_width_layout => '1',
:tracker_ids => [1], :is_for_all => true)
issue = Issue.find(1)
issue.custom_field_values = {field.id => 'This is a long text'}
issue.save!
get :index, :params => {
:set_filter => 1,
:c => ['subject', 'description', "cf_#{field.id}"]
}
assert_response :success
assert_select 'td.description[colspan="4"] span', :text => 'Description'
assert_select "td.cf_#{field.id} span", :text => 'Long text'
end
def test_index_with_parent_column
Issue.delete_all
parent = Issue.generate!
......
with_settings :date_format => '%d/%m/%Y' do
issue = Issue.generate!(:start_date => '2018-11-29', :due_date => '2018-12-01')
IssueRelation.create!(:issue_from => Issue.find(1), :issue_to => issue, :relation_type => 'relates')
get :show, :params => {
:id => 1
}
assert_response :success
assert_select '#relations td.start_date', :text => '29/11/2018'
assert_select '#relations td.due_date', :text => '01/12/2018'
end
(3-3/4)