diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2012-04-25 17:17:49 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2012-04-25 17:17:49 +0000 |
commit | 5e57a1a9d9478162ac4f27ae96b2ccaf55a1aba7 (patch) | |
tree | 93e57765139714bd82dede475725516c448c0d55 /app | |
parent | 34e20c4373b7f5a20ab3a132feae3f70f21ec477 (diff) | |
download | redmine-5e57a1a9d9478162ac4f27ae96b2ccaf55a1aba7.tar.gz redmine-5e57a1a9d9478162ac4f27ae96b2ccaf55a1aba7.zip |
Merged rails-3.2 branch.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9528 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app')
134 files changed, 371 insertions, 392 deletions
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 0ecc04fcb..17a0b9e1c 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -22,9 +22,12 @@ class Unauthorized < Exception; end class ApplicationController < ActionController::Base include Redmine::I18n + + class_attribute :accept_api_auth_actions + class_attribute :accept_rss_auth_actions + class_attribute :model_object layout 'base' - exempt_from_layout 'builder', 'rsb' protect_from_forgery def handle_unverified_request @@ -68,7 +71,6 @@ class ApplicationController < ActionController::Base end before_filter :user_setup, :check_if_login_required, :set_localization - filter_parameter_logging :password rescue_from ActionController::InvalidAuthenticityToken, :with => :invalid_authenticity_token rescue_from ::Unauthorized, :with => :deny_access @@ -77,10 +79,6 @@ class ApplicationController < ActionController::Base include Redmine::MenuManager::MenuController helper Redmine::MenuManager::MenuHelper - Redmine::Scm::Base.all.each do |scm| - require_dependency "repository/#{scm.underscore}" - end - def user_setup # Check the settings cache for each request Setting.check_cache @@ -242,7 +240,7 @@ class ApplicationController < ActionController::Base end def find_model_object - model = self.class.read_inheritable_attribute('model_object') + model = self.class.model_object if model @object = model.find(params[:id]) self.instance_variable_set('@' + controller_name.singularize, @object) if @object @@ -252,7 +250,7 @@ class ApplicationController < ActionController::Base end def self.model_object(model) - write_inheritable_attribute('model_object', model) + self.model_object = model end # Filter for bulk issue operations @@ -388,9 +386,9 @@ class ApplicationController < ActionController::Base def self.accept_rss_auth(*actions) if actions.any? - write_inheritable_attribute('accept_rss_auth_actions', actions) + self.accept_rss_auth_actions = actions else - read_inheritable_attribute('accept_rss_auth_actions') || [] + self.accept_rss_auth_actions || [] end end @@ -400,9 +398,9 @@ class ApplicationController < ActionController::Base def self.accept_api_auth(*actions) if actions.any? - write_inheritable_attribute('accept_api_auth_actions', actions) + self.accept_api_auth_actions = actions else - read_inheritable_attribute('accept_api_auth_actions') || [] + self.accept_api_auth_actions || [] end end @@ -523,26 +521,12 @@ class ApplicationController < ActionController::Base else @error_messages = objects.errors.full_messages end - render :template => 'common/error_messages.api', :status => :unprocessable_entity, :layout => false - end - - # Overrides #default_template so that the api template - # is used automatically if it exists - def default_template(action_name = self.action_name) - if api_request? - begin - return self.view_paths.find_template(default_template_name(action_name), 'api') - rescue ::ActionView::MissingTemplate - # the api template was not found - # fallback to the default behaviour - end - end - super + render :template => 'common/error_messages.api', :status => :unprocessable_entity, :layout => nil end - # Overrides #pick_layout so that #render with no arguments + # Overrides #_include_layout? so that #render with no arguments # doesn't use the layout for api requests - def pick_layout(*args) - api_request? ? nil : super + def _include_layout?(*args) + api_request? ? false : super end end diff --git a/app/controllers/messages_controller.rb b/app/controllers/messages_controller.rb index a8ef03f34..2a04641ad 100644 --- a/app/controllers/messages_controller.rb +++ b/app/controllers/messages_controller.rb @@ -95,10 +95,11 @@ class MessagesController < ApplicationController # Delete a messages def destroy (render_403; return false) unless @message.destroyable_by?(User.current) + r = @message.to_param @message.destroy redirect_to @message.parent.nil? ? { :controller => 'boards', :action => 'show', :project_id => @project, :id => @board } : - { :action => 'show', :id => @message.parent, :r => @message } + { :action => 'show', :id => @message.parent, :r => r } end def quote diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index 73892b1d8..fb12ce373 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -18,6 +18,7 @@ require 'SVG/Graph/Bar' require 'SVG/Graph/BarHorizontal' require 'digest/sha1' +require 'redmine/scm/adapters/abstract_adapter' class ChangesetNotFound < Exception; end class InvalidRevisionParam < Exception; end @@ -307,8 +308,7 @@ class RepositoriesController < ApplicationController @repository = @project.repository end (render_404; return false) unless @repository - @path = params[:path].join('/') unless params[:path].nil? - @path ||= '' + @path = params[:path].is_a?(Array) ? params[:path].join('/') : params[:path].to_s @rev = params[:rev].blank? ? @repository.default_branch : params[:rev].to_s.strip @rev_to = params[:rev_to] @@ -343,15 +343,15 @@ class RepositoriesController < ApplicationController @date_to = Date.today @date_from = @date_to << 11 @date_from = Date.civil(@date_from.year, @date_from.month, 1) - commits_by_day = repository.changesets.count( + commits_by_day = Changeset.count( :all, :group => :commit_date, - :conditions => ["commit_date BETWEEN ? AND ?", @date_from, @date_to]) + :conditions => ["repository_id = ? AND commit_date BETWEEN ? AND ?", repository.id, @date_from, @date_to]) commits_by_month = [0] * 12 commits_by_day.each {|c| commits_by_month[c.first.to_date.months_ago] += c.last } - changes_by_day = repository.changes.count( - :all, :group => :commit_date, - :conditions => ["commit_date BETWEEN ? AND ?", @date_from, @date_to]) + changes_by_day = Change.count( + :all, :group => :commit_date, :include => :changeset, + :conditions => ["#{Changeset.table_name}.repository_id = ? AND #{Changeset.table_name}.commit_date BETWEEN ? AND ?", repository.id, @date_from, @date_to]) changes_by_month = [0] * 12 changes_by_day.each {|c| changes_by_month[c.first.to_date.months_ago] += c.last } @@ -384,10 +384,10 @@ class RepositoriesController < ApplicationController end def graph_commits_per_author(repository) - commits_by_author = repository.changesets.count(:all, :group => :committer) + commits_by_author = Changeset.count(:all, :group => :committer, :conditions => ["repository_id = ?", repository.id]) commits_by_author.to_a.sort! {|x, y| x.last <=> y.last} - changes_by_author = repository.changes.count(:all, :group => :committer) + changes_by_author = Change.count(:all, :group => :committer, :include => :changeset, :conditions => ["#{Changeset.table_name}.repository_id = ?", repository.id]) h = changes_by_author.inject({}) {|o, i| o[i.first] = i.last; o} fields = commits_by_author.collect {|r| r.first} diff --git a/app/controllers/watchers_controller.rb b/app/controllers/watchers_controller.rb index 00f647023..c4f857f98 100644 --- a/app/controllers/watchers_controller.rb +++ b/app/controllers/watchers_controller.rb @@ -109,7 +109,7 @@ private @watched = klass.find(params[:object_id]) @project = @watched.project elsif params[:project_id] - @project = Project.visible.find(params[:project_id]) + @project = Project.visible.find_by_param(params[:project_id]) end rescue render_404 diff --git a/app/controllers/wiki_controller.rb b/app/controllers/wiki_controller.rb index 2f851aec9..671ab157b 100644 --- a/app/controllers/wiki_controller.rb +++ b/app/controllers/wiki_controller.rb @@ -163,6 +163,8 @@ class WikiController < ApplicationController # Optimistic locking exception flash.now[:error] = l(:notice_locking_conflict) render :action => 'edit' + rescue ActiveRecord::RecordNotSaved + render :action => 'edit' end # rename a page diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 34f9d1285..8310a4972 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -930,6 +930,9 @@ module ApplicationHelper def labelled_form_for(*args, &proc) args << {} unless args.last.is_a?(Hash) options = args.last + if args.first.is_a?(Symbol) + options.merge!(:as => args.shift) + end options.merge!({:builder => Redmine::Views::LabelledFormBuilder}) form_for(*args, &proc) end @@ -1060,7 +1063,7 @@ module ApplicationHelper # +user+ can be a User or a string that will be scanned for an email address (eg. 'joe <joe@foo.bar>') def avatar(user, options = { }) if Setting.gravatar_enabled? - options.merge!({:ssl => (defined?(request) && request.ssl?), :default => Setting.gravatar_default}) + options.merge!({:ssl => (request && request.ssl?), :default => Setting.gravatar_default}) email = nil if user.respond_to?(:mail) email = user.mail @@ -1079,7 +1082,7 @@ module ApplicationHelper # Returns the javascript tags that are included in the html layout head def javascript_heads - tags = javascript_include_tag(:defaults) + tags = javascript_include_tag('prototype', 'effects', 'dragdrop', 'controls', 'rails', 'application') unless User.current.pref.warn_on_leaving_unsaved == '0' tags << "\n".html_safe + javascript_tag("Event.observe(window, 'load', function(){ new WarnLeavingUnsaved('#{escape_javascript( l(:text_warn_on_leaving_unsaved) )}'); });") end diff --git a/app/helpers/wiki_helper.rb b/app/helpers/wiki_helper.rb index 74bec7422..a6e38a12a 100644 --- a/app/helpers/wiki_helper.rb +++ b/app/helpers/wiki_helper.rb @@ -21,14 +21,14 @@ module WikiHelper def wiki_page_options_for_select(pages, selected = nil, parent = nil, level = 0) pages = pages.group_by(&:parent) unless pages.is_a?(Hash) - s = '' + s = ''.html_safe if pages.has_key?(parent) pages[parent].each do |page| attrs = "value='#{page.id}'" attrs << " selected='selected'" if selected == page - indent = (level > 0) ? (' ' * level * 2 + '» ') : nil + indent = (level > 0) ? (' ' * level * 2 + '» ') : '' - s << "<option #{attrs}>#{indent}#{h page.pretty_title}</option>\n" + + s << content_tag('option', (indent + h(page.pretty_title)).html_safe, :value => page.id.to_s, :selected => selected == page) + wiki_page_options_for_select(pages, selected, page, level + 1) end end diff --git a/app/models/custom_field.rb b/app/models/custom_field.rb index 75fac2464..c5c8a9373 100644 --- a/app/models/custom_field.rb +++ b/app/models/custom_field.rb @@ -80,7 +80,7 @@ class CustomField < ActiveRecord::Base when 'bool' [[l(:general_text_Yes), '1'], [l(:general_text_No), '0']] else - read_possible_values_utf8_encoded || [] + possible_values || [] end end @@ -91,14 +91,20 @@ class CustomField < ActiveRecord::Base when 'bool' ['1', '0'] else - read_possible_values_utf8_encoded + values = super() + if values.is_a?(Array) + values.each do |value| + value.force_encoding('UTF-8') if value.respond_to?(:force_encoding) + end + end + values end end # Makes possible_values accept a multiline string def possible_values=(arg) if arg.is_a?(Array) - write_attribute(:possible_values, arg.compact.collect(&:strip).select {|v| !v.blank?}) + super(arg.compact.collect(&:strip).select {|v| !v.blank?}) else self.possible_values = arg.to_s.split(/[\n\r]+/) end @@ -218,14 +224,4 @@ class CustomField < ActiveRecord::Base end errs end - - def read_possible_values_utf8_encoded - values = read_attribute(:possible_values) - if values.is_a?(Array) - values.each do |value| - value.force_encoding('UTF-8') if value.respond_to?(:force_encoding) - end - end - values - end end diff --git a/app/models/issue.rb b/app/models/issue.rb index d72ff4dcf..a81dda16f 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -246,8 +246,8 @@ class Issue < ActiveRecord::Base write_attribute(:description, arg) end - # Overrides attributes= so that project and tracker get assigned first - def attributes_with_project_and_tracker_first=(new_attributes, *args) + # Overrides assign_attributes so that project and tracker get assigned first + def assign_attributes_with_project_and_tracker_first(new_attributes, *args) return if new_attributes.nil? attrs = new_attributes.dup attrs.stringify_keys! @@ -257,10 +257,10 @@ class Issue < ActiveRecord::Base send "#{attr}=", attrs.delete(attr) end end - send :attributes_without_project_and_tracker_first=, attrs, *args + send :assign_attributes_without_project_and_tracker_first, attrs, *args end # Do not redefine alias chain on reload (see #4838) - alias_method_chain(:attributes=, :project_and_tracker_first) unless method_defined?(:attributes_without_project_and_tracker_first=) + alias_method_chain(:assign_attributes, :project_and_tracker_first) unless method_defined?(:assign_attributes_without_project_and_tracker_first) def estimated_hours=(h) write_attribute :estimated_hours, (h.is_a?(String) ? h.to_hours : h) @@ -350,7 +350,7 @@ class Issue < ActiveRecord::Base end # mass-assignment security bypass - self.send :attributes=, attrs, false + assign_attributes attrs, :without_protection => true end def done_ratio @@ -921,7 +921,7 @@ class Issue < ActiveRecord::Base p.estimated_hours = nil if p.estimated_hours == 0.0 # ancestors will be recursively updated - p.save(false) + p.save(:validate => false) end end diff --git a/app/models/mail_handler.rb b/app/models/mail_handler.rb index e920dbd5f..07083f0ab 100644 --- a/app/models/mail_handler.rb +++ b/app/models/mail_handler.rb @@ -15,7 +15,9 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -class MailHandler < ActionMailer::Base +require 'vendor/tmail' + +class MailHandler include ActionView::Helpers::SanitizeHelper include Redmine::I18n @@ -39,7 +41,14 @@ class MailHandler < ActionMailer::Base @@handler_options[:allow_override] << 'status' unless @@handler_options[:issue].has_key?(:status) @@handler_options[:no_permission_check] = (@@handler_options[:no_permission_check].to_s == '1' ? true : false) - super email + + mail = TMail::Mail.parse(email) + mail.base64_decode + new.receive(mail) + end + + def logger + Rails.logger end cattr_accessor :ignored_emails_headers diff --git a/app/models/mailer.rb b/app/models/mailer.rb index 113a77337..1cfa7d6cd 100644 --- a/app/models/mailer.rb +++ b/app/models/mailer.rb @@ -21,13 +21,10 @@ class Mailer < ActionMailer::Base helper :issues helper :custom_fields - include ActionController::UrlWriter include Redmine::I18n def self.default_url_options - h = Setting.host_name - h = h.to_s.gsub(%r{\/.*$}, '') unless Redmine::Utils.relative_url_root.blank? - { :host => h, :protocol => Setting.protocol } + { :host => Setting.host_name, :protocol => Setting.protocol } end # Builds a tmail object used to email recipients of the added issue. @@ -42,12 +39,13 @@ class Mailer < ActionMailer::Base redmine_headers 'Issue-Assignee' => issue.assigned_to.login if issue.assigned_to message_id issue @author = issue.author - recipients issue.recipients - cc(issue.watcher_recipients - @recipients) - subject "[#{issue.project.name} - #{issue.tracker.name} ##{issue.id}] (#{issue.status.name}) #{issue.subject}" - body :issue => issue, - :issue_url => url_for(:controller => 'issues', :action => 'show', :id => issue) - render_multipart('issue_add', body) + @issue = issue + @issue_url = url_for(:controller => 'issues', :action => 'show', :id => issue) + recipients = issue.recipients + cc = issue.watcher_recipients - recipients + mail :to => recipients, + :cc => cc, + :subject => "[#{issue.project.name} - #{issue.tracker.name} ##{issue.id}] (#{issue.status.name}) #{issue.subject}" end # Builds a tmail object used to email recipients of the edited issue. @@ -64,30 +62,29 @@ class Mailer < ActionMailer::Base message_id journal references issue @author = journal.user - recipients issue.recipients + recipients = issue.recipients # Watchers in cc - cc(issue.watcher_recipients - @recipients) + cc = issue.watcher_recipients - recipients s = "[#{issue.project.name} - #{issue.tracker.name} ##{issue.id}] " s << "(#{issue.status.name}) " if journal.new_value_for('status_id') s << issue.subject - subject s - body :issue => issue, - :journal => journal, - :issue_url => url_for(:controller => 'issues', :action => 'show', :id => issue, :anchor => "change-#{journal.id}") - - render_multipart('issue_edit', body) + @issue = issue + @journal = journal + @issue_url = url_for(:controller => 'issues', :action => 'show', :id => issue, :anchor => "change-#{journal.id}") + mail :to => recipients, + :cc => cc, + :subject => s end def reminder(user, issues, days) set_language_if_valid user.language - recipients user.mail - subject l(:mail_subject_reminder, :count => issues.size, :days => days) - body :issues => issues, - :days => days, - :issues_url => url_for(:controller => 'issues', :action => 'index', + @issues = issues + @days = days + @issues_url = url_for(:controller => 'issues', :action => 'index', :set_filter => 1, :assigned_to_id => user.id, :sort => 'due_date:asc') - render_multipart('reminder', body) + mail :to => user.mail, + :subject => l(:mail_subject_reminder, :count => issues.size, :days => days) end # Builds a tmail object used to email users belonging to the added document's project. @@ -97,12 +94,11 @@ class Mailer < ActionMailer::Base # Mailer.deliver_document_added(document) => sends an email to the document's project recipients def document_added(document) redmine_headers 'Project' => document.project.identifier - recipients document.recipients @author = User.current - subject "[#{document.project.name}] #{l(:label_document_new)}: #{document.title}" - body :document => document, - :document_url => url_for(:controller => 'documents', :action => 'show', :id => document) - render_multipart('document_added', body) + @document = document + @document_url = url_for(:controller => 'documents', :action => 'show', :id => document) + mail :to => document.recipients, + :subject => "[#{document.project.name}] #{l(:label_document_new)}: #{document.title}" end # Builds a tmail object used to email recipients of a project when an attachements are added. @@ -119,22 +115,22 @@ class Mailer < ActionMailer::Base when 'Project' added_to_url = url_for(:controller => 'files', :action => 'index', :project_id => container) added_to = "#{l(:label_project)}: #{container}" - recipients container.project.notified_users.select {|user| user.allowed_to?(:view_files, container.project)}.collect {|u| u.mail} + recipients = container.project.notified_users.select {|user| user.allowed_to?(:view_files, container.project)}.collect {|u| u.mail} when 'Version' added_to_url = url_for(:controller => 'files', :action => 'index', :project_id => container.project) added_to = "#{l(:label_version)}: #{container.name}" - recipients container.project.notified_users.select {|user| user.allowed_to?(:view_files, container.project)}.collect {|u| u.mail} + recipients = container.project.notified_users.select {|user| user.allowed_to?(:view_files, container.project)}.collect {|u| u.mail} when 'Document' added_to_url = url_for(:controller => 'documents', :action => 'show', :id => container.id) added_to = "#{l(:label_document)}: #{container.title}" - recipients container.recipients + recipients = container.recipients end redmine_headers 'Project' => container.project.identifier - subject "[#{container.project.name}] #{l(:label_attachment_new)}" - body :attachments => attachments, - :added_to => added_to, - :added_to_url => added_to_url - render_multipart('attachments_added', body) + @attachments = attachments + @added_to = added_to + @added_to_url = added_to_url + mail :to => recipients, + :subject => "[#{container.project.name}] #{l(:label_attachment_new)}" end # Builds a tmail object used to email recipients of a news' project when a news item is added. @@ -146,11 +142,10 @@ class Mailer < ActionMailer::Base redmine_headers 'Project' => news.project.identifier @author = news.author message_id news - recipients news.recipients - subject "[#{news.project.name}] #{l(:label_news)}: #{news.title}" - body :news => news, - :news_url => url_for(:controller => 'news', :action => 'show', :id => news) - render_multipart('news_added', body) + @news = news + @news_url = url_for(:controller => 'news', :action => 'show', :id => news) + mail :to => news.recipients, + :subject => "[#{news.project.name}] #{l(:label_news)}: #{news.title}" end # Builds a tmail object used to email recipients of a news' project when a news comment is added. @@ -163,13 +158,12 @@ class Mailer < ActionMailer::Base redmine_headers 'Project' => news.project.identifier @author = comment.author message_id comment - recipients news.recipients - cc news.watcher_recipients - subject "Re: [#{news.project.name}] #{l(:label_news)}: #{news.title}" - body :news => news, - :comment => comment, - :news_url => url_for(:controller => 'news', :action => 'show', :id => news) - render_multipart('news_comment_added', body) + @news = news + @comment = comment + @news_url = url_for(:controller => 'news', :action => 'show', :id => news) + mail :to => news.recipients, + :cc => news.watcher_recipients, + :subject => "Re: [#{news.project.name}] #{l(:label_news)}: #{news.title}" end # Builds a tmail object used to email the recipients of the specified message that was posted. @@ -183,12 +177,13 @@ class Mailer < ActionMailer::Base @author = message.author message_id message references message.parent unless message.parent.nil? - recipients(message.recipients) - cc((message.root.watcher_recipients + message.board.watcher_recipients).uniq - @recipients) - subject "[#{message.board.project.name} - #{message.board.name} - msg#{message.root.id}] #{message.subject}" - body :message => message, - :message_url => url_for(message.event_url) - render_multipart('message_posted', body) + recipients = message.recipients + cc = ((message.root.watcher_recipients + message.board.watcher_recipients).uniq - recipients) + @message = message + @message_url = url_for(message.event_url) + mail :to => recipients, + :cc => cc, + :subject => "[#{message.board.project.name} - #{message.board.name} - msg#{message.root.id}] #{message.subject}" end # Builds a tmail object used to email the recipients of a project of the specified wiki content was added. @@ -201,14 +196,15 @@ class Mailer < ActionMailer::Base 'Wiki-Page-Id' => wiki_content.page.id @author = wiki_content.author message_id wiki_content - recipients wiki_content.recipients - cc(wiki_content.page.wiki.watcher_recipients - recipients) - subject "[#{wiki_content.project.name}] #{l(:mail_subject_wiki_content_added, :id => wiki_content.page.pretty_title)}" - body :wiki_content => wiki_content, - :wiki_content_url => url_for(:controller => 'wiki', :action => 'show', + recipients = wiki_content.recipients + cc = wiki_content.page.wiki.watcher_recipients - recipients + @wiki_content = wiki_content + @wiki_content_url = url_for(:controller => 'wiki', :action => 'show', :project_id => wiki_content.project, :id => wiki_content.page.title) - render_multipart('wiki_content_added', body) + mail :to => recipients, + :cc => cc, + :subject => "[#{wiki_content.project.name}] #{l(:mail_subject_wiki_content_added, :id => wiki_content.page.pretty_title)}" end # Builds a tmail object used to email the recipients of a project of the specified wiki content was updated. @@ -221,17 +217,18 @@ class Mailer < ActionMailer::Base 'Wiki-Page-Id' => wiki_content.page.id @author = wiki_content.author message_id wiki_content - recipients wiki_content.recipients - cc(wiki_content.page.wiki.watcher_recipients + wiki_content.page.watcher_recipients - recipients) - subject "[#{wiki_content.project.name}] #{l(:mail_subject_wiki_content_updated, :id => wiki_content.page.pretty_title)}" - body :wiki_content => wiki_content, - :wiki_content_url => url_for(:controller => 'wiki', :action => 'show', + recipients = wiki_content.recipients + cc = wiki_content.page.wiki.watcher_recipients + wiki_content.page.watcher_recipients - recipients + @wiki_content = wiki_content + @wiki_content_url = url_for(:controller => 'wiki', :action => 'show', :project_id => wiki_content.project, - :id => wiki_content.page.title), - :wiki_diff_url => url_for(:controller => 'wiki', :action => 'diff', + :id => wiki_content.page.title) + @wiki_diff_url = url_for(:controller => 'wiki', :action => 'diff', :project_id => wiki_content.project, :id => wiki_content.page.title, :version => wiki_content.version) - render_multipart('wiki_content_updated', body) + mail :to => recipients, + :cc => cc, + :subject => "[#{wiki_content.project.name}] #{l(:mail_subject_wiki_content_updated, :id => wiki_content.page.pretty_title)}" end # Builds a tmail object used to email the specified user their account information. @@ -241,12 +238,11 @@ class Mailer < ActionMailer::Base # Mailer.deliver_account_information(user, password) => sends account information to the user def account_information(user, password) set_language_if_valid user.language - recipients user.mail - subject l(:mail_subject_register, Setting.app_title) - body :user => user, - :password => password, - :login_url => url_for(:controller => 'account', :action => 'login') - render_multipart('account_information', body) + @user = user + @password = password + @login_url = url_for(:controller => 'account', :action => 'login') + mail :to => user.mail, + :subject => l(:mail_subject_register, Setting.app_title) end # Builds a tmail object used to email all active administrators of an account activation request. @@ -256,13 +252,13 @@ class Mailer < ActionMailer::Base # Mailer.deliver_account_activation_request(user)=> sends an email to all active administrators def account_activation_request(user) # Send the email to all active administrators - recipients User.active.find(:all, :conditions => {:admin => true}).collect { |u| u.mail }.compact - subject l(:mail_subject_account_activation_request, Setting.app_title) - body :user => user, - :url => url_for(:controller => 'users', :action => 'index', + recipients = User.active.find(:all, :conditions => {:admin => true}).collect { |u| u.mail }.compact + @user = user + @url = url_for(:controller => 'users', :action => 'index', :status => User::STATUS_REGISTERED, :sort_key => 'created_on', :sort_order => 'desc') - render_multipart('account_activation_request', body) + mail :to => recipients, + :subject => l(:mail_subject_account_activation_request, Setting.app_title) end # Builds a tmail object used to email the specified user that their account was activated by an administrator. @@ -272,37 +268,33 @@ class Mailer < ActionMailer::Base # Mailer.deliver_account_activated(user) => sends an email to the registered user def account_activated(user) set_language_if_valid user.language - recipients user.mail - subject l(:mail_subject_register, Setting.app_title) - body :user => user, - :login_url => url_for(:controller => 'account', :action => 'login') - render_multipart('account_activated', body) + @user = user + @login_url = url_for(:controller => 'account', :action => 'login') + mail :to => user.mail, + :subject => l(:mail_subject_register, Setting.app_title) end def lost_password(token) set_language_if_valid(token.user.language) - recipients token.user.mail - subject l(:mail_subject_lost_password, Setting.app_title) - body :token => token, - :url => url_for(:controller => 'account', :action => 'lost_password', :token => token.value) - render_multipart('lost_password', body) + @token = token + @url = url_for(:controller => 'account', :action => 'lost_password', :token => token.value) + mail :to => token.user.mail, + :subject => l(:mail_subject_lost_password, Setting.app_title) end def register(token) set_language_if_valid(token.user.language) - recipients token.user.mail - subject l(:mail_subject_register, Setting.app_title) - body :token => token, - :url => url_for(:controller => 'account', :action => 'activate', :token => token.value) - render_multipart('register', body) + @token = token + @url = url_for(:controller => 'account', :action => 'activate', :token => token.value) + mail :to => token.user.mail, + :subject => l(:mail_subject_register, Setting.app_title) end def test_email(user) set_language_if_valid(user.language) - recipients user.mail - subject 'Redmine test' - body :url => url_for(:controller => 'welcome') - render_multipart('test_email', body) + @url = url_for(:controller => 'welcome') + mail :to => user.mail, + :subject => 'Redmine test' end # Overrides default deliver! method to prevent from sending an email @@ -313,13 +305,6 @@ class Mailer < ActionMailer::Base (cc.nil? || cc.empty?) && (bcc.nil? || bcc.empty?) - # Set Message-Id and References - if @message_id_object - mail.message_id = self.class.message_id_for(@message_id_object) - end - if @references_objects - mail.references = @references_objects.collect {|o| self.class.message_id_for(o)} - end # Log errors when raise_delivery_errors is set to false, Rails does not raise_errors = self.class.raise_delivery_errors @@ -383,83 +368,72 @@ class Mailer < ActionMailer::Base ActionMailer::Base.delivery_method = saved_method end - private - def initialize_defaults(method_name) - super - @initial_language = current_language - set_language_if_valid Setting.default_language - from Setting.mail_from - - # Common headers - headers 'X-Mailer' => 'Redmine', + def mail(headers={}) + headers.merge! 'X-Mailer' => 'Redmine', 'X-Redmine-Host' => Setting.host_name, 'X-Redmine-Site' => Setting.app_title, 'X-Auto-Response-Suppress' => 'OOF', - 'Auto-Submitted' => 'auto-generated' - end + 'Auto-Submitted' => 'auto-generated', + 'From' => Setting.mail_from - # Appends a Redmine header field (name is prepended with 'X-Redmine-') - def redmine_headers(h) - h.each { |k,v| headers["X-Redmine-#{k}"] = v.to_s } - end - - # Overrides the create_mail method - def create_mail # Removes the author from the recipients and cc # if he doesn't want to receive notifications about what he does if @author && @author.logged? && @author.pref[:no_self_notified] - if recipients - recipients((recipients.is_a?(Array) ? recipients : [recipients]) - [@author.mail]) - end - if cc - cc((cc.is_a?(Array) ? cc : [cc]) - [@author.mail]) - end + headers[:to].delete(@author.mail) if headers[:to].is_a?(Array) + headers[:cc].delete(@author.mail) if headers[:cc].is_a?(Array) end if @author && @author.logged? redmine_headers 'Sender' => @author.login end - notified_users = [recipients, cc].flatten.compact.uniq - # Rails would log recipients only, not cc and bcc - mylogger.info "Sending email notification to: #{notified_users.join(', ')}" if mylogger - # Blind carbon copy recipients if Setting.bcc_recipients? - bcc(notified_users) - recipients [] - cc [] + headers[:bcc] = [headers[:to], headers[:cc]].flatten.uniq.reject(&:blank?) + headers[:to] = nil + headers[:cc] = nil + end + + if @message_id_object + headers[:message_id] = "<#{self.class.message_id_for(@message_id_object)}>" + end + if @references_objects + headers[:references] = @references_objects.collect {|o| "<#{self.class.message_id_for(o)}>"}.join(' ') + end + + super headers do |format| + format.text + format.html unless Setting.plain_text_mail? end + + set_language_if_valid @initial_language + end + + def initialize(*args) + @initial_language = current_language + set_language_if_valid Setting.default_language + super + end + + def self.deliver_mail(mail) + return false if mail.to.blank? && mail.cc.blank? && mail.bcc.blank? super end - # Rails 2.3 has problems rendering implicit multipart messages with - # layouts so this method will wrap an multipart messages with - # explicit parts. - # - # https://rails.lighthouseapp.com/projects/8994/tickets/2338-actionmailer-mailer-views-and-content-type - # https://rails.lighthouseapp.com/projects/8994/tickets/1799-actionmailer-doesnt-set-template_format-when-rendering-layouts - - def render_multipart(method_name, body) - if Setting.plain_text_mail? - content_type "text/plain" - body render(:file => "#{method_name}.text.erb", - :body => body, - :layout => 'mailer.text.erb') + def self.method_missing(method, *args, &block) + if m = method.to_s.match(%r{^deliver_(.+)$}) + send(m[1], *args).deliver else - content_type "multipart/alternative" - part :content_type => "text/plain", - :body => render(:file => "#{method_name}.text.erb", - :body => body, :layout => 'mailer.text.erb') - part :content_type => "text/html", - :body => render_message("#{method_name}.html.erb", body) + super end end - # Makes partial rendering work with Rails 1.2 (retro-compatibility) - def self.controller_path - '' - end unless respond_to?('controller_path') + private + + # Appends a Redmine header field (name is prepended with 'X-Redmine-') + def redmine_headers(h) + h.each { |k,v| headers["X-Redmine-#{k}"] = v.to_s } + end # Returns a predictable Message-Id for the given object def self.message_id_for(object) @@ -469,11 +443,9 @@ class Mailer < ActionMailer::Base hash = "redmine.#{object.class.name.demodulize.underscore}-#{object.id}.#{timestamp.strftime("%Y%m%d%H%M%S")}" host = Setting.mail_from.to_s.gsub(%r{^.*@}, '') host = "#{::Socket.gethostname}.redmine" if host.empty? - "<#{hash}@#{host}>" + "#{hash}@#{host}" end - private - def message_id(object) @message_id_object = object end @@ -487,12 +459,3 @@ class Mailer < ActionMailer::Base Rails.logger end end - -# Patch TMail so that message_id is not overwritten -module TMail - class Mail - def add_message_id( fqdn = nil ) - self.message_id ||= ::TMail::new_message_id(fqdn) - end - end -end diff --git a/app/models/project.rb b/app/models/project.rb index 2e76612f5..6dfe95cc4 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -272,6 +272,10 @@ class Project < ActiveRecord::Base end end + def self.find_by_param(*args) + self.find(*args) + end + def reload(*args) @shared_versions = nil @rolled_up_versions = nil diff --git a/app/models/repository.rb b/app/models/repository.rb index 5b1d68111..7efbc0c26 100644 --- a/app/models/repository.rb +++ b/app/models/repository.rb @@ -57,7 +57,7 @@ class Repository < ActiveRecord::Base end alias :attributes_without_extra_info= :attributes= - def attributes=(new_attributes, guard_protected_attributes = true) + def attributes=(new_attributes) return if new_attributes.nil? attributes = new_attributes.dup attributes.stringify_keys! @@ -72,7 +72,7 @@ class Repository < ActiveRecord::Base end end - send :attributes_without_extra_info=, p, guard_protected_attributes + send :attributes_without_extra_info=, p if p_extra.keys.any? merge_extra_info(p_extra) end diff --git a/app/models/role.rb b/app/models/role.rb index 44bb340c3..06822fdba 100644 --- a/app/models/role.rb +++ b/app/models/role.rb @@ -36,7 +36,7 @@ class Role < ActiveRecord::Base before_destroy :check_deletable has_many :workflows, :dependent => :delete_all do def copy(source_role) - Workflow.copy(nil, source_role, nil, proxy_owner) + Workflow.copy(nil, source_role, nil, proxy_association.owner) end end diff --git a/app/models/tracker.rb b/app/models/tracker.rb index 784e18f5e..32eea2309 100644 --- a/app/models/tracker.rb +++ b/app/models/tracker.rb @@ -20,7 +20,7 @@ class Tracker < ActiveRecord::Base has_many :issues has_many :workflows, :dependent => :delete_all do def copy(source_tracker) - Workflow.copy(source_tracker, nil, proxy_owner, nil) + Workflow.copy(source_tracker, nil, proxy_association.owner, nil) end end diff --git a/app/views/account/login.html.erb b/app/views/account/login.html.erb index fad59e9a4..99eda9242 100644 --- a/app/views/account/login.html.erb +++ b/app/views/account/login.html.erb @@ -1,6 +1,6 @@ <%= call_hook :view_account_login_top %> <div id="login-form"> -<% form_tag({:action=> "login"}) do %> +<%= form_tag({:action=> "login"}) do %> <%= back_url_hidden_field_tag %> <table> <tr> diff --git a/app/views/account/lost_password.html.erb b/app/views/account/lost_password.html.erb index 420e8f9b1..44f851475 100644 --- a/app/views/account/lost_password.html.erb +++ b/app/views/account/lost_password.html.erb @@ -1,7 +1,7 @@ <h2><%=l(:label_password_lost)%></h2> <div class="box"> -<% form_tag({:action=> "lost_password"}, :class => "tabular") do %> +<%= form_tag({:action=> "lost_password"}, :class => "tabular") do %> <p><label for="mail"><%=l(:field_mail)%> <span class="required">*</span></label> <%= text_field_tag 'mail', nil, :size => 40 %> diff --git a/app/views/account/password_recovery.html.erb b/app/views/account/password_recovery.html.erb index 72310aefc..53c635050 100644 --- a/app/views/account/password_recovery.html.erb +++ b/app/views/account/password_recovery.html.erb @@ -2,7 +2,7 @@ <%= error_messages_for 'user' %> -<% form_tag({:token => @token.value}) do %> +<%= form_tag({:token => @token.value}) do %> <div class="box tabular"> <p><label for="new_password"><%=l(:field_new_password)%> <span class="required">*</span></label> <%= password_field_tag 'new_password', nil, :size => 25 %> diff --git a/app/views/account/register.html.erb b/app/views/account/register.html.erb index adb436326..7e44e123b 100644 --- a/app/views/account/register.html.erb +++ b/app/views/account/register.html.erb @@ -1,6 +1,6 @@ <h2><%=l(:label_register)%> <%=link_to l(:label_login_with_open_id_option), signin_url if Setting.openid? %></h2> -<% labelled_form_for @user, :url => {:action => 'register'} do |f| %> +<%= labelled_form_for @user, :url => {:action => 'register'} do |f| %> <%= error_messages_for 'user' %> <div class="box tabular"> diff --git a/app/views/activities/index.html.erb b/app/views/activities/index.html.erb index 81916e5e1..e2f15d109 100644 --- a/app/views/activities/index.html.erb +++ b/app/views/activities/index.html.erb @@ -40,7 +40,7 @@ <% end %> <% content_for :sidebar do %> -<% form_tag({}, :method => :get) do %> +<%= form_tag({}, :method => :get) do %> <h3><%= l(:label_activity) %></h3> <p><% @activity.event_types.each do |t| %> <%= check_box_tag "show_#{t}", 1, @activity.scope.include?(t) %> diff --git a/app/views/admin/_no_data.html.erb b/app/views/admin/_no_data.html.erb index 5d52dc059..8ad39b197 100644 --- a/app/views/admin/_no_data.html.erb +++ b/app/views/admin/_no_data.html.erb @@ -1,5 +1,5 @@ <div class="nodata"> -<% form_tag({:action => 'default_configuration'}) do %> +<%= form_tag({:action => 'default_configuration'}) do %> <%= simple_format(l(:text_no_configuration_data)) %> <p><%= l(:field_language) %>: <%= select_tag 'lang', options_for_select(lang_options_for_select(false), current_language.to_s) %> diff --git a/app/views/admin/projects.html.erb b/app/views/admin/projects.html.erb index 33d1d8818..6525f8ea5 100644 --- a/app/views/admin/projects.html.erb +++ b/app/views/admin/projects.html.erb @@ -4,7 +4,7 @@ <h2><%=l(:label_project_plural)%></h2> -<% form_tag({}, :method => :get) do %> +<%= form_tag({}, :method => :get) do %> <fieldset><legend><%= l(:label_filter_plural) %></legend> <label for='status'><%= l(:field_status) %> :</label> <%= select_tag 'status', project_status_options_for_select(@status), :class => "small", :onchange => "this.form.submit(); return false;" %> diff --git a/app/views/attachments/diff.html.erb b/app/views/attachments/diff.html.erb index fa4e182fc..5359d4eea 100644 --- a/app/views/attachments/diff.html.erb +++ b/app/views/attachments/diff.html.erb @@ -7,7 +7,7 @@ <span class="size">(<%= number_to_human_size @attachment.filesize %>)</span></p> </div> <p> -<% form_tag({}, :method => 'get') do %> +<%= form_tag({}, :method => 'get') do %> <label><%= l(:label_view_diff) %></label> <%= select_tag 'type', options_for_select( diff --git a/app/views/auth_sources/edit.html.erb b/app/views/auth_sources/edit.html.erb index f2d76002c..1673d8336 100644 --- a/app/views/auth_sources/edit.html.erb +++ b/app/views/auth_sources/edit.html.erb @@ -1,6 +1,6 @@ <h2><%=l(:label_auth_source)%> (<%= h(@auth_source.auth_method_name) %>)</h2> -<% form_tag({:action => 'update', :id => @auth_source}, :method => :put, :class => "tabular") do %> +<%= form_tag({:action => 'update', :id => @auth_source}, :method => :put, :class => "tabular") do %> <%= render :partial => auth_source_partial_name(@auth_source) %> <%= submit_tag l(:button_save) %> <% end %> diff --git a/app/views/auth_sources/new.html.erb b/app/views/auth_sources/new.html.erb index e5b9106bd..b585c0aa0 100644 --- a/app/views/auth_sources/new.html.erb +++ b/app/views/auth_sources/new.html.erb @@ -1,6 +1,6 @@ <h2><%=l(:label_auth_source_new)%> (<%= h(@auth_source.auth_method_name) %>)</h2> -<% form_tag({:action => 'create'}, :class => "tabular") do %> +<%= form_tag({:action => 'create'}, :class => "tabular") do %> <%= hidden_field_tag 'type', @auth_source.type %> <%= render :partial => auth_source_partial_name(@auth_source) %> <%= submit_tag l(:button_create) %> diff --git a/app/views/boards/edit.html.erb b/app/views/boards/edit.html.erb index 9e94c25cd..e57509eab 100644 --- a/app/views/boards/edit.html.erb +++ b/app/views/boards/edit.html.erb @@ -1,6 +1,6 @@ <h2><%= l(:label_board) %></h2> -<% labelled_form_for @board, :url => project_board_path(@project, @board) do |f| %> +<%= labelled_form_for @board, :url => project_board_path(@project, @board) do |f| %> <%= render :partial => 'form', :locals => {:f => f} %> <%= submit_tag l(:button_save) %> <% end %> diff --git a/app/views/boards/new.html.erb b/app/views/boards/new.html.erb index 68eb1a33c..acdf43fcf 100644 --- a/app/views/boards/new.html.erb +++ b/app/views/boards/new.html.erb @@ -1,6 +1,6 @@ <h2><%= l(:label_board_new) %></h2> -<% labelled_form_for @board, :url => project_boards_path(@project) do |f| %> +<%= labelled_form_for @board, :url => project_boards_path(@project) do |f| %> <%= render :partial => 'form', :locals => {:f => f} %> <%= submit_tag l(:button_create) %> <% end %> diff --git a/app/views/boards/show.html.erb b/app/views/boards/show.html.erb index 6441c5ce3..523dfea45 100644 --- a/app/views/boards/show.html.erb +++ b/app/views/boards/show.html.erb @@ -11,7 +11,7 @@ <div id="add-message" style="display:none;"> <% if authorize_for('messages', 'new') %> <h2><%= link_to h(@board.name), :controller => 'boards', :action => 'show', :project_id => @project, :id => @board %> » <%= l(:label_message_new) %></h2> -<% form_for :message, @message, :url => {:controller => 'messages', :action => 'new', :board_id => @board}, :html => {:multipart => true, :id => 'message-form'} do |f| %> +<%= form_for @message, :url => {:controller => 'messages', :action => 'new', :board_id => @board}, :html => {:multipart => true, :id => 'message-form'} do |f| %> <%= render :partial => 'messages/form', :locals => {:f => f} %> <p><%= submit_tag l(:button_create) %> <%= link_to_remote l(:label_preview), diff --git a/app/views/calendars/show.html.erb b/app/views/calendars/show.html.erb index 803a17357..ab5590129 100644 --- a/app/views/calendars/show.html.erb +++ b/app/views/calendars/show.html.erb @@ -1,6 +1,7 @@ <h2><%= @query.new_record? ? l(:label_calendar) : h(@query.name) %></h2> -<% form_tag({:controller => 'calendars', :action => 'show', :project_id => @project}, :method => :get, :id => 'query_form') do %> +<%= form_tag({:controller => 'calendars', :action => 'show', :project_id => @project}, + :method => :get, :id => 'query_form') do %> <%= hidden_field_tag 'set_filter', '1' %> <fieldset id="filters" class="collapsible <%= @query.new_record? ? "" : "collapsed" %>"> <legend onclick="toggleFieldset(this);"><%= l(:label_filter_plural) %></legend> diff --git a/app/views/common/feed.atom.builder b/app/views/common/feed.atom.builder index d76f0acd1..70dacc75a 100644 --- a/app/views/common/feed.atom.builder +++ b/app/views/common/feed.atom.builder @@ -1,8 +1,8 @@ xml.instruct! xml.feed "xmlns" => "http://www.w3.org/2005/Atom" do xml.title truncate_single_line(@title, :length => 100) - xml.link "rel" => "self", "href" => url_for(params.merge(:only_path => false, :escape => false)) - xml.link "rel" => "alternate", "href" => url_for(params.merge(:only_path => false, :format => nil, :key => nil, :escape => false)) + xml.link "rel" => "self", "href" => url_for(params.merge(:only_path => false)) + xml.link "rel" => "alternate", "href" => url_for(params.merge(:only_path => false, :format => nil, :key => nil)) xml.id url_for(:controller => 'welcome', :only_path => false) xml.updated((@items.first ? @items.first.event_datetime : Time.now).xmlschema) xml.author { xml.name "#{Setting.app_title}" } diff --git a/app/views/custom_fields/edit.html.erb b/app/views/custom_fields/edit.html.erb index 62672ab20..dce34736f 100644 --- a/app/views/custom_fields/edit.html.erb +++ b/app/views/custom_fields/edit.html.erb @@ -2,7 +2,7 @@ » <%= link_to l(@custom_field.type_name), :controller => 'custom_fields', :action => 'index', :tab => @custom_field.class.name %> » <%=h @custom_field.name %></h2> -<% labelled_form_for :custom_field, @custom_field, :url => custom_field_path(@custom_field), :html => {:method => :put} do |f| %> +<%= labelled_form_for :custom_field, @custom_field, :url => custom_field_path(@custom_field), :html => {:method => :put} do |f| %> <%= render :partial => 'form', :locals => { :f => f } %> <%= submit_tag l(:button_save) %> <% end %> diff --git a/app/views/custom_fields/new.html.erb b/app/views/custom_fields/new.html.erb index 4fcd160e4..cde4fab58 100644 --- a/app/views/custom_fields/new.html.erb +++ b/app/views/custom_fields/new.html.erb @@ -2,7 +2,7 @@ » <%= link_to l(@custom_field.type_name), :controller => 'custom_fields', :action => 'index', :tab => @custom_field.class.name %> » <%= l(:label_custom_field_new) %></h2> -<% labelled_form_for :custom_field, @custom_field, :url => custom_fields_path do |f| %> +<%= labelled_form_for :custom_field, @custom_field, :url => custom_fields_path do |f| %> <%= render :partial => 'form', :locals => { :f => f } %> <%= hidden_field_tag 'type', @custom_field.type %> <%= submit_tag l(:button_save) %> diff --git a/app/views/documents/edit.html.erb b/app/views/documents/edit.html.erb index 04e9b72e1..15491168d 100644 --- a/app/views/documents/edit.html.erb +++ b/app/views/documents/edit.html.erb @@ -1,6 +1,6 @@ <h2><%=l(:label_document)%></h2> -<% labelled_form_for @document do |f| %> +<%= labelled_form_for @document do |f| %> <%= render :partial => 'form', :locals => {:f => f} %> <p><%= submit_tag l(:button_save) %></p> <% end %> diff --git a/app/views/documents/index.html.erb b/app/views/documents/index.html.erb index d3658dac6..fd47c3842 100644 --- a/app/views/documents/index.html.erb +++ b/app/views/documents/index.html.erb @@ -5,7 +5,7 @@ <div id="add-document" style="display:none;"> <h2><%=l(:label_document_new)%></h2> -<% labelled_form_for @document, :url => project_documents_path(@project), :html => {:multipart => true} do |f| %> +<%= labelled_form_for @document, :url => project_documents_path(@project), :html => {:multipart => true} do |f| %> <%= render :partial => 'form', :locals => {:f => f} %> <p> <%= submit_tag l(:button_create) %> diff --git a/app/views/documents/new.html.erb b/app/views/documents/new.html.erb index 772093e31..a34391e31 100644 --- a/app/views/documents/new.html.erb +++ b/app/views/documents/new.html.erb @@ -1,6 +1,6 @@ <h2><%=l(:label_document_new)%></h2> -<% labelled_form_for @document, :url => project_documents_path(@project), :html => {:multipart => true} do |f| %> +<%= labelled_form_for @document, :url => project_documents_path(@project), :html => {:multipart => true} do |f| %> <%= render :partial => 'form', :locals => {:f => f} %> <p><%= submit_tag l(:button_create) %></p> <% end %> diff --git a/app/views/documents/show.html.erb b/app/views/documents/show.html.erb index fded30052..f65d5ae88 100644 --- a/app/views/documents/show.html.erb +++ b/app/views/documents/show.html.erb @@ -19,7 +19,7 @@ <% if authorize_for('documents', 'add_attachment') %> <p><%= link_to l(:label_attachment_new), {}, :onclick => "Element.show('add_attachment_form'); Element.hide(this); Element.scrollTo('add_attachment_form'); return false;", :id => 'attach_files_link' %></p> - <% form_tag({ :controller => 'documents', :action => 'add_attachment', :id => @document }, :multipart => true, :id => "add_attachment_form", :style => "display:none;") do %> + <%= form_tag({ :controller => 'documents', :action => 'add_attachment', :id => @document }, :multipart => true, :id => "add_attachment_form", :style => "display:none;") do %> <div class="box"> <p><%= render :partial => 'attachments/form' %></p> </div> diff --git a/app/views/enumerations/destroy.html.erb b/app/views/enumerations/destroy.html.erb index 4fca33d4a..02e66bd9f 100644 --- a/app/views/enumerations/destroy.html.erb +++ b/app/views/enumerations/destroy.html.erb @@ -1,6 +1,6 @@ <h2><%= l(@enumeration.option_name) %>: <%=h @enumeration %></h2> -<% form_tag({}, :method => :delete) do %> +<%= form_tag({}, :method => :delete) do %> <div class="box"> <p><strong><%= l(:text_enumeration_destroy_question, @enumeration.objects_count) %></strong></p> <p><label for='reassign_to_id'><%= l(:text_enumeration_category_reassign_to) %></label> diff --git a/app/views/enumerations/edit.html.erb b/app/views/enumerations/edit.html.erb index c46a7606f..e5c523390 100644 --- a/app/views/enumerations/edit.html.erb +++ b/app/views/enumerations/edit.html.erb @@ -1,6 +1,6 @@ <h2><%= link_to l(@enumeration.option_name), enumerations_path %> » <%=h @enumeration %></h2> -<% labelled_form_for :enumeration, @enumeration, :url => enumeration_path(@enumeration), :html => {:method => :put} do |f| %> +<%= labelled_form_for :enumeration, @enumeration, :url => enumeration_path(@enumeration), :html => {:method => :put} do |f| %> <%= render :partial => 'form', :locals => {:f => f} %> <%= submit_tag l(:button_save) %> <% end %> diff --git a/app/views/enumerations/new.html.erb b/app/views/enumerations/new.html.erb index f0e6bd343..dfbd99f52 100644 --- a/app/views/enumerations/new.html.erb +++ b/app/views/enumerations/new.html.erb @@ -1,6 +1,6 @@ <h2><%= link_to l(@enumeration.option_name), enumerations_path %> » <%=l(:label_enumeration_new)%></h2> -<% labelled_form_for :enumeration, @enumeration, :url => enumerations_path do |f| %> +<%= labelled_form_for :enumeration, @enumeration, :url => enumerations_path do |f| %> <%= f.hidden_field :type %> <%= render :partial => 'form', :locals => {:f => f} %> <%= submit_tag l(:button_create) %> diff --git a/app/views/files/new.html.erb b/app/views/files/new.html.erb index 544bd333b..ab38b4472 100644 --- a/app/views/files/new.html.erb +++ b/app/views/files/new.html.erb @@ -1,7 +1,7 @@ <h2><%=l(:label_attachment_new)%></h2> <%= error_messages_for 'attachment' %> -<% form_tag(project_files_path(@project), :multipart => true, :class => "tabular") do %> +<%= form_tag(project_files_path(@project), :multipart => true, :class => "tabular") do %> <div class="box"> <% if @versions.any? %> diff --git a/app/views/gantts/show.html.erb b/app/views/gantts/show.html.erb index 0b4af3523..aeeb127e4 100644 --- a/app/views/gantts/show.html.erb +++ b/app/views/gantts/show.html.erb @@ -1,7 +1,10 @@ <% @gantt.view = self %> <h2><%= @query.new_record? ? l(:label_gantt) : h(@query.name) %></h2> -<% form_tag({:controller => 'gantts', :action => 'show', :project_id => @project, :month => params[:month], :year => params[:year], :months => params[:months]}, :method => :get, :id => 'query_form') do %> +<%= form_tag({:controller => 'gantts', :action => 'show', + :project_id => @project, :month => params[:month], + :year => params[:year], :months => params[:months]}, + :method => :get, :id => 'query_form') do %> <%= hidden_field_tag 'set_filter', '1' %> <fieldset id="filters" class="collapsible <%= @query.new_record? ? "" : "collapsed" %>"> <legend onclick="toggleFieldset(this);"><%= l(:label_filter_plural) %></legend> diff --git a/app/views/groups/_general.html.erb b/app/views/groups/_general.html.erb index a9d05b7ca..8c720c3ee 100644 --- a/app/views/groups/_general.html.erb +++ b/app/views/groups/_general.html.erb @@ -1,4 +1,4 @@ -<% labelled_form_for @group do |f| %> +<%= labelled_form_for @group do |f| %> <%= render :partial => 'form', :locals => { :f => f } %> <%= submit_tag l(:button_save) %> <% end %> diff --git a/app/views/groups/_memberships.html.erb b/app/views/groups/_memberships.html.erb index 9346e1021..79b990c84 100644 --- a/app/views/groups/_memberships.html.erb +++ b/app/views/groups/_memberships.html.erb @@ -16,8 +16,9 @@ <td class="project"><%=h membership.project %></td> <td class="roles"> <span id="member-<%= membership.id %>-roles"><%=h membership.roles.sort.collect(&:to_s).join(', ') %></span> - <% remote_form_for(:membership, :url => { :action => 'edit_membership', :id => @group, :membership_id => membership }, - :html => { :id => "member-#{membership.id}-roles-form", :style => 'display:none;'}) do %> + <%= form_for(:membership, :remote => true, + :url => { :action => 'edit_membership', :id => @group, :membership_id => membership }, + :html => { :id => "member-#{membership.id}-roles-form", :style => 'display:none;'}) do %> <p><% roles.each do |role| %> <label><%= check_box_tag 'membership[role_ids][]', role.id, membership.roles.include?(role) %> <%=h role %></label><br /> <% end %></p> @@ -55,7 +56,7 @@ <div class="splitcontentright"> <% if projects.any? %> <fieldset><legend><%=l(:label_project_new)%></legend> -<% remote_form_for(:membership, :url => { :action => 'edit_membership', :id => @group }) do %> +<%= form_for(:membership, :remote => true, :url => { :action => 'edit_membership', :id => @group }) do %> <%= label_tag "membership_project_id", l(:description_choose_project), :class => "hidden-for-sighted" %> <%= select_tag 'membership[project_id]', options_for_membership_project_select(@group, projects) %> <p><%= l(:label_role_plural) %>: diff --git a/app/views/groups/_users.html.erb b/app/views/groups/_users.html.erb index d265c751f..5d10fe694 100644 --- a/app/views/groups/_users.html.erb +++ b/app/views/groups/_users.html.erb @@ -29,7 +29,8 @@ <div class="splitcontentright"> <% users = User.active.not_in_group(@group).all(:limit => 100) %> <% if users.any? %> - <% remote_form_for(@group, :url => group_users_path(@group), :html => {:method => :post}) do |f| %> + <%= form_for(@group, :remote => true, :url => group_users_path(@group), + :html => {:method => :post}) do |f| %> <fieldset><legend><%=l(:label_user_new)%></legend> <p><%= label_tag "user_search", l(:label_user_search) %><%= text_field_tag 'user_search', nil %></p> diff --git a/app/views/groups/new.html.erb b/app/views/groups/new.html.erb index a4426f2d1..f47034588 100644 --- a/app/views/groups/new.html.erb +++ b/app/views/groups/new.html.erb @@ -1,6 +1,6 @@ <h2><%= link_to l(:label_group_plural), groups_path %> » <%= l(:label_group_new) %></h2> -<% labelled_form_for @group do |f| %> +<%= labelled_form_for @group do |f| %> <%= render :partial => 'form', :locals => { :f => f } %> <p> <%= f.submit l(:button_create) %> diff --git a/app/views/issue_categories/destroy.html.erb b/app/views/issue_categories/destroy.html.erb index 882a75e4a..5f13eedcf 100644 --- a/app/views/issue_categories/destroy.html.erb +++ b/app/views/issue_categories/destroy.html.erb @@ -1,6 +1,6 @@ <h2><%=l(:label_issue_category)%>: <%=h @category.name %></h2> -<% form_tag(issue_category_path(@category), :method => :delete) do %> +<%= form_tag(issue_category_path(@category), :method => :delete) do %> <div class="box"> <p><strong><%= l(:text_issue_category_destroy_question, @issue_count) %></strong></p> <p><label><%= radio_button_tag 'todo', 'nullify', true %> <%= l(:text_issue_category_destroy_assignments) %></label><br /> diff --git a/app/views/issue_statuses/edit.html.erb b/app/views/issue_statuses/edit.html.erb index 584fe06a9..d52d61bd2 100644 --- a/app/views/issue_statuses/edit.html.erb +++ b/app/views/issue_statuses/edit.html.erb @@ -1,6 +1,6 @@ <h2><%= link_to l(:label_issue_status_plural), issue_statuses_path %> » <%=h @issue_status %></h2> -<% labelled_form_for @issue_status do |f| %> +<%= labelled_form_for @issue_status do |f| %> <%= render :partial => 'form', :locals => {:f => f} %> <%= submit_tag l(:button_save) %> <% end %> diff --git a/app/views/issue_statuses/new.html.erb b/app/views/issue_statuses/new.html.erb index 6ab77b214..c9e60abcd 100644 --- a/app/views/issue_statuses/new.html.erb +++ b/app/views/issue_statuses/new.html.erb @@ -1,6 +1,6 @@ <h2><%= link_to l(:label_issue_status_plural), issue_statuses_path %> » <%=l(:label_issue_status_new)%></h2> -<% labelled_form_for @issue_status do |f| %> +<%= labelled_form_for @issue_status do |f| %> <%= render :partial => 'form', :locals => {:f => f} %> <%= submit_tag l(:button_create) %> <% end %> diff --git a/app/views/issues/_action_menu.html.erb b/app/views/issues/_action_menu.html.erb index c643934d1..4d0503117 100644 --- a/app/views/issues/_action_menu.html.erb +++ b/app/views/issues/_action_menu.html.erb @@ -1,6 +1,6 @@ <div class="contextual"> <%= link_to_if_authorized(l(:button_update), {:controller => 'issues', :action => 'edit', :id => @issue }, :onclick => 'showAndScrollTo("update", "notes"); return false;', :class => 'icon icon-edit', :accesskey => accesskey(:edit)) %> -<%= link_to_if_authorized l(:button_log_time), {:controller => 'timelog', :action => 'new', :issue_id => @issue}, :class => 'icon icon-time-add' %> +<%= link_to l(:button_log_time), new_issue_time_entry_path(@issue), :class => 'icon icon-time-add' if User.current.allowed_to?(:log_time, @project) %> <%= watcher_tag(@issue, User.current) %> <%= link_to_if_authorized l(:button_copy), {:controller => 'issues', :action => 'new', :project_id => @project, :copy_from => @issue}, :class => 'icon icon-copy' %> <%= link_to l(:button_delete), issue_path(@issue), :confirm => issues_destroy_confirmation_message(@issue), :method => :delete, :class => 'icon icon-del' if User.current.allowed_to?(:delete_issues, @project) %> diff --git a/app/views/issues/_attributes.html.erb b/app/views/issues/_attributes.html.erb index 7ac662e13..c65735ae4 100644 --- a/app/views/issues/_attributes.html.erb +++ b/app/views/issues/_attributes.html.erb @@ -1,4 +1,4 @@ -<% labelled_fields_for :issue, @issue do |f| %> +<%= labelled_fields_for :issue, @issue do |f| %> <div class="splitcontent"> <div class="splitcontentleft"> diff --git a/app/views/issues/_edit.html.erb b/app/views/issues/_edit.html.erb index 690fa9386..b5ddfac38 100644 --- a/app/views/issues/_edit.html.erb +++ b/app/views/issues/_edit.html.erb @@ -1,4 +1,4 @@ -<% labelled_form_for @issue, :html => {:id => 'issue-form', :multipart => true} do |f| %> +<%= labelled_form_for @issue, :html => {:id => 'issue-form', :multipart => true} do |f| %> <%= error_messages_for 'issue', 'time_entry' %> <%= render :partial => 'conflict' if @conflict %> <div class="box"> @@ -11,7 +11,7 @@ <% end %> <% if User.current.allowed_to?(:log_time, @project) %> <fieldset class="tabular"><legend><%= l(:button_log_time) %></legend> - <% labelled_fields_for :time_entry, @time_entry do |time_entry| %> + <%= labelled_fields_for :time_entry, @time_entry do |time_entry| %> <div class="splitcontentleft"> <p><%= time_entry.text_field :hours, :size => 6, :label => :label_spent_time %> <%= l(:field_hours) %></p> </div> diff --git a/app/views/issues/_form.html.erb b/app/views/issues/_form.html.erb index 6634723f7..9bc362377 100644 --- a/app/views/issues/_form.html.erb +++ b/app/views/issues/_form.html.erb @@ -1,4 +1,4 @@ -<% labelled_fields_for :issue, @issue do |f| %> +<%= labelled_fields_for :issue, @issue do |f| %> <%= call_hook(:view_issues_form_details_top, { :issue => @issue, :form => f }) %> <% if @issue.safe_attribute? 'is_private' %> @@ -28,7 +28,7 @@ <label><%= l(:field_description) %></label> <%= link_to_function image_tag('edit.png'), 'Element.hide(this); Effect.toggle("issue_description_and_toolbar", "appear", {duration:0.3})' unless @issue.new_record? %> - <% content_tag 'span', :id => "issue_description_and_toolbar", :style => (@issue.new_record? ? nil : 'display:none') do %> + <%= content_tag 'span', :id => "issue_description_and_toolbar", :style => (@issue.new_record? ? nil : 'display:none') do %> <%= f.text_area :description, :cols => 60, :rows => (@issue.description.blank? ? 10 : [[10, @issue.description.length / 50].max, 100].min), diff --git a/app/views/issues/_list.html.erb b/app/views/issues/_list.html.erb index f5b5bc1bb..62cf4e443 100644 --- a/app/views/issues/_list.html.erb +++ b/app/views/issues/_list.html.erb @@ -1,4 +1,4 @@ -<% form_tag({}) do -%> +<%= form_tag({}) do -%> <%= hidden_field_tag 'back_url', url_for(params), :id => nil %> <div class="autoscroll"> <table class="list issues"> @@ -27,8 +27,8 @@ <% end %> <tr id="issue-<%= issue.id %>" class="hascontextmenu <%= cycle('odd', 'even') %> <%= issue.css_classes %> <%= level > 0 ? "idnt idnt-#{level}" : nil %>"> <td class="checkbox hide-when-print"><%= check_box_tag("ids[]", issue.id, false, :id => nil) %></td> - <td class="id"><%= link_to issue.id, :controller => 'issues', :action => 'show', :id => issue %></td> - <% query.columns.each do |column| %><%= content_tag 'td', column_content(column, issue), :class => column.css_classes %><% end %> + <td class="id"><%= link_to issue.id, issue_path(issue) %></td> + <%= raw query.columns.map {|column| "<td class=\"#{column.css_classes}\">#{column_content(column, issue)}</td>"}.join %> </tr> <% end -%> </tbody> diff --git a/app/views/issues/_list_simple.html.erb b/app/views/issues/_list_simple.html.erb index fcbd9d3fe..ae34000f1 100644 --- a/app/views/issues/_list_simple.html.erb +++ b/app/views/issues/_list_simple.html.erb @@ -1,5 +1,5 @@ <% if issues && issues.any? %> -<% form_tag({}) do %> +<%= form_tag({}) do %> <table class="list issues"> <thead><tr> <th>#</th> diff --git a/app/views/issues/bulk_edit.html.erb b/app/views/issues/bulk_edit.html.erb index e81676ada..946b5255b 100644 --- a/app/views/issues/bulk_edit.html.erb +++ b/app/views/issues/bulk_edit.html.erb @@ -7,7 +7,7 @@ ) + h(": #{i.subject}")) }.join("\n").html_safe %></ul> -<% form_tag({:action => 'bulk_update'}, :id => 'bulk_edit_form') do %> +<%= form_tag({:action => 'bulk_update'}, :id => 'bulk_edit_form') do %> <%= @issues.collect {|i| hidden_field_tag('ids[]', i.id)}.join("\n").html_safe %> <div class="box tabular"> <fieldset class="attributes"> diff --git a/app/views/issues/destroy.html.erb b/app/views/issues/destroy.html.erb index 3491c78eb..a8ca78826 100644 --- a/app/views/issues/destroy.html.erb +++ b/app/views/issues/destroy.html.erb @@ -1,6 +1,6 @@ <h2><%= l(:label_confirmation) %></h2> -<% form_tag({}, :method => :delete) do %> +<%= form_tag({}, :method => :delete) do %> <%= @issues.collect {|i| hidden_field_tag('ids[]', i.id)}.join("\n").html_safe %> <div class="box"> <p><strong><%= l(:text_destroy_time_entries_question, :hours => number_with_precision(@hours, :precision => 2)) %></strong></p> diff --git a/app/views/issues/index.html.erb b/app/views/issues/index.html.erb index e3e256dee..ac9da57dc 100644 --- a/app/views/issues/index.html.erb +++ b/app/views/issues/index.html.erb @@ -9,7 +9,7 @@ <h2><%= @query.new_record? ? l(:label_issue_plural) : h(@query.name) %></h2> <% html_title(@query.new_record? ? l(:label_issue_plural) : @query.name) %> -<% form_tag({ :controller => 'issues', :action => 'index', :project_id => @project }, +<%= form_tag({ :controller => 'issues', :action => 'index', :project_id => @project }, :method => :get, :id => 'query_form') do %> <%= hidden_field_tag 'set_filter', '1' %> <div id="query_form_content" class="hide-when-print"> @@ -68,7 +68,7 @@ <div id="csv-export-options" style="display:none;"> <h3 class="title"><%= l(:label_export_options, :export_format => 'CSV') %></h3> - <% form_tag(params.merge({:format => 'csv',:page=>nil}), :method => :get, :id => 'csv-export-form') do %> + <%= form_tag(params.merge({:format => 'csv',:page=>nil}), :method => :get, :id => 'csv-export-form') do %> <p> <label><%= radio_button_tag 'columns', '', true %> <%= l(:description_selected_columns) %></label><br /> <label><%= radio_button_tag 'columns', 'all' %> <%= l(:description_all_columns) %></label> diff --git a/app/views/issues/new.html.erb b/app/views/issues/new.html.erb index 400423317..4e8449570 100644 --- a/app/views/issues/new.html.erb +++ b/app/views/issues/new.html.erb @@ -2,7 +2,7 @@ <%= call_hook(:view_issues_new_top, {:issue => @issue}) %> -<% labelled_form_for @issue, :url => project_issues_path(@project), +<%= labelled_form_for @issue, :url => project_issues_path(@project), :html => {:id => 'issue-form', :multipart => true} do |f| %> <%= error_messages_for 'issue' %> <%= hidden_field_tag 'copy_from', params[:copy_from] if params[:copy_from] %> diff --git a/app/views/journals/_notes_form.html.erb b/app/views/journals/_notes_form.html.erb index f1311ac3b..f451dbbeb 100644 --- a/app/views/journals/_notes_form.html.erb +++ b/app/views/journals/_notes_form.html.erb @@ -1,4 +1,4 @@ -<% form_remote_tag(:url => {}, :html => { :id => "journal-#{@journal.id}-form" }) do %> +<%= form_remote_tag(:url => {}, :html => { :id => "journal-#{@journal.id}-form" }) do %> <%= label_tag "notes", l(:description_notes), :class => "hidden-for-sighted" %> <%= text_area_tag :notes, @journal.notes, :id => "journal_#{@journal.id}_notes", diff --git a/app/views/layouts/base.html.erb b/app/views/layouts/base.html.erb index 1a7c3c816..68b175848 100644 --- a/app/views/layouts/base.html.erb +++ b/app/views/layouts/base.html.erb @@ -29,17 +29,14 @@ <div id="account"> <%= render_menu :account_menu -%> </div> - <%= content_tag( - 'div', - "#{l(:label_logged_as)} #{link_to_user(User.current, :format => :username)}".html_safe, - :id => 'loggedas') if User.current.logged? %> + <%= content_tag('div', "#{l(:label_logged_as)} #{link_to_user(User.current, :format => :username)}".html_safe, :id => 'loggedas') if User.current.logged? %> <%= render_menu :top_menu if User.current.logged? || !Setting.login_required? -%> </div> <div id="header"> <% if User.current.logged? || !Setting.login_required? %> <div id="quick-search"> - <% form_tag({:controller => 'search', :action => 'index', :id => @project}, :method => :get ) do %> + <%= form_tag({:controller => 'search', :action => 'index', :id => @project}, :method => :get ) do %> <%= hidden_field_tag(controller.default_search_scope, 1, :id => nil) if controller.default_search_scope %> <label for='q'> <%= link_to l(:label_search), {:controller => 'search', :action => 'index', :id => @project}, :accesskey => accesskey(:search) %>: @@ -59,10 +56,13 @@ <% end %> </div> +<% content_for :sidebar do %> + <%= call_hook :view_layouts_base_sidebar %> +<% end %> + <%= tag('div', {:id => 'main', :class => (has_content?(:sidebar) ? '' : 'nosidebar')}, true) %> <div id="sidebar"> <%= yield :sidebar %> - <%= call_hook :view_layouts_base_sidebar %> </div> <div id="content"> diff --git a/app/views/messages/edit.html.erb b/app/views/messages/edit.html.erb index 054297cee..362f1b6b9 100644 --- a/app/views/messages/edit.html.erb +++ b/app/views/messages/edit.html.erb @@ -2,11 +2,13 @@ :action => 'show', :project_id => @project, :id => @board %> » <%= h @message.subject %></h2> -<% form_for :message, @message, - :url => {:action => 'edit'}, - :html => {:multipart => true, - :id => 'message-form', - :method => :post} do |f| %> +<%= form_for @message, { + :as => :message, + :url => {:action => 'edit'}, + :html => {:multipart => true, + :id => 'message-form', + :method => :post} + } do |f| %> <%= render :partial => 'form', :locals => {:f => f, :replying => !@message.parent.nil?} %> <%= submit_tag l(:button_save) %> diff --git a/app/views/messages/new.html.erb b/app/views/messages/new.html.erb index f41e27079..f1dddb6f5 100644 --- a/app/views/messages/new.html.erb +++ b/app/views/messages/new.html.erb @@ -1,6 +1,6 @@ <h2><%= link_to h(@board.name), :controller => 'boards', :action => 'show', :project_id => @project, :id => @board %> » <%= l(:label_message_new) %></h2> -<% form_for :message, @message, :url => {:action => 'new'}, :html => {:multipart => true, :id => 'message-form'} do |f| %> +<%= form_for @message, :url => {:action => 'new'}, :html => {:multipart => true, :id => 'message-form'} do |f| %> <%= render :partial => 'form', :locals => {:f => f} %> <%= submit_tag l(:button_create) %> <%= link_to_remote l(:label_preview), diff --git a/app/views/messages/show.html.erb b/app/views/messages/show.html.erb index 9edc8451f..d0857cf46 100644 --- a/app/views/messages/show.html.erb +++ b/app/views/messages/show.html.erb @@ -72,7 +72,7 @@ <% if !@topic.locked? && authorize_for('messages', 'reply') %> <p><%= toggle_link l(:button_reply), "reply", :focus => 'message_content' %></p> <div id="reply" style="display:none;"> -<% form_for :reply, @reply, :url => {:action => 'reply', :id => @topic}, :html => {:multipart => true, :id => 'message-form'} do |f| %> +<%= form_for @reply, :as => :reply, :url => {:action => 'reply', :id => @topic}, :html => {:multipart => true, :id => 'message-form'} do |f| %> <%= render :partial => 'form', :locals => {:f => f, :replying => true} %> <%= submit_tag l(:button_submit) %> <%= link_to_remote l(:label_preview), diff --git a/app/views/my/account.html.erb b/app/views/my/account.html.erb index 9d6910bce..47e945949 100644 --- a/app/views/my/account.html.erb +++ b/app/views/my/account.html.erb @@ -6,7 +6,7 @@ <h2><%=l(:label_my_account)%></h2> <%= error_messages_for 'user' %> -<% labelled_form_for :user, @user, +<%= labelled_form_for :user, @user, :url => { :action => "account" }, :html => { :id => 'my_account_form', :method => :post } do |f| %> diff --git a/app/views/my/destroy.html.erb b/app/views/my/destroy.html.erb index 5d6eaa004..68691412b 100644 --- a/app/views/my/destroy.html.erb +++ b/app/views/my/destroy.html.erb @@ -2,7 +2,7 @@ <div class="warning"> <p><%= simple_format l(:text_account_destroy_confirmation)%></p> <p> - <% form_tag({}) do %> + <%= form_tag({}) do %> <label><%= check_box_tag 'confirm', 1 %> <%= l(:general_text_Yes) %></label> <%= submit_tag l(:button_delete_my_account) %> | <%= link_to l(:button_cancel), :action => 'account' %> diff --git a/app/views/my/page_layout.html.erb b/app/views/my/page_layout.html.erb index 67edb9f28..0025186d9 100644 --- a/app/views/my/page_layout.html.erb +++ b/app/views/my/page_layout.html.erb @@ -35,7 +35,7 @@ function removeBlock(block) { </script> <div class="contextual"> -<% form_tag({:action => "add_block"}, :id => "block-form") do %> +<%= form_tag({:action => "add_block"}, :id => "block-form") do %> <%= label_tag('block-select', l(:label_my_page_block)) %>: <%= select_tag 'block', "<option></option>".html_safe + options_for_select(@block_options), diff --git a/app/views/my/password.html.erb b/app/views/my/password.html.erb index 61d5c56ca..de9a459e4 100644 --- a/app/views/my/password.html.erb +++ b/app/views/my/password.html.erb @@ -2,7 +2,7 @@ <%= error_messages_for 'user' %> -<% form_tag({}, :class => "tabular") do %> +<%= form_tag({}, :class => "tabular") do %> <div class="box"> <p><label for="password"><%=l(:field_password)%> <span class="required">*</span></label> <%= password_field_tag 'password', nil, :size => 25 %></p> diff --git a/app/views/news/edit.html.erb b/app/views/news/edit.html.erb index f00a024c1..5dd43c3ce 100644 --- a/app/views/news/edit.html.erb +++ b/app/views/news/edit.html.erb @@ -1,6 +1,6 @@ <h2><%=l(:label_news)%></h2> -<% labelled_form_for @news, :html => { :id => 'news-form', :multipart => true, :method => :put } do |f| %> +<%= labelled_form_for @news, :html => { :id => 'news-form', :multipart => true, :method => :put } do |f| %> <%= render :partial => 'form', :locals => { :f => f } %> <%= submit_tag l(:button_save) %> <%= link_to_remote l(:label_preview), diff --git a/app/views/news/index.html.erb b/app/views/news/index.html.erb index b839b5f44..b354adcb8 100644 --- a/app/views/news/index.html.erb +++ b/app/views/news/index.html.erb @@ -7,7 +7,7 @@ <div id="add-news" style="display:none;"> <h2><%=l(:label_news_new)%></h2> -<% labelled_form_for @news, :url => project_news_index_path(@project), +<%= labelled_form_for @news, :url => project_news_index_path(@project), :html => { :id => 'news-form', :multipart => true } do |f| %> <%= render :partial => 'news/form', :locals => { :f => f } %> <%= submit_tag l(:button_create) %> diff --git a/app/views/news/new.html.erb b/app/views/news/new.html.erb index 1c55215b7..95a902432 100644 --- a/app/views/news/new.html.erb +++ b/app/views/news/new.html.erb @@ -1,6 +1,6 @@ <h2><%=l(:label_news_new)%></h2> -<% labelled_form_for @news, :url => project_news_index_path(@project), +<%= labelled_form_for @news, :url => project_news_index_path(@project), :html => { :id => 'news-form', :multipart => true } do |f| %> <%= render :partial => 'news/form', :locals => { :f => f } %> <%= submit_tag l(:button_create) %> diff --git a/app/views/news/show.html.erb b/app/views/news/show.html.erb index b0b5f023e..cb332f88c 100644 --- a/app/views/news/show.html.erb +++ b/app/views/news/show.html.erb @@ -16,7 +16,7 @@ <% if authorize_for('news', 'edit') %> <div id="edit-news" style="display:none;"> -<% labelled_form_for :news, @news, :url => news_path(@news), +<%= labelled_form_for :news, @news, :url => news_path(@news), :html => { :id => 'news-form', :multipart => true, :method => :put } do |f| %> <%= render :partial => 'form', :locals => { :f => f } %> <%= submit_tag l(:button_save) %> @@ -55,7 +55,7 @@ <% if @news.commentable? %> <p><%= toggle_link l(:label_comment_add), "add_comment_form", :focus => "comment_comments" %></p> -<% form_tag({:controller => 'comments', :action => 'create', :id => @news}, :id => "add_comment_form", :style => "display:none;") do %> +<%= form_tag({:controller => 'comments', :action => 'create', :id => @news}, :id => "add_comment_form", :style => "display:none;") do %> <div class="box"> <%= text_area 'comment', 'comments', :cols => 80, :rows => 15, :class => 'wiki-edit' %> <%= wikitoolbar_for 'comment_comments' %> diff --git a/app/views/projects/_edit.html.erb b/app/views/projects/_edit.html.erb index e52baa116..211762903 100644 --- a/app/views/projects/_edit.html.erb +++ b/app/views/projects/_edit.html.erb @@ -1,4 +1,4 @@ -<% labelled_form_for @project do |f| %> +<%= labelled_form_for @project do |f| %> <%= render :partial => 'form', :locals => { :f => f } %> <%= submit_tag l(:button_save) %> <% end %> diff --git a/app/views/projects/copy.html.erb b/app/views/projects/copy.html.erb index 66f6d3353..26ec2e5a6 100644 --- a/app/views/projects/copy.html.erb +++ b/app/views/projects/copy.html.erb @@ -1,6 +1,6 @@ <h2><%=l(:label_project_new)%></h2> -<% labelled_form_for @project, :url => { :action => "copy" } do |f| %> +<%= labelled_form_for @project, :url => { :action => "copy" } do |f| %> <%= render :partial => 'form', :locals => { :f => f } %> <fieldset class="box tabular"><legend><%= l(:button_copy) %></legend> diff --git a/app/views/projects/destroy.html.erb b/app/views/projects/destroy.html.erb index 23844ec67..d4348b040 100644 --- a/app/views/projects/destroy.html.erb +++ b/app/views/projects/destroy.html.erb @@ -8,7 +8,7 @@ <% end %> </p> <p> - <% form_tag(project_path(@project_to_destroy), :method => :delete) do %> + <%= form_tag(project_path(@project_to_destroy), :method => :delete) do %> <label><%= check_box_tag 'confirm', 1 %> <%= l(:general_text_Yes) %></label> <%= submit_tag l(:button_delete) %> <% end %> diff --git a/app/views/projects/index.html.erb b/app/views/projects/index.html.erb index b7cd8e6e8..42b400ff7 100644 --- a/app/views/projects/index.html.erb +++ b/app/views/projects/index.html.erb @@ -4,7 +4,7 @@ <div class="contextual"> <%= link_to(l(:label_project_new), {:controller => 'projects', :action => 'new'}, :class => 'icon icon-add') + ' |' if User.current.allowed_to?(:add_project, nil, :global => true) %> - <%= link_to(l(:label_issue_view_all), { :controller => 'issues' }) + ' |' if User.current.allowed_to?(:view_issues, nil, :global => true) %> + <%= link_to(l(:label_issue_view_all), issues_path) + ' |' if User.current.allowed_to?(:view_issues, nil, :global => true) %> <%= link_to(l(:label_overall_spent_time), time_entries_path) + ' |' if User.current.allowed_to?(:view_time_entries, nil, :global => true) %> <%= link_to l(:label_overall_activity), { :controller => 'activities', :action => 'index', diff --git a/app/views/projects/new.html.erb b/app/views/projects/new.html.erb index deca4e344..062073c5d 100644 --- a/app/views/projects/new.html.erb +++ b/app/views/projects/new.html.erb @@ -1,6 +1,6 @@ <h2><%=l(:label_project_new)%></h2> -<% labelled_form_for @project do |f| %> +<%= labelled_form_for @project do |f| %> <%= render :partial => 'form', :locals => { :f => f } %> <%= submit_tag l(:button_create) %> <%= submit_tag l(:button_create_and_continue), :name => 'continue' %> diff --git a/app/views/projects/settings/_activities.html.erb b/app/views/projects/settings/_activities.html.erb index 296737dd5..0331cc8ac 100644 --- a/app/views/projects/settings/_activities.html.erb +++ b/app/views/projects/settings/_activities.html.erb @@ -1,4 +1,4 @@ -<% form_tag(project_enumerations_path(@project), :method => :put, :class => "tabular") do %> +<%= form_tag(project_enumerations_path(@project), :method => :put, :class => "tabular") do %> <table class="list"> <thead><tr> @@ -11,7 +11,7 @@ </tr></thead> <% @project.activities(true).each do |enumeration| %> - <% fields_for "enumerations[#{enumeration.id}]", enumeration do |ff| %> + <%= fields_for "enumerations[#{enumeration.id}]", enumeration do |ff| %> <tr class="<%= cycle('odd', 'even') %>"> <td> <%= ff.hidden_field :parent_id, :value => enumeration.id unless enumeration.project %> diff --git a/app/views/projects/settings/_modules.html.erb b/app/views/projects/settings/_modules.html.erb index 437ea5e2e..e955d63f0 100644 --- a/app/views/projects/settings/_modules.html.erb +++ b/app/views/projects/settings/_modules.html.erb @@ -1,4 +1,4 @@ -<% form_for :project, @project, +<%= form_for @project, :url => { :action => 'modules', :id => @project }, :html => {:id => 'modules-form', :method => :post} do |f| %> diff --git a/app/views/projects/show.html.erb b/app/views/projects/show.html.erb index 5371bc4c8..4963ebbe4 100644 --- a/app/views/projects/show.html.erb +++ b/app/views/projects/show.html.erb @@ -12,7 +12,7 @@ </div> <ul> <% unless @project.homepage.blank? %> - <li><%=l(:field_homepage)%>: <%= auto_link(h(@project.homepage)).html_safe %></li> + <li><%=l(:field_homepage)%>: <%= link_to h(@project.homepage), @project.homepage %></li> <% end %> <% if @subprojects.any? %> <li><%=l(:label_subproject_plural)%>: @@ -69,8 +69,8 @@ <% if @total_hours.present? %> <h3><%= l(:label_spent_time) %></h3> <p><span class="icon icon-time"><%= l_hours(@total_hours) %></span></p> - <p><%= link_to(l(:label_details), {:controller => 'timelog', :action => 'index', :project_id => @project}) %> | - <%= link_to(l(:label_report), {:controller => 'timelog', :action => 'report', :project_id => @project}) %></p> + <p><%= link_to(l(:label_details), project_time_entries_path(@project)) %> | + <%= link_to(l(:label_report), report_project_time_entries_path(@project)) %></p> <% end %> <%= call_hook(:view_projects_show_sidebar_bottom, :project => @project) %> <% end %> diff --git a/app/views/queries/_filters.html.erb b/app/views/queries/_filters.html.erb index ff84d8544..5bc6af2f3 100644 --- a/app/views/queries/_filters.html.erb +++ b/app/views/queries/_filters.html.erb @@ -5,7 +5,7 @@ <% query.available_filters.sort{|a,b| a[1][:order]<=>b[1][:order]}.each do |filter| %> <% field = filter[0] options = filter[1] %> - <tr <%= 'style="display:none;"' unless query.has_filter?(field) %> id="tr_<%= field %>" class="filter"> + <tr <%= 'style="display:none;"'.html_safe unless query.has_filter?(field) %> id="tr_<%= field %>" class="filter"> <td class="field"> <%= check_box_tag 'f[]', field, query.has_filter?(field), :onclick => "toggle_filter('#{field}');", :id => "cb_#{field}" %> <label for="cb_<%= field %>"><%= filter[1][:name] || l(("field_"+field.to_s.gsub(/\_id$/, "")).to_sym) %></label> diff --git a/app/views/queries/edit.html.erb b/app/views/queries/edit.html.erb index 610ae01c3..a1534f82d 100644 --- a/app/views/queries/edit.html.erb +++ b/app/views/queries/edit.html.erb @@ -1,6 +1,6 @@ <h2><%= l(:label_query) %></h2> -<% form_tag(query_path(@query), :onsubmit => 'selectAllOptions("selected_columns");', :method => :put) do %> +<%= form_tag(query_path(@query), :onsubmit => 'selectAllOptions("selected_columns");', :method => :put) do %> <%= render :partial => 'form', :locals => {:query => @query} %> <%= submit_tag l(:button_save) %> <% end %> diff --git a/app/views/queries/new.html.erb b/app/views/queries/new.html.erb index 2ec7f6600..7081eee24 100644 --- a/app/views/queries/new.html.erb +++ b/app/views/queries/new.html.erb @@ -1,6 +1,6 @@ <h2><%= l(:label_query_new) %></h2> -<% form_tag(@project ? project_queries_path : queries_path, :onsubmit => 'selectAllOptions("selected_columns");') do %> +<%= form_tag(@project ? project_queries_path(@project) : queries_path, :onsubmit => 'selectAllOptions("selected_columns");') do %> <%= render :partial => 'form', :locals => {:query => @query} %> <%= submit_tag l(:button_save) %> <% end %> diff --git a/app/views/repositories/_navigation.html.erb b/app/views/repositories/_navigation.html.erb index ba38fed1a..a42daa8f5 100644 --- a/app/views/repositories/_navigation.html.erb +++ b/app/views/repositories/_navigation.html.erb @@ -6,7 +6,7 @@ {:action => 'stats', :id => @project, :repository_id => @repository.identifier_param}, :class => 'icon icon-stats' if @repository.supports_all_revisions? %> -<% form_tag({:action => controller.action_name, +<%= form_tag({:action => controller.action_name, :id => @project, :repository_id => @repository.identifier_param, :path => to_path_param(@path), diff --git a/app/views/repositories/_revisions.html.erb b/app/views/repositories/_revisions.html.erb index e4a77388e..d3059520b 100644 --- a/app/views/repositories/_revisions.html.erb +++ b/app/views/repositories/_revisions.html.erb @@ -14,7 +14,7 @@ :space => graph_space } end %> -<% form_tag( +<%= form_tag( {:controller => 'repositories', :action => 'diff', :id => project, :repository_id => @repository.identifier_param, :path => to_path_param(path)}, :method => :get diff --git a/app/views/repositories/committers.html.erb b/app/views/repositories/committers.html.erb index f408d5382..a5426dfee 100644 --- a/app/views/repositories/committers.html.erb +++ b/app/views/repositories/committers.html.erb @@ -6,7 +6,7 @@ <p class="nodata"><%= l(:label_no_data) %></p> <% else %> -<% form_tag({}) do %> +<%= form_tag({}) do %> <table class="list"> <thead> <tr> diff --git a/app/views/repositories/diff.html.erb b/app/views/repositories/diff.html.erb index 738b4810a..ecd19ccf8 100644 --- a/app/views/repositories/diff.html.erb +++ b/app/views/repositories/diff.html.erb @@ -1,7 +1,7 @@ <h2><%= l(:label_revision) %> <%= @diff_format_revisions %> <%=h @path %></h2> <!-- Choose view type --> -<% form_tag({:path => to_path_param(@path)}, :method => 'get') do %> +<%= form_tag({:path => to_path_param(@path)}, :method => 'get') do %> <%= hidden_field_tag('rev', params[:rev]) if params[:rev] %> <%= hidden_field_tag('rev_to', params[:rev_to]) if params[:rev_to] %> <p> diff --git a/app/views/repositories/edit.html.erb b/app/views/repositories/edit.html.erb index 7a8d7d190..78105acaa 100644 --- a/app/views/repositories/edit.html.erb +++ b/app/views/repositories/edit.html.erb @@ -1,5 +1,5 @@ <h2><%= l(:label_repository) %></h2> -<% labelled_form_for :repository, @repository, :url => repository_path(@path), :html => {:method => :put} do |f| %> +<%= labelled_form_for :repository, @repository, :url => repository_path(@path), :html => {:method => :put} do |f| %> <%= render :partial => 'form', :locals => {:f => f} %> <% end %> diff --git a/app/views/repositories/new.html.erb b/app/views/repositories/new.html.erb index 996404229..9f40c542f 100644 --- a/app/views/repositories/new.html.erb +++ b/app/views/repositories/new.html.erb @@ -1,5 +1,5 @@ <h2><%= l(:label_repository_new) %></h2> -<% labelled_form_for :repository, @repository, :url => project_repositories_path(@project) do |f| %> +<%= labelled_form_for :repository, @repository, :url => project_repositories_path(@project) do |f| %> <%= render :partial => 'form', :locals => {:f => f} %> <% end %> diff --git a/app/views/repositories/revision.html.erb b/app/views/repositories/revision.html.erb index 4e7ad4c2a..c1e2413e1 100644 --- a/app/views/repositories/revision.html.erb +++ b/app/views/repositories/revision.html.erb @@ -13,7 +13,7 @@ <% end -%> » - <% form_tag({:controller => 'repositories', + <%= form_tag({:controller => 'repositories', :action => 'revision', :id => @project, :repository_id => @repository.identifier_param, diff --git a/app/views/repositories/revisions.html.erb b/app/views/repositories/revisions.html.erb index e2878fb7b..0395e4b96 100644 --- a/app/views/repositories/revisions.html.erb +++ b/app/views/repositories/revisions.html.erb @@ -1,6 +1,6 @@ <div class="contextual"> -<% form_tag( - {:action => 'revision', :id => @project, +<%= form_tag( + {:controller => 'repositories', :action => 'revision', :id => @project, :repository_id => @repository.identifier_param} ) do %> <%= l(:label_revision) %>: <%= text_field_tag 'rev', @rev, :size => 8 %> diff --git a/app/views/roles/edit.html.erb b/app/views/roles/edit.html.erb index 3bb07c08f..7caca3002 100644 --- a/app/views/roles/edit.html.erb +++ b/app/views/roles/edit.html.erb @@ -1,6 +1,6 @@ <h2><%= link_to l(:label_role_plural), roles_path %> » <%=h @role.name %></h2> -<% labelled_form_for @role do |f| %> +<%= labelled_form_for @role do |f| %> <%= render :partial => 'form', :locals => { :f => f } %> <%= submit_tag l(:button_save) %> <% end %> diff --git a/app/views/roles/new.html.erb b/app/views/roles/new.html.erb index 77f31a7c0..0e5dfeb9c 100644 --- a/app/views/roles/new.html.erb +++ b/app/views/roles/new.html.erb @@ -1,6 +1,6 @@ <h2><%= link_to l(:label_role_plural), roles_path %> » <%=l(:label_role_new)%></h2> -<% labelled_form_for @role do |f| %> +<%= labelled_form_for @role do |f| %> <%= render :partial => 'form', :locals => { :f => f } %> <%= submit_tag l(:button_create) %> <% end %> diff --git a/app/views/roles/permissions.html.erb b/app/views/roles/permissions.html.erb index da8e1ad8b..af78715e0 100644 --- a/app/views/roles/permissions.html.erb +++ b/app/views/roles/permissions.html.erb @@ -1,6 +1,6 @@ <h2><%= link_to l(:label_role_plural), roles_path %> » <%=l(:label_permissions_report)%></h2> -<% form_tag(permissions_roles_path, :id => 'permissions_form') do %> +<%= form_tag(permissions_roles_path, :id => 'permissions_form') do %> <%= hidden_field_tag 'permissions[0]', '', :id => nil %> <div class="autoscroll"> <table class="list permissions"> diff --git a/app/views/search/index.html.erb b/app/views/search/index.html.erb index 7d24710bd..6c9c56f4c 100644 --- a/app/views/search/index.html.erb +++ b/app/views/search/index.html.erb @@ -1,7 +1,7 @@ <h2><%= l(:label_search) %></h2> <div class="box"> -<% form_tag({}, :method => :get) do %> +<%= form_tag({}, :method => :get) do %> <%= label_tag "search-input", l(:description_search), :class => "hidden-for-sighted" %> <p><%= text_field_tag 'q', @question, :size => 60, :id => 'search-input' %> <%= javascript_tag "Field.focus('search-input')" %> diff --git a/app/views/settings/_authentication.html.erb b/app/views/settings/_authentication.html.erb index 14396e274..fe27e3d88 100644 --- a/app/views/settings/_authentication.html.erb +++ b/app/views/settings/_authentication.html.erb @@ -1,4 +1,4 @@ -<% form_tag({:action => 'edit', :tab => 'authentication'}) do %> +<%= form_tag({:action => 'edit', :tab => 'authentication'}) do %> <div class="box tabular settings"> <p><%= setting_check_box :login_required %></p> diff --git a/app/views/settings/_display.html.erb b/app/views/settings/_display.html.erb index 25f65fc56..3299ff10b 100644 --- a/app/views/settings/_display.html.erb +++ b/app/views/settings/_display.html.erb @@ -1,4 +1,4 @@ -<% form_tag({:action => 'edit', :tab => 'display'}) do %> +<%= form_tag({:action => 'edit', :tab => 'display'}) do %> <div class="box tabular settings"> <p><%= setting_select :ui_theme, Redmine::Themes.themes.collect {|t| [t.name, t.id]}, :blank => :label_default, :label => :label_theme %></p> diff --git a/app/views/settings/_general.html.erb b/app/views/settings/_general.html.erb index befec041c..4ec01995a 100644 --- a/app/views/settings/_general.html.erb +++ b/app/views/settings/_general.html.erb @@ -1,4 +1,4 @@ -<% form_tag({:action => 'edit'}) do %> +<%= form_tag({:action => 'edit'}) do %> <div class="box tabular settings"> <p><%= setting_text_field :app_title, :size => 30 %></p> diff --git a/app/views/settings/_issues.html.erb b/app/views/settings/_issues.html.erb index 2ffa21113..429685638 100644 --- a/app/views/settings/_issues.html.erb +++ b/app/views/settings/_issues.html.erb @@ -1,4 +1,4 @@ -<% form_tag({:action => 'edit', :tab => 'issues'}) do %> +<%= form_tag({:action => 'edit', :tab => 'issues'}) do %> <div class="box tabular settings"> <p><%= setting_check_box :cross_project_issue_relations %></p> diff --git a/app/views/settings/_mail_handler.html.erb b/app/views/settings/_mail_handler.html.erb index 3da977353..e4ddf5e99 100644 --- a/app/views/settings/_mail_handler.html.erb +++ b/app/views/settings/_mail_handler.html.erb @@ -1,4 +1,4 @@ -<% form_tag({:action => 'edit', :tab => 'mail_handler'}) do %> +<%= form_tag({:action => 'edit', :tab => 'mail_handler'}) do %> <div class="box tabular settings"> <p> diff --git a/app/views/settings/_notifications.html.erb b/app/views/settings/_notifications.html.erb index 26c11ad9a..f746f7ced 100644 --- a/app/views/settings/_notifications.html.erb +++ b/app/views/settings/_notifications.html.erb @@ -1,5 +1,5 @@ <% if @deliveries %> -<% form_tag({:action => 'edit', :tab => 'notifications'}) do %> +<%= form_tag({:action => 'edit', :tab => 'notifications'}) do %> <div class="box tabular settings"> <p><%= setting_text_field :mail_from, :size => 60 %></p> diff --git a/app/views/settings/_projects.html.erb b/app/views/settings/_projects.html.erb index f61a0055d..90db6b1ce 100644 --- a/app/views/settings/_projects.html.erb +++ b/app/views/settings/_projects.html.erb @@ -1,4 +1,4 @@ -<% form_tag({:action => 'edit', :tab => 'projects'}) do %> +<%= form_tag({:action => 'edit', :tab => 'projects'}) do %> <div class="box tabular settings"> <p><%= setting_check_box :default_projects_public %></p> diff --git a/app/views/settings/_repositories.html.erb b/app/views/settings/_repositories.html.erb index 9593a14c4..d63c1db45 100644 --- a/app/views/settings/_repositories.html.erb +++ b/app/views/settings/_repositories.html.erb @@ -1,4 +1,4 @@ -<% form_tag({:action => 'edit', :tab => 'repositories'}) do %> +<%= form_tag({:action => 'edit', :tab => 'repositories'}) do %> <fieldset class="box settings enabled_scm"> <%= hidden_field_tag 'settings[enabled_scm][]', '' %> diff --git a/app/views/settings/plugin.html.erb b/app/views/settings/plugin.html.erb index 61913484d..155f80c22 100644 --- a/app/views/settings/plugin.html.erb +++ b/app/views/settings/plugin.html.erb @@ -1,7 +1,7 @@ <h2><%= l(:label_settings) %>: <%=h @plugin.name %></h2> <div id="settings"> -<% form_tag({:action => 'plugin'}) do %> +<%= form_tag({:action => 'plugin'}) do %> <div class="box tabular"> <%= render :partial => @partial, :locals => {:settings => @settings}%> </div> diff --git a/app/views/timelog/_date_range.html.erb b/app/views/timelog/_date_range.html.erb index 95e604dcf..086f78bc2 100644 --- a/app/views/timelog/_date_range.html.erb +++ b/app/views/timelog/_date_range.html.erb @@ -31,8 +31,8 @@ <% url_params = @free_period ? { :from => @from, :to => @to } : { :period => params[:period] } %> <ul> <li><%= link_to(l(:label_details), url_params.merge({:controller => 'timelog', :action => 'index', :project_id => @project, :issue_id => @issue }), - :class => (@controller.action_name == 'index' ? 'selected' : nil)) %></li> + :class => (action_name == 'index' ? 'selected' : nil)) %></li> <li><%= link_to(l(:label_report), url_params.merge({:controller => 'timelog', :action => 'report', :project_id => @project, :issue_id => @issue}), - :class => (@controller.action_name == 'report' ? 'selected' : nil)) %></li> + :class => (action_name == 'report' ? 'selected' : nil)) %></li> </ul> </div> diff --git a/app/views/timelog/_list.html.erb b/app/views/timelog/_list.html.erb index 4e86d7833..e916756c9 100644 --- a/app/views/timelog/_list.html.erb +++ b/app/views/timelog/_list.html.erb @@ -1,4 +1,4 @@ -<% form_tag({}) do -%> +<%= form_tag({}) do -%> <%= hidden_field_tag 'back_url', url_for(params) %> <div class="autoscroll"> <table class="list time-entries"> diff --git a/app/views/timelog/bulk_edit.html.erb b/app/views/timelog/bulk_edit.html.erb index de1f9a365..dc0bd92f3 100644 --- a/app/views/timelog/bulk_edit.html.erb +++ b/app/views/timelog/bulk_edit.html.erb @@ -7,7 +7,7 @@ )}.join("\n").html_safe %> </ul> -<% form_tag(:action => 'bulk_update') do %> +<%= form_tag(:action => 'bulk_update') do %> <%= @time_entries.collect {|i| hidden_field_tag('ids[]', i.id)}.join.html_safe %> <div class="box tabular"> <div> diff --git a/app/views/timelog/edit.html.erb b/app/views/timelog/edit.html.erb index e5586e19a..db2e73cd5 100644 --- a/app/views/timelog/edit.html.erb +++ b/app/views/timelog/edit.html.erb @@ -1,6 +1,6 @@ <h2><%= l(:label_spent_time) %></h2> -<% labelled_form_for @time_entry, :url => project_time_entry_path(@time_entry.project, @time_entry) do |f| %> +<%= labelled_form_for @time_entry, :url => project_time_entry_path(@time_entry.project, @time_entry) do |f| %> <%= render :partial => 'form', :locals => {:f => f} %> <%= submit_tag l(:button_save) %> <% end %> diff --git a/app/views/timelog/index.html.erb b/app/views/timelog/index.html.erb index c3a63436e..52c9118e7 100644 --- a/app/views/timelog/index.html.erb +++ b/app/views/timelog/index.html.erb @@ -8,7 +8,7 @@ <h2><%= l(:label_spent_time) %></h2> -<% form_tag({:controller => 'timelog', :action => 'index', :project_id => @project, :issue_id => @issue}, :method => :get, :id => 'query_form') do %> +<%= form_tag({:controller => 'timelog', :action => 'index', :project_id => @project, :issue_id => @issue}, :method => :get, :id => 'query_form') do %> <%= render :partial => 'date_range' %> <% end %> diff --git a/app/views/timelog/new.html.erb b/app/views/timelog/new.html.erb index f37574397..84bf7dae1 100644 --- a/app/views/timelog/new.html.erb +++ b/app/views/timelog/new.html.erb @@ -1,6 +1,6 @@ <h2><%= l(:label_spent_time) %></h2> -<% labelled_form_for @time_entry, :url => time_entries_path do |f| %> +<%= labelled_form_for @time_entry, :url => time_entries_path do |f| %> <%= render :partial => 'form', :locals => {:f => f} %> <%= submit_tag l(:button_create) %> <%= submit_tag l(:button_create_and_continue), :name => 'continue' %> diff --git a/app/views/timelog/report.html.erb b/app/views/timelog/report.html.erb index 960d41b72..4b9f0befe 100644 --- a/app/views/timelog/report.html.erb +++ b/app/views/timelog/report.html.erb @@ -6,7 +6,9 @@ <h2><%= l(:label_spent_time) %></h2> -<% form_tag({:controller => 'timelog', :action => 'report', :project_id => @project, :issue_id => @issue}, :method => :get, :id => 'query_form') do %> +<%= form_tag({:controller => 'timelog', :action => 'report', + :project_id => @project, :issue_id => @issue}, + :method => :get, :id => 'query_form') do %> <% @report.criteria.each do |criterion| %> <%= hidden_field_tag 'criteria[]', criterion, :id => nil %> <% end %> diff --git a/app/views/trackers/edit.html.erb b/app/views/trackers/edit.html.erb index b553704a0..76744c403 100644 --- a/app/views/trackers/edit.html.erb +++ b/app/views/trackers/edit.html.erb @@ -1,5 +1,5 @@ <h2><%= link_to l(:label_tracker_plural), trackers_path %> » <%=h @tracker %></h2> -<% labelled_form_for @tracker do |f| %> +<%= labelled_form_for @tracker do |f| %> <%= render :partial => 'form', :locals => { :f => f } %> <% end %> diff --git a/app/views/trackers/new.html.erb b/app/views/trackers/new.html.erb index e48525793..7bd8c6a00 100644 --- a/app/views/trackers/new.html.erb +++ b/app/views/trackers/new.html.erb @@ -1,5 +1,5 @@ <h2><%= link_to l(:label_tracker_plural), trackers_path %> » <%=l(:label_tracker_new)%></h2> -<% labelled_form_for @tracker do |f| %> +<%= labelled_form_for @tracker do |f| %> <%= render :partial => 'form', :locals => { :f => f } %> <% end %> diff --git a/app/views/users/_general.html.erb b/app/views/users/_general.html.erb index b332e856e..0daa421c7 100644 --- a/app/views/users/_general.html.erb +++ b/app/views/users/_general.html.erb @@ -1,4 +1,4 @@ -<% labelled_form_for @user do |f| %> +<%= labelled_form_for @user do |f| %> <%= render :partial => 'form', :locals => { :f => f } %> <% if @user.active? && email_delivery_enabled? -%> <p><label><%= check_box_tag 'send_information', 1, true %> <%= l(:label_send_information) %></label></p> diff --git a/app/views/users/_groups.html.erb b/app/views/users/_groups.html.erb index 0ab2f11eb..e24296ef0 100644 --- a/app/views/users/_groups.html.erb +++ b/app/views/users/_groups.html.erb @@ -1,4 +1,4 @@ -<% form_for(:user, :url => { :action => 'update' }, :html => {:method => :put}) do %> +<%= form_for(:user, :url => { :action => 'update' }, :html => {:method => :put}) do %> <div class="box"> <% Group.all.sort.each do |group| %> <label><%= check_box_tag 'user[group_ids][]', group.id, @user.groups.include?(group) %> <%=h group %></label><br /> diff --git a/app/views/users/_memberships.html.erb b/app/views/users/_memberships.html.erb index 51fb11106..a480d2ac7 100644 --- a/app/views/users/_memberships.html.erb +++ b/app/views/users/_memberships.html.erb @@ -19,8 +19,10 @@ </td> <td class="roles"> <span id="member-<%= membership.id %>-roles"><%=h membership.roles.sort.collect(&:to_s).join(', ') %></span> - <% remote_form_for(:membership, :url => user_membership_path(@user, membership), :method => :put, - :html => { :id => "member-#{membership.id}-roles-form", :style => 'display:none;'}) do %> + <%= form_for(:membership, :remote => true, + :url => user_membership_path(@user, membership), :method => :put, + :html => {:id => "member-#{membership.id}-roles-form", + :style => 'display:none;'}) do %> <p><% roles.each do |role| %> <label><%= check_box_tag 'membership[role_ids][]', role.id, membership.roles.include?(role), :disabled => membership.member_roles.detect {|mr| mr.role_id == role.id && !mr.inherited_from.nil?} %> <%=h role %></label><br /> @@ -57,7 +59,7 @@ <div class="splitcontentright"> <% if projects.any? %> <fieldset><legend><%=l(:label_project_new)%></legend> -<% remote_form_for(:membership, :url => user_memberships_path(@user)) do %> +<%= form_for(:membership, :remote => true, :url => user_memberships_path(@user)) do %> <%= select_tag 'membership[project_id]', options_for_membership_project_select(@user, projects) %> <p><%= l(:label_role_plural) %>: <% roles.each do |role| %> diff --git a/app/views/users/_preferences.html.erb b/app/views/users/_preferences.html.erb index a5a0e5cb1..26e83b123 100644 --- a/app/views/users/_preferences.html.erb +++ b/app/views/users/_preferences.html.erb @@ -1,4 +1,4 @@ -<% labelled_fields_for :pref, @user.pref do |pref_fields| %> +<%= labelled_fields_for :pref, @user.pref do |pref_fields| %> <p><%= pref_fields.check_box :hide_mail %></p> <p><%= pref_fields.select :time_zone, ActiveSupport::TimeZone.all.collect {|z| [ z.to_s, z.name ]}, :include_blank => true %></p> <p><%= pref_fields.select :comments_sorting, [[l(:label_chronological_order), 'asc'], [l(:label_reverse_chronological_order), 'desc']] %></p> diff --git a/app/views/users/index.html.erb b/app/views/users/index.html.erb index 3decdc971..d23be4ad2 100644 --- a/app/views/users/index.html.erb +++ b/app/views/users/index.html.erb @@ -4,7 +4,7 @@ <h2><%=l(:label_user_plural)%></h2> -<% form_tag({}, :method => :get) do %> +<%= form_tag({}, :method => :get) do %> <fieldset><legend><%= l(:label_filter_plural) %></legend> <label for='status'><%= l(:field_status) %>:</label> <%= select_tag 'status', users_status_options_for_select(@status), :class => "small", :onchange => "this.form.submit(); return false;" %> diff --git a/app/views/users/new.html.erb b/app/views/users/new.html.erb index eb8a9f93d..3eecf4a20 100644 --- a/app/views/users/new.html.erb +++ b/app/views/users/new.html.erb @@ -1,6 +1,6 @@ <h2><%= link_to l(:label_user_plural), users_path %> » <%=l(:label_user_new)%></h2> -<% labelled_form_for @user do |f| %> +<%= labelled_form_for @user do |f| %> <%= render :partial => 'form', :locals => { :f => f } %> <% if email_delivery_enabled? %> <p><label><%= check_box_tag 'send_information', 1, true %> <%= l(:label_send_information) %></label></p> diff --git a/app/views/versions/_issue_counts.html.erb b/app/views/versions/_issue_counts.html.erb index 78b77e408..e4bb6e666 100644 --- a/app/views/versions/_issue_counts.html.erb +++ b/app/views/versions/_issue_counts.html.erb @@ -1,4 +1,4 @@ -<% form_tag({}, :id => "status_by_form") do -%> +<%= form_tag({}, :id => "status_by_form") do -%> <fieldset> <legend> <%= l(:label_issues_by, diff --git a/app/views/versions/_new_modal.html.erb b/app/views/versions/_new_modal.html.erb index 8b58883c8..cd51fdc93 100644 --- a/app/views/versions/_new_modal.html.erb +++ b/app/views/versions/_new_modal.html.erb @@ -1,6 +1,6 @@ <h3 class="title"><%=l(:label_version_new)%></h3> -<% labelled_remote_form_for @version, :url => project_versions_path(@project) do |f| %> +<%= labelled_remote_form_for :version, @version, :url => project_versions_path(@project) do |f| %> <%= render :partial => 'versions/form', :locals => { :f => f } %> <p class="buttons"> <%= submit_tag l(:button_create), :name => nil %> diff --git a/app/views/versions/edit.html.erb b/app/views/versions/edit.html.erb index 6c8f5a579..3c67f09c0 100644 --- a/app/views/versions/edit.html.erb +++ b/app/views/versions/edit.html.erb @@ -1,6 +1,6 @@ <h2><%=l(:label_version)%></h2> -<% labelled_form_for @version do |f| %> +<%= labelled_form_for @version do |f| %> <%= render :partial => 'form', :locals => { :f => f } %> <%= submit_tag l(:button_save) %> <% end %> diff --git a/app/views/versions/index.html.erb b/app/views/versions/index.html.erb index 71a756ea7..d8ac53401 100644 --- a/app/views/versions/index.html.erb +++ b/app/views/versions/index.html.erb @@ -14,7 +14,7 @@ <%= render(:partial => "wiki/content", :locals => {:content => version.wiki_page.content}) if version.wiki_page %> <% if (issues = @issues_by_version[version]) && issues.size > 0 %> - <% form_tag({}) do -%> + <%= form_tag({}) do -%> <table class="list related-issues"> <caption><%= l(:label_related_issues) %></caption> <% issues.each do |issue| -%> @@ -32,7 +32,7 @@ <% end %> <% content_for :sidebar do %> -<% form_tag({}, :method => :get) do %> +<%= form_tag({}, :method => :get) do %> <h3><%= l(:label_roadmap) %></h3> <% @trackers.each do |tracker| %> <label><%= check_box_tag "tracker_ids[]", tracker.id, (@selected_tracker_ids.include? tracker.id.to_s), :id => nil %> diff --git a/app/views/versions/new.html.erb b/app/views/versions/new.html.erb index 2a51957a1..c63edade7 100644 --- a/app/views/versions/new.html.erb +++ b/app/views/versions/new.html.erb @@ -1,6 +1,6 @@ <h2><%=l(:label_version_new)%></h2> -<% labelled_form_for @version, :url => project_versions_path(@project) do |f| %> +<%= labelled_form_for @version, :url => project_versions_path(@project) do |f| %> <%= render :partial => 'versions/form', :locals => { :f => f } %> <%= submit_tag l(:button_create) %> <% end %> diff --git a/app/views/versions/show.html.erb b/app/views/versions/show.html.erb index 07ae0b1cc..f44e3f272 100644 --- a/app/views/versions/show.html.erb +++ b/app/views/versions/show.html.erb @@ -36,7 +36,7 @@ </div> <% if @issues.present? %> -<% form_tag({}) do -%> +<%= form_tag({}) do -%> <table class="list related-issues"> <caption><%= l(:label_related_issues) %></caption> <%- @issues.each do |issue| -%> diff --git a/app/views/watchers/_new.html.erb b/app/views/watchers/_new.html.erb index c2c133ee7..4220776f3 100644 --- a/app/views/watchers/_new.html.erb +++ b/app/views/watchers/_new.html.erb @@ -1,6 +1,6 @@ <h3 class="title"><%= l(:permission_add_issue_watchers) %></h3> -<% form_remote_tag :url => {:controller => 'watchers', +<%= form_remote_tag :url => {:controller => 'watchers', :action => (watched ? 'create' : 'append'), :object_type => watched.class.name.underscore, :object_id => watched}, diff --git a/app/views/wiki/_sidebar.html.erb b/app/views/wiki/_sidebar.html.erb index 9a24963f2..b4034d88b 100644 --- a/app/views/wiki/_sidebar.html.erb +++ b/app/views/wiki/_sidebar.html.erb @@ -6,4 +6,4 @@ <%= link_to l(:field_start_page), {:action => 'show', :id => nil} %><br /> <%= link_to l(:label_index_by_title), {:action => 'index'} %><br /> -<%= link_to l(:label_index_by_date), {:action => 'date_index'} %><br /> +<%= link_to l(:label_index_by_date), {:controller => 'wiki', :project_id => @project, :action => 'date_index'} %><br /> diff --git a/app/views/wiki/destroy.html.erb b/app/views/wiki/destroy.html.erb index a3cc476bf..05c0fd56d 100644 --- a/app/views/wiki/destroy.html.erb +++ b/app/views/wiki/destroy.html.erb @@ -2,7 +2,7 @@ <h2><%=h @page.pretty_title %></h2> -<% form_tag({}, :method => :delete) do %> +<%= form_tag({}, :method => :delete) do %> <div class="box"> <p><strong><%= l(:text_wiki_page_destroy_question, :descendants => @descendants_count) %></strong></p> <p><label><%= radio_button_tag 'todo', 'nullify', true %> <%= l(:text_wiki_page_nullify_children) %></label><br /> diff --git a/app/views/wiki/edit.html.erb b/app/views/wiki/edit.html.erb index 281657990..51d8ab94e 100644 --- a/app/views/wiki/edit.html.erb +++ b/app/views/wiki/edit.html.erb @@ -2,7 +2,7 @@ <h2><%= h @page.pretty_title %></h2> -<% form_for :content, @content, +<%= form_for @content, :as => :content, :url => {:action => 'update', :id => @page.title}, :html => {:method => :put, :multipart => true, :id => 'wiki_form'} do |f| %> <%= f.hidden_field :version %> @@ -16,10 +16,10 @@ <%= text_area_tag 'content[text]', @text, :cols => 100, :rows => 25, :class => 'wiki-edit', :accesskey => accesskey(:edit) %> <% if @page.safe_attribute_names.include?('parent_id') && @wiki.pages.any? %> - <% fields_for @page do |fp| %> + <%= fields_for @page do |fp| %> <p> <label><%= l(:field_parent_title) %></label> - <%= fp.select :parent_id, "<option value=''></option>" + wiki_page_options_for_select(@wiki.pages.all(:include => :parent) - @page.self_and_descendants, @page.parent) %> + <%= fp.select :parent_id, content_tag('option', '', :value => '') + wiki_page_options_for_select(@wiki.pages.all(:include => :parent) - @page.self_and_descendants, @page.parent) %> </p> <% end %> <% end %> diff --git a/app/views/wiki/history.html.erb b/app/views/wiki/history.html.erb index cfbf64154..fa9effd1a 100644 --- a/app/views/wiki/history.html.erb +++ b/app/views/wiki/history.html.erb @@ -4,7 +4,9 @@ <h3><%= l(:label_history) %></h3> -<% form_tag({:controller => 'wiki', :action => 'diff', :project_id => @page.project, :id => @page.title}, :method => :get) do %> +<%= form_tag({:controller => 'wiki', :action => 'diff', + :project_id => @page.project, :id => @page.title}, + :method => :get) do %> <table class="list wiki-page-versions"> <thead><tr> <th>#</th> diff --git a/app/views/wiki/rename.html.erb b/app/views/wiki/rename.html.erb index fea76383a..86385a94b 100644 --- a/app/views/wiki/rename.html.erb +++ b/app/views/wiki/rename.html.erb @@ -4,14 +4,14 @@ <%= error_messages_for 'page' %> -<% labelled_form_for :wiki_page, @page, +<%= labelled_form_for :wiki_page, @page, :url => { :action => 'rename' }, :html => { :method => :post } do |f| %> <div class="box tabular"> <p><%= f.text_field :title, :required => true, :size => 100 %></p> <p><%= f.check_box :redirect_existing_links %></p> <p><%= f.select :parent_id, - "<option value=''></option>" + + content_tag('option', '', :value => '') + wiki_page_options_for_select( @wiki.pages.all(:include => :parent) - @page.self_and_descendants, @page.parent), diff --git a/app/views/wiki/show.html.erb b/app/views/wiki/show.html.erb index 19215bb98..0ef8fc869 100644 --- a/app/views/wiki/show.html.erb +++ b/app/views/wiki/show.html.erb @@ -42,7 +42,10 @@ <div id="wiki_add_attachment"> <p><%= link_to l(:label_attachment_new), {}, :onclick => "Element.show('add_attachment_form'); Element.hide(this); Element.scrollTo('add_attachment_form'); return false;", :id => 'attach_files_link' %></p> -<% form_tag({ :controller => 'wiki', :action => 'add_attachment', :project_id => @project, :id => @page.title }, :multipart => true, :id => "add_attachment_form", :style => "display:none;") do %> +<%= form_tag({:controller => 'wiki', :action => 'add_attachment', + :project_id => @project, :id => @page.title}, + :multipart => true, :id => "add_attachment_form", + :style => "display:none;") do %> <div class="box"> <p><%= render :partial => 'attachments/form' %></p> </div> diff --git a/app/views/wikis/destroy.html.erb b/app/views/wikis/destroy.html.erb index 75c0eac24..bc3360014 100644 --- a/app/views/wikis/destroy.html.erb +++ b/app/views/wikis/destroy.html.erb @@ -3,7 +3,7 @@ <div class="box"><center> <p><strong><%= h(@project.name) %></strong><br /><%=l(:text_wiki_destroy_confirmation)%></p> -<% form_tag({:controller => 'wikis', :action => 'destroy', :id => @project}) do %> +<%= form_tag({:controller => 'wikis', :action => 'destroy', :id => @project}) do %> <%= hidden_field_tag "confirm", 1 %> <%= submit_tag l(:button_delete) %> <% end %> diff --git a/app/views/workflows/copy.html.erb b/app/views/workflows/copy.html.erb index cbe13b42b..057e40367 100644 --- a/app/views/workflows/copy.html.erb +++ b/app/views/workflows/copy.html.erb @@ -2,7 +2,7 @@ <h2><%=l(:label_workflow)%></h2> -<% form_tag({}, :id => 'workflow_copy_form') do %> +<%= form_tag({}, :id => 'workflow_copy_form') do %> <fieldset class="tabular box"> <legend><%= l(:label_copy_source) %></legend> <p> diff --git a/app/views/workflows/edit.html.erb b/app/views/workflows/edit.html.erb index 8dc509904..20eaff992 100644 --- a/app/views/workflows/edit.html.erb +++ b/app/views/workflows/edit.html.erb @@ -4,7 +4,7 @@ <p><%=l(:text_workflow_edit)%>:</p> -<% form_tag({}, :method => 'get') do %> +<%= form_tag({}, :method => 'get') do %> <p> <label><%=l(:label_role)%>: <%= select_tag 'role_id', options_from_collection_for_select(@roles, "id", "name", @role && @role.id) %></label> @@ -21,7 +21,7 @@ <% end %> <% if @tracker && @role && @statuses.any? %> - <% form_tag({}, :id => 'workflow_form' ) do %> + <%= form_tag({}, :id => 'workflow_form' ) do %> <%= hidden_field_tag 'tracker_id', @tracker.id %> <%= hidden_field_tag 'role_id', @role.id %> <div class="autoscroll"> |