Project

General

Profile

Feature #32240 » 32240_add_download_button_v2.patch

Yuichi HARADA, 2019-11-08 01:59

View differences:

app/helpers/application_helper.rb
253 253
    when 'Issue'
254 254
      object.visible? && html ? link_to_issue(object) : "##{object.id}"
255 255
    when 'Attachment'
256
      html ? link_to_attachment(object) : object.filename
256
      if html
257
        content_tag(:span,
258
          link_to_attachment(object) +
259
          link_to_attachment(
260
            object,
261
            :class => ['icon-only', 'icon-download'], :title => l(:button_download), :download => true
262
          )
263
        )
264
      else
265
        object.filename
266
      end
257 267
    when 'CustomValue', 'CustomFieldValue'
258 268
      if object.custom_field
259 269
        f = object.custom_field.format.formatted_custom_value(self, object, html)
public/stylesheets/application.css
238 238
table.list td.id { width: 2%; text-align: center;}
239 239
table.list td.name, table.list td.description, table.list td.subject, table.list td.comments, table.list td.roles, table.list td.attachments, table.list td.text,  table.list td.short_description {text-align: left;}
240 240

  
241
table.list td.attachments a {display:block;}
241
table.list td.attachments span {display:block; height:16px;}
242
table.list td.attachments span a.icon-download {display:none;}
243
table.list td.attachments span:hover a.icon-download {display:inline-block;}
242 244
table.list td.tick {width:15%}
243 245
table.list td.checkbox { width: 15px; padding: 2px 0 0 0; }
244 246
table.list .checkbox input {padding:0px; height: initial;}
test/functional/issues_controller_test.rb
1498 1498
    assert_select 'td.attachments'
1499 1499
    assert_select 'tr#issue-2' do
1500 1500
      assert_select 'td.attachments' do
1501
        assert_select 'a', :text => 'source.rb'
1502
        assert_select 'a', :text => 'picture.jpg'
1501
        assert_select 'span:nth-of-type(1)' do
1502
          assert_select 'a[href=?]', '/attachments/4', :text => 'source.rb'
1503
          assert_select 'a[href=?].icon-download', '/attachments/download/4/source.rb'
1504
        end
1505
        assert_select 'span:nth-of-type(2)' do
1506
          assert_select 'a[href=?]', '/attachments/10', :text => 'picture.jpg'
1507
          assert_select 'a[href=?].icon-download', '/attachments/download/10/picture.jpg'
1508
        end
1503 1509
      end
1504 1510
    end
1505 1511
  end
(4-4/6)