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
123 123
    self.sortable = custom_field.order_statement || false
124 124
    self.groupable = custom_field.group_statement || false
125 125
    self.totalable = options.key?(:totalable) ? !!options[:totalable] : custom_field.totalable?
126
    @inline = true
126
    @inline = custom_field.full_width_layout? ? false : true
127 127
    @cf = custom_field
128 128
  end
129 129

  
app/views/issues/_list.html.erb
40 40
  <% query.block_columns.each do |column|
41 41
       if (text = column_content(column, issue)) && text.present? -%>
42 42
  <tr class="<%= current_cycle %>">
43
    <td colspan="<%= query.inline_columns.size + 2 %>" class="<%= column.css_classes %>">
43
    <td colspan="<%= query.inline_columns.size + 2 %>" class="<%= column.css_classes %> block_column">
44 44
      <% if query.block_columns.count > 1 %>
45 45
        <span><%= column.caption %></span>
46 46
      <% end %>
public/stylesheets/application.css
264 264
tr.issue td.relations { text-align: left; }
265 265
tr.issue td.done_ratio table.progress { margin-left:auto; margin-right: auto;}
266 266
tr.issue td.relations span {white-space: nowrap;}
267
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;}
268
table.issues td.description pre, table.issues td.last_notes pre {white-space:normal;}
267
table.issues td.block_column {color:#777; font-size:90%; padding:4px 4px 4px 24px; text-align:left; white-space:normal;}
268
table.issues td.block_column pre {white-space:normal;}
269 269

  
270 270
tr.issue.idnt td.subject {background: url(../images/arrow_right.png) no-repeat 2px 50%;}
271 271
tr.issue.idnt-1 td.subject {padding-left: 24px; background-position: 8px 50%;}
test/functional/issues_controller_test.rb
355 355

  
356 356
  def test_index_grouped_by_created_on
357 357
    skip unless IssueQuery.new.groupable_columns.detect {|c| c.name == :created_on}
358
  
358

  
359 359
    get :index, :params => {
360 360
        :set_filter => 1,
361 361
        :group_by => 'created_on'
362 362
      }
363 363
    assert_response :success
364
  
364

  
365 365
    assert_select 'tr.group span.name', :text => '07/19/2006' do
366 366
      assert_select '+ span.count', :text => '2'
367 367
    end
368 368
  end
369
  
369

  
370 370
  def test_index_grouped_by_created_on_as_pdf
371 371
    skip unless IssueQuery.new.groupable_columns.detect {|c| c.name == :created_on}
372
  
372

  
373 373
    get :index, :params => {
374 374
        :set_filter => 1,
375 375
        :group_by => 'created_on',
......
1398 1398
    assert_select 'td.description[colspan="4"] span', :text => 'Description'
1399 1399
  end
1400 1400

  
1401
  def test_index_with_full_width_layout_custom_field_column_should_show_column_as_block_column
1402
    field = IssueCustomField.create!(:name => 'Long text', :field_format => 'text', :full_width_layout => '1',
1403
      :tracker_ids => [1], :is_for_all => true)
1404
    issue = Issue.find(1)
1405
    issue.custom_field_values = {field.id => 'This is a long text'}
1406
    issue.save!
1407

  
1408
    get :index, :params => {
1409
        :set_filter => 1,
1410
        :c => ['subject', 'description', "cf_#{field.id}"]
1411
      }
1412
    assert_response :success
1413

  
1414
    assert_select 'td.description[colspan="4"] span', :text => 'Description'
1415
    assert_select "td.cf_#{field.id} span", :text => 'Long text'
1416
  end
1417

  
1401 1418
  def test_index_with_parent_column
1402 1419
    Issue.delete_all
1403 1420
    parent = Issue.generate!
......
1867 1884
    with_settings :date_format => '%d/%m/%Y' do
1868 1885
      issue = Issue.generate!(:start_date => '2018-11-29', :due_date => '2018-12-01')
1869 1886
      IssueRelation.create!(:issue_from => Issue.find(1), :issue_to => issue, :relation_type => 'relates')
1870
  
1887

  
1871 1888
      get :show, :params => {
1872 1889
          :id => 1
1873 1890
        }
1874 1891
      assert_response :success
1875
  
1892

  
1876 1893
      assert_select '#relations td.start_date', :text => '29/11/2018'
1877 1894
      assert_select '#relations td.due_date', :text => '01/12/2018'
1878 1895
    end
(3-3/4)