add ad_banner inner page,pic title.

This commit is contained in:
Fu Matthew 2013-01-09 16:54:33 +08:00
parent 614b6fde71
commit 5ab4bbd367
7 changed files with 43 additions and 2 deletions

View File

@ -28,6 +28,10 @@ class FrontController < ApplicationController
@page_id = params[:page_id]
end
def show_inner_ad_image
@ad_image = AdImage.find(params[:id]) rescue nil
@ad_images = AdImage.all
end
private

View File

@ -65,7 +65,6 @@ class PagesController < ApplicationController
def get_item
module_app = ModuleApp.first(:conditions => {:key => params[:app_name]})
if !params[:category_id].blank? && !params[:tag_id].blank?
@item = Item.first(:conditions => {:module_app_id => module_app.id, :app_frontend_url => params[:app_action], :category => params[:category_id], :tag => params[:tag_id]})
@item = Item.first(:conditions => {:module_app_id => module_app.id, :app_frontend_url => params[:app_action], :category => params[:category_id], :tag => ''}) unless @item

View File

@ -0,0 +1,9 @@
module FrontHelper
def ad_image_link(ad_image)
link = ad_image.out_link
link =front_show_inner_ad_image_path(:id=> ad_image.id) if link.blank? && !ad_image.context.blank?
end
end

View File

@ -19,7 +19,7 @@
<div id='slideshow-<%= @ad_banner.title.dehumanize %>' class='slideshow'>
<% (images = @ad_banner.ad_images).shuffle.each do |ad_image| %>
<% if ad_image.display? %>
<img src='<%= ad_image.file %>' alt='<%= ad_image.title || ' ' %>' time_to_next='<%= @ad_banner.transition_msec %>' link_open='<%= ad_image.link_open %>' link_url='<%= (ad_image.out_link) %>' style=' <%= 'cursor:pointer;' if !ad_image.out_link.blank? %>'/>
<img src='<%= ad_image.file %>' alt='<%= ad_image.title || ' ' %>' title='<%= ad_image.title || ' ' %>' time_to_next='<%= @ad_banner.transition_msec %>' link_open='<%= ad_image.link_open %>' link_url='<%= ad_image_link(ad_image)%>' style=' <%= 'cursor:pointer;' if !ad_image.out_link.blank? %>'/>
<% end %>
<% end %>
</div>

View File

@ -0,0 +1,21 @@
<%if @ad_image && @ad_image.display? %>
<h1 class="h1"><%= @ad_image.title %></h1>
<div class="info">
<div class="info1">
<span class="date"><%= display_date_time(@ad_image.post_date) %></span>
</div>
</div>
<div class="news_image">
<%#= image_tag(@ad_image.image.url, :size => "320x240") if @ad_image.image.file %>
<%= link_to image_tag(@ad_image.file.url, :size => "320x240"), @ad_image.file.url, {:target => '_blank', :title => @ad_image.title} if @ad_image.file.file %>
</div>
<div class="news_paragraph">
<%= @ad_image.context.html_safe rescue '' %>
</div>
<%#= share_links(@ad_image, 'ad_image') %>
<% else %>
<% end %>

View File

@ -280,4 +280,6 @@ Orbit::Application.routes.draw do
root :to => 'pages#index'
match '/panel/ad_banner/front_end/inner_page/:id' => 'front#show_inner_ad_image', :as => :front_show_inner_ad_image
end

View File

@ -383,5 +383,11 @@ namespace :migrate do
end
end
task :add_inner_page_for_ad_banner => :environment do
a = ModuleApp.where(:key=>'ad_banner').first
a.app_pages = ["inner_page"]
a.save
end
end