Adds an helper to render other formats download links.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2333 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
bf76988ebc
commit
f1aa0df326
|
@ -45,11 +45,11 @@ class WikiController < ApplicationController
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@content = @page.content_for_version(params[:version])
|
@content = @page.content_for_version(params[:version])
|
||||||
if params[:export] == 'html'
|
if params[:format] == 'html'
|
||||||
export = render_to_string :action => 'export', :layout => false
|
export = render_to_string :action => 'export', :layout => false
|
||||||
send_data(export, :type => 'text/html', :filename => "#{@page.title}.html")
|
send_data(export, :type => 'text/html', :filename => "#{@page.title}.html")
|
||||||
return
|
return
|
||||||
elsif params[:export] == 'txt'
|
elsif params[:format] == 'txt'
|
||||||
send_data(@content.text, :type => 'text/plain', :filename => "#{@page.title}.txt")
|
send_data(@content.text, :type => 'text/plain', :filename => "#{@page.title}.txt")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
|
@ -282,6 +282,12 @@ module ApplicationHelper
|
||||||
elements = args.flatten
|
elements = args.flatten
|
||||||
elements.any? ? content_tag('p', args.join(' » ') + ' » ', :class => 'breadcrumb') : nil
|
elements.any? ? content_tag('p', args.join(' » ') + ' » ', :class => 'breadcrumb') : nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def other_formats_links(&block)
|
||||||
|
concat('<p class="other-formats">' + l(:label_export_to), block.binding)
|
||||||
|
yield Redmine::Views::OtherFormatsBuilder.new(self)
|
||||||
|
concat('</p>', block.binding)
|
||||||
|
end
|
||||||
|
|
||||||
def html_title(*args)
|
def html_title(*args)
|
||||||
if args.empty?
|
if args.empty?
|
||||||
|
|
|
@ -55,10 +55,9 @@
|
||||||
<% end -%>
|
<% end -%>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<p class="other-formats">
|
<% other_formats_links do |f| %>
|
||||||
<%= l(:label_export_to) %>
|
<%= f.link_to 'Atom', :url => {:controller => 'projects', :action => 'activity', :id => nil, :user_id => @user, :key => User.current.rss_key} %>
|
||||||
<%= link_to 'Atom', {:controller => 'projects', :action => 'activity', :id => nil, :user_id => @user, :format => :atom, :key => User.current.rss_key}, :class => 'feed' %>
|
<% end %>
|
||||||
</p>
|
|
||||||
|
|
||||||
<% content_for :header_tags do %>
|
<% content_for :header_tags do %>
|
||||||
<%= auto_discovery_link_tag(:atom, :controller => 'projects', :action => 'activity', :user_id => @user, :format => :atom, :key => User.current.rss_key) %>
|
<%= auto_discovery_link_tag(:atom, :controller => 'projects', :action => 'activity', :user_id => @user, :format => :atom, :key => User.current.rss_key) %>
|
||||||
|
|
|
@ -29,11 +29,9 @@
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<p class="other-formats">
|
<% other_formats_links do |f| %>
|
||||||
<%= l(:label_export_to) %>
|
<%= f.link_to 'Atom', :url => {:controller => 'projects', :action => 'activity', :id => @project, :show_messages => 1, :key => User.current.rss_key} %>
|
||||||
<span><%= link_to 'Atom', {:controller => 'projects', :action => 'activity', :id => @project, :format => 'atom', :show_messages => 1, :key => User.current.rss_key},
|
<% end %>
|
||||||
:class => 'feed' %></span>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<% content_for :header_tags do %>
|
<% content_for :header_tags do %>
|
||||||
<%= auto_discovery_link_tag(:atom, {:controller => 'projects', :action => 'activity', :id => @project, :format => 'atom', :show_messages => 1, :key => User.current.rss_key}) %>
|
<%= 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 %>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<p class="other-formats">
|
<% other_formats_links do |f| %>
|
||||||
<%= l(:label_export_to) %>
|
<%= f.link_to 'PDF', :url => @gantt.params %>
|
||||||
<span><%= link_to 'PDF', @gantt.params.merge(:format => 'pdf'), :class => 'pdf' %></span>
|
<%= f.link_to('PNG', :url => @gantt.params) if @gantt.respond_to?('to_image') %>
|
||||||
<% if @gantt.respond_to?('to_image') %>
|
|
||||||
<span><%= link_to 'PNG', @gantt.params.merge(:format => 'png'), :class => 'image' %></span>
|
|
||||||
<% end %>
|
<% end %>
|
||||||
</p>
|
|
||||||
<% end # query.valid? %>
|
<% end # query.valid? %>
|
||||||
|
|
||||||
<% content_for :sidebar do %>
|
<% content_for :sidebar do %>
|
||||||
|
|
|
@ -44,12 +44,12 @@
|
||||||
<%= render :partial => 'issues/list', :locals => {:issues => @issues, :query => @query} %>
|
<%= render :partial => 'issues/list', :locals => {:issues => @issues, :query => @query} %>
|
||||||
<p class="pagination"><%= pagination_links_full @issue_pages, @issue_count %></p>
|
<p class="pagination"><%= pagination_links_full @issue_pages, @issue_count %></p>
|
||||||
|
|
||||||
<p class="other-formats">
|
<% other_formats_links do |f| %>
|
||||||
<%= l(:label_export_to) %>
|
<%= f.link_to 'Atom', :url => {:query_id => (@query.new_record? ? nil : @query), :key => User.current.rss_key} %>
|
||||||
<span><%= link_to 'Atom', {:query_id => @query, :format => 'atom', :key => User.current.rss_key}, :class => 'feed' %></span>
|
<%= f.link_to 'CSV' %>
|
||||||
<span><%= link_to 'CSV', {:format => 'csv'}, :class => 'csv' %></span>
|
<%= f.link_to 'PDF' %>
|
||||||
<span><%= link_to 'PDF', {:format => 'pdf'}, :class => 'pdf' %></span>
|
<% end %>
|
||||||
</p>
|
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
|
|
@ -108,11 +108,10 @@ end %>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<p class="other-formats">
|
<% other_formats_links do |f| %>
|
||||||
<%= l(:label_export_to) %>
|
<%= f.link_to 'Atom', :url => {:key => User.current.rss_key} %>
|
||||||
<span><%= link_to 'Atom', {:format => 'atom', :key => User.current.rss_key}, :class => 'feed' %></span>
|
<%= f.link_to 'PDF' %>
|
||||||
<span><%= link_to 'PDF', {:format => 'pdf'}, :class => 'pdf' %></span>
|
<% end %>
|
||||||
</p>
|
|
||||||
|
|
||||||
<% html_title "#{@issue.tracker.name} ##{@issue.id}: #{@issue.subject}" %>
|
<% html_title "#{@issue.tracker.name} ##{@issue.id}: #{@issue.subject}" %>
|
||||||
|
|
||||||
|
|
|
@ -39,10 +39,9 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
<p class="pagination"><%= pagination_links_full @news_pages %></p>
|
<p class="pagination"><%= pagination_links_full @news_pages %></p>
|
||||||
|
|
||||||
<p class="other-formats">
|
<% other_formats_links do |f| %>
|
||||||
<%= l(:label_export_to) %>
|
<%= f.link_to 'Atom', :url => {:project_id => @project, :key => User.current.rss_key} %>
|
||||||
<span><%= link_to 'Atom', {:project_id => @project, :format => 'atom', :key => User.current.rss_key}, :class => 'feed' %></span>
|
<% end %>
|
||||||
</p>
|
|
||||||
|
|
||||||
<% content_for :header_tags do %>
|
<% content_for :header_tags do %>
|
||||||
<%= auto_discovery_link_tag(:atom, params.merge({:format => 'atom', :page => nil, :key => User.current.rss_key})) %>
|
<%= auto_discovery_link_tag(:atom, params.merge({:format => 'atom', :page => nil, :key => User.current.rss_key})) %>
|
||||||
|
|
|
@ -33,10 +33,9 @@
|
||||||
: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 %>
|
: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 %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<p class="other-formats">
|
<% other_formats_links do |f| %>
|
||||||
<%= l(:label_export_to) %>
|
<%= f.link_to 'Atom', :url => params.merge(:from => nil, :key => User.current.rss_key) %>
|
||||||
<%= link_to 'Atom', params.merge(:format => :atom, :from => nil, :key => User.current.rss_key), :class => 'feed' %>
|
<% end %>
|
||||||
</p>
|
|
||||||
|
|
||||||
<% content_for :header_tags do %>
|
<% content_for :header_tags do %>
|
||||||
<%= auto_discovery_link_tag(:atom, params.merge(:format => 'atom', :from => nil, :key => User.current.rss_key)) %>
|
<%= auto_discovery_link_tag(:atom, params.merge(:format => 'atom', :from => nil, :key => User.current.rss_key)) %>
|
||||||
|
|
|
@ -14,9 +14,8 @@
|
||||||
</p>
|
</p>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<p class="other-formats">
|
<% other_formats_links do |f| %>
|
||||||
<%= l(:label_export_to) %>
|
<%= f.link_to 'Atom', :url => {:key => User.current.rss_key} %>
|
||||||
<span><%= link_to 'Atom', {:format => 'atom', :key => User.current.rss_key}, :class => 'feed' %></span>
|
<% end %>
|
||||||
</p>
|
|
||||||
|
|
||||||
<% html_title(l(:label_project_plural)) -%>
|
<% html_title(l(:label_project_plural)) -%>
|
||||||
|
|
|
@ -15,10 +15,9 @@
|
||||||
<%= render :partial => 'common/diff', :locals => {:diff => @diff, :diff_type => @diff_type} %>
|
<%= render :partial => 'common/diff', :locals => {:diff => @diff, :diff_type => @diff_type} %>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
|
|
||||||
<p class="other-formats">
|
<% other_formats_links do |f| %>
|
||||||
<%= l(:label_export_to) %>
|
<%= f.link_to 'Diff', :url => params, :caption => 'Unified diff' %>
|
||||||
<span><%= link_to 'Unified diff', params.merge(:format => 'diff') %></span>
|
<% end %>
|
||||||
</p>
|
|
||||||
|
|
||||||
<% html_title(with_leading_slash(@path), 'Diff') -%>
|
<% html_title(with_leading_slash(@path), 'Diff') -%>
|
||||||
|
|
||||||
|
|
|
@ -16,9 +16,8 @@
|
||||||
<%= auto_discovery_link_tag(:atom, params.merge({:format => 'atom', :page => nil, :key => User.current.rss_key})) %>
|
<%= auto_discovery_link_tag(:atom, params.merge({:format => 'atom', :page => nil, :key => User.current.rss_key})) %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<p class="other-formats">
|
<% other_formats_links do |f| %>
|
||||||
<%= l(:label_export_to) %>
|
<%= f.link_to 'Atom', :url => {:key => User.current.rss_key} %>
|
||||||
<span><%= link_to 'Atom', {:format => 'atom', :key => User.current.rss_key}, :class => 'feed' %></span>
|
<% end %>
|
||||||
</p>
|
|
||||||
|
|
||||||
<% html_title(l(:label_revision_plural)) -%>
|
<% html_title(l(:label_revision_plural)) -%>
|
||||||
|
|
|
@ -22,10 +22,10 @@
|
||||||
<% content_for :header_tags do %>
|
<% content_for :header_tags do %>
|
||||||
<%= auto_discovery_link_tag(:atom, params.merge({:format => 'atom', :action => 'revisions', :id => @project, :page => nil, :key => User.current.rss_key})) %>
|
<%= auto_discovery_link_tag(:atom, params.merge({:format => 'atom', :action => 'revisions', :id => @project, :page => nil, :key => User.current.rss_key})) %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<p class="other-formats">
|
|
||||||
<%= l(:label_export_to) %>
|
<% other_formats_links do |f| %>
|
||||||
<span><%= link_to 'Atom', {:action => 'revisions', :id => @project, :format => 'atom', :key => User.current.rss_key}, :class => 'feed' %></span>
|
<%= f.link_to 'Atom', :url => {:action => 'revisions', :id => @project, :key => User.current.rss_key} %>
|
||||||
</p>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% content_for :header_tags do %>
|
<% content_for :header_tags do %>
|
||||||
|
|
|
@ -22,11 +22,10 @@ already in the URI %>
|
||||||
<%= render :partial => 'list', :locals => { :entries => @entries }%>
|
<%= render :partial => 'list', :locals => { :entries => @entries }%>
|
||||||
<p class="pagination"><%= pagination_links_full @entry_pages, @entry_count %></p>
|
<p class="pagination"><%= pagination_links_full @entry_pages, @entry_count %></p>
|
||||||
|
|
||||||
<p class="other-formats">
|
<% other_formats_links do |f| %>
|
||||||
<%= l(:label_export_to) %>
|
<%= f.link_to 'Atom', :url => params.merge({:issue_id => @issue, :key => User.current.rss_key}) %>
|
||||||
<span><%= link_to 'Atom', {:issue_id => @issue, :format => 'atom', :key => User.current.rss_key}, :class => 'feed' %></span>
|
<%= f.link_to 'CSV', :url => params %>
|
||||||
<span><%= link_to 'CSV', params.merge(:format => 'csv'), :class => 'csv' %></span>
|
<% end %>
|
||||||
</p>
|
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% html_title l(:label_spent_time), l(:label_details) %>
|
<% html_title l(:label_spent_time), l(:label_details) %>
|
||||||
|
|
|
@ -65,10 +65,9 @@
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<p class="other-formats">
|
<% other_formats_links do |f| %>
|
||||||
<%= l(:label_export_to) %>
|
<%= f.link_to 'CSV', :url => params %>
|
||||||
<span><%= link_to 'CSV', params.merge({:format => 'csv'}), :class => 'csv' %></span>
|
<% end %>
|
||||||
</p>
|
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
|
|
@ -42,11 +42,10 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<p class="other-formats">
|
<% other_formats_links do |f| %>
|
||||||
<%= l(:label_export_to) %>
|
<%= f.link_to 'HTML', :url => {:page => @page.title, :version => @content.version} %>
|
||||||
<span><%= link_to 'HTML', {:page => @page.title, :export => 'html', :version => @content.version}, :class => 'html' %></span>
|
<%= f.link_to 'TXT', :url => {:page => @page.title, :version => @content.version} %>
|
||||||
<span><%= link_to 'TXT', {:page => @page.title, :export => 'txt', :version => @content.version}, :class => 'text' %></span>
|
<% end %>
|
||||||
</p>
|
|
||||||
|
|
||||||
<% content_for :header_tags do %>
|
<% content_for :header_tags do %>
|
||||||
<%= stylesheet_link_tag 'scm' %>
|
<%= stylesheet_link_tag 'scm' %>
|
||||||
|
|
|
@ -18,11 +18,10 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% unless @pages.empty? %>
|
<% unless @pages.empty? %>
|
||||||
<p class="other-formats">
|
<% other_formats_links do |f| %>
|
||||||
<%= l(:label_export_to) %>
|
<%= f.link_to 'Atom', :url => {:controller => 'projects', :action => 'activity', :id => @project, :show_wiki_pages => 1, :key => User.current.rss_key} %>
|
||||||
<span><%= link_to 'Atom', {:controller => 'projects', :action => 'activity', :id => @project, :show_wiki_pages => 1, :format => 'atom', :key => User.current.rss_key}, :class => 'feed' %></span>
|
<%= f.link_to 'HTML', :url => {:action => 'special', :page => 'export'} %>
|
||||||
<span><%= link_to 'HTML', {:action => 'special', :page => 'export'}, :class => 'html' %></span>
|
<% end %>
|
||||||
</p>
|
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% content_for :header_tags do %>
|
<% content_for :header_tags do %>
|
||||||
|
|
|
@ -11,11 +11,10 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% unless @pages.empty? %>
|
<% unless @pages.empty? %>
|
||||||
<p class="other-formats">
|
<% other_formats_links do |f| %>
|
||||||
<%= l(:label_export_to) %>
|
<%= f.link_to 'Atom', :url => {:controller => 'projects', :action => 'activity', :id => @project, :show_wiki_pages => 1, :key => User.current.rss_key} %>
|
||||||
<span><%= link_to 'Atom', {:controller => 'projects', :action => 'activity', :id => @project, :show_wiki_pages => 1, :format => 'atom', :key => User.current.rss_key}, :class => 'feed' %></span>
|
<%= f.link_to 'HTML', :url => {:action => 'special', :page => 'export'} %>
|
||||||
<span><%= link_to 'HTML', {:action => 'special', :page => 'export'} %></span>
|
<% end %>
|
||||||
</p>
|
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% content_for :header_tags do %>
|
<% content_for :header_tags do %>
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
# Redmine - project management software
|
||||||
|
# Copyright (C) 2006-2009 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
|
||||||
|
# as published by the Free Software Foundation; either version 2
|
||||||
|
# of the License, or (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
|
module Redmine
|
||||||
|
module Views
|
||||||
|
class OtherFormatsBuilder
|
||||||
|
def initialize(view)
|
||||||
|
@view = view
|
||||||
|
end
|
||||||
|
|
||||||
|
def link_to(name, options={})
|
||||||
|
url = { :format => name.to_s.downcase }.merge(options.delete(:url) || {})
|
||||||
|
caption = options.delete(:caption) || name
|
||||||
|
html_options = { :class => name.to_s.downcase }.merge(options)
|
||||||
|
@view.content_tag('span', @view.link_to(caption, url, html_options))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -307,7 +307,7 @@ div.attachments span.author { font-size: 0.9em; color: #888; }
|
||||||
p.other-formats { text-align: right; font-size:0.9em; color: #666; }
|
p.other-formats { text-align: right; font-size:0.9em; color: #666; }
|
||||||
.other-formats span + span:before { content: "| "; }
|
.other-formats span + span:before { content: "| "; }
|
||||||
|
|
||||||
a.feed { background: url(../images/feed.png) no-repeat 1px 50%; padding: 2px 0px 3px 16px; }
|
a.atom { background: url(../images/feed.png) no-repeat 1px 50%; padding: 2px 0px 3px 16px; }
|
||||||
|
|
||||||
/***** Flash & error messages ****/
|
/***** Flash & error messages ****/
|
||||||
#errorExplanation, div.flash, .nodata, .warning {
|
#errorExplanation, div.flash, .nodata, .warning {
|
||||||
|
|
Loading…
Reference in New Issue