diff --git a/app/controllers/org_subfields_controller.rb b/app/controllers/org_subfields_controller.rb index 496c3aa92..159648f34 100644 --- a/app/controllers/org_subfields_controller.rb +++ b/app/controllers/org_subfields_controller.rb @@ -25,16 +25,18 @@ class OrgSubfieldsController < ApplicationController # status类型说明,详见SubField def update_status_by_type subfield, type case type + when "Resource" + subfield.update_attribute(:status, 6) when "Comptec" subfield.update_attribute(:status, 6) when "Compstu" subfield.update_attribute(:status, 7) when "Comppro" - subfield.update_attribute(:status, 8) + subfield.update_attribute(:status, 5) when "Compcou" - subfield.update_attribute(:status, 9) + subfield.update_attribute(:status, 2) when "Compact" - subfield.update_attribute(:status, 10) + subfield.update_attribute(:status, 4) end end diff --git a/app/controllers/organizations_controller.rb b/app/controllers/organizations_controller.rb index 4021560bf..8be34a318 100644 --- a/app/controllers/organizations_controller.rb +++ b/app/controllers/organizations_controller.rb @@ -93,7 +93,7 @@ class OrganizationsController < ApplicationController end # 热门项目 if @organization.org_subfields.where(:field_type => "Comppro", :hide => 0).count > 0 - @excellent_courses = Course.where(:is_public => true, :status => true) + @excellent_projects = Course.where(:is_public => true, :status => true, :hot => true) end # 最新动态, 来自我关联的项目和课程 if @organization.org_subfields.where(:field_type => "Compact", :hide => 0).count > 0 diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index a2285a678..42a033bee 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -3105,7 +3105,7 @@ def named_attachment_url_without_domain(id, filename, option={}) end #判断是否为默认的组织栏目 def is_default_field? field - (field.name == 'activity' || field.name == 'course' || field.name == 'project') && field.field_type == 'default' + (field.name == 'activity' || field.name == 'course' || field.name == 'project' || field.name == "Comppro" || field.name == "Comppro" || field.name == "Compact") && field.field_type == 'default' end def host_with_protocol diff --git a/app/helpers/organizations_helper.rb b/app/helpers/organizations_helper.rb index 4c6089b51..a5a3d6aaa 100644 --- a/app/helpers/organizations_helper.rb +++ b/app/helpers/organizations_helper.rb @@ -66,11 +66,40 @@ module OrganizationsHelper def org_user_by_type obj case obj.act_type when "Message" + user = obj.act.author when "News" + user = obj.act.author when "HomeworkCommon" + user = obj.act.user when "Issue" + user = obj.act.author end + end + def org_title_by_type obj + case obj.act_type + when "Message" + user = obj.act.parent_id.nil? ? obj.act.subject : obj.act.parent.subject + when "News" + user = obj.act.title + when "HomeworkCommon" + user = obj.act.name + when "Issue" + user = obj.act.subject + end + end + + def org_content_by_type obj + case obj.act_type + when "Message" + user = obj.act.parent_id.nil? ? obj.act.content : obj.act.parent.content + when "News" + user = obj.act.description + when "HomeworkCommon" + user = obj.act.description + when "Issue" + user = obj.act.description + end end #排列下拉框 diff --git a/app/views/organizations/_org_custom_header.html.erb b/app/views/organizations/_org_custom_header.html.erb index fc556255a..6368fef90 100644 --- a/app/views/organizations/_org_custom_header.html.erb +++ b/app/views/organizations/_org_custom_header.html.erb @@ -38,14 +38,9 @@ <%= link_to "首页", organization_path(@organization), :class => "por_index_act" %> <% when 'course' %> -
  • - 课程动态 -
  • <% when 'project' %> -
  • - 项目动态 -
  • <% end %> + <% else %> <% if field.field_type == "Post" && field.hide == 0 %>
  • <%= field.name %>
  • diff --git a/app/views/organizations/_org_custom_left2.html.erb b/app/views/organizations/_org_custom_left2.html.erb index ee9530d32..83d9dea17 100644 --- a/app/views/organizations/_org_custom_left2.html.erb +++ b/app/views/organizations/_org_custom_left2.html.erb @@ -119,6 +119,15 @@ <% end %> <% end %> <% end %> + <% when 'Compcou' %> + <% @excellent_courses.first(4).each do |course| %> +
    + <%= link_to course.name, course_path(course.id), :target => '_blank', :class => "por_course_title", :title => course.name %> + <%= link_to image_tag(url_to_avatar(course),:width => "140", :height => "100"), user_path(attach.author), :target => "_blank", :class => "fl" %> + <%=render :partial =>"organizations/organization_content_extension", :locals => {:user_activity_id => course.id, :content=> course.description, :maxheight => 80, :maxwordsnum => 56, :maxwidth => 0, :cl => "por_course_txt fl"} %> + <%= time_from_now course.updated_at %> +
    + <% end %> <% end %> <% else %> <% if field.field_type == "Post" %> diff --git a/app/views/organizations/_org_custom_right1.html.erb b/app/views/organizations/_org_custom_right1.html.erb index 4fed81a6b..882c994cc 100644 --- a/app/views/organizations/_org_custom_right1.html.erb +++ b/app/views/organizations/_org_custom_right1.html.erb @@ -5,44 +5,32 @@ <% else %> <% end %> \ No newline at end of file diff --git a/app/views/organizations/_org_custom_right2.html.erb b/app/views/organizations/_org_custom_right2.html.erb index 3cef2f622..7bb2cbf93 100644 --- a/app/views/organizations/_org_custom_right2.html.erb +++ b/app/views/organizations/_org_custom_right2.html.erb @@ -1,32 +1,22 @@
    -

    热点项目更多>

    - -
    \ No newline at end of file + <% cotainers[1..4].each do |container| %> +
  • + <%= link_to "#{container.name}".html_safe, project_path(container), :class => "por_hidden_w205 fl", :title => container.name, :target => "_blank" %> +

    活跃度<%= static_project_score(@project.project_score) %>

    +
    +
  • + <% end %> + <% end %> + diff --git a/app/views/organizations/_organization_content_extension.html.erb b/app/views/organizations/_organization_content_extension.html.erb index be5343d61..48abd48b9 100644 --- a/app/views/organizations/_organization_content_extension.html.erb +++ b/app/views/organizations/_organization_content_extension.html.erb @@ -1,16 +1,9 @@ -<% if cl.nil? %> - +

    <%= content.to_s.html_safe%> - -<% else %> -

    - - <%= content.to_s.html_safe%> - -

    -<% end %> +

    +