diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 9a9518eb3..0c98b804e 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -16,7 +16,8 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. class ProjectsController < ApplicationController # if @project.project_type == 1 - layout 'base_projects'# by young + # layout 'base_projects'# by young + layout :select_project_layout menu_item :overview menu_item :roadmap, :only => :roadmap menu_item :settings, :only => :settings @@ -614,12 +615,12 @@ class ProjectsController < ApplicationController #Added by young # @course_tag = params[:course] # if @course_tag == '1' - if @project.project_type == 1 - @course = Course.find_by_extra(@project.identifier) - render :layout => 'base_courses' - else - render :layout => 'base_projects' - end + @course = Course.find_by_extra(@project.identifier) + # if @project.project_type == 1 + # render :layout => 'base_courses' + # else + # render :layout => 'base_projects' + # end #Ended by young end @@ -837,6 +838,12 @@ class ProjectsController < ApplicationController private + def select_project_layout + project = Project.find_by_id(params[:id]) + project ||= @project + (project.project_type == Project::ProjectType_project) ? 'base_projects' : 'base_courses' + end + # Validates parent_id param according to user's permissions # TODO: move it to Project model in a validation that depends on User.current def validate_parent_id diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index bbd2ea015..7863ead1e 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -65,7 +65,7 @@ module ApplicationHelper if user.is_a?(User) name = h(user.name(options[:format])) if user.active? || (User.current.admin? && user.logged?) - link_to name, user_path(user), :class => user.css_classes + link_to name, {:controller=> 'users', :action => 'show', id: user.id, host: Setting.forge_domain}, :class => user.css_classes else name end @@ -1500,16 +1500,16 @@ module ApplicationHelper end def render_dynamic_nav - home_link = link_to l(:field_homepage), home_path - course_all_course_link = link_to l(:label_course_all), {:controller => 'projects', :action => 'course', :project_type => 1} + home_link = link_to l(:field_homepage), "http://"+Setting.forge_domain+":3000" + course_all_course_link = link_to l(:label_course_all), {:controller => 'projects', :action => 'course', :project_type => 1,} course_teacher_all_link = link_to l(:label_teacher_all), {:controller => 'users', :action => 'index', :role => 'teacher'} - courses_link = link_to l(:label_course_practice), {:controller => 'projects', :action => 'course', :project_type => 1} - projects_link = link_to l(:label_project_deposit), {:controller => 'projects', :action => 'index', :project_type => 0} + courses_link = link_to l(:label_course_practice), {: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'} - contest_link = link_to l(:label_contest_innovate), {:controller => 'bids', :action => 'contest', :project_type => 1} + 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), forums_path - stores_link = link_to l(:label_stores_index), stores_path + forum_link = link_to l(:label_project_module_forums), {:controller => "forums", :action => "index", :host => Setting.forge_domain} + stores_link = link_to l(:label_stores_index), {:controller => 'stores', :action=> 'index', :host => Setting.forge_domain} #@nav_dispaly_project_label nav_list = Array.new diff --git a/app/helpers/welcome_helper.rb b/app/helpers/welcome_helper.rb index f548a40f5..a446631d7 100644 --- a/app/helpers/welcome_helper.rb +++ b/app/helpers/welcome_helper.rb @@ -24,7 +24,7 @@ module WelcomeHelper def welcome_join_in_course(project, user) if(user.logged? && - !(course_timeout? project) && + !(course_endTime_timeout? project) && (project.course_extra.teacher.id != user.id) ) join_in_course(project, user) diff --git a/app/models/project.rb b/app/models/project.rb index 3205db8fa..3f91d8c2f 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -17,6 +17,8 @@ class Project < ActiveRecord::Base include Redmine::SafeAttributes + ProjectType_project = 0 + ProjectType_course = 1 # Project statuses STATUS_ACTIVE = 1 diff --git a/app/views/layouts/_base_header.html.erb b/app/views/layouts/_base_header.html.erb index d8287a59d..2cb5fafa0 100644 --- a/app/views/layouts/_base_header.html.erb +++ b/app/views/layouts/_base_header.html.erb @@ -12,14 +12,14 @@ <%=link_to_user(User.current)%>