diff --git a/app/controllers/welcome_controller.rb b/app/controllers/welcome_controller.rb index a0e79f0f6..387595e0b 100644 --- a/app/controllers/welcome_controller.rb +++ b/app/controllers/welcome_controller.rb @@ -17,7 +17,7 @@ class WelcomeController < ApplicationController caches_action :robots - before_filter :entry_select, :only => [:index] + before_filter :entry_select, :entry_select_contest, :only => [:index] def index # @news = News.latest User.current @@ -79,6 +79,10 @@ class WelcomeController < ApplicationController @teacher = User.teacher @student = User.student end + + def contest + + end def search search_condition = params[:q] @@ -113,4 +117,11 @@ class WelcomeController < ApplicationController (course() and render :course and return 0) if request.original_url.match(/course\.trustie\.net/) end + def entry_select_contest + if request.original_url.match(/contest\.trustie\.net/) + course + render :contest, layout: false + return 0 + end + end end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 60935d6d8..7f8a8bd2b 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1499,12 +1499,15 @@ module ApplicationHelper def render_dynamic_nav home_link = link_to l(:field_homepage), {:controller => 'welcome', :action => 'index'} + main_course_link = link_to l(:label_course_practice), {:controller => 'welcome', :action => 'index', :host => Setting.course_domain} + main_project_link = link_to l(:label_project_deposit), {:controller => 'welcome', :action => 'index', :host => Setting.project_domain} + course_all_course_link = link_to l(:label_course_all), {:controller => 'projects', :action => 'course', :project_type => 1, :host => Setting.course_domain} course_teacher_all_link = link_to l(:label_teacher_all), {:controller => 'users', :action => 'index', :role => 'teacher', :host => Setting.course_domain} courses_link = link_to l(:label_course_practice), {:controller => 'projects', :action => 'course', :project_type => 1, :host => Setting.course_domain} projects_link = link_to l(:label_project_deposit), {:controller => 'projects', :action => 'index', :project_type => 0, :host => Setting.project_domain} users_link = link_to l(:label_software_user), {:controller => 'users', :action => 'index', :host => Setting.user_domain} - contest_link = link_to l(:label_contest_innovate), {:controller => 'bids', :action => 'contest', :project_type => 1 , :host => Setting.project_domain} + contest_link = link_to l(:label_contest_innovate), {:controller => 'bids', :action => 'contest', :project_type => 1 , :host => Setting.contest_domain} bids_link = link_to l(:label_requirement_enterprise), {:controller => 'bids', :action => 'index'} forum_link = link_to l(:label_project_module_forums), {:controller => "forums", :action => "index"} stores_link = link_to l(:label_stores_index), {:controller => 'stores', :action=> 'index'} @@ -1514,14 +1517,17 @@ module ApplicationHelper nav_list.push(home_link) if !@nav_dispaly_home_path_label nav_list.push(course_all_course_link) if @nav_dispaly_course_all_label nav_list.push(course_teacher_all_link) if @nav_dispaly_teacher_all_label - + + nav_list.push(main_project_link) if @nav_dispaly_main_project_label + nav_list.push(main_course_link) if @nav_dispaly_main_course_label + nav_list.push(courses_link) if @nav_dispaly_course_label nav_list.push(projects_link) if @nav_dispaly_project_label nav_list.push(users_link) if @nav_dispaly_user_label nav_list.push(contest_link) if @nav_dispaly_contest_label nav_list.push(bids_link) if @nav_dispaly_bid_label nav_list.push(forum_link) if @nav_dispaly_forum_label - nav_list.push(stores_link) if !@nav_dispaly_course_all_label + nav_list.push(stores_link) if @nav_dispaly_store_all_label content_li = '' nav_list.collect do |nav_item| diff --git a/app/views/layouts/_base_header.html.erb b/app/views/layouts/_base_header.html.erb index a0cc53329..4973ae885 100644 --- a/app/views/layouts/_base_header.html.erb +++ b/app/views/layouts/_base_header.html.erb @@ -5,8 +5,8 @@ @nav_dispaly_course_label = 1 elsif (realUrl.match(/users/)) @nav_dispaly_home_path_label = 1 - @nav_dispaly_course_all_label = 1 - @nav_dispaly_project_label = 1 + @nav_dispaly_main_course_label = 1 + @nav_dispaly_main_project_label = 1 elsif (realUrl.match(/projects/)) @nav_dispaly_project_label = 1 elsif (realUrl.match(/contest/)) @@ -21,8 +21,8 @@ @nav_dispaly_contest_label = 1 elsif (realUrl.match(/course\.trustie\.net/)) @nav_dispaly_course_all_label = 1 - # @nav_dispaly_teacher_all_label = 1 @nav_dispaly_forum_label = 1 + @nav_dispaly_store_all_label = 1 elsif (realUrl.match(/user\.trustie\.net/)) @nav_dispaly_home_path_label = 1 @nav_dispaly_course_all_label = 1 diff --git a/app/views/welcome/contest.html.erb b/app/views/welcome/contest.html.erb new file mode 100644 index 000000000..6a0a8413f --- /dev/null +++ b/app/views/welcome/contest.html.erb @@ -0,0 +1,9 @@ +
+ + + + diff --git a/config/routes.rb b/config/routes.rb index 336d8dc51..98061fd08 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -17,6 +17,7 @@ RedmineApp::Application.routes.draw do match 'course', :to => 'welcome#course', :via => :get + match 'contest', :to => 'welcome#contest', :via => :get resources :stores do collection do match 'search', via: [:get, :post] diff --git a/db/schema.rb b/db/schema.rb index effd13d81..24db37967 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -13,6 +13,14 @@ ActiveRecord::Schema.define(:version => 20140319092720) do + create_table "a_user_watchers", :force => true do |t| + t.string "name" + t.text "description" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "member_id" + end + create_table "activities", :force => true do |t| t.integer "act_id", :null => false t.string "act_type", :null => false @@ -294,9 +302,9 @@ ActiveRecord::Schema.define(:version => 20140319092720) do add_index "issue_categories", ["project_id"], :name => "issue_categories_project_id" create_table "issue_relations", :force => true do |t| - t.integer "issue_from_id", :null => false - t.integer "issue_to_id", :null => false - t.string "relation_type", :default => "", :null => false + t.integer "issue_from_id", :null => false + t.integer "issue_to_id", :null => false + t.string "relation_type", :null => false t.integer "delay" end @@ -464,6 +472,22 @@ ActiveRecord::Schema.define(:version => 20140319092720) do add_index "messages", ["last_reply_id"], :name => "index_messages_on_last_reply_id" add_index "messages", ["parent_id"], :name => "messages_parent_id" + create_table "messages_for_bids", :force => true do |t| + t.string "message" + t.integer "user_id" + t.integer "bid_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "messages_for_users", :force => true do |t| + t.integer "messager_id" + t.integer "user_id" + t.string "message" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + create_table "news", :force => true do |t| t.integer "project_id" t.string "title", :limit => 60, :default => "", :null => false @@ -523,11 +547,23 @@ ActiveRecord::Schema.define(:version => 20140319092720) do t.integer "watchers_count" t.integer "project_id" t.integer "project_type" - t.float "grade", :default => 0.0 - t.integer "course_ac_para", :default => 0 + t.integer "gitlab_group_id", :limit => 8 + t.float "grade", :default => 0.0 + t.integer "course_ac_para", :default => 0 end + add_index "project_statuses", ["changesets_count"], :name => "index_project_statuses_on_changesets_count" add_index "project_statuses", ["grade"], :name => "index_project_statuses_on_grade" + add_index "project_statuses", ["watchers_count"], :name => "index_project_statuses_on_watchers_count" + + create_table "project_tags", :force => true do |t| + t.integer "project_id" + t.integer "tag_id" + t.string "description" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "user_id" + end create_table "projects", :force => true do |t| t.string "name", :default => "", :null => false @@ -573,17 +609,18 @@ ActiveRecord::Schema.define(:version => 20140319092720) do add_index "queries", ["user_id"], :name => "index_queries_on_user_id" create_table "repositories", :force => true do |t| - t.integer "project_id", :default => 0, :null => false - t.string "url", :default => "", :null => false - t.string "login", :limit => 60, :default => "" - t.string "password", :default => "" - t.string "root_url", :default => "" + t.integer "project_id", :default => 0, :null => false + t.string "url", :default => "", :null => false + t.string "login", :limit => 60, :default => "" + t.string "password", :default => "" + t.string "root_url", :default => "" t.string "type" - t.string "path_encoding", :limit => 64 - t.string "log_encoding", :limit => 64 + t.string "path_encoding", :limit => 64 + t.string "log_encoding", :limit => 64 t.text "extra_info" t.string "identifier" - t.boolean "is_default", :default => false + t.boolean "is_default", :default => false + t.string "git_project_id" end add_index "repositories", ["project_id"], :name => "index_repositories_on_project_id" @@ -602,26 +639,6 @@ ActiveRecord::Schema.define(:version => 20140319092720) do t.string "province" end - create_table "seems_rateable_cached_ratings", :force => true do |t| - t.integer "cacheable_id", :limit => 8 - t.string "cacheable_type" - t.float "avg", :null => false - t.integer "cnt", :null => false - t.string "dimension" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "seems_rateable_rates", :force => true do |t| - t.integer "rater_id", :limit => 8 - t.integer "rateable_id" - t.string "rateable_type" - t.float "stars", :null => false - t.string "dimension" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - create_table "settings", :force => true do |t| t.string "name", :default => "", :null => false t.text "value" @@ -632,9 +649,9 @@ ActiveRecord::Schema.define(:version => 20140319092720) do create_table "shares", :force => true do |t| t.date "created_on" - t.string "url" t.string "title" - t.integer "share_type" + t.string "share_type" + t.string "url" t.datetime "created_at", :null => false t.datetime "updated_at", :null => false t.integer "project_id" @@ -642,6 +659,12 @@ ActiveRecord::Schema.define(:version => 20140319092720) do t.string "description" end + create_table "students", :force => true do |t| + t.string "name" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + create_table "students_for_courses", :force => true do |t| t.integer "student_id" t.integer "course_id" @@ -700,7 +723,7 @@ ActiveRecord::Schema.define(:version => 20140319092720) do create_table "tokens", :force => true do |t| t.integer "user_id", :default => 0, :null => false t.string "action", :limit => 30, :default => "", :null => false - t.string "value", :limit => 40, :default => "", :null => false + t.string "value", :limit => 40 t.datetime "created_on", :null => false end @@ -726,12 +749,13 @@ ActiveRecord::Schema.define(:version => 20140319092720) do t.integer "zip_code" t.datetime "created_at", :null => false t.datetime "updated_at", :null => false - t.string "technical_title" t.integer "identity" + t.string "technical_title" t.string "student_id" t.string "teacher_realname" t.string "student_realname" t.string "location_city" + t.string "git_token" end create_table "user_grades", :force => true do |t| @@ -768,6 +792,14 @@ ActiveRecord::Schema.define(:version => 20140319092720) do add_index "user_statuses", ["grade"], :name => "index_user_statuses_on_grade" add_index "user_statuses", ["watchers_count"], :name => "index_user_statuses_on_watchers_count" + create_table "user_tags", :force => true do |t| + t.integer "user_id" + t.integer "tag_id" + t.string "description" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + create_table "users", :force => true do |t| t.string "login", :default => "", :null => false t.string "hashed_password", :limit => 40, :default => "", :null => false diff --git a/lib/redmine.rb b/lib/redmine.rb index 3990d10d3..0f8b3acc3 100644 --- a/lib/redmine.rb +++ b/lib/redmine.rb @@ -264,7 +264,7 @@ end # end Redmine::MenuManager.map :account_menu do |menu| - menu.push :login, {:controller => 'account', :action => 'login', :host => Setting.project_domain}, :if => Proc.new { !User.current.logged? } + menu.push :login, {:controller => 'account', :action => 'login', :host => Setting.user_domain}, :if => Proc.new { !User.current.logged? } menu.push :register, {:controller => 'account', :action => 'register'}, :if => Proc.new { !User.current.logged? && Setting.self_registration? } # menu.push :my_account, { :controller => 'my', :action => 'account' }, :if => Proc.new { User.current.logged? } menu.push :logout, {:controller => 'account', :action => 'logout'}, :html => {:method => 'post'}, :if => Proc.new { User.current.logged? }