diff --git a/app/assets/javascripts/web_footer_company.js.coffee b/app/assets/javascripts/web_footer_company.js.coffee deleted file mode 100644 index 761567942..000000000 --- a/app/assets/javascripts/web_footer_company.js.coffee +++ /dev/null @@ -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/ diff --git a/app/assets/stylesheets/web_footer_company.css.scss b/app/assets/stylesheets/web_footer_company.css.scss deleted file mode 100644 index e68badbc2..000000000 --- a/app/assets/stylesheets/web_footer_company.css.scss +++ /dev/null @@ -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/ diff --git a/app/controllers/account_controller.rb b/app/controllers/account_controller.rb index 02163889b..36b6435c8 100644 --- a/app/controllers/account_controller.rb +++ b/app/controllers/account_controller.rb @@ -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 diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb index 22538d86c..369bb8ec7 100644 --- a/app/controllers/admin_controller.rb +++ b/app/controllers/admin_controller.rb @@ -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 diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 0947301ae..ef6bd7582 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -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"' } @@ -499,12 +499,14 @@ class ApplicationController < ActionController::Base def render_403(options={}) @project = nil - render_error({:message => :notice_not_authorized, :status => 403}.merge(options)) + #render_error({:message => :notice_not_authorized, :status => 403}.merge(options)) + render :template => 'common/403' return false end def render_404(options={}) - render_error({:message => :notice_file_not_found, :status => 404}.merge(options)) + #render_error({:message => :notice_file_not_found, :status => 404}.merge(options)) + render :template => 'common/404' return false end @@ -764,7 +766,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 diff --git a/app/controllers/auth_sources_controller.rb b/app/controllers/auth_sources_controller.rb index 1ac5ca391..81542cf47 100644 --- a/app/controllers/auth_sources_controller.rb +++ b/app/controllers/auth_sources_controller.rb @@ -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 diff --git a/app/controllers/bids_controller.rb b/app/controllers/bids_controller.rb index 0cf8ea45d..cce93d86a 100644 --- a/app/controllers/bids_controller.rb +++ b/app/controllers/bids_controller.rb @@ -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' diff --git a/app/controllers/boards_controller.rb b/app/controllers/boards_controller.rb index 72e134fbf..ed9fcd52f 100644 --- a/app/controllers/boards_controller.rb +++ b/app/controllers/boards_controller.rb @@ -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 diff --git a/app/controllers/comments_controller.rb b/app/controllers/comments_controller.rb index 90c034fdb..72d9ebbe5 100644 --- a/app/controllers/comments_controller.rb +++ b/app/controllers/comments_controller.rb @@ -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 diff --git a/app/controllers/contestnotifications_controller.rb b/app/controllers/contestnotifications_controller.rb index 6b05e8e4d..f9c7e80c2 100644 --- a/app/controllers/contestnotifications_controller.rb +++ b/app/controllers/contestnotifications_controller.rb @@ -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 diff --git a/app/controllers/contests_controller.rb b/app/controllers/contests_controller.rb index 71edfe835..f3b471a6a 100644 --- a/app/controllers/contests_controller.rb +++ b/app/controllers/contests_controller.rb @@ -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] diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index 945b8c514..01945358d 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -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) } @@ -544,7 +543,6 @@ class CoursesController < ApplicationController def finishcourse yesterday = Date.today.prev_day.to_time - @course_prefs.endup_time = yesterday @save_flag = @course_prefs.save get_courses diff --git a/app/controllers/custom_fields_controller.rb b/app/controllers/custom_fields_controller.rb index c20516a1d..d017de5ca 100644 --- a/app/controllers/custom_fields_controller.rb +++ b/app/controllers/custom_fields_controller.rb @@ -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 diff --git a/app/controllers/documents_controller.rb b/app/controllers/documents_controller.rb index 721ae07ce..bf2a7b303 100644 --- a/app/controllers/documents_controller.rb +++ b/app/controllers/documents_controller.rb @@ -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 # 权限判断 diff --git a/app/controllers/enumerations_controller.rb b/app/controllers/enumerations_controller.rb index 4e5475bec..58e76ed4a 100644 --- a/app/controllers/enumerations_controller.rb +++ b/app/controllers/enumerations_controller.rb @@ -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 diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb index ef6e20644..89ad42c17 100644 --- a/app/controllers/files_controller.rb +++ b/app/controllers/files_controller.rb @@ -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 diff --git a/app/controllers/forums_controller.rb b/app/controllers/forums_controller.rb index d3de11177..88bec0f2a 100644 --- a/app/controllers/forums_controller.rb +++ b/app/controllers/forums_controller.rb @@ -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 diff --git a/app/controllers/groups_controller.rb b/app/controllers/groups_controller.rb index b2f9d6af5..0b7eeacfb 100644 --- a/app/controllers/groups_controller.rb +++ b/app/controllers/groups_controller.rb @@ -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 diff --git a/app/controllers/homework_attach_controller.rb b/app/controllers/homework_attach_controller.rb index 920cd9d4d..030c8d1b1 100644 --- a/app/controllers/homework_attach_controller.rb +++ b/app/controllers/homework_attach_controller.rb @@ -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 diff --git a/app/controllers/issue_categories_controller.rb b/app/controllers/issue_categories_controller.rb index 472514cb9..8b7a8d5ce 100644 --- a/app/controllers/issue_categories_controller.rb +++ b/app/controllers/issue_categories_controller.rb @@ -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 diff --git a/app/controllers/issue_relations_controller.rb b/app/controllers/issue_relations_controller.rb index cd008529a..f3689044b 100644 --- a/app/controllers/issue_relations_controller.rb +++ b/app/controllers/issue_relations_controller.rb @@ -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 diff --git a/app/controllers/issue_statuses_controller.rb b/app/controllers/issue_statuses_controller.rb index cedd6a9f9..376eb5b8b 100644 --- a/app/controllers/issue_statuses_controller.rb +++ b/app/controllers/issue_statuses_controller.rb @@ -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 diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index b522a09d6..aa68f5867 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -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 diff --git a/app/controllers/journals_controller.rb b/app/controllers/journals_controller.rb index 77ee9d648..4ebef9971 100644 --- a/app/controllers/journals_controller.rb +++ b/app/controllers/journals_controller.rb @@ -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 diff --git a/app/controllers/members_controller.rb b/app/controllers/members_controller.rb index daf11b33f..12d979098 100644 --- a/app/controllers/members_controller.rb +++ b/app/controllers/members_controller.rb @@ -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 diff --git a/app/controllers/messages_controller.rb b/app/controllers/messages_controller.rb index 63ac3baaa..0fe5f1a3e 100644 --- a/app/controllers/messages_controller.rb +++ b/app/controllers/messages_controller.rb @@ -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 diff --git a/app/controllers/my_controller.rb b/app/controllers/my_controller.rb index ccdf80464..4e23fc41b 100644 --- a/app/controllers/my_controller.rb +++ b/app/controllers/my_controller.rb @@ -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 diff --git a/app/controllers/news_controller.rb b/app/controllers/news_controller.rb index e564bc940..ce06ea199 100644 --- a/app/controllers/news_controller.rb +++ b/app/controllers/news_controller.rb @@ -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 diff --git a/app/controllers/notificationcomments_controller.rb b/app/controllers/notificationcomments_controller.rb index 43cad6cbb..86345e9c6 100644 --- a/app/controllers/notificationcomments_controller.rb +++ b/app/controllers/notificationcomments_controller.rb @@ -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 diff --git a/app/controllers/open_source_projects_controller.rb b/app/controllers/open_source_projects_controller.rb index ee3af10ce..d4ac4027a 100644 --- a/app/controllers/open_source_projects_controller.rb +++ b/app/controllers/open_source_projects_controller.rb @@ -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 diff --git a/app/controllers/project_enumerations_controller.rb b/app/controllers/project_enumerations_controller.rb index c473102af..0534deed6 100644 --- a/app/controllers/project_enumerations_controller.rb +++ b/app/controllers/project_enumerations_controller.rb @@ -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 diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 6770d0c02..bf0717aae 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -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 diff --git a/app/controllers/queries_controller.rb b/app/controllers/queries_controller.rb index 639255125..d9a933c68 100644 --- a/app/controllers/queries_controller.rb +++ b/app/controllers/queries_controller.rb @@ -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 diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index 39865d4e9..c9550add3 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -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 diff --git a/app/controllers/roles_controller.rb b/app/controllers/roles_controller.rb index f4bae1e81..5d1ab45d9 100644 --- a/app/controllers/roles_controller.rb +++ b/app/controllers/roles_controller.rb @@ -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 diff --git a/app/controllers/search_controller.rb b/app/controllers/search_controller.rb index 66a9b674b..112bc173e 100644 --- a/app/controllers/search_controller.rb +++ b/app/controllers/search_controller.rb @@ -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 diff --git a/app/controllers/settings_controller.rb b/app/controllers/settings_controller.rb index 586c23956..19a0669f3 100644 --- a/app/controllers/settings_controller.rb +++ b/app/controllers/settings_controller.rb @@ -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}" diff --git a/app/controllers/softapplications_controller.rb b/app/controllers/softapplications_controller.rb index 067465b40..5d87bebb6 100644 --- a/app/controllers/softapplications_controller.rb +++ b/app/controllers/softapplications_controller.rb @@ -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 diff --git a/app/controllers/stores_controller.rb b/app/controllers/stores_controller.rb index 26ed51a59..a68d12517 100644 --- a/app/controllers/stores_controller.rb +++ b/app/controllers/stores_controller.rb @@ -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 diff --git a/app/controllers/timelog_controller.rb b/app/controllers/timelog_controller.rb index a44f41879..e26608cf5 100644 --- a/app/controllers/timelog_controller.rb +++ b/app/controllers/timelog_controller.rb @@ -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) diff --git a/app/controllers/trackers_controller.rb b/app/controllers/trackers_controller.rb index a317f82de..66a7eec03 100644 --- a/app/controllers/trackers_controller.rb +++ b/app/controllers/trackers_controller.rb @@ -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 diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 638a883d2..d05447d06 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -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 diff --git a/app/controllers/versions_controller.rb b/app/controllers/versions_controller.rb index c3aff06e1..57f26103c 100644 --- a/app/controllers/versions_controller.rb +++ b/app/controllers/versions_controller.rb @@ -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 diff --git a/app/controllers/web_footer_companies_controller.rb b/app/controllers/web_footer_companies_controller.rb index 499e6288d..b61a58189 100644 --- a/app/controllers/web_footer_companies_controller.rb +++ b/app/controllers/web_footer_companies_controller.rb @@ -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 diff --git a/app/controllers/welcome_controller.rb b/app/controllers/welcome_controller.rb index dee79bc31..2e1d5349f 100644 --- a/app/controllers/welcome_controller.rb +++ b/app/controllers/welcome_controller.rb @@ -62,11 +62,12 @@ class WelcomeController < ApplicationController def course @course_page = FirstPage.where("page_type = 'course'").first - if params[:school_id] - @school_id = params[:school_id] - elsif User.current.logged? && User.current.user_extensions.try(:school) - @school_id = User.current.user_extensions.school.try(:id) - end + #if params[:school_id] + # @school_id = params[:school_id] + #elsif User.current.logged? && User.current.user_extensions.try(:school) + # @school_id = User.current.user_extensions.school.try(:id) + #end + @school_id = params[:school_id] || User.current.user_extensions.school.try(:id) @logoLink ||= logolink() end @@ -126,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 diff --git a/app/controllers/wiki_controller.rb b/app/controllers/wiki_controller.rb index 39b3b1753..2acbd660a 100644 --- a/app/controllers/wiki_controller.rb +++ b/app/controllers/wiki_controller.rb @@ -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 diff --git a/app/controllers/wikis_controller.rb b/app/controllers/wikis_controller.rb index cdd778e48..d600efe78 100644 --- a/app/controllers/wikis_controller.rb +++ b/app/controllers/wikis_controller.rb @@ -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 diff --git a/app/controllers/words_controller.rb b/app/controllers/words_controller.rb index f2502e03e..7752b530b 100644 --- a/app/controllers/words_controller.rb +++ b/app/controllers/words_controller.rb @@ -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 @@ -236,7 +236,7 @@ class WordsController < ApplicationController #modify by nwb #添加对课程留言的支持 referer = request.headers["Referer"] - obj_id = referer.match(%r(/([0-9]{1,})(/|$)))[1] + obj_id = referer.match(%r(/([0-9]{1,})(/|\?|$)))[1] if referer.match(/project/) obj = Project.find_by_id(obj_id) elsif referer.match(/course/) diff --git a/app/controllers/workflows_controller.rb b/app/controllers/workflows_controller.rb index 06ae30e2e..44b76cb87 100644 --- a/app/controllers/workflows_controller.rb +++ b/app/controllers/workflows_controller.rb @@ -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 diff --git a/app/controllers/zipdown_controller.rb b/app/controllers/zipdown_controller.rb index a7d804321..df834f13c 100644 --- a/app/controllers/zipdown_controller.rb +++ b/app/controllers/zipdown_controller.rb @@ -31,7 +31,8 @@ class ZipdownController < ApplicationController end send_file zipfile, :filename => obj.name+".zip", :type => detect_content_type(zipfile) if zipfile - #rescue NameError, ActiveRecord::RecordNotFound => e + rescue Exception => e + render file: 'public/no_file_found.html' , :layout => 'course_base' #logger.error "[ZipDown] ===> #{e}" #@error = e end diff --git a/app/helpers/web_footer_companies_helper.rb b/app/helpers/web_footer_companies_helper.rb deleted file mode 100644 index ac4b7da09..000000000 --- a/app/helpers/web_footer_companies_helper.rb +++ /dev/null @@ -1,2 +0,0 @@ -module WebFooterCompaniesHelper -end diff --git a/app/helpers/welcome_helper.rb b/app/helpers/welcome_helper.rb index 1139deb35..2399179b8 100644 --- a/app/helpers/welcome_helper.rb +++ b/app/helpers/welcome_helper.rb @@ -136,31 +136,33 @@ module WelcomeHelper #获取课程列表 # add by nwb - def find_miracle_course(sum=10, max_rate=7, school_id) + def find_miracle_course(sum=10, max_rate=7, school_id, time,term) if User.current.user_extensions.nil? && User.current.user_extensions.school.nil? and school_id.nil? Course.active.visible. joins(:memberships). + where("courses.time = #{time} and courses.term = #{term}"). group('members.course_id'). reorder("courses.created_at DESC, COUNT(members.course_id) DESC").take sum else if school_id.nil? Course.active.visible. joins(:memberships). - where("#{Course.table_name}.school_id = ?", User.current.user_extensions.school.id). + where("#{Course.table_name}.school_id = ? and courses.time = ? and courses.term = ?", User.current.user_extensions.school.id, time, term). group('members.course_id'). - reorder("courses.created_at DESC, COUNT(members.course_id) DESC").take sum + reorder("COUNT(members.course_id) DESC").take sum else if school_id == "0" Course.active.visible. joins(:memberships). + where("courses.time = #{time} and courses.term = #{term}"). group('members.course_id'). - reorder("courses.created_at DESC, COUNT(members.course_id) DESC").take sum + reorder("COUNT(members.course_id) DESC").take sum else Course.active.visible. joins(:memberships). - where("#{Course.table_name}.school_id = ?", school_id). + where("#{Course.table_name}.school_id = ? and courses.time = ? and courses.term = ?", school_id, time, term). group('members.course_id'). - reorder("courses.created_at DESC, COUNT(members.course_id) DESC").take sum + reorder("COUNT(members.course_id) DESC").take sum end end end @@ -229,16 +231,28 @@ module WelcomeHelper end # modif by nwb - def find_all_new_hot_course limit = 9 ,school_id = 0 + def find_all_new_hot_course limit = 9 ,school_id = nil, year_now, course_term #sort_project_by_hot_rails 1, 'course_ac_para DESC', limit - time_now = Time.new.strftime("%Y") - if school_id - courses = Course.includes(:school, :members).visible.joins(:course_status).where("#{Course.table_name}.created_at like '%#{time_now}%' and #{Course.table_name}.school_id <> - ?", school_id).order("course_ac_para DESC").limit(limit).all - else - courses = Course.includes(:school, :members).visible.joins(:course_status).where("#{Course.table_name}.created_at like '%#{time_now}%' and #{Course.table_name}.school_id is not NULL - ").order("course_ac_para DESC").limit(limit).all - end + #time_now = Time.new.strftime("%Y") + #if school_id + #courses = Course.includes(:school, :members).visible.joins(:course_status).where("#{Course.table_name}.created_at like '%#{time_now}%' and #{Course.table_name}.school_id <> + # ?", school_id).order("course_ac_para DESC").limit(limit).all + #else + # courses = Course.includes(:school, :members).visible.joins(:course_status).where("#{Course.table_name}.created_at like '%#{time_now}%' and #{Course.table_name}.school_id is not NULL + # ").order("course_ac_para DESC").limit(limit).all + # end + school_id.nil? ? + courses = Course.includes(:school, :members).visible. + joins(:memberships). + where("courses.time = ? and courses.term = ? and courses.school_id is not NULL", year_now, course_term). + group('members.course_id'). + reorder("COUNT(members.course_id) DESC").limit(limit).all + : + courses = Course.includes(:school, :members).visible. + joins(:course_status). + where("courses.time = ? and courses.term = ? and courses.school_id <> ?",year_now, course_term, school_id). + group('members.course_id'). + reorder("COUNT(members.course_id) DESC").limit(limit).all courses end diff --git a/app/models/activity.rb b/app/models/activity.rb index 635171653..4676ca7b8 100644 --- a/app/models/activity.rb +++ b/app/models/activity.rb @@ -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 diff --git a/app/models/attachment.rb b/app/models/attachment.rb index c934a5ce8..a0012492d 100644 --- a/app/models/attachment.rb +++ b/app/models/attachment.rb @@ -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 diff --git a/app/models/auth_source.rb b/app/models/auth_source.rb index 0b4db9bcc..fdaf622b3 100644 --- a/app/models/auth_source.rb +++ b/app/models/auth_source.rb @@ -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 diff --git a/app/models/auth_source_ldap.rb b/app/models/auth_source_ldap.rb index 25cdc6f1b..8eae422e5 100644 --- a/app/models/auth_source_ldap.rb +++ b/app/models/auth_source_ldap.rb @@ -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) diff --git a/app/models/bid.rb b/app/models/bid.rb index f65d71fa8..038c45cd5 100644 --- a/app/models/bid.rb +++ b/app/models/bid.rb @@ -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 diff --git a/app/models/biding_project.rb b/app/models/biding_project.rb index 0b7b3718e..9ebd1b73c 100644 --- a/app/models/biding_project.rb +++ b/app/models/biding_project.rb @@ -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, diff --git a/app/models/board.rb b/app/models/board.rb index b51790e19..0d8c21ab2 100644 --- a/app/models/board.rb +++ b/app/models/board.rb @@ -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| diff --git a/app/models/bug_to_osp.rb b/app/models/bug_to_osp.rb index 9cd1d7359..3d93957cf 100644 --- a/app/models/bug_to_osp.rb +++ b/app/models/bug_to_osp.rb @@ -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 diff --git a/app/models/change.rb b/app/models/change.rb index b80b96eb9..304a2fb59 100644 --- a/app/models/change.rb +++ b/app/models/change.rb @@ -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 diff --git a/app/models/changeset.rb b/app/models/changeset.rb index b9ce4acf5..5a617b790 100644 --- a/app/models/changeset.rb +++ b/app/models/changeset.rb @@ -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)) diff --git a/app/models/comment.rb b/app/models/comment.rb index 577afe942..f261fcb9e 100644 --- a/app/models/comment.rb +++ b/app/models/comment.rb @@ -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 diff --git a/app/models/contest.rb b/app/models/contest.rb index b2c11ceac..59f8ee470 100644 --- a/app/models/contest.rb +++ b/app/models/contest.rb @@ -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 diff --git a/app/models/contest_notification.rb b/app/models/contest_notification.rb index d525b4b3a..79d8bc254 100644 --- a/app/models/contest_notification.rb +++ b/app/models/contest_notification.rb @@ -1,4 +1,4 @@ class ContestNotification < ActiveRecord::Base attr_accessible :content, :title - validates_length_of :title, maximum: 30 + validates :title, length: {maximum: 30} end diff --git a/app/models/contesting_project.rb b/app/models/contesting_project.rb index 641990b8a..3db6d6f86 100644 --- a/app/models/contesting_project.rb +++ b/app/models/contesting_project.rb @@ -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, diff --git a/app/models/contestnotification.rb b/app/models/contestnotification.rb index 0bda49548..fff861ab4 100644 --- a/app/models/contestnotification.rb +++ b/app/models/contestnotification.rb @@ -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 diff --git a/app/models/course.rb b/app/models/course.rb index 1c2828adc..36329ccda 100644 --- a/app/models/course.rb +++ b/app/models/course.rb @@ -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 diff --git a/app/models/course_status.rb b/app/models/course_status.rb index b36661ebe..85969e55e 100644 --- a/app/models/course_status.rb +++ b/app/models/course_status.rb @@ -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 diff --git a/app/models/web_footer_company.rb b/app/models/web_footer_company.rb index 0e5f37976..bca8dfb5d 100644 --- a/app/models/web_footer_company.rb +++ b/app/models/web_footer_company.rb @@ -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\-\.,@?^=%&:\/~\+#]*[\w\-\@?^=%&\/~\+#])?/,: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\-\.,@?^=%&:\/~\+#]*[\w\-\@?^=%&\/~\+#])?/, + message: l(:is_not_url_error) + } end diff --git a/app/views/bids/_fork_form.html.erb b/app/views/bids/_fork_form.html.erb index 3fcf0f02e..7a7010794 100644 --- a/app/views/bids/_fork_form.html.erb +++ b/app/views/bids/_fork_form.html.erb @@ -10,13 +10,13 @@

<%= f.text_area :description, :rows => 8, :value => @bid.description, :class => 'wiki-edit', :style => "font-size:small;width:490px;margin-left:10px;", :maxlength => Bid::DESCRIPTION_LENGTH_LIMIT %>

- -

<%= f.text_field :deadline, :value => nil,:required => true, :size => 60, :style => "width:150px;" %><%= calendar_for('bid_deadline')%> +

<%= f.text_field :deadline, :value => nil,:required => true, :size => 60, :style => "width:150px;" , :readonly => true %><%= calendar_for('bid_deadline')%>

<%= f.select :is_evaluation, is_evaluation_option %> diff --git a/app/views/bids/_form.html.erb b/app/views/bids/_form.html.erb index c5c284d85..98277d315 100644 --- a/app/views/bids/_form.html.erb +++ b/app/views/bids/_form.html.erb @@ -30,6 +30,6 @@

-

<%= f.text_field :deadline, :required => true, :size => 60, :style => "width:150px;", :placeholder => "#{l(:label_deadline)}" %><%= calendar_for('bid_deadline')%> +

<%= f.text_field :deadline, :required => true, :size => 60, :style => "width:150px;", :placeholder => "#{l(:label_deadline)}", :readonly => true %><%= calendar_for('bid_deadline')%>

diff --git a/app/views/bids/_form_contest.html.erb b/app/views/bids/_form_contest.html.erb index 448af2e8e..e2dba9271 100644 --- a/app/views/bids/_form_contest.html.erb +++ b/app/views/bids/_form_contest.html.erb @@ -33,4 +33,4 @@

-

<%= f.text_field :deadline, :required => true, :size => 60, :style => "width:150px;", :placeholder => "#{l(:label_deadline)}" %><%= calendar_for('bid_deadline')%>

+

<%= f.text_field :deadline, :required => true, :size => 60, :style => "width:150px;", :readonly => true, :placeholder => "#{l(:label_deadline)}" %><%= calendar_for('bid_deadline')%>

diff --git a/app/views/bids/_history.html.erb b/app/views/bids/_history.html.erb index 00a497e78..b67421823 100644 --- a/app/views/bids/_history.html.erb +++ b/app/views/bids/_history.html.erb @@ -19,41 +19,48 @@ <% if journals.size >0 %> - <% end %> diff --git a/app/views/bids/_homework_form.html.erb b/app/views/bids/_homework_form.html.erb index 226eae650..145e01f1c 100644 --- a/app/views/bids/_homework_form.html.erb +++ b/app/views/bids/_homework_form.html.erb @@ -29,17 +29,21 @@

<%= f.text_area :description, :rows => 8, :class => 'wiki-edit', :style => "font-size:small;width:490px;", :maxlength => Bid::DESCRIPTION_LENGTH_LIMIT %>

-

<%= f.text_field(:deadline, :required => true, :size => 60, :style => "width:150px;", :onchange => "regexDeadLine();") %> +

<%= f.text_field(:deadline, :required => true, :size => 60, :style => "width:150px;", :readonly => true, :onchange => "regexDeadLine();") %> <%= calendar_for('bid_deadline')%>

-

<%= f.select :is_evaluation, is_evaluation_option %> +

+ <%= f.select :is_evaluation, is_evaluation_option %>

-

<%= f.select :proportion, proportion_option %> +

+ <%= f.select :proportion, proportion_option %>

-

<%= hidden_field_tag 'course_id', @course.id %> +

+ <%= hidden_field_tag 'course_id', @course.id %>

-
<%= l(:label_attachment_plural) %> -

<%= render :partial => 'attachments/form', :locals => {:container => @homework} %>

+
+ <%= l(:label_attachment_plural) %> +

<%= render :partial => 'attachments/form', :locals => {:container => @bid} %>

\ No newline at end of file diff --git a/app/views/bids/_new_bid.html.erb b/app/views/bids/_new_bid.html.erb index afce79577..db1387a00 100644 --- a/app/views/bids/_new_bid.html.erb +++ b/app/views/bids/_new_bid.html.erb @@ -69,7 +69,7 @@ border-top: 1px solid #acaeb1; border-bottom: 1px solid #acaeb1; margin-top: 30p <%= text_field_tag 'bid_deadline', "#{l(:label_deadline)}", :class => 'noline', :required => true, - :onfocus => "clearInfo('bid_deadline', '#{l(:label_deadline)}')", :onblur => "showInfo('bid_deadline', '#{l(:label_deadline)}')"%> + :onfocus => "clearInfo('bid_deadline', '#{l(:label_deadline)}')", :readonly => true, :onblur => "showInfo('bid_deadline', '#{l(:label_deadline)}')"%> <%= calendar_for('bid_deadline')%> diff --git a/app/views/bids/edit.html.erb b/app/views/bids/edit.html.erb index fe92977ae..b02898353 100644 --- a/app/views/bids/edit.html.erb +++ b/app/views/bids/edit.html.erb @@ -55,6 +55,6 @@
<%#= render :partial => 'homework_form', :locals => { :f => f } %> <%= render :partial => 'homework_form', :locals => { :f => f } %> - + <% end %>
\ No newline at end of file diff --git a/app/views/boards/_course_show.html.erb b/app/views/boards/_course_show.html.erb index 35e066d45..26576195d 100644 --- a/app/views/boards/_course_show.html.erb +++ b/app/views/boards/_course_show.html.erb @@ -17,7 +17,7 @@ <%= form_for @message, :url => new_board_message_path(@board), :html => {:multipart => true, :id => 'message-form'} do |f| %> <%= render :partial => 'messages/form', :locals => {:f => f} %>

<%= submit_tag l(:button_create), :class => "whiteButton m3p10 h30" %> - <%= preview_link(preview_board_message_path(@board), 'message-form' ,target='preview',{:class => 'whiteButton m3p10'} )%> | + <%#= preview_link(preview_board_message_path(@board), 'message-form' ,target='preview',{:class => 'whiteButton m3p10'} )%> <%= link_to l(:button_cancel), "#", :onclick => '$("#add-message").hide(); return false;' ,:class => 'whiteButton m3p10' %>

<% end %>
diff --git a/app/views/boards/_project_show.html.erb b/app/views/boards/_project_show.html.erb index 199155838..d615c877c 100644 --- a/app/views/boards/_project_show.html.erb +++ b/app/views/boards/_project_show.html.erb @@ -18,8 +18,8 @@ <%= form_for @message, :url => new_board_message_path(@board), :html => {:multipart => true, :id => 'message-form'} do |f| %> <%= render :partial => 'messages/form', :locals => {:f => f} %>

<%= submit_tag l(:button_create), :class => "whiteButton m3p10 h30" %> - <%= preview_link(preview_board_message_path(@board), 'message-form', target='preview', {:class => 'whiteButton m3p10'}) %> - | + <%#= preview_link(preview_board_message_path(@board), 'message-form', target='preview', {:class => 'whiteButton m3p10'}) %> + <%= link_to l(:button_cancel), "#", :onclick => '$("#add-message").hide(); return false;', :class => 'whiteButton m3p10' %>

<% end %>
diff --git a/app/views/common/403.html b/app/views/common/403.html new file mode 100644 index 000000000..8462570e4 --- /dev/null +++ b/app/views/common/403.html @@ -0,0 +1,41 @@ + + + + +没有访问权限 + + + + + +
+
403
+
+

ERROR FORBIDDEN
+ 没有访问权限!建议您

+ +
+ +
+ + diff --git a/app/views/common/404.html b/app/views/common/404.html new file mode 100644 index 000000000..5a3eaec9f --- /dev/null +++ b/app/views/common/404.html @@ -0,0 +1,41 @@ + + + + +页面不见了 + + + + + +
+
404
+
+

ERROR PAGE
+ 页面不见了!建议您

+ +
+ +
+ + diff --git a/app/views/common/_preview.html.erb b/app/views/common/_preview.html.erb index 90d83ce8c..cf26d78ab 100644 --- a/app/views/common/_preview.html.erb +++ b/app/views/common/_preview.html.erb @@ -1,3 +1,3 @@
<%= l(:label_preview) %> -<%= textilizable @text, :attachments => @attachments, :object => @previewed %> + <%= textilizable @text, :attachments => @attachments, :object => @previewed %>
diff --git a/app/views/contestnotifications/edit.html.erb b/app/views/contestnotifications/edit.html.erb index 27e38f999..22f484724 100644 --- a/app/views/contestnotifications/edit.html.erb +++ b/app/views/contestnotifications/edit.html.erb @@ -7,7 +7,7 @@ :method => :put } do |f| %> <%= render :partial => 'form', :locals => { :f => f } %> <%= submit_tag l(:button_save) %> -<%= preview_link preview_contestnotifications_path(id: @contestnotification), +<%#= preview_link preview_contestnotifications_path(id: @contestnotification), 'contestnotifications-form' %> <% end %> diff --git a/app/views/contests/_form_contest.html.erb b/app/views/contests/_form_contest.html.erb index 513419668..ffd273db9 100644 --- a/app/views/contests/_form_contest.html.erb +++ b/app/views/contests/_form_contest.html.erb @@ -68,6 +68,7 @@ :required => true, :size => 60, :style => "width:150px;", + :readonly => true, :placeholder => "#{l(:label_deadline)}" %> <%= calendar_for('contest_deadline')%> diff --git a/app/views/contests/_new_softapplication.html.erb b/app/views/contests/_new_softapplication.html.erb index 3e4c0c9e0..fb16e9351 100644 --- a/app/views/contests/_new_softapplication.html.erb +++ b/app/views/contests/_new_softapplication.html.erb @@ -4,7 +4,7 @@ //验证作品名称 function regexName() { - var name = $("#softapplication_name").val(); + var name = $.trim($("#softapplication_name").val()); if(name.length == 0) { $("#spane_name_notice").text("<%= l(:label_no_softapplication_name) %>"); @@ -31,7 +31,7 @@ //验证作品简介 function regexDescription() { - var name = $("#softapplication_description").val(); + var name = $.trim($("#softapplication_description").val()); if(name.length ==0) { $("#span_sofapplication_description").text("<%= l(:label_no_softapplication_description) %>"); @@ -56,7 +56,7 @@ //验证运行平台 function regexWorkdescription() { - var workDescription = $("#softapplication_android_min_version_available").val(); + var workDescription = $.trim($("#softapplication_android_min_version_available").val()); if(workDescription.length ==0) { $("#spane_workdescription_notice").text("<%= l(:label_no_softapplication_platform) %>"); @@ -80,7 +80,7 @@ //验证开发人员 function regexDevelopers() { - var workDescription = $("#softapplication_application_developers").val(); + var workDescription = $.trim($("#softapplication_application_developers").val()); if(workDescription.length ==0) { $("#span_softapplication_application_developers").text("<%= l(:label_no_softapplication_developers) %>"); diff --git a/app/views/courses/_homework_form.html.erb b/app/views/courses/_homework_form.html.erb index 4b63b8852..b397b8d8f 100644 --- a/app/views/courses/_homework_form.html.erb +++ b/app/views/courses/_homework_form.html.erb @@ -34,7 +34,7 @@ <%#= f.text_field :budget, :required => true, :size => 60, :style => "width:350px;", :placeholder => l(:label_bids_reward_what) %>

--> <% time = (Time.now + 3600 * 24).strftime('%Y-%m-%d') %> -

<%= f.text_field(:deadline, :required => true, :size => 60, :style => "width:150px;",:value => "#{time}", :onchange => "regexDeadLine();") %> +

<%= f.text_field(:deadline, :required => true, :size => 60, :style => "width:150px;",:value => "#{time}", :onchange => "regexDeadLine();", :readonly => true) %> <%= calendar_for('bid_deadline')%> diff --git a/app/views/courses/finishcourse.js.erb b/app/views/courses/finishcourse.js.erb index 75c2b774d..46bc57e32 100644 --- a/app/views/courses/finishcourse.js.erb +++ b/app/views/courses/finishcourse.js.erb @@ -1,12 +1,12 @@ <% if @save_flag %> -<% if Rails.env.development? %> -console.debug('课程修改成功:结束时间改为<%=Course.find_by_extra(@course.extra).try(:endup_time)%>'); -<% end %> -$('#content-title-top-div').html("<%= j(render partial: 'users/my_course_ex', :locals => {:memberships => @memberships,:user=>@user, -:memberships_doing=>@memberships_doing,:memberships_done=>@memberships_done} )%>") -$('#finish_course_<%=@course.id%>').replaceWith("<%= j(render partial: 'courses/set_course_time', :locals => {:course => @course} )%>") + <% if Rails.env.development? %> + console.debug('课程修改成功:结束时间改为<%=Course.find_by_extra(@course.extra).try(:endup_time)%>'); + <% end %> + $('#content-title-top-div').html("<%= j(render partial: 'users/my_course_ex', :locals => {:memberships => @memberships,:user=>@user, + :memberships_doing=>@memberships_doing,:memberships_done=>@memberships_done} )%>"); + $('#finish_course_<%=@course.id%>').replaceWith("<%= j(render partial: 'courses/set_course_time', :locals => {:course => @course} )%>"); <% else %> -alert('权限不足,设置失败,请在论坛提交问题,等待管理员处理。'); + alert('权限不足,设置失败,请在论坛提交问题,等待管理员处理。'); <% end %> diff --git a/app/views/courses/index.html.erb b/app/views/courses/index.html.erb index 24eefd4cb..907be64a4 100644 --- a/app/views/courses/index.html.erb +++ b/app/views/courses/index.html.erb @@ -56,9 +56,9 @@

<% end %> -<% other_formats_links do |f| %> - <%= f.link_to 'Atom', :url => {:key => User.current.rss_key} %> -<% end %> +<%# other_formats_links do |f| %> + <%#= f.link_to 'Atom', :url => {:key => User.current.rss_key} %> +<%# end %> <% content_for :sidebar do %> <%= form_tag({}, :method => :get) do %> diff --git a/app/views/courses/search.html.erb b/app/views/courses/search.html.erb index 25b45e0db..e25cd5349 100644 --- a/app/views/courses/search.html.erb +++ b/app/views/courses/search.html.erb @@ -45,13 +45,13 @@ <% if User.current.logged? %>

- <%= l(:label_my_projects) %> + <%= l(:label_my_course) %>

<% end %> -<% other_formats_links do |f| %> -<%= f.link_to 'Atom', :url => {:key => User.current.rss_key} %> -<% end %> +<%# other_formats_links do |f| %> +<%#= f.link_to 'Atom', :url => {:key => User.current.rss_key} %> +<%# end %> <% content_for :sidebar do %> <%= form_tag({}, :method => :get) do %> diff --git a/app/views/issues/bulk_edit.html.erb b/app/views/issues/bulk_edit.html.erb index 281c7a309..2924ad927 100644 --- a/app/views/issues/bulk_edit.html.erb +++ b/app/views/issues/bulk_edit.html.erb @@ -107,14 +107,14 @@ <% if @safe_attributes.include?('start_date') %>

- <%= text_field_tag 'issue[start_date]', '', :size => 10 %><%= calendar_for('issue_start_date') %> + <%= text_field_tag 'issue[start_date]', '', :size => 10, :readonly => true %><%= calendar_for('issue_start_date') %>

<% end %> <% if @safe_attributes.include?('due_date') %>

- <%= text_field_tag 'issue[due_date]', '', :size => 10 %><%= calendar_for('issue_due_date') %> + <%= text_field_tag 'issue[due_date]', '', :size => 10, :readonly => true %><%= calendar_for('issue_due_date') %>

<% end %> diff --git a/app/views/layouts/_base_footer.html.erb b/app/views/layouts/_base_footer.html.erb index 3509276c7..cfe950eae 100644 --- a/app/views/layouts/_base_footer.html.erb +++ b/app/views/layouts/_base_footer.html.erb @@ -10,8 +10,10 @@ <%= @organize.description.html_safe unless @organize.nil?%>

diff --git a/app/views/layouts/_base_header.html.erb b/app/views/layouts/_base_header.html.erb index b0daf8c88..c3b06759c 100644 --- a/app/views/layouts/_base_header.html.erb +++ b/app/views/layouts/_base_header.html.erb @@ -42,48 +42,25 @@ @@ -98,7 +75,7 @@ \ No newline at end of file diff --git a/app/views/messages/_form.html.erb b/app/views/messages/_form.html.erb index 4eab5658c..2cfeea80e 100644 --- a/app/views/messages/_form.html.erb +++ b/app/views/messages/_form.html.erb @@ -5,12 +5,22 @@
<% unless replying %> -


+

+ +
<%= f.text_field :subject, :size => 60, :style => "width: 99%;", :id => "message_subject", :maxlength => 254 %>

<% else %> -


- <%= f.text_field :subject, :size => 60, :style => "width: 99%;", :id => "message_subject", :readonly => true %> +

+ +
+ <%= f.text_field :subject, :size => 60, :style => "width: 99%;", :id => "message_subject", :readonly => true %>

<% end %>

@@ -31,7 +41,8 @@

<%= label_tag "message_content", l(:description_message_content), :class => "hidden-for-sighted" %> - <%= f.text_area :content, :cols => 80, :rows => 13, :class => 'wiki-edit', :id => 'message_content' %> + <%= f.text_area :content, :cols => 80, :rows => 13, :class => 'wiki-edit', :id => 'message_content', :onblur => "regexContent();" %> +

diff --git a/app/views/news/_course_news.html.erb b/app/views/news/_course_news.html.erb index ea94244d5..f66def486 100644 --- a/app/views/news/_course_news.html.erb +++ b/app/views/news/_course_news.html.erb @@ -74,9 +74,9 @@ <%= labelled_form_for @news, :url => course_news_index_path(@course), :html => {:id => 'news-form', :multipart => true} do |f| %> <%= render :partial => 'news/course_form', :locals => {:f => f, :is_new => true} %> - <%= link_to l(:button_create), "#", :onclick => 'submitNews();', :onmouseover => 'submitFocus(this);', :class => 'whiteButton m3p10' %>| - <%= preview_link preview_news_path(:course_id => @course), 'news-form', target='preview', {:class => 'whiteButton m3p10'} %> - | + <%= link_to l(:button_create), "#", :onclick => 'submitNews();', :onmouseover => 'submitFocus(this);', :class => 'whiteButton m3p10' %> + <%#= preview_link preview_news_path, 'news-form', target='preview', {:class => 'whiteButton m3p10'} %> + <%= link_to l(:button_cancel), "#", :onclick => '$("#add-news").hide()', :class => 'whiteButton m3p10' %> <% end if @course %>
diff --git a/app/views/news/_course_show.html.erb b/app/views/news/_course_show.html.erb index 6e03e8e34..6f13c28c7 100644 --- a/app/views/news/_course_show.html.erb +++ b/app/views/news/_course_show.html.erb @@ -70,7 +70,7 @@ <%= render :partial => 'course_form', :locals => { :f => f, :is_new => false } %> <%#= submit_tag l(:button_save) %> <%= link_to l(:button_save), "#", :onclick => 'submitNews();',:onmouseover => 'this.focus()',:class => 'whiteButton m3p10' %> - <%= preview_link preview_news_path(:course_id => @course, :id => @news), 'news-form',target='preview',{:class => 'whiteButton m3p10'} %> | + <%#= preview_link preview_news_path(:course_id => @course, :id => @news), 'news-form',target='preview',{:class => 'whiteButton m3p10'} %> <%= link_to l(:button_cancel), "#", :onclick => '$("#edit-news").hide(); return false;',:class => 'whiteButton m3p10' %> <% end %>
diff --git a/app/views/news/_project_news.html.erb b/app/views/news/_project_news.html.erb index 75f33d1d3..79217f1fe 100644 --- a/app/views/news/_project_news.html.erb +++ b/app/views/news/_project_news.html.erb @@ -84,8 +84,8 @@ <%#= submit_tag l(:button_create), :class => 'whiteButton m3p10 h30', :name => nil %> <%= link_to l(:button_create), "#", :onclick => 'submitNews();',:onmouseover => 'submitFocus(this);', :class => 'whiteButton m3p10' %> | - <%= preview_link preview_news_path(:project_id => @project), 'news-form', target='preview', {:class => 'whiteButton m3p10'} %> - | + <%#= preview_link preview_news_path(:project_id => @project), 'news-form', target='preview', {:class => 'whiteButton m3p10'} %> + <%= link_to l(:button_cancel), "#", :onclick => '$("#add-news").hide()', :class => 'whiteButton m3p10' %> <% end if @project %>
diff --git a/app/views/news/_project_show.html.erb b/app/views/news/_project_show.html.erb index 665094cc8..7b4c209b0 100644 --- a/app/views/news/_project_show.html.erb +++ b/app/views/news/_project_show.html.erb @@ -70,7 +70,7 @@ <%= render :partial => 'form', :locals => { :f => f } %> <%#= submit_tag l(:button_save) %> <%= link_to l(:button_save), "#", :onclick => 'submitNews();',:onmouseover => 'this.focus()',:class => 'whiteButton m3p10' %> - <%= preview_link preview_news_path(:project_id => @project, :id => @news), 'news-form',target='preview',{:class => 'whiteButton m3p10'} %> | + <%#= preview_link preview_news_path(:project_id => @project, :id => @news), 'news-form',target='preview',{:class => 'whiteButton m3p10'} %> <%= link_to l(:button_cancel), "#", :onclick => '$("#edit-news").hide(); return false;',:class => 'whiteButton m3p10' %> <% end %>
diff --git a/app/views/news/edit.html.erb b/app/views/news/edit.html.erb index e5e5221b9..3225f8031 100644 --- a/app/views/news/edit.html.erb +++ b/app/views/news/edit.html.erb @@ -3,7 +3,7 @@ <%= 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) %> -<%= preview_link preview_news_path(:project_id => @project, :id => @news), 'news-form' %> +<%#= preview_link preview_news_path(:project_id => @project, :id => @news), 'news-form' %> <% end %>
diff --git a/app/views/news/new.html.erb b/app/views/news/new.html.erb index 836d3b6ed..03c1d3ee7 100644 --- a/app/views/news/new.html.erb +++ b/app/views/news/new.html.erb @@ -4,14 +4,14 @@ :html => {:id => 'news-form', :multipart => true} do |f| %> <%= render :partial => 'news/form', :locals => {:f => f} %> <%= submit_tag l(:button_create), :class => "whiteButton m3p10 h30" %> - <%= preview_link preview_news_path(:project_id => @project), 'news-form', target='preview', {:class => 'whiteButton m3p10'} %> + <%#= preview_link preview_news_path(:project_id => @project), 'news-form', target='preview', {:class => 'whiteButton m3p10'} %> <% end %> <% elsif @course %> <%= labelled_form_for @news, :url => course_news_index_path(@course), :html => {:id => 'news-form', :multipart => true} do |f| %> <%= render :partial => 'news/form', :locals => {:f => f} %> <%= submit_tag l(:button_create), :class => "whiteButton m3p10 h30" %> - <%= preview_link preview_news_path(:course_id => @course), 'news-form', target='preview', {:class => 'whiteButton m3p10'} %> + <%#= preview_link preview_news_path(:course_id => @course), 'news-form', target='preview', {:class => 'whiteButton m3p10'} %> <% end %> <% end %>
diff --git a/app/views/projects/_new_homework.html.erb b/app/views/projects/_new_homework.html.erb index 1da188f3b..64a76aa0f 100644 --- a/app/views/projects/_new_homework.html.erb +++ b/app/views/projects/_new_homework.html.erb @@ -68,7 +68,7 @@ border-top: 1px solid #acaeb1; border-bottom: 1px solid #acaeb1; margin-top: 30p
- <%= text_field_tag 'bid_deadline', "#{l(:label_deadline)}", :class => 'noline', :required => true, + <%= text_field_tag 'bid_deadline', "#{l(:label_deadline)}", :class => 'noline', :readonly => true, :required => true, :onfocus => "clearInfo('bid_deadline', '#{l(:label_deadline)}')", :onblur => "showInfo('bid_deadline', '#{l(:label_deadline)}')"%> <%= calendar_for('bid_deadline')%> diff --git a/app/views/timelog/_form.html.erb b/app/views/timelog/_form.html.erb index 3256feaac..a3c0fa81b 100644 --- a/app/views/timelog/_form.html.erb +++ b/app/views/timelog/_form.html.erb @@ -13,7 +13,7 @@ <%= f.text_field :issue_id, :size => 6 %> <%= h("#{@time_entry.issue.tracker.name} ##{@time_entry.issue.id}: #{@time_entry.issue.subject}") if @time_entry.issue %>

-

<%= f.text_field :spent_on, :size => 10, :required => true %><%= calendar_for('time_entry_spent_on') %>

+

<%= f.text_field :spent_on, :size => 10, :required => true, :readonly => true %><%= calendar_for('time_entry_spent_on') %>

<%= f.text_field :hours, :size => 6, :required => true %>

<%= f.text_field :comments, :size => 100, :maxlength => 255 %>

<%= f.select :activity_id, activity_collection_for_select_options(@time_entry), :required => true %>

diff --git a/app/views/timelog/bulk_edit.html.erb b/app/views/timelog/bulk_edit.html.erb index caabc18a2..a7ccc36fc 100644 --- a/app/views/timelog/bulk_edit.html.erb +++ b/app/views/timelog/bulk_edit.html.erb @@ -18,7 +18,7 @@

- <%= text_field :time_entry, :spent_on, :size => 10 %><%= calendar_for('time_entry_spent_on') %> + <%= text_field :time_entry, :spent_on, :size => 10, :readonly => true %><%= calendar_for('time_entry_spent_on') %>

diff --git a/app/views/versions/_form.html.erb b/app/views/versions/_form.html.erb index d852b3dab..d0729c720 100644 --- a/app/views/versions/_form.html.erb +++ b/app/views/versions/_form.html.erb @@ -2,15 +2,40 @@ <%= error_messages_for 'version' %>

-

<%= f.text_field :name, :size => 60, :required => true %>

-

<%= f.text_field :description, :size => 60, :style => "margin-left:10px;" %>

-

<%= f.select :status, Version::VERSION_STATUSES.collect {|s| [l("version_status_#{s}"), s]} %>

-

<%= f.text_field :wiki_page_title, :label => :label_wiki_page, :size => 60, :disabled => @project.wiki.nil? %>

-

<%= f.text_field :effective_date, :size => 10 %><%= calendar_for('version_effective_date') %>

-

<%= f.select :sharing, @version.allowed_sharings.collect {|v| [format_version_sharing(v), v]} %>

+

+ <%= f.text_field :name, :size => 60, :required => true %> +

+

+ <%= f.text_field :description, :size => 60, :style => "margin-left:10px;" %> +

+

+ + <%= f.select :status, Version::VERSION_STATUSES.collect {|s| [l("version_status_#{s}"), s]} %> + +

+

+ + <%= f.text_field :wiki_page_title, :label => :label_wiki_page, :size => 60, :disabled => @project.wiki.nil? %> + +

+

+ + <%= f.text_field :effective_date, :size => 10, :readonly => true %> + <%= calendar_for('version_effective_date') %> + +

+

+ + <%= f.select :sharing, @version.allowed_sharings.collect {|v| [format_version_sharing(v), v]} %> + +

<% @version.custom_field_values.each do |value| %> -

<%= custom_field_tag_with_label :version, value %>

+

+ + <%= custom_field_tag_with_label :version, value %> + +

<% end %>
diff --git a/app/views/welcome/course.html.erb b/app/views/welcome/course.html.erb index d28c89aa8..ea8963f7e 100644 --- a/app/views/welcome/course.html.erb +++ b/app/views/welcome/course.html.erb @@ -78,29 +78,28 @@

<%= l(:lable_hot_course)%>

- <% if @school_id %> - <% school_course = find_miracle_course(10,7, @school_id) %> - <% else %> - <%school_course=[]%> - <% end %> - <% if (school_course.count == 0) %> - <%= render :partial => 'more_course', :locals => {:school_id => nil}%> + <% month_now = Time.now.strftime("%m").to_i %> + <% year_now = Time.new.strftime("%Y") %> + + <% (month_now >= 3 && month_now < 9) ? course_term = "春季学期" : course_term = "秋季学期" %> + <% @school_id.nil? ? cur_school_course = [] : cur_school_course = find_miracle_course(10,7,@school_id, year_now, course_term) %> + + <% if cur_school_course.count == 0 %> + <%= render :partial => 'more_course', :locals => {:school_id => nil}%>
    - <% if User.current.logged? %>
  • <%= render :partial => 'no_course_title', :locals => {:course_title => l(:label_school_no_course)} %>
  • - <%= render :partial => 'course_list', :locals => {:course_list => find_all_new_hot_course(9, @school_id)} %> - <% else %> - <%= render :partial => 'course_list', :locals => {:course_list => find_all_new_hot_course(10, @school_id)} %> <% end %> + <% User.current.logged? ? course_count = 9 : course_count = 10 %> + <%= render :partial => 'course_list', :locals => {:course_list => find_all_new_hot_course(course_count, @school_id, year_now, course_term)} %>
<% else %> - <% if school_course.count < 9 %> + <% if cur_school_course.count < 9 %> <%= render :partial => 'more_course', :locals => {:school_id => nil}%> @@ -111,12 +110,12 @@ <% end %>
    - <%= render :partial => 'course_list', :locals => {:course_list => school_course} %> - <% if school_course.count < 9 %> + <%= render :partial => 'course_list', :locals => {:course_list => cur_school_course} %> + <% if cur_school_course.count < 9 %>
  • <%= render :partial => 'no_course_title', :locals => {:course_title => l(:label_school_less_course)} %>
  • - <%= render :partial => 'course_list', :locals => {:course_list => find_all_new_hot_course(9 - school_course.count, @school_id)} %> + <%= render :partial => 'course_list', :locals => {:course_list => find_all_new_hot_course(9-cur_school_course.count, @school_id, year_now, course_term)} %> <% end %>
@@ -136,19 +135,26 @@ <% find_new_forum_topics(10).each do |topic| %>
  • -       - <%= link_to '['+topic.forum.name + ']', forum_path(topic.forum), :class => 'memo_Bar_title' %><%= link_to topic.subject.truncate(30, omission: '...'), topic.event_url, :class => "gray", :style => "font-size: 10pt !important;" %> + +       + <%= link_to '['+topic.forum.name + ']', forum_path(topic.forum), :class => 'memo_Bar_title' %> + <%= link_to topic.subject, topic.event_url, :class => "gray", :style => "font-size: 10pt !important;" %>
    <%= "#{l(:label_updated_time, value: time_tag_welcome(topic_last_time topic))}".html_safe %> - - <%= l(:label_question_sponsor)%>: <%= link_to topic.author.login.truncate(10, omission: '...'),user_path(topic.author),title: topic.author.login %> + + <%= l(:label_question_sponsor)%>: + <%= link_to topic.author.login.truncate(10, omission: '...'),user_path(topic.author),title: topic.author.login %> - - <%= l(:label_final_reply)%>:<% unless (topic.last_reply.nil? || topic.last_reply.author.nil?) %><%=link_to topic.last_reply.author.login.truncate(10, omission: '...'),user_path(topic.last_reply.author),title: topic.last_reply.author.login%><% end %> + + <%= l(:label_final_reply)%>: + <% unless (topic.last_reply.nil? || topic.last_reply.author.nil?) %> + <%=link_to topic.last_reply.author.login.truncate(10, omission: '...'),user_path(topic.last_reply.author),title: topic.last_reply.author.login%> + <% end %> <%= l(:label_reply)%>(<%= link_to topic.try(:replies_count), topic.event_url %>) diff --git a/app/views/wiki/edit.html.erb b/app/views/wiki/edit.html.erb index 3a1abdd83..ba82865ad 100644 --- a/app/views/wiki/edit.html.erb +++ b/app/views/wiki/edit.html.erb @@ -44,7 +44,7 @@

    <%= submit_tag l(:button_save) %> - <%= preview_link({:controller => 'wiki', :action => 'preview', :project_id => @project, :id => @page.title }, 'wiki_form') %>

    + <%#= preview_link({:controller => 'wiki', :action => 'preview', :project_id => @project, :id => @page.title }, 'wiki_form') %>

    <%= wikitoolbar_for 'content_text' %> <% end %> diff --git a/app/views/words/_new_respond.html.erb b/app/views/words/_new_respond.html.erb index d3f4145a8..64b83d777 100644 --- a/app/views/words/_new_respond.html.erb +++ b/app/views/words/_new_respond.html.erb @@ -1,13 +1,15 @@ <%= form_tag({:controller => 'words', :action => 'create_reply'}, :remote => true) do %> -<%= text_area_tag 'user_notes', "", :class => 'noline', - :style => "resize: none;", :rows => 4, - :placeholder => l(:label_projects_feedback_respond_content), - :maxlength => 250 %> + <%= text_area_tag 'user_notes', "", :class => 'noline', + :style => "resize: none;", :rows => 4, + :placeholder => l(:label_projects_feedback_respond_content), + :maxlength => 250 %> -<%= hidden_field_tag 'reference_id', params[:reference_id], :value => journal.id %> -<%= hidden_field_tag 'reference_user_id', params[:reference_user_id], :value => m_reply_id.user.id %> -<%= hidden_field_tag 'reference_message_id', params[:reference_message_id], :value => m_reply_id.id %> -<%= submit_tag l(:button_projects_feedback_respond), :name => nil , :class => "enterprise", :style => "float: right; margin-top: 1px; margin-right: 4px;"%> + <%= hidden_field_tag 'reference_id', params[:reference_id], :value => journal.id %> + <%= hidden_field_tag 'reference_user_id', params[:reference_user_id], :value => m_reply_id.user.id %> + <%= hidden_field_tag 'reference_message_id', params[:reference_message_id], :value => m_reply_id.id %> + <%= submit_tag l(:button_projects_feedback_respond), :name => nil , + :class => "enterprise", + :style => "float: right; margin-top: 1px; margin-right: 4px;"%> <% end %> \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index f61e61f9d..dedf15dfe 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -100,7 +100,6 @@ RedmineApp::Application.routes.draw do #resources :contestnotifications, :only => [:index, :show, :edit, :update, :destroy] # match '/contestnotifications/:id/notificationcomments', :to => 'notificationcomments#create', :via => :post # match '/contestnotifications/:id/notificationcomments/:notificationcomment_id', :to => 'notificationcomments#destroy', :via => :delete - match '/contestnotifications/preview', :to => 'previews#contestnotification', :as => 'preview_contestnotifications', :via => [:get, :post, :put] ## new added by linchun #新竞赛相关 resources :contests, only: [:index] do resources :contestnotifications do @@ -136,6 +135,19 @@ RedmineApp::Application.routes.draw do end end + match '/news/preview', :to => 'previews#news', :as => 'preview_news', :via => [:get, :post, :put] + match '/issues/preview/new/:project_id', :to => 'previews#issue', :as => 'preview_new_issue', :via => [:get, :post, :put] + match '/issues/preview/edit/:id', :to => 'previews#issue', :as => 'preview_edit_issue', :via => [:get, :post, :put] + match '/issues/preview', :to => 'previews#issue', :as => 'preview_issue', :via => [:get, :post, :put] + match '/contestnotifications/preview', :to => 'previews#contestnotification', :as => 'preview_contestnotifications', :via => [:get, :post, :put] + + #resource :previews, only: [] do + # collection do + # match 'news', :via => [:get, :post, :put] + # match 'issue', :via => [:get, :post, :put] + # end + #end + resources :stores do collection do match 'search', :via => [:get, :post] @@ -188,11 +200,6 @@ RedmineApp::Application.routes.draw do match 'account/activate', :via => :get match 'account/valid_ajax', :via => :get - match '/news/preview', :to => 'previews#news', :as => 'preview_news', :via => [:get, :post, :put] - match '/issues/preview/new/:project_id', :to => 'previews#issue', :as => 'preview_new_issue', :via => [:get, :post, :put] - match '/issues/preview/edit/:id', :to => 'previews#issue', :as => 'preview_edit_issue', :via => [:get, :post, :put] - match '/issues/preview', :to => 'previews#issue', :as => 'preview_issue', :via => [:get, :post, :put] - match 'projects/:id/wiki', :to => 'wikis#edit', :via => :post match 'projects/:id/wiki/destroy', :to => 'wikis#destroy', :via => [:get, :post] diff --git a/public/404.html b/public/404.html index 8f2a53fe2..5b3280ccb 100644 --- a/public/404.html +++ b/public/404.html @@ -1,23 +1,41 @@ - - -Trustie 404 error - + + + + + 页面不见了 + + + -

    Page not found

    -

    The page you were trying to access doesn't exist or has been removed.

    -

    Back

    + +
    +
    404
    +
    +

    ERROR PAGE
    + 页面不见了!建议您

    + +
    + +