diff options
author | Go MAEDA <maeda@farend.jp> | 2018-05-17 13:09:43 +0000 |
---|---|---|
committer | Go MAEDA <maeda@farend.jp> | 2018-05-17 13:09:43 +0000 |
commit | 37d1fcf8a46d990a6a1c5ffb1a3f943c8130a004 (patch) | |
tree | d20a86691101167dd312358d5eb105e1a3cb7e86 /app/views/common | |
parent | ccfdee4a53dbe828f7a1cf3a5810d1df2fc53fd1 (diff) | |
download | redmine-37d1fcf8a46d990a6a1c5ffb1a3f943c8130a004.tar.gz redmine-37d1fcf8a46d990a6a1c5ffb1a3f943c8130a004.zip |
Adds previews for audio / video attachments (#27336).
Patch by Jens Kraemer.
git-svn-id: http://svn.redmine.org/redmine/trunk@17340 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/views/common')
-rw-r--r-- | app/views/common/_no_preview.html.erb | 8 | ||||
-rw-r--r-- | app/views/common/_other.html.erb | 28 |
2 files changed, 30 insertions, 6 deletions
diff --git a/app/views/common/_no_preview.html.erb b/app/views/common/_no_preview.html.erb new file mode 100644 index 000000000..3eb9a95a1 --- /dev/null +++ b/app/views/common/_no_preview.html.erb @@ -0,0 +1,8 @@ +<p class="nodata"> + <% if download_link %> + <%= t(:label_no_preview_alternative_html, link: download_link) %> + <% else %> + <%= l(:label_no_preview) %> + <% end %> +</p> + diff --git a/app/views/common/_other.html.erb b/app/views/common/_other.html.erb index 74d87a60a..bb72ec3de 100644 --- a/app/views/common/_other.html.erb +++ b/app/views/common/_other.html.erb @@ -1,7 +1,23 @@ -<p class="nodata"> - <% if defined? download_link %> - <%= t(:label_no_preview_alternative_html, link: download_link) %> +<% download_link = nil unless defined? download_link %> +<% kind = nil unless defined? kind %> +<% path = nil unless defined? path %> + +<% if path.present? %> + + <% if kind == 'video' %> + <%= content_tag :video, class: 'filecontent', src: path, controls: true do %> + <%= render partial: 'common/no_preview', locals: { download_link: download_link } %> + <% end %> + <% elsif kind == 'audio' %> + <%= content_tag :audio, class: 'filecontent', src: path, controls: true do %> + <%= render partial: 'common/no_preview', locals: { download_link: download_link } %> + <% end %> <% else %> - <%= l(:label_no_preview) %> - <% end %> -</p> + <%= render partial: 'common/no_preview', locals: { download_link: download_link } %> + <% end %> + +<% else %> + + <%= render partial: 'common/no_preview', locals: { download_link: download_link } %> + +<% end %> |