@@ -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 | 18 | class IssuesController < ApplicationController |
|
19 | 19 | layout 'base' |
|
20 | menu_item :new_issue, :only => :new | |
|
21 | ||
|
20 | 22 | before_filter :find_issue, :except => [:index, :changes, :preview, :new, :update_form] |
|
21 | 23 | before_filter :find_project, :only => [:new, :update_form] |
|
22 | 24 | before_filter :authorize, :except => [:index, :changes, :preview, :update_form] |
@@ -162,15 +162,9 module ApplicationHelper | |||
|
162 | 162 | @html_title += args |
|
163 | 163 | end |
|
164 | 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 | 166 | def accesskey(s) |
|
173 | ACCESSKEYS[s] | |
|
167 | Redmine::AccessKeys.key_for s | |
|
174 | 168 | end |
|
175 | 169 | |
|
176 | 170 | # Formats text according to system settings. |
@@ -188,12 +188,4 module ProjectsHelper | |||
|
188 | 188 | gc.draw(imgl) |
|
189 | 189 | imgl |
|
190 | 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 | 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 |
|
|
7 | 2 | <%= link_to l(:label_issue_view_all), { :controller => 'issues', :action => 'index', :project_id => @project, :set_filter => 1 } %><br /> |
|
8 | 3 | <%= link_to l(:field_summary), :controller => 'reports', :action => 'issue_report', :id => @project %><br /> |
@@ -56,11 +56,6 | |||
|
56 | 56 | </div> |
|
57 | 57 | |
|
58 | 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 | 59 | <% planning_links = [] |
|
65 | 60 | planning_links << link_to_if_authorized(l(:label_calendar), :action => 'calendar', :id => @project) |
|
66 | 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 | 95 | menu.push :activity, { :controller => 'projects', :action => 'activity' }, :caption => :label_activity |
|
96 | 96 | menu.push :roadmap, { :controller => 'projects', :action => 'roadmap' }, :caption => :label_roadmap |
|
97 | 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 | 100 | menu.push :news, { :controller => 'news', :action => 'index' }, :param => :project_id, :caption => :label_news_plural |
|
99 | 101 | menu.push :documents, { :controller => 'documents', :action => 'index' }, :param => :project_id, :caption => :label_document_plural |
|
100 | 102 | menu.push :wiki, { :controller => 'wiki', :action => 'index', :page => nil }, |
@@ -68,7 +68,7 module Redmine | |||
|
68 | 68 | unless item.condition && !item.condition.call(project) |
|
69 | 69 | links << content_tag('li', |
|
70 | 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 | 72 | end |
|
73 | 73 | end if project && !project.new_record? |
|
74 | 74 | links.empty? ? nil : content_tag('ul', links.join("\n")) |
@@ -94,6 +94,11 module Redmine | |||
|
94 | 94 | end |
|
95 | 95 | |
|
96 | 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 | 102 | def push(name, url, options={}) |
|
98 | 103 | @items ||= [] |
|
99 | 104 | @items << MenuItem.new(name, url, options) |
@@ -105,7 +110,7 module Redmine | |||
|
105 | 110 | end |
|
106 | 111 | |
|
107 | 112 | class MenuItem |
|
108 | attr_reader :name, :url, :param, :condition, :caption | |
|
113 | attr_reader :name, :url, :param, :condition, :caption, :html_options | |
|
109 | 114 | |
|
110 | 115 | def initialize(name, url, options) |
|
111 | 116 | @name = name |
@@ -113,6 +118,7 module Redmine | |||
|
113 | 118 | @condition = options[:if] |
|
114 | 119 | @param = options[:param] || :id |
|
115 | 120 | @caption = options[:caption] || name.to_s.humanize |
|
121 | @html_options = options[:html] || {} | |
|
116 | 122 | end |
|
117 | 123 | end |
|
118 | 124 | end |
@@ -17,7 +17,7 h4, .wiki h3 {font-size: 12px;padding: 2px 10px 1px 0px;margin-bottom: 5px; bord | |||
|
17 | 17 | #header a {color:#f8f8f8;} |
|
18 | 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 | 21 | #main-menu ul {margin: 0; padding: 0;} |
|
22 | 22 | #main-menu li { |
|
23 | 23 | float:left; |
General Comments 0
You need to be logged in to leave comments.
Login now