summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2008-06-29 12:01:20 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2008-06-29 12:01:20 +0000
commit1424b0f215082fff57d840dc715f5875bea45ef0 (patch)
tree1b0ee883e614f65c3f74f265ccb54b9992f8e970
parent94cf4f258ff61bac4708c9a8dcba5c50b8adcf94 (diff)
downloadredmine-1424b0f215082fff57d840dc715f5875bea45ef0.tar.gz
redmine-1424b0f215082fff57d840dc715f5875bea45ef0.zip
Addq "please select" to activity select box if no activity is set as default (#937).
git-svn-id: http://redmine.rubyforge.org/svn/trunk@1602 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r--app/controllers/issues_controller.rb3
-rw-r--r--app/controllers/timelog_controller.rb1
-rw-r--r--app/helpers/timelog_helper.rb8
-rw-r--r--app/views/issues/_edit.rhtml2
-rw-r--r--app/views/timelog/edit.rhtml2
5 files changed, 11 insertions, 5 deletions
diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb
index 49b443238..5bc65d2e4 100644
--- a/app/controllers/issues_controller.rb
+++ b/app/controllers/issues_controller.rb
@@ -43,6 +43,7 @@ class IssuesController < ApplicationController
helper :sort
include SortHelper
include IssuesHelper
+ helper :timelog
def index
sort_init "#{Issue.table_name}.id", "desc"
@@ -99,7 +100,6 @@ class IssuesController < ApplicationController
@journals.reverse! if User.current.wants_comments_in_reverse_order?
@allowed_statuses = @issue.new_statuses_allowed_to(User.current)
@edit_allowed = User.current.allowed_to?(:edit_issues, @project)
- @activities = Enumeration::get_values('ACTI')
@priorities = Enumeration::get_values('IPRI')
@time_entry = TimeEntry.new
respond_to do |format|
@@ -157,7 +157,6 @@ class IssuesController < ApplicationController
def edit
@allowed_statuses = @issue.new_statuses_allowed_to(User.current)
- @activities = Enumeration::get_values('ACTI')
@priorities = Enumeration::get_values('IPRI')
@edit_allowed = User.current.allowed_to?(:edit_issues, @project)
diff --git a/app/controllers/timelog_controller.rb b/app/controllers/timelog_controller.rb
index cf1c844df..9f539d459 100644
--- a/app/controllers/timelog_controller.rb
+++ b/app/controllers/timelog_controller.rb
@@ -183,7 +183,6 @@ class TimelogController < ApplicationController
redirect_to(params[:back_url].blank? ? {:action => 'details', :project_id => @time_entry.project} : params[:back_url])
return
end
- @activities = Enumeration::get_values('ACTI')
end
def destroy
diff --git a/app/helpers/timelog_helper.rb b/app/helpers/timelog_helper.rb
index 7fd70e744..2c1ae5285 100644
--- a/app/helpers/timelog_helper.rb
+++ b/app/helpers/timelog_helper.rb
@@ -16,6 +16,14 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
module TimelogHelper
+ def activity_collection_for_select_options
+ activities = Enumeration::get_values('ACTI')
+ collection = []
+ collection << [ "--- #{l(:actionview_instancetag_blank_option)} ---", '' ] unless activities.detect(&:is_default)
+ activities.each { |a| collection << [a.name, a.id] }
+ collection
+ end
+
def select_hours(data, criteria, value)
data.select {|row| row[criteria] == value}
end
diff --git a/app/views/issues/_edit.rhtml b/app/views/issues/_edit.rhtml
index 49f198a63..914f7b9c4 100644
--- a/app/views/issues/_edit.rhtml
+++ b/app/views/issues/_edit.rhtml
@@ -21,7 +21,7 @@
<p><%= time_entry.text_field :hours, :size => 6, :label => :label_spent_time %> <%= l(:field_hours) %></p>
</div>
<div class="splitcontentright">
- <p><%= time_entry.select :activity_id, (@activities.collect {|p| [p.name, p.id]}) %></p>
+ <p><%= time_entry.select :activity_id, activity_collection_for_select_options %></p>
</div>
<p><%= time_entry.text_field :comments, :size => 60 %></p>
<% end %>
diff --git a/app/views/timelog/edit.rhtml b/app/views/timelog/edit.rhtml
index f9dae8a99..7e8cc4591 100644
--- a/app/views/timelog/edit.rhtml
+++ b/app/views/timelog/edit.rhtml
@@ -9,7 +9,7 @@
<p><%= f.text_field :spent_on, :size => 10, :required => true %><%= calendar_for('time_entry_spent_on') %></p>
<p><%= f.text_field :hours, :size => 6, :required => true %></p>
<p><%= f.text_field :comments, :size => 100 %></p>
-<p><%= f.select :activity_id, (@activities.collect {|p| [p.name, p.id]}), :required => true %></p>
+<p><%= f.select :activity_id, activity_collection_for_select_options, :required => true %></p>
</div>
<%= submit_tag l(:button_save) %>