@@ -0,0 +1,33 | |||
|
1 | # Redmine - project management software | |
|
2 | # Copyright (C) 2006-2009 Jean-Philippe Lang | |
|
3 | # | |
|
4 | # This program is free software; you can redistribute it and/or | |
|
5 | # modify it under the terms of the GNU General Public License | |
|
6 | # as published by the Free Software Foundation; either version 2 | |
|
7 | # of the License, or (at your option) any later version. | |
|
8 | # | |
|
9 | # This program is distributed in the hope that it will be useful, | |
|
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
|
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
|
12 | # GNU General Public License for more details. | |
|
13 | # | |
|
14 | # You should have received a copy of the GNU General Public License | |
|
15 | # along with this program; if not, write to the Free Software | |
|
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
|
17 | ||
|
18 | module Redmine | |
|
19 | module Views | |
|
20 | class OtherFormatsBuilder | |
|
21 | def initialize(view) | |
|
22 | @view = view | |
|
23 | end | |
|
24 | ||
|
25 | def link_to(name, options={}) | |
|
26 | url = { :format => name.to_s.downcase }.merge(options.delete(:url) || {}) | |
|
27 | caption = options.delete(:caption) || name | |
|
28 | html_options = { :class => name.to_s.downcase }.merge(options) | |
|
29 | @view.content_tag('span', @view.link_to(caption, url, html_options)) | |
|
30 | end | |
|
31 | end | |
|
32 | end | |
|
33 | end |
@@ -45,11 +45,11 class WikiController < ApplicationController | |||
|
45 | 45 | return |
|
46 | 46 | end |
|
47 | 47 | @content = @page.content_for_version(params[:version]) |
|
48 |
if params[: |
|
|
48 | if params[:format] == 'html' | |
|
49 | 49 | export = render_to_string :action => 'export', :layout => false |
|
50 | 50 | send_data(export, :type => 'text/html', :filename => "#{@page.title}.html") |
|
51 | 51 | return |
|
52 |
elsif params[: |
|
|
52 | elsif params[:format] == 'txt' | |
|
53 | 53 | send_data(@content.text, :type => 'text/plain', :filename => "#{@page.title}.txt") |
|
54 | 54 | return |
|
55 | 55 | end |
@@ -283,6 +283,12 module ApplicationHelper | |||
|
283 | 283 | elements.any? ? content_tag('p', args.join(' » ') + ' » ', :class => 'breadcrumb') : nil |
|
284 | 284 | end |
|
285 | 285 | |
|
286 | def other_formats_links(&block) | |
|
287 | concat('<p class="other-formats">' + l(:label_export_to), block.binding) | |
|
288 | yield Redmine::Views::OtherFormatsBuilder.new(self) | |
|
289 | concat('</p>', block.binding) | |
|
290 | end | |
|
291 | ||
|
286 | 292 | def html_title(*args) |
|
287 | 293 | if args.empty? |
|
288 | 294 | title = [] |
@@ -55,10 +55,9 | |||
|
55 | 55 | <% end -%> |
|
56 | 56 | </div> |
|
57 | 57 | |
|
58 | <p class="other-formats"> | |
|
59 | <%= l(:label_export_to) %> | |
|
60 | <%= link_to 'Atom', {:controller => 'projects', :action => 'activity', :id => nil, :user_id => @user, :format => :atom, :key => User.current.rss_key}, :class => 'feed' %> | |
|
61 | </p> | |
|
58 | <% other_formats_links do |f| %> | |
|
59 | <%= f.link_to 'Atom', :url => {:controller => 'projects', :action => 'activity', :id => nil, :user_id => @user, :key => User.current.rss_key} %> | |
|
60 | <% end %> | |
|
62 | 61 | |
|
63 | 62 | <% content_for :header_tags do %> |
|
64 | 63 | <%= auto_discovery_link_tag(:atom, :controller => 'projects', :action => 'activity', :user_id => @user, :format => :atom, :key => User.current.rss_key) %> |
@@ -29,11 +29,9 | |||
|
29 | 29 | </tbody> |
|
30 | 30 | </table> |
|
31 | 31 | |
|
32 | <p class="other-formats"> | |
|
33 | <%= l(:label_export_to) %> | |
|
34 | <span><%= link_to 'Atom', {:controller => 'projects', :action => 'activity', :id => @project, :format => 'atom', :show_messages => 1, :key => User.current.rss_key}, | |
|
35 | :class => 'feed' %></span> | |
|
36 | </p> | |
|
32 | <% other_formats_links do |f| %> | |
|
33 | <%= f.link_to 'Atom', :url => {:controller => 'projects', :action => 'activity', :id => @project, :show_messages => 1, :key => User.current.rss_key} %> | |
|
34 | <% end %> | |
|
37 | 35 | |
|
38 | 36 | <% content_for :header_tags do %> |
|
39 | 37 | <%= auto_discovery_link_tag(:atom, {:controller => 'projects', :action => 'activity', :id => @project, :format => 'atom', :show_messages => 1, :key => User.current.rss_key}) %> |
@@ -241,13 +241,10 if Date.today >= @gantt.date_from and Date.today <= @gantt.date_to %> | |||
|
241 | 241 | </tr> |
|
242 | 242 | </table> |
|
243 | 243 | |
|
244 | <p class="other-formats"> | |
|
245 | <%= l(:label_export_to) %> | |
|
246 | <span><%= link_to 'PDF', @gantt.params.merge(:format => 'pdf'), :class => 'pdf' %></span> | |
|
247 | <% if @gantt.respond_to?('to_image') %> | |
|
248 | <span><%= link_to 'PNG', @gantt.params.merge(:format => 'png'), :class => 'image' %></span> | |
|
244 | <% other_formats_links do |f| %> | |
|
245 | <%= f.link_to 'PDF', :url => @gantt.params %> | |
|
246 | <%= f.link_to('PNG', :url => @gantt.params) if @gantt.respond_to?('to_image') %> | |
|
249 | 247 | <% end %> |
|
250 | </p> | |
|
251 | 248 | <% end # query.valid? %> |
|
252 | 249 | |
|
253 | 250 | <% content_for :sidebar do %> |
@@ -44,12 +44,12 | |||
|
44 | 44 | <%= render :partial => 'issues/list', :locals => {:issues => @issues, :query => @query} %> |
|
45 | 45 | <p class="pagination"><%= pagination_links_full @issue_pages, @issue_count %></p> |
|
46 | 46 | |
|
47 | <p class="other-formats"> | |
|
48 | <%= l(:label_export_to) %> | |
|
49 | <span><%= link_to 'Atom', {:query_id => @query, :format => 'atom', :key => User.current.rss_key}, :class => 'feed' %></span> | |
|
50 | <span><%= link_to 'CSV', {:format => 'csv'}, :class => 'csv' %></span> | |
|
51 | <span><%= link_to 'PDF', {:format => 'pdf'}, :class => 'pdf' %></span> | |
|
52 | </p> | |
|
47 | <% other_formats_links do |f| %> | |
|
48 | <%= f.link_to 'Atom', :url => {:query_id => (@query.new_record? ? nil : @query), :key => User.current.rss_key} %> | |
|
49 | <%= f.link_to 'CSV' %> | |
|
50 | <%= f.link_to 'PDF' %> | |
|
51 | <% end %> | |
|
52 | ||
|
53 | 53 | <% end %> |
|
54 | 54 | <% end %> |
|
55 | 55 |
@@ -108,11 +108,10 end %> | |||
|
108 | 108 | </div> |
|
109 | 109 | <% end %> |
|
110 | 110 | |
|
111 | <p class="other-formats"> | |
|
112 | <%= l(:label_export_to) %> | |
|
113 | <span><%= link_to 'Atom', {:format => 'atom', :key => User.current.rss_key}, :class => 'feed' %></span> | |
|
114 | <span><%= link_to 'PDF', {:format => 'pdf'}, :class => 'pdf' %></span> | |
|
115 | </p> | |
|
111 | <% other_formats_links do |f| %> | |
|
112 | <%= f.link_to 'Atom', :url => {:key => User.current.rss_key} %> | |
|
113 | <%= f.link_to 'PDF' %> | |
|
114 | <% end %> | |
|
116 | 115 | |
|
117 | 116 | <% html_title "#{@issue.tracker.name} ##{@issue.id}: #{@issue.subject}" %> |
|
118 | 117 |
@@ -39,10 +39,9 | |||
|
39 | 39 | <% end %> |
|
40 | 40 | <p class="pagination"><%= pagination_links_full @news_pages %></p> |
|
41 | 41 | |
|
42 | <p class="other-formats"> | |
|
43 | <%= l(:label_export_to) %> | |
|
44 | <span><%= link_to 'Atom', {:project_id => @project, :format => 'atom', :key => User.current.rss_key}, :class => 'feed' %></span> | |
|
45 | </p> | |
|
42 | <% other_formats_links do |f| %> | |
|
43 | <%= f.link_to 'Atom', :url => {:project_id => @project, :key => User.current.rss_key} %> | |
|
44 | <% end %> | |
|
46 | 45 | |
|
47 | 46 | <% content_for :header_tags do %> |
|
48 | 47 | <%= auto_discovery_link_tag(:atom, params.merge({:format => 'atom', :page => nil, :key => User.current.rss_key})) %> |
@@ -33,10 +33,9 | |||
|
33 | 33 | :title => "#{l(:label_date_from)} #{format_date(@date_to)} #{l(:label_date_to).downcase} #{format_date(@date_to + @days - 1)}"}) unless @date_to >= Date.today %> |
|
34 | 34 | </div> |
|
35 | 35 | |
|
36 | <p class="other-formats"> | |
|
37 | <%= l(:label_export_to) %> | |
|
38 | <%= link_to 'Atom', params.merge(:format => :atom, :from => nil, :key => User.current.rss_key), :class => 'feed' %> | |
|
39 | </p> | |
|
36 | <% other_formats_links do |f| %> | |
|
37 | <%= f.link_to 'Atom', :url => params.merge(:from => nil, :key => User.current.rss_key) %> | |
|
38 | <% end %> | |
|
40 | 39 | |
|
41 | 40 | <% content_for :header_tags do %> |
|
42 | 41 | <%= auto_discovery_link_tag(:atom, params.merge(:format => 'atom', :from => nil, :key => User.current.rss_key)) %> |
@@ -14,9 +14,8 | |||
|
14 | 14 | </p> |
|
15 | 15 | <% end %> |
|
16 | 16 | |
|
17 | <p class="other-formats"> | |
|
18 | <%= l(:label_export_to) %> | |
|
19 | <span><%= link_to 'Atom', {:format => 'atom', :key => User.current.rss_key}, :class => 'feed' %></span> | |
|
20 | </p> | |
|
17 | <% other_formats_links do |f| %> | |
|
18 | <%= f.link_to 'Atom', :url => {:key => User.current.rss_key} %> | |
|
19 | <% end %> | |
|
21 | 20 | |
|
22 | 21 | <% html_title(l(:label_project_plural)) -%> |
@@ -15,10 +15,9 | |||
|
15 | 15 | <%= render :partial => 'common/diff', :locals => {:diff => @diff, :diff_type => @diff_type} %> |
|
16 | 16 | <% end -%> |
|
17 | 17 | |
|
18 | <p class="other-formats"> | |
|
19 | <%= l(:label_export_to) %> | |
|
20 | <span><%= link_to 'Unified diff', params.merge(:format => 'diff') %></span> | |
|
21 | </p> | |
|
18 | <% other_formats_links do |f| %> | |
|
19 | <%= f.link_to 'Diff', :url => params, :caption => 'Unified diff' %> | |
|
20 | <% end %> | |
|
22 | 21 | |
|
23 | 22 | <% html_title(with_leading_slash(@path), 'Diff') -%> |
|
24 | 23 |
@@ -16,9 +16,8 | |||
|
16 | 16 | <%= auto_discovery_link_tag(:atom, params.merge({:format => 'atom', :page => nil, :key => User.current.rss_key})) %> |
|
17 | 17 | <% end %> |
|
18 | 18 | |
|
19 | <p class="other-formats"> | |
|
20 | <%= l(:label_export_to) %> | |
|
21 | <span><%= link_to 'Atom', {:format => 'atom', :key => User.current.rss_key}, :class => 'feed' %></span> | |
|
22 | </p> | |
|
19 | <% other_formats_links do |f| %> | |
|
20 | <%= f.link_to 'Atom', :url => {:key => User.current.rss_key} %> | |
|
21 | <% end %> | |
|
23 | 22 | |
|
24 | 23 | <% html_title(l(:label_revision_plural)) -%> |
@@ -22,10 +22,10 | |||
|
22 | 22 | <% content_for :header_tags do %> |
|
23 | 23 | <%= auto_discovery_link_tag(:atom, params.merge({:format => 'atom', :action => 'revisions', :id => @project, :page => nil, :key => User.current.rss_key})) %> |
|
24 | 24 | <% end %> |
|
25 | <p class="other-formats"> | |
|
26 | <%= l(:label_export_to) %> | |
|
27 |
|
|
|
28 | </p> | |
|
25 | ||
|
26 | <% other_formats_links do |f| %> | |
|
27 | <%= f.link_to 'Atom', :url => {:action => 'revisions', :id => @project, :key => User.current.rss_key} %> | |
|
28 | <% end %> | |
|
29 | 29 | <% end %> |
|
30 | 30 | |
|
31 | 31 | <% content_for :header_tags do %> |
@@ -22,11 +22,10 already in the URI %> | |||
|
22 | 22 | <%= render :partial => 'list', :locals => { :entries => @entries }%> |
|
23 | 23 | <p class="pagination"><%= pagination_links_full @entry_pages, @entry_count %></p> |
|
24 | 24 | |
|
25 | <p class="other-formats"> | |
|
26 | <%= l(:label_export_to) %> | |
|
27 | <span><%= link_to 'Atom', {:issue_id => @issue, :format => 'atom', :key => User.current.rss_key}, :class => 'feed' %></span> | |
|
28 | <span><%= link_to 'CSV', params.merge(:format => 'csv'), :class => 'csv' %></span> | |
|
29 | </p> | |
|
25 | <% other_formats_links do |f| %> | |
|
26 | <%= f.link_to 'Atom', :url => params.merge({:issue_id => @issue, :key => User.current.rss_key}) %> | |
|
27 | <%= f.link_to 'CSV', :url => params %> | |
|
28 | <% end %> | |
|
30 | 29 | <% end %> |
|
31 | 30 | |
|
32 | 31 | <% html_title l(:label_spent_time), l(:label_details) %> |
@@ -65,10 +65,9 | |||
|
65 | 65 | </tbody> |
|
66 | 66 | </table> |
|
67 | 67 | |
|
68 | <p class="other-formats"> | |
|
69 | <%= l(:label_export_to) %> | |
|
70 | <span><%= link_to 'CSV', params.merge({:format => 'csv'}), :class => 'csv' %></span> | |
|
71 | </p> | |
|
68 | <% other_formats_links do |f| %> | |
|
69 | <%= f.link_to 'CSV', :url => params %> | |
|
70 | <% end %> | |
|
72 | 71 | <% end %> |
|
73 | 72 | <% end %> |
|
74 | 73 |
@@ -42,11 +42,10 | |||
|
42 | 42 | <% end %> |
|
43 | 43 | <% end %> |
|
44 | 44 | |
|
45 | <p class="other-formats"> | |
|
46 | <%= l(:label_export_to) %> | |
|
47 |
|
|
|
48 | <span><%= link_to 'TXT', {:page => @page.title, :export => 'txt', :version => @content.version}, :class => 'text' %></span> | |
|
49 | </p> | |
|
45 | <% other_formats_links do |f| %> | |
|
46 | <%= f.link_to 'HTML', :url => {:page => @page.title, :version => @content.version} %> | |
|
47 | <%= f.link_to 'TXT', :url => {:page => @page.title, :version => @content.version} %> | |
|
48 | <% end %> | |
|
50 | 49 | |
|
51 | 50 | <% content_for :header_tags do %> |
|
52 | 51 | <%= stylesheet_link_tag 'scm' %> |
@@ -18,11 +18,10 | |||
|
18 | 18 | <% end %> |
|
19 | 19 | |
|
20 | 20 | <% unless @pages.empty? %> |
|
21 | <p class="other-formats"> | |
|
22 | <%= l(:label_export_to) %> | |
|
23 | <span><%= link_to 'Atom', {:controller => 'projects', :action => 'activity', :id => @project, :show_wiki_pages => 1, :format => 'atom', :key => User.current.rss_key}, :class => 'feed' %></span> | |
|
24 | <span><%= link_to 'HTML', {:action => 'special', :page => 'export'}, :class => 'html' %></span> | |
|
25 | </p> | |
|
21 | <% other_formats_links do |f| %> | |
|
22 | <%= f.link_to 'Atom', :url => {:controller => 'projects', :action => 'activity', :id => @project, :show_wiki_pages => 1, :key => User.current.rss_key} %> | |
|
23 | <%= f.link_to 'HTML', :url => {:action => 'special', :page => 'export'} %> | |
|
24 | <% end %> | |
|
26 | 25 | <% end %> |
|
27 | 26 | |
|
28 | 27 | <% content_for :header_tags do %> |
@@ -11,11 +11,10 | |||
|
11 | 11 | <% end %> |
|
12 | 12 | |
|
13 | 13 | <% unless @pages.empty? %> |
|
14 | <p class="other-formats"> | |
|
15 | <%= l(:label_export_to) %> | |
|
16 | <span><%= link_to 'Atom', {:controller => 'projects', :action => 'activity', :id => @project, :show_wiki_pages => 1, :format => 'atom', :key => User.current.rss_key}, :class => 'feed' %></span> | |
|
17 | <span><%= link_to 'HTML', {:action => 'special', :page => 'export'} %></span> | |
|
18 | </p> | |
|
14 | <% other_formats_links do |f| %> | |
|
15 | <%= f.link_to 'Atom', :url => {:controller => 'projects', :action => 'activity', :id => @project, :show_wiki_pages => 1, :key => User.current.rss_key} %> | |
|
16 | <%= f.link_to 'HTML', :url => {:action => 'special', :page => 'export'} %> | |
|
17 | <% end %> | |
|
19 | 18 | <% end %> |
|
20 | 19 | |
|
21 | 20 | <% content_for :header_tags do %> |
@@ -307,7 +307,7 div.attachments span.author { font-size: 0.9em; color: #888; } | |||
|
307 | 307 | p.other-formats { text-align: right; font-size:0.9em; color: #666; } |
|
308 | 308 | .other-formats span + span:before { content: "| "; } |
|
309 | 309 | |
|
310 |
a. |
|
|
310 | a.atom { background: url(../images/feed.png) no-repeat 1px 50%; padding: 2px 0px 3px 16px; } | |
|
311 | 311 | |
|
312 | 312 | /***** Flash & error messages ****/ |
|
313 | 313 | #errorExplanation, div.flash, .nodata, .warning { |
General Comments 0
You need to be logged in to leave comments.
Login now