热门项目按照项目得分排序及设置界面中默认设置

This commit is contained in:
huang 2016-06-03 10:31:29 +08:00
parent 432baebdc3
commit ca3b072f85
4 changed files with 7 additions and 19 deletions

View File

@ -93,7 +93,10 @@ class OrganizationsController < ApplicationController
end
# 热门项目
if @organization.org_subfields.where(:field_type => "Comppro", :hide => 0).count > 0
@excellent_projects = Project.where(:is_public => true, :status => true, :hot => true)
# @excellent_projects = Project.where(:is_public => true, :status => true, :hot => true).order("project_score")
@excellent_projects = Project.find_by_sql("SELECT p.* FROM `projects` p, project_scores ps where p.id = ps.project_id and p.is_public =1 and
status =1 and hot =1 order by (ps.issue_num * 4 + ps.issue_journal_num + ps.changeset_num * 4 + ps.board_num * 2 +
ps.board_message_num + ps.news_num + ps.attach_num * 5) desc limit 5;")
end
# 最新动态, 来自我关联的项目和课程
if @organization.org_subfields.where(:field_type => "Compact", :hide => 0).count > 0

View File

@ -3103,9 +3103,10 @@ def named_attachment_url_without_domain(id, filename, option={})
attachment_id = (Attachment === id ? id.id : id)
Setting.protocol + "://" + Setting.host_name + "/attachments/" + attachment_id.to_s + "/" + filename
end
#判断是否为默认的组织栏目
def is_default_field? field
(field.name == 'activity' || field.name == 'course' || field.name == 'project' || field.name == "Comppro" || field.name == "Comppro" || field.name == "Compact") && field.field_type == 'default'
(field.name == 'activity' || field.name == 'course' || field.name == 'project' ) && field.field_type == 'default'
end
def host_with_protocol

View File

@ -105,10 +105,6 @@ module OrganizationsHelper
#排列下拉框
def subfield_status_option
type = []
option1 = []
option1 << "左一"
option1 << "1"
type << option1
option2 = []
option2 << "左二"
option2 << "2"
@ -117,18 +113,6 @@ module OrganizationsHelper
option3 << "左三"
option3 << "2"
type << option3
option4 = []
option4 << "右一"
option4 << "3"
type << option4
option5 = []
option5 << "右二"
option5 << "5"
type << option5
option6 = []
option6 << "右三"
option6 << "6"
type << option6
type
end

View File

@ -57,7 +57,7 @@
</li>
<li class="orgListStatus">新增</li>
<li class="orgListStatusList">
<% if field.field_type == "Resource" || field.field_type == "Comptec" %>
<% if field.field_type == "Resource" || field.field_type == "Comptec" || field.field_type == "Comppro" || field.field_type == "Compcou" || field.field_type == "Compact" || field.field_type == "Compstu" %>
默认
<% else %>
<%= form_tag({:controller => 'org_subfields', :action => 'update_status', :id => field.id,},:remote=>'true', :method => 'post', :id=>"update_status_form_#{field.id}", :class => 'query_form') do %>