aboutsummaryrefslogtreecommitdiffstats
path: root/app/views/refinery/banners
diff options
context:
space:
mode:
authorJames Thompson <james.b.thompson@gmail.com>2012-03-14 11:40:16 +0200
committerJames Thompson <james.b.thompson@gmail.com>2012-03-14 11:40:16 +0200
commit56d7747f54e86993415b76c92e101608e5ea44e2 (patch)
tree025b7b37f50c4c291e7e676286e7767c40adb1f9 /app/views/refinery/banners
downloadrefinerycms-pc_banners-56d7747f54e86993415b76c92e101608e5ea44e2.tar.gz
refinerycms-pc_banners-56d7747f54e86993415b76c92e101608e5ea44e2.tar.bz2
refinerycms-pc_banners-56d7747f54e86993415b76c92e101608e5ea44e2.zip
initial commit
Diffstat (limited to 'app/views/refinery/banners')
-rw-r--r--app/views/refinery/banners/admin/banners/_actions.html.erb25
-rw-r--r--app/views/refinery/banners/admin/banners/_banner.html.erb20
-rw-r--r--app/views/refinery/banners/admin/banners/_banners.html.erb2
-rw-r--r--app/views/refinery/banners/admin/banners/_form.html.erb74
-rw-r--r--app/views/refinery/banners/admin/banners/_records.html.erb18
-rw-r--r--app/views/refinery/banners/admin/banners/_sortable_list.html.erb5
-rw-r--r--app/views/refinery/banners/admin/banners/edit.html.erb1
-rw-r--r--app/views/refinery/banners/admin/banners/index.html.erb7
-rw-r--r--app/views/refinery/banners/admin/banners/new.html.erb1
-rw-r--r--app/views/refinery/banners/shared/_banner_image.html.erb1
-rw-r--r--app/views/refinery/banners/shared/_banners.html.erb9
11 files changed, 163 insertions, 0 deletions
diff --git a/app/views/refinery/banners/admin/banners/_actions.html.erb b/app/views/refinery/banners/admin/banners/_actions.html.erb
new file mode 100644
index 0000000..f2a1681
--- /dev/null
+++ b/app/views/refinery/banners/admin/banners/_actions.html.erb
@@ -0,0 +1,25 @@
+<ul>
+ <% if ::Refinery::Banners::Admin::BannersController.searchable? %>
+ <li>
+ <%= render '/refinery/admin/search', :url => refinery.banners_admin_banners_path %>
+ </li>
+ <% end %>
+ <li>
+ <%= link_to t('.create_new'), refinery.new_banners_admin_banner_path,
+ :class => "add_icon" %>
+ </li>
+<% if !searching? && ::Refinery::Banners::Admin::BannersController.sortable? && ::Refinery::Banners::Banner.any? %>
+ <li>
+ <%= link_to t('.reorder', :what => "Banners"),
+ refinery.banners_admin_banners_path,
+ :id => "reorder_action",
+ :class => "reorder_icon" %>
+
+ <%= link_to t('.reorder_done', :what => "Banners"),
+ refinery.banners_admin_banners_path,
+ :id => "reorder_action_done",
+ :style => "display: none;",
+ :class => "reorder_icon" %>
+ </li>
+<% end %>
+</ul>
diff --git a/app/views/refinery/banners/admin/banners/_banner.html.erb b/app/views/refinery/banners/admin/banners/_banner.html.erb
new file mode 100644
index 0000000..9a362a2
--- /dev/null
+++ b/app/views/refinery/banners/admin/banners/_banner.html.erb
@@ -0,0 +1,20 @@
+<li class='clearfix record <%= cycle("on", "on-hover") %>' id="<%= dom_id(banner) -%>">
+ <span class='title'>
+ <%= banner.name %>
+
+ </span>
+ <span class='actions'>
+
+ <%= link_to refinery_icon_tag("application_go.png"), refinery.banners_banner_path(banner),
+ :title => t('.view_live_html'),
+ :target => "_blank" %>
+
+ <%= link_to refinery_icon_tag("application_edit.png"), refinery.edit_banners_admin_banner_path(banner),
+ :title => t('.edit') %>
+ <%= link_to refinery_icon_tag("delete.png"), refinery.banners_admin_banner_path(banner),
+ :class => "cancel confirm-delete",
+ :title => t('.delete'),
+ :confirm => t('message', :scope => 'refinery.admin.delete', :title => banner.name),
+ :method => :delete %>
+ </span>
+</li>
diff --git a/app/views/refinery/banners/admin/banners/_banners.html.erb b/app/views/refinery/banners/admin/banners/_banners.html.erb
new file mode 100644
index 0000000..0027493
--- /dev/null
+++ b/app/views/refinery/banners/admin/banners/_banners.html.erb
@@ -0,0 +1,2 @@
+<%= will_paginate @banners if Refinery::Banners::Admin::BannersController.pageable? %>
+<%= render 'sortable_list' %>
diff --git a/app/views/refinery/banners/admin/banners/_form.html.erb b/app/views/refinery/banners/admin/banners/_form.html.erb
new file mode 100644
index 0000000..2cd827f
--- /dev/null
+++ b/app/views/refinery/banners/admin/banners/_form.html.erb
@@ -0,0 +1,74 @@
+<%= form_for [refinery, :banners_admin, @banner] do |f| -%>
+ <%= render '/refinery/admin/error_messages',
+ :object => @banner,
+ :include_object_name => true %>
+
+ <%= hidden_field_tag 'banner[page_ids][]' %>
+
+ <div class='field'>
+ <%= f.label :name -%>
+ <%= f.text_field :name, :class => 'larger widest' -%>
+
+ </div>
+
+ <div class='field'>
+ <%= f.label :title -%>
+ <%= f.text_field :title -%>
+
+ </div>
+
+ <div class='field'>
+ <%= f.label :description -%>
+ <%= f.text_field :description -%>
+
+ </div>
+
+ <div class='field'>
+ <%= f.label :image -%>
+ <%= render '/refinery/admin/image_picker',
+ :f => f,
+ :field => :image_id,
+ :image => @banner.image,
+ :toggle_image_display => false %>
+
+ </div>
+
+ <div class='field'>
+ <%= f.label :url -%>
+ <%= f.text_field :url -%>
+
+ </div>
+
+ <div class='field'>
+ <%= f.label :is_active -%>
+ <%= f.check_box :is_active, :checked => @banner[:is_active] -%>
+
+ </div>
+
+ <div class='field'>
+ <%= f.label :start_date -%>
+ <%= f.date_select :start_date -%>
+
+ </div>
+
+ <div class='field'>
+ <%= f.label :expiry_date -%>
+ <%= f.date_select :expiry_date -%>
+
+ </div>
+
+ <div class="field">
+ <%= f.label :pages %>
+ <% Refinery::Page.all.each do |page| %>
+ <div>
+ <%= check_box_tag "banner[page_ids][]", page.id, @banner.pages.include?(page) %>
+ <%= page.title %>
+ </div>
+ <% end %>
+ </div>
+
+ <%= render '/refinery/admin/form_actions', :f => f,
+ :continue_editing => false,
+ :delete_title => t('delete', :scope => 'refinery.banners.admin.banners.banner'),
+ :delete_confirmation => t('message', :scope => 'refinery.admin.delete', :title => @banner.name) %>
+<% end -%>
diff --git a/app/views/refinery/banners/admin/banners/_records.html.erb b/app/views/refinery/banners/admin/banners/_records.html.erb
new file mode 100644
index 0000000..109fb04
--- /dev/null
+++ b/app/views/refinery/banners/admin/banners/_records.html.erb
@@ -0,0 +1,18 @@
+<% if searching? %>
+ <h2><%= t('results_for', :scope => 'refinery.admin.search', :query => params[:search]) %></h2>
+<% end %>
+<div class='pagination_container'>
+ <% if @banners.any? %>
+ <%= render 'banners' %>
+ <% else %>
+ <p>
+ <% unless searching? %>
+ <strong>
+ <%= t('.no_items_yet') %>
+ </strong>
+ <% else %>
+ <%= t('no_results', :scope => 'refinery.admin.search') %>
+ <% end %>
+ </p>
+ <% end %>
+</div>
diff --git a/app/views/refinery/banners/admin/banners/_sortable_list.html.erb b/app/views/refinery/banners/admin/banners/_sortable_list.html.erb
new file mode 100644
index 0000000..0a0aac1
--- /dev/null
+++ b/app/views/refinery/banners/admin/banners/_sortable_list.html.erb
@@ -0,0 +1,5 @@
+<ul id='sortable_list'>
+ <%= render :partial => 'banner', :collection => @banners %>
+</ul>
+<%= render '/refinery/admin/sortable_list',
+ :continue_reordering => (local_assigns.keys.include?(:continue_reordering)) ? continue_reordering : true %>
diff --git a/app/views/refinery/banners/admin/banners/edit.html.erb b/app/views/refinery/banners/admin/banners/edit.html.erb
new file mode 100644
index 0000000..2d34363
--- /dev/null
+++ b/app/views/refinery/banners/admin/banners/edit.html.erb
@@ -0,0 +1 @@
+<%= render 'form' %>
diff --git a/app/views/refinery/banners/admin/banners/index.html.erb b/app/views/refinery/banners/admin/banners/index.html.erb
new file mode 100644
index 0000000..5413e3c
--- /dev/null
+++ b/app/views/refinery/banners/admin/banners/index.html.erb
@@ -0,0 +1,7 @@
+<section id='records'>
+ <%= render 'records' %>
+</section>
+<aside id='actions'>
+ <%= render 'actions' %>
+</aside>
+<%= render '/refinery/admin/make_sortable', :tree => false if !searching? and ::Refinery::Banners::Admin::BannersController.sortable? and ::Refinery::Banners::Banner.count > 1 %>
diff --git a/app/views/refinery/banners/admin/banners/new.html.erb b/app/views/refinery/banners/admin/banners/new.html.erb
new file mode 100644
index 0000000..2d34363
--- /dev/null
+++ b/app/views/refinery/banners/admin/banners/new.html.erb
@@ -0,0 +1 @@
+<%= render 'form' %>
diff --git a/app/views/refinery/banners/shared/_banner_image.html.erb b/app/views/refinery/banners/shared/_banner_image.html.erb
new file mode 100644
index 0000000..74eebb4
--- /dev/null
+++ b/app/views/refinery/banners/shared/_banner_image.html.erb
@@ -0,0 +1 @@
+<%= image_fu(banner_image.image, '960x310#c') %> \ No newline at end of file
diff --git a/app/views/refinery/banners/shared/_banners.html.erb b/app/views/refinery/banners/shared/_banners.html.erb
new file mode 100644
index 0000000..d436cc7
--- /dev/null
+++ b/app/views/refinery/banners/shared/_banners.html.erb
@@ -0,0 +1,9 @@
+<div id="slider">
+ <% if @page.present? and @page.banners.published.present? %>
+ <%= render :partial => 'refinery/banners/shared/banner_image', :collection => @page.banners.published %>
+ <% elsif @banners.present? then %>
+ <%= render :partial => 'refinery/banners/shared/banner_image', :collection => @banners %>
+ <% else %>
+ <!--todo: insert static images here-->
+ <% end %>
+</div> \ No newline at end of file