Merge branch 'hjq_beidou' of https://git.trustie.net/jacknudt/trustieforge into hjq_beidou

This commit is contained in:
Tim 2016-06-03 08:42:09 +08:00
commit a9ad6c05a8
10 changed files with 95 additions and 89 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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
#排列下拉框

View File

@ -38,14 +38,9 @@
<%= link_to "首页", organization_path(@organization), :class => "por_index_act" %>
</li>
<% when 'course' %>
<li style="display:<%= field.hide == 0 ? 'block':'none' %>;">
<a href="#course_<%= field.id %>" class="sn-link-white"> 课程动态</a>
</li>
<% when 'project' %>
<li style="display:<%= field.hide == 0 ? 'block':'none' %>;">
<a href="#project_<%= field.id %>" class="sn-link-white">项目动态</a>
</li>
<% end %>
<% else %>
<% if field.field_type == "Post" && field.hide == 0 %>
<li><a href="#message_<%= field.id %>" class="sn-link-white"><%= field.name %></a></li>

View File

@ -119,6 +119,15 @@
<% end %>
<% end %>
<% end %>
<% when 'Compcou' %>
<% @excellent_courses.first(4).each do |course| %>
<div class="por_course_bar fl clear">
<%= 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"} %>
<a class=" por_course_time"><%= time_from_now course.updated_at %></a>
</div>
<% end %>
<% end %>
<% else %>
<% if field.field_type == "Post" %>

View File

@ -5,44 +5,32 @@
<% else %>
<ul class="por_news_list clear">
<% @acts.each do |obj| %>
<% if obj.act_type = "Message" %>
<% user = org_user_by_type(obj) %>
<% title = org_title_by_type(obj) %>
<% content = org_content_by_type(obj) %>
<% message = obj.act %>
<% title = message.parent_id.nil? ? message.subject : message.parent.subject %>
<li>
<%= link_to image_tag(url_to_avatar(user),:width => "43", :height => "43", :class => "por_users_img"), user_path(user), :target => "_blank", :class => "fl" %>
<div class="por_news_txt fl">
<p class="por_news_p fl">
<%= link_to message.author.show_name, user_path(message.author), :class => "por_hot_name fl", :target => "_blank" %>
<span class="fl">&nbsp;:&nbsp;</span>
<%=render :partial =>"organizations/organization_content_extension", :locals => {:user_activity_id => message.id, :content=> message.content, :maxheight => 40, :maxwordsnum => 28, :maxwidth => 0, :cl => ""} %>
</p>
<p><span class="por_time fl"><%= time_from_now(message.created_on) %> </span>
<!--<a href="javascript:void(0);" target="_blank" class="por_zan fr">50</a>-->
</p>
</div>
<div class="cl"></div>
</li>
<% elsif obj.act_type = "News" %>
<% elsif obj.act_type = "HomeworkCommon" %>
<% elsif obj.act_type = "Issue" %>
<% end %>
<% user = org_user_by_type(obj) %>
<% title = org_title_by_type(obj) %>
<% content = org_content_by_type(obj) %>
<li>
<%= link_to image_tag(url_to_avatar(user),:width => "43", :height => "43", :class => "por_users_img"), user_path(user), :target => "_blank", :class => "fl" %>
<div class="por_news_txt fl">
<p class="por_news_p fl">
<%= link_to user.show_name, user_path(user), :class => "por_hot_name fl", :target => "_blank" %>
<span class="fl">&nbsp;:&nbsp;</span>
<% if obj.act_type = "Message" %>
<%= link_to title, board_message_path(obj.act.board.id, obj.act.id) %>
<% elsif obj.act_type = "News" %>
<%= link_to title, news_path(obj.act.id) %>
<% elsif obj.act_type = "HomeworkCommon" %>
<%= link_to title, student_work_index_url_in_org(obj.act.id) %>
<% elsif obj.act_type = "Issue" %>
<%= link_to title, issue_path(obj.act.id) %>
<% end %>
</p>
<p><span class="por_time fl"><%= time_from_now(obj.act.created_on) %> </span>
<!--<a href="javascript:void(0);" target="_blank" class="por_zan fr">50</a>-->
</p>
</div>
<div class="cl"></div>
</li>
<% end %>
<li >
<a href="javascript:void(0);" target="_blank" class="fl"><img src="/images/org_custom/homepageImage.jpg" width="43" height="43" alt="" class="por_users_img"/></a>
<div class="por_news_txt fl">
<p class="por_news_p fl">
<a href="javascript:void(0);" target="_blank" class=" por_hot_name fl"> 叮当当 </a><span class="fl">&nbsp;:&nbsp;</span>
Trustie社区新版上线了必须支持一下比以前好用很多....
</p>
<p><span class="por_time fl">1分钟前 </span><a href="javascript:void(0);" target="_blank" class="por_zan fr">500</a></p>
</div>
<div class="cl"></div>
</li>
</ul>
<% end %>
</div><!--por_news end-->

View File

@ -1,32 +1,22 @@
<div class="por_projects">
<h2 class="por_h2_index clear">热点项目<a href="javascript:void(0);" target="_blank" class="por_more_index fr">更多></a></h2>
<ul>
<li class="por_project_li">
<a href="javascript:void(0);" target="_blank" class=" por_hidden_w205 fl"><span class="post_icons_grey fl"></span>谷歌、Facebook等超过8ook等超过80%ook等超过80%ook等超过80%0%的企业都为开源做贡献贡献贡</a>
<p class="fr por_time">活跃度<a href="javascript:void(0);" target="_blank" class="ml5" >500</a></p>
<h2 class="por_h2_index clear">热点项目</h2>
<% if containers.blank? %>
<p class="fontGrey2 f14 mt10 mb5">该模块暂时没有相关内容</p>
<% else %>
<% container = cotainers.first %>
<li class="por_project_li">
<%= link_to "<span class='post_icons_grey fl'></span>#{container.name}".html_safe, project_path(container), :class => "por_hidden_w205 fl", :title => container.name, :target => "_blank" %>
<p class="fr por_time">活跃度<a class="ml5" ><%= static_project_score(@project.project_score) %></a></p>
<div class="cl"></div>
<%=render :partial =>"organizations/organization_content_extension", :locals => {:user_activity_id => activity.id, :content=> activity.description, :maxheight => 20, :maxwordsnum => 70, :maxwidth => 0, :cl => "por_project_p"} %>
</li>
<div class="cl"></div>
<p class="por_project_p ">众所周知,系统读取数据时,从内存中读取要比从硬盘上速度要快好几上速度要快好几百倍。故现在绝大上速度要快好几百倍。故现在绝大百倍。故现在绝大部分应用系...</p>
</li>
<li>
<a href="javascript:void(0);" target="_blank" class=" por_hidden_w205 fl"><span class="post_icons_grey fl"></span>谷歌、Facebook等超过8ook等超过80%ook等超过80%ook等超过80%0%的企业都为开源做贡献贡献贡</a>
<p class="fr por_time">活跃度<a href="javascript:void(0);" target="_blank" class="ml5" >500</a></p>
<div class="cl"></div>
</li>
<li>
<a href="javascript:void(0);" target="_blank" class=" por_hidden_w205 fl"><span class="post_icons_grey fl"></span>谷歌、Facebook等超过8ook等超过80%ook等超过80%ook等超过80%0%的企业都为开源做贡献贡献贡</a>
<p class="fr por_time">活跃度<a href="javascript:void(0);" target="_blank" class="ml5" >500</a></p>
<div class="cl"></div>
</li>
<li>
<a href="javascript:void(0);" target="_blank" class=" por_hidden_w205 fl"><span class="post_icons_grey fl"></span>谷歌、Facebook等超过8ook等超过80%ook等超过80%ook等超过80%0%的企业都为开源做贡献贡献贡</a>
<p class="fr por_time">活跃度<a href="javascript:void(0);" target="_blank" class="ml5" >500</a></p>
<div class="cl"></div>
</li>
<li>
<a href="javascript:void(0);" target="_blank" class=" por_hidden_w205 fl"><span class="post_icons_grey fl"></span>谷歌、Facebook等超过8ook等超过80%ook等超过80%ook等超过80%0%的企业都为开源做贡献贡献贡</a>
<p class="fr por_time">活跃度<a href="javascript:void(0);" target="_blank" class="ml5" >500</a></p>
<div class="cl"></div>
</li>
</ul>
</div><!--por_projects end-->
<% cotainers[1..4].each do |container| %>
<li>
<%= link_to "<span class='post_icons_grey fl'></span>#{container.name}".html_safe, project_path(container), :class => "por_hidden_w205 fl", :title => container.name, :target => "_blank" %>
<p class="fr por_time">活跃度<a class="ml5" ><%= static_project_score(@project.project_score) %></a></p>
<div class="cl"></div>
</li>
<% end %>
<% end %>
</div><!--por_projects end-->

View File

@ -1,16 +1,9 @@
<% if cl.nil? %>
<span class="<%= cl %>" id="activity_description_<%= user_activity_id %>">
<p class="<%= cl %>" id="activity_description_<%= user_activity_id %>">
<span id="intro_content_<%= user_activity_id%>">
<%= content.to_s.html_safe%>
</span>
</span>
<% else %>
<p class="<%= cl %>" id="activity_description_<%= user_activity_id %>">
<span id="intro_content_<%= user_activity_id%>">
<%= content.to_s.html_safe%>
</span>
</p>
<% end %>
</p>
<script type="text/javascript">
$("#intro_content_<%= user_activity_id %>").hide();

View File

@ -15,7 +15,7 @@
<% if field.status.to_i == 4 %>
<%= render :partial => 'organizations/org_custom_right1', :locals => {:field => field} %>
<% elsif field.status.to_i == 5 %>
<%= render :partial => 'organizations/org_custom_right2', :locals => {:field => field} %>
<%= render :partial => 'organizations/org_custom_right2', :locals => {:field => field, :containers => @excellent_projects} %>
<% elsif field.status.to_i == 6 %>
<%= render :partial => 'organizations/org_custom_right3', :locals => {:field => field} %>
<% end %>