##// END OF EJS Templates
Don't generate urls with params....
Jean-Philippe Lang -
r15250:f4e7765e0101
parent child
Show More
@@ -1,81 +1,89
1 1 # encoding: utf-8
2 2 #
3 3 # Redmine - project management software
4 4 # Copyright (C) 2006-2016 Jean-Philippe Lang
5 5 #
6 6 # This program is free software; you can redistribute it and/or
7 7 # modify it under the terms of the GNU General Public License
8 8 # as published by the Free Software Foundation; either version 2
9 9 # of the License, or (at your option) any later version.
10 10 #
11 11 # This program is distributed in the hope that it will be useful,
12 12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 14 # GNU General Public License for more details.
15 15 #
16 16 # You should have received a copy of the GNU General Public License
17 17 # along with this program; if not, write to the Free Software
18 18 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 19
20 20 module RoutesHelper
21 21
22 22 # Returns the path to project issues or to the cross-project
23 23 # issue list if project is nil
24 24 def _project_issues_path(project, *args)
25 25 if project
26 26 project_issues_path(project, *args)
27 27 else
28 28 issues_path(*args)
29 29 end
30 30 end
31 31
32 def _project_news_path(project, *args)
33 if project
34 project_news_index_path(project, *args)
35 else
36 news_index_path(*args)
37 end
38 end
39
32 40 def _new_project_issue_path(project, *args)
33 41 if project
34 42 new_project_issue_path(project, *args)
35 43 else
36 44 new_issue_path(*args)
37 45 end
38 46 end
39 47
40 48 def _project_calendar_path(project, *args)
41 49 project ? project_calendar_path(project, *args) : issues_calendar_path(*args)
42 50 end
43 51
44 52 def _project_gantt_path(project, *args)
45 53 project ? project_gantt_path(project, *args) : issues_gantt_path(*args)
46 54 end
47 55
48 56 def _time_entries_path(project, issue, *args)
49 57 if issue
50 58 issue_time_entries_path(issue, *args)
51 59 elsif project
52 60 project_time_entries_path(project, *args)
53 61 else
54 62 time_entries_path(*args)
55 63 end
56 64 end
57 65
58 66 def _report_time_entries_path(project, issue, *args)
59 67 if issue
60 68 report_issue_time_entries_path(issue, *args)
61 69 elsif project
62 70 report_project_time_entries_path(project, *args)
63 71 else
64 72 report_time_entries_path(*args)
65 73 end
66 74 end
67 75
68 76 def _new_time_entry_path(project, issue, *args)
69 77 if issue
70 78 new_issue_time_entry_path(issue, *args)
71 79 elsif project
72 80 new_project_time_entry_path(project, *args)
73 81 else
74 82 new_time_entry_path(*args)
75 83 end
76 84 end
77 85
78 86 def board_path(board, *args)
79 87 project_board_path(board.project, board, *args)
80 88 end
81 89 end
@@ -1,72 +1,72
1 1 <h2><%= @author.nil? ? l(:label_activity) : l(:label_user_activity, link_to_user(@author)).html_safe %></h2>
2 2 <p class="subtitle"><%= l(:label_date_from_to, :start => format_date(@date_to - @days), :end => format_date(@date_to-1)) %></p>
3 3
4 4 <div id="activity">
5 5 <% @events_by_day.keys.sort.reverse.each do |day| %>
6 6 <h3><%= format_activity_day(day) %></h3>
7 7 <dl>
8 8 <% sort_activity_events(@events_by_day[day]).each do |e, in_group| -%>
9 9 <dt class="<%= e.event_type %> <%= "grouped" if in_group %> <%= User.current.logged? && e.respond_to?(:event_author) && User.current == e.event_author ? 'me' : nil %>">
10 10 <%= avatar(e.event_author, :size => "24") if e.respond_to?(:event_author) %>
11 11 <span class="time"><%= format_time(e.event_datetime, false) %></span>
12 12 <%= content_tag('span', e.project, :class => 'project') if @project.nil? || @project != e.project %>
13 13 <%= link_to format_activity_title(e.event_title), e.event_url %>
14 14 </dt>
15 15 <dd class="<%= "grouped" if in_group %>"><span class="description"><%= format_activity_description(e.event_description) %></span>
16 16 <span class="author"><%= link_to_user(e.event_author) if e.respond_to?(:event_author) %></span></dd>
17 17 <% end -%>
18 18 </dl>
19 19 <% end -%>
20 20 </div>
21 21
22 22 <%= content_tag('p', l(:label_no_data), :class => 'nodata') if @events_by_day.empty? %>
23 23
24 24 <span class="pagination">
25 25 <ul class="pages">
26 26 <li class="previous page">
27 27 <%= link_to("\xc2\xab " + l(:label_previous),
28 28 {:params => request.query_parameters.merge(:from => @date_to - @days - 1)},
29 29 :title => l(:label_date_from_to, :start => format_date(@date_to - 2*@days), :end => format_date(@date_to - @days - 1)),
30 30 :accesskey => accesskey(:previous)) %>
31 31 </li><% unless @date_to >= User.current.today %><li class="next page">
32 32 <%= link_to(l(:label_next) + " \xc2\xbb",
33 33 {:params => request.query_parameters.merge(:from => @date_to + @days - 1)},
34 34 :title => l(:label_date_from_to, :start => format_date(@date_to), :end => format_date(@date_to + @days - 1)),
35 35 :accesskey => accesskey(:next)) %><% end %>
36 36 </li>
37 37 </ul>
38 38 </span>
39 39 &nbsp;
40 40 <% other_formats_links do |f| %>
41 41 <%= f.link_to_with_query_parameters 'Atom', 'from' => nil, :key => User.current.rss_key %>
42 42 <% end %>
43 43
44 44 <% content_for :header_tags do %>
45 <%= auto_discovery_link_tag(:atom, params.merge(:format => 'atom', :from => nil, :key => User.current.rss_key)) %>
45 <%= auto_discovery_link_tag(:atom, :params => request.query_parameters.merge(:from => nil, :key => User.current.rss_key), :format => 'atom') %>
46 46 <% end %>
47 47
48 48 <% content_for :sidebar do %>
49 49 <%= form_tag({}, :method => :get) do %>
50 50 <h3><%= l(:label_activity) %></h3>
51 51 <ul>
52 52 <% @activity.event_types.each do |t| %>
53 53 <li>
54 54 <%= check_box_tag "show_#{t}", 1, @activity.scope.include?(t) %>
55 55 <label for="show_<%=t%>">
56 56 <%= link_to(l("label_#{t.singularize}_plural"),
57 57 {"show_#{t}" => 1, :user_id => params[:user_id], :from => params[:from]})%>
58 58 </label>
59 59 </li>
60 60 <% end %>
61 61 </ul>
62 62 <% if @project && @project.descendants.active.any? %>
63 63 <%= hidden_field_tag 'with_subprojects', 0, :id => nil %>
64 64 <p><label><%= check_box_tag 'with_subprojects', 1, @with_subprojects %> <%=l(:label_subproject_plural)%></label></p>
65 65 <% end %>
66 66 <%= hidden_field_tag('user_id', params[:user_id]) unless params[:user_id].blank? %>
67 67 <%= hidden_field_tag('from', params[:from]) unless params[:from].blank? %>
68 68 <p><%= submit_tag l(:button_apply), :class => 'button-small', :name => 'submit' %></p>
69 69 <% end %>
70 70 <% end %>
71 71
72 72 <% html_title(l(:label_activity), @author) -%>
@@ -1,32 +1,32
1 1 xml.instruct!
2 2 xml.feed "xmlns" => "http://www.w3.org/2005/Atom" do
3 3 xml.title truncate_single_line_raw(@title, 100)
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))
4 xml.link "rel" => "self", "href" => url_for(:params => request.query_parameters, :only_path => false, :format => 'atom')
5 xml.link "rel" => "alternate", "href" => url_for(:params => request.query_parameters.merge(:format => nil, :key => nil), :only_path => false)
6 6 xml.id home_url
7 7 xml.icon favicon_url
8 8 xml.updated((@items.first ? @items.first.event_datetime : Time.now).xmlschema)
9 9 xml.author { xml.name "#{Setting.app_title}" }
10 10 xml.generator(:uri => Redmine::Info.url) { xml.text! Redmine::Info.app_name; }
11 11 @items.each do |item|
12 12 xml.entry do
13 13 url = url_for(item.event_url(:only_path => false))
14 14 if @project
15 15 xml.title truncate_single_line_raw(item.event_title, 100)
16 16 else
17 17 xml.title truncate_single_line_raw("#{item.project} - #{item.event_title}", 100)
18 18 end
19 19 xml.link "rel" => "alternate", "href" => url
20 20 xml.id url
21 21 xml.updated item.event_datetime.xmlschema
22 22 author = item.event_author if item.respond_to?(:event_author)
23 23 xml.author do
24 24 xml.name(author)
25 25 xml.email(author.mail) if author.is_a?(User) && !author.mail.blank? && !author.pref.hide_mail
26 26 end if author
27 27 xml.content "type" => "html" do
28 28 xml.text! textilizable(item, :event_description, :only_path => false)
29 29 end
30 30 end
31 31 end
32 32 end
@@ -1,51 +1,51
1 1 <div class="contextual">
2 2 <%= link_to(l(:label_news_new),
3 3 new_project_news_path(@project),
4 4 :class => 'icon icon-add',
5 5 :onclick => 'showAndScrollTo("add-news", "news_title"); return false;') if @project && User.current.allowed_to?(:manage_news, @project) %>
6 6 <%= watcher_link(@project.enabled_module('news'), User.current) if @project && User.current.logged? %>
7 7 </div>
8 8
9 9 <div id="add-news" style="display:none;">
10 10 <h2><%=l(:label_news_new)%></h2>
11 11 <%= labelled_form_for @news, :url => project_news_index_path(@project),
12 12 :html => { :id => 'news-form', :multipart => true } do |f| %>
13 13 <%= render :partial => 'news/form', :locals => { :f => f } %>
14 14 <%= submit_tag l(:button_create) %>
15 15 <%= preview_link preview_news_path(:project_id => @project), 'news-form' %> |
16 16 <%= link_to l(:button_cancel), "#", :onclick => '$("#add-news").hide()' %>
17 17 <% end if @project %>
18 18 <div id="preview" class="wiki"></div>
19 19 </div>
20 20
21 21 <h2><%=l(:label_news_plural)%></h2>
22 22
23 23 <% if @newss.empty? %>
24 24 <p class="nodata"><%= l(:label_no_data) %></p>
25 25 <% else %>
26 26 <% @newss.each do |news| %>
27 27 <article class="news-article">
28 28 <header>
29 29 <h3><%= avatar(news.author, :size => "24") %><%= link_to_project(news.project) + ': ' unless news.project == @project %>
30 30 <%= link_to h(news.title), news_path(news) %>
31 31 <%= "(#{l(:label_x_comments, :count => news.comments_count)})" if news.comments_count > 0 %></h3>
32 32 <p class="author"><%= authoring news.created_on, news.author %></p>
33 33 </header>
34 34 <div class="wiki">
35 35 <%= textilizable(news, :description) %>
36 36 </div>
37 37 </article>
38 38 <% end %>
39 39 <% end %>
40 40 <span class="pagination"><%= pagination_links_full @news_pages %></span>
41 41
42 42 <% other_formats_links do |f| %>
43 43 <%= f.link_to 'Atom', :url => {:project_id => @project, :key => User.current.rss_key} %>
44 44 <% end %>
45 45
46 46 <% content_for :header_tags do %>
47 <%= auto_discovery_link_tag(:atom, params.merge({:format => 'atom', :page => nil, :key => User.current.rss_key})) %>
47 <%= auto_discovery_link_tag(:atom, _project_news_path(@project, :key => User.current.rss_key, :format => 'atom')) %>
48 48 <%= stylesheet_link_tag 'scm' %>
49 49 <% end %>
50 50
51 51 <% html_title(l(:label_news_plural)) -%>
@@ -1,21 +1,25
1 1 <%= call_hook(:view_repositories_show_contextual, { :repository => @repository, :project => @project }) %>
2 2
3 3 <div class="contextual">
4 4 <%= render :partial => 'navigation' %>
5 5 </div>
6 6
7 7 <h2><%= render :partial => 'breadcrumbs', :locals => { :path => @path, :kind => 'file', :revision => @rev } %></h2>
8 8
9 9 <%= render :partial => 'link_to_functions' %>
10 10
11 11 <% if Redmine::MimeType.is_type?('image', @path) %>
12 <%= render :partial => 'common/image', :locals => {:path => url_for(params.merge(:action => 'raw')), :alt => @path} %>
12 <%= render :partial => 'common/image', :locals => {:path => url_for(:action => 'raw',
13 :id => @project,
14 :repository_id => @repository.identifier_param,
15 :path => @path,
16 :rev => @rev), :alt => @path} %>
13 17 <% elsif @content %>
14 18 <%= render :partial => 'common/file', :locals => {:filename => @path, :content => @content} %>
15 19 <% else %>
16 20 <%= render :partial => 'common/other' %>
17 21 <% end %>
18 22
19 23 <% content_for :header_tags do %>
20 24 <%= stylesheet_link_tag "scm" %>
21 25 <% end %>
@@ -1,34 +1,34
1 1 <div class="contextual">
2 2 <%= form_tag(
3 3 {:controller => 'repositories', :action => 'revision', :id => @project,
4 4 :repository_id => @repository.identifier_param},
5 5 :method => :get
6 6 ) do %>
7 7 <%= l(:label_revision) %>: <%= text_field_tag 'rev', nil, :size => 8 %>
8 8 <%= submit_tag 'OK' %>
9 9 <% end %>
10 10 </div>
11 11
12 12 <h2><%= l(:label_revision_plural) %></h2>
13 13
14 14 <%= render :partial => 'revisions',
15 15 :locals => {:project => @project,
16 16 :path => '',
17 17 :revisions => @changesets,
18 18 :entry => nil } %>
19 19
20 20 <span class="pagination"><%= pagination_links_full @changeset_pages,@changeset_count %></span>
21 21
22 22 <% content_for :header_tags do %>
23 23 <%= stylesheet_link_tag "scm" %>
24 24 <%= auto_discovery_link_tag(
25 25 :atom,
26 params.merge(
27 {:format => 'atom', :page => nil, :key => User.current.rss_key})) %>
26 :params => request.query_parameters.merge(:page => nil, :key => User.current.rss_key),
27 :format => 'atom') %>
28 28 <% end %>
29 29
30 30 <% other_formats_links do |f| %>
31 31 <%= f.link_to 'Atom', :url => {:key => User.current.rss_key} %>
32 32 <% end %>
33 33
34 34 <% html_title(l(:label_revision_plural)) -%>
@@ -1,77 +1,78
1 1 <%= call_hook(:view_repositories_show_contextual, { :repository => @repository, :project => @project }) %>
2 2
3 3 <div class="contextual">
4 4 <%= render :partial => 'navigation' %>
5 5 </div>
6 6
7 7 <h2><%= render :partial => 'breadcrumbs',
8 8 :locals => { :path => @path, :kind => 'dir', :revision => @rev } %></h2>
9 9
10 10 <% if !@entries.nil? && authorize_for('repositories', 'browse') %>
11 11 <%= render :partial => 'dir_list' %>
12 12 <% end %>
13 13
14 14 <%= render_properties(@properties) %>
15 15
16 16 <% if authorize_for('repositories', 'revisions') %>
17 17 <% if @changesets && !@changesets.empty? %>
18 18 <h3><%= l(:label_latest_revision_plural) %></h3>
19 19 <%= render :partial => 'revisions',
20 20 :locals => {:project => @project, :path => @path,
21 21 :revisions => @changesets, :entry => nil }%>
22 22 <% end %>
23 23 <p>
24 24 <% has_branches = (!@repository.branches.nil? && @repository.branches.length > 0)
25 25 sep = '' %>
26 26 <% if @repository.supports_all_revisions? && @path.blank? %>
27 27 <%= link_to l(:label_view_all_revisions), :action => 'revisions', :id => @project,
28 28 :repository_id => @repository.identifier_param %>
29 29 <% sep = '|' %>
30 30 <% end %>
31 31 <% if @repository.supports_directory_revisions? &&
32 32 ( has_branches || !@path.blank? || !@rev.blank? ) %>
33 33 <%= sep %>
34 34 <%= link_to l(:label_view_revisions),
35 35 :action => 'changes',
36 36 :path => to_path_param(@path),
37 37 :id => @project,
38 38 :repository_id => @repository.identifier_param,
39 39 :rev => @rev %>
40 40 <% end %>
41 41 </p>
42 42 <% if @repository.supports_all_revisions? %>
43 43 <% content_for :header_tags do %>
44 44 <%= auto_discovery_link_tag(
45 :atom, params.merge(
46 {:format => 'atom', :action => 'revisions',
47 :id => @project, :page => nil, :key => User.current.rss_key})) %>
45 :atom,
46 :action => 'revisions', :id => @project,
47 :repository_id => @repository.identifier_param,
48 :key => User.current.rss_key) %>
48 49 <% end %>
49 50
50 51 <% other_formats_links do |f| %>
51 52 <%= f.link_to 'Atom',
52 53 :url => {:action => 'revisions', :id => @project,
53 54 :repository_id => @repository.identifier_param,
54 55 :key => User.current.rss_key} %>
55 56 <% end %>
56 57 <% end %>
57 58 <% end %>
58 59
59 60 <% if @repositories.size > 1 %>
60 61 <% content_for :sidebar do %>
61 62 <h3><%= l(:label_repository_plural) %></h3>
62 63 <p>
63 64 <%= @repositories.sort.collect {|repo|
64 65 link_to repo.name,
65 66 {:controller => 'repositories', :action => 'show',
66 67 :id => @project, :repository_id => repo.identifier_param, :rev => nil, :path => nil},
67 68 :class => 'repository' + (repo == @repository ? ' selected' : '')
68 69 }.join('<br />').html_safe %>
69 70 </p>
70 71 <% end %>
71 72 <% end %>
72 73
73 74 <% content_for :header_tags do %>
74 75 <%= stylesheet_link_tag "scm" %>
75 76 <% end %>
76 77
77 78 <% html_title(l(:label_repository)) -%>
General Comments 0
You need to be logged in to leave comments. Login now