From bbc8d3d76877e27ae7fb41892e2250e6c60c57d1 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Fri, 13 Feb 2009 17:29:49 +0000 Subject: [PATCH] Removes invalid css class on issue details (#2733). git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2461 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/views/issues/show.rhtml | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/app/views/issues/show.rhtml b/app/views/issues/show.rhtml index 8742ce6..2d947d0 100644 --- a/app/views/issues/show.rhtml +++ b/app/views/issues/show.rhtml @@ -23,7 +23,7 @@ <%=l(:field_start_date)%>:<%= format_date(@issue.start_date) %> - <%=l(:field_priority)%>:<%= @issue.priority.name %> + <%=l(:field_priority)%>:<%= @issue.priority.name %> <%=l(:field_due_date)%>:<%= format_date(@issue.due_date) %> -- 1.6.0.2 From f9c9b054babea460fae3bf5341d9720493d9428c Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Fri, 13 Feb 2009 17:59:45 +0000 Subject: [PATCH] Timelog is ignored when updating an issue if user is admin but not a project member (#2717). git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2463 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/controllers/issues_controller.rb | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index fc02794..557347b 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -187,7 +187,7 @@ class IssuesController < ApplicationController if (@time_entry.hours.nil? || @time_entry.valid?) && @issue.save # Log spend time - if current_role.allowed_to?(:log_time) + if User.current.allowed_to?(:log_time, @project) @time_entry.save end if !journal.new_record? -- 1.6.0.2 From 1c2cdedf19feadfce5cddad683604b156105a5cd Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sat, 14 Feb 2009 18:32:11 +0000 Subject: [PATCH] Fixes headings style in html emails (#2739). git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2465 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/views/mailer/layout.text.html.rhtml | 17 ++++++----------- 1 files changed, 6 insertions(+), 11 deletions(-) diff --git a/app/views/mailer/layout.text.html.rhtml b/app/views/mailer/layout.text.html.rhtml index 12fb654..83d9678 100644 --- a/app/views/mailer/layout.text.html.rhtml +++ b/app/views/mailer/layout.text.html.rhtml @@ -6,17 +6,12 @@ body { font-size: 0.8em; color:#484848; } -h1 { - font-family: "Trebuchet MS", Verdana, sans-serif; - font-size: 1.2em; - margin: 0px; -} -a, a:link, a:visited { - color: #2A5685; -} -a:hover, a:active { - color: #c61a1a; -} +h1, h2, h3 { font-family: "Trebuchet MS", Verdana, sans-serif; margin: 0px; } +h1 { font-size: 1.2em; } +h2, h3 { font-size: 1.1em; } +a, a:link, a:visited { color: #2A5685;} +a:hover, a:active { color: #c61a1a; } +a.wiki-anchor { display: none; } hr { width: 100%; height: 1px; -- 1.6.0.2 From d3038eee925001fdb012670681f5564dd61010bf Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sat, 14 Feb 2009 19:06:44 +0000 Subject: [PATCH] Adds an index on watchers table to speed up watched issue filtering. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2466 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- ...090214190337_add_watchers_user_id_type_index.rb | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-) create mode 100644 db/migrate/20090214190337_add_watchers_user_id_type_index.rb diff --git a/db/migrate/20090214190337_add_watchers_user_id_type_index.rb b/db/migrate/20090214190337_add_watchers_user_id_type_index.rb new file mode 100644 index 0000000..7ff4e54 --- /dev/null +++ b/db/migrate/20090214190337_add_watchers_user_id_type_index.rb @@ -0,0 +1,9 @@ +class AddWatchersUserIdTypeIndex < ActiveRecord::Migration + def self.up + add_index :watchers, [:user_id, :watchable_type], :name => :watchers_user_id_type + end + + def self.down + remove_index :watchers, :name => :watchers_user_id_type + end +end -- 1.6.0.2 From d77be4e90869c89dd6716b2b08d6d3f6e3a14ef2 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sun, 15 Feb 2009 08:33:48 +0000 Subject: [PATCH] Removes invalid css class on issue details (#2753). git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2467 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/views/issues/show.rhtml | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/app/views/issues/show.rhtml b/app/views/issues/show.rhtml index 2d947d0..6b79ba8 100644 --- a/app/views/issues/show.rhtml +++ b/app/views/issues/show.rhtml @@ -19,7 +19,7 @@ - + -- 1.6.0.2 From 13e2c727cfa7b3a9e3e9bd0563cda0a15ee3892d Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sun, 15 Feb 2009 09:02:41 +0000 Subject: [PATCH] Updates 0.8.1 CHANGELOG. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2468 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- doc/CHANGELOG | 23 +++++++++++++++++++++-- 1 files changed, 21 insertions(+), 2 deletions(-) diff --git a/doc/CHANGELOG b/doc/CHANGELOG index 31f3165..b1b3e39 100644 --- a/doc/CHANGELOG +++ b/doc/CHANGELOG @@ -1,16 +1,35 @@ == Redmine changelog Redmine - project management software -Copyright (C) 2006-2008 Jean-Philippe Lang +Copyright (C) 2006-2009 Jean-Philippe Lang http://www.redmine.org/ -== v0.8.1 +== 2009-02-15 v0.8.1 * Select watchers on new issue form +* Issue description is no longer a required field * Files module: ability to add files without version +* Jump to the current tab when using the project quick-jump combo +* Display a warning if some attachments were not saved +* Import custom fields values from emails on issue creation * Show view/annotate/download links on entry and annotate views +* Admin Info Screen: Display if plugin assets directory is writable +* Adds a 'Create and continue' button on the new issue form +* IMAP: add options to move received emails +* Do not show Category field when categories are not defined +* Lower the project identifier limit to a minimum of two characters +* Add "closed" html class to closed entries in issue list +* Fixed: broken redirect URL on login failure * Fixed: Deleted files are shown when using Darcs +* Fixed: Darcs adapter works on Win32 only +* Fixed: syntax highlight doesn't appear in new ticket preview +* Fixed: email notification for changes I make still occurs when running Repository.fetch_changesets +* Fixed: no error is raised when entering invalid hours on the issue update form +* Fixed: Details time log report CSV export doesn't honour date format from settings +* Fixed: invalid css classes on issue details +* Fixed: Trac importer creates duplicate custom values +* Fixed: inline attached image should not match partial filename == 2008-12-30 v0.8.0 -- 1.6.0.2 From 4601ed2f3aebc545024287e318494ce32bc5803f Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sun, 15 Feb 2009 13:33:09 +0000 Subject: [PATCH] Replaces Enumeration.get_values and Enumeration.default with named scopes. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2472 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/controllers/documents_controller.rb | 2 +- app/controllers/enumerations_controller.rb | 2 +- app/controllers/issues_controller.rb | 8 ++++---- app/controllers/reports_controller.rb | 4 ++-- app/helpers/timelog_helper.rb | 2 +- app/models/document.rb | 2 +- app/models/enumeration.rb | 26 +++++++++++++++++++------- app/models/issue.rb | 2 +- app/models/time_entry.rb | 2 +- app/views/documents/_form.rhtml | 2 +- app/views/enumerations/list.rhtml | 2 +- app/views/issues/bulk_edit.rhtml | 2 +- lib/tasks/migrate_from_mantis.rake | 2 +- lib/tasks/migrate_from_trac.rake | 2 +- test/functional/issues_controller_test.rb | 4 ++-- test/unit/enumeration_test.rb | 16 ++++++++-------- test/unit/issue_test.rb | 10 +++++----- 17 files changed, 51 insertions(+), 39 deletions(-) diff --git a/app/controllers/documents_controller.rb b/app/controllers/documents_controller.rb index 2d1c414..9656141 100644 --- a/app/controllers/documents_controller.rb +++ b/app/controllers/documents_controller.rb @@ -54,7 +54,7 @@ class DocumentsController < ApplicationController end def edit - @categories = Enumeration::get_values('DCAT') + @categories = Enumeration.document_categories if request.post? and @document.update_attributes(params[:document]) flash[:notice] = l(:notice_successful_update) redirect_to :action => 'show', :id => @document diff --git a/app/controllers/enumerations_controller.rb b/app/controllers/enumerations_controller.rb index 50521ba..6e136fb 100644 --- a/app/controllers/enumerations_controller.rb +++ b/app/controllers/enumerations_controller.rb @@ -85,7 +85,7 @@ class EnumerationsController < ApplicationController redirect_to :action => 'index' end end - @enumerations = Enumeration.get_values(@enumeration.opt) - [@enumeration] + @enumerations = Enumeration.values(@enumeration.opt) - [@enumeration] #rescue # flash[:error] = 'Unable to delete enumeration' # redirect_to :action => 'index' diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index 557347b..5efa1d6 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -100,7 +100,7 @@ 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) - @priorities = Enumeration::get_values('IPRI') + @priorities = Enumeration.priorities @time_entry = TimeEntry.new respond_to do |format| format.html { render :template => 'issues/show.rhtml' } @@ -153,7 +153,7 @@ class IssuesController < ApplicationController return end end - @priorities = Enumeration::get_values('IPRI') + @priorities = Enumeration.priorities render :layout => !request.xhr? end @@ -163,7 +163,7 @@ class IssuesController < ApplicationController def edit @allowed_statuses = @issue.new_statuses_allowed_to(User.current) - @priorities = Enumeration::get_values('IPRI') + @priorities = Enumeration.priorities @edit_allowed = User.current.allowed_to?(:edit_issues, @project) @time_entry = TimeEntry.new @@ -403,7 +403,7 @@ class IssuesController < ApplicationController @assignables << @issue.assigned_to if @issue && @issue.assigned_to && !@assignables.include?(@issue.assigned_to) end - @priorities = Enumeration.get_values('IPRI').reverse + @priorities = Enumeration.priorities.reverse @statuses = IssueStatus.find(:all, :order => 'position') @back = request.env['HTTP_REFERER'] diff --git a/app/controllers/reports_controller.rb b/app/controllers/reports_controller.rb index bfe5157..f459413 100644 --- a/app/controllers/reports_controller.rb +++ b/app/controllers/reports_controller.rb @@ -37,7 +37,7 @@ class ReportsController < ApplicationController render :template => "reports/issue_report_details" when "priority" @field = "priority_id" - @rows = Enumeration::get_values('IPRI') + @rows = Enumeration.priorities @data = issues_by_priority @report_title = l(:field_priority) render :template => "reports/issue_report_details" @@ -68,7 +68,7 @@ class ReportsController < ApplicationController else @trackers = @project.trackers @versions = @project.versions.sort - @priorities = Enumeration::get_values('IPRI') + @priorities = Enumeration.priorities @categories = @project.issue_categories @assignees = @project.members.collect { |m| m.user } @authors = @project.members.collect { |m| m.user } diff --git a/app/helpers/timelog_helper.rb b/app/helpers/timelog_helper.rb index f068b4d..f43bce0 100644 --- a/app/helpers/timelog_helper.rb +++ b/app/helpers/timelog_helper.rb @@ -27,7 +27,7 @@ module TimelogHelper end def activity_collection_for_select_options - activities = Enumeration::get_values('ACTI') + activities = Enumeration.activities collection = [] collection << [ "--- #{l(:actionview_instancetag_blank_option)} ---", '' ] unless activities.detect(&:is_default) activities.each { |a| collection << [a.name, a.id] } diff --git a/app/models/document.rb b/app/models/document.rb index 2ec99fe..f78c15e 100644 --- a/app/models/document.rb +++ b/app/models/document.rb @@ -31,7 +31,7 @@ class Document < ActiveRecord::Base def after_initialize if new_record? - self.category ||= Enumeration.default('DCAT') + self.category ||= Enumeration.document_categories.default end end end diff --git a/app/models/enumeration.rb b/app/models/enumeration.rb index e4b080b..d466940 100644 --- a/app/models/enumeration.rb +++ b/app/models/enumeration.rb @@ -26,17 +26,29 @@ class Enumeration < ActiveRecord::Base # Single table inheritance would be an option OPTIONS = { - "IPRI" => {:label => :enumeration_issue_priorities, :model => Issue, :foreign_key => :priority_id}, - "DCAT" => {:label => :enumeration_doc_categories, :model => Document, :foreign_key => :category_id}, - "ACTI" => {:label => :enumeration_activities, :model => TimeEntry, :foreign_key => :activity_id} + "IPRI" => {:label => :enumeration_issue_priorities, :model => Issue, :foreign_key => :priority_id, :scope => :priorities}, + "DCAT" => {:label => :enumeration_doc_categories, :model => Document, :foreign_key => :category_id, :scope => :document_categories}, + "ACTI" => {:label => :enumeration_activities, :model => TimeEntry, :foreign_key => :activity_id, :scope => :activities} }.freeze - def self.get_values(option) - find(:all, :conditions => {:opt => option}, :order => 'position') + # Creates a named scope for each type of value. The scope has a +default+ method + # that returns the default value, or nil if no value is set as default. + # Example: + # Enumeration.priorities + # Enumeration.priorities.default + OPTIONS.each do |k, v| + next unless v[:scope] + named_scope v[:scope], :conditions => { :opt => k }, :order => 'position' do + def default + find(:first, :conditions => { :is_default => true }) + end + end end - def self.default(option) - find(:first, :conditions => {:opt => option, :is_default => true}, :order => 'position') + named_scope :values, lambda {|opt| { :conditions => { :opt => opt }, :order => 'position' } } do + def default + find(:first, :conditions => { :is_default => true }) + end end def option_name diff --git a/app/models/issue.rb b/app/models/issue.rb index 618c559..46a2870 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -63,7 +63,7 @@ class Issue < ActiveRecord::Base if new_record? # set default values for new records only self.status ||= IssueStatus.default - self.priority ||= Enumeration.default('IPRI') + self.priority ||= Enumeration.priorities.default end end diff --git a/app/models/time_entry.rb b/app/models/time_entry.rb index f10b179..4cb7644 100644 --- a/app/models/time_entry.rb +++ b/app/models/time_entry.rb @@ -37,7 +37,7 @@ class TimeEntry < ActiveRecord::Base def after_initialize if new_record? && self.activity.nil? - if default_activity = Enumeration.default('ACTI') + if default_activity = Enumeration.activities.default self.activity_id = default_activity.id end end diff --git a/app/views/documents/_form.rhtml b/app/views/documents/_form.rhtml index d45e295..12a16f5 100644 --- a/app/views/documents/_form.rhtml +++ b/app/views/documents/_form.rhtml @@ -2,7 +2,7 @@

-<%= select('document', 'category_id', Enumeration.get_values('DCAT').collect {|c| [c.name, c.id]}) %>

+<%= select('document', 'category_id', Enumeration.document_categories.collect {|c| [c.name, c.id]}) %>

<%= text_field 'document', 'title', :size => 60 %>

diff --git a/app/views/enumerations/list.rhtml b/app/views/enumerations/list.rhtml index 7f3886b..c4a9af2 100644 --- a/app/views/enumerations/list.rhtml +++ b/app/views/enumerations/list.rhtml @@ -3,7 +3,7 @@ <% Enumeration::OPTIONS.each do |option, params| %>

<%= l(params[:label]) %>

-<% enumerations = Enumeration.get_values(option) %> +<% enumerations = Enumeration.values(option) %> <% if enumerations.any? %>
<%=l(:field_status)%>:<%= @issue.status.name %><%=l(:field_status)%>:<%= @issue.status.name %> <%=l(:field_start_date)%>:<%= format_date(@issue.start_date) %>
<% enumerations.each do |enumeration| %> diff --git a/app/views/issues/bulk_edit.rhtml b/app/views/issues/bulk_edit.rhtml index acda6a6..2141168 100644 --- a/app/views/issues/bulk_edit.rhtml +++ b/app/views/issues/bulk_edit.rhtml @@ -13,7 +13,7 @@ <%= select_tag('status_id', "" + options_from_collection_for_select(@available_statuses, :id, :name)) %> <% end %> +<%= select_tag('priority_id', "" + options_from_collection_for_select(Enumeration.priorities, :id, :name)) %>