- <%= image_tag "slideshow_preview_A.png", :width=>220 %>
- <%= image_tag "slideshow_preview_B.png", :width=>220 %>
+ <%= render :partial => "form", :locals => { :f => f } %>
+
-
<%= t("ad_banner.effect") %>
-
<%= t(:cancel) %>
- <%= f.submit t(:update_), class: 'btn btn-primary btn-small' %>
-<% end %>
-
\ No newline at end of file
+<% end %>
\ No newline at end of file
diff --git a/app/views/admin/ad_banners/_form.html.erb b/app/views/admin/ad_banners/_form.html.erb
new file mode 100644
index 000000000..40062f2ba
--- /dev/null
+++ b/app/views/admin/ad_banners/_form.html.erb
@@ -0,0 +1,45 @@
+<%= flash_messages %>
+<%= f.error_messages %>
+
+<%= f.label :title, t('ad_banner.banner_name') %>
+<%= f.text_field :title, class: 'input-large', placeholder: t('ad_banner.banner_name') %>
+
<%= t('ad_banner.name_only_english') %>
+
+<%= f.label :timeout, t('ad_banner.transition_interval') %>
+<%= f.number_field :timeout, in: 0..60, step: 1, class: 'input-mini', onkeypress: "if (event.keyCode < 48 || event.keyCode > 57) event.returnValue = false;" %>
+
<%= t('ad_banner.number_seconds') %>
+
+<%= f.label :speed, t('ad_banner.transition_speed') %>
+<%= f.number_field :speed, in: 0..1000, step: 100, class: 'input-mini', onkeypress: "if (event.keyCode < 48 || event.keyCode > 57) event.returnValue = false;" %>
+
<%= t('ad_banner.number_milliseconds') %>
+
+<%= f.label :size, t('ad_banner.size') %>
+
W:
+<%= f.number_field :width, in: 10..1000, step: 10, class: 'input-mini', onkeypress: "if (event.keyCode < 48 || event.keyCode > 57) event.returnValue = false;" %>
+
H:
+<%= f.number_field :height, in: 10..1000, step: 10, class: 'input-mini', onkeypress: "if (event.keyCode < 48 || event.keyCode > 57) event.returnValue = false;" %>
+
<%= t('ad_banner.number_milliseconds') %>
+
+<%= f.label :ad_fx, t('ad_banner.effect') %>
+<%= f.select :ad_fx, AdBanner::FX_TYPES, {}, {class: 'ad_banner_ad_fx'} %>
+
+ <%= image_tag "slideshow_preview_A.png" %>
+ <%= image_tag "slideshow_preview_B.png" %>
+
+
<%= t('ad_banner.effect') %>
+
+
+
+
+
\ No newline at end of file
diff --git a/app/views/admin/ad_banners/_index.html.erb b/app/views/admin/ad_banners/_index.html.erb
index 2a75ee1e8..81268aedd 100644
--- a/app/views/admin/ad_banners/_index.html.erb
+++ b/app/views/admin/ad_banners/_index.html.erb
@@ -1,39 +1,63 @@
-<%= javascript_include_tag "lib/jquery.cycle.all.js"%>
+<% set_default_index do
+ objects @ad_banners
+ quick_edit_link type: 'edit',
+ link: 'edit_admin_ad_banner_path',
+ class: 'open-slide',
+ data: {title: t('ad_banner.edit_banner')}
+ quick_edit_link type: 'detail'
+ quick_edit_link type: 'delete',
+ link: 'admin_ad_banner_path'
+ # can have: title, warning, cancel and submit values
+ field db_field: 'title',
+ translation: 'ad_banner.banner_name',
+ sort: 'title',
+ quick_edit: true,
+ header_class: 'span4',
+ sort: 'title'
+ field db_field: 'ad_fx',
+ translation: 'ad_banner.effect',
+ hide: 'phone',
+ sort: 'effect'
+ field db_field: 'timeout',
+ translation: 'ad_banner.transition_interval',
+ hide: 'phone',
+ sort: 'timeout'
+ field db_field: 'speed',
+ translation: 'ad_banner.transition_speed',
+ hide: 'phone',
+ sort: 'speed'
+ field db_field: 'size',
+ translation: 'ad_banner.size',
+ hide: 'phone',
+ sort: 'size'
+ field type: 'standalone',
+ translation: 'preview',
+ display_option: "link_to(t(:preview), '#', data: {w: object.width, h: object.height, fx: object.ad_fx, time: object.timeout_in_min, speed: object.speed}, class: 'btn btn-success open-modal')",
+ need_value: true,
+ hide: 'phone'
+ footer link: 'new_admin_ad_banner_path',
+ link_class: 'btn btn-primary open-slide',
+ link_data: {title: t('ad_banner.new_banner')}
+end %>
-
-
-
- <%= t('ad_banner.title') %>
- <%= t('ad_banner.transition_msec') %>
- <%= t('ad_banner.ad_fx') %>
-
-
-
- <% @ad_banners.each do |ad_banner| %>
-
- <%= ad_banner.title %>
-
-
- <% if is_admin?%>
- <%= link_to t(:edit), edit_admin_ad_banner_path(ad_banner), :class => "open-slide" %>
- <%= link_to 'Destroy', admin_ad_banner_path(ad_banner), method: :delete , :confirm => t(:sure?) %>
-
- <% end %>
-
-
-
- <%= ad_banner.transition_msec %>
- <%= ad_banner.ad_fx%>
-
- <% end %>
-
-
-<%if is_manager? %>
-
-
-
- <%= link_to content_tag(:i, nil, class: "icons-plus") + " " + t(:add_new), new_admin_ad_banner_path, :class => "btn btn-primary open-slide"%>
-
-
+<%= render 'admin/default_index/index' %>
+<% content_for :page_specific_javascript do %>
+ <%= javascript_include_tag "lib/jquery.cycle.all.js" %>
+ <%= javascript_include_tag "lib/ad_banner/banner_preview" %>
<% end %>
+
+
+
+
+
+ <%= image_tag "slideshow_preview_A.png" %>
+ <%= image_tag "slideshow_preview_B.png" %>
+
+
+
+
diff --git a/app/views/admin/ad_banners/_modal_ad_banner_form.html.erb b/app/views/admin/ad_banners/_modal_ad_banner_form.html.erb
deleted file mode 100644
index dc35a7044..000000000
--- a/app/views/admin/ad_banners/_modal_ad_banner_form.html.erb
+++ /dev/null
@@ -1,46 +0,0 @@
-
-
- <%= form_for(:ad_banner,:remote => true, :url => admin_ad_banners_path) do |f| %>
-
-
-
-
-
- <%= f.label :title, t(:title),:class => "control-label" %>
-
- <%= f.text_field :title %>
-
-
-
-
- <%= f.label :transition_sec, t('ad.transition_sec'),:class => "control-label" %>
-
- <%= f.text_field :transition_sec %> <%= t("ad.trans_unit_sec") %>
-
-
-
-
- <%= f.label :best_size, t('ad.best_size'),:class => "control-label" %>
-
- <%= f.text_field :best_size %> <%= t('ad.best_size_example') %>
-
-
-
-
- <%= f.label :ad_fx, t('ad.ab_fx') %>
-
- <%= f.select :ad_fx ,AdBanner::FX_TYPES %>
-
-
-
-
- <% end %>
-
-
diff --git a/app/views/admin/ad_banners/_modal_preview.html.erb b/app/views/admin/ad_banners/_modal_preview.html.erb
deleted file mode 100644
index adf84adb8..000000000
--- a/app/views/admin/ad_banners/_modal_preview.html.erb
+++ /dev/null
@@ -1,36 +0,0 @@
-<% if ad_banner -%>
-
-
-
-
-
- <% preview_block_ad_images_helper(ad_banner).each do |ad_image| -%>
- <%= image_tag 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 || ad_banner.context || " ")) %>
- <% end -%>
-
-
-
-
-
-
-
-
-
-
-
-<% end -%>
diff --git a/app/views/admin/ad_banners/_new.html.erb b/app/views/admin/ad_banners/_new.html.erb
index 95b114511..945c2a206 100644
--- a/app/views/admin/ad_banners/_new.html.erb
+++ b/app/views/admin/ad_banners/_new.html.erb
@@ -1,31 +1,9 @@
-<%= form_for(:ad_banner, :url => admin_ad_banners_path) do |f| %>
-
- <%= t("ad_banner.banner") %>
- <%= t("ad_banner.banner_name") %>
- <%= f.text_field :title, :class=>"input-large", :placeholder=>"Banner Name" %>
- <%= t("ad_banner.banner_name_note") %>
- <%= t("ad_banner.ste") %>
- <%= f.text_field :transition_sec, :class => 'input-large', :placeholder => 'Time' %>
- <%= t("ad_banner.ste_note") %>
- <%= t("ad_banner.best_size") %>
- <%= f.text_field :best_size, :class=>"input-large", :placeholder=>"Banner Size" %>
- <%= t("ad_banner.best_size") %> EX:120x30
- <%= t("ad_banner.effect") %>
- <%= f.select :ad_fx ,AdBanner::FX_TYPES %>
-
- <%= image_tag "slideshow_preview_A.png", :width=>220 %>
- <%= image_tag "slideshow_preview_B.png", :width=>220 %>
-
- <%= t("ad_banner.effect") %>
- <%= t(:cancel) %>
- <%= f.submit t(:create_), class: 'btn btn-primary btn-small' %>
-
-<% end %>
-
\ No newline at end of file
+<%= form_for @ad_banner, url: admin_ad_banners_path, remote: true do |f| %>
+
+ <%= render :partial => "form", :locals => { :f => f } %>
+
+
+<% end %>
\ No newline at end of file
diff --git a/app/views/admin/ad_banners/_new_add_banner_file.html.erb b/app/views/admin/ad_banners/_new_add_banner_file.html.erb
deleted file mode 100644
index 457b57f1a..000000000
--- a/app/views/admin/ad_banners/_new_add_banner_file.html.erb
+++ /dev/null
@@ -1,7 +0,0 @@
-<%= f.fields_for field_name, new_add_banner_file do |f| %>
-
- <%= f.file_field :file %>
- <%#= render :partial => "ad_image_form", :locals => { :f => f } %>
- <%= button_tag '+', :class => "multi_files"%>
-
-<% end %>
\ No newline at end of file
diff --git a/app/views/admin/ad_banners/_preview_block.html.erb b/app/views/admin/ad_banners/_preview_block.html.erb
deleted file mode 100644
index cbaad8e8b..000000000
--- a/app/views/admin/ad_banners/_preview_block.html.erb
+++ /dev/null
@@ -1,29 +0,0 @@
-<% if ad_banner -%>
-<%= link_to t(:preview),"#slideshow-#{ad_banner.title.dehumanize}",:class=>"btn btn-primary btn-large",:data=>{:toggle=>'modal'} %>
-
-
-
-
-
- <% preview_block_ad_images_helper(ad_banner).each do |ad_image| -%>
- <%= image_tag 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 || ad_banner.context || ' ')) %>
- <% end -%>
-
-
-
-
-
-<% end -%>
-
-
-
diff --git a/app/views/admin/ad_banners/create_error_msg.js.erb b/app/views/admin/ad_banners/create_error_msg.js.erb
deleted file mode 100644
index dbd013dfd..000000000
--- a/app/views/admin/ad_banners/create_error_msg.js.erb
+++ /dev/null
@@ -1 +0,0 @@
-$("#ad_banner-modal-info").append("<%= @ad_banner.errors.full_messages.join(',')%>");
\ No newline at end of file
diff --git a/app/views/admin/ad_banners/index.html.erb b/app/views/admin/ad_banners/index.html.erb
index cf8c645e7..f87f7fac9 100644
--- a/app/views/admin/ad_banners/index.html.erb
+++ b/app/views/admin/ad_banners/index.html.erb
@@ -1,9 +1,3 @@
-<% content_for :right_nav do %>
-
-
-
-<% end %>
-
-
-
-
+
-
-
- <%= f.hidden_field :id, :value => @ad_image.id %>
-
- <%= f.submit t("submit"),:class=>"btn btn-primary" %>
- <%= f.submit t("cancel"),:class=>"btn ",:type => 'reset' %>
-
-
-
-