0002-Add-download-link-to-no-preview-message.patch

Jan from Planio www.plan.io, 2017-05-24 18:51

Download (5.72 KB)

View differences:

app/views/attachments/other.html.erb
1 1
<%= render :layout => 'layouts/file' do %>
2
  <%= render :partial => 'common/other' %>
2
  <%= render :partial => 'common/other',
3
             :locals => {
4
               :download_link => link_to_attachment(
5
                                   @attachment,
6
                                   :text => l(:label_no_preview_download),
7
                                   :download => true,
8
                                   :class => 'icon icon-download'
9
                                 )
10
             } %>
3 11
<% end %>
app/views/common/_other.html.erb
1
<p class="nodata"><%= l(:label_no_preview) %></p>
1
<p class="nodata">
2
  <% if defined? download_link %>
3
    <%= t(:label_no_preview_alternative_html, link: download_link) %>
4
  <% else %>
5
    <%= l(:label_no_preview) %>
6
  <% end %>
7
</p>
app/views/repositories/entry.html.erb
17 17
<% elsif @content %>
18 18
  <%= render :partial => 'common/file', :locals => {:filename => @path, :content => @content} %>
19 19
<% else %>
20
  <%= render :partial => 'common/other' %>
20
  <%= render :partial => 'common/other',
21
             :locals => {
22
               :download_link => @repository.supports_cat? ? link_to(
23
                 l(:label_no_preview_download),
24
                 { :action => 'raw', :id => @project,
25
                   :repository_id => @repository.identifier_param,
26
                   :path => to_path_param(@path),
27
                   :rev => @rev },
28
                :class => 'icon icon-download') : nil } %>
21 29
<% end %>
22 30

  
23 31
<% content_for :header_tags do %>
config/locales/de.yml
654 654
  label_no_change_option: (Keine Änderung)
655 655
  label_no_data: Nichts anzuzeigen
656 656
  label_no_preview: Keine Vorschau verfügbar
657
  label_no_preview_alternative_html: Keine Vorschau verfügbar. Sie können die Datei stattdessen %{link}.
658
  label_no_preview_download: herunterladen
657 659
  label_no_issues_in_project: keine Tickets im Projekt
658 660
  label_nobody: Niemand
659 661
  label_none: kein
config/locales/en.yml
638 638
  label_attribute_plural: Attributes
639 639
  label_no_data: No data to display
640 640
  label_no_preview: No preview available
641
  label_no_preview_alternative_html: No preview available. %{link} the file instead.
642
  label_no_preview_download: Download
641 643
  label_change_status: Change status
642 644
  label_history: History
643 645
  label_attachment: File
config/locales/fr.yml
1223 1223
  mail_body_security_notification_notify_enabled: Les notifications ont été activées pour l'adresse %{value}
1224 1224
  mail_body_security_notification_notify_disabled: Les notifications ont été désactivées pour l'adresse %{value}
1225 1225
  field_remote_ip: Adresse IP
1226
  label_no_preview: No preview available
1226
  label_no_preview: Aucun aperçu disponible
1227
  label_no_preview_alternative_html: Aucun aperçu disponible. Veuillez %{link} le fichier.
1228
  label_no_preview_download: télécharger
1227 1229
  label_user_mail_option_only_assigned: Only for things I watch or I am assigned to
1228 1230
  label_user_mail_option_only_owner: Only for things I watch or I am the owner of
test/functional/attachments_controller_test.rb
180 180
      get :show, :id => 4
181 181
      assert_response :success
182 182
      assert_equal 'text/html', @response.content_type
183
      assert_select '.nodata', :text => 'No preview available'
183
      assert_select '.nodata', :text => 'No preview available. Download the file instead.'
184 184
    end
185 185
    set_tmp_attachments_directory
186 186
  end
......
197 197
    @request.session[:user_id] = 2
198 198
    get :show, :id => 6
199 199
    assert_equal 'text/html', @response.content_type
200
    assert_select '.nodata', :text => 'No preview available'
200
    assert_select '.nodata', :text => 'No preview available. Download the file instead.'
201 201
    set_tmp_attachments_directory
202 202
  end
203 203

  
204
-