@@ -0,0 +1,31 | |||||
|
1 | # redMine - project management software | |||
|
2 | # Copyright (C) 2006-2008 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 AccessKeys | |||
|
20 | ACCESSKEYS = {:edit => 'e', | |||
|
21 | :preview => 'r', | |||
|
22 | :quick_search => 'f', | |||
|
23 | :search => '4', | |||
|
24 | :new_issue => '7' | |||
|
25 | }.freeze unless const_defined?(:ACCESSKEYS) | |||
|
26 | ||||
|
27 | def self.key_for(action) | |||
|
28 | ACCESSKEYS[action] | |||
|
29 | end | |||
|
30 | end | |||
|
31 | end |
@@ -17,6 +17,8 | |||||
17 |
|
17 | |||
18 | class IssuesController < ApplicationController |
|
18 | class IssuesController < ApplicationController | |
19 | layout 'base' |
|
19 | layout 'base' | |
|
20 | menu_item :new_issue, :only => :new | |||
|
21 | ||||
20 | before_filter :find_issue, :except => [:index, :changes, :preview, :new, :update_form] |
|
22 | before_filter :find_issue, :except => [:index, :changes, :preview, :new, :update_form] | |
21 | before_filter :find_project, :only => [:new, :update_form] |
|
23 | before_filter :find_project, :only => [:new, :update_form] | |
22 | before_filter :authorize, :except => [:index, :changes, :preview, :update_form] |
|
24 | before_filter :authorize, :except => [:index, :changes, :preview, :update_form] |
@@ -162,15 +162,9 module ApplicationHelper | |||||
162 | @html_title += args |
|
162 | @html_title += args | |
163 | end |
|
163 | end | |
164 | end |
|
164 | end | |
165 |
|
||||
166 | ACCESSKEYS = {:edit => 'e', |
|
|||
167 | :preview => 'r', |
|
|||
168 | :quick_search => 'f', |
|
|||
169 | :search => '4', |
|
|||
170 | }.freeze unless const_defined?(:ACCESSKEYS) |
|
|||
171 |
|
165 | |||
172 | def accesskey(s) |
|
166 | def accesskey(s) | |
173 | ACCESSKEYS[s] |
|
167 | Redmine::AccessKeys.key_for s | |
174 | end |
|
168 | end | |
175 |
|
169 | |||
176 | # Formats text according to system settings. |
|
170 | # Formats text according to system settings. |
@@ -188,12 +188,4 module ProjectsHelper | |||||
188 | gc.draw(imgl) |
|
188 | gc.draw(imgl) | |
189 | imgl |
|
189 | imgl | |
190 | end if Object.const_defined?(:Magick) |
|
190 | end if Object.const_defined?(:Magick) | |
191 |
|
||||
192 | def new_issue_selector |
|
|||
193 | trackers = @project.trackers |
|
|||
194 | # can't use form tag inside helper |
|
|||
195 | content_tag('form', |
|
|||
196 | select_tag('tracker_id', '<option></option>' + options_from_collection_for_select(trackers, 'id', 'name'), :onchange => "if (this.value != '') {this.form.submit()}"), |
|
|||
197 | :action => url_for(:controller => 'issues', :action => 'new', :project_id => @project), :method => 'get') |
|
|||
198 | end |
|
|||
199 | end |
|
191 | end |
@@ -1,8 +1,3 | |||||
1 | <% if authorize_for('issues', 'new') && @project.trackers.any? %> |
|
|||
2 | <h3><%= l(:label_issue_new) %></h3> |
|
|||
3 | <%= l(:label_tracker) %>: <%= new_issue_selector %> |
|
|||
4 | <% end %> |
|
|||
5 |
|
||||
6 |
|
|
1 | <h3><%= l(:label_issue_plural) %></h3> | |
7 | <%= link_to l(:label_issue_view_all), { :controller => 'issues', :action => 'index', :project_id => @project, :set_filter => 1 } %><br /> |
|
2 | <%= link_to l(:label_issue_view_all), { :controller => 'issues', :action => 'index', :project_id => @project, :set_filter => 1 } %><br /> | |
8 | <%= link_to l(:field_summary), :controller => 'reports', :action => 'issue_report', :id => @project %><br /> |
|
3 | <%= link_to l(:field_summary), :controller => 'reports', :action => 'issue_report', :id => @project %><br /> |
@@ -56,11 +56,6 | |||||
56 | </div> |
|
56 | </div> | |
57 |
|
57 | |||
58 | <% content_for :sidebar do %> |
|
58 | <% content_for :sidebar do %> | |
59 | <% if authorize_for('issues', 'new') && @project.trackers.any? %> |
|
|||
60 | <h3><%= l(:label_issue_new) %></h3> |
|
|||
61 | <%= l(:label_tracker) %>: <%= new_issue_selector %> |
|
|||
62 | <% end %> |
|
|||
63 |
|
||||
64 | <% planning_links = [] |
|
59 | <% planning_links = [] | |
65 | planning_links << link_to_if_authorized(l(:label_calendar), :action => 'calendar', :id => @project) |
|
60 | planning_links << link_to_if_authorized(l(:label_calendar), :action => 'calendar', :id => @project) | |
66 | planning_links << link_to_if_authorized(l(:label_gantt), :action => 'gantt', :id => @project) |
|
61 | planning_links << link_to_if_authorized(l(:label_gantt), :action => 'gantt', :id => @project) |
@@ -95,6 +95,8 Redmine::MenuManager.map :project_menu do |menu| | |||||
95 | menu.push :activity, { :controller => 'projects', :action => 'activity' }, :caption => :label_activity |
|
95 | menu.push :activity, { :controller => 'projects', :action => 'activity' }, :caption => :label_activity | |
96 | menu.push :roadmap, { :controller => 'projects', :action => 'roadmap' }, :caption => :label_roadmap |
|
96 | menu.push :roadmap, { :controller => 'projects', :action => 'roadmap' }, :caption => :label_roadmap | |
97 | menu.push :issues, { :controller => 'issues', :action => 'index' }, :param => :project_id, :caption => :label_issue_plural |
|
97 | menu.push :issues, { :controller => 'issues', :action => 'index' }, :param => :project_id, :caption => :label_issue_plural | |
|
98 | menu.push :new_issue, { :controller => 'issues', :action => 'new' }, :param => :project_id, :caption => :label_issue_new, | |||
|
99 | :html => { :accesskey => Redmine::AccessKeys.key_for(:new_issue) } | |||
98 | menu.push :news, { :controller => 'news', :action => 'index' }, :param => :project_id, :caption => :label_news_plural |
|
100 | menu.push :news, { :controller => 'news', :action => 'index' }, :param => :project_id, :caption => :label_news_plural | |
99 | menu.push :documents, { :controller => 'documents', :action => 'index' }, :param => :project_id, :caption => :label_document_plural |
|
101 | menu.push :documents, { :controller => 'documents', :action => 'index' }, :param => :project_id, :caption => :label_document_plural | |
100 | menu.push :wiki, { :controller => 'wiki', :action => 'index', :page => nil }, |
|
102 | menu.push :wiki, { :controller => 'wiki', :action => 'index', :page => nil }, |
@@ -68,7 +68,7 module Redmine | |||||
68 | unless item.condition && !item.condition.call(project) |
|
68 | unless item.condition && !item.condition.call(project) | |
69 | links << content_tag('li', |
|
69 | links << content_tag('li', | |
70 | link_to(l(item.caption), {item.param => project}.merge(item.url), |
|
70 | link_to(l(item.caption), {item.param => project}.merge(item.url), | |
71 |
|
|
71 | (current_menu_item == item.name ? item.html_options.merge(:class => 'selected') : item.html_options))) | |
72 | end |
|
72 | end | |
73 | end if project && !project.new_record? |
|
73 | end if project && !project.new_record? | |
74 | links.empty? ? nil : content_tag('ul', links.join("\n")) |
|
74 | links.empty? ? nil : content_tag('ul', links.join("\n")) | |
@@ -94,6 +94,11 module Redmine | |||||
94 | end |
|
94 | end | |
95 |
|
95 | |||
96 | class Mapper |
|
96 | class Mapper | |
|
97 | # Adds an item at the end of the menu. Available options: | |||
|
98 | # * param: the parameter name that is used for the project id (default is :id) | |||
|
99 | # * condition: a proc that is called before rendering the item, the item is displayed only if it returns true | |||
|
100 | # * caption: the localized string key that is used as the item label | |||
|
101 | # * html_options: a hash of html options that are passed to link_to | |||
97 | def push(name, url, options={}) |
|
102 | def push(name, url, options={}) | |
98 | @items ||= [] |
|
103 | @items ||= [] | |
99 | @items << MenuItem.new(name, url, options) |
|
104 | @items << MenuItem.new(name, url, options) | |
@@ -105,7 +110,7 module Redmine | |||||
105 | end |
|
110 | end | |
106 |
|
111 | |||
107 | class MenuItem |
|
112 | class MenuItem | |
108 | attr_reader :name, :url, :param, :condition, :caption |
|
113 | attr_reader :name, :url, :param, :condition, :caption, :html_options | |
109 |
|
114 | |||
110 | def initialize(name, url, options) |
|
115 | def initialize(name, url, options) | |
111 | @name = name |
|
116 | @name = name | |
@@ -113,6 +118,7 module Redmine | |||||
113 | @condition = options[:if] |
|
118 | @condition = options[:if] | |
114 | @param = options[:param] || :id |
|
119 | @param = options[:param] || :id | |
115 | @caption = options[:caption] || name.to_s.humanize |
|
120 | @caption = options[:caption] || name.to_s.humanize | |
|
121 | @html_options = options[:html] || {} | |||
116 | end |
|
122 | end | |
117 | end |
|
123 | end | |
118 | end |
|
124 | end |
@@ -17,7 +17,7 h4, .wiki h3 {font-size: 12px;padding: 2px 10px 1px 0px;margin-bottom: 5px; bord | |||||
17 | #header a {color:#f8f8f8;} |
|
17 | #header a {color:#f8f8f8;} | |
18 | #quick-search {float:right;} |
|
18 | #quick-search {float:right;} | |
19 |
|
19 | |||
20 | #main-menu {position: absolute; bottom: 0px; left:6px;} |
|
20 | #main-menu {position: absolute; bottom: 0px; left:6px; margin-right: -500px;} | |
21 | #main-menu ul {margin: 0; padding: 0;} |
|
21 | #main-menu ul {margin: 0; padding: 0;} | |
22 | #main-menu li { |
|
22 | #main-menu li { | |
23 | float:left; |
|
23 | float:left; |
General Comments 0
You need to be logged in to leave comments.
Login now