From 5d2bb4ccbdafedbab3ac6d206c375284bfe5a39e Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Tue, 13 May 2014 10:30:15 +0800 Subject: [PATCH] =?UTF-8?q?1.=E9=80=89=E6=8B=A9=E5=AD=A6=E6=A0=A1=E8=BF=9B?= =?UTF-8?q?=E5=85=A5=E5=AD=A6=E6=A0=A1=E8=AF=BE=E7=A8=8B=E5=88=97=E8=A1=A8?= =?UTF-8?q?=EF=BC=8C=E7=82=B9=E5=87=BB=E6=9B=B4=E5=A4=9A=E7=94=B1=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E6=89=80=E6=9C=89=E8=AF=BE=E7=A8=8B=E5=8F=AF=E8=83=BD?= =?UTF-8?q?=E6=94=B9=E4=B8=BA=E6=98=BE=E7=A4=BA=E5=BD=93=E5=89=8D=E5=AD=A6?= =?UTF-8?q?=E6=A0=A1=E8=AF=BE=E7=A8=8B=E5=88=97=E8=A1=A8=EF=BC=8C=E4=B9=8B?= =?UTF-8?q?=E5=90=8E=E6=8E=92=E5=BA=8F=E4=B9=9F=E4=B8=80=E6=A0=B7=202.?= =?UTF-8?q?=E5=BD=93=E6=9F=A5=E8=AF=A2=E5=AD=A6=E6=A0=A1=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E4=B8=BA=E7=A9=BA=E6=97=B6=EF=BC=8C=E6=8E=A8?= =?UTF-8?q?=E8=8D=90=E6=94=B9=E4=B8=BA=E6=9C=AC=E7=B3=BB=E7=BB=9F=E4=B8=AD?= =?UTF-8?q?=E6=9C=AC=E5=B9=B4=E5=BA=A6=E5=BC=80=E8=AE=BE=E7=9A=84=E6=9C=80?= =?UTF-8?q?=E5=A5=BD=E7=9A=84=E8=AF=BE=E7=A8=8B=EF=BC=8C=E5=90=8C=E6=97=B6?= =?UTF-8?q?=E5=8A=A0=E5=85=A5=E8=AF=BE=E7=A8=8B=E6=94=B9=E4=B8=BA=E5=85=B3?= =?UTF-8?q?=E6=B3=A8=E8=AF=BE=E7=A8=8B=E3=80=82=E6=AD=A4=E6=97=B6=E7=82=B9?= =?UTF-8?q?=E5=87=BB=E6=9B=B4=E5=A4=9A=E6=9F=A5=E7=9C=8B=E7=9A=84=E4=B8=BA?= =?UTF-8?q?=E6=89=80=E6=9C=89=E8=AF=BE=E7=A8=8B=203.=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E5=87=BA=E8=AF=BE=E7=A8=8B=E5=88=97=E8=A1=A8=E5=B0=86=E5=AD=A6?= =?UTF-8?q?=E6=A0=A1=E5=92=8C=E6=95=99=E5=B8=88=E6=94=BE=E5=9C=A8=E8=AF=BE?= =?UTF-8?q?=E7=A8=8B=E4=B8=8A=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/projects_controller.rb | 2 +- app/helpers/projects_helper.rb | 26 +- app/helpers/welcome_helper.rb | 6 + app/views/projects/course.html.erb | 2 +- app/views/welcome/course.html.erb | 321 +++++++++++++------------ 5 files changed, 185 insertions(+), 172 deletions(-) diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index d26cf698..a120394e 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -198,7 +198,7 @@ class ProjectsController < ApplicationController @project_type = params[:project_type] @school_id = params[:school_id] per_page_option = 10 - if @school_id == "0" or @school.nil? + if @school_id == "0" or @school_id.nil? @projects_all = Project.active.visible. joins("LEFT JOIN #{ProjectStatus.table_name} ON #{Project.table_name}.id = #{ProjectStatus.table_name}.project_id"). where("#{Project.table_name}.project_type = ? ", Project::ProjectType_course) diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb index 5bd677bd..bddf9d0d 100644 --- a/app/helpers/projects_helper.rb +++ b/app/helpers/projects_helper.rb @@ -62,33 +62,33 @@ module ProjectsHelper content_tag('div', content, :class => "tabs_enterprise") end - def sort_course(state, project_type) + def sort_course(state, project_type, school_id) content = ''.html_safe case state when 0 - 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") - 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_time), course_path(:project_sort_type => '0', :project_type => project_type), :school_id => school_id, :class=>"selected"), :class=>"selected") + content << content_tag('li', link_to(l(:label_sort_by_active), course_path(:project_sort_type => '1', :project_type => project_type, :school_id => school_id))) # 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_activity), course_path(:project_sort_type => '3', :project_type => project_type))) + content << content_tag('li', link_to(l(:label_sort_by_activity), course_path(:project_sort_type => '3', :project_type => project_type, :school_id => school_id))) when 1 - content << content_tag('li', link_to(l(:label_sort_by_time), course_path(:project_sort_type => '0', :project_type => project_type))) - 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_time), course_path(:project_sort_type => '0', :project_type => project_type, :school_id => school_id))) + content << content_tag('li', link_to(l(:label_sort_by_active), course_path(:project_sort_type => '1', :project_type => project_type, :school_id => school_id), :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_activity), course_path(:project_sort_type => '3', :project_type => project_type))) + content << content_tag('li', link_to(l(:label_sort_by_activity), course_path(:project_sort_type => '3', :project_type => project_type, :school_id => school_id))) when 2 - content << content_tag('li', link_to(l(:label_sort_by_time), course_path(:project_sort_type => '0', :project_type => project_type))) - 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_time), course_path(:project_sort_type => '0', :project_type => project_type, :school_id => school_id))) + content << content_tag('li', link_to(l(:label_sort_by_active), course_path(:project_sort_type => '1', :project_type => project_type, :school_id => school_id))) # 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_activity), course_path(:project_sort_type => '3', :project_type => project_type))) + content << content_tag('li', link_to(l(:label_sort_by_activity), course_path(:project_sort_type => '3', :project_type => project_type, :school_id => school_id))) #gcm when 3 - content << content_tag('li', link_to(l(:label_sort_by_time), course_path(:project_sort_type => '0', :project_type => project_type))) - 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_time), course_path(:project_sort_type => '0', :project_type => project_type, :school_id => school_id))) + content << content_tag('li', link_to(l(:label_sort_by_active), course_path(:project_sort_type => '1', :project_type => project_type, :school_id => school_id))) # 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_activity), course_path(:project_sort_type => '3', :project_type => project_type), :class=>"selected"), :class=>"selected") + content << content_tag('li', link_to(l(:label_sort_by_activity), course_path(:project_sort_type => '3', :project_type => project_type, :school_id => school_id), :class=>"selected"), :class=>"selected") end #gcmend diff --git a/app/helpers/welcome_helper.rb b/app/helpers/welcome_helper.rb index ed435fe6..e05f789a 100644 --- a/app/helpers/welcome_helper.rb +++ b/app/helpers/welcome_helper.rb @@ -154,6 +154,12 @@ module WelcomeHelper sort_course_by_hot limit end + def find_all_new_hot_course limit = 9 + #sort_project_by_hot_rails 1, 'course_ac_para DESC', limit + time_now = Time.new.strftime("%Y"); + Project.visible.joins(:project_status).where("#{Project.table_name}.project_type = ? and #{Project.table_name}.created_on like '%#{time_now}%'", 1).order("course_ac_para DESC").limit(limit).all + end + def find_all_hot_bid sort_bid_by_hot end diff --git a/app/views/projects/course.html.erb b/app/views/projects/course.html.erb index 1359b8be..98228c16 100644 --- a/app/views/projects/course.html.erb +++ b/app/views/projects/course.html.erb @@ -30,7 +30,7 @@ <% end %> -<%= sort_course(@s_type, @project_type)%> +<%= sort_course(@s_type, @project_type, @school_id)%>
<%= render_project_hierarchy(@projects)%> diff --git a/app/views/welcome/course.html.erb b/app/views/welcome/course.html.erb index 286ff60d..005f5371 100644 --- a/app/views/welcome/course.html.erb +++ b/app/views/welcome/course.html.erb @@ -1,197 +1,204 @@ <%= stylesheet_link_tag 'welcome' %> <%= javascript_include_tag 'welcome' %>
- -
-
- <%= image_tag(@logoLink, size:'75x75') %> + +
+
+ <%= image_tag(@logoLink, size:'75x75') %> -
-
-
+
+
+
<% if params[:school_id].nil? and User.current.user_extensions.school.nil? %> - <% else%> + <% else%> <% if params[:school_id] == "0" %> - <% else %> + <% else %> <% if params[:school_id].nil? %> <%= link_to School.find(User.current.user_extensions.school.id).name, options={:action => 'course',:school_id => User.current.user_extensions.school.id}, html_options={:class => 'font_welcome_school',:method => 'get'}%> -
+
<% else %> <%= link_to School.find(params[:school_id]).name ,options={:action => 'course',:school_id => params[:school_id]}, html_options={:class => 'font_welcome_school',:method => 'get'}%> -
+
<% end %> <% end %> <% end %>
- <%= l(:label_welcome_trustie) %><%= l(:label_welcome_trustie_course) %> - <% if params[:school_id].nil? and User.current.user_extensions.school.nil? %> - , <%= l(:label_welcome_trustie_course_description) %> - <% else %> - <% if params[:school_id] == "0" %> - , <%= l(:label_welcome_trustie_course_description) %> - <% end %> - <% end %> -
- -
-
+ <%= l(:label_welcome_trustie) %><%= l(:label_welcome_trustie_course) %> + <% if params[:school_id].nil? and User.current.user_extensions.school.nil? %> + , <%= l(:label_welcome_trustie_course_description) %> + <% else %> + <% if params[:school_id] == "0" %> + , <%= l(:label_welcome_trustie_course_description) %> + <% end %> + <% end %> +
+ +
+
-
+
-

新开课程

- <%= link_to "更多>>", {:controller => 'projects', :action => 'course', :project_type => 1, :school_id => params[:school_id]} %> -
-
    +

    新开课程

    + <% if(find_miracle_course(10, 7,params[:school_id]).map.count == 0) %> + <%= link_to "更多>>", {:controller => 'projects', :action => 'course', :project_type => 1, :school_id => nil} %> +
    +
      -
    - -
      - <% if(find_miracle_course(10, 7,params[:school_id]).map.count == 0) %> -

      -

      - 该学校未开设任何课程,您可以查看其他学校课程 -

      -

      - <% find_all_hot_course(9).map do |project| %> -
    • > -
      - <%= image_tag(get_course_avatar(project), :class => "avatar-4") %> -
      - -
      - [<%= get_course_term project %>] - <%= link_to( project.name, project_path(project.id), :class => "d-g-blue d-p-project-name",:title => "#{project.name}" )%> - (<%= link_to "#{studentCount(project)}人", project_member_path(project, :role => 2) ,:course =>'1' %>) - <% files_count = (project.attachments.count.to_i+Version.joins(:project).where("projects.id=#{project.id}").count.to_i).to_s %> - (<%=link_to "#{files_count}份", project_files_path(project) %>资料) -
      -
      - - <% course = Course.find_by_extra(project.identifier)%> - <% if(course.school == nil) %> -               - <% else %> - <%= course.school.name.try(:gsub, /(.+)$/, '\1:') %> - <% end %> - - - <%= link_to(course.try(:teacher).try(:name), user_path(course.teacher)) %> - <%#=course.try(:teacher).try(:name)%> - -
      - - -
    • - <% end %> - <% else %> - <% find_miracle_course(10, 7,params[:school_id]).map do |project| %> -
    • > -
      - <%= image_tag(get_course_avatar(project), :class => "avatar-4") %> -
      - -
      - [<%= get_course_term project %>] - <%= link_to( project.name, project_path(project.id), :class => "d-g-blue d-p-project-name",:title => "#{project.name}" )%> - (<%= link_to "#{studentCount(project)}人", project_member_path(project, :role => 2) ,:course =>'1' %>) - <% files_count = (project.attachments.count.to_i+Version.joins(:project).where("projects.id=#{project.id}").count.to_i).to_s %> - (<%=link_to "#{files_count}份", project_files_path(project) %>资料) -
      -
      - - <% course = Course.find_by_extra(project.identifier) %> - <%= course.school.name.try(:gsub, /(.+)$/, '\1:') %> - - - <%= link_to(course.try(:teacher).try(:name), user_path(course.teacher)) %> +
    +
      +

      +

      + 该学校未开设任何课程,您可以查看其他学校课程 +

      +

      + <% find_all_new_hot_course(9).map do |project| %> +
    • > +
      + <%= image_tag(get_course_avatar(project), :class => "avatar-4") %> +
      + +
      + + <% course = Course.find_by_extra(project.identifier)%> + <% if(course.school == nil) %> +               + <% else %> + <%= course.school.name.try(:gsub, /(.+)$/, '\1:') %> + <% end %> + + + <%= link_to(course.try(:teacher).try(:name), user_path(course.teacher)) %> <%#=course.try(:teacher).try(:name)%> - -
      - - -
    • - <% end; reset_cycle %> + +
    +
    + [<%= get_course_term project %>] + <%= link_to( project.name, project_path(project.id), :class => "d-g-blue d-p-project-name",:title => "#{project.name}" )%> + (<%= link_to "#{studentCount(project)}人", project_member_path(project, :role => 2) ,:course =>'1' %>) + <% files_count = (project.attachments.count.to_i+Version.joins(:project).where("projects.id=#{project.id}").count.to_i).to_s %> + (<%=link_to "#{files_count}份", project_files_path(project) %>资料) +
    + +
    + <% if !course_endTime_timeout?(project)%> +
    + <%= new_watcher_link(project, User.current)%> +
    + <% end %> +
    + <% end %> -
-
+ +
+ <% else %> + <%= link_to "更多>>", {:controller => 'projects', :action => 'course', :project_type => 1, :school_id => params[:school_id]} %> +
+ + +
+ <% end %>
-

- 问题和反馈动态 - <%= link_to "我要提问" , newbie_send_path, {:class => 'orangeButton idea_btn', :style => "color: #EEEEEE" }%> - <%= link_to "我要反馈" , suggestion_send_path, {:class => 'orangeButton idea_btn', :style => "color: #EEEEEE" }%> -

- <%= link_to "更多>>", forums_path %> -
- +
\ No newline at end of file