spree_banner 1.1.5 → 1.1.6
Sign up to get free protection for your applications and to get access to all the features.
data/README.md
CHANGED
@@ -2,22 +2,19 @@ module Spree
|
|
2
2
|
module BannersHelper
|
3
3
|
|
4
4
|
def insert_banner(params={})
|
5
|
-
# max items show for list
|
6
5
|
params[:max] ||= 1
|
7
|
-
# category items show
|
8
6
|
params[:category] ||= "home"
|
9
|
-
# class items show
|
10
7
|
params[:class] ||= "banner"
|
11
|
-
|
8
|
+
params[:style] ||= "small"
|
12
9
|
params[:list] ||= false
|
13
10
|
banner = Spree::Banner.enable(params[:category]).limit(params[:max])
|
14
11
|
if !banner.blank?
|
15
12
|
banner = banner.sort_by { |ban| ban.position }
|
16
13
|
|
17
14
|
if (params[:list])
|
18
|
-
content_tag(:ul, banner.map{|ban| content_tag(:li, link_to(image_tag(ban.attachment.url(:
|
15
|
+
content_tag(:ul, banner.map{|ban| content_tag(:li, link_to(image_tag(ban.attachment.url(params[:style].to_sym)), (ban.url.blank? ? "javascript: void(0)" : ban.url)), :class => params[:class])}.join().html_safe )
|
19
16
|
else
|
20
|
-
banner.map{|ban| content_tag(:div, link_to(image_tag(ban.attachment.url(:
|
17
|
+
banner.map{|ban| content_tag(:div, link_to(image_tag(ban.attachment.url(params[:style].to_sym)), (ban.url.blank? ? "javascript: void(0)" : ban.url)), :class => params[:class])}.join().html_safe
|
21
18
|
end
|
22
19
|
|
23
20
|
end
|
data/app/models/spree/banner.rb
CHANGED
@@ -3,18 +3,10 @@ module Spree
|
|
3
3
|
attr_accessible :title, :url, :category, :position, :enabled, :attachment
|
4
4
|
|
5
5
|
has_attached_file :attachment,
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
:small => "120x120#",
|
11
|
-
:custom => "#{a.instance.attachment_width}x#{a.instance.attachment_height}#"
|
12
|
-
}},
|
13
|
-
:convert_options => {
|
14
|
-
:mini => "-gravity center",
|
15
|
-
:small => "-gravity center",
|
16
|
-
:custom => "-gravity center"
|
17
|
-
}
|
6
|
+
:styles => { :mini => '80x80#', :small => '120x120#' },
|
7
|
+
:url => "/spree/banners/:id/:style_:basename.:extension",
|
8
|
+
:path => ":rails_root/public/spree/banners/:id/:style_:basename.:extension",
|
9
|
+
:convert_options => { :all => '-strip' }
|
18
10
|
|
19
11
|
after_post_process :find_dimensions
|
20
12
|
|
@@ -12,31 +12,13 @@
|
|
12
12
|
<%= f.text_field :url, :class => 'fullwidth title' %>
|
13
13
|
<%= f.error_message_on :url %>
|
14
14
|
<% end %>
|
15
|
-
|
15
|
+
</div>
|
16
|
+
<div class="right" data-hook="admin_banner_form_right">
|
16
17
|
<%= f.field_container :attachment do %>
|
17
18
|
<%= f.label :attachment, t(:attachment) %><br />
|
18
19
|
<%= f.file_field :attachment %>
|
19
20
|
<%= f.error_message_on :attachment %>
|
20
21
|
<% end %>
|
21
|
-
</div>
|
22
|
-
<div class="right" data-hook="admin_banner_form_right">
|
23
|
-
<%= f.field_container :attachment_width do %>
|
24
|
-
<%= f.label :attachment_width, t(:attachment_width) %> <span class="required">*</span><br />
|
25
|
-
<%= f.text_field :attachment_width, :class => 'fullwidth title' %>
|
26
|
-
<%= f.error_message_on :attachment_width %>
|
27
|
-
<% end %>
|
28
|
-
|
29
|
-
<%= f.field_container :attachment_height do %>
|
30
|
-
<%= f.label :attachment_height, t(:attachment_height) %> <span class="required">*</span><br />
|
31
|
-
<%= f.text_field :attachment_height, :class => 'fullwidth title' %>
|
32
|
-
<%= f.error_message_on :attachment_height %>
|
33
|
-
<% end %>
|
34
|
-
|
35
|
-
<%= f.field_container :position do %>
|
36
|
-
<%= f.label :position, t(:position) %><br />
|
37
|
-
<%= f.text_field :position, :class => 'fullwidth title' %>
|
38
|
-
<%= f.error_message_on :position %>
|
39
|
-
<% end %>
|
40
22
|
|
41
23
|
<%= f.field_container :enabled do %>
|
42
24
|
<%= f.label :enabled, t(:enabled) %><br />
|
@@ -1,29 +1,36 @@
|
|
1
1
|
<div class="toolbar" data-hook="toolbar">
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
2
|
+
<ul class="actions">
|
3
|
+
<li id="new_banner_link">
|
4
|
+
<%= button_link_to t(:new_banner), new_object_url, {:remote => true, :icon => 'add', :id => 'admin_new_banner'} %>
|
5
|
+
</li>
|
6
|
+
</ul>
|
7
|
+
<br class="clear" />
|
8
8
|
</div>
|
9
9
|
|
10
10
|
<h1><%= t(:listing_banners) %></h1>
|
11
11
|
|
12
12
|
<div id="new_banner" data-hook></div>
|
13
13
|
|
14
|
-
<table class="index"
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
14
|
+
<table class="index sortable" data-hook="listing_banners" data-sortable-link="<%= update_positions_admin_banners_url() %>">
|
15
|
+
<tr data-hook="admin_banners_index_headers">
|
16
|
+
<th><%= t(:thumbnail) %></th>
|
17
|
+
<th><%= t(:category) %></th>
|
18
|
+
<th><%= t(:enable) %></th>
|
19
|
+
<th data-hook="admin_banners_index_header_actions"></th>
|
20
|
+
</tr>
|
21
|
+
<% @banners.each do |banner| %>
|
22
|
+
<tr id="<%= spree_dom_id banner %>" data-hook="admin_banners_index_rows">
|
23
|
+
<td>
|
24
|
+
<span class="handle"></span>
|
25
|
+
<%= link_to image_tag(banner.attachment.url(:mini)), banner.attachment.url(:small) %>
|
26
|
+
</td>
|
27
|
+
<td><%= banner.category %></td>
|
28
|
+
<td><%= icon('tick') if banner.enabled %></td>
|
29
|
+
<td class="actions" data-hook="admin_banners_index_row_actions">
|
30
|
+
<%= link_to_edit banner, :class => 'edit' %>
|
31
|
+
|
32
|
+
<%= link_to_delete banner %>
|
33
|
+
</td>
|
34
|
+
</tr>
|
35
|
+
<% end %>
|
29
36
|
</table>
|
@@ -15,31 +15,13 @@
|
|
15
15
|
<%= f.text_field :url, :class => 'fullwidth title' %>
|
16
16
|
<%= f.error_message_on :url %>
|
17
17
|
<% end %>
|
18
|
-
|
18
|
+
</div>
|
19
|
+
<div class="right">
|
19
20
|
<%= f.field_container :attachment do %>
|
20
21
|
<%= f.label :attachment, t(:attachment) %><br />
|
21
22
|
<%= f.file_field :attachment %>
|
22
23
|
<%= f.error_message_on :attachment %>
|
23
24
|
<% end %>
|
24
|
-
</div>
|
25
|
-
<div class="right">
|
26
|
-
<%= f.field_container :attachment_width do %>
|
27
|
-
<%= f.label :attachment_width, t(:attachment_width) %> <span class="required">*</span><br />
|
28
|
-
<%= f.text_field :attachment_width, :class => 'fullwidth title' %>
|
29
|
-
<%= f.error_message_on :attachment_width %>
|
30
|
-
<% end %>
|
31
|
-
|
32
|
-
<%= f.field_container :attachment_height do %>
|
33
|
-
<%= f.label :attachment_height, t(:attachment_height) %> <span class="required">*</span><br />
|
34
|
-
<%= f.text_field :attachment_height, :class => 'fullwidth title' %>
|
35
|
-
<%= f.error_message_on :attachment_height %>
|
36
|
-
<% end %>
|
37
|
-
|
38
|
-
<%= f.field_container :position do %>
|
39
|
-
<%= f.label :position, t(:position) %><br />
|
40
|
-
<%= f.text_field :position, :class => 'fullwidth title' %>
|
41
|
-
<%= f.error_message_on :position %>
|
42
|
-
<% end %>
|
43
25
|
|
44
26
|
<%= f.field_container :enabled do %>
|
45
27
|
<%= f.label :enabled, t(:enabled) %><br />
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spree_banner
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-03-
|
12
|
+
date: 2013-03-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: spree_core
|