parent
a64671f9de
commit
d1edd86e11
|
@ -27,28 +27,31 @@ class WelcomeController < ApplicationController
|
|||
def index
|
||||
# 企业版定制: params[:project]为传过来的参数
|
||||
unless params[:organization].nil?
|
||||
@cur_projects = Project.find(params[:organization])
|
||||
@organization = @cur_projects.enterprise_name
|
||||
@organization_projects = (current_user.admin? || User.current.member_of?(@cur_projects)) ? Project.where("enterprise_name =? ", @organization) : Project.all_public.where("enterprise_name =? ", @organization)
|
||||
@e_count = @organization_projects.count
|
||||
@part_projects = []
|
||||
# 取十个
|
||||
@organization_projects.each do |obj|
|
||||
break if(@organization_projects[10] == obj)
|
||||
@part_projects << Project.visible.find_by_id("#{obj.id}") unless obj.id.nil?
|
||||
end
|
||||
# 不够十个的用最火项目替代
|
||||
@e_count < 9 ? @part_projects = find_miracle_project( 9 - @e_count, 3,"score desc") : @part_projects
|
||||
# 配置文件首页定制
|
||||
@organization = Organization.find params[:organization]
|
||||
@organization_projects = Project.visible.joins(:project_status).joins("LEFT JOIN project_scores ON projects.id = project_scores.project_id").where("projects.organization_id = ?", 1).order("score DESC").limit(10).all
|
||||
@part_projects = @organization_projects.count < 9 ? find_miracle_project( 9 - @organization_projects.count, 3,"score desc") : []
|
||||
# @cur_projects = Project.find(params[:organization])
|
||||
# @organization = @cur_projects.enterprise_name
|
||||
# @organization_projects = (current_user.admin? || User.current.member_of?(@cur_projects)) ? Project.where("enterprise_name =? ", @organization) : Project.all_public.where("enterprise_name =? ", @organization)
|
||||
# @e_count = @organization_projects.count
|
||||
# @part_projects = []
|
||||
# # 取十个
|
||||
# @organization_projects.each do |obj|
|
||||
# break if(@organization_projects[10] == obj)
|
||||
# @part_projects << Project.visible.find_by_id("#{obj.id}") unless obj.id.nil?
|
||||
# end
|
||||
# # 不够十个的用最火项目替代
|
||||
# @e_count < 9 ? @part_projects = find_miracle_project( 9 - @e_count, 3,"score desc") : @part_projects
|
||||
# # 配置文件首页定制
|
||||
@enterprise_page = FirstPage.find_by_page_type('enterprise')
|
||||
if @enterprise_page.nil?
|
||||
@enterprise_page = FirstPage.new
|
||||
@enterprise_page.page_type = 'enterprise'
|
||||
end
|
||||
# 主页配置部分结束
|
||||
|
||||
end
|
||||
# end 企业版定制结束
|
||||
|
||||
if @first_page.nil? || @first_page.sort_type.nil?
|
||||
@projects = find_miracle_project(10, 3,"score desc")
|
||||
else
|
||||
|
@ -74,7 +77,8 @@ class WelcomeController < ApplicationController
|
|||
@projects = @projects_all.order("score desc")
|
||||
end
|
||||
end
|
||||
|
||||
rescue Exception => e
|
||||
render_404
|
||||
end
|
||||
|
||||
def robots
|
||||
|
|
|
@ -5,7 +5,9 @@
|
|||
<!-- 上左下右 -->
|
||||
<div style="float: left; margin-left: 10px; width: 380px;">
|
||||
<% unless project.is_public %>
|
||||
<span class="private_project"> <%= l(:label_private) %> </span>
|
||||
<span class="private_project">
|
||||
<%= l(:label_private) %>
|
||||
</span>
|
||||
<% end %>
|
||||
<%= link_to( project.name, project_path(project.id), :class => "d-g-blue d-p-project-name",:title => "#{project.name}" )%>
|
||||
(<%= link_to l(:label_project_member_amount, :count=>projectCount(project)), project_member_path(project) ,:course =>'0' %>)
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
<% if get_avatar?(@first_page) %>
|
||||
<%= image_tag(url_to_avatar(@first_page), width:@first_page.image_width,height: @first_page.image_height) %>
|
||||
<% else %>
|
||||
<%= image_tag '/images/transparent.png', width:@first_page.image_width,height: @first_page.image_height %>
|
||||
<%= image_tag @organization.logo_link, width:@first_page.image_width,height: @first_page.image_height %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<%= image_tag(url_to_avatar(@enterprise_page), width:@first_page.image_width,height: @first_page.image_height) %>
|
||||
|
@ -48,7 +48,7 @@
|
|||
<% end %>
|
||||
<% else %>
|
||||
<span class="font_welcome_school" style="color: #E8770D">
|
||||
<%= @organization %>
|
||||
<%= @organization.name %>
|
||||
</span>
|
||||
<br/>
|
||||
<span class="font_welcome_trustie">
|
||||
|
@ -86,20 +86,17 @@
|
|||
<% end; reset_cycle %>
|
||||
<!-- 企业版项目 -->
|
||||
<% else %>
|
||||
<% if @e_count == 0 %>
|
||||
<div id="flash_notice" class="flash notice"><%= l(:label_enterprise_tips) %></div>
|
||||
<% if @part_projects.empty? %>
|
||||
<% @projects.map do |project| %>
|
||||
<%= render :partial => 'hot_projects_list', :locals => {:project => project} %>
|
||||
<% end %>
|
||||
<% elsif @e_count < 10 %>
|
||||
<% else %>
|
||||
<% @organization_projects.map do |project| %>
|
||||
<%= render :partial => 'hot_projects_list', :locals => {:project => project} %>
|
||||
<% end %>
|
||||
<div id="flash_notice" class="flash notice"><%= l(:label_part_enterprise_tips) %></div>
|
||||
<% @part_projects.map do |project| %>
|
||||
<%= render :partial => 'hot_projects_list', :locals => {:project => project} %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<div id="errorExplanation">
|
||||
<%= l(:label_part_enterprise_tips) %>
|
||||
</div>
|
||||
<% @part_projects.map do |project| %>
|
||||
<%= render :partial => 'hot_projects_list', :locals => {:project => project} %>
|
||||
<% end %>
|
||||
|
|
Loading…
Reference in New Issue