Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh
This commit is contained in:
commit
b5773e2bd1
|
@ -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:up VERSION=20140811022947
|
||||||
bundle exec rake db:migrate
|
bundle exec rake db:migrate
|
||||||
bundle exec rake project_score:calculate
|
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
|
||||||
|
|
|
@ -159,7 +159,7 @@ class AdminController < ApplicationController
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
flash[:notice] = l(:notice_successful_update)
|
flash[:notice] = l(:notice_successful_update)
|
||||||
format.html {
|
format.html {
|
||||||
redirect_to admin_first_page_made_url
|
redirect_to first_page_made_url
|
||||||
}
|
}
|
||||||
format.api { render_api_ok }
|
format.api { render_api_ok }
|
||||||
#format.json { render json: @first_page, status: :created, location: @first_page }
|
#format.json { render json: @first_page, status: :created, location: @first_page }
|
||||||
|
@ -194,7 +194,7 @@ class AdminController < ApplicationController
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html {
|
format.html {
|
||||||
flash[:notice] = l(:notice_successful_update)
|
flash[:notice] = l(:notice_successful_update)
|
||||||
redirect_to admin_course_page_made_url
|
redirect_to course_page_made_url
|
||||||
}
|
}
|
||||||
format.api { render_api_ok }
|
format.api { render_api_ok }
|
||||||
end
|
end
|
||||||
|
@ -235,7 +235,7 @@ class AdminController < ApplicationController
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html {
|
format.html {
|
||||||
flash[:notice] = l(:notice_successful_update)
|
flash[:notice] = l(:notice_successful_update)
|
||||||
redirect_to admin_contest_page_made_url
|
redirect_to contest_page_made_url
|
||||||
}
|
}
|
||||||
format.api { render_api_ok }
|
format.api { render_api_ok }
|
||||||
end
|
end
|
||||||
|
@ -270,7 +270,7 @@ class AdminController < ApplicationController
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html {
|
format.html {
|
||||||
flash[:notice] = l(:notice_successful_update)
|
flash[:notice] = l(:notice_successful_update)
|
||||||
redirect_to admin_web_footer_made_url
|
redirect_to web_footer_made_url
|
||||||
}
|
}
|
||||||
format.api { render_api_ok }
|
format.api { render_api_ok }
|
||||||
end
|
end
|
||||||
|
|
|
@ -766,7 +766,7 @@ class ApplicationController < ActionController::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def find_web_footer
|
def find_web_footer
|
||||||
@organize = WebFooterOranizer.first
|
@organizer = WebFooterOranizer.first
|
||||||
@companies = WebFooterCompany.all
|
@companies = WebFooterCompany.all
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -39,9 +39,10 @@ class UsersController < ApplicationController
|
||||||
:user_homeworks, :destroy_membership, :user_activities, :user_projects, :user_newfeedback, :user_comments,
|
: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,
|
: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_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 :auth_user_extension, only: :show
|
||||||
before_filter :rest_user_score, 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
|
accept_api_auth :index, :show, :create, :update, :destroy,:tag_save , :tag_saveEx
|
||||||
|
|
||||||
#william
|
#william
|
||||||
|
@ -80,6 +81,21 @@ class UsersController < ApplicationController
|
||||||
end
|
end
|
||||||
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
|
#added by young
|
||||||
def user_projects
|
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 = Redmine::Activity::Fetcher.new(User.current, :author => @user).events(nil, nil, :limit => 20)
|
||||||
#@events_by_day = events.group_by(&:event_date)
|
#@events_by_day = events.group_by(&:event_date)
|
||||||
@state = 0
|
@state = 0
|
||||||
|
|
||||||
|
|
||||||
#add by huang
|
#add by huang
|
||||||
unless User.current.admin?
|
unless User.current.admin?
|
||||||
if !@user.active? #|| (@user != User.current && @memberships.empty? && events.empty?)
|
if !@user.active? #|| (@user != User.current && @memberships.empty? && events.empty?)
|
||||||
|
|
|
@ -7,9 +7,10 @@ class ContestingProject < ActiveRecord::Base
|
||||||
|
|
||||||
DESCRIPTION_LENGTH_LIMIT = 500
|
DESCRIPTION_LENGTH_LIMIT = 500
|
||||||
validates :description, length: {maximum:DESCRIPTION_LENGTH_LIMIT }
|
validates :description, length: {maximum:DESCRIPTION_LENGTH_LIMIT }
|
||||||
validates :user_id, presence: true
|
validates :user_id, presence: true
|
||||||
validates :contest_id, presence: true, uniqueness: {:scope => :project_id}
|
validates :contest_id, presence: true, uniqueness: {scope: :project_id}
|
||||||
validates :project_id, presence: true
|
validates :project_id, presence: true
|
||||||
|
|
||||||
validate :validate_user
|
validate :validate_user
|
||||||
validate :validate_contest
|
validate :validate_contest
|
||||||
validate :validate_project
|
validate :validate_project
|
||||||
|
|
|
@ -7,14 +7,12 @@
|
||||||
|
|
||||||
<!--gcm-->
|
<!--gcm-->
|
||||||
<p>
|
<p>
|
||||||
<%= @organize.description.html_safe unless @organize.nil?%>
|
<%= @organizer.description.html_safe unless @organizer.nil?%>
|
||||||
</p>
|
</p>
|
||||||
<div id="logo_link">
|
<div id="logo_link">
|
||||||
<% unless @companies.nil?%>
|
<% @companies && @companies.each do |company| %>
|
||||||
<% @companies.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>
|
<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 %>
|
||||||
<% end %>
|
|
||||||
</div>
|
</div>
|
||||||
<!--gcm-->
|
<!--gcm-->
|
||||||
|
|
||||||
|
|
|
@ -274,7 +274,7 @@
|
||||||
<% if @user.user_extensions.identity == 2 %>
|
<% if @user.user_extensions.identity == 2 %>
|
||||||
<%= render_menu :user_enterprise_menu %>
|
<%= render_menu :user_enterprise_menu %>
|
||||||
<% else %>
|
<% else %>
|
||||||
<%= render_menu :user_menu %>
|
<%= render_menu :user_menu,@user %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -241,6 +241,7 @@ RedmineApp::Application.routes.draw do
|
||||||
match "tag_saveEx" , :via => [:get, :post]
|
match "tag_saveEx" , :via => [:get, :post]
|
||||||
end
|
end
|
||||||
member do
|
member do
|
||||||
|
match 'user_projects_index', :to => 'users#user_projects_index', :via => :get
|
||||||
match 'user_projects', :to => 'users#user_projects', :via => :get
|
match 'user_projects', :to => 'users#user_projects', :via => :get
|
||||||
match 'user_activities', :to => 'users#user_activities', :via => :get, :as => "user_activities"
|
match 'user_activities', :to => 'users#user_activities', :via => :get, :as => "user_activities"
|
||||||
match 'user_newfeedback', :to => 'users#user_newfeedback', :via => :get, :as => "user_newfeedback"
|
match 'user_newfeedback', :to => 'users#user_newfeedback', :via => :get, :as => "user_newfeedback"
|
||||||
|
@ -592,10 +593,10 @@ RedmineApp::Application.routes.draw do
|
||||||
match 'admin', :to => 'admin#index', :via => :get
|
match 'admin', :to => 'admin#index', :via => :get
|
||||||
match 'admin/projects', :via => :get
|
match 'admin/projects', :via => :get
|
||||||
match 'admin/users', :via => :get
|
match 'admin/users', :via => :get
|
||||||
match 'admin/first_page_made', :via => [:get,:post]
|
match 'admin/first_page_made', as: :first_page_made
|
||||||
match 'admin/course_page_made', :via => [:get,:post]
|
match 'admin/course_page_made', as: :course_page_made
|
||||||
match 'admin/contest_page_made', :via => [:get,:post]
|
match 'admin/contest_page_made', as: :contest_page_made
|
||||||
match 'admin/web_footer_made', :via => [:get,:post]
|
match 'admin/web_footer_made', as: :web_footer_made
|
||||||
match 'admin/search', :via => [:get, :post]
|
match 'admin/search', :via => [:get, :post]
|
||||||
match 'admin/plugins', :via => :get
|
match 'admin/plugins', :via => :get
|
||||||
match 'admin/info', :via => :get
|
match 'admin/info', :via => :get
|
||||||
|
|
|
@ -415,9 +415,25 @@ Redmine::MenuManager.map :course_menu do |menu|
|
||||||
end
|
end
|
||||||
Redmine::MenuManager.map :user_menu do |menu|
|
Redmine::MenuManager.map :user_menu do |menu|
|
||||||
menu.push :activity, {:controller => 'users', :action => 'show', :host => Setting.user_domain }
|
menu.push :activity, {:controller => 'users', :action => 'show', :host => Setting.user_domain }
|
||||||
menu.push :user_course, {:controller => 'users', :action => 'user_courses'},:if => Proc.new {|c| FirstPage.find_by_page_type('project').show_course != 2}
|
menu.push :user_course, {:controller => 'users', :action => 'user_courses'},
|
||||||
|
:if => Proc.new {|u| if User.current == u || User.current.admin?
|
||||||
|
membership = u.coursememberships.all
|
||||||
|
else
|
||||||
|
membership = u.coursememberships.all(:conditions => Course.visible_condition(User.current))
|
||||||
|
end
|
||||||
|
FirstPage.find_by_page_type('project').show_course != 2 && membership && membership.count > 0
|
||||||
|
}
|
||||||
#menu.push :user_homework, {:controller => 'users', :action => 'user_homeworks'} by huang
|
#menu.push :user_homework, {:controller => 'users', :action => 'user_homeworks'} by huang
|
||||||
menu.push :user_project, {:controller => 'users', :action => 'user_projects', :host => Setting.project_domain}
|
menu.push :user_project, {:controller => 'users', :action => 'user_projects_index', :host => Setting.project_domain},
|
||||||
|
:if => Proc.new {|u| if User.current.admin?
|
||||||
|
memberships = u.memberships.all(conditions: "projects.project_type = #{Project::ProjectType_project}").first
|
||||||
|
else
|
||||||
|
cond = Project.visible_condition(User.current) + " AND projects.project_type <> 1"
|
||||||
|
memberships = u.memberships.all(:conditions => cond).first
|
||||||
|
end
|
||||||
|
watch_projects = Project.joins(:watchers).where("project_type <>? and watchable_type = ? and `watchers`.user_id = ?", '1','Project', u.id).first
|
||||||
|
memberships || watch_projects
|
||||||
|
}
|
||||||
# menu.push :requirement_focus, {:controller => 'users', :action => 'watch_bids'} by huang
|
# menu.push :requirement_focus, {:controller => 'users', :action => 'watch_bids'} by huang
|
||||||
menu.push :user_newfeedback, {:controller => 'users', :action => 'user_newfeedback', :host => Setting.user_domain}
|
menu.push :user_newfeedback, {:controller => 'users', :action => 'user_newfeedback', :host => Setting.user_domain}
|
||||||
|
|
||||||
|
|
|
@ -216,7 +216,7 @@ module Redmine
|
||||||
# * Checking the url target (project only)
|
# * Checking the url target (project only)
|
||||||
# * Checking the conditions of the item
|
# * Checking the conditions of the item
|
||||||
def allowed_node?(node, user, project)
|
def allowed_node?(node, user, project)
|
||||||
if project && user && !user.allowed_to?(node.url, project)
|
if project && project.is_a?(Project) && user && !user.allowed_to?(node.url, project)
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
if node.condition && !node.condition.call(project)
|
if node.condition && !node.condition.call(project)
|
||||||
|
|
Loading…
Reference in New Issue