Skip to content

Commit 4e4ba70

Browse files
committed
Don't show non-working download button for templates
It's a little followup to recent commit 6c00320. It seems unlikely that someone would want to disable the download url a public searchable template, but let's behave sanely if they do. Also download_url site method instead of preparing the url manually.
1 parent aed6cee commit 4e4ba70

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

rails/app/views/application/_site_tile.html.haml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,13 @@
2020
- if clone_buttons
2121
-# Show the new style clone and download buttons
2222
.clone-download-buttons
23-
= link_to "#{site.url}/download", class: 'btn btn-sm btn-light' do
24-
#{bi_icon('download', height: '1.2em', fill: '#777')}Download
23+
-#
24+
This is an unlikely use case, but the download link won't work if the
25+
disable_download_url option is set for a site, so let's not show the
26+
download button in that situation
27+
- unless site.disable_download_url
28+
= link_to site.download_url, class: 'btn btn-sm btn-light' do
29+
#{bi_icon('download', height: '1.2em', fill: '#777')}Download
2530
= link_to new_site_path(clone: site.name), class: 'btn btn-sm btn-light' do
2631
#{bi_icon('files', height: '1.2em', fill: '#777')}Clone
2732

0 commit comments

Comments
 (0)