diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 3726856b..53a0a259 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -355,9 +355,9 @@ class ProjectsController < ApplicationController end def search - + #modified by nie @projects = Project.visible - @projects = @projects.visible.like(params[:name]) if params[:name].present? + @projects = @projects.visible.where('project_type = ?', params[:project_type]).like(params[:name]) if params[:name].present? @offset, @limit = api_offset_and_limit({:limit => 10}) @project_count = @projects.visible.count @project_pages = Paginator.new @project_count, @limit, params['page'] diff --git a/app/models/project.rb b/app/models/project.rb index e85d5007..0e023da6 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -145,7 +145,7 @@ class Project < ActiveRecord::Base where(nil) else pattern = "%#{arg.to_s.strip.downcase}%" - where("LOWER(identifier) LIKE :p OR LOWER(name) LIKE :p", :p => pattern) + where("LOWER(identifier) LIKE :p OR LOWER(name) LIKE :p ", :p => pattern) end } diff --git a/app/views/layouts/base_courses.html.erb b/app/views/layouts/base_courses.html.erb index be9ae7af..25ff12a9 100644 --- a/app/views/layouts/base_courses.html.erb +++ b/app/views/layouts/base_courses.html.erb @@ -56,6 +56,7 @@ <% if @course.teacher.id == User.current.id%> <%= link_to l(:label_course_settings), {:controller => 'projects', :action => 'settings', :id => @project} %> <% else %> + <%= join_in_course(@project, User.current)%> <% end %> <% unless User.current.member_of?(@project) %> diff --git a/app/views/projects/course.html.erb b/app/views/projects/course.html.erb index b11d0226..864d22c7 100644 --- a/app/views/projects/course.html.erb +++ b/app/views/projects/course.html.erb @@ -16,6 +16,7 @@ diff --git a/app/views/projects/index.html.erb b/app/views/projects/index.html.erb index 95a8219f..c8f11829 100644 --- a/app/views/projects/index.html.erb +++ b/app/views/projects/index.html.erb @@ -2,7 +2,7 @@ <%= auto_discovery_link_tag(:atom, {:action => 'index', :format => 'atom', :key => User.current.rss_key}) %> <% end %> -<%= form_tag(:controller => 'projects', :action => 'search', :method => :get) do %> +<%= form_tag(:controller => 'projects', :action => "search", :method => :get) do %>
@@ -13,7 +13,7 @@ diff --git a/app/views/projects/search.html.erb b/app/views/projects/search.html.erb index e10be86f..8671d5ad 100644 --- a/app/views/projects/search.html.erb +++ b/app/views/projects/search.html.erb @@ -6,12 +6,21 @@
- + - + <% else %> + <%= l(:label_new_course)%> + + + + <% end %> diff --git a/lib/redmine.rb b/lib/redmine.rb index 0ec9a772..1b674d66 100644 --- a/lib/redmine.rb +++ b/lib/redmine.rb @@ -240,7 +240,7 @@ Redmine::MenuManager.map :top_college_menu do |menu| menu.push :new_course, {:controller => 'projects', :action => 'course', :project_type => 1 } menu.push :new_homework, {:controller => 'bids', :action => 'index', :project_type => 1 } menu.push :new_contest, {:controller => 'bids', :action => 'contest', :project_type => 1} - menu.push :projects, { :controller => 'projects', :action => 'index', :project_type => 1 }, :caption => :label_project_plural + menu.push :projects, { :controller => 'projects', :action => 'index', :project_type => 0 }, :caption => :label_project_plural menu.push :developer, {:controller => 'users', :action => 'index', :project_type => 1 } menu.push :enterprise_into, {:controller=>'projects', :action=>'enterprise_course', :project_type => 0 } # menu.push :investor, :home_path diff --git a/public/images/avatars/User/4861 b/public/images/avatars/User/4861 index 0b88c913..a587c965 100644 Binary files a/public/images/avatars/User/4861 and b/public/images/avatars/User/4861 differ
<%= l(:label_project_plural)%> + <% if params[:project_type] == '0'%> + <%= l(:label_project_plural)%> + <%= link_to(l(:label_project_new), {:controller => 'projects', :action => 'new'}, :class => 'icon icon-add') if User.current.allowed_to?(:add_project, nil, :global => true) %><%= link_to(l(:label_course_new), {:controller => 'projects', :action => 'new', :course => 1, :project_type => @project_type}, :class => 'icon icon-add') if User.current.allowed_to?(:add_project, nil, :global => true) %>