ADD more companies page

This commit is contained in:
Jasder 2019-10-18 11:05:53 +08:00
parent 613b371e58
commit 0bc4ba2ac2
7 changed files with 35 additions and 57 deletions

View File

@ -1,25 +1,20 @@
class HomesController < ApplicationController
layout 'base_introduce'
before_filter :find_home, :except => [:index, :new, :create]
before_filter :find_home, :except => [:index, :new, :create, :partners]
# GET /homes
# GET /homes.json
def index
@home = Home.includes(:banners, :cover => [:file]).first
<<<<<<< HEAD
@dynamic_news = DynamicNew.limit(4)
@dynamic_news = DynamicNew.desc.limit(4)
@companies = WebFooterCompany.dedicators
@first_companies_group = Array(@companies.slice(0, 5))
@second_companies_group = Array(@companies.slice(5, 8))
@third_companies_group = Array(@companies.slice(13, 4))
=======
@dynamic_news = DynamicNew.desc.limit(4)
@companies = WebFooterCompany.dedicators.limit(26)
@first_companies_group = Array(@companies.slice(0, 8))
@second_companies_group = Array(@companies.slice(8, 10))
@third_companies_group = Array(@companies.slice(18, 8))
>>>>>>> 849b928baec73ad593eddd55d1ca697c6baad78b
end
def partners
@companies = WebFooterCompany.all.group_by {|company| company.key }
end
# GET /homes/1

View File

@ -21,4 +21,11 @@ module HomesHelper
File.join("/files/uploads/image", file.disk_directory, file.disk_filename)
end
def render_pool_name poll
case poll
when 'partner' then '合作机构'
when 'dedicator' then '合作共建平台'
else '合作机构'
end
end
end

View File

@ -25,7 +25,7 @@
<%= link_to image_tag(url_to_avatar(company),:alt=> company.name ), company.url, :target => "_blank" %>
<% end %>
<% if @companies.length > 17 %>
<a href="javascript:void(0)"><img src="/images/introduce/more.png"/></a>
<a href="<%= partners_homes_path %>"><img src="/images/introduce/more.png"/></a>
<% end %>
</li>
</div>

View File

@ -1,42 +0,0 @@
<div class="smallPanel">
<p class="mt15 mb25">
<a href="javascript:void(0)" class="c_grey02">首页</a><span class="c_grey02 ml3 mr3">&gt;</span>
<span>社区动态</span>
</p>
<p class="f28 lh24 mb20">合作共建平台</p>
<ul class="partnerList clearfix mb30">
<li><a href="javascript:void(0)"><img src="/images/ucloud.png"/></a></li>
<li><a href="javascript:void(0)"><img src="/images/ucloud.png"/></a></li>
<li><a href="javascript:void(0)"><img src="/images/ucloud.png"/></a></li>
<li><a href="javascript:void(0)"><img src="/images/ucloud.png"/></a></li>
<li><a href="javascript:void(0)"><img src="/images/ucloud.png"/></a></li>
<li><a href="javascript:void(0)"><img src="/images/ucloud.png"/></a></li>
<li><a href="javascript:void(0)"><img src="/images/ucloud.png"/></a></li>
<li><a href="javascript:void(0)"><img src="/images/ucloud.png"/></a></li>
<li><a href="javascript:void(0)"><img src="/images/ucloud.png"/></a></li>
<li><a href="javascript:void(0)"><img src="/images/ucloud.png"/></a></li>
<li><a href="javascript:void(0)"><img src="/images/ucloud.png"/></a></li>
<li><a href="javascript:void(0)"><img src="/images/ucloud.png"/></a></li>
<li><a href="javascript:void(0)"><img src="/images/ucloud.png"/></a></li>
<li><a href="javascript:void(0)"><img src="/images/ucloud.png"/></a></li>
<li><a href="javascript:void(0)"><img src="/images/ucloud.png"/></a></li>
</ul>
<p class="f28 lh24 mb20">合作机构</p>
<ul class="partnerList clearfix mb30">
<li><a href="javascript:void(0)"><img src="/images/ucloud.png"/></a></li>
<li><a href="javascript:void(0)"><img src="/images/ucloud.png"/></a></li>
<li><a href="javascript:void(0)"><img src="/images/ucloud.png"/></a></li>
<li><a href="javascript:void(0)"><img src="/images/ucloud.png"/></a></li>
<li><a href="javascript:void(0)"><img src="/images/ucloud.png"/></a></li>
<li><a href="javascript:void(0)"><img src="/images/ucloud.png"/></a></li>
<li><a href="javascript:void(0)"><img src="/images/ucloud.png"/></a></li>
<li><a href="javascript:void(0)"><img src="/images/ucloud.png"/></a></li>
<li><a href="javascript:void(0)"><img src="/images/ucloud.png"/></a></li>
<li><a href="javascript:void(0)"><img src="/images/ucloud.png"/></a></li>
<li><a href="javascript:void(0)"><img src="/images/ucloud.png"/></a></li>
<li><a href="javascript:void(0)"><img src="/images/ucloud.png"/></a></li>
<li><a href="javascript:void(0)"><img src="/images/ucloud.png"/></a></li>
<li><a href="javascript:void(0)"><img src="/images/ucloud.png"/></a></li>
<li><a href="javascript:void(0)"><img src="/images/ucloud.png"/></a></li>
</ul>
</div>

View File

@ -0,0 +1,16 @@
<div class="smallPanel">
<p class="mt15 mb25">
<a href="<%= homes_path %>" class="c_grey02">首页</a><span class="c_grey02 ml3 mr3">&gt;</span>
<span>开源生态</span>
</p>
<% @companies.each do |pool, coms| %>
<p class="f28 lh24 mb20"><%= render_pool_name(pool) %></p>
<ul class="partnerList clearfix mb30">
<% coms.each do |company|%>
<li>
<%= link_to image_tag(url_to_avatar(company),:alt=> company.name ), company.url, :target => "_blank" %>
</li>
<% end %>
</ul>
<% end %>
</div>

View File

@ -517,7 +517,9 @@ RedmineApp::Application.routes.draw do
#end
root :to => 'homes#index'
resources :homes, only: [:show, :index]
resources :homes, only: [:show, :index] do
get 'partners', on: :collection
end
# added by longjun
match 'welcome/contest', :via => :get
# end longjun