Project

General

Profile

Feature #32240 » 32240_add_download_button_v4.patch

Go MAEDA, 2020-02-05 07:48

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(
258
          :span,
259
          link_to_attachment(object) +
260
          link_to_attachment(
261
            object,
262
            :class => ['icon-only', 'icon-download'],
263
            :title => l(:button_download),
264
            :download => true
265
          )
266
        )
267
      else
268
        object.filename
269
      end
257 270
    when 'CustomValue', 'CustomFieldValue'
258 271
      if object.custom_field
259 272
        f = object.custom_field.format.formatted_custom_value(self, object, html)
public/stylesheets/application.css
241 241
table.list td.id { width: 2%; text-align: center;}
242 242
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;}
243 243

  
244
table.list td.attachments a {display:block;}
244
table.list td.attachments span {display: block; height: 16px;}
245
table.list td.attachments span a.icon-download {display: inline-block; visibility: hidden;}
246
table.list td.attachments span:hover a.icon-download {visibility: visible;}
245 247
table.list td.tick {width:15%}
246 248
table.list td.checkbox { width: 15px; padding: 2px 0 0 0; }
247 249
table.list .checkbox input {padding:0px; height: initial;}
test/functional/issues_controller_test.rb
1784 1784
    assert_select 'td.attachments'
1785 1785
    assert_select 'tr#issue-2' do
1786 1786
      assert_select 'td.attachments' do
1787
        assert_select 'a', :text => 'source.rb'
1788
        assert_select 'a', :text => 'picture.jpg'
1787
        assert_select 'span:nth-of-type(1)' do
1788
          assert_select 'a[href=?]', '/attachments/4', :text => 'source.rb'
1789
          assert_select 'a[href=?].icon-download', '/attachments/download/4/source.rb'
1790
        end
1791
        assert_select 'span:nth-of-type(2)' do
1792
          assert_select 'a[href=?]', '/attachments/10', :text => 'picture.jpg'
1793
          assert_select 'a[href=?].icon-download', '/attachments/download/10/picture.jpg'
1794
        end
1789 1795
      end
1790 1796
    end
1791 1797
  end
test/integration/lib/redmine/field_format/attachment_format_test.rb
81 81
    assert_response :success
82 82

  
83 83
    # link to the attachment
84
    link = css_select(".cf_#{@field.id} .value a")
84
    link = css_select(".cf_#{@field.id} .value a:not(.icon-download)")
85 85
    assert_equal 1, link.size
86 86
    assert_equal "testfile.txt", link.text
87 87

  
(6-6/6)