ADD more news page
This commit is contained in:
parent
0bc4ba2ac2
commit
63057a1fb5
|
@ -1,7 +1,7 @@
|
||||||
class HomesController < ApplicationController
|
class HomesController < ApplicationController
|
||||||
layout 'base_introduce'
|
layout 'base_introduce'
|
||||||
|
|
||||||
before_filter :find_home, :except => [:index, :new, :create, :partners]
|
before_filter :find_home, :except => [:index, :new, :create, :partners, :news]
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@home = Home.includes(:banners, :cover => [:file]).first
|
@home = Home.includes(:banners, :cover => [:file]).first
|
||||||
|
@ -17,6 +17,19 @@ class HomesController < ApplicationController
|
||||||
@companies = WebFooterCompany.all.group_by {|company| company.key }
|
@companies = WebFooterCompany.all.group_by {|company| company.key }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def news
|
||||||
|
scope = DynamicNew.desc
|
||||||
|
@dynamic_news_count = scope.count
|
||||||
|
|
||||||
|
@dynamic_news = paginateHelper scope, 15
|
||||||
|
@page = (params['page'] || 1).to_i - 1
|
||||||
|
|
||||||
|
respond_to do |format|
|
||||||
|
format.js
|
||||||
|
format.html
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
# GET /homes/1
|
# GET /homes/1
|
||||||
# GET /homes/1.json
|
# GET /homes/1.json
|
||||||
def show
|
def show
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
<% @dynamic_news.each do |dynamic_new| %>
|
||||||
|
<li>
|
||||||
|
<img src="<%= dynamic_new.cover_url %>" width="158px" height="100px" class="mr20"/>
|
||||||
|
<div>
|
||||||
|
<p class="mb25">
|
||||||
|
<a href="<%= dynamic_new.remote_url %>" class="f18 color-grey3 mr10 fl lh24"><%= h dynamic_new.title %></a>
|
||||||
|
<span class="activitiesTag">行业动态</span>
|
||||||
|
<span class="f12 fontGrey4 fr"><i class="iconfont icon-shijian f14 fl mr5 lh18"></i><%= format_time(dynamic_new.created_at) %></span>
|
||||||
|
</p>
|
||||||
|
<p class="introduce_a_content break_full_word">
|
||||||
|
<span><%= h dynamic_new.simple_intruduce %></span>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<% end %>
|
||||||
|
<ul class="pages" style="width: auto;display: table;margin-left: auto;margin-right: auto; padding-top: 10px">
|
||||||
|
<%= pagination_links_full @obj_pages, @obj_count ,:per_page_links => true, :remote => true, :flag => true, :is_new => true %>
|
||||||
|
</ul>
|
|
@ -20,7 +20,7 @@
|
||||||
<div>
|
<div>
|
||||||
<p class="clearfix mb10">
|
<p class="clearfix mb10">
|
||||||
<span class="f26 lh26 color-grey3 fl mt3">社区动态</span>
|
<span class="f26 lh26 color-grey3 fl mt3">社区动态</span>
|
||||||
<a href="javaScript:void(0)" class="fr fontGrey4 mt8">更多>></a>
|
<a href="<%= news_homes_path %>" class="fr fontGrey4 mt8">更多>></a>
|
||||||
</p>
|
</p>
|
||||||
<div class="homepage_activity_list">
|
<div class="homepage_activity_list">
|
||||||
<%= render :partial => 'dynamic_news', :locals => {:dynamic_news => @dynamic_news}%>
|
<%= render :partial => 'dynamic_news', :locals => {:dynamic_news => @dynamic_news}%>
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
<div class="smallPanel">
|
||||||
|
<p class="mt15 mb25">
|
||||||
|
<a href="<%= homes_path %>" class="c_grey02">首页</a><span class="c_grey02 ml3 mr3">></span>
|
||||||
|
<span>行业动态</span>
|
||||||
|
</p>
|
||||||
|
<p class="f28 lh24">社区动态</p>
|
||||||
|
<ul class="introduce_a_list">
|
||||||
|
<%= render :partial => 'news_list'%>
|
||||||
|
</ul>
|
||||||
|
</div>
|
|
@ -0,0 +1 @@
|
||||||
|
$(".introduce_a_list").html("<%= escape_javascript(render :partial => 'news_list') %>");
|
|
@ -519,6 +519,7 @@ RedmineApp::Application.routes.draw do
|
||||||
root :to => 'homes#index'
|
root :to => 'homes#index'
|
||||||
resources :homes, only: [:show, :index] do
|
resources :homes, only: [:show, :index] do
|
||||||
get 'partners', on: :collection
|
get 'partners', on: :collection
|
||||||
|
match 'news', on: :collection, :via => [:get, :post]
|
||||||
end
|
end
|
||||||
# added by longjun
|
# added by longjun
|
||||||
match 'welcome/contest', :via => :get
|
match 'welcome/contest', :via => :get
|
||||||
|
|
Loading…
Reference in New Issue