From fc36e4c01eb12f52154561cec393ea209dda912d Mon Sep 17 00:00:00 2001 From: huang Date: Mon, 9 May 2016 18:10:22 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=99=E5=B8=88=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/organizations_controller.rb | 10 +- .../_org_left_subfield_list.html.erb | 2 +- .../organizations/_show_students.html.erb | 36 +++++ .../organizations/_show_teachers.html.erb | 45 +++++++ app/views/organizations/show.html.erb | 126 ++++++++++-------- public/stylesheets/new_user.css | 1 + public/stylesheets/org.css | 20 ++- 7 files changed, 177 insertions(+), 63 deletions(-) create mode 100644 app/views/organizations/_show_students.html.erb create mode 100644 app/views/organizations/_show_teachers.html.erb diff --git a/app/controllers/organizations_controller.rb b/app/controllers/organizations_controller.rb index 3709dd24b..561ebf8a8 100644 --- a/app/controllers/organizations_controller.rb +++ b/app/controllers/organizations_controller.rb @@ -98,10 +98,16 @@ class OrganizationsController < ApplicationController else if @organization.is_public? || User.current.admin? || User.current.member_of_org?(@organization) @organization = Organization.find(params[:id]) + # params[:org_subfield_id] 存在即对应的栏目,否则进入组织动态 if params[:org_subfield_id] @org_subfield = OrgSubfield.find(params[:org_subfield_id]) - @org_subfield_ids = @org_subfield.org_document_comments.map(&:id) << 0 - @org_activities = OrgActivity.where("(org_act_type='OrgDocumentComment'and org_act_id in (#{@org_subfield_ids.join(",")})) || (container_type='OrgSubfield' and container_id=#{@org_subfield.id})").order('updated_at desc').page(params[:page] || 1).per(10) + if @org_subfield.field_type == "Comptec" || @org_subfield.field_type == "Compstu" + #@org_students = User.find_by_sql("SELECT * FROM users u, user_extensions ue where u.id = ue.user_id and ue.identity =1;") + @org_teachers = User.find_by_sql("SELECT * FROM users u, user_extensions ue where u.id = ue.user_id and ue.identity =0;") + else + @org_subfield_ids = @org_subfield.org_document_comments.map(&:id) << 0 + @org_activities = OrgActivity.where("(org_act_type='OrgDocumentComment'and org_act_id in (#{@org_subfield_ids.join(",")})) || (container_type='OrgSubfield' and container_id=#{@org_subfield.id})").order('updated_at desc').page(params[:page] || 1).per(10) + end else shield_project_ids = ShieldActivity.where("container_type='Organization' and container_id=#{@organization.id} and shield_type='Project'").map(&:shield_id) shield_course_ids = ShieldActivity.where("container_type='Organization' and container_id=#{@organization.id} and shield_type='Course'").map(&:shield_id) diff --git a/app/views/organizations/_org_left_subfield_list.html.erb b/app/views/organizations/_org_left_subfield_list.html.erb index 6e01e9c50..90019354c 100644 --- a/app/views/organizations/_org_left_subfield_list.html.erb +++ b/app/views/organizations/_org_left_subfield_list.html.erb @@ -91,7 +91,7 @@ <% end %> <% else %>
- <% if field.field_type == ("Post" || "Complex" || "Compstu" || "Comptec") %> + <% if field.field_type == "Post" || field.field_type == "Complex" || field.field_type == "Compstu" || field.field_type == "Comptec" %>
<% if !field.subfield_subdomain_dir.nil? %> diff --git a/app/views/organizations/_show_students.html.erb b/app/views/organizations/_show_students.html.erb new file mode 100644 index 000000000..7f8d90203 --- /dev/null +++ b/app/views/organizations/_show_students.html.erb @@ -0,0 +1,36 @@ +
+
+ + + +
+
+
+
+
+
+
尹刚国防科学技术大学教授
+
+
6000
+
课程数
+
+
+
+
500
+
学生数
+
+
+
+
8000
+
资源数
+
+
+ 添加 +
+
+
+
\ No newline at end of file diff --git a/app/views/organizations/_show_teachers.html.erb b/app/views/organizations/_show_teachers.html.erb new file mode 100644 index 000000000..a95efbfa9 --- /dev/null +++ b/app/views/organizations/_show_teachers.html.erb @@ -0,0 +1,45 @@ +
+
+ + + +
+
+ <% @org_teachers.each do |org_teacher| %> + <% school = School.where("id =?", org_teacher.school_id).first %> +
+
+
+
+
<%= org_teacher.try(:realname).nil? ? org_teacher.try(:login) : org_teacher.try(:realname) %> + <% unless school.nil? %> + <%= school.name %> + <% end %> + <% unless org_teacher.nil? %> + <%= org_teacher.technical_title %>
+ <% end %> +
+
<%= User.current.courses.count %>
+
课程数
+
+
+
+
500
+
学生数
+
+
+
+
8000
+
资源数
+
+
+ 添加 +
+
+
+ <% end %> +
\ No newline at end of file diff --git a/app/views/organizations/show.html.erb b/app/views/organizations/show.html.erb index f217f006e..24c1ab791 100644 --- a/app/views/organizations/show.html.erb +++ b/app/views/organizations/show.html.erb @@ -1,69 +1,77 @@ -<%= javascript_include_tag "jquery.infinitescroll.js" %> +<% if !params[:org_subfield_id].nil? && @org_subfield.field_type == "Compstu" %> + <%= render 'organizations/show_students', :field => @org_subfield %> +<% elsif !params[:org_subfield_id].nil? && @org_subfield.field_type == "Comptec" %> + <%= render 'organizations/show_teachers', :field => @org_subfield %> +<% else %> + <%= javascript_include_tag "jquery.infinitescroll.js" %> -<%= content_for(:header_tags) do %> - <%= import_ke(enable_at: false, prettify: false, init_activity: true) %> -<% end %> + <%= content_for(:header_tags) do %> + <%= import_ke(enable_at: false, prettify: false, init_activity: true) %> + <% end %> -<% if params[:show_homepage].nil? and User.current.logged? %> -
-
<%= @org_subfield.nil? ? "最新动态":"#{@org_subfield.name}" %>
- <% if params[:org_subfield_id].nil? %> -
    -
  • -
      -
    • -
        -
      • 课程动态
      • -
      • <%= link_to "作业动态", {:controller => "organizations", :action => "show", :type => "course_homework"}, :class => "homepagePostTypeAssignment postTypeGrey"%> -
      • -
      • <%= link_to "通知动态", {:controller => "organizations", :action => "show", :type => "course_news"}, :class => "homepagePostTypeNotice postTypeGrey"%> - -
      • <%= link_to "论坛动态", {:controller => "organizations", :action => "show", :type => "course_message"}, :class => "homepagePostTypeForum postTypeGrey"%> -
      • <%= link_to "问卷动态", {:controller => "organizations", :action => "show", :type => "course_poll"}, :class => "homepagePostTypeQuiz postTypeGrey"%> - - + <% if params[:show_homepage].nil? and User.current.logged? %> +
        +
        <%= @org_subfield.nil? ? "最新动态":"#{@org_subfield.name}" %>
        + <% if params[:org_subfield_id].nil? %> +
          +
        • +
            +
          • +
              +
            • 课程动态
            • +
            • <%= link_to "作业动态", {:controller => "organizations", :action => "show", :type => "course_homework"}, :class => "homepagePostTypeAssignment postTypeGrey"%> +
            • +
            • <%= link_to "通知动态", {:controller => "organizations", :action => "show", :type => "course_news"}, :class => "homepagePostTypeNotice postTypeGrey"%> + +
            • <%= link_to "论坛动态", {:controller => "organizations", :action => "show", :type => "course_message"}, :class => "homepagePostTypeForum postTypeGrey"%> +
            • <%= link_to "问卷动态", {:controller => "organizations", :action => "show", :type => "course_poll"}, :class => "homepagePostTypeQuiz postTypeGrey"%> + + +
            +
          • +
          • +
              +
            • 项目动态
            • +
            • <%= link_to "问题动态", {:controller => "organizations", :action => "show", :type => "project_issue"}, :class => "homepagePostTypeQuestion postTypeGrey"%> +
            • <%= link_to "论坛动态", {:controller => "organizations", :action => "show", :type => "project_message"}, :class => "homepagePostTypeForum postTypeGrey"%> + +
            +
          • +
          • +
              +
            • 更多
            • +
            • <%= link_to "组织动态", {:controller => "organizations", :action => "show", :type => "org"}, :class =>"homepagePostTypeMessage postTypeGrey"%> +
            • <%= link_to "全部动态", {:controller => "organizations", :action => "show", :type => nil}, :class =>"homepagePostTypeAll postTypeGrey"%> +
            +
          • +
          +
        -
      • -
      • -
          -
        • 项目动态
        • -
        • <%= link_to "问题动态", {:controller => "organizations", :action => "show", :type => "project_issue"}, :class => "homepagePostTypeQuestion postTypeGrey"%> -
        • <%= link_to "论坛动态", {:controller => "organizations", :action => "show", :type => "project_message"}, :class => "homepagePostTypeForum postTypeGrey"%> - -
        -
      • -
      • -
          -
        • 更多
        • -
        • <%= link_to "组织动态", {:controller => "organizations", :action => "show", :type => "org"}, :class =>"homepagePostTypeMessage postTypeGrey"%> -
        • <%= link_to "全部动态", {:controller => "organizations", :action => "show", :type => nil}, :class =>"homepagePostTypeAll postTypeGrey"%> -
        -
      • -
      -
    • -
    - <% end %> -
-<% end %> -<% if !@organization.home_id.nil? and OrgDocumentComment.where("id = ?", @organization.home_id).count > 0 and params[:org_subfield_id].nil? %> - - <% act = OrgActivity.where("org_act_type = 'OrgDocumentComment' and org_act_id =?", @organization.home_id).first %> + <% end %> +
+ <% end %> + <% if !@organization.home_id.nil? and OrgDocumentComment.where("id = ?", @organization.home_id).count > 0 and params[:org_subfield_id].nil? %> + + <% act = OrgActivity.where("org_act_type = 'OrgDocumentComment' and org_act_id =?", @organization.home_id).first %> <%= render :partial => 'show_home_page', :locals => {:document => OrgDocumentComment.find(@organization.home_id), :home_id => @organization.home_id, :act => act} %> -<% end %> -<% if @org_activities %> - <%= render :partial => 'organizations/org_activities', - :locals => {:org_activities => @org_activities, - :page=> @page, - :org => @organization, - :org_act_count=> @org_activities.count} %> + <% end %> + <% if @org_activities %> + <%= render :partial => 'organizations/org_activities', + :locals => {:org_activities => @org_activities, + :page=> @page, + :org => @organization, + :org_act_count=> @org_activities.count} %> + <% end %> <% end %> + + diff --git a/public/stylesheets/new_user.css b/public/stylesheets/new_user.css index 986e4183d..0d0602788 100644 --- a/public/stylesheets/new_user.css +++ b/public/stylesheets/new_user.css @@ -76,6 +76,7 @@ a.linkGrey6:hover {color:#ffffff !important;} .ml15{ margin-left:15px;} .ml20{ margin-left:20px;} .ml24{margin-left:24px;} +.ml25{margin-left:25px;} .ml36{ margin-left:36px; } .ml40{ margin-left:40px;} .ml45{ margin-left:45px;} diff --git a/public/stylesheets/org.css b/public/stylesheets/org.css index d05c94bbe..76309217d 100644 --- a/public/stylesheets/org.css +++ b/public/stylesheets/org.css @@ -159,4 +159,22 @@ a.blue-btn { background-color: #269ac9; cursor: pointer; text-align: center; -} \ No newline at end of file +} + +/*名师榜20160505*/ +.function-row {border-bottom:1px dashed #b2b2b2; padding-bottom:16px;} +.teacher-list-search {width:310px; height:23px; border:1px solid #ccc; border-right:none; outline:none;} +.teacher-search-icon {background:url(../images/search.png) 0 3px no-repeat; width:25px; height:23px; border:1px solid #ccc; border-left:none;} +.teacher-search-type {width:84px; height:23px; border:1px solid #ccc; outline:none;} +.teacher-list-row {border-bottom:1px dashed #b2b2b2; padding:18px 0;} +.teacher-avatar {float:left;} +.teacher-name {font-size:18px; color:#333; margin-right:15px;} +.teacher-social-block {width:90px; float:left; text-align:center;} +.block-num {font-size:16px; color:#000;} +.block-title {font-size:12px; color:#999;} +.block-slice {width:1px; height:40px; background-color:#e0e0e0; float:left; margin-top:3px;} +.teacher-intro {font-size:13px; color:#999; line-height:24px; height:72px; overflow:hidden;} +a.teacher-select {font-size:13px; color:#fff; padding:3px 18px; background-color:#269ac9;} +a.teacher-select:hover {background-color:#297fb8;} +a.follow-button {font-size:13px; color:#272727; padding:3px 5px; background-color:#f2efef;} +a.follow-button:hover {background-color:#c1c1c1;}