##// END OF EJS Templates
Use named routes or helpers....
Jean-Philippe Lang -
r13274:1fcbeb6f816a
parent child
Show More
@@ -1,47 +1,47
1 # encoding: utf-8
1 # encoding: utf-8
2 #
2 #
3 # Redmine - project management software
3 # Redmine - project management software
4 # Copyright (C) 2006-2014 Jean-Philippe Lang
4 # Copyright (C) 2006-2014 Jean-Philippe Lang
5 #
5 #
6 # This program is free software; you can redistribute it and/or
6 # This program is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU General Public License
7 # modify it under the terms of the GNU General Public License
8 # as published by the Free Software Foundation; either version 2
8 # as published by the Free Software Foundation; either version 2
9 # of the License, or (at your option) any later version.
9 # of the License, or (at your option) any later version.
10 #
10 #
11 # This program is distributed in the hope that it will be useful,
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
14 # GNU General Public License for more details.
15 #
15 #
16 # You should have received a copy of the GNU General Public License
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19
19
20 module AttachmentsHelper
20 module AttachmentsHelper
21 # Displays view/delete links to the attachments of the given object
21 # Displays view/delete links to the attachments of the given object
22 # Options:
22 # Options:
23 # :author -- author names are not displayed if set to false
23 # :author -- author names are not displayed if set to false
24 # :thumbails -- display thumbnails if enabled in settings
24 # :thumbails -- display thumbnails if enabled in settings
25 def link_to_attachments(container, options = {})
25 def link_to_attachments(container, options = {})
26 options.assert_valid_keys(:author, :thumbnails)
26 options.assert_valid_keys(:author, :thumbnails)
27
27
28 if container.attachments.any?
28 if container.attachments.any?
29 options = {:deletable => container.attachments_deletable?, :author => true}.merge(options)
29 options = {:deletable => container.attachments_deletable?, :author => true}.merge(options)
30 render :partial => 'attachments/links',
30 render :partial => 'attachments/links',
31 :locals => {:attachments => container.attachments, :options => options, :thumbnails => (options[:thumbnails] && Setting.thumbnails_enabled?)}
31 :locals => {:attachments => container.attachments, :options => options, :thumbnails => (options[:thumbnails] && Setting.thumbnails_enabled?)}
32 end
32 end
33 end
33 end
34
34
35 def render_api_attachment(attachment, api)
35 def render_api_attachment(attachment, api)
36 api.attachment do
36 api.attachment do
37 api.id attachment.id
37 api.id attachment.id
38 api.filename attachment.filename
38 api.filename attachment.filename
39 api.filesize attachment.filesize
39 api.filesize attachment.filesize
40 api.content_type attachment.content_type
40 api.content_type attachment.content_type
41 api.description attachment.description
41 api.description attachment.description
42 api.content_url url_for(:controller => 'attachments', :action => 'download', :id => attachment, :filename => attachment.filename, :only_path => false)
42 api.content_url download_named_attachment_url(attachment, attachment.filename)
43 api.author(:id => attachment.author.id, :name => attachment.author.name) if attachment.author
43 api.author(:id => attachment.author.id, :name => attachment.author.name) if attachment.author
44 api.created_on attachment.created_on
44 api.created_on attachment.created_on
45 end
45 end
46 end
46 end
47 end
47 end
@@ -1,32 +1,32
1 xml.instruct!
1 xml.instruct!
2 xml.feed "xmlns" => "http://www.w3.org/2005/Atom" do
2 xml.feed "xmlns" => "http://www.w3.org/2005/Atom" do
3 xml.title truncate_single_line_raw(@title, 100)
3 xml.title truncate_single_line_raw(@title, 100)
4 xml.link "rel" => "self", "href" => url_for(params.merge(:only_path => false))
4 xml.link "rel" => "self", "href" => url_for(params.merge(:only_path => false))
5 xml.link "rel" => "alternate", "href" => url_for(params.merge(:only_path => false, :format => nil, :key => nil))
5 xml.link "rel" => "alternate", "href" => url_for(params.merge(:only_path => false, :format => nil, :key => nil))
6 xml.id url_for(:controller => 'welcome', :only_path => false)
6 xml.id home_url
7 xml.icon favicon_url
7 xml.icon favicon_url
8 xml.updated((@items.first ? @items.first.event_datetime : Time.now).xmlschema)
8 xml.updated((@items.first ? @items.first.event_datetime : Time.now).xmlschema)
9 xml.author { xml.name "#{Setting.app_title}" }
9 xml.author { xml.name "#{Setting.app_title}" }
10 xml.generator(:uri => Redmine::Info.url) { xml.text! Redmine::Info.app_name; }
10 xml.generator(:uri => Redmine::Info.url) { xml.text! Redmine::Info.app_name; }
11 @items.each do |item|
11 @items.each do |item|
12 xml.entry do
12 xml.entry do
13 url = url_for(item.event_url(:only_path => false))
13 url = url_for(item.event_url(:only_path => false))
14 if @project
14 if @project
15 xml.title truncate_single_line_raw(item.event_title, 100)
15 xml.title truncate_single_line_raw(item.event_title, 100)
16 else
16 else
17 xml.title truncate_single_line_raw("#{item.project} - #{item.event_title}", 100)
17 xml.title truncate_single_line_raw("#{item.project} - #{item.event_title}", 100)
18 end
18 end
19 xml.link "rel" => "alternate", "href" => url
19 xml.link "rel" => "alternate", "href" => url
20 xml.id url
20 xml.id url
21 xml.updated item.event_datetime.xmlschema
21 xml.updated item.event_datetime.xmlschema
22 author = item.event_author if item.respond_to?(:event_author)
22 author = item.event_author if item.respond_to?(:event_author)
23 xml.author do
23 xml.author do
24 xml.name(author)
24 xml.name(author)
25 xml.email(author.mail) if author.is_a?(User) && !author.mail.blank? && !author.pref.hide_mail
25 xml.email(author.mail) if author.is_a?(User) && !author.mail.blank? && !author.pref.hide_mail
26 end if author
26 end if author
27 xml.content "type" => "html" do
27 xml.content "type" => "html" do
28 xml.text! textilizable(item, :event_description, :only_path => false)
28 xml.text! textilizable(item, :event_description, :only_path => false)
29 end
29 end
30 end
30 end
31 end
31 end
32 end
32 end
@@ -1,31 +1,31
1 xml.instruct!
1 xml.instruct!
2 xml.feed "xmlns" => "http://www.w3.org/2005/Atom" do
2 xml.feed "xmlns" => "http://www.w3.org/2005/Atom" do
3 xml.title @title
3 xml.title @title
4 xml.link "rel" => "self", "href" => url_for(:format => 'atom', :key => User.current.rss_key, :only_path => false)
4 xml.link "rel" => "self", "href" => url_for(:format => 'atom', :key => User.current.rss_key, :only_path => false)
5 xml.link "rel" => "alternate", "href" => home_url(:only_path => false)
5 xml.link "rel" => "alternate", "href" => home_url
6 xml.id url_for(:controller => 'welcome', :only_path => false)
6 xml.id home_url
7 xml.icon favicon_url
7 xml.icon favicon_url
8 xml.updated((@journals.first ? @journals.first.event_datetime : Time.now).xmlschema)
8 xml.updated((@journals.first ? @journals.first.event_datetime : Time.now).xmlschema)
9 xml.author { xml.name "#{Setting.app_title}" }
9 xml.author { xml.name "#{Setting.app_title}" }
10 @journals.each do |change|
10 @journals.each do |change|
11 issue = change.issue
11 issue = change.issue
12 xml.entry do
12 xml.entry do
13 xml.title "#{issue.project.name} - #{issue.tracker.name} ##{issue.id}: #{issue.subject}"
13 xml.title "#{issue.project.name} - #{issue.tracker.name} ##{issue.id}: #{issue.subject}"
14 xml.link "rel" => "alternate", "href" => url_for(:controller => 'issues' , :action => 'show', :id => issue, :only_path => false)
14 xml.link "rel" => "alternate", "href" => issue_url(issue)
15 xml.id url_for(:controller => 'issues' , :action => 'show', :id => issue, :journal_id => change, :only_path => false)
15 xml.id issue_url(issue, :journal_id => change)
16 xml.updated change.created_on.xmlschema
16 xml.updated change.created_on.xmlschema
17 xml.author do
17 xml.author do
18 xml.name change.user.name
18 xml.name change.user.name
19 xml.email(change.user.mail) if change.user.is_a?(User) && !change.user.mail.blank? && !change.user.pref.hide_mail
19 xml.email(change.user.mail) if change.user.is_a?(User) && !change.user.mail.blank? && !change.user.pref.hide_mail
20 end
20 end
21 xml.content "type" => "html" do
21 xml.content "type" => "html" do
22 xml.text! '<ul>'
22 xml.text! '<ul>'
23 details_to_strings(change.details, false).each do |string|
23 details_to_strings(change.details, false).each do |string|
24 xml.text! '<li>' + string + '</li>'
24 xml.text! '<li>' + string + '</li>'
25 end
25 end
26 xml.text! '</ul>'
26 xml.text! '</ul>'
27 xml.text! textilizable(change, :notes, :only_path => false) unless change.notes.blank?
27 xml.text! textilizable(change, :notes, :only_path => false) unless change.notes.blank?
28 end
28 end
29 end
29 end
30 end
30 end
31 end
31 end
@@ -1,9 +1,9
1 <p><%= l(:mail_body_reminder, :count => @issues.size, :days => @days) %></p>
1 <p><%= l(:mail_body_reminder, :count => @issues.size, :days => @days) %></p>
2
2
3 <ul>
3 <ul>
4 <% @issues.each do |issue| -%>
4 <% @issues.each do |issue| -%>
5 <li><%=h issue.project %> - <%=link_to(h("#{issue.tracker} ##{issue.id}"), :controller => 'issues', :action => 'show', :id => issue, :only_path => false)%>: <%=h issue.subject %></li>
5 <li><%= link_to_issue(issue, :project => true, :only_path => false) %></li>
6 <% end -%>
6 <% end -%>
7 </ul>
7 </ul>
8
8
9 <p><%= link_to l(:label_issue_view_all), @issues_url %></p>
9 <p><%= link_to l(:label_issue_view_all), @issues_url %></p>
General Comments 0
You need to be logged in to leave comments. Login now