spree-homepager 0.40.3 → 0.40.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,18 @@
1
+ class Admin::BannersController < Admin::BaseController
2
+ resource_controller
3
+
4
+ def reorder
5
+ params[:banner].each_with_index do |id, index|
6
+ Banner.update_all(['position=?', index+1], ['id=?', id])
7
+ end
8
+ end
9
+
10
+ create.response do |wants|
11
+ wants.html { redirect_to collection_url }
12
+ end
13
+
14
+ update.response do |wants|
15
+ wants.html { redirect_to collection_url }
16
+ end
17
+
18
+ end
@@ -0,0 +1,5 @@
1
+ class Banner < ActiveRecord::Base
2
+ acts_as_list
3
+ has_attached_file :image, :styles => {:thumb => "100x100>" }
4
+ default_scope :order => "position"
5
+ end
@@ -0,0 +1,16 @@
1
+ <% f.field_container :tagline do %>
2
+ <%= f.label :tagline, t("tagline") %><br />
3
+ <%= f.text_field :tagline %>
4
+ <%= f.error_message_on :tagline%>
5
+ <% end %>
6
+
7
+ <% f.field_container :target_url do %>
8
+ <%= f.label :target_url, t("target_url") %><br />
9
+ <%= f.text_field :target_url %>
10
+ <%= f.error_message_on :target_url %>
11
+ <% end %>
12
+
13
+ <%f.field_container :image do%>
14
+ <%= f.label :image, t("image")%> <br />
15
+ <%= f.file_field :image%>
16
+ <%end%>
@@ -0,0 +1,11 @@
1
+ <%= render :partial => 'admin/shared/configuration_menu' %>
2
+
3
+ <h1><%= t("editing_banner") %></h1>
4
+ <%= render "shared/error_messages", :target => @banner %>
5
+
6
+ <% form_for(:banner, :url => object_url, :html => { :method => :put, :multipart => true }) do |f| %>
7
+ <%= render :partial => "form", :locals => { :f => f } %>
8
+ <p class="form-buttons">
9
+ <%= button t("update") %> <%= link_to t('cancel'), collection_url %>
10
+ </p>
11
+ <% end %>
@@ -0,0 +1,78 @@
1
+ <div class='toolbar'>
2
+ <ul class='actions'>
3
+ <li>
4
+ <p><%= button_link_to t("new_banner"), new_object_url, :icon => 'add' %></p>
5
+ </li>
6
+ </ul>
7
+ <br class='clear' />
8
+ </div>
9
+
10
+
11
+ <h1><%= t("listing_banners") %></h1>
12
+
13
+ <p><%=t("reorder_explain")%></p>
14
+ <table id="banners" class="index">
15
+ <thead>
16
+ <tr>
17
+ <th>
18
+ <%= t("reorder")%>
19
+ </th>
20
+ <th>
21
+ <%= t("image")%>
22
+ </th>
23
+ <th>
24
+ <%= t("tagline")%>
25
+ </th>
26
+ <th>
27
+ <%= t("target_url")%>
28
+ </th>
29
+ <th>&nbsp;</th>
30
+ </tr>
31
+ </thead>
32
+ <tbody>
33
+ <% @banners.each do |banner|%>
34
+ <tr id="<%= dom_id banner %>">
35
+ <td><span class="handle">[drag]</span></td>
36
+ <td><%= link_to(image_tag(banner.image.url(:thumb)), banner.image.url(:banner)) %></td>
37
+ <td><%=banner.tagline%></td>
38
+ <td><%=banner.target_url%></td>
39
+ <td>
40
+ <%=link_to_edit banner%> &nbsp;
41
+ <%=link_to_delete banner%>
42
+ </td>
43
+ </tr>
44
+ <% end %>
45
+ </tbody>
46
+ </table>
47
+
48
+ <script type="text/javascript" charset="utf-8">
49
+
50
+ var fixWidthHelper = function(e, ui) {
51
+ ui.children().each(function() {
52
+ $(this).width($(this).width());
53
+ });
54
+ return ui;
55
+ };
56
+
57
+ $(function() {
58
+ $("#banners tbody").sortable({
59
+ axis: 'y',
60
+ handle: '.handle',
61
+ cursor: "move",
62
+ helper: fixWidthHelper,
63
+
64
+ update: function(){
65
+ $.ajax({
66
+ type: 'post',
67
+ data: $('#banners tbody').sortable('serialize'),
68
+ dataType: 'script',
69
+ complete: function(request){
70
+ $('#banners tbody').effect('highlight');
71
+ },
72
+ url: "<%=reorder_admin_banners_url%>"
73
+ })
74
+ }
75
+ }).disableSelection();
76
+ });
77
+
78
+ </script>
@@ -0,0 +1,11 @@
1
+ <%= render :partial => 'admin/shared/configuration_menu' %>
2
+
3
+ <h1><%= t("new_banner") %></h1>
4
+
5
+ <%= render "shared/error_messages", :target => @banner %>
6
+ <% form_for(:banner, :url => collection_url, :html => { :multipart => true }) do |f| %>
7
+ <%= render :partial => "form", :locals => { :f => f } %>
8
+ <p class="form-buttons">
9
+ <%= button t("create") %> <%= link_to t('cancel'), collection_url %>
10
+ </p>
11
+ <% end %>
@@ -1 +1,2 @@
1
+ <%= render "shared/banners"%>
1
2
  <%= render "shared/products", :products => @products, :taxon => @taxon %>
@@ -0,0 +1,22 @@
1
+ <div id="banner-slideshow">
2
+ <% Banner.all.each do |banner| -%>
3
+ <div class="banner">
4
+ <div class="tagline"><%=banner.tagline%></div>
5
+ <%if banner.target_url.empty?%>
6
+ <%=image_tag( banner.image.url(:original)) %>
7
+ <%else%>
8
+ <%= link_to(image_tag(banner.image.url(:original)), banner.target_url) %>
9
+ <%end%>
10
+ </div>
11
+ <%end -%>
12
+ </div>
13
+
14
+ <script type="text/javascript" charset="utf-8">
15
+ $(document).ready(function() {
16
+ $('#banner-slideshow').cycle({
17
+ fx: 'fade', // choose your transition type, ex: fade, scrollUp, shuffle, etc...
18
+ speed: 1000,
19
+ timeout: 1000
20
+ });
21
+ });
22
+ </script>
@@ -0,0 +1,2 @@
1
+ <%= javascript_include_tag "jquery.cycle.all.js", :cache => 'cycle' %>
2
+ <%= stylesheet_link_tag "banners.css"%>
@@ -1,3 +1,7 @@
1
1
  class HomepagerHooks < Spree::ThemeSupport::HookListener
2
2
  insert_after :admin_product_form_right, "shared/ext_homepager_admin_product_fields.html"
3
+ insert_after :admin_tabs do
4
+ %(<%= tab(:banners) %>)
5
+ end
6
+ insert_after :inside_head, "shared/banners_js_css"
3
7
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spree-homepager
3
3
  version: !ruby/object:Gem::Version
4
- hash: 185
4
+ hash: 183
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 40
9
- - 3
10
- version: 0.40.3
9
+ - 4
10
+ version: 0.40.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Peter Berkenbosch
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-02-19 00:00:00 +01:00
18
+ date: 2011-02-22 00:00:00 +01:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -49,9 +49,17 @@ files:
49
49
  - lib/homepager_hooks.rb
50
50
  - lib/tasks/homepager.rake
51
51
  - lib/tasks/install.rake
52
+ - app/controllers/admin/banners_controller.rb
52
53
  - app/controllers/home_controller.rb
54
+ - app/models/banner.rb
53
55
  - app/models/product_decorator.rb
56
+ - app/views/admin/banners/_form.html.erb
57
+ - app/views/admin/banners/edit.html.erb
58
+ - app/views/admin/banners/index.html.erb
59
+ - app/views/admin/banners/new.html.erb
54
60
  - app/views/home/index.html.erb
61
+ - app/views/shared/_banners.html.erb
62
+ - app/views/shared/_banners_js_css.html.erb
55
63
  - app/views/shared/_ext_homepager_admin_product_fields.html.erb
56
64
  has_rdoc: true
57
65
  homepage: http://www.pero-ict.nl