diff --git a/app/controllers/bids_controller.rb b/app/controllers/bids_controller.rb
index b7951fbe6..f4ff47fba 100644
--- a/app/controllers/bids_controller.rb
+++ b/app/controllers/bids_controller.rb
@@ -15,10 +15,16 @@ class BidsController < ApplicationController
helper :projects
def index
+ @project_type = params[:project_type]
# Modified by nie
# @requirement_title = "4"
@offset, @limit = api_offset_and_limit({:limit => 10})
- @bids = Bid.visible
+ if @project_type == '1'
+ @bids = Bid.visible.where('reward_type = ?', 3)
+ else
+ @bids = Bid.visible.where('reward_type = ? or reward_type = ?', 1, 2)
+ end
+
@bids = @bids.like(params[:name]) if params[:name].present?
@bid_count = @bids.count
@bid_pages = Paginator.new @bid_count, @limit, params['page']
diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb
index 137079233..08e35566e 100644
--- a/app/controllers/courses_controller.rb
+++ b/app/controllers/courses_controller.rb
@@ -6,7 +6,7 @@ class CoursesController < ApplicationController
def join
if User.current.logged?
course = Project.find(params[:object_id])
- if params[:course_password].to_i == Course.find_by_extra(course.identifier).state
+ if params[:course_password] == Course.find_by_extra(course.identifier).password
members = []
members << Member.new(:role_ids => [5], :user_id => User.current.id)
course.members << members
diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb
index 1048c12bd..1e1934ecf 100644
--- a/app/controllers/files_controller.rb
+++ b/app/controllers/files_controller.rb
@@ -45,7 +45,7 @@ class FilesController < ApplicationController
def new
@versions = @project.versions.sort
@course_tag = @project.project_type
- if @course_tag
+ if @project.project_type == 1
render :layout => 'base_courses'
end
end
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb
index e9e35cbd1..f94c5e7d0 100644
--- a/app/controllers/projects_controller.rb
+++ b/app/controllers/projects_controller.rb
@@ -41,8 +41,9 @@ class ProjectsController < ApplicationController
# menu_item l(:label_course_file), :only => files
# menu_item l(:label_settings), :only => settings
- before_filter :find_project, :except => [ :index, :search,:list, :new, :create, :copy, :statistics, :new_join]
- before_filter :authorize, :except => [:new_join, :new_homework, :homework, :statistics, :search, :watcherlist, :index, :list, :new, :create, :copy, :archive, :unarchive, :destroy, :member, :focus, :file, :statistics, :feedback]
+ before_filter :find_project, :except => [ :index, :search,:list, :new, :create, :copy, :statistics, :new_join, :course]
+ before_filter :authorize, :except => [:new_join, :new_homework, :homework, :statistics, :search, :watcherlist, :index, :list, :new, :create, :copy, :archive, :unarchive, :destroy, :member, :focus, :file,
+ :statistics, :feedback, :course]
before_filter :authorize_global, :only => [:new, :create]
before_filter :require_admin, :only => [ :copy, :archive, :unarchive, :destroy, :calendar]
#by young
@@ -110,8 +111,17 @@ class ProjectsController < ApplicationController
# @offset ||= @project_pages.offset
# @projects = Project.visible.offset(@offset).limit(@limit).order('lft').all
@project_type = params[:project_type]
+ @project_type = params[:project_type]
+
@offset, @limit = api_offset_and_limit({:limit => 10})
- @projects_status = ProjectStatus.visible
+ @projects_status = ProjectStatus.visible.where("project_type <> ? or project_type is null", 1)
+ # @projects_status = ProjectStatus.visible
+ # @projects_status.each do |project|
+ # if Project.visible.find_by_id("#{project.project_id}")
+ # project.project_type = Project.visible.find_by_id("#{project.project_id}").project_type
+ # project.save
+ # end
+ # end
# @projects.each do |project|
# @admin = project.users_by_role[Role.find(3)]
# unless @admin.nil?
@@ -192,7 +202,122 @@ class ProjectsController < ApplicationController
@projects = []
@projects_status.each do |obj|
- @projects << Project.visible.find_by_id("#{obj.project_id}") unless Project.visible.find_by_id("#{obj.project_id}").nil?
+ @projects << Project.visible.find_by_id("#{obj.project_id}") unless Project.visible.find_by_id("#{obj.project_id}").nil?
+ end
+ #end
+ respond_to do |format|
+ format.html {
+ render :layout => 'base'
+ scope = Project
+ unless params[:closed]
+ scope = scope.active
+ end
+ }
+ format.api {
+ # @offset, @limit = api_offset_and_limit
+ # @project_count = Project.visible.count
+ # @projects = Project.visible.offset(@offset).limit(@limit).order('lft').all
+ }
+ format.atom {
+ projects = Project.visible.order('created_on DESC').limit(Setting.feeds_limit.to_i).all
+ render_feed(projects, :title => "#{Setting.app_title}: #{l(:label_project_latest)}")
+ }
+ end
+ end
+
+ def course
+ #Modified by nie
+ # @offset, @limit = api_offset_and_limit({:limit => 10})
+ # @project_count = Project.visible.count
+ # @project_pages = Paginator.new @project_count, @limit, params['page']
+ # @offset ||= @project_pages.offset
+ # @projects = Project.visible.offset(@offset).limit(@limit).order('lft').all
+
+ @project_type = params[:project_type]
+
+ @offset, @limit = api_offset_and_limit({:limit => 10})
+ @projects_status = ProjectStatus.visible.where("project_type = ?", 1)
+ # @projects.each do |project|
+ # @admin = project.users_by_role[Role.find(3)]
+ # unless @admin.nil?
+ # @admin.each do |user|
+ # ProjectInfo.create(:user_id => user.id, :project_id => project.id)
+ # end
+ #
+ # end
+ # end
+ # @projects.each do |project|
+ # ProjectStatus.create(:changesets_count => project.changesets.count, :project_id => project.id, :watchers_count => project.watcher_users.count)
+ # end
+ #@projects_status = Project.visible.like(params[:name]) if params[:name].present?
+ @project_count = @projects_status.count
+ @project_pages = Paginator.new @project_count, @limit, params['page']
+
+ @offset ||= @project_pages.reverse_offset
+
+ #@projects = @projects.offset(@offset).limit(@limit).order('created_on DESC').all
+ if params[:project_sort_type].present?
+ case params[:project_sort_type]
+ when '0'
+ @offset ||= @project_pages.reverse_offset
+ unless @offset == 0
+ @projects_status = @projects_status.offset(@offset).limit(@limit).all.reverse
+ else
+ limit = @project_count % @limit
+ if limit == 0
+ limit = @limit
+ end
+ @projects_status = @projects_status.offset(@offset).limit(limit).all.reverse
+ end
+ @s_type = 0
+ # @projects = @projects.sort {|x,y| y.created_on <=> x.created_on }
+ # @projects = @projects[@offset, @limit]
+ when '1'
+ @offset ||= @project_pages.reverse_offset
+ unless @offset == 0
+ @projects_status = @projects_status.reorder('changesets_count').offset(@offset).limit(@limit).all.reverse
+ else
+ limit = @project_count % @limit
+ if limit == 0
+ limit = @limit
+ end
+ @projects_status = @projects_status.reorder('changesets_count').offset(@offset).limit(limit).all.reverse
+ end
+ @s_type = 1
+
+ #@projects = @projects[@offset, @limit]
+ when '2'
+ @offset ||= @project_pages.reverse_offset
+ unless @offset == 0
+ @projects_status = @projects_status.reorder('watchers_count').offset(@offset).limit(@limit).all.reverse
+ else
+ limit = @project_count % @limit
+ if limit == 0
+ limit = @limit
+ end
+ @projects_status = @projects_status.reorder('watchers_count').offset(@offset).limit(limit).all.reverse
+ end
+ @s_type = 2
+ end
+ else
+ @offset ||= @project_pages.reverse_offset
+ unless @offset == 0
+ @projects_status = @projects_status.reorder('changesets_count').offset(@offset).limit(@limit).all.reverse
+ else
+ limit = @project_count % @limit
+ if limit == 0
+ limit = @limit
+ end
+ @projects_status = @projects_status.reorder('changesets_count').offset(@offset).limit(limit).all.reverse
+ end
+ @s_type = 1
+ # @projects = @projects.sort {|x,y| y.created_on <=> x.created_on }
+ # @projects = @projects[@offset, @limit]
+ end
+
+ @projects = []
+ @projects_status.each do |obj|
+ @projects << Project.visible.find_by_id("#{obj.project_id}") unless Project.visible.find_by_id("#{obj.project_id}").nil?
end
#end
respond_to do |format|
@@ -328,6 +453,7 @@ class ProjectsController < ApplicationController
end
def new
+ @project_type = params[:project_type]
@course_tag = params[:course]
@issue_custom_fields = IssueCustomField.sorted.all
@trackers = Tracker.sorted.all
@@ -340,7 +466,8 @@ class ProjectsController < ApplicationController
render :layout => 'base'
end
- def create
+ def create
+
@course_tag = params[:project][:project_type]
if(@course_tag=="1")
@course = Course.new
@@ -385,7 +512,7 @@ class ProjectsController < ApplicationController
redirect_to new_project_path(:course => '1')
#Ended by young
else
- redirect_to settings_project_path(@project)
+ redirect_to settings_project_path(@project,:project_type => 1)
end
}
format.api { render :action => 'show', :status => :created, :location => url_for(:controller => 'projects', :action => 'show', :id => @project.id) }
@@ -482,6 +609,9 @@ class ProjectsController < ApplicationController
# Show @project
def show
+
+ @project_type = params[:project_type]
+
# try to redirect to the requested menu item
if params[:jump] && redirect_to_project_menu_item(@project, params[:jump])
return
@@ -491,7 +621,7 @@ class ProjectsController < ApplicationController
@subprojects = @project.children.visible.all
@news = @project.news.limit(5).includes(:author, :project).reorder("#{News.table_name}.created_on DESC").all
@trackers = @project.rolled_up_trackers
- @user = User.find_by_id(ProjectInfo.find_by_project_id(@project.id).user_id)
+ @user = User.find_by_id(ProjectInfo.find_by_project_id(@project.id).user_id)
cond = @project.project_condition(Setting.display_subprojects_issues?)
@open_issues_by_tracker = Issue.visible.open.where(cond).count(:group => :tracker)
@@ -614,9 +744,11 @@ class ProjectsController < ApplicationController
@project.safe_attributes = params[:project]
if validate_parent_id && @project.save
@course = Course.find_by_extra(@project.identifier)
- @course.state = params[:project][:course][:state]
+ unless @course.nil?
+ @course.password = params[:project][:course][:password]
@course.term = params[:project][:course][:term]
- @course.save
+ @course.save
+ end
@project.set_allowed_parent!(params[:project]['parent_id']) if params[:project].has_key?('parent_id')
if params[:project][:is_public] == '0'
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index 825c79060..6857e8a11 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -203,6 +203,9 @@ class UsersController < ApplicationController
#end
def index
+
+ @project_type = params[:project_type]
+
sort_init 'login', 'asc'
sort_update %w(login firstname lastname mail admin created_on last_login_on)
diff --git a/app/controllers/welcome_controller.rb b/app/controllers/welcome_controller.rb
index c06d4d65f..c00f223c9 100644
--- a/app/controllers/welcome_controller.rb
+++ b/app/controllers/welcome_controller.rb
@@ -72,4 +72,6 @@ class WelcomeController < ApplicationController
@projects = Project.all_public.active
render :layout => false, :content_type => 'text/plain'
end
+
+
end
diff --git a/app/helpers/bids_helper.rb b/app/helpers/bids_helper.rb
index ddab8da7e..ed8c8873f 100644
--- a/app/helpers/bids_helper.rb
+++ b/app/helpers/bids_helper.rb
@@ -39,16 +39,33 @@ module BidsHelper
Bid.tagged_with(tag_name).order('updated_on desc')
end
- def sort_bid(state)
+ #added by huang
+ def sort_bid_enterprise(state, project_type)
content = ''.html_safe
case state
when 0
- content << content_tag('li', link_to(l(:label_sort_by_active), calls_path(:bid_sort_type => '1')))
- content << content_tag('li', link_to(l(:label_sort_by_time), calls_path(:bid_sort_type => '0'), :class=>"selected"), :class=>"selected")
+ content << content_tag('li', link_to(l(:label_sort_by_active), calls_path(:bid_sort_type => '1', :project_type => project_type)))
+ content << content_tag('li', link_to(l(:label_sort_by_time), calls_path(:bid_sort_type => '0', :project_type => project_type), :class=>"selected"), :class=>"selected")
when 1
- content << content_tag('li', link_to(l(:label_sort_by_active), calls_path(:bid_sort_type => '1'), :class=>"selected"), :class=>"selected")
- content << content_tag('li', link_to(l(:label_sort_by_time), calls_path(:bid_sort_type => '0')))
+ content << content_tag('li', link_to(l(:label_sort_by_active), calls_path(:bid_sort_type => '1', :project_type => project_type), :class=>"selected"), :class=>"selected")
+ content << content_tag('li', link_to(l(:label_sort_by_time), calls_path(:bid_sort_type => '0', :project_type => project_type)))
+ end
+ content = content_tag('ul', content)
+ content_tag('div', content, :class => "tabs_enterprise")
+ end
+ #end
+
+ def sort_bid(state, project_type)
+ content = ''.html_safe
+ case state
+ when 0
+ content << content_tag('li', link_to(l(:label_sort_by_active), calls_path(:bid_sort_type => '1', :project_type => project_type)))
+ content << content_tag('li', link_to(l(:label_sort_by_time), calls_path(:bid_sort_type => '0', :project_type => project_type), :class=>"selected"), :class=>"selected")
+
+ when 1
+ content << content_tag('li', link_to(l(:label_sort_by_active), calls_path(:bid_sort_type => '1', :project_type => project_type), :class=>"selected"), :class=>"selected")
+ content << content_tag('li', link_to(l(:label_sort_by_time), calls_path(:bid_sort_type => '0', :project_type => project_type)))
end
content = content_tag('ul', content)
content_tag('div', content, :class => "tabs")
diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb
index 661d5c627..b38d3497a 100644
--- a/app/helpers/projects_helper.rb
+++ b/app/helpers/projects_helper.rb
@@ -38,23 +38,91 @@ module ProjectsHelper
end
- def sort_project(state)
+ # added bu huang
+ def sort_project_enterprise(state, project_type)
content = ''.html_safe
case state
when 0
- content << content_tag('li', link_to(l(:label_sort_by_active), projects_path(:project_sort_type => '1')))
- content << content_tag('li', link_to(l(:label_sort_by_influence), projects_path(:project_sort_type => '2')))
- content << content_tag('li', link_to(l(:label_sort_by_time), projects_path(:project_sort_type => '0'), :class=>"selected"), :class=>"selected")
+ content << content_tag('li', link_to(l(:label_sort_by_active), projects_path(:project_sort_type => '1', :project_type => project_type)))
+ content << content_tag('li', link_to(l(:label_sort_by_influence), projects_path(:project_sort_type => '2', :project_type => project_type)))
+ content << content_tag('li', link_to(l(:label_sort_by_time), projects_path(:project_sort_type => '0', :project_type => project_type), :class=>"selected"), :class=>"selected")
when 1
- content << content_tag('li', link_to(l(:label_sort_by_active), projects_path(:project_sort_type => '1'), :class=>"selected"), :class=>"selected")
- content << content_tag('li', link_to(l(:label_sort_by_influence), projects_path(:project_sort_type => '2')))
- content << content_tag('li', link_to(l(:label_sort_by_time), projects_path(:project_sort_type => '0')))
+ content << content_tag('li', link_to(l(:label_sort_by_active), projects_path(:project_sort_type => '1', :project_type => project_type), :class=>"selected"), :class=>"selected")
+ content << content_tag('li', link_to(l(:label_sort_by_influence), projects_path(:project_sort_type => '2', :project_type => project_type)))
+ content << content_tag('li', link_to(l(:label_sort_by_time), projects_path(:project_sort_type => '0', :project_type => project_type)))
when 2
- content << content_tag('li', link_to(l(:label_sort_by_active), projects_path(:project_sort_type => '1')))
- content << content_tag('li', link_to(l(:label_sort_by_influence), projects_path(:project_sort_type => '2'), :class=>"selected"), :class=>"selected")
- content << content_tag('li', link_to(l(:label_sort_by_time), projects_path(:project_sort_type => '0')))
+ content << content_tag('li', link_to(l(:label_sort_by_active), projects_path(:project_sort_type => '1', :project_type => project_type)))
+ content << content_tag('li', link_to(l(:label_sort_by_influence), projects_path(:project_sort_type => '2', :project_type => project_type), :class=>"selected"), :class=>"selected")
+ content << content_tag('li', link_to(l(:label_sort_by_time), projects_path(:project_sort_type => '0', :project_type => project_type)))
+ end
+ content = content_tag('ul', content)
+ content_tag('div', content, :class => "tabs_enterprise")
+ end
+
+ def sort_course(state, project_type)
+ content = ''.html_safe
+ case state
+ when 0
+
+ content << content_tag('li', link_to(l(:label_sort_by_active), course_path(:project_sort_type => '1', :project_type => project_type)))
+ content << content_tag('li', link_to(l(:label_sort_by_influence), course_path(:project_sort_type => '2', :project_type => project_type)))
+ content << content_tag('li', link_to(l(:label_sort_by_time), course_path(:project_sort_type => '0', :project_type => project_type), :class=>"selected"), :class=>"selected")
+ when 1
+
+ content << content_tag('li', link_to(l(:label_sort_by_active), course_path(:project_sort_type => '1', :project_type => project_type), :class=>"selected"), :class=>"selected")
+ content << content_tag('li', link_to(l(:label_sort_by_influence), course_path(:project_sort_type => '2', :project_type => project_type)))
+ content << content_tag('li', link_to(l(:label_sort_by_time), course_path(:project_sort_type => '0', :project_type => project_type)))
+ when 2
+ content << content_tag('li', link_to(l(:label_sort_by_active), course_path(:project_sort_type => '1', :project_type => project_type)))
+ content << content_tag('li', link_to(l(:label_sort_by_influence), course_path(:project_sort_type => '2', :project_type => project_type), :class=>"selected"), :class=>"selected")
+ content << content_tag('li', link_to(l(:label_sort_by_time), course_path(:project_sort_type => '0', :project_type => project_type)))
+ end
+ content = content_tag('ul', content)
+ content_tag('div', content, :class => "tabs_enterprise")
+ end
+ # end
+
+ def sort_project(state, project_type)
+ content = ''.html_safe
+ case state
+ when 0
+
+ content << content_tag('li', link_to(l(:label_sort_by_active), projects_path(:project_sort_type => '1', :project_type => project_type)))
+ content << content_tag('li', link_to(l(:label_sort_by_influence), projects_path(:project_sort_type => '2', :project_type => project_type)))
+ content << content_tag('li', link_to(l(:label_sort_by_time), projects_path(:project_sort_type => '0', :project_type => project_type), :class=>"selected"), :class=>"selected")
+ when 1
+
+ content << content_tag('li', link_to(l(:label_sort_by_active), projects_path(:project_sort_type => '1', :project_type => project_type), :class=>"selected"), :class=>"selected")
+ content << content_tag('li', link_to(l(:label_sort_by_influence), projects_path(:project_sort_type => '2', :project_type => project_type)))
+ content << content_tag('li', link_to(l(:label_sort_by_time), projects_path(:project_sort_type => '0', :project_type => project_type)))
+ when 2
+ content << content_tag('li', link_to(l(:label_sort_by_active), projects_path(:project_sort_type => '1', :project_type => project_type)))
+ content << content_tag('li', link_to(l(:label_sort_by_influence), projects_path(:project_sort_type => '2', :project_type => project_type), :class=>"selected"), :class=>"selected")
+ content << content_tag('li', link_to(l(:label_sort_by_time), projects_path(:project_sort_type => '0', :project_type => project_type)))
+ end
+ content = content_tag('ul', content)
+ content_tag('div', content, :class => "tabs")
+ end
+
+ def sort_course(state, project_type)
+ content = ''.html_safe
+ case state
+ when 0
+
+ content << content_tag('li', link_to(l(:label_sort_by_active), course_path(:project_sort_type => '1', :project_type => project_type)))
+ content << content_tag('li', link_to(l(:label_sort_by_influence), course_path(:project_sort_type => '2', :project_type => project_type)))
+ content << content_tag('li', link_to(l(:label_sort_by_time), course_path(:project_sort_type => '0', :project_type => project_type), :class=>"selected"), :class=>"selected")
+ when 1
+
+ content << content_tag('li', link_to(l(:label_sort_by_active), course_path(:project_sort_type => '1', :project_type => project_type), :class=>"selected"), :class=>"selected")
+ content << content_tag('li', link_to(l(:label_sort_by_influence), course_path(:project_sort_type => '2', :project_type => project_type)))
+ content << content_tag('li', link_to(l(:label_sort_by_time), course_path(:project_sort_type => '0', :project_type => project_type)))
+ when 2
+ content << content_tag('li', link_to(l(:label_sort_by_active), course_path(:project_sort_type => '1', :project_type => project_type)))
+ content << content_tag('li', link_to(l(:label_sort_by_influence), course_path(:project_sort_type => '2', :project_type => project_type), :class=>"selected"), :class=>"selected")
+ content << content_tag('li', link_to(l(:label_sort_by_time), course_path(:project_sort_type => '0', :project_type => project_type)))
end
content = content_tag('ul', content)
content_tag('div', content, :class => "tabs")
@@ -95,7 +163,7 @@ module ProjectsHelper
render_project_nested_lists(projects) do |project|
#Modified by young
if (project.project_type==1)
- s = link_to_project(project, {}, :class => "#{project.css_classes} #{User.current.member_of?(project) ? 'my-project' : nil}")+"(#{l(:label_course)})".html_safe
+ s = link_to_project(project, {}, :class => "#{project.css_classes} #{User.current.member_of?(project) ? 'my-project' : nil}").html_safe
else
s = link_to_project(project, {}, :class => "#{project.css_classes} #{User.current.member_of?(project) ? 'my-project' : nil}")
end
diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb
index 88e918256..ab163f804 100644
--- a/app/helpers/users_helper.rb
+++ b/app/helpers/users_helper.rb
@@ -113,24 +113,44 @@ module UsersHelper
end
# added by huang
-def sort_user(state)
+def sort_user(state, project_type)
content = ''.html_safe
case state
when 0
- content << content_tag('li', link_to(l(:label_sort_by_active), users_path(:user_sort_type => '1')))
- content << content_tag('li', link_to(l(:label_sort_by_influence), users_path(:user_sort_type => '2')))
- content << content_tag('li', link_to(l(:label_sort_by_time), users_path(:user_sort_type => '0'), :class=>"selected"), :class=>"selected")
+ content << content_tag('li', link_to(l(:label_sort_by_active), users_path(:user_sort_type => '1', :project_type => project_type)))
+ content << content_tag('li', link_to(l(:label_sort_by_influence), users_path(:user_sort_type => '2', :project_type => project_type)))
+ content << content_tag('li', link_to(l(:label_sort_by_time), users_path(:user_sort_type => '0', :project_type => project_type), :class=>"selected"), :class=>"selected")
when 1
- content << content_tag('li', link_to(l(:label_sort_by_active), users_path(:user_sort_type => '1'), :class=>"selected"), :class=>"selected")
- content << content_tag('li', link_to(l(:label_sort_by_influence), users_path(:user_sort_type => '2')))
- content << content_tag('li', link_to(l(:label_sort_by_time), users_path(:user_sort_type => '0')))
+ content << content_tag('li', link_to(l(:label_sort_by_active), users_path(:user_sort_type => '1', :project_type => project_type), :class=>"selected"), :class=>"selected")
+ content << content_tag('li', link_to(l(:label_sort_by_influence), users_path(:user_sort_type => '2', :project_type => project_type)))
+ content << content_tag('li', link_to(l(:label_sort_by_time), users_path(:user_sort_type => '0', :project_type => project_type)))
when 2
- content << content_tag('li', link_to(l(:label_sort_by_active), users_path(:user_sort_type => '1')))
- content << content_tag('li', link_to(l(:label_sort_by_influence), users_path(:user_sort_type => '2'), :class=>"selected"), :class=>"selected")
- content << content_tag('li', link_to(l(:label_sort_by_time), users_path(:user_sort_type => '0')))
+ content << content_tag('li', link_to(l(:label_sort_by_active), users_path(:user_sort_type => '1', :project_type => project_type)))
+ content << content_tag('li', link_to(l(:label_sort_by_influence), users_path(:user_sort_type => '2', :project_type => project_type), :class=>"selected"), :class=>"selected")
+ content << content_tag('li', link_to(l(:label_sort_by_time), users_path(:user_sort_type => '0', :project_type => project_type)))
end
content = content_tag('ul', content)
content_tag('div', content, :class => "tabs")
end
+
+ def sort_user_enterprise(state, project_type)
+ content = ''.html_safe
+ case state
+ when 0
+ content << content_tag('li', link_to(l(:label_sort_by_active), users_path(:user_sort_type => '1', :project_type => project_type)))
+ content << content_tag('li', link_to(l(:label_sort_by_influence), users_path(:user_sort_type => '2', :project_type => project_type)))
+ content << content_tag('li', link_to(l(:label_sort_by_time), users_path(:user_sort_type => '0', :project_type => project_type), :class=>"selected"), :class=>"selected")
+ when 1
+ content << content_tag('li', link_to(l(:label_sort_by_active), users_path(:user_sort_type => '1', :project_type => project_type), :class=>"selected"), :class=>"selected")
+ content << content_tag('li', link_to(l(:label_sort_by_influence), users_path(:user_sort_type => '2', :project_type => project_type)))
+ content << content_tag('li', link_to(l(:label_sort_by_time), users_path(:user_sort_type => '0', :project_type => project_type)))
+ when 2
+ content << content_tag('li', link_to(l(:label_sort_by_active), users_path(:user_sort_type => '1', :project_type => project_type)))
+ content << content_tag('li', link_to(l(:label_sort_by_influence), users_path(:user_sort_type => '2', :project_type => project_type), :class=>"selected"), :class=>"selected")
+ content << content_tag('li', link_to(l(:label_sort_by_time), users_path(:user_sort_type => '0', :project_type => project_type)))
+ end
+ content = content_tag('ul', content)
+ content_tag('div', content, :class => "tabs_enterprise")
+ end
#end
end
diff --git a/app/models/course.rb b/app/models/course.rb
index a216798f0..155ad068f 100644
--- a/app/models/course.rb
+++ b/app/models/course.rb
@@ -14,7 +14,8 @@ class Course < ActiveRecord::Base
'location',
'tea_id',
'password',
- 'term'
+ 'term',
+ 'password'
end
diff --git a/app/models/project_status.rb b/app/models/project_status.rb
index 02eeb30c8..f6d91bfde 100644
--- a/app/models/project_status.rb
+++ b/app/models/project_status.rb
@@ -1,5 +1,5 @@
class ProjectStatus < ActiveRecord::Base
- attr_accessible :changesets_count, :watchers_count, :project_id
+ attr_accessible :changesets_count, :watchers_count, :project_id, :project_type
belongs_to :projects
belongs_to :watchers
belongs_to :changesets
diff --git a/app/views/bids/_bid_show.html.erb b/app/views/bids/_bid_show.html.erb
index d3f1cbb74..03640dc15 100644
--- a/app/views/bids/_bid_show.html.erb
+++ b/app/views/bids/_bid_show.html.erb
@@ -29,7 +29,7 @@
-
+
<%= bid.description%> |
diff --git a/app/views/bids/_homework_list.html.erb b/app/views/bids/_homework_list.html.erb
index 3e9713bdd..7ec7b7073 100644
--- a/app/views/bids/_homework_list.html.erb
+++ b/app/views/bids/_homework_list.html.erb
@@ -5,8 +5,12 @@
<% if homework.attachments.any?%>
-
- <%= link_to image_tag(url_to_avatar(homework.user), :class => "avatar"), user_path(homework.user), :class => "avatar" %> |
+
+ <% if User.current.member_of?(@bid.courses.first) %>
+ <%= link_to image_tag(url_to_avatar(homework.user), :class => "avatar"), user_path(homework.user), :class => "avatar" %><%= l(:label_bidding_user_studentcode) %><%= homework.user.user_extensions.student_id%> |
+ <% else %>
+ <%= link_to image_tag(url_to_avatar(homework.user), :class => "avatar"), user_path(homework.user), :class => "avatar" %> |
+ <% end %>
diff --git a/app/views/bids/_list_projects.html.erb b/app/views/bids/_list_projects.html.erb
index 6244cb4e6..8fb2abd00 100644
--- a/app/views/bids/_list_projects.html.erb
+++ b/app/views/bids/_list_projects.html.erb
@@ -78,7 +78,7 @@
<%= l(:label_bidding_user) %>
- <%= link_to(b_project.user.name, user_path(b_project.user)) %>
+ <%= link_to(b_project.user.lastname+b_project.user.firstname, user_path(b_project.user)) %>
|
diff --git a/app/views/bids/_project_list.html.erb b/app/views/bids/_project_list.html.erb
index 18294d0c8..e6dda6cc3 100644
--- a/app/views/bids/_project_list.html.erb
+++ b/app/views/bids/_project_list.html.erb
@@ -4,12 +4,16 @@
<% if @bid.deadline > Date.today %>
+ <%if @bid.reward_type == 3 %>
+ <%= l(:label_homework_project) %>(<%= @bidding_project.count%>) |
+ <% else %>
<%= l(:label_bidding_project) %>(<%= @bidding_project.count%>) |
- <%= l(:label_homework_project) %>(<%= @bidding_project.count%>) |
+ <% end %>
<% if User.current.logged? %>
<% if User.current.logged? && (!Member.where('user_id = ? and project_id = ?', User.current.id, @bid.courses.first.id).first.nil? && (Member.where('user_id = ? and project_id = ?', User.current.id, @bid.courses.first.id).first.roles&Role.where('id = ? or id = ?', 5, 7)).size >0) %>
+
<%= toggle_link l(:button_bidding_homework), 'put-bid-form' %>
<% end %>
@@ -44,7 +48,10 @@
- <%= l(:label_bidding_user_homework) %> : <%= link_to(b_project.user.name, user_path(b_project.user)) %> |
+ <%= l(:label_bidding_user_studentcode) %> : <%= (b_project.user.user_extensions.student_id) %> |
+
+
+ <%= l(:label_bidding_user_homework) %> : <%= link_to(b_project.user.lastname+b_project.user.firstname, user_path(b_project.user)) %> |
<%= l(:label_bidding_reason_homewrok) %> : <%= b_project.description %> |
@@ -57,20 +64,22 @@
<% end %>
- <% else %>
+<% else %>
<%= l(:label_bidding_project) %>(<%= @bidding_project.count%>) |
<% if User.current.logged? %>
-
-
- <%= toggle_link l(:button_bidding_homework), 'put-bid-form' %>
-
+
+
+ <%= toggle_link l(:label_bid_me), 'put-bid-form' %>
+
+
|
<% end %>
<% end %>
+<% unless @bid.reward_type == 3%>
<%= render :partial=> "list_projects",:locals => {:bidding_project => @bidding_project,:bid => @bid }%>
-
+<% end %>
diff --git a/app/views/bids/index.html.erb b/app/views/bids/index.html.erb
index e41f0ec37..937b1b6dd 100644
--- a/app/views/bids/index.html.erb
+++ b/app/views/bids/index.html.erb
@@ -3,11 +3,20 @@
- <%= l(:label_call_list)%> |
+
+ <% if @project_type == '1' %>
+ 作业列表
+ <% else %>
+ <%= l(:label_call_list)%>
+ <% end %> |
<% if User.current.logged? %>
+ <% if @project_type == '0' %>
+ <%= link_to(l(:label_new_call), {:controller => 'bids', :action => 'new_bid'}, :class => 'icon_enterprise icon_enterprise-add') %>
+ <% else %>
<%= link_to(l(:label_new_call), {:controller => 'bids', :action => 'new_bid'}, :class => 'icon icon-add') %>
+ <% end %>
<% end %> |
@@ -15,7 +24,11 @@
<%= text_field_tag 'name', params[:name], :size => 30 %>
+ <% if @project_type == '0'%>
+ <%= submit_tag l(:label_search), :class => "enterprise", :name => nil %>
+ <% else %>
<%= submit_tag l(:label_search), :class => "small", :name => nil %>
+ <% end %>
|
@@ -26,8 +39,11 @@
<%= render :partial => 'new_bid' %>
<% end %>
-
-<%= sort_bid(@s_state)%>
+<% if @project_type == '0'%>
+<%= sort_bid_enterprise(@s_state, @project_type)%>
+<% else %>
+<%= sort_bid(@s_state, @project_type)%>
+<% end %>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/views/layouts/_base_home_menu.html.erb b/app/views/layouts/_base_home_menu.html.erb
new file mode 100644
index 000000000..ca3e5c847
--- /dev/null
+++ b/app/views/layouts/_base_home_menu.html.erb
@@ -0,0 +1,23 @@
+
+
+
diff --git a/app/views/layouts/base.html.erb b/app/views/layouts/base.html.erb
index f9ecbc54f..3168c4dff 100644
--- a/app/views/layouts/base.html.erb
+++ b/app/views/layouts/base.html.erb
@@ -19,9 +19,13 @@
-
+<% if @project_type == '0' %>
+<%=render :partial => 'layouts/base_enterprise_header'%>
+<% elsif @project_type == '1' %>
+<%=render :partial => 'layouts/base_college_header'%>
+<% else %>
<%=render :partial => 'layouts/base_header'%>
-
+<% end %>
<%= render_flash_messages %>
diff --git a/app/views/layouts/base_bids.html.erb b/app/views/layouts/base_bids.html.erb
index 4ebe4a0eb..77b1edcea 100644
--- a/app/views/layouts/base_bids.html.erb
+++ b/app/views/layouts/base_bids.html.erb
@@ -20,7 +20,7 @@
- <%=render :partial => 'layouts/base_header'%>
+ <%=render :partial => 'layouts/base_enterprise_header'%>
| | |