diff --git a/ReadMe.txt b/ReadMe.txt index 538457d3d..895e7ffb8 100644 --- a/ReadMe.txt +++ b/ReadMe.txt @@ -88,3 +88,12 @@ bundle exec rake db:migrate:down VERSION=20140811022947 bundle exec rake db:migrate:up VERSION=20140811022947 bundle exec rake db:migrate bundle exec rake project_score:calculate +=================================[2014-10-17]==================================== +kw:数据迁移,web_footer_oranizers表已存在 +bundle exec rake db:migrate:down VERSION=20141013014908 +bundle exec rake db:migrate:up VERSION=20141013014908 +bundle exec rake db:migrate +kw:数据迁移,web_footer_companies表已存在 +bundle exec rake db:migrate:down VERSION=20141013023400 +bundle exec rake db:migrate:up VERSION=20141013023400 +bundle exec rake db:migrate diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb index 7b4e326ad..f3b8b421a 100644 --- a/app/controllers/admin_controller.rb +++ b/app/controllers/admin_controller.rb @@ -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_url + redirect_to 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_url + redirect_to course_page_made_url } format.api { render_api_ok } end @@ -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_url + redirect_to contest_page_made_url } format.api { render_api_ok } 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_url + redirect_to web_footer_made_url } format.api { render_api_ok } end diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 7f3dc0203..1d94d9a7c 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -766,7 +766,7 @@ class ApplicationController < ActionController::Base end def find_web_footer - @organize = WebFooterOranizer.first + @organizer = WebFooterOranizer.first @companies = WebFooterCompany.all end end diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 9d1bb1472..21adfa19e 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -39,9 +39,10 @@ class UsersController < ApplicationController :user_homeworks, :destroy_membership, :user_activities, :user_projects, :user_newfeedback, :user_comments, :watch_bids, :watch_contests, :info, :watch_projects, :show_score, :topic_score_index, :project_score_index, :activity_score_index, :influence_score_index, :score_index,:show_new_score, :topic_new_score_index, :project_new_score_index, - :activity_new_score_index, :influence_new_score_index, :score_new_index] + :activity_new_score_index, :influence_new_score_index, :score_new_index,:user_projects_index] before_filter :auth_user_extension, only: :show before_filter :rest_user_score, only: :show + #before_filter :select_entry, only: :user_projects accept_api_auth :index, :show, :create, :update, :destroy,:tag_save , :tag_saveEx #william @@ -80,6 +81,21 @@ class UsersController < ApplicationController end end + def user_projects_index + if User.current.admin? + memberships = @user.memberships.all(conditions: "projects.project_type = #{Project::ProjectType_project}").first + else + cond = Project.visible_condition(User.current) + " AND projects.project_type <> 1" + memberships = @user.memberships.all(:conditions => cond).first + end + watch_projects = Project.joins(:watchers).where("project_type <>? and watchable_type = ? and `watchers`.user_id = ?", '1','Project', @user.id).first + if memberships.nil? && watch_projects + redirect_to(:watch_projects_user) and return + else + redirect_to(:user_projects_user) and return + end + end + #added by young def user_projects @@ -92,8 +108,6 @@ class UsersController < ApplicationController #events = Redmine::Activity::Fetcher.new(User.current, :author => @user).events(nil, nil, :limit => 20) #@events_by_day = events.group_by(&:event_date) @state = 0 - - #add by huang unless User.current.admin? if !@user.active? #|| (@user != User.current && @memberships.empty? && events.empty?) diff --git a/app/models/contesting_project.rb b/app/models/contesting_project.rb index 3db6d6f86..9828bb598 100644 --- a/app/models/contesting_project.rb +++ b/app/models/contesting_project.rb @@ -7,9 +7,10 @@ class ContestingProject < ActiveRecord::Base DESCRIPTION_LENGTH_LIMIT = 500 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 + 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 diff --git a/app/views/layouts/_base_footer.html.erb b/app/views/layouts/_base_footer.html.erb index 31175ea6d..012729aea 100644 --- a/app/views/layouts/_base_footer.html.erb +++ b/app/views/layouts/_base_footer.html.erb @@ -7,14 +7,12 @@
- <%= @organize.description.html_safe unless @organize.nil?%> + <%= @organizer.description.html_safe unless @organizer.nil?%>