From ab83ed5d8eb9c07f53a5ba3a285d552f8eb34c42 Mon Sep 17 00:00:00 2001 From: Nicolas Chuche Date: Wed, 20 Aug 2008 18:37:09 +0000 Subject: [PATCH] r18452@gaspard (orig r1723): jplang | 2008-08-07 21:59:02 +0200 Slight change to engines to let plugins override views. r18456@gaspard (orig r1727): jplang | 2008-08-10 17:22:54 +0200 Moves @layout 'base'@ to ApplicationController. r18457@gaspard (orig r1728): jplang | 2008-08-10 23:35:03 +0200 Quote ids for attachment association since Trac's attachment.id is varchar (#1759). r18458@gaspard (orig r1729): jplang | 2008-08-11 00:18:23 +0200 Adds links to forum messages using message#id syntax (#1756). r18459@gaspard (orig r1730): jplang | 2008-08-11 20:09:54 +0200 Allow same name for custom fields on different object types. r18460@gaspard (orig r1731): jplang | 2008-08-11 20:24:39 +0200 Fixes custom fields display order at several places (#1768). r18461@gaspard (orig r1732): edavis10 | 2008-08-11 22:49:52 +0200 Added doc/README_FOR_APP so RDoc can be built. (#1769) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit r18462@gaspard (orig r1733): jplang | 2008-08-11 22:55:17 +0200 Adds 'Edit' link on account/show for admin users. r18463@gaspard (orig r1734): jplang | 2008-08-11 23:02:36 +0200 Adds Lock/Unlock/Activate link on user edit screen. r18464@gaspard (orig r1735): jplang | 2008-08-11 23:10:24 +0200 Adds user count in status drop down on admin user list. r18472@gaspard (orig r1743): edavis10 | 2008-08-13 05:54:54 +0200 Added missing documentation for setting up the Darcs test repository. r18473@gaspard (orig r1744): edavis10 | 2008-08-13 06:20:16 +0200 Added rake tasks to generate rcov code coverage reports. rake -T test:coverage to see them all r18474@gaspard (orig r1745): edavis10 | 2008-08-13 06:20:23 +0200 Extracted rcov options and removed gems from the rcov report. r18476@gaspard (orig r1747): jplang | 2008-08-15 20:44:46 +0200 No warning about rcov each time a rake task is ran. r18477@gaspard (orig r1748): edavis10 | 2008-08-20 06:26:46 +0200 Javascripts are now cached into a single file for downloads in production mode. Thanks to Philippe Lafoucrière for the patch. (#1186) r18478@gaspard (orig r1749): edavis10 | 2008-08-20 07:09:13 +0200 Hiding the View Differences button when a wiki page's history only has one version. Patch contributed by Chaoqun Zou (#1743) r18479@gaspard (orig r1750): edavis10 | 2008-08-20 08:14:44 +0200 Messages on a Board can now be sorted by the number of replies. #1761 r18480@gaspard (orig r1751): edavis10 | 2008-08-20 08:21:06 +0200 Added the "Status:" keyword to the MailHandler for setting and changing an Issue status via email. #1669 git-svn-id: http://redmine.rubyforge.org/svn/branches/work@1752 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- hooks/app/controllers/account_controller.rb | 3 +- hooks/app/controllers/admin_controller.rb | 1 - hooks/app/controllers/application.rb | 2 + .../app/controllers/attachments_controller.rb | 1 - .../controllers/auth_sources_controller.rb | 1 - hooks/app/controllers/boards_controller.rb | 1 - .../controllers/custom_fields_controller.rb | 1 - hooks/app/controllers/documents_controller.rb | 1 - .../controllers/enumerations_controller.rb | 1 - .../issue_categories_controller.rb | 1 - .../controllers/issue_relations_controller.rb | 1 - .../controllers/issue_statuses_controller.rb | 1 - hooks/app/controllers/issues_controller.rb | 1 - hooks/app/controllers/journals_controller.rb | 1 - hooks/app/controllers/members_controller.rb | 1 - hooks/app/controllers/messages_controller.rb | 1 - hooks/app/controllers/my_controller.rb | 5 +- hooks/app/controllers/news_controller.rb | 1 - hooks/app/controllers/projects_controller.rb | 1 - hooks/app/controllers/queries_controller.rb | 1 - hooks/app/controllers/reports_controller.rb | 1 - .../controllers/repositories_controller.rb | 1 - hooks/app/controllers/roles_controller.rb | 1 - hooks/app/controllers/search_controller.rb | 2 - hooks/app/controllers/settings_controller.rb | 1 - hooks/app/controllers/timelog_controller.rb | 1 - hooks/app/controllers/trackers_controller.rb | 1 - hooks/app/controllers/users_controller.rb | 1 - hooks/app/controllers/versions_controller.rb | 1 - hooks/app/controllers/watchers_controller.rb | 1 - hooks/app/controllers/welcome_controller.rb | 1 - hooks/app/controllers/wiki_controller.rb | 1 - hooks/app/controllers/wikis_controller.rb | 1 - hooks/app/helpers/application_helper.rb | 14 +++- hooks/app/helpers/users_helper.rb | 9 ++- hooks/app/models/custom_field.rb | 4 +- hooks/app/models/mail_handler.rb | 10 ++- hooks/app/models/project.rb | 2 +- hooks/app/views/account/show.rhtml | 4 + hooks/app/views/boards/show.rhtml | 2 +- hooks/app/views/issues/_form.rhtml | 2 +- .../views/issues/_form_custom_fields.rhtml | 2 +- hooks/app/views/layouts/base.rhtml | 2 +- hooks/app/views/users/edit.rhtml | 4 + hooks/app/views/users/list.rhtml | 2 +- hooks/app/views/wiki/history.rhtml | 2 +- hooks/doc/README_FOR_APP | 5 ++ hooks/doc/RUNNING_TESTS | 4 + hooks/lib/tasks/migrate_from_trac.rake | 10 ++- hooks/lib/tasks/testing.rake | 46 ++++++++++++ .../mail_handler/ticket_on_given_project.eml | 1 + .../mail_handler/ticket_reply_with_status.eml | 75 +++++++++++++++++++ .../test/functional/issues_controller_test.rb | 2 +- hooks/test/functional/wiki_controller_test.rb | 12 ++- .../unit/helpers/application_helper_test.rb | 11 ++- hooks/test/unit/mail_handler_test.rb | 23 +++++- .../lib/acts_as_customizable.rb | 5 +- .../plugins/engines/lib/engines/plugin.rb | 2 +- 58 files changed, 237 insertions(+), 59 deletions(-) create mode 100644 hooks/doc/README_FOR_APP create mode 100644 hooks/lib/tasks/testing.rake create mode 100644 hooks/test/fixtures/mail_handler/ticket_reply_with_status.eml diff --git a/hooks/app/controllers/account_controller.rb b/hooks/app/controllers/account_controller.rb index 1fe990007..4b2ec8317 100644 --- a/hooks/app/controllers/account_controller.rb +++ b/hooks/app/controllers/account_controller.rb @@ -16,7 +16,6 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. class AccountController < ApplicationController - layout 'base' helper :custom_fields include CustomFieldsHelper @@ -26,7 +25,7 @@ class AccountController < ApplicationController # Show user's account def show @user = User.find_active(params[:id]) - @custom_values = @user.custom_values.find(:all, :include => :custom_field) + @custom_values = @user.custom_values # show only public projects and private projects that the logged in user is also a member of @memberships = @user.memberships.select do |membership| diff --git a/hooks/app/controllers/admin_controller.rb b/hooks/app/controllers/admin_controller.rb index e002f3a27..a6df49dcd 100644 --- a/hooks/app/controllers/admin_controller.rb +++ b/hooks/app/controllers/admin_controller.rb @@ -16,7 +16,6 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. class AdminController < ApplicationController - layout 'base' before_filter :require_admin helper :sort diff --git a/hooks/app/controllers/application.rb b/hooks/app/controllers/application.rb index debe02162..7a56e61f0 100644 --- a/hooks/app/controllers/application.rb +++ b/hooks/app/controllers/application.rb @@ -18,6 +18,8 @@ require 'uri' class ApplicationController < ActionController::Base + layout 'base' + before_filter :user_setup, :check_if_login_required, :set_localization filter_parameter_logging :password diff --git a/hooks/app/controllers/attachments_controller.rb b/hooks/app/controllers/attachments_controller.rb index 1e8f566e6..788bab94d 100644 --- a/hooks/app/controllers/attachments_controller.rb +++ b/hooks/app/controllers/attachments_controller.rb @@ -16,7 +16,6 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. class AttachmentsController < ApplicationController - layout 'base' before_filter :find_project def show diff --git a/hooks/app/controllers/auth_sources_controller.rb b/hooks/app/controllers/auth_sources_controller.rb index b830f1970..981f29f03 100644 --- a/hooks/app/controllers/auth_sources_controller.rb +++ b/hooks/app/controllers/auth_sources_controller.rb @@ -16,7 +16,6 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. class AuthSourcesController < ApplicationController - layout 'base' before_filter :require_admin def index diff --git a/hooks/app/controllers/boards_controller.rb b/hooks/app/controllers/boards_controller.rb index 5bf4499bd..4532a88fe 100644 --- a/hooks/app/controllers/boards_controller.rb +++ b/hooks/app/controllers/boards_controller.rb @@ -16,7 +16,6 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. class BoardsController < ApplicationController - layout 'base' before_filter :find_project, :authorize helper :messages diff --git a/hooks/app/controllers/custom_fields_controller.rb b/hooks/app/controllers/custom_fields_controller.rb index d30e89493..4589996f1 100644 --- a/hooks/app/controllers/custom_fields_controller.rb +++ b/hooks/app/controllers/custom_fields_controller.rb @@ -16,7 +16,6 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. class CustomFieldsController < ApplicationController - layout 'base' before_filter :require_admin def index diff --git a/hooks/app/controllers/documents_controller.rb b/hooks/app/controllers/documents_controller.rb index 1f0784bb2..dbf9cd8e5 100644 --- a/hooks/app/controllers/documents_controller.rb +++ b/hooks/app/controllers/documents_controller.rb @@ -16,7 +16,6 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. class DocumentsController < ApplicationController - layout 'base' before_filter :find_project, :only => [:index, :new] before_filter :find_document, :except => [:index, :new] before_filter :authorize diff --git a/hooks/app/controllers/enumerations_controller.rb b/hooks/app/controllers/enumerations_controller.rb index 788fa11b2..50521bab8 100644 --- a/hooks/app/controllers/enumerations_controller.rb +++ b/hooks/app/controllers/enumerations_controller.rb @@ -16,7 +16,6 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. class EnumerationsController < ApplicationController - layout 'base' before_filter :require_admin def index diff --git a/hooks/app/controllers/issue_categories_controller.rb b/hooks/app/controllers/issue_categories_controller.rb index a73935b4f..8315d6eb8 100644 --- a/hooks/app/controllers/issue_categories_controller.rb +++ b/hooks/app/controllers/issue_categories_controller.rb @@ -16,7 +16,6 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. class IssueCategoriesController < ApplicationController - layout 'base' menu_item :settings before_filter :find_project, :authorize diff --git a/hooks/app/controllers/issue_relations_controller.rb b/hooks/app/controllers/issue_relations_controller.rb index cb0ad552a..2ca3f0d68 100644 --- a/hooks/app/controllers/issue_relations_controller.rb +++ b/hooks/app/controllers/issue_relations_controller.rb @@ -16,7 +16,6 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. class IssueRelationsController < ApplicationController - layout 'base' before_filter :find_project, :authorize def new diff --git a/hooks/app/controllers/issue_statuses_controller.rb b/hooks/app/controllers/issue_statuses_controller.rb index d0712e7c3..69d9db965 100644 --- a/hooks/app/controllers/issue_statuses_controller.rb +++ b/hooks/app/controllers/issue_statuses_controller.rb @@ -16,7 +16,6 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. class IssueStatusesController < ApplicationController - layout 'base' before_filter :require_admin verify :method => :post, :only => [ :destroy, :create, :update, :move ], diff --git a/hooks/app/controllers/issues_controller.rb b/hooks/app/controllers/issues_controller.rb index ea27810fd..986e76e28 100644 --- a/hooks/app/controllers/issues_controller.rb +++ b/hooks/app/controllers/issues_controller.rb @@ -16,7 +16,6 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. class IssuesController < ApplicationController - layout 'base' menu_item :new_issue, :only => :new before_filter :find_issue, :only => [:show, :edit, :reply, :destroy_attachment] diff --git a/hooks/app/controllers/journals_controller.rb b/hooks/app/controllers/journals_controller.rb index 758b8507f..6df54f098 100644 --- a/hooks/app/controllers/journals_controller.rb +++ b/hooks/app/controllers/journals_controller.rb @@ -16,7 +16,6 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. class JournalsController < ApplicationController - layout 'base' before_filter :find_journal def edit diff --git a/hooks/app/controllers/members_controller.rb b/hooks/app/controllers/members_controller.rb index a1706e601..1072090bc 100644 --- a/hooks/app/controllers/members_controller.rb +++ b/hooks/app/controllers/members_controller.rb @@ -16,7 +16,6 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. class MembersController < ApplicationController - layout 'base' before_filter :find_member, :except => :new before_filter :find_project, :only => :new before_filter :authorize diff --git a/hooks/app/controllers/messages_controller.rb b/hooks/app/controllers/messages_controller.rb index 97cb2c3bf..08c77d7d2 100644 --- a/hooks/app/controllers/messages_controller.rb +++ b/hooks/app/controllers/messages_controller.rb @@ -16,7 +16,6 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. class MessagesController < ApplicationController - layout 'base' menu_item :boards before_filter :find_board, :only => [:new, :preview] before_filter :find_message, :except => [:new, :preview] diff --git a/hooks/app/controllers/my_controller.rb b/hooks/app/controllers/my_controller.rb index ff3393e90..1cfa3e531 100644 --- a/hooks/app/controllers/my_controller.rb +++ b/hooks/app/controllers/my_controller.rb @@ -16,11 +16,10 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. class MyController < ApplicationController - helper :issues - - layout 'base' before_filter :require_login + helper :issues + BLOCKS = { 'issuesassignedtome' => :label_assigned_to_me_issues, 'issuesreportedbyme' => :label_reported_issues, 'issueswatched' => :label_watched_issues, diff --git a/hooks/app/controllers/news_controller.rb b/hooks/app/controllers/news_controller.rb index 8c1a03a5b..b5f7ca1b2 100644 --- a/hooks/app/controllers/news_controller.rb +++ b/hooks/app/controllers/news_controller.rb @@ -16,7 +16,6 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. class NewsController < ApplicationController - layout 'base' before_filter :find_news, :except => [:new, :index, :preview] before_filter :find_project, :only => [:new, :preview] before_filter :authorize, :except => [:index, :preview] diff --git a/hooks/app/controllers/projects_controller.rb b/hooks/app/controllers/projects_controller.rb index cfac01b9a..43d35cf4f 100644 --- a/hooks/app/controllers/projects_controller.rb +++ b/hooks/app/controllers/projects_controller.rb @@ -16,7 +16,6 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. class ProjectsController < ApplicationController - layout 'base' menu_item :overview menu_item :activity, :only => :activity menu_item :roadmap, :only => :roadmap diff --git a/hooks/app/controllers/queries_controller.rb b/hooks/app/controllers/queries_controller.rb index da2c4a2c8..8500e853a 100644 --- a/hooks/app/controllers/queries_controller.rb +++ b/hooks/app/controllers/queries_controller.rb @@ -16,7 +16,6 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. class QueriesController < ApplicationController - layout 'base' menu_item :issues before_filter :find_query, :except => :new before_filter :find_optional_project, :only => :new diff --git a/hooks/app/controllers/reports_controller.rb b/hooks/app/controllers/reports_controller.rb index 338059a50..dd3ece930 100644 --- a/hooks/app/controllers/reports_controller.rb +++ b/hooks/app/controllers/reports_controller.rb @@ -16,7 +16,6 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. class ReportsController < ApplicationController - layout 'base' menu_item :issues before_filter :find_project, :authorize diff --git a/hooks/app/controllers/repositories_controller.rb b/hooks/app/controllers/repositories_controller.rb index 13bba6200..2f96e2d66 100644 --- a/hooks/app/controllers/repositories_controller.rb +++ b/hooks/app/controllers/repositories_controller.rb @@ -23,7 +23,6 @@ class ChangesetNotFound < Exception; end class InvalidRevisionParam < Exception; end class RepositoriesController < ApplicationController - layout 'base' menu_item :repository before_filter :find_repository, :except => :edit before_filter :find_project, :only => :edit diff --git a/hooks/app/controllers/roles_controller.rb b/hooks/app/controllers/roles_controller.rb index 9fdd9701b..72555e5b0 100644 --- a/hooks/app/controllers/roles_controller.rb +++ b/hooks/app/controllers/roles_controller.rb @@ -16,7 +16,6 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. class RolesController < ApplicationController - layout 'base' before_filter :require_admin verify :method => :post, :only => [ :destroy, :move ], diff --git a/hooks/app/controllers/search_controller.rb b/hooks/app/controllers/search_controller.rb index 50e42f088..e6e66f05c 100644 --- a/hooks/app/controllers/search_controller.rb +++ b/hooks/app/controllers/search_controller.rb @@ -16,8 +16,6 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. class SearchController < ApplicationController - layout 'base' - before_filter :find_optional_project helper :messages diff --git a/hooks/app/controllers/settings_controller.rb b/hooks/app/controllers/settings_controller.rb index e20cb64b5..6482a3576 100644 --- a/hooks/app/controllers/settings_controller.rb +++ b/hooks/app/controllers/settings_controller.rb @@ -16,7 +16,6 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. class SettingsController < ApplicationController - layout 'base' before_filter :require_admin def index diff --git a/hooks/app/controllers/timelog_controller.rb b/hooks/app/controllers/timelog_controller.rb index bf7b57d9d..f331cdbe4 100644 --- a/hooks/app/controllers/timelog_controller.rb +++ b/hooks/app/controllers/timelog_controller.rb @@ -16,7 +16,6 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. class TimelogController < ApplicationController - layout 'base' menu_item :issues before_filter :find_project, :authorize diff --git a/hooks/app/controllers/trackers_controller.rb b/hooks/app/controllers/trackers_controller.rb index 3d7dbd5c5..8c02f9474 100644 --- a/hooks/app/controllers/trackers_controller.rb +++ b/hooks/app/controllers/trackers_controller.rb @@ -16,7 +16,6 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. class TrackersController < ApplicationController - layout 'base' before_filter :require_admin def index diff --git a/hooks/app/controllers/users_controller.rb b/hooks/app/controllers/users_controller.rb index eb8aa7bac..d2564c2cb 100644 --- a/hooks/app/controllers/users_controller.rb +++ b/hooks/app/controllers/users_controller.rb @@ -16,7 +16,6 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. class UsersController < ApplicationController - layout 'base' before_filter :require_admin helper :sort diff --git a/hooks/app/controllers/versions_controller.rb b/hooks/app/controllers/versions_controller.rb index 5d3393ed8..ab2ccb773 100644 --- a/hooks/app/controllers/versions_controller.rb +++ b/hooks/app/controllers/versions_controller.rb @@ -16,7 +16,6 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. class VersionsController < ApplicationController - layout 'base' menu_item :roadmap before_filter :find_project, :authorize diff --git a/hooks/app/controllers/watchers_controller.rb b/hooks/app/controllers/watchers_controller.rb index a44686d3f..8e6ee3a9e 100644 --- a/hooks/app/controllers/watchers_controller.rb +++ b/hooks/app/controllers/watchers_controller.rb @@ -16,7 +16,6 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. class WatchersController < ApplicationController - layout 'base' before_filter :find_project before_filter :require_login, :check_project_privacy, :only => [:watch, :unwatch] before_filter :authorize, :only => :new diff --git a/hooks/app/controllers/welcome_controller.rb b/hooks/app/controllers/welcome_controller.rb index b4be7fb1c..b8108e8ac 100644 --- a/hooks/app/controllers/welcome_controller.rb +++ b/hooks/app/controllers/welcome_controller.rb @@ -16,7 +16,6 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. class WelcomeController < ApplicationController - layout 'base' def index @news = News.latest User.current diff --git a/hooks/app/controllers/wiki_controller.rb b/hooks/app/controllers/wiki_controller.rb index 5a5f3949f..46df2931e 100644 --- a/hooks/app/controllers/wiki_controller.rb +++ b/hooks/app/controllers/wiki_controller.rb @@ -18,7 +18,6 @@ require 'diff' class WikiController < ApplicationController - layout 'base' before_filter :find_wiki, :authorize verify :method => :post, :only => [:destroy, :destroy_attachment, :protect], :redirect_to => { :action => :index } diff --git a/hooks/app/controllers/wikis_controller.rb b/hooks/app/controllers/wikis_controller.rb index 6054abd9a..215d39f4b 100644 --- a/hooks/app/controllers/wikis_controller.rb +++ b/hooks/app/controllers/wikis_controller.rb @@ -16,7 +16,6 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. class WikisController < ApplicationController - layout 'base' menu_item :settings before_filter :find_project, :authorize diff --git a/hooks/app/helpers/application_helper.rb b/hooks/app/helpers/application_helper.rb index a4102c84a..ed5c6bdb7 100644 --- a/hooks/app/helpers/application_helper.rb +++ b/hooks/app/helpers/application_helper.rb @@ -319,7 +319,9 @@ module ApplicationHelper # source:some/file#L120 -> Link to line 120 of the file # source:some/file@52#L120 -> Link to line 120 of the file's revision 52 # export:some/file -> Force the download of the file - text = text.gsub(%r{([\s\(,\-\>]|^)(!)?(attachment|document|version|commit|source|export)?((#|r)(\d+)|(:)([^"\s<>][^\s<>]*?|"[^"]+?"))(?=(?=[[:punct:]]\W)|\s|<|$)}) do |m| + # Forum messages: + # message#1218 -> Link to message with id 1218 + text = text.gsub(%r{([\s\(,\-\>]|^)(!)?(attachment|document|version|commit|source|export|message)?((#|r)(\d+)|(:)([^"\s<>][^\s<>]*?|"[^"]+?"))(?=(?=[[:punct:]]\W)|\s|<|$)}) do |m| leading, esc, prefix, sep, oid = $1, $2, $3, $5 || $7, $6 || $8 link = nil if esc.nil? @@ -349,6 +351,16 @@ module ApplicationHelper link = link_to h(version.name), {:only_path => only_path, :controller => 'versions', :action => 'show', :id => version}, :class => 'version' end + when 'message' + if message = Message.find_by_id(oid, :include => [:parent, {:board => :project}], :conditions => Project.visible_by(User.current)) + link = link_to h(truncate(message.subject, 60)), {:only_path => only_path, + :controller => 'messages', + :action => 'show', + :board_id => message.board, + :id => message.root, + :anchor => (message.parent ? "message-#{message.id}" : nil)}, + :class => 'message' + end end elsif sep == ':' # removes the double quotes if any diff --git a/hooks/app/helpers/users_helper.rb b/hooks/app/helpers/users_helper.rb index 32b29526a..5b113e880 100644 --- a/hooks/app/helpers/users_helper.rb +++ b/hooks/app/helpers/users_helper.rb @@ -16,11 +16,12 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. module UsersHelper - def status_options_for_select(selected) + def users_status_options_for_select(selected) + user_count_by_status = User.count(:group => 'status').to_hash options_for_select([[l(:label_all), ''], - [l(:status_active), 1], - [l(:status_registered), 2], - [l(:status_locked), 3]], selected) + ["#{l(:status_active)} (#{user_count_by_status[1].to_i})", 1], + ["#{l(:status_registered)} (#{user_count_by_status[2].to_i})", 2], + ["#{l(:status_locked)} (#{user_count_by_status[3].to_i})", 3]], selected) end # Options for the new membership projects combo-box diff --git a/hooks/app/models/custom_field.rb b/hooks/app/models/custom_field.rb index 990adf9e2..704fbe010 100644 --- a/hooks/app/models/custom_field.rb +++ b/hooks/app/models/custom_field.rb @@ -30,7 +30,7 @@ class CustomField < ActiveRecord::Base }.freeze validates_presence_of :name, :field_format - validates_uniqueness_of :name + validates_uniqueness_of :name, :scope => :type validates_length_of :name, :maximum => 30 validates_format_of :name, :with => /^[\w\s\'\-]*$/i validates_inclusion_of :field_format, :in => FIELD_FORMATS.keys @@ -66,7 +66,7 @@ class CustomField < ActiveRecord::Base # to move in project_custom_field def self.for_all - find(:all, :conditions => ["is_for_all=?", true]) + find(:all, :conditions => ["is_for_all=?", true], :order => 'position') end def type_name diff --git a/hooks/app/models/mail_handler.rb b/hooks/app/models/mail_handler.rb index 109db2989..2f1eba3e9 100644 --- a/hooks/app/models/mail_handler.rb +++ b/hooks/app/models/mail_handler.rb @@ -31,6 +31,8 @@ class MailHandler < ActionMailer::Base @@handler_options[:allow_override] ||= [] # Project needs to be overridable if not specified @@handler_options[:allow_override] << 'project' unless @@handler_options[:issue].has_key?(:project) + # Status needs to be overridable if not specified + @@handler_options[:allow_override] << 'status' unless @@handler_options[:issue].has_key?(:status) super email end @@ -76,10 +78,11 @@ class MailHandler < ActionMailer::Base tracker = (get_keyword(:tracker) && project.trackers.find_by_name(get_keyword(:tracker))) || project.trackers.find(:first) category = (get_keyword(:category) && project.issue_categories.find_by_name(get_keyword(:category))) priority = (get_keyword(:priority) && Enumeration.find_by_opt_and_name('IPRI', get_keyword(:priority))) + status = (get_keyword(:status) && IssueStatus.find_by_name(get_keyword(:status))) || IssueStatus.default # check permission raise UnauthorizedAction unless user.allowed_to?(:add_issues, project) - issue = Issue.new(:author => user, :project => project, :tracker => tracker, :category => category, :priority => priority) + issue = Issue.new(:author => user, :project => project, :tracker => tracker, :category => category, :priority => priority, :status => status) issue.subject = email.subject.chomp issue.description = email.plain_text_body.chomp issue.save! @@ -100,13 +103,18 @@ class MailHandler < ActionMailer::Base # Adds a note to an existing issue def receive_issue_update(issue_id) + status = (get_keyword(:status) && IssueStatus.find_by_name(get_keyword(:status))) + issue = Issue.find_by_id(issue_id) return unless issue # check permission raise UnauthorizedAction unless user.allowed_to?(:add_issue_notes, issue.project) || user.allowed_to?(:edit_issues, issue.project) + raise UnauthorizedAction unless status.nil? || user.allowed_to?(:edit_issues, issue.project) + # add the note journal = issue.init_journal(user, email.plain_text_body.chomp) add_attachments(issue) + issue.status = status unless status.nil? issue.save! logger.info "MailHandler: issue ##{issue.id} updated by #{user}" if logger && logger.info Mailer.deliver_issue_edit(journal) if Setting.notified_events.include?('issue_updated') diff --git a/hooks/app/models/project.rb b/hooks/app/models/project.rb index 5679344bc..9e4bd6971 100644 --- a/hooks/app/models/project.rb +++ b/hooks/app/models/project.rb @@ -198,7 +198,7 @@ class Project < ActiveRecord::Base # Returns an array of all custom fields enabled for project issues # (explictly associated custom fields and custom fields enabled for all projects) def all_issue_custom_fields - @all_issue_custom_fields ||= (IssueCustomField.for_all + issue_custom_fields).uniq + @all_issue_custom_fields ||= (IssueCustomField.for_all + issue_custom_fields).uniq.sort end def project diff --git a/hooks/app/views/account/show.rhtml b/hooks/app/views/account/show.rhtml index 2d0731b42..1160a5d8c 100644 --- a/hooks/app/views/account/show.rhtml +++ b/hooks/app/views/account/show.rhtml @@ -1,3 +1,7 @@ +
+<%= link_to(l(:button_edit), {:controller => 'users', :action => 'edit', :id => @user}, :class => 'icon icon-edit') if User.current.admin? %> +
+

<%=h @user.name %>

diff --git a/hooks/app/views/boards/show.rhtml b/hooks/app/views/boards/show.rhtml index 5b0c208a3..96818df34 100644 --- a/hooks/app/views/boards/show.rhtml +++ b/hooks/app/views/boards/show.rhtml @@ -33,7 +33,7 @@ <%= l(:field_subject) %> <%= l(:field_author) %> <%= sort_header_tag("#{Message.table_name}.created_on", :caption => l(:field_created_on)) %> - <%= l(:label_reply_plural) %> + <%= sort_header_tag("#{Message.table_name}.replies_count", :caption => l(:label_reply_plural)) %> <%= sort_header_tag("#{Message.table_name}.updated_on", :caption => l(:label_message_last)) %> diff --git a/hooks/app/views/issues/_form.rhtml b/hooks/app/views/issues/_form.rhtml index 5d3731c47..419536fee 100644 --- a/hooks/app/views/issues/_form.rhtml +++ b/hooks/app/views/issues/_form.rhtml @@ -42,7 +42,7 @@

-<%= render :partial => 'form_custom_fields', :locals => {:values => @custom_values} %> +<%= render :partial => 'form_custom_fields' %> <% if @issue.new_record? %>

<%= render :partial => 'attachments/form' %>

diff --git a/hooks/app/views/issues/_form_custom_fields.rhtml b/hooks/app/views/issues/_form_custom_fields.rhtml index ebd4c3219..752fb4d37 100644 --- a/hooks/app/views/issues/_form_custom_fields.rhtml +++ b/hooks/app/views/issues/_form_custom_fields.rhtml @@ -1,5 +1,5 @@
-<% i = 1 %> +<% i = 0 %> <% split_on = @issue.custom_field_values.size / 2 %> <% @issue.custom_field_values.each do |value| %>

<%= custom_field_tag_with_label :issue, value %>

diff --git a/hooks/app/views/layouts/base.rhtml b/hooks/app/views/layouts/base.rhtml index e866287a2..8c1c01903 100644 --- a/hooks/app/views/layouts/base.rhtml +++ b/hooks/app/views/layouts/base.rhtml @@ -6,7 +6,7 @@ <%= stylesheet_link_tag 'application', :media => 'all' %> -<%= javascript_include_tag :defaults %> +<%= javascript_include_tag :defaults, :cache => true %> <%= stylesheet_link_tag 'jstoolbar' %>