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