This commit is contained in:
z9hang 2014-10-15 17:27:15 +08:00
commit fadddcc09a
112 changed files with 716 additions and 526 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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

View File

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

View File

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

View File

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

View File

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

View File

@ -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

View File

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

View File

@ -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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -10,13 +10,13 @@
<p style="margin-left:-10px;padding-right: 20px;">
<%= 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 %></p>
<!-- <p><%= select_tag 'bid_reward_type', "<option value = '0'>#{l(:label_choose_reward)}</option><option value = '1'>#{l(:label_money)}</option><option value = '3'>#{l(:label_bids_credit)}</option><option value = '2'>#{l(:label_reward_1)}</option>".html_safe,
<!-- <p><%#= select_tag 'bid_reward_type', "<option value = '0'>#{l(:label_choose_reward)}</option><option value = '1'>#{l(:label_money)}</option><option value = '3'>#{l(:label_bids_credit)}</option><option value = '2'>#{l(:label_reward_1)}</option>".html_safe,
:onChange => "show('bid_reward_type', 'bid_budget', '"+l(:label_bids_reward_what)+"','"+l(:label_bids_new_money)+"','"+l(:label_bids_new_credit)+"','"+l(:label_bids_new_content)+"')" %>
<%= f.text_field :budget, :required => true, :size => 60, :style => "width:350px;", :placeholder => l(:label_bids_reward_what) %>
<%#= f.text_field :budget, :required => true, :size => 60, :style => "width:350px;", :placeholder => l(:label_bids_reward_what) %>
</p> -->
<p><%= f.text_field :deadline, :value => nil,:required => true, :size => 60, :style => "width:150px;" %><%= calendar_for('bid_deadline')%>
<p><%= f.text_field :deadline, :value => nil,:required => true, :size => 60, :style => "width:150px;" , :readonly => true %><%= calendar_for('bid_deadline')%>
<!--
<p><%= f.select :homework_type, homework_type_option %>
<p><%#= f.select :homework_type, homework_type_option %>
</p>
-->
<p><%= f.select :is_evaluation, is_evaluation_option %>

View File

@ -30,6 +30,6 @@
<!-- 设置奖项设置的打开 关闭开关-->
</p>
<p><%= f.text_field :deadline, :required => true, :size => 60, :style => "width:150px;", :placeholder => "#{l(:label_deadline)}" %><%= calendar_for('bid_deadline')%>
<p><%= f.text_field :deadline, :required => true, :size => 60, :style => "width:150px;", :placeholder => "#{l(:label_deadline)}", :readonly => true %><%= calendar_for('bid_deadline')%>
</p>

View File

@ -33,4 +33,4 @@
<!-- 设置奖项设置的打开 关闭开关-->
</p>
<!-- <em class="info" style="margin-left:95px;"><%= l(:text_contest_reward) %></em> -->
<p><%= f.text_field :deadline, :required => true, :size => 60, :style => "width:150px;", :placeholder => "#{l(:label_deadline)}" %><%= calendar_for('bid_deadline')%></p>
<p><%= f.text_field :deadline, :required => true, :size => 60, :style => "width:150px;", :readonly => true, :placeholder => "#{l(:label_deadline)}" %><%= calendar_for('bid_deadline')%></p>

View File

@ -19,41 +19,48 @@
<% if journals.size >0 %>
<ul class="message-for-user">
<% for journal in journals%>
<li id='word_li_<%= journal.id.to_s %>' class="outer-message-for-user">
<span class="portrait"><%= image_tag(url_to_avatar(journal.user), :class => "avatar") %></span>
<span class="body">
<span class="user"><%= link_to journal.user, user_path(journal.user)%></span>
<span class="font_lighter"><%= label %></span>
<div> <%= textilizable journal.notes%> </div>
<span class="font_lighter"><%= l(:label_bids_published) %>&nbsp;<%= time_tag(journal.created_on).html_safe %>&nbsp;<%= l(:label_bids_published_ago) %></span>
<ul class="message-for-user">
<% for journal in journals%>
<li id='word_li_<%= journal.id.to_s %>' class="outer-message-for-user">
<span class="portrait"><%= image_tag(url_to_avatar(journal.user), :class => "avatar") %></span>
<span class="body">
<span class="user"><%= link_to journal.user, user_path(journal.user)%></span>
<span class="font_lighter"><%= label %></span>
<div> <%= textilizable journal.notes%> </div>
<span class="font_lighter">
<%= l(:label_bids_published) %>&nbsp;
<%= time_tag(journal.created_on).html_safe %>&nbsp;
<%= l(:label_bids_published_ago) %>
</span>
<% ids = 'project_respond_form_'+ journal.id.to_s%>
<span>
<% if reply_allow %>
<%= link_to(l(:button_quote), {:controller => 'bids', :action => 'new', :id => bid, :journal_id => journal}, :remote => true,
:method => 'post', :title => l(:button_quote))%>
<%= link_to l(:label_bid_respond_quote),'',
{:focus => 'project_respond', :onclick => "toggleAndSettingWordsVal($('##{ids}'), $('##{ids} textarea'), '#{l(:label_reply_plural)} #{journal.user.name}: '); $('##{ids} textarea') ;return false;"}
%>
<% end %>
<% if @user==User.current|| User.current.admin? %>
<%= link_to(l(:label_bid_respond_delete), {:controller => 'words', :action => 'destroy', :object_id => journal, :user_id => @user}, :remote => true, :confirm => l(:text_are_you_sure), :method => 'delete', :class => "delete", :title => l(:button_delete)) %>
<% end %>
</span>
</span>
<div style="clear: both;"></div>
<% ids = 'project_respond_form_'+ journal.id.to_s%>
<% if reply_allow %>
<div id='<%= ids %>' class="respond-form">
<%= render :partial => 'words/new_respond', :locals => {:journal => journal, :m_reply_id => journal} %>
</div>
<span>
<% if reply_allow %>
<%= link_to(l(:button_quote), {:controller => 'bids', :action => 'new', :id => bid, :journal_id => journal},
:remote => true,:method => 'post', :title => l(:button_quote))%>
<%= link_to l(:label_bid_respond_quote),'',
{:focus => 'project_respond', :onclick => "toggleAndSettingWordsVal($('##{ids}'), $('##{ids} textarea'), '#{l(:label_reply_plural)} #{journal.user.name}: '); $('##{ids} textarea') ;return false;"}
%>
<% end %>
<% if @user==User.current|| User.current.admin? %>
<%= link_to(l(:label_bid_respond_delete),
{:controller => 'words', :action => 'destroy', :object_id => journal, :user_id => @user},
:remote => true, :confirm => l(:text_are_you_sure), :method => 'delete',
:class => "delete", :title => l(:button_delete)) %>
<% end %>
</span>
</span>
<div style="clear: both;"></div>
<% ids = 'project_respond_form_'+ journal.id.to_s%>
<% if reply_allow %>
<div id='<%= ids %>' class="respond-form">
<%= render :partial => 'words/new_respond', :locals => {:journal => journal, :m_reply_id => journal} %>
</div>
<% end %>
<div style="clear: both;"></div>
<div>
<%= render :partial => "words/journal_reply", :locals => {:journal => journal } %>
</div>
</li>
<% end %>
<div style="clear: both;"></div>
<div>
<%= render :partial => "words/journal_reply", :locals => {:journal => journal } %>
</div>
</li>
<% end %>
</ul>
</ul>
<% end %>

View File

@ -29,17 +29,21 @@
<p><span id="bid_name_span"></span></p>
<p><%= f.text_area :description, :rows => 8, :class => 'wiki-edit', :style => "font-size:small;width:490px;", :maxlength => Bid::DESCRIPTION_LENGTH_LIMIT %></p>
<p><%= f.text_field(:deadline, :required => true, :size => 60, :style => "width:150px;", :onchange => "regexDeadLine();") %>
<p><%= f.text_field(:deadline, :required => true, :size => 60, :style => "width:150px;", :readonly => true, :onchange => "regexDeadLine();") %>
<%= calendar_for('bid_deadline')%>
<span id="bid_deadline_span">
</span>
</p>
<p><%= f.select :is_evaluation, is_evaluation_option %>
<p>
<%= f.select :is_evaluation, is_evaluation_option %>
</p>
<p><%= f.select :proportion, proportion_option %>
<p>
<%= f.select :proportion, proportion_option %>
</p>
<p><%= hidden_field_tag 'course_id', @course.id %>
<p>
<%= hidden_field_tag 'course_id', @course.id %>
</p>
<fieldset><legend><%= l(:label_attachment_plural) %></legend>
<p><%= render :partial => 'attachments/form', :locals => {:container => @homework} %></p>
<fieldset>
<legend><%= l(:label_attachment_plural) %></legend>
<p><%= render :partial => 'attachments/form', :locals => {:container => @bid} %></p>
</fieldset>

View File

@ -69,7 +69,7 @@ border-top: 1px solid #acaeb1; border-bottom: 1px solid #acaeb1; margin-top: 30p
</tr>
<tr>
<td colspan="2"><%= 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')%></td>
</tr>
</table>

View File

@ -55,6 +55,6 @@
<div class="box tabular">
<%#= render :partial => 'homework_form', :locals => { :f => f } %>
<%= render :partial => 'homework_form', :locals => { :f => f } %>
<input type="button" onclick="submitHomework(<%= @bid.id%>);" value="<%= l(:button_create)%>" class="enterprise">
<input type="button" onclick="submitHomework(<%= @bid.id%>);" value="<%= l(:button_create)%>" class="enterprise">
<% end %>
</div>

View File

@ -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} %>
<p><%= 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' %></p>
<% end %>
<div id="preview" class="wiki"></div>

View File

@ -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} %>
<p><%= 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' %></p>
<% end %>
<div id="preview" class="wiki"></div>

41
app/views/common/403.html Normal file
View File

@ -0,0 +1,41 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>没有访问权限</title>
<style>
body{ font-size:12px; font-family:"微软雅黑","宋体"; line-height:1.9; background:#fff; font-style:normal;}
div,html,img,ul,li,p,body,h1,h2,h3,h4,p,a,table,tr,td,fieldset,input,span{ margin:0; padding:0;}
div,img,tr,td{ border:0;}
table,tr,td{border:0 cellspacing:0; cellpadding:0;}
ul,li{ list-style-type:none}
.cl{ clear:both; overflow:hidden; }
a{ text-decoration:none; }
a:hover{ }
.error_content{ width:550px; height:200px; margin:0 auto; padding:10px 0;}
.error_left{color:#15bccf; font-size:100px; font-weight:bold; font-style:oblique; width:200px; height:120px; padding-right:30px; float:left;}
.error_right{ width:240px; height:120px; float:left;color:#15bccf; font-size: 17px; font-weight:bold; padding-left:30px; margin-top:40px; border-left:1px dashed #CCC; }
.error_link{ margin-top:8px;}
.error_link a{ display:block; width:80px; height:28px; font-size:14px; font-weight:bold; color:#fff; text-align:center; background:#15bccf; float:left; margin-right:10px;}
.error_link a:hover{ background:#ff8417;}
</style>
</head>
<body>
<div class="error_content">
<div class="error_left">403</div>
<div class="error_right">
<p>ERROR FORBIDDEN<br />
没有访问权限!建议您</p>
<div class="error_link">
<!---<a href="http://forge.trustie.net/" target="_blank">返回首页</a>---->
<a href="#" target="_blank">后退一步</a>
<a href="http://user.trustie.net/users/5/user_newfeedback" target="_blank">给我留言</a>
</div>
</div>
</div>
</body>
</html>

41
app/views/common/404.html Normal file
View File

@ -0,0 +1,41 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>页面不见了</title>
<style>
body{ font-size:12px; font-family:"微软雅黑","宋体"; line-height:1.9; background:#fff;}
div,html,img,ul,li,p,body,h1,h2,h3,h4,p,a,table,tr,td,fieldset,input,span{ margin:0; padding:0;}
div,img,tr,td{ border:0;}
table,tr,td{border:0 cellspacing:0; cellpadding:0;}
ul,li{ list-style-type:none}
.cl{ clear:both; overflow:hidden; }
a{ text-decoration:none; }
a:hover{ }
.error_content{ width:550px; height:200px; margin:0 auto; padding:10px 0;}
.error_left{color:#15bccf; font-size:100px; font-weight:bold; font-style:oblique; width:200px; height:120px; padding-right:30px; float:left;}
.error_right{ width:240px; height:120px; float:left;color:#15bccf; font-size: 18px; font-weight:bold; padding-left:30px; margin-top:40px; border-left:1px dashed #CCC; }
.error_link{ margin-top:8px;}
.error_link a{ display:block; width:80px; height:28px; font-size:14px; font-weight:bold; color:#fff; text-align:center; background:#15bccf; float:left; margin-right:10px;}
.error_link a:hover{ background:#ff8417;}
</style>
</head>
<body>
<div class="error_content">
<div class="error_left">404</div>
<div class="error_right">
<p><span style="font-size:24px;">ERROR PAGE</span><br />
页面不见了!建议您</p>
<div class="error_link">
<!---<a href="http://forge.trustie.net/" target="_blank">返回首页</a>---->
<a href="#" target="_blank">后退一步</a>
<a href="http://user.trustie.net/users/5/user_newfeedback" target="_blank">给我留言</a>
</div>
</div>
</div>
</body>
</html>

View File

@ -1,3 +1,3 @@
<fieldset class="preview"><legend><%= l(:label_preview) %></legend>
<%= textilizable @text, :attachments => @attachments, :object => @previewed %>
<%= textilizable @text, :attachments => @attachments, :object => @previewed %>
</fieldset>

View File

@ -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 %>

View File

@ -68,6 +68,7 @@
:required => true,
:size => 60,
:style => "width:150px;",
:readonly => true,
:placeholder => "#{l(:label_deadline)}"
%>
<%= calendar_for('contest_deadline')%>

View File

@ -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) %>");

View File

@ -34,7 +34,7 @@
<%#= f.text_field :budget, :required => true, :size => 60, :style => "width:350px;", :placeholder => l(:label_bids_reward_what) %>
</p> -->
<% time = (Time.now + 3600 * 24).strftime('%Y-%m-%d') %>
<p><%= f.text_field(:deadline, :required => true, :size => 60, :style => "width:150px;",:value => "#{time}", :onchange => "regexDeadLine();") %>
<p><%= f.text_field(:deadline, :required => true, :size => 60, :style => "width:150px;",:value => "#{time}", :onchange => "regexDeadLine();", :readonly => true) %>
<%= calendar_for('bid_deadline')%>
<span id="bid_deadline_span">
</span>

View File

@ -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 %>

View File

@ -56,9 +56,9 @@
</p>
<% 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 %>

View File

@ -45,13 +45,13 @@
<% if User.current.logged? %>
<p style="text-align:right;">
<span class="my-project"><%= l(:label_my_projects) %></span>
<span class="my-project"><%= l(:label_my_course) %></span>
</p>
<% 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 %>

View File

@ -107,14 +107,14 @@
<% if @safe_attributes.include?('start_date') %>
<p>
<label for='issue_start_date'><%= l(:field_start_date) %></label>
<%= 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') %>
</p>
<% end %>
<% if @safe_attributes.include?('due_date') %>
<p>
<label for='issue_due_date'><%= l(:field_due_date) %></label>
<%= 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') %>
</p>
<% end %>

View File

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

View File

@ -42,48 +42,25 @@
<ul class="sub_menu">
<% if @show_course == 1 %>
<% if User.current.user_extensions && [UserExtensions::TEACHER, UserExtensions::STUDENT].include?(User.current.user_extensions.identity) -%>
<% hasCourse=false %>
<% User.current.courses.each do |course| %>
<% if !course_endTime_timeout?(course) %>
<% hasCourse=true %>
<% end %>
<% end %>
<% if hasCourse %>
<li id="course_loggedas_li" style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;"><%=link_to l(:label_my_course), {:controller => 'users', :action => 'user_courses', id: User.current.id} %>
<ul class="course_sub_menu">
<% hasCourse=false %>
<% User.current.courses.each do |course| %>
<% if !course_endTime_timeout?(course) %>
<li style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;" title="<%=course.name%>"><%= link_to course.name, {:controller => 'courses',:action => 'show',id:course.id} %></li>
<% hasCourse=true %>
<% end %>
<% end %>
</ul>
</li>
<% end %>
<%= render :partial => 'layouts/user_courses_list', :locals => {:hasCourse => hasCourse} %>
<% end -%>
<% end %>
<% if User.current.projects.count>0 %>
<li id="project_loggedas_li" style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;">
<%= link_to l(:label_my_projects), {:controller => 'users', :action => 'user_projects', id: User.current.id, host: Setting.project_domain} %>
<% if hasCourse %>
<ul class="project_sub_menu" style="top: 35px">
<% else %>
<ul class="project_sub_menu" style="top: 0px">
<% end %>
<% User.current.projects.each do |project| %>
<li style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;" title="<%=project.name%>"><%= link_to project.name, {:controller => 'projects', :action => 'show',id: project.id, host: Setting.project_domain } %></li>
<% end %>
</ul>
<%= render :partial => 'layouts/user_project_list', :locals => {:hasCourse => hasCourse} %>
<li style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;">
<%=link_to l(:label_user_edit), {:controller => 'my', :action=> 'account', host: Setting.user_domain}%>
</li>
<% end %>
<li style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;"><%=link_to l(:label_user_edit), {:controller => 'my', :action=> 'account', host: Setting.user_domain}%>
</li>
</ul>
</li>
<li style="padding:0 0; margin:0 0;display:inline;border-bottom: 0;">
<%=link_to l(:label_my_message)+'('+User.current.count_new_jour.to_s+')', { :controller => 'users', :action => 'user_newfeedback', id: User.current.id, host: Setting.user_domain }, {:class => 'my-message'} if User.current.logged?%>
<%=link_to l(:label_my_message)+'('+User.current.count_new_jour.to_s+')',
{ :controller => 'users', :action => 'user_newfeedback', id: User.current.id, host: Setting.user_domain },
{:class => 'my-message'} if User.current.logged?%>
</li>
</ul>
</div>
@ -98,7 +75,7 @@
<script type="text/javascript">
function setMessageCount () {
var mes = $('#loggedas .my-message')
mes.html(mes.html()+'('+<%=User.current.count_new_jour.to_s%>+")")
mes.html(mes.html()+ '(' + <%=User.current.count_new_jour.to_s%> + ")")
}
function addSlipMenu () {

View File

@ -0,0 +1,14 @@
<% if hasCourse %>
<li id="course_loggedas_li" style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;">
<%=link_to l(:label_my_course), {:controller => 'users', :action => 'user_courses', id: User.current.id} %>
<ul class="course_sub_menu">
<% User.current.courses.each do |course| %>
<% if !course_endTime_timeout?(course) %>
<li style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;" title="<%=course.name%>">
<%= link_to course.name, {:controller => 'courses',:action => 'show',id:course.id} %>
</li>
<% end %>
<% end %>
</ul>
</li>
<% end %>

View File

@ -0,0 +1,12 @@
<% if User.current.projects.count>0 %>
<li id="project_loggedas_li" style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;">
<%= link_to l(:label_my_projects), {:controller => 'users', :action => 'user_projects', id: User.current.id, host: Setting.project_domain} %>
<ul class="project_sub_menu" style="top:<%= hasCourse ? 35 : 0 %>px;">
<% User.current.projects.each do |project| %>
<li style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;" title="<%=project.name%>">
<%= link_to project.name, {:controller => 'projects', :action => 'show',id: project.id, host: Setting.project_domain } %>
</li>
<% end %>
</ul>
</li>
<% end %>

View File

@ -66,19 +66,19 @@
<table>
<tr>
<td style="vertical-align: top;font-size: 16px;text-align: center;">
<span style=" word-wrap: break-word; word-break: break-all">
<strong>
<%= link_to course.name.to_s, homework_course_path(course) if course %>
</strong>
</span>
<span style=" word-wrap: break-word; word-break: break-all">
<strong>
<%= link_to course.name.to_s, homework_course_path(course) if course %>
</strong>
</span>
</td>
</tr>
<tr>
<td style=" word-wrap: break-word; word-break: break-all;font-size: 16px;text-align: center">
<span style=" color:#ed8924">
<!-- modified by zjc 添加超链接 -->
<strong><%=link_to(@bid.name, respond_path(@bid)) %></strong>
</span>
<span style=" color:#ed8924">
<!-- modified by zjc 添加超链接 -->
<strong><%=link_to(@bid.name, respond_path(@bid)) %></strong>
</span>
</td>
</tr>
</table>
@ -107,7 +107,7 @@
<tr>
<td valign="top" style="padding-left: 8px; width:60px">主讲老师 :</td>
<td class="font_lighter_sidebar"><%= link_to(@user.lastname+@user.firstname, user_path(@user)) %></td>
<td class="font_lighter_sidebar"><%= link_to(course.teacher.lastname+course.teacher.firstname, user_path(course.teacher)) %></td>
</tr>
<tr>

View File

@ -58,7 +58,6 @@
/*border-radius: 10px;*/
}
</style>
<div class="lz">
<!-- 在这里添加赞和踩-->
<span id="praise_tread" style="float: right"> <%= render :partial => "/praise_tread/praise_tread",:locals => {:obj => @topic,:show_flag => true,:user_id =>User.current.id,:horizontal => true}%> </span>
@ -132,24 +131,24 @@
<td>
<div class="contextual-borad">
<%= link_to(
"引用",
{:action => 'quote', :id => message},
:remote => true,
:method => 'get',
:title => l(:button_quote)) if !@topic.locked? && authorize_for('messages', 'reply') %>
l(:button_quote),
{:action => 'quote', :id => message},
:remote => true,
:method => 'get',
:title => l(:button_quote)) if !@topic.locked? && authorize_for('messages', 'reply') %>
<%= link_to(
#image_tag('edit.png'),
"编辑",
{:action => 'edit', :id => message},
:title => l(:button_edit)
#image_tag('edit.png'),
l(:button_edit),
{:action => 'edit', :id => message},
:title => l(:button_edit)
) if message.course_editable_by?(User.current) %>
<%= link_to(
#image_tag('delete.png'),
"删除",
{:action => 'destroy', :id => message},
:method => :post,
:data => {:confirm => l(:text_are_you_sure)},
:title => l(:button_delete)
#image_tag('delete.png'),
l(:button_delete),
{:action => 'destroy', :id => message},
:method => :post,
:data => {:confirm => l(:text_are_you_sure)},
:title => l(:button_delete)
) if message.course_destroyable_by?(User.current) %>
</div></td>
</tr>
@ -175,10 +174,12 @@
<% end %>
<% if !@topic.locked? && authorize_for_course('messages', 'reply') %>
<div id="reply" style="display:none;">
<%= form_for @reply, :as => :reply, :url => {:action => 'reply', :id => @topic}, :html => {:multipart => true, :id => 'message-form'} do |f| %>
<%= render :partial => 'form', :locals => {:f => f, :replying => true} %>
<%= submit_tag l(:button_submit) %>
<%= preview_link({:controller => 'messages', :action => 'preview', :board_id => @board}, 'message-form') %>
<%#= submit_tag l(:button_submit) %>
<input type="button" class="enterprise" value="<%=l(:button_submit) %>" onclick="submit_message_replay();" >
<%#= preview_link({:controller => 'messages', :action => 'preview', :board_id => @board}, 'message-form') %>
<% end %>
<div id="preview" class="wiki"></div>
</div>
@ -190,4 +191,27 @@
jQuery(document).ready(function($) {
transpotUrl('#content');
});
function submit_message_replay()
{
if(regexContent())
{
$("#message-form").submit();
}
}
function regexContent()
{
var content = $.trim($("#message_content").val());
if(content.length ==0)
{
$("#message_content_span").text("<%= l(:label_reply_empty) %>");
$("#message_content_span").css('color','#ff0000');
return false;
}
else
{
$("#message_content_span").text("<%= l(:label_field_correct) %>");
$("#message_content_span").css('color','#008000');
return true;
}
}
</script>

View File

@ -5,12 +5,22 @@
<div class="box ph10_5">
<!--[form:message]-->
<% unless replying %>
<p><label for="message_subject"><%= l(:field_subject) %><span class="required"> *&nbsp;&nbsp;</span></label><br/>
<p>
<label for="message_subject">
<%= l(:field_subject) %>
<span class="required"> *&nbsp;&nbsp;</span>
</label>
<br/>
<%= f.text_field :subject, :size => 60, :style => "width: 99%;", :id => "message_subject", :maxlength => 254 %><!--by young-->
</p>
<% else %>
<p><label for="message_subject"><%= l(:field_subject) %><span class="required"> *&nbsp;&nbsp;</span></label><br/>
<%= f.text_field :subject, :size => 60, :style => "width: 99%;", :id => "message_subject", :readonly => true %>
<p>
<label for="message_subject">
<%= l(:field_subject) %>
<span class="required"> *&nbsp;&nbsp;</span>
</label>
<br/>
<%= f.text_field :subject, :size => 60, :style => "width: 99%;", :id => "message_subject", :readonly => true %>
</p>
<% end %>
<p>
@ -31,7 +41,8 @@
</p>
<p>
<%= 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();" %>
<span id="message_content_span"></span>
</p>
<!--[eoform:message]-->

View File

@ -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 %>
<div id="preview" class="wiki"></div>

View File

@ -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 %>
<div id="preview" class="wiki"></div>

View File

@ -84,8 +84,8 @@
<%#= submit_tag l(:button_create), :class => 'whiteButton m3p10 h30', :name => nil %><!-- button-submit -->
<%= 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 %>
<div id="preview" class="wiki"></div>

Some files were not shown because too many files have changed in this diff Show More