From 68cea1ea491dc4c18167d04d672901eaffac7269 Mon Sep 17 00:00:00 2001
From: Matthew Kaito Juyuan Fu
Date: Thu, 2 Feb 2012 09:55:09 +0800
Subject: [PATCH] AdBanner is now working
---
app/models/ad_banner.rb | 4 +++-
app/views/admin/ad_banners/_form.html.erb | 4 ++++
lib/fraisier/layout.html | 2 ++
lib/parsers/parser_back_end.rb | 19 +++++++++++++++++++
lib/parsers/parser_front_end.rb | 12 ++++++++++++
lib/parsers/parser_layout.rb | 2 ++
6 files changed, 42 insertions(+), 1 deletion(-)
diff --git a/app/models/ad_banner.rb b/app/models/ad_banner.rb
index 368c7081..4fcfea9b 100644
--- a/app/models/ad_banner.rb
+++ b/app/models/ad_banner.rb
@@ -9,13 +9,15 @@ class AdBanner
field :unpost_date,type: Date
field :context
field :direct_to_after_click,type: Boolean
- field :ad_style #TODO Design should explain
+ field :ad_fx #TODO Design should explain
before_save :save_or_destroy
embeds_many :ad_images, :cascade_callbacks => true
+ FX_TYPES = ["blindX","blindY","blindZ","cover","curtainX","curtainY","fade","fadeZoom","growX","growY","scrollUp","scrollDown","scrollLeft","scrollRight","scrollHorz","scrollVert","shuffle","slideX","slideY","toss","turnUp","turnDown","turnLeft","turnRight","uncover","wipe","zoom"]
+
def new_ad_images=(*attrs)
attrs[0].each do |attr| #Loop by JSs,Themes,Imgs
unless attr[:file].nil?
diff --git a/app/views/admin/ad_banners/_form.html.erb b/app/views/admin/ad_banners/_form.html.erb
index ff19e513..ff522794 100644
--- a/app/views/admin/ad_banners/_form.html.erb
+++ b/app/views/admin/ad_banners/_form.html.erb
@@ -34,6 +34,10 @@
<%= f.label :direct_to_after_click, t('admin.direct_to_after_click') %>
<%= f.check_box :direct_to_after_click %>
+
+ <%= f.label :ad_fx, t('admin.ad_fx') %>
+ <%= f.select :ad_fx ,AdBanner::FX_TYPES %>
+
<%= f.label :ad_images, t('admin.ad_images') %>
diff --git a/lib/fraisier/layout.html b/lib/fraisier/layout.html
index f6fb9942..ac6d3c6b 100644
--- a/lib/fraisier/layout.html
+++ b/lib/fraisier/layout.html
@@ -18,6 +18,8 @@