parent
6261d95eba
commit
26b1f9f433
|
@ -25,22 +25,30 @@ class WelcomeController < ApplicationController
|
||||||
before_filter :entry_select, :only => [:index]
|
before_filter :entry_select, :only => [:index]
|
||||||
|
|
||||||
def index
|
def index
|
||||||
unless params[:project].nil?
|
# 企业版定制: params[:project]为传过来的参数
|
||||||
@cur_projects = Project.find(params[:project])
|
unless params[:organization].nil?
|
||||||
|
@cur_projects = Project.find(params[:organization])
|
||||||
@organization = @cur_projects.enterprise_name
|
@organization = @cur_projects.enterprise_name
|
||||||
@organization_projects = Project.find_by_sql(["select * from projects where enterprise_name =? ", @organization])
|
@organization_projects = current_user.admin? ? Project.where("enterprise_name =? ", @organization) : Project.all_public.where("enterprise_name =? ", @organization)
|
||||||
@e_count = @organization_projects.count
|
@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')
|
@enterprise_page = FirstPage.find_by_page_type('enterprise')
|
||||||
if @enterprise_page.nil?
|
if @enterprise_page.nil?
|
||||||
@enterprise_page = FirstPage.new
|
@enterprise_page = FirstPage.new
|
||||||
@enterprise_page.page_type = 'enterprise'
|
@enterprise_page.page_type = 'enterprise'
|
||||||
end
|
end
|
||||||
if @e_count < 9
|
# 主页配置部分结束
|
||||||
part_count = 9 - @e_count
|
|
||||||
# @part_projects = find_all_hot_project part_count, order
|
|
||||||
@part_projects = find_miracle_project(part_count, 3,"score desc")
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
# end 企业版定制结束
|
||||||
if @first_page.nil? || @first_page.sort_type.nil?
|
if @first_page.nil? || @first_page.sort_type.nil?
|
||||||
@projects = find_miracle_project(10, 3,"score desc")
|
@projects = find_miracle_project(10, 3,"score desc")
|
||||||
else
|
else
|
||||||
|
|
|
@ -5,11 +5,11 @@
|
||||||
<% if @projects.count == 0 %>
|
<% if @projects.count == 0 %>
|
||||||
<h3><%= l(:label_enterprise_nil) %></h3>
|
<h3><%= l(:label_enterprise_nil) %></h3>
|
||||||
<% else %>
|
<% else %>
|
||||||
<% @projects.each do |project| %>
|
<% @projects.each do |organization| %>
|
||||||
<% unless project.enterprise_name.blank? %>
|
<% unless organization.enterprise_name.blank? %>
|
||||||
<ul>
|
<ul>
|
||||||
<li ><img src="/images/organization_logo.jpg" width="30" height="30" alt="#{project.enterprise_name}" />
|
<li ><img src="/images/organization_logo.jpg" width="30" height="30" alt="#{project.enterprise_name}" />
|
||||||
<%= link_to project.enterprise_name, home_path(:project => project) %></li>
|
<%= link_to organization.enterprise_name, home_path(:organization => organization) %></li>
|
||||||
</ul>
|
</ul>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
@ -48,7 +48,7 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
<% else %>
|
<% else %>
|
||||||
<span class="font_welcome_school" style="color: #E8770D">
|
<span class="font_welcome_school" style="color: #E8770D">
|
||||||
<%= link_to @organization, options={:action => 'index', :enterprise => @organization}, html_options={ :method => 'get', :style => "color: #E8770D"} %>
|
<%= @organization %>
|
||||||
</span>
|
</span>
|
||||||
<br/>
|
<br/>
|
||||||
<span class="font_welcome_trustie">
|
<span class="font_welcome_trustie">
|
||||||
|
@ -87,7 +87,7 @@
|
||||||
<!-- 企业版项目 -->
|
<!-- 企业版项目 -->
|
||||||
<% else %>
|
<% else %>
|
||||||
<% if @e_count == 0 %>
|
<% if @e_count == 0 %>
|
||||||
<p id="errorExplanation"><%= l(:label_enterprise_tips) %></p>
|
<div id="flash_notice" class="flash notice"><%= l(:label_enterprise_tips) %></div>
|
||||||
<% @projects.map do |project| %>
|
<% @projects.map do |project| %>
|
||||||
<%= render :partial => 'hot_projects_list', :locals => {:project => project} %>
|
<%= render :partial => 'hot_projects_list', :locals => {:project => project} %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
@ -95,7 +95,7 @@
|
||||||
<% @organization_projects.map do |project| %>
|
<% @organization_projects.map do |project| %>
|
||||||
<%= render :partial => 'hot_projects_list', :locals => {:project => project} %>
|
<%= render :partial => 'hot_projects_list', :locals => {:project => project} %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<p id="errorExplanation"><%= l(:label_part_enterprise_tips) %></p>
|
<div id="flash_notice" class="flash notice"><%= l(:label_part_enterprise_tips) %></div>
|
||||||
<% @part_projects.map do |project| %>
|
<% @part_projects.map do |project| %>
|
||||||
<%= render :partial => 'hot_projects_list', :locals => {:project => project} %>
|
<%= render :partial => 'hot_projects_list', :locals => {:project => project} %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
Loading…
Reference in New Issue