Project

General

Profile

Feature #32240 » 32240_add_download_button_v3.patch

Yuichi HARADA, 2020-02-05 02:56

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
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:none;}
246
table.list td.attachments span:hover a.icon-download {display:inline-block;}
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

  
(5-5/6)