Redmine 4.1.1
This commit is contained in:
parent
33e7b881a5
commit
3d976f1b3b
1593 changed files with 36180 additions and 19489 deletions
|
@ -1,7 +1,7 @@
|
|||
# encoding: utf-8
|
||||
#
|
||||
# frozen_string_literal: true
|
||||
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2017 Jean-Philippe Lang
|
||||
# Copyright (C) 2006-2019 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
|
@ -33,13 +33,12 @@ module AttachmentsHelper
|
|||
# :thumbails -- display thumbnails if enabled in settings
|
||||
def link_to_attachments(container, options = {})
|
||||
options.assert_valid_keys(:author, :thumbnails)
|
||||
|
||||
attachments = if container.attachments.loaded?
|
||||
container.attachments
|
||||
else
|
||||
container.attachments.preload(:author).to_a
|
||||
end
|
||||
|
||||
attachments =
|
||||
if container.attachments.loaded?
|
||||
container.attachments
|
||||
else
|
||||
container.attachments.preload(:author).to_a
|
||||
end
|
||||
if attachments.any?
|
||||
options = {
|
||||
:editable => container.attachments_editable?,
|
||||
|
@ -56,6 +55,14 @@ module AttachmentsHelper
|
|||
end
|
||||
end
|
||||
|
||||
def render_pagination
|
||||
pagination_links_each @paginator do |text, parameters, options|
|
||||
if att = @attachments[parameters[:page] - 1]
|
||||
link_to text, named_attachment_path(att, att.filename)
|
||||
end
|
||||
end if @paginator
|
||||
end
|
||||
|
||||
def render_api_attachment(attachment, api, options={})
|
||||
api.attachment do
|
||||
render_api_attachment_attributes(attachment, api)
|
||||
|
@ -78,4 +85,14 @@ module AttachmentsHelper
|
|||
end
|
||||
api.created_on attachment.created_on
|
||||
end
|
||||
|
||||
def render_file_content(attachment, content)
|
||||
if attachment.is_markdown?
|
||||
render :partial => 'common/markup', :locals => {:markup_text_formatting => 'markdown', :markup_text => content}
|
||||
elsif attachment.is_textile?
|
||||
render :partial => 'common/markup', :locals => {:markup_text_formatting => 'textile', :markup_text => content}
|
||||
else
|
||||
render :partial => 'common/file', :locals => {:content => content, :filename => attachment.filename}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue