diff --git a/app/helpers/courses_helper.rb b/app/helpers/courses_helper.rb index bcd45ac08..6a348a1ea 100644 --- a/app/helpers/courses_helper.rb +++ b/app/helpers/courses_helper.rb @@ -122,6 +122,40 @@ module CoursesHelper members end + def sort_course(state, school_id) + content = ''.html_safe + case state + when 0 + content << content_tag('li', link_to(l(:label_sort_by_time), course_path(:course_sort_type => '0'), :school_id => school_id, :class=>"selected"), :class=>"selected") + content << content_tag('li', link_to(l(:label_sort_by_active), course_path(:course_sort_type => '1', :school_id => school_id))) + # content << content_tag('li', link_to(l(:label_sort_by_influence), course_path(:course_sort_type => '2'))) + content << content_tag('li', link_to(l(:label_sort_by_activity), course_path(:course_sort_type => '3', :school_id => school_id))) + + when 1 + content << content_tag('li', link_to(l(:label_sort_by_time), course_path(:course_sort_type => '0', :school_id => school_id))) + content << content_tag('li', link_to(l(:label_sort_by_active), course_path(:course_sort_type => '1', :school_id => school_id), :class=>"selected"), :class=>"selected") + # content << content_tag('li', link_to(l(:label_sort_by_influence), course_path(:course_sort_type => '2'))) + content << content_tag('li', link_to(l(:label_sort_by_activity), course_path(:course_sort_type => '3', :school_id => school_id))) + + when 2 + content << content_tag('li', link_to(l(:label_sort_by_time), course_path(:course_sort_type => '0', :school_id => school_id))) + content << content_tag('li', link_to(l(:label_sort_by_active), course_path(:course_sort_type => '1', :school_id => school_id))) + # content << content_tag('li', link_to(l(:label_sort_by_influence), course_path(:course_sort_type => '2'), :class=>"selected"), :class=>"selected") + content << content_tag('li', link_to(l(:label_sort_by_activity), course_path(:course_sort_type => '3', :school_id => school_id))) + + #gcm + when 3 + content << content_tag('li', link_to(l(:label_sort_by_time), course_path(:course_sort_type => '0', :school_id => school_id))) + content << content_tag('li', link_to(l(:label_sort_by_active), course_path(:course_sort_type => '1', :school_id => school_id))) + # content << content_tag('li', link_to(l(:label_sort_by_influence), course_path(:course_sort_type => '2'))) + content << content_tag('li', link_to(l(:label_sort_by_activity), course_path(:course_sort_type => '3', :school_id => school_id), :class=>"selected"), :class=>"selected") + end + #gcmend + + content = content_tag('ul', content) + content_tag('div', content, :class => "tabs") + end + def findCourseTime project str = "" begin diff --git a/app/views/courses/_course.html.erb b/app/views/courses/_course.html.erb index 4fd807b63..6ea802037 100644 --- a/app/views/courses/_course.html.erb +++ b/app/views/courses/_course.html.erb @@ -15,8 +15,8 @@

<%= content_tag('span', "#{l(:label_institution_name)}:", :class => "course-font")%> <% @admin = @project.project_infos%> - <%if @admin&&@adadminmin.first&&@admin.first.user&&@admin.first.user.user_extensions%> - + <%if @admin&&@admin.first&&@admin.first.user&&@admin.first.user.user_extensions%> + <%# unless @project.course_extra.school.nil? %> <%= @project.course_extra.teacher.user_extensions.school.try(:name) %> <%# end %> diff --git a/app/views/courses/index.html.erb b/app/views/courses/index.html.erb index 1492264c8..a74668dc4 100644 --- a/app/views/courses/index.html.erb +++ b/app/views/courses/index.html.erb @@ -6,49 +6,44 @@ <%= form_tag(courses_search_path, :method => :get) do %> - + + <% end %> <% end %> - - - + + + - - + +
<%= l(:label_course_all) %><%= l(:label_course_practice) %> <%= l(:label_user_location) %> : - <% if User.current.logged? %> - <%= link_to(l(:label_course_new), {:controller => 'courses', :action => 'new', :course => 0, :course_type => (@course_type||=0)}, :class => 'icon icon-add') if User.current.allowed_to?(:add_course, nil, :global => true) %> + <% if User.current.logged?%> + <% if User.current.user_extensions.identity == 0 %> + <%= link_to(l(:label_course_new), {:controller => 'courses', :action => 'new', :course => 1}, :class => 'icon icon-add') if User.current.allowed_to?(:add_course, nil, :global => true) %> - -
+ +
- <%= link_to request.host()+"/courses", :controller => 'courses', :action => 'index', :course_type => 0 %> - <%= link_to l(:field_homepage), home_path %> - > <%= link_to l(:label_course_all), :controller => 'courses', :action => 'index', :course_type => 0 %><%= link_to request.host()+"/course", :controller => 'courses', :action => 'course', :course_type => 1 %> <%=link_to l(:field_homepage), home_path %> > <%=link_to l(:label_course_practice), :controller => 'courses', :action => 'course', :course_type => 1 %>
<% end %> -<%= sort_courses(@s_type) %> -

- <% if @courses %> - <%= render_course_hierarchy(@courses) %> - <% end %> +<%= sort_course(@s_type, @course_type, @school_id)%> + +
+ <%= render_project_hierarchy(@projects)%>
<% if User.current.logged? %>

- <%= l(:label_my_courses) %> + <%= l(:label_my_course) %>

<% end %> @@ -57,14 +52,13 @@ <% end %> <% content_for :sidebar do %> - <%= form_tag({}, :method => :get) do %> -

<%= l(:label_course_all) %>

- +

<%= l(:label_project_plural) %>

+

<%= submit_tag l(:button_apply), :class => 'button-small', :name => nil %>

<% end %> <% end %> -<% html_title(l(:label_course_all)) -%> +<% html_title(l(:label_new_course)) -%>