Merge branch 'szzh' into develop

This commit is contained in:
sw 2014-10-15 14:02:11 +08:00
commit 7d84ea70f2
69 changed files with 268 additions and 285 deletions

View File

@ -1,3 +0,0 @@
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/

View File

@ -1,3 +0,0 @@
// Place all the styles related to the WebFooterCompany controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/

View File

@ -66,7 +66,7 @@ class AccountController < ApplicationController
if @user.save
@token.destroy
flash[:notice] = l(:notice_account_password_updated)
redirect_to signin_path
redirect_to signin_url
return
end
end
@ -92,7 +92,7 @@ class AccountController < ApplicationController
Mailer.lost_password(token).deliver
end
flash[:notice] = l(:notice_account_lost_email_sent)
redirect_to signin_path
redirect_to signin_url
return
end
end
@ -136,7 +136,7 @@ class AccountController < ApplicationController
session[:auth_source_registration] = nil
self.logged_user = @user
flash[:notice] = l(:notice_account_activated)
redirect_to my_account_path
redirect_to my_account_url
end
else
@user.login = params[:user][:login]
@ -204,7 +204,7 @@ class AccountController < ApplicationController
token.destroy
flash[:notice] = l(:notice_account_activated)
end
redirect_to signin_path
redirect_to signin_url
end
def valid_ajax
@ -363,7 +363,7 @@ class AccountController < ApplicationController
UserStatus.create(:user_id => user.id, :changsets_count => 0, :watchers_count => 0)
Mailer.register(token).deliver
flash[:notice] = l(:notice_account_register_done)
redirect_to signin_path
redirect_to signin_url
else
yield if block_given?
end
@ -380,7 +380,7 @@ class AccountController < ApplicationController
UserStatus.create(:user_id => user.id, :changsets_count => 0, :watchers_count => 0)
self.logged_user = user
flash[:notice] = l(:notice_account_activated)
redirect_to my_account_path
redirect_to my_account_url
else
yield if block_given?
end
@ -402,6 +402,6 @@ class AccountController < ApplicationController
def account_pending
flash[:notice] = l(:notice_account_pending)
redirect_to signin_path
redirect_to signin_url
end
end

View File

@ -86,7 +86,7 @@ class AdminController < ApplicationController
flash[:error] = l(:error_can_t_load_default_data, e.message)
end
end
redirect_to admin_path
redirect_to admin_url
end
def test_email
@ -100,7 +100,7 @@ class AdminController < ApplicationController
flash[:error] = l(:notice_email_error, e.message)
end
ActionMailer::Base.raise_delivery_errors = raise_delivery_errors
redirect_to settings_path(:tab => 'notifications')
redirect_to settings_url(:tab => 'notifications')
end
def info
@ -159,7 +159,7 @@ class AdminController < ApplicationController
respond_to do |format|
flash[:notice] = l(:notice_successful_update)
format.html {
redirect_to admin_first_page_made_path
redirect_to admin_first_page_made_url
}
format.api { render_api_ok }
#format.json { render json: @first_page, status: :created, location: @first_page }
@ -194,7 +194,7 @@ class AdminController < ApplicationController
respond_to do |format|
format.html {
flash[:notice] = l(:notice_successful_update)
redirect_to admin_course_page_made_path
redirect_to admin_course_page_made_url
}
format.api { render_api_ok }
end
@ -217,11 +217,11 @@ class AdminController < ApplicationController
if request.get?
@contest_page = FirstPage.where("page_type = 'contest'").first
@first_page = FirstPage.where("page_type = 'project'").first
@notification = ContestNotification.all.first;
@notification = ContestNotification.first;
elsif request.post?
@first_page = FirstPage.where("page_type = 'project'").first
@contest_page = FirstPage.where("page_type = 'contest'").first
@notification = ContestNotification.all.first;
@notification = ContestNotification.first;
@first_page.web_title = params[:web_title]
@contest_page.web_title = params[:web_title]
@contest_page.title = params[:contest_title]
@ -235,7 +235,7 @@ class AdminController < ApplicationController
respond_to do |format|
format.html {
flash[:notice] = l(:notice_successful_update)
redirect_to admin_contest_page_made_path
redirect_to admin_contest_page_made_url
}
format.api { render_api_ok }
end
@ -254,13 +254,13 @@ class AdminController < ApplicationController
def web_footer_made
if request.get?
@organizer = WebFooterOranizer.all.first
@organizer = WebFooterOranizer.first
@first_page = FirstPage.where("page_type = 'project'").first
#@notification = ContestNotification.all.first;
elsif request.post?
@first_page = FirstPage.where("page_type = 'project'").first
@first_page.web_title = params[:web_title]
@organizer = WebFooterOranizer.all.first
@organizer = WebFooterOranizer.first
if @organizer.nil?
@organizer = WebFooterOranizer.new
end
@ -270,7 +270,7 @@ class AdminController < ApplicationController
respond_to do |format|
format.html {
flash[:notice] = l(:notice_successful_update)
redirect_to admin_web_footer_made_path
redirect_to admin_web_footer_made_url
}
format.api { render_api_ok }
end

View File

@ -209,8 +209,8 @@ class ApplicationController < ActionController::Base
url = url_for(:controller => params[:controller], :action => params[:action], :id => params[:id], :project_id => params[:project_id])
end
respond_to do |format|
format.html { redirect_to :controller => "account", :action => "login", :back_url => url }
format.atom { redirect_to :controller => "account", :action => "login", :back_url => url }
format.html { redirect_to signin_url }
format.atom { redirect_to signin_url }
format.xml { head :unauthorized, 'WWW-Authenticate' => 'Basic realm="Redmine API"' }
format.js { head :unauthorized, 'WWW-Authenticate' => 'Basic realm="Redmine API"' }
format.json { head :unauthorized, 'WWW-Authenticate' => 'Basic realm="Redmine API"' }
@ -763,7 +763,7 @@ class ApplicationController < ActionController::Base
end
def find_web_footer
@organize = WebFooterOranizer.all.first
@companys = WebFooterCompany.all
@organize = WebFooterOranizer.first
@companies = WebFooterCompany.all
end
end

View File

@ -36,7 +36,7 @@ class AuthSourcesController < ApplicationController
@auth_source = AuthSource.new_subclass_instance(params[:type], params[:auth_source])
if @auth_source.save
flash[:notice] = l(:notice_successful_create)
redirect_to auth_sources_path
redirect_to auth_sources_url
else
render :action => 'new'
end
@ -48,7 +48,7 @@ class AuthSourcesController < ApplicationController
def update
if @auth_source.update_attributes(params[:auth_source])
flash[:notice] = l(:notice_successful_update)
redirect_to auth_sources_path
redirect_to auth_sources_url
else
render :action => 'edit'
end
@ -61,7 +61,7 @@ class AuthSourcesController < ApplicationController
rescue Exception => e
flash[:error] = l(:error_unable_to_connect, e.message)
end
redirect_to auth_sources_path
redirect_to auth_sources_url
end
def destroy
@ -69,7 +69,7 @@ class AuthSourcesController < ApplicationController
@auth_source.destroy
flash[:notice] = l(:notice_successful_delete)
end
redirect_to auth_sources_path
redirect_to auth_sources_url
end
def autocomplete_for_new_user

View File

@ -612,9 +612,9 @@ class BidsController < ApplicationController
binding_project = params[:binding_project]
if can_delete_project_homework(BidingProject.find(binding_project),User.current)
if BidingProject.delete(binding_project)
redirect_to project_for_bid_path
redirect_to project_for_bid_url
else
redirect_to 403;
render_403;
end
end
end
@ -731,7 +731,7 @@ class BidsController < ApplicationController
flash[:notice] = l(:label_bid_succeed)
end
end
redirect_to respond_path(@bid)
redirect_to respond_url(@bid)
else
@bid.safe_attributes = params[:bid]
render :action => 'new_bid'
@ -755,7 +755,7 @@ class BidsController < ApplicationController
flash[:notice] = l(:label_bid_succeed)
end
end
redirect_to respond_path(@bid)
redirect_to respond_url(@bid)
else
@bid.safe_attributes = params[:bid]
render :action => 'new_bid'
@ -782,7 +782,7 @@ class BidsController < ApplicationController
flash[:notice] = l(:label_bid_succeed)
end
end
redirect_to respond_path(@bid)
redirect_to respond_url(@bid)
else
@bid.safe_attributes = params[:bid]
render :action => 'new_bid'
@ -811,7 +811,7 @@ class BidsController < ApplicationController
flash[:notice] = l(:label_bid_succeed)
end
end
redirect_to respond_path(@bid)
redirect_to respond_url(@bid)
else
@bid.safe_attributes = params[:bid]
@homework = @bid
@ -859,7 +859,7 @@ class BidsController < ApplicationController
@bid.save_attachments(params[:attachments] || (params[:bid] && params[:bid][:uploads]))
if @bid.save
flash[:notice] = l(:label_update_homework_succeed)
redirect_to course_homework_path(@course)
redirect_to course_homework_url(@course)
else
@bid.safe_attributes = params[:bid]
render :action => 'edit', :layout =>'base_courses'

View File

@ -108,7 +108,7 @@ class BoardsController < ApplicationController
flash[:notice] = l(:notice_successful_create)
#Modified by young
#redirect_to_settings_in_projects
redirect_to project_board_path(@project, @board)
redirect_to project_board_url(@project, @board)
#Ended by young
else
render :action => 'new'
@ -137,7 +137,7 @@ class BoardsController < ApplicationController
private
def redirect_to_settings_in_projects
redirect_to settings_project_path(@project, :tab => 'boards')
redirect_to settings_project_url(@project, :tab => 'boards')
end
def find_board_if_available

View File

@ -32,12 +32,12 @@ class CommentsController < ApplicationController
flash[:notice] = l(:label_comment_added)
end
redirect_to news_path(@news)
redirect_to news_url(@news)
end
def destroy
@news.comments.find(params[:comment_id]).destroy
redirect_to news_path(@news)
redirect_to news_url(@news)
end
private

View File

@ -118,7 +118,7 @@ class ContestnotificationsController < ApplicationController
if @contestnotification.save
render_attachment_warning_if_needed(@contestnotification)
flash[:notice] = l(:notice_successful_create)
redirect_to contest_contestnotifications_path(@contest)
redirect_to contest_contestnotifications_url(@contest)
else
layout_file = 'base_newcontest'
render :action => 'new', :layout => layout_file
@ -145,7 +145,7 @@ class ContestnotificationsController < ApplicationController
if @contestnotification.save
render_attachment_warning_if_needed(@contestnotification)
flash[:notice] = l(:notice_successful_update)
redirect_to contest_contestnotification_path(@contestnotification.contest, @contestnotification)
redirect_to contest_contestnotification_url(@contestnotification.contest, @contestnotification)
else
render :action => 'edit'
end
@ -163,7 +163,7 @@ class ContestnotificationsController < ApplicationController
# end
@contestnotification = Contestnotification.find(params[:id])
@contestnotification.destroy
redirect_to contest_contestnotifications_path(@contest)
redirect_to contest_contestnotifications_url(@contest)
end
private

View File

@ -44,7 +44,7 @@ class ContestsController < ApplicationController
#@contests = @contests.like(params[:name]) if params[:name].present?
@contests = Contest.visible.where("name like '%#{params[:name]}%'")
if params[:contests_search]
(redirect_to contests_path, :notice => l(:label_sumbit_empty);return) if params[:name].blank?
(redirect_to contests_url, :notice => l(:label_sumbit_empty);return) if params[:name].blank?
end
@contest_count = @contests.count
@contest_pages = Paginator.new @contest_count, @limit, params['page']
@ -617,7 +617,7 @@ class ContestsController < ApplicationController
flash[:notice] = l(:label_contesting_created_succeed)
end
end
redirect_to show_contest_contest_path(@contest)
redirect_to show_contest_contest_url(@contest)
else
@contest.safe_attributes = params[:contest]
render :action => 'new_contest'
@ -641,7 +641,7 @@ class ContestsController < ApplicationController
flash[:notice] = l(:label_contesting_updated_succeed)
end
end
redirect_to show_contest_contest_path(@contest)
redirect_to show_contest_contest_url(@contest)
else
@contest.safe_attributes = params[:contest]

View File

@ -79,14 +79,13 @@ class CoursesController < ApplicationController
respond_to do |format|
format.html {
flash[:notice] = l(:notice_successful_update)
redirect_to settings_course_path(@course)
redirect_to settings_course_url(@course)
}
format.api { render_api_ok }
end
else
respond_to do |format|
format.html {
settings
render :action => 'settings'
}
format.api { render_validation_errors(@course) }
@ -103,7 +102,7 @@ class CoursesController < ApplicationController
def search
courses_all = Course.all_course
name = params[:name]
(redirect_to courses_path, :notice => l(:label_sumbit_empty);return) if name.blank?
(redirect_to courses_url, :notice => l(:label_sumbit_empty);return) if name.blank?
@courses = courses_all.visible
if params[:name].present?
@courses_all = @courses.like(params[:name])
@ -264,11 +263,11 @@ class CoursesController < ApplicationController
format.html {
flash[:notice] = l(:notice_successful_create)
if params[:continue]
redirect_to new_course_path(attrs, :course => '0')
redirect_to new_course_url(attrs, :course => '0')
elsif params[:course_continue]
redirect_to new_course_path(:course => '1')
redirect_to new_course_url(:course => '1')
else
redirect_to settings_course_path(@course, :course_type => 1)
redirect_to settings_course_url(@course, :course_type => 1)
end
}
format.api { render :action => 'show', :status => :created, :location => url_for(:controller => 'courses', :action => 'show', :id => @course.id) }

View File

@ -34,7 +34,7 @@ class CustomFieldsController < ApplicationController
if @custom_field.save
flash[:notice] = l(:notice_successful_create)
call_hook(:controller_custom_fields_new_after_save, :params => params, :custom_field => @custom_field)
redirect_to custom_fields_path(:tab => @custom_field.class.name)
redirect_to custom_fields_url(:tab => @custom_field.class.name)
else
render :action => 'new'
end
@ -47,7 +47,7 @@ class CustomFieldsController < ApplicationController
if @custom_field.update_attributes(params[:custom_field])
flash[:notice] = l(:notice_successful_update)
call_hook(:controller_custom_fields_edit_after_save, :params => params, :custom_field => @custom_field)
redirect_to custom_fields_path(:tab => @custom_field.class.name)
redirect_to custom_fields_url(:tab => @custom_field.class.name)
else
render :action => 'edit'
end
@ -59,7 +59,7 @@ class CustomFieldsController < ApplicationController
rescue
flash[:error] = l(:error_can_not_delete_custom_field)
end
redirect_to custom_fields_path(:tab => @custom_field.class.name)
redirect_to custom_fields_url(:tab => @custom_field.class.name)
end
private

View File

@ -76,7 +76,7 @@ class DocumentsController < ApplicationController
if @document.save
render_attachment_warning_if_needed(@document)
flash[:notice] = l(:notice_successful_create)
redirect_to project_documents_path(@project)
redirect_to project_documents_url(@project)
else
render :action => 'new'
end
@ -89,7 +89,7 @@ class DocumentsController < ApplicationController
@document.safe_attributes = params[:document]
if request.put? and @document.save
flash[:notice] = l(:notice_successful_update)
redirect_to document_path(@document)
redirect_to document_url(@document)
else
render :action => 'edit'
end
@ -97,7 +97,7 @@ class DocumentsController < ApplicationController
def destroy
@document.destroy if request.delete?
redirect_to project_documents_path(@project)
redirect_to project_documents_url(@project)
end
def add_attachment
@ -107,7 +107,7 @@ class DocumentsController < ApplicationController
if attachments.present? && attachments[:files].present? && Setting.notified_events.include?('document_added')
Mailer.attachments_added(attachments[:files]).deliver
end
redirect_to document_path(@document)
redirect_to document_url(@document)
end
# 权限判断

View File

@ -46,7 +46,7 @@ class EnumerationsController < ApplicationController
def create
if request.post? && @enumeration.save
flash[:notice] = l(:notice_successful_create)
redirect_to enumerations_path
redirect_to enumerations_url
else
render :action => 'new'
end
@ -58,7 +58,7 @@ class EnumerationsController < ApplicationController
def update
if request.put? && @enumeration.update_attributes(params[:enumeration])
flash[:notice] = l(:notice_successful_update)
redirect_to enumerations_path
redirect_to enumerations_url
else
render :action => 'edit'
end
@ -68,12 +68,12 @@ class EnumerationsController < ApplicationController
if !@enumeration.in_use?
# No associated objects
@enumeration.destroy
redirect_to enumerations_path
redirect_to enumerations_url
return
elsif params[:reassign_to_id]
if reassign_to = @enumeration.class.find_by_id(params[:reassign_to_id])
@enumeration.destroy(reassign_to)
redirect_to enumerations_path
redirect_to enumerations_url
return
end
end

View File

@ -178,7 +178,7 @@ class FilesController < ApplicationController
respond_to do |format|
format.js
format.html {
redirect_to project_files_path(@project)
redirect_to project_files_url(@project)
}
end
elsif @course
@ -206,7 +206,7 @@ class FilesController < ApplicationController
respond_to do |format|
format.js
format.html {
redirect_to course_files_path(@course)
redirect_to course_files_url(@course)
}
end
end

View File

@ -23,7 +23,7 @@ class ForumsController < ApplicationController
respond_to do |format|
if @memo.save
format.html { redirect_to (forum_memo_path(@forum, (@memo.parent_id.nil? ? @memo : @memo.parent_id))), notice: "#{l :label_memo_create_succ}" }
format.html { redirect_to (forum_memo_url(@forum, (@memo.parent_id.nil? ? @memo : @memo.parent_id))), notice: "#{l :label_memo_create_succ}" }
format.json { render json: @memo, status: :created, location: @memo }
else
sort_init 'updated_at', 'desc'
@ -170,7 +170,7 @@ class ForumsController < ApplicationController
def search_forum
# @forums = paginateHelper Forum.where("name LIKE '%#{params[:name]}%'")
q = "%#{params[:name].strip}%"
(redirect_to forums_path, :notice => l(:label_sumbit_empty);return) if params[:name].blank?
(redirect_to forums_url, :notice => l(:label_sumbit_empty);return) if params[:name].blank?
@offset, @limit = api_offset_and_limit({:limit => 10})
@forums_all = Forum.where("name LIKE ?", q)
@forums_count = @forums_all.count

View File

@ -52,7 +52,7 @@ class GroupsController < ApplicationController
if @group.save
format.html {
flash[:notice] = l(:notice_successful_create)
redirect_to(params[:continue] ? new_group_path : groups_path)
redirect_to(params[:continue] ? new_group_url : groups_url)
}
format.api { render :action => 'show', :status => :created, :location => group_url(@group) }
else
@ -71,7 +71,7 @@ class GroupsController < ApplicationController
respond_to do |format|
if @group.save
flash[:notice] = l(:notice_successful_update)
format.html { redirect_to(groups_path) }
format.html { redirect_to(groups_url) }
format.api { render_api_ok }
else
format.html { render :action => "edit" }
@ -84,7 +84,7 @@ class GroupsController < ApplicationController
@group.destroy
respond_to do |format|
format.html { redirect_to(groups_path) }
format.html { redirect_to(groups_url) }
format.api { render_api_ok }
end
end
@ -93,7 +93,7 @@ class GroupsController < ApplicationController
@users = User.find_all_by_id(params[:user_id] || params[:user_ids])
@group.users << @users if request.post?
respond_to do |format|
format.html { redirect_to edit_group_path(@group, :tab => 'users') }
format.html { redirect_to edit_group_url(@group, :tab => 'users') }
format.js
format.api { render_api_ok }
end
@ -102,7 +102,7 @@ class GroupsController < ApplicationController
def remove_user
@group.users.delete(User.find(params[:user_id])) if request.delete?
respond_to do |format|
format.html { redirect_to edit_group_path(@group, :tab => 'users') }
format.html { redirect_to edit_group_url(@group, :tab => 'users') }
format.js
format.api { render_api_ok }
end
@ -118,7 +118,7 @@ class GroupsController < ApplicationController
@membership = Member.edit_membership(params[:membership_id], params[:membership], @group)
@membership.save if request.post?
respond_to do |format|
format.html { redirect_to edit_group_path(@group, :tab => 'memberships') }
format.html { redirect_to edit_group_url(@group, :tab => 'memberships') }
format.js
end
end
@ -126,7 +126,7 @@ class GroupsController < ApplicationController
def destroy_membership
Member.find(params[:membership_id]).destroy if request.post?
respond_to do |format|
format.html { redirect_to edit_group_path(@group, :tab => 'memberships') }
format.html { redirect_to edit_group_url(@group, :tab => 'memberships') }
format.js
end
end

View File

@ -110,7 +110,7 @@ class HomeworkAttachController < ApplicationController
if @homework.save
respond_to do |format|
format.html { redirect_to course_for_bid_path @homework.bid }
format.html { redirect_to course_for_bid_url @homework.bid }
format.json { head :no_content }
end
else
@ -215,7 +215,7 @@ class HomeworkAttachController < ApplicationController
end
if @homework.save
respond_to do |format|
format.html { redirect_to course_for_bid_path @homework.bid }
format.html { redirect_to course_for_bid_url @homework.bid }
format.json { head :no_content }
end
else
@ -230,7 +230,7 @@ class HomeworkAttachController < ApplicationController
if User.current.admin? || User.current == @homework.user
if @homework.destroy
respond_to do |format|
format.html { redirect_to course_for_bid_path @homework.bid }
format.html { redirect_to course_for_bid_url @homework.bid }
format.json { head :no_content }
end
else
@ -315,7 +315,7 @@ class HomeworkAttachController < ApplicationController
@homework = HomeworkAttach.find(params[:jour_id])
@add_jour = @homework.addjours User.current.id, params[:new_form][:user_message],0,params[:is_comprehensive_evaluation]
respond_to do |format|
format.html { redirect_to homework_attach_path @homework }
format.html { redirect_to homework_attach_url @homework }
format.json { head :no_content }
end
end

View File

@ -114,7 +114,7 @@ class IssueCategoriesController < ApplicationController
private
def redirect_to_settings_in_projects
redirect_to settings_project_path(@project, :tab => 'categories')
redirect_to settings_project_url(@project, :tab => 'categories')
end
# Wrap ApplicationController's find_model_object method to set

View File

@ -48,7 +48,7 @@ class IssueRelationsController < ApplicationController
saved = @relation.save
respond_to do |format|
format.html { redirect_to issue_path(@issue) }
format.html { redirect_to issue_url(@issue) }
format.js {
@relations = @issue.reload.relations.select {|r| r.other_issue(@issue) && r.other_issue(@issue).visible? }
}
@ -67,7 +67,7 @@ class IssueRelationsController < ApplicationController
@relation.destroy
respond_to do |format|
format.html { redirect_to issue_path(@relation.issue_from) }
format.html { redirect_to issue_url(@relation.issue_from) }
format.js
format.api { render_api_ok }
end

View File

@ -42,7 +42,7 @@ class IssueStatusesController < ApplicationController
@issue_status = IssueStatus.new(params[:issue_status])
if request.post? && @issue_status.save
flash[:notice] = l(:notice_successful_create)
redirect_to issue_statuses_path
redirect_to issue_statuses_url
else
render :action => 'new'
end
@ -56,7 +56,7 @@ class IssueStatusesController < ApplicationController
@issue_status = IssueStatus.find(params[:id])
if request.put? && @issue_status.update_attributes(params[:issue_status])
flash[:notice] = l(:notice_successful_update)
redirect_to issue_statuses_path
redirect_to issue_statuses_url
else
render :action => 'edit'
end
@ -64,10 +64,10 @@ class IssueStatusesController < ApplicationController
def destroy
IssueStatus.find(params[:id]).destroy
redirect_to issue_statuses_path
redirect_to issue_statuses_url
rescue
flash[:error] = l(:error_unable_delete_issue_status)
redirect_to issue_statuses_path
redirect_to issue_statuses_url
end
def update_issue_done_ratio
@ -76,6 +76,6 @@ class IssueStatusesController < ApplicationController
else
flash[:error] = l(:error_issue_done_ratios_not_updated)
end
redirect_to issue_statuses_path
redirect_to issue_statuses_url
end
end

View File

@ -160,9 +160,9 @@ class IssuesController < ApplicationController
#flash[:notice] = l(:notice_issue_successful_create, :id => view_context.link_to("##{@issue.id}", issue_path(@issue), :title => @issue.subject))
if params[:continue]
attrs = {:tracker_id => @issue.tracker, :parent_issue_id => @issue.parent_issue_id}.reject {|k,v| v.nil?}
redirect_to new_project_issue_path(@issue.project, :issue => attrs)
redirect_to new_project_issue_url(@issue.project, :issue => attrs)
else
redirect_to issue_path(@issue)
redirect_to issue_url(@issue)
end
}
format.api { render :action => 'show', :status => :created, :location => issue_url(@issue) }
@ -320,9 +320,9 @@ class IssuesController < ApplicationController
if params[:follow]
if @issues.size == 1 && moved_issues.size == 1
redirect_to issue_path(moved_issues.first)
redirect_to issue_url(moved_issues.first)
elsif moved_issues.map(&:project).uniq.size == 1
redirect_to project_issues_path(moved_issues.map(&:project).first)
redirect_to project_issues_url(moved_issues.map(&:project).first)
end
else
redirect_back_or_default _project_issues_path(@project)
@ -409,7 +409,7 @@ class IssuesController < ApplicationController
when 'add_notes'
issue_attributes = issue_attributes.slice(:notes)
when 'cancel'
redirect_to issue_path(@issue)
redirect_to issue_url(@issue)
return false
end
end

View File

@ -86,7 +86,7 @@ class JournalsController < ApplicationController
@journal.destroy if @journal.details.empty? && @journal.notes.blank?
call_hook(:controller_journals_edit_post, { :journal => @journal, :params => params})
respond_to do |format|
format.html { redirect_to issue_path(@journal.journalized) }
format.html { redirect_to issue_url(@journal.journalized) }
format.js { render :action => 'update' }
end
else
@ -103,7 +103,7 @@ class JournalsController < ApplicationController
# Delete a journals added by young
def destroy
@journal.destroy
redirect_to issue_path(@journal.journalized)
redirect_to issue_url(@journal.journalized)
end
private

View File

@ -317,10 +317,10 @@ class MembersController < ApplicationController
private
def redirect_to_settings_in_projects
redirect_to settings_project_path(@project, :tab => 'members')
redirect_to settings_project_url(@project, :tab => 'members')
end
def redirect_to_settings_in_courses
redirect_to settings_course_path(@course, :tab => 'members')
redirect_to settings_course_url(@course, :tab => 'members')
end
end

View File

@ -70,7 +70,7 @@ class MessagesController < ApplicationController
if @message.save
call_hook(:controller_messages_new_after_save, { :params => params, :message => @message})
render_attachment_warning_if_needed(@message)
redirect_to board_message_path(@board, @message)
redirect_to board_message_url(@board, @message)
else
layout_file = @project ? 'base_projects' : 'base_courses'
render :action => 'new', :layout => layout_file
@ -81,7 +81,7 @@ class MessagesController < ApplicationController
# Reply to a topic
def reply
if params[:reply][:content] == ""
(redirect_to board_message_path(@board, @topic, :r => @reply), :notice => l(:label_reply_empty);return)
(redirect_to board_message_url(@board, @topic, :r => @reply), :notice => l(:label_reply_empty);return)
end
@quote = params[:quote][:quote]
@reply = Message.new
@ -98,7 +98,7 @@ class MessagesController < ApplicationController
else
#render file: 'messages#show', layout: 'base_courses'
end
redirect_to board_message_path(@board, @topic, :r => @reply)
redirect_to board_message_url(@board, @topic, :r => @reply)
end
@ -116,7 +116,7 @@ class MessagesController < ApplicationController
render_attachment_warning_if_needed(@message)
flash[:notice] = l(:notice_successful_update)
@message.reload
redirect_to board_message_path(@message.board, @message.root, :r => (@message.parent_id && @message.id))
redirect_to board_message_url(@message.board, @message.root, :r => (@message.parent_id && @message.id))
elsif request.get?
respond_to do |format|
format.html {
@ -139,15 +139,15 @@ class MessagesController < ApplicationController
# modify by nwb
if @project
if @message.parent
redirect_to board_message_path(@board, @message.parent, :r => r)
redirect_to board_message_url(@board, @message.parent, :r => r)
else
redirect_to project_board_path(@project, @board)
redirect_to board_message_url(@project, @board)
end
elsif @course
if @message.parent
redirect_to board_message_path(@board, @message.parent, :r => r)
redirect_to board_message_url(@board, @message.parent, :r => r)
else
redirect_to course_board_path(@course, @board)
redirect_to course_board_url(@course, @board)
end
end
end

View File

@ -131,7 +131,7 @@ class MyController < ApplicationController
@user.notified_project_ids = (@user.mail_notification == 'selected' ? params[:notified_project_ids] : [])
set_language_if_valid @user.language
flash.now[:notice] = l(:notice_account_updated)
redirect_to user_path(@user)
redirect_to user_url(@user)
return
else
# 确保文件被删除
@ -152,7 +152,7 @@ class MyController < ApplicationController
def destroy
@user = User.current
unless @user.own_account_deletable?
redirect_to my_account_path
redirect_to my_account_url
return
end
@ -162,7 +162,7 @@ class MyController < ApplicationController
logout_user
flash.now[:notice] = l(:notice_account_deleted)
end
redirect_to home_path
redirect_to home_url
end
end
@ -171,7 +171,7 @@ class MyController < ApplicationController
@user = User.current
unless @user.change_password_allowed?
flash.now[:error] = l(:notice_can_t_change_password)
redirect_to my_account_path
redirect_to my_account_url
return
end
if request.post?
@ -180,7 +180,7 @@ class MyController < ApplicationController
if @user.save
flash.now[:notice] = l(:notice_account_password_updated)
redirect_to my_account_path
redirect_to my_account_url
end
else
flash.now[:error] = l(:notice_account_wrong_password)
@ -198,7 +198,7 @@ class MyController < ApplicationController
User.current.rss_key
flash[:notice] = l(:notice_feeds_access_key_reseted)
end
redirect_to my_account_path
redirect_to my_account_url
end
# Create a new API key
@ -211,7 +211,7 @@ class MyController < ApplicationController
User.current.api_key
flash[:notice] = l(:notice_api_access_key_reseted)
end
redirect_to my_account_path
redirect_to my_account_url
end
# User's page layout configuration
@ -241,7 +241,7 @@ class MyController < ApplicationController
@user.pref[:my_page_layout] = layout
@user.pref.save
end
redirect_to my_page_layout_path
redirect_to my_page_layout_url
end
# Remove a block to user's page
@ -254,7 +254,7 @@ class MyController < ApplicationController
%w(top left right).each {|f| (layout[f] ||= []).delete block }
@user.pref[:my_page_layout] = layout
@user.pref.save
redirect_to my_page_layout_path
redirect_to my_page_layout_url
end
# Change blocks order on user's page

View File

@ -117,7 +117,7 @@ class NewsController < ApplicationController
if @news.save
render_attachment_warning_if_needed(@news)
flash[:notice] = l(:notice_successful_create)
redirect_to project_news_index_path(@project)
redirect_to project_news_index_url(@project)
else
layout_file = @project ? 'base_projects' : 'base_courses'
render :action => 'new', :layout => layout_file
@ -129,7 +129,7 @@ class NewsController < ApplicationController
if @news.save
render_attachment_warning_if_needed(@news)
flash[:notice] = l(:notice_successful_create)
redirect_to course_news_index_path(@course)
redirect_to course_news_index_url(@course)
else
layout_file = 'base_courses'
render :action => 'new', :layout => layout_file
@ -146,10 +146,10 @@ class NewsController < ApplicationController
if @news.save
render_attachment_warning_if_needed(@news)
flash[:notice] = l(:notice_successful_update)
redirect_to news_path(@news)
redirect_to news_url(@news)
else
#flash[:error] = l(:notice_successful_update)
redirect_to news_path(@news)
redirect_to news_url(@news)
end
end
@ -157,9 +157,9 @@ class NewsController < ApplicationController
@news.destroy
# modify by nwb
if @project
redirect_to project_news_index_path(@project)
redirect_to project_news_index_url(@project)
elsif @course
redirect_to course_news_index_path(@course)
redirect_to course_news_index_url(@course)
end
end

View File

@ -19,7 +19,7 @@ class NotificationcommentsController < ApplicationController
flash[:notice] = l(:label_comment_added)
end
redirect_to contest_contestnotification_path(@contest, @contestnotification)
redirect_to contest_contestnotification_url(@contest, @contestnotification)
end
def destroy
@ -30,7 +30,7 @@ class NotificationcommentsController < ApplicationController
#@contestnotifications = notificaioncomments.Contestnotification
#@contest = @contestnotifications.contest
#@contestnotifications.notificaioncomments.find(params[:notificaioncomment_id]).destroy
redirect_to contest_contestnotification_path(@contest,@contestnotification)
redirect_to contest_contestnotification_url(@contest,@contestnotification)
end
end

View File

@ -215,7 +215,7 @@ class OpenSourceProjectsController < ApplicationController
@app_dir = params[:app_dir]
@language = params[:language]
@created_at = params[:created_at]
redirect_to open_source_projects_path(:app_dir => @app_dir, :language => @language, :created_at => @created_at, :name => params[:name])
redirect_to open_source_projects_url(:app_dir => @app_dir, :language => @language, :created_at => @created_at, :name => params[:name])
end
def search
@ -229,7 +229,7 @@ class OpenSourceProjectsController < ApplicationController
#
# @open_source_projects = @open_source_projects.offset(@os_project_pages.offset).limit(@os_project_pages.per_page)
redirect_to open_source_projects_path(:name => params[:name])
redirect_to open_source_projects_url(:name => params[:name])
end
@ -237,7 +237,7 @@ class OpenSourceProjectsController < ApplicationController
@apply = ApplyProjectMaster.where("user_id = ? and apply_id = ? and apply_type = 'OpenSourceProject'", params[:user_id], @open_source_project.id)
@apply.first.destory
redirect_to master_apply_open_source_project_path
redirect_to master_apply_open_source_project_url
end
def accept_master_apply
@ -246,7 +246,7 @@ class OpenSourceProjectsController < ApplicationController
@apply.first.update_attributes(:status => 2)
end
redirect_to master_apply_open_source_project_path
redirect_to master_apply_open_source_project_url
end
private

View File

@ -29,7 +29,7 @@ class ProjectEnumerationsController < ApplicationController
flash[:notice] = l(:notice_successful_update)
end
redirect_to settings_project_path(@project, :tab => 'activities')
redirect_to settings_project_url(@project, :tab => 'activities')
end
def destroy
@ -37,6 +37,6 @@ class ProjectEnumerationsController < ApplicationController
time_entry_activity.destroy(time_entry_activity.parent)
end
flash[:notice] = l(:notice_successful_update)
redirect_to settings_project_path(@project, :tab => 'activities')
redirect_to settings_project_url(@project, :tab => 'activities')
end
end

View File

@ -509,9 +509,9 @@ class ProjectsController < ApplicationController
flash[:notice] = l(:notice_successful_create)
if params[:continue]
attrs = {:parent_id => @project.parent_id}.reject {|k,v| v.nil?}
redirect_to new_project_path(attrs, :course => '0')
redirect_to new_project_url(attrs, :course => '0')
else
redirect_to settings_project_path(@project)
redirect_to settings_project_url(@project)
end
}
format.api { render :action => 'show', :status => :created, :location => url_for(:controller => 'projects', :action => 'show', :id => @project.id) }
@ -538,13 +538,13 @@ class ProjectsController < ApplicationController
if validate_parent_id && @project.copy(@source_project, :only => params[:only])
@project.set_allowed_parent!(params[:project]['parent_id']) if params[:project].has_key?('parent_id')
flash[:notice] = l(:notice_successful_create)
redirect_to settings_project_path(@project)
redirect_to settings_project_url(@project)
elsif !@project.new_record?
# Project was created
# But some objects were not copied due to validation failures
# (eg. issues from disabled trackers)
# TODO: inform about that
redirect_to settings_project_path(@project)
redirect_to settings_project_url(@project)
end
end
end
@ -780,7 +780,7 @@ class ProjectsController < ApplicationController
respond_to do |format|
format.html {
flash[:notice] = l(:notice_successful_update)
redirect_to settings_project_path(@project,:course => @project.project_type)
redirect_to settings_project_url(@project,:course => @project.project_type)
}
format.api { render_api_ok }
end
@ -798,7 +798,7 @@ class ProjectsController < ApplicationController
def modules
@project.enabled_module_names = params[:enabled_module_names]
flash[:notice] = l(:notice_successful_update)
redirect_to settings_project_path(@project, :tab => 'modules')
redirect_to settings_project_url(@project, :tab => 'modules')
end
def archive
@ -807,22 +807,22 @@ class ProjectsController < ApplicationController
flash[:error] = l(:error_can_not_archive_project)
end
end
redirect_to admin_projects_path(:status => params[:status])
redirect_to admin_projects_url(:status => params[:status])
end
def unarchive
@project.unarchive if request.post? && !@project.active?
redirect_to admin_projects_path(:status => params[:status])
redirect_to admin_projects_url(:status => params[:status])
end
def close
@project.close
redirect_to project_path(@project)
redirect_to project_url(@project)
end
def reopen
@project.reopen
redirect_to project_path(@project)
redirect_to project_url(@project)
end
# Delete @project
@ -831,7 +831,7 @@ class ProjectsController < ApplicationController
if api_request? || params[:confirm]
@project_to_destroy.destroy
respond_to do |format|
format.html { redirect_to admin_projects_path }
format.html { redirect_to admin_projects_url }
format.api { render_api_ok }
end
else

View File

@ -59,7 +59,7 @@ class QueriesController < ApplicationController
if @query.save
flash[:notice] = l(:notice_successful_create)
redirect_to _project_issues_path(@project, :query_id => @query)
redirect_to _project_issues_url(@project, :query_id => @query)
else
render :action => 'new', :layout => !request.xhr?
end
@ -77,7 +77,7 @@ class QueriesController < ApplicationController
if @query.save
flash[:notice] = l(:notice_successful_update)
redirect_to _project_issues_path(@project, :query_id => @query)
redirect_to _project_issues_url(@project, :query_id => @query)
else
render :action => 'edit'
end
@ -85,7 +85,7 @@ class QueriesController < ApplicationController
def destroy
@query.destroy
redirect_to _project_issues_path(@project, :set_filter => 1)
redirect_to _project_issues_url(@project, :set_filter => 1)
end
private

View File

@ -104,7 +104,7 @@ class RepositoriesController < ApplicationController
end
@repository.project = @project
if request.post? && @repository.save
redirect_to settings_project_path(@project, :tab => 'repositories')
redirect_to settings_project_url(@project, :tab => 'repositories')
else
render :action => 'new'
end
@ -153,7 +153,7 @@ class RepositoriesController < ApplicationController
# end
@repository.update_attributes(:login => User.current.login.to_s)
end
redirect_to settings_project_path(@project, :tab => 'repositories')
redirect_to settings_project_url(@project, :tab => 'repositories')
else if(@repository_tag)
render :action => 'newrepo', :layout =>'base_projects'
else
@ -174,7 +174,7 @@ class RepositoriesController < ApplicationController
end
@repository.project = @project
if request.put? && @repository.save
redirect_to settings_project_path(@project, :tab => 'repositories')
redirect_to settings_project_url(@project, :tab => 'repositories')
else
render :action => 'edit'
end
@ -205,7 +205,7 @@ class RepositoriesController < ApplicationController
# Build a hash with repository usernames as keys and corresponding user ids as values
@repository.committer_ids = params[:committers].values.inject({}) {|h, c| h[c.first] = c.last; h}
flash[:notice] = l(:notice_successful_update)
redirect_to settings_project_path(@project, :tab => 'repositories')
redirect_to settings_project_url(@project, :tab => 'repositories')
elsif request.get?
respond_to do |format|
format.html{
@ -223,7 +223,7 @@ class RepositoriesController < ApplicationController
@repository_name=User.current.login.to_s+"/"+@repository.identifier.to_s+".git"
@middle=User.current.login.to_s+"_"+@repository.identifier.to_s+"-write:"
@repository.destroy if request.delete?
redirect_to settings_project_path(@project, :tab => 'repositories')
redirect_to settings_project_url(@project, :tab => 'repositories')
if(@repository.type=="Repository::Git")
logger.info "destory the repository value"+"root path"+@root_path+"repo_name"+@repo_name+
"repository_name"+@repository_name+"user group"+@middle

View File

@ -58,7 +58,7 @@ class RolesController < ApplicationController
@role.workflow_rules.copy(copy_from)
end
flash[:notice] = l(:notice_successful_create)
redirect_to roles_path
redirect_to roles_url
else
@roles = Role.sorted.all
render :action => 'new'
@ -71,7 +71,7 @@ class RolesController < ApplicationController
def update
if request.put? and @role.update_attributes(params[:role])
flash[:notice] = l(:notice_successful_update)
redirect_to roles_path
redirect_to roles_url
else
render :action => 'edit'
end
@ -79,10 +79,10 @@ class RolesController < ApplicationController
def destroy
@role.destroy
redirect_to roles_path
redirect_to roles_url
rescue
flash[:error] = l(:error_can_not_remove_role)
redirect_to roles_path
redirect_to roles_url
end
def permissions
@ -94,7 +94,7 @@ class RolesController < ApplicationController
role.save
end
flash[:notice] = l(:notice_successful_update)
redirect_to roles_path
redirect_to roles_url
end
end

View File

@ -41,7 +41,7 @@ class SearchController < ApplicationController
# quick jump to an issue
if (m = @question.match(/^#?(\d+)$/)) && (issue = Issue.visible.find_by_id(m[1].to_i))
redirect_to issue_path(issue)
redirect_to issue_url(issue)
return
end

View File

@ -24,7 +24,6 @@ class SettingsController < ApplicationController
before_filter :require_admin
def index
edit
render :action => 'edit'
end
@ -38,7 +37,7 @@ class SettingsController < ApplicationController
Setting[name] = value
end
flash[:notice] = l(:notice_successful_update)
redirect_to settings_path(:tab => params[:tab])
redirect_to settings_url(:tab => params[:tab])
else
@options = {}
user_format = User::USER_FORMATS.collect{|key, value| [key, value[:setting_order]]}.sort{|a, b| a[1] <=> b[1]}
@ -62,7 +61,7 @@ class SettingsController < ApplicationController
if request.post?
Setting.send "plugin_#{@plugin.id}=", params[:settings]
flash[:notice] = l(:notice_successful_update)
redirect_to plugin_settings_path(@plugin)
redirect_to plugin_settings_url(@plugin)
else
@partial = @plugin.settings[:partial]
@settings = Setting.send "plugin_#{@plugin.id}"

View File

@ -153,7 +153,7 @@ class SoftapplicationsController < ApplicationController
ContestingSoftapplication.create(:contest_id => params[:contest_id], :softapplication_id => @softapplication.id)
#ProjectingSoftapplication.create_softapplication_projecting(:project_id => params[:project_id], :softapplication_id => @softapplication.id)
#ProjectingSoftapplication.create_softapplication_projecting(@project.id, softapplication.id)
format.html { redirect_to show_attendingcontest_contest_path(:id => params[:contest_id]), notice: l(:notice_attendingcontest_work_successfully_created) }
format.html { redirect_to show_attendingcontest_contest_url(:id => params[:contest_id]), notice: l(:notice_attendingcontest_work_successfully_created) }
# format.json { render json: @softapplication, status: :created, location: @softapplication }
else
#format.js { render status: 406 }
@ -207,7 +207,7 @@ class SoftapplicationsController < ApplicationController
@softapplication.destroy
respond_to do |format|
format.html { redirect_to home_path }
format.html { redirect_to home_url }
format.json { head :no_content }
end
end

View File

@ -7,14 +7,14 @@ class StoresController < ApplicationController
def search
begin
q = "%#{params[:name].strip}%"
(redirect_to stores_path, :notice => l(:label_sumbit_empty);return) if params[:name].blank?
(redirect_to stores_url, :notice => l(:label_sumbit_empty);return) if params[:name].blank?
result = find_public_attache q
@searched_attach = paginateHelper result
@result_all_count = result.count;
rescue Exception => e
#render 'stores'
redirect_to stores_path
redirect_to stores_url
end
end

View File

@ -135,16 +135,16 @@ class TimelogController < ApplicationController
:back_url => params[:back_url]
}
if @time_entry.issue
redirect_to new_project_issue_time_entry_path(@time_entry.project, @time_entry.issue, options)
redirect_to new_project_issue_time_entry_url(@time_entry.project, @time_entry.issue, options)
else
redirect_to new_project_time_entry_path(@time_entry.project, options)
redirect_to new_project_time_entry_url(@time_entry.project, options)
end
else
options = {
:time_entry => {:project_id => @time_entry.project_id, :issue_id => @time_entry.issue_id, :activity_id => @time_entry.activity_id},
:back_url => params[:back_url]
}
redirect_to new_time_entry_path(options)
redirect_to new_time_entry_url(options)
end
else
redirect_back_or_default project_time_entries_path(@time_entry.project)

View File

@ -54,10 +54,9 @@ class TrackersController < ApplicationController
@tracker.workflow_rules.copy(copy_from)
end
flash[:notice] = l(:notice_successful_create)
redirect_to trackers_path
redirect_to trackers_url
return
end
new
render :action => 'new'
end
@ -71,7 +70,7 @@ class TrackersController < ApplicationController
@tracker = Tracker.find(params[:id])
if @tracker.update_attributes(params[:tracker])
flash[:notice] = l(:notice_successful_update)
redirect_to trackers_path
redirect_to trackers_url
return
end
edit
@ -85,7 +84,7 @@ class TrackersController < ApplicationController
else
@tracker.destroy
end
redirect_to trackers_path
redirect_to trackers_url
end
def fields
@ -99,7 +98,7 @@ class TrackersController < ApplicationController
end
end
flash[:notice] = l(:notice_successful_update)
redirect_to fields_trackers_path
redirect_to fields_trackers_url
return
end
@trackers = Tracker.sorted.all

View File

@ -166,7 +166,7 @@ class UsersController < ApplicationController
# added by fq
def user_activities
redirect_to user_path(@user, type: params[:type], page: params[:page])
redirect_to user_url(@user, type: params[:type], page: params[:page])
return
# useless abort.
@watcher = User.watched_by_id(@user)
@ -347,7 +347,7 @@ class UsersController < ApplicationController
def search
sort_init 'login', 'asc'
sort_update %w(login firstname lastname mail admin created_on last_login_on)
(redirect_to users_path, :notice => l(:label_sumbit_empty);return) if params[:name].blank?
(redirect_to user_url, :notice => l(:label_sumbit_empty);return) if params[:name].blank?
case params[:format]
when 'xml', 'json'
@offset, @limit = api_offset_and_limit({:limit => 15})
@ -516,9 +516,9 @@ class UsersController < ApplicationController
format.html {
flash[:notice] = l(:notice_user_successful_create, :id => view_context.link_to(@user.login, user_path(@user)))
if params[:continue]
redirect_to new_user_path
redirect_to new_user_url
else
redirect_to edit_user_path(@user)
redirect_to edit_user_url(@user)
end
}
format.api { render :action => 'show', :status => :created, :location => user_url(@user) }
@ -585,7 +585,7 @@ class UsersController < ApplicationController
respond_to do |format|
format.html {
flash[:notice] = l(:notice_successful_update)
redirect_to_referer_or edit_user_path(@user)
redirect_to_referer_or edit_user_url(@user)
}
format.api { render_api_ok }
end
@ -614,7 +614,7 @@ class UsersController < ApplicationController
@membership = Member.edit_membership(params[:membership_id], params[:membership], @user)
@membership.save
respond_to do |format|
format.html { redirect_to edit_user_path(@user, :tab => 'memberships') }
format.html { redirect_to edit_user_url(@user, :tab => 'memberships') }
format.js
end
end
@ -625,7 +625,7 @@ class UsersController < ApplicationController
@membership.destroy
end
respond_to do |format|
format.html { redirect_to edit_user_path(@user, :tab => 'memberships') }
format.html { redirect_to edit_user_url(@user, :tab => 'memberships') }
format.js
end
end
@ -800,7 +800,7 @@ class UsersController < ApplicationController
def auth_user_extension
if @user == User.current && (@user.user_extensions.nil? || @user.user_extensions.school.nil?)
flash[:error] = l(:error_complete_occupation)
redirect_to my_account_path
redirect_to my_account_url
end
end

View File

@ -107,7 +107,7 @@ class VersionsController < ApplicationController
respond_to do |format|
format.html do
flash[:notice] = l(:notice_successful_create)
redirect_to settings_project_path(@project, :tab => 'versions')
redirect_to settings_project_url(@project, :tab => 'versions')
end
format.js
format.api do
@ -153,14 +153,14 @@ class VersionsController < ApplicationController
if request.put?
@project.close_completed_versions
end
redirect_to settings_project_path(@project, :tab => 'versions')
redirect_to settings_project_url(@project, :tab => 'versions')
end
def close_completed_contest
if request.put?
@contest.close_completed_versions
end
redirect_to settings_contest_path(@contest, :tab => 'versions')
redirect_to settings_contest_url(@contest, :tab => 'versions')
end
def destroy
@ -174,7 +174,7 @@ class VersionsController < ApplicationController
respond_to do |format|
format.html {
flash[:error] = l(:notice_unable_delete_version)
redirect_to settings_project_path(@project, :tab => 'versions')
redirect_to settings_project_url(@project, :tab => 'versions')
}
format.api { head :unprocessable_entity }
end

View File

@ -17,10 +17,9 @@ class WebFooterCompaniesController < ApplicationController
@company = WebFooterCompany.new(params[:web_footer_company])
if @company.save
flash[:notice] = l(:notice_successful_create)
redirect_to web_footer_companies_path
redirect_to web_footer_companies_url
else
flash[:error] = "#{l :web_footer_company_create_fail}: #{@company.errors.full_messages[0]}"
new
render :action => 'new'
end
end
@ -28,7 +27,7 @@ class WebFooterCompaniesController < ApplicationController
def destroy
@company = WebFooterCompany.find(params[:id])
@company.destroy
redirect_to web_footer_companies_path
redirect_to web_footer_companies_url
end
def edit
@ -39,10 +38,9 @@ class WebFooterCompaniesController < ApplicationController
@company = WebFooterCompany.find(params[:id])
if @company.update_attributes(params[:web_footer_company])
flash[:notice] = l(:notice_successful_update)
redirect_to web_footer_companies_path
redirect_to web_footer_companies_url
else
flash[:error] = "#{l :web_footer_company_update_fail}: #{@company.errors.full_messages[0]}"
edit
render :action => 'edit'
end
end

View File

@ -127,21 +127,21 @@ class WelcomeController < ApplicationController
format.html{
case search_type
when :projects
redirect_to projects_search_path(:name => search_condition,
redirect_to projects_search_url(:name => search_condition,
:project_type => Project::ProjectType_project)
when :courses
redirect_to courses_search_path(:name => search_condition)
redirect_to courses_search_url(:name => search_condition)
when :contests
redirect_to contests_path(:name => search_condition)
redirect_to contests_url(:name => search_condition)
when :users
redirect_to users_search_path(:name => search_condition)
redirect_to users_search_url(:name => search_condition)
when :users_teacher
redirect_to users_search_path(:name => search_condition, :role => :teacher)
redirect_to users_search_url(:name => search_condition, :role => :teacher)
when :users_student
redirect_to users_search_path(:name => search_condition, :role => :student)
redirect_to users_search_url(:name => search_condition, :role => :student)
else
#redirect_to home_path, :alert => l(:label_sumbit_empty)
(redirect_to home_path, :notice => l(:label_sumbit_empty);return) #if params[:name].blank?
(redirect_to home_url, :notice => l(:label_sumbit_empty);return) #if params[:name].blank?
end
}
end

View File

@ -68,7 +68,6 @@ class WikiController < ApplicationController
def show
if @page.new_record?
if User.current.allowed_to?(:edit_wiki_pages, @project) && editable? && !api_request?
edit
render :action => 'edit'
else
render_404
@ -162,7 +161,7 @@ class WikiController < ApplicationController
call_hook(:controller_wiki_edit_after_save, { :params => params, :page => @page})
respond_to do |format|
format.html { redirect_to project_wiki_page_path(@project, @page.title) }
format.html { redirect_to project_wiki_page_url(@project, @page.title) }
format.api {
if was_new_page
render :action => 'show', :status => :created, :location => project_wiki_page_path(@project, @page.title)
@ -202,13 +201,13 @@ class WikiController < ApplicationController
@original_title = @page.pretty_title
if request.post? && @page.update_attributes(params[:wiki_page])
flash[:notice] = l(:notice_successful_update)
redirect_to project_wiki_page_path(@project, @page.title)
redirect_to project_wiki_page_url(@project, @page.title)
end
end
def protect
@page.update_attribute :protected, params[:protected]
redirect_to project_wiki_page_path(@project, @page.title)
redirect_to project_wiki_page_url(@project, @page.title)
end
# show page history
@ -264,7 +263,7 @@ class WikiController < ApplicationController
end
@page.destroy
respond_to do |format|
format.html { redirect_to project_wiki_index_path(@project) }
format.html { redirect_to project_wiki_index_url(@project) }
format.api { render_api_ok }
end
end
@ -274,7 +273,7 @@ class WikiController < ApplicationController
@content = @page.content_for_version(params[:version])
@content.destroy
redirect_to_referer_or history_project_wiki_page_path(@project, @page.title)
redirect_to_referer_or history_project_wiki_page_url(@project, @page.title)
end
# Export wiki to a single pdf or html file

View File

@ -30,7 +30,7 @@ class WikisController < ApplicationController
def destroy
if request.post? && params[:confirm] && @project.wiki
@project.wiki.destroy
redirect_to settings_project_path(@project, :tab => 'wiki')
redirect_to settings_project_url(@project, :tab => 'wiki')
end
end
end

View File

@ -184,7 +184,7 @@ class WordsController < ApplicationController
message = params[:new_form][:project_message]
Project.add_jour(user, message)
redirect_to project_feedback_path('trustie')
redirect_to project_feedback_url('trustie')
# redirect_to signin_path
end
@ -193,10 +193,10 @@ class WordsController < ApplicationController
message = params[:new_form][:project_message]
feedback = Project.add_new_jour(user, message, params[:id])
if(feedback.errors.empty?)
redirect_to project_feedback_path(params[:id]), notice: l(:label_feedback_success)
redirect_to project_feedback_url(params[:id]), notice: l(:label_feedback_success)
else
flash[:error] = feedback.errors.full_messages[0]
redirect_to project_feedback_path(params[:id])
redirect_to project_feedback_url(params[:id])
end
end
@ -207,10 +207,10 @@ class WordsController < ApplicationController
message = params[:new_form][:course_message]
feedback = Course.add_new_jour(user, message, params[:id])
if(feedback.errors.empty?)
redirect_to course_feedback_path(params[:id]), notice: l(:label_feedback_success)
redirect_to course_feedback_url(params[:id]), notice: l(:label_feedback_success)
else
flash[:error] = feedback.errors.full_messages[0]
redirect_to course_feedback_path(params[:id])
redirect_to course_feedback_url(params[:id])
end
end
@ -219,7 +219,7 @@ class WordsController < ApplicationController
user = User.current
message = params[:new_form][:user_introduction]
UserExtensions.introduction(user, message)
redirect_to user_path(user.id)
redirect_to user_url(user.id)
end
private

View File

@ -38,7 +38,7 @@ class WorkflowsController < ApplicationController
}
}
if @role.save
redirect_to workflows_edit_path(:role_id => @role, :tracker_id => @tracker, :used_statuses_only => params[:used_statuses_only])
redirect_to workflows_edit_url(:role_id => @role, :tracker_id => @tracker, :used_statuses_only => params[:used_statuses_only])
return
end
end
@ -64,7 +64,7 @@ class WorkflowsController < ApplicationController
if request.post? && @role && @tracker
WorkflowPermission.replace_permissions(@tracker, @role, params[:permissions] || {})
redirect_to workflows_permissions_path(:role_id => @role, :tracker_id => @tracker, :used_statuses_only => params[:used_statuses_only])
redirect_to workflows_permissions_url(:role_id => @role, :tracker_id => @tracker, :used_statuses_only => params[:used_statuses_only])
return
end
@ -111,7 +111,7 @@ class WorkflowsController < ApplicationController
else
WorkflowRule.copy(@source_tracker, @source_role, @target_trackers, @target_roles)
flash[:notice] = l(:notice_successful_update)
redirect_to workflows_copy_path(:source_tracker_id => @source_tracker, :source_role_id => @source_role)
redirect_to workflows_copy_url(:source_tracker_id => @source_tracker, :source_role_id => @source_role)
end
end
end

View File

@ -1,2 +0,0 @@
module WebFooterCompaniesHelper
end

View File

@ -2,6 +2,7 @@ class Activity < ActiveRecord::Base
attr_accessible :act_id, :act_type, :user_id
belongs_to :act, :polymorphic => true
belongs_to :user
validates_presence_of :act_id, :act_type, :user_id
validates :act_id, presence: true
validates :act_type, presence: true
validates :user_id, presence: true
end

View File

@ -28,10 +28,10 @@ class Attachment < ActiveRecord::Base
include UserScoreHelper
validates_presence_of :filename, :author
validates_length_of :filename, :maximum => 254
validates_length_of :disk_filename, :maximum => 254
validates_length_of :description, :maximum => 254
validates :filename, presence: true, length: {maximum: 254}
validates :author, presence: true
validates :disk_filename, length: {maximum: 254}
validates :description, length: {maximum: 254}
validate :validate_max_file_size

View File

@ -26,9 +26,7 @@ class AuthSource < ActiveRecord::Base
has_many :users
validates_presence_of :name
validates_uniqueness_of :name
validates_length_of :name, :maximum => 60
validates :name, presence: true, uniqueness: true, length: {maximum: 60}
def authenticate(login, password)
end

View File

@ -20,14 +20,20 @@ require 'net/ldap/dn'
require 'timeout'
class AuthSourceLdap < AuthSource
validates_presence_of :host, :port, :attr_login
validates_length_of :name, :host, :maximum => 60, :allow_nil => true
validates_length_of :account, :account_password, :base_dn, :filter, :maximum => 255, :allow_blank => true
validates_length_of :attr_login, :attr_firstname, :attr_lastname, :attr_mail, :maximum => 30, :allow_nil => true
validates_numericality_of :port, :only_integer => true
validates_numericality_of :timeout, :only_integer => true, :allow_blank => true
validates :host, presence: true, length: {maximum: 60, allow_nil: true}
validates :port, presence: true, numericality: {only_integer: true}
validates :attr_login, presence: true
validates :name, length: {maximum: 60, allow_nil: true}
validates :account, length: {maximum: 255, allow_blank: true}
validates :account_password, length: {maximum: 255, allow_blank: true}
validates :base_dn, length: {maximum: 255, allow_blank: true}
validates :filter, length: {maximum: 255, allow_blank: true}
validates :attr_login, length: {maximum: 30, allow_nil: true}
validates :attr_firstname, length: {maximum: 30, allow_nil: true}
validates :attr_lastname, length: {maximum: 30, allow_nil: true}
validates :attr_mail, length: {maximum: 30, allow_nil: true}
validates :timeout, numericality: { only_integer: true, allow_blank: true}
validate :validate_filter
before_validation :strip_ldap_attributes
def initialize(attributes=nil, *args)

View File

@ -37,16 +37,14 @@ class Bid < ActiveRecord::Base
NAME_LENGTH_LIMIT = 60
DESCRIPTION_LENGTH_LIMIT = 250
validates_length_of :name, :maximum => NAME_LENGTH_LIMIT
validates_length_of :description, :maximum => DESCRIPTION_LENGTH_LIMIT
validates_presence_of :author_id, :name, :deadline
# validates_presence_of :deadline, :message => 'test'
# validates_format_of :deadline, :with =>
validates_format_of :deadline, :with => /^[\d]{4}[-][\d]{1,2}[-][\d]{1,2}$/
validates_format_of :budget, :with => /^(\d+)$|^(\d+).([0-9]{2})|^(\d+).([0-9]{1})$/,
:if => Proc.new { |p| p.reward_type == 1 }
validates_format_of :budget, :with => /^(\d+)$|^(\d+).([0-9]{1})$/, :if => Proc.new { |p| p.reward_type == 3 }
validates :name, length: {maximum: NAME_LENGTH_LIMIT}, presence: true
validates :description, length: {maximum: DESCRIPTION_LENGTH_LIMIT}
validates :author_id, presence: true
validates :deadline, presence: true, format: {:with => /^[\d]{4}[-][\d]{1,2}[-][\d]{1,2}$/}
validates :name, length: {maximum: NAME_LENGTH_LIMIT}
validates :budget,
format: {with : /^(\d+)$|^(\d+).([0-9]{2})|^(\d+).([0-9]{1})$/, if: Proc.new { |p| p.reward_type == 1 }},
format: {with: /^(\d+)$|^(\d+).([0-9]{1})$/, if: Proc.new { |p| p.reward_type == 3 }}
validate :validate_user
validate :validate_reward_type
after_create :act_as_activity

View File

@ -7,13 +7,13 @@ class BidingProject < ActiveRecord::Base
belongs_to :user
DESCRIPTION_LENGTH_LIMIT = 500
validates_length_of :description, :maximum => DESCRIPTION_LENGTH_LIMIT
validates_presence_of :user_id, :bid_id, :project_id
validates :description, length: {maximum: DESCRIPTION_LENGTH_LIMIT}
validates :user_id, presence: true
validates :bid_id, presence: true, :uniqueness => { :scope => :project_id}
validates :project_id, presence: true
validate :validate_user
validate :validate_bid
validate :validate_project
validates_uniqueness_of :bid_id, :scope => :project_id
def self.cerate_bidding(bid_id, project_id, description = nil)
self.create(:user_id => User.current.id, :bid_id => bid_id,

View File

@ -26,9 +26,8 @@ class Board < ActiveRecord::Base
acts_as_list :scope => '(project_id = #{project_id} AND parent_id #{parent_id ? "= #{parent_id}" : "IS NULL"})'
acts_as_watchable
validates_presence_of :name, :description
validates_length_of :name, :maximum => 30
validates_length_of :description, :maximum => 255
validates :name, presence: true, length: {maximum: 30}
validates :description, presence: true, length: {maximum: 255}
validate :validate_board
scope :visible, lambda {|*args|

View File

@ -2,11 +2,10 @@ class BugToOsp < ActiveRecord::Base
# attr_accessible :title, :body
belongs_to :open_source_project, :foreign_key => "osp_id"
belongs_to :bug, :class_name => 'RelativeMemo', :foreign_key => "relative_memo_id"
validates_presence_of :osp_id, :relative_memo_id
validates :osp_id, presence: true
validates :relative_memo_id, presence: true
scope :visible, lambda {|*args|
nil
}
end

View File

@ -18,7 +18,9 @@
class Change < ActiveRecord::Base
belongs_to :changeset
validates_presence_of :changeset_id, :action, :path
validates :changeset_id, presence: true
validates :action, presence: true
validates :path, presence: true
before_save :init_path
before_validation :replace_invalid_utf8_of_path

View File

@ -54,10 +54,11 @@ class Changeset < ActiveRecord::Base
acts_as_activity_provider :timestamp => "#{table_name}.committed_on",
:author_key => :user_id,
:find_options => {:include => [:user, {:repository => :project}]}
validates_presence_of :repository_id, :revision, :committed_on, :commit_date
validates_uniqueness_of :revision, :scope => :repository_id
validates_uniqueness_of :scmid, :scope => :repository_id, :allow_nil => true
validates :repository_id, presence: true
validates :revision, presence: true, uniqueness: {scope: :repository_id}
validates :committed_on, presence: true
validates :commit_date, presence: true
validates :scmid, uniqueness: {scope: :repository_id, allow_nil: true}
scope :visible, lambda {|*args|
includes(:repository => :project).where(Project.allowed_to_condition(args.shift || User.current, :view_changesets, *args))

View File

@ -19,8 +19,6 @@ class Comment < ActiveRecord::Base
include Redmine::SafeAttributes
belongs_to :commented, :polymorphic => true, :counter_cache => true
belongs_to :author, :class_name => 'User', :foreign_key => 'author_id'
validates_presence_of :commented, :author, :comments
safe_attributes 'comments'
end

View File

@ -21,13 +21,11 @@ class Contest < ActiveRecord::Base
NAME_LENGTH_LIMIT = 60
DESCRIPTION_LENGTH_LIMIT = 250
validates_length_of :name, :maximum => NAME_LENGTH_LIMIT
validates_length_of :description, :maximum => DESCRIPTION_LENGTH_LIMIT
validates_presence_of :author_id, :name, :budget
#validates_format_of :deadline, :with => /^[\d]{4}[-][\d]{1,2}[-][\d]{1,2}$/
validates_format_of :deadline, :with =>/^[1-9][0-9]{3}\-0?[1-9]|1[12]\-0?[1-9]|[12]\d|3[01]$/
# validates_format_of :budget, :with => /^(\d+)$|^(\d+).([0-9]{2})|^(\d+).([0-9]{1})$/
validates :name, length: {maximum: NAME_LENGTH_LIMIT}, presence: true
validates :description, length: {maximum: DESCRIPTION_LENGTH_LIMIT}
validates :author_id, presence: true
validates :budget, presence: true
validates :deadline, format: {:with =>/^[1-9][0-9]{3}\-0?[1-9]|1[12]\-0?[1-9]|[12]\d|3[01]$/}
validate :validate_user
after_create :act_as_activity

View File

@ -1,4 +1,4 @@
class ContestNotification < ActiveRecord::Base
attr_accessible :content, :title
validates_length_of :title, maximum: 30
validates :title, length: {maximum: 30}
end

View File

@ -6,13 +6,13 @@ class ContestingProject < ActiveRecord::Base
belongs_to :user
DESCRIPTION_LENGTH_LIMIT = 500
validates_length_of :description, :maximum => DESCRIPTION_LENGTH_LIMIT
validates_presence_of :user_id, :contest_id, :project_id
validates :description, length: {maximum:DESCRIPTION_LENGTH_LIMIT }
validates :user_id, presence: true
validates :contest_id, presence: true, uniqueness: {:scope => :project_id}
validates :project_id, presence: true
validate :validate_user
validate :validate_contest
validate :validate_project
validates_uniqueness_of :contest_id, :scope => :project_id
def self.create_contesting(contest_id, project_id, description = nil)
self.create(:user_id => User.current.id, :contest_id => contest_id,

View File

@ -8,10 +8,9 @@ class Contestnotification < ActiveRecord::Base
has_many :notificationcomments, as: :notificationcommented, :dependent => :delete_all, :order => "created_at"
# fq
has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy
validates_presence_of :title, :description
validates_length_of :title, :maximum => 60
validates_length_of :summary, :maximum => 255
validates :title, length: {maximum: 60}, presence: true
validates :description, presence: true
validates :summary, length: {maximum: 255}
acts_as_attachable :delete_permission => :manage_contestnotifications
acts_as_searchable :columns => ['title', 'summary', "#{table_name}.description"], :include => :contest
@ -19,11 +18,8 @@ class Contestnotification < ActiveRecord::Base
acts_as_activity_provider :find_options => {:include => [:contest, :author]},
:author_key => :author_id
acts_as_watchable
after_create :add_author_as_watcher
after_create :act_as_activity
scope :visible, lambda {|*args|
nil

View File

@ -10,7 +10,6 @@ class Course < ActiveRecord::Base
belongs_to :teacher, :class_name => 'User', :foreign_key => :tea_id # 定义一个方法teacher该方法通过tea_id来调用User表
belongs_to :school, :class_name => 'School', :foreign_key => :school_id #定义一个方法school该方法通过school_id来调用School表
has_many :bid
has_many :members, :include => [:principal, :roles], :conditions => "#{Principal.table_name}.type='User' AND #{Principal.table_name}.status=#{Principal::STATUS_ACTIVE}"
has_many :memberships, :class_name => 'Member'
has_many :member_principals, :class_name => 'Member',
@ -34,10 +33,10 @@ class Course < ActiveRecord::Base
acts_as_attachable :view_permission => :view_files,
:delete_permission => :manage_files
validates_presence_of :password, :term,:name ,:class_period
validates_format_of :class_period, :with =>/^\d*$/
#validates_format_of :name,:with =>/^[a-zA-Z0-9_\u4e00-\u9fa5]+$/
validates :password, presence: true
validates :term, presence: true
validates :name, presence: true
validates :class_period, presence: true,format: {:with =>/^\d*$/}
before_save :self_validate
after_create :create_board_sync
before_destroy :delete_all_members

View File

@ -1,7 +1,5 @@
class CourseStatus < ActiveRecord::Base
attr_accessible :changesets_count, :course_ac_para, :course_id, :grade, :watchers_count
belongs_to :course
validates_presence_of :course_id
validates_uniqueness_of :course_id
validates :course_id, presence: true,uniqueness: true
end

View File

@ -1,6 +1,8 @@
class WebFooterCompany < ActiveRecord::Base
attr_accessible :logo_size, :name, :url
validates_presence_of :name,:url
validates_length_of :name,:url, :maximum => 255
validates_format_of :url,:with => /(http|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&amp;:\/~\+#]*[\w\-\@?^=%&amp;\/~\+#])?/,:message => l(:is_not_url_error)
validates :name, presence: true, length: { maximum: 500 }
validates :url, length: { maximum: 500 },
format: { with: /(http|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&amp;:\/~\+#]*[\w\-\@?^=%&amp;\/~\+#])?/,
message: l(:is_not_url_error)
}
end

View File

@ -10,8 +10,10 @@
<%= @organize.description.html_safe unless @organize.nil?%>
</p>
<div id="logo_link">
<% @companys.each do |company| %>
<span class="footer_logo_link"><%= link_to image_tag(url_to_avatar(company),:size=>"100x30",:alt=>company.name),company.url, :target => "_blank" %></span>
<% unless @companys.nil?%>
<% @companys.each do |company| %>
<span class="footer_logo_link"><%= link_to image_tag(url_to_avatar(company),:size=>"100x30",:alt=>company.name),company.url, :target => "_blank" %></span>
<% end %>
<% end %>
</div>
<!--gcm-->