Updated AdBanner index page and Ad Image index page, and edit pages

Conflicts:
	vendor/built_in_modules/ad_banner/config/locales/en.yml
	vendor/built_in_modules/ad_banner/init.rb
This commit is contained in:
saurabhbhatia committed 2013-08-09 15:22:06 +08:00
1 parent e14cb3c74c
commit 7c64e8c637
14 files changed
+180 -156

No files matched your search

+19 -20
View File
@@ -10,28 +10,27 @@ class Admin::AdImagesController < Admin::AdBannersController
end
def index
@ad_banner = AdBanner.find params[:ad_banner_id]
@ad_images = @ad_banner.ad_images.all.page(params[:page]).per(10)
#@ad_banner = AdBanner.find params[:ad_banner_id]
#@ad_images = @ad_banner.ad_images.all.page(params[:page]).per(10)
@ad_images = AdImage.all.page(params[:page]).per(10)
end
def edit
@ad_banner = AdBanner.find params[:ad_banner_id]
@ad_image = @ad_banner.ad_images.find params[:id]
#@ad_banner = AdBanner.find params[:ad_banner_id]
@ad_image = AdImage.find(params[:id])
@tags = get_tags
end
def update
@ad_banner = AdBanner.find params[:ad_banner_id]
@ad_image = AdImage.find params[:id]
@ad_image = AdImage.find(params[:id])
@ad_image.update_attributes(params[:ad_image])
@ad_image.to_save = true
@ad_image.save!
redirect_to admin_ad_banner_path @ad_banner
redirect_to admin_ad_images_path
end
def new
ad_banner = AdBanner.find params[:ad_banner_id]
@ad_image =ad_banner.ad_images.build
#ad_banner = AdBanner.find params[:ad_banner_id]
#@ad_image =ad_banner.ad_images.build
@ad_image = AdImage.new
@ad_image.post_date = Date.today
@ad_image.unpost_date = Date.today + 30
@tags = get_tags
@@ -39,23 +38,23 @@ class Admin::AdImagesController < Admin::AdBannersController
end
def create
@ad_banner = AdBanner.find params[:ad_banner][:id]
ad_image = AdImage.new params[:ad_image]
ad_image.to_save = true
@ad_banner.ad_images << ad_image
# @ad_banner = AdBanner.find params[:ad_banner][:id]
@ad_image = AdImage.new params[:ad_image]
#@ad_image.to_save = true
#@ad_banner.ad_images << ad_image
if @ad_banner.save!
redirect_to admin_ad_banner_path @ad_banner
if @ad_image.save
redirect_to admin_ad_images_path
end
end
def destroy
@ad_banner = AdBanner.find params[:ad_banner_id]
@ad_image = @ad_banner.ad_images.find params[:id]
#@ad_banner = AdBanner.find params[:ad_banner_id]
@ad_image = AdImage.find params[:id]
if @ad_image.destroy
flash[:notice] = t('ad.success_destroy_ad_image')
redirect_to admin_ad_banner_path @ad_banner
redirect_to admin_ad_images_path
end
end
+25
View File
@@ -0,0 +1,25 @@
<div class="content">
<%= form_for(:ad_banner, :url => admin_ad_banner_path(:ad_banner), :remote => true) do |f| %>
<fieldset>
<legend>Ad Banner</legend>
<label>Banner Name</label>
<%= f.text_field :title, :class=>"input-large", :placeholder=>"Banner Name" %>
<span class="help-block">Banner Name only english</span>
<label for="timeout">Ste</label>
<%= f.text_field :transition_sec, :class => 'input-large', :placeholder => 'Time' %>
<span class="help-block">Please enter the number of seconds</span>
<label>Best Size</label>
<%= f.text_field :best_size, :class=>"input-large", :placeholder=>"Banner Size" %>
<span class="help-block">Best Size EX:120x30 </span>
<label>Effect</label>
<%= f.select :ad_fx ,AdBanner::FX_TYPES %>
<div class="preview">
<%= image_tag "slideshow_preview_A.png", :width=>220 %>
<%= image_tag "slideshow_preview_B.png", :width=>220 %>
</div>
<span class="help-block">Effect</span>
<a href="javascript:$.pageslide.close()" class="btn btn-small"><%= t(:cancel) %></a>
<%= f.submit t(:create_), class: 'btn btn-primary btn-small' %>
</fieldset>
<% end %>
</div>
@@ -0,0 +1,41 @@
<table class="table main-list">
<thead>
<tr>
<th class="span1"><%= t('ad_banner.title') %></th>
<th class="span1"><%= t('ad_banner.transition_msec') %></th>
<th class="span1"><%= t('ad_banner.ad_fx') %></th>
</tr>
</thead>
<tbody id="tbody_locations" class="sort-holder">
<% @ad_banners.each do |ad_banner| %>
<tr class="with_action">
<td><%= ad_banner.title %>
<div class="quick-edit">
<ul class="nav nav-pills">
<% if is_admin?%>
<li><%= link_to t(:edit), edit_admin_ad_banner_path(ad_banner)%></li>
<li><%= link_to 'Destroy', admin_ad_banner_path(ad_banner), method: :delete , :confirm => t(:sure?) %></li>
<% end %>
</ul>
</div>
</td>
<td><%= ad_banner.transition_msec %></td>
<td><%= ad_banner.ad_fx%></td>
</tr>
<% end %>
</tbody>
</table>
<%if is_manager? %>
<!-- footer -->
<div class="bottomnav clearfix">
<div class="action pull-right">
<%= link_to content_tag(:i, nil, class: "icons-plus") + " " + t(:add_new), "#add-banner", :class => "btn btn-primary open-slide"%>
</div>
</div>
<div id="add-banner" class="nano" style="display:none">
<%= render 'new' %>
</div>
<% end %>
+1 -25
View File
@@ -1,25 +1 @@
<div class="content">
<%= form_for(:ad_banner, :url => admin_ad_banners_path, :remote => true) do |f| %>
<fieldset>
<legend>Ad Banner</legend>
<label>Banner Name</label>
<%= f.text_field :title, :class=>"input-large", :placeholder=>"Banner Name" %>
<span class="help-block">Banner Name only english</span>
<label for="timeout">Ste</label>
<%= f.text_field :transition_sec, :class => 'input-large', :placeholder => 'Time' %>
<span class="help-block">Please enter the number of seconds</span>
<label>Best Size</label>
<%= f.text_field :best_size, :class=>"input-large", :placeholder=>"Banner Size" %>
<span class="help-block">Best Size EX:120x30 </span>
<label>Effect</label>
<%= f.select :ad_fx ,AdBanner::FX_TYPES %>
<div class="preview">
<%= image_tag "slideshow_preview_A.png", :width=>220 %>
<%= image_tag "slideshow_preview_B.png", :width=>220 %>
</div>
<span class="help-block">Effect</span>
<a href="javascript:$.pageslide.close()" class="btn btn-small"><%= t(:cancel) %></a>
<%= f.submit t(:create_), class: 'btn btn-primary btn-small' %>
</fieldset>
<% end %>
</div>
<%= render 'edit'%>
+1
View File
@@ -0,0 +1 @@
$('#view-page .content').html("<%= j render 'edit' %>");
+7 -49
View File
@@ -1,51 +1,9 @@
<% set_default_index do
objects @ad_banners
quick_edit_link type: 'edit',
link: 'edit_admin_ad_banner_path'
quick_edit_link type: 'detail'
quick_edit_link type: "add image",
link: 'new_admin_ad_banner_ad_image_path'
quick_edit_link type: "Images",
link: 'admin_ad_banner_ad_images_path'
field type: 'field',
db_field: 'title',
translation: 'title',
sort: 'title',
link: 'admin_ad_banner_path',
quick_edit: true,
header_class: 'span5'
field type: 'field',
db_field: 'ad_fx',
translation: 'ad_fx',
sort: 'ad_fx',
link: 'admin_ad_banner_path',
quick_edit: true,
header_class: 'span5'
field db_field: 'best_size',
translation: 'best_size',
header_class: 'span5'
filter_field type: 'objects',
values: @tags,
translation: 'tags',
object_field: 'name'
end %>
<%= render 'admin/default_index/index' %>
<!-- footer -->
<div class="bottomnav clearfix">
<div class="action pull-right">
<%= link_to content_tag(:i, nil, class: "icons-plus") + " " + t(:add_new), "#add-banner", :class => "btn btn-primary open-slide"%>
<% content_for :right_nav do %>
<div class="searchClear pull-right">
<input id="filter-input" class="search-query input-medium" type="text" placeholder="<%= t('search.tags') %>" value="">
</div>
</div>
<% end %>
<div id="add-banner" class="nano" style="display:none">
<%= render 'new' %>
</div>
<div id="tags_index">
<%= render 'index' %>
</div>
+3
View File
@@ -0,0 +1,3 @@
$("#categories_index").html("<%= j render 'index' %>")
$.pageslide.close();
openSlide();
+1 -1
View File
@@ -1,6 +1,6 @@
<%= flash_messages %>
<%= form_for @ad_image, :url => admin_ad_banner_ad_image_path, :html => { :class => 'form' } do |f| %>
<%= form_for @ad_image, :url => admin_ad_image_path, :html => { :class => 'form' } do |f| %>
<%= render :partial => "form", :locals => { :f => f } %>
+45 -36
View File
@@ -1,39 +1,48 @@
<% set_default_index do
objects @ad_images
<table class="table main-list">
<thead>
<tr>
<th class="span1"><%= t('ad_image.image') %></th>
<th class="span1"><%= t('ad_image.post_date') %></th>
<th class="span1"><%= t('ad_image.unpost_date') %></th>
<th class="span1"><%= t('ad_image.context') %></th>
<th class="span1"><%= t('ad_image.out_link') %></th>
</tr>
</thead>
<tbody id="tbody_locations" class="sort-holder">
<% @ad_images.each do |ad_image| %>
<tr class="with_action">
<td><%= image_tag ad_image.file.thumb %>
<div class="quick-edit">
<ul class="nav nav-pills">
<% if is_admin?%>
<li><%= link_to t(:edit), edit_admin_ad_image_path(ad_image)%></li>
<li><%= link_to 'Destroy', admin_ad_image_path(ad_image), method: :delete , :confirm => t(:sure?) %></li>
quick_edit_link type: 'edit',
link: 'edit_admin_ad_banner_ad_image_path'
quick_edit_link type: 'detail'
quick_edit_link type: 'delete',
link: 'admin_ad_banner_ad_image_path'
<% end %>
</ul>
</div>
</td>
<td><%= ad_image.post_date %></td>
<td><%= ad_image.unpost_date %></td>
<td><%= ad_image.context %></td>
<td><%=link_to "#{ad_image.out_link}", ad_image.out_link %></td>
</tr>
<% end %>
</tbody>
</table>
<%if is_manager? %>
<!-- footer -->
<div class="bottomnav clearfix">
<div class="action pull-right">
<%= link_to content_tag(:i, nil, class: "icons-plus") + " " + t(:add_new), "#add-banner", :class => "btn btn-primary open-slide"%>
</div>
<div class="pagination pagination-centered">
<%= paginate @ad_images unless @ad_images.blank? %>
</div>
</div>
field db_field: 'file',
translation: 'image'
<div id="add-banner" class="nano" style="display:none">
<%= render 'new' %>
</div>
field db_field: 'post_date',
translation: 'start_date',
hide: 'phone',
sort: 'start_date'
field db_field: 'unpost_date',
translation: 'end_date',
hide: 'phone',
sort: 'end_date'
field db_field: 'unpost_date',
translation: 'end_date',
hide: 'phone',
sort: 'end_date'
field db_field: 'context',
translation: 'content',
hide: 'phone'
field db_field: 'out_link',
translation: 'link',
hide: 'phone'
footer link: 'new_admin_ad_banner_ad_image_path'
end %>
<%= render 'admin/default_index/index' %>
<% end %>
+1 -2
View File
@@ -1,6 +1,5 @@
<%= flash_messages %>
<%= form_for @ad_image, :url => create_ad_image_admin_ad_banners_path, :html => { :class => 'form' ,:multipart => true} do |f| %>
<%= form_for @ad_image, :url => admin_create_ad_image_path, :html => { :class => 'form' ,:multipart => true} do |f| %>
<%= render :partial => "form", :locals => { :f => f } %>