synergy_default_theme 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (85) hide show
  1. data/LICENSE +23 -0
  2. data/README.md +4 -0
  3. data/Rakefile +31 -0
  4. data/app/controllers/home_controller.rb +10 -0
  5. data/app/controllers/products_controller_decorator.rb +3 -0
  6. data/app/helpers/base_helper_decorator.rb +14 -0
  7. data/app/helpers/orders_helper_decorator.rb +5 -0
  8. data/app/helpers/product_helper_decorator.rb +22 -0
  9. data/app/helpers/taxons_helper_decorator.rb +7 -0
  10. data/app/models/page_sweeper.rb +20 -0
  11. data/app/models/tracker_sweeper.rb +20 -0
  12. data/app/views/admin/reviews/index.html.erb +42 -0
  13. data/app/views/admin/taxonomies/_list.html.erb +19 -0
  14. data/app/views/admin/taxonomies/_show_on_homepage_field.html.erb +4 -0
  15. data/app/views/checkout/_delivery.html.erb +25 -0
  16. data/app/views/checkout/_payment.html.erb +34 -0
  17. data/app/views/gateway/robokassa/show.html.erb +22 -0
  18. data/app/views/home/index.html.erb +11 -0
  19. data/app/views/layouts/spree_application.html.erb +110 -0
  20. data/app/views/orders/_advanced_cart.html.erb +45 -0
  21. data/app/views/products/_cart_form.html.erb +59 -0
  22. data/app/views/products/_eot_includes.html.erb +27 -0
  23. data/app/views/products/_image.html.erb +8 -0
  24. data/app/views/products/_properties.html.erb +12 -0
  25. data/app/views/products/_thumbnails.html.erb +36 -0
  26. data/app/views/products/show.html.erb +146 -0
  27. data/app/views/shared/_like_buttons.html.erb +27 -0
  28. data/app/views/shared/_login_bar.html.erb +26 -0
  29. data/app/views/shared/_order_details.html.erb +50 -0
  30. data/app/views/shared/_products.html.erb +42 -0
  31. data/app/views/shared/_rating.html.erb +8 -0
  32. data/app/views/shared/_reviews.html.erb +40 -0
  33. data/app/views/shared/_search.html.erb +3 -0
  34. data/app/views/shared/_synergy_compare_products_js.html.erb +51 -0
  35. data/app/views/shared/_taxonomies.html.erb +16 -0
  36. data/config/initializers/advanced_cart.rb +3 -0
  37. data/config/initializers/constants.rb +3 -0
  38. data/config/initializers/like_buttons.rb +1 -0
  39. data/config/locales/ru.yml +22 -0
  40. data/config/routes.rb +4 -0
  41. data/db/migrate/20110330125354_add_show_on_main_page_flag_to_taxonomies.rb +9 -0
  42. data/db/migrate/20110404120925_change_column_title_in_reviews.rb +13 -0
  43. data/lib/spree_compare_products_hooks.rb +15 -0
  44. data/lib/spree_reviews_hook.rb +24 -0
  45. data/lib/synergy_default_theme.rb +39 -0
  46. data/lib/synergy_default_theme_hooks.rb +5 -0
  47. data/lib/tasks/install.rake +25 -0
  48. data/lib/tasks/synergy_default_theme.rake +1 -0
  49. data/public/images/bubblepopup_bg.png +0 -0
  50. data/public/images/bubblepopup_bottom.png +0 -0
  51. data/public/images/bubblepopup_top.png +0 -0
  52. data/public/images/button_long.png +0 -0
  53. data/public/images/button_short.png +0 -0
  54. data/public/images/cart.png +0 -0
  55. data/public/images/cart_th_bg.png +0 -0
  56. data/public/images/checkout.png +0 -0
  57. data/public/images/close_button.png +0 -0
  58. data/public/images/facebook_32.png +0 -0
  59. data/public/images/footer_panel.png +0 -0
  60. data/public/images/google_32.png +0 -0
  61. data/public/images/header_panel.png +0 -0
  62. data/public/images/libra.png +0 -0
  63. data/public/images/login_bar_bg.png +0 -0
  64. data/public/images/logo.png +0 -0
  65. data/public/images/noimage/product.jpg +0 -0
  66. data/public/images/noimage/small.jpg +0 -0
  67. data/public/images/red_button_bg.png +0 -0
  68. data/public/images/remove_comparable.png +0 -0
  69. data/public/images/search_button.png +0 -0
  70. data/public/images/search_textinput.png +0 -0
  71. data/public/images/search_textinput_active.png +0 -0
  72. data/public/images/star.png +0 -0
  73. data/public/images/star_orange.png +0 -0
  74. data/public/images/star_white.png +0 -0
  75. data/public/images/table_th1_34.png +0 -0
  76. data/public/images/twitter_32.png +0 -0
  77. data/public/images/vkontakte_32.png +0 -0
  78. data/public/images/zoom.png +0 -0
  79. data/public/javascripts/jquery.tools.min.js +23 -0
  80. data/public/javascripts/product.js +64 -0
  81. data/public/javascripts/product_simple.js +54 -0
  82. data/public/stylesheets/style.css +965 -0
  83. data/spec/spec_helper.rb +30 -0
  84. data/synergy_default_theme.gemspec +23 -0
  85. metadata +177 -0
data/LICENSE ADDED
@@ -0,0 +1,23 @@
1
+ Redistribution and use in source and binary forms, with or without modification,
2
+ are permitted provided that the following conditions are met:
3
+
4
+ * Redistributions of source code must retain the above copyright notice,
5
+ this list of conditions and the following disclaimer.
6
+ * Redistributions in binary form must reproduce the above copyright notice,
7
+ this list of conditions and the following disclaimer in the documentation
8
+ and/or other materials provided with the distribution.
9
+ * Neither the name of the Rails Dog LLC nor the names of its
10
+ contributors may be used to endorse or promote products derived from this
11
+ software without specific prior written permission.
12
+
13
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
14
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
15
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
16
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
17
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
21
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
22
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
23
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,4 @@
1
+ Synergy Default Theme
2
+ ===================
3
+
4
+ Copyright (c) 2011 "Сервис и Консалтинг", released under the New BSD License
@@ -0,0 +1,31 @@
1
+ require File.expand_path('../../config/application', __FILE__)
2
+
3
+ require 'rubygems'
4
+ require 'rake'
5
+ require 'rake/testtask'
6
+ require 'rake/packagetask'
7
+ require 'rake/gempackagetask'
8
+
9
+ spec = eval(File.read('synergy_default_theme.gemspec'))
10
+
11
+ Rake::GemPackageTask.new(spec) do |p|
12
+ p.gem_spec = spec
13
+ end
14
+
15
+ desc "Release to gemcutter"
16
+ task :release => :package do
17
+ require 'rake/gemcutter'
18
+ Rake::Gemcutter::Tasks.new(spec).define
19
+ Rake::Task['gem:push'].invoke
20
+ end
21
+
22
+ desc "Default Task"
23
+ task :default => [ :spec ]
24
+
25
+ require 'rspec/core/rake_task'
26
+ RSpec::Core::RakeTask.new
27
+
28
+ # require 'cucumber/rake/task'
29
+ # Cucumber::Rake::Task.new do |t|
30
+ # t.cucumber_opts = %w{--format pretty}
31
+ # end
@@ -0,0 +1,10 @@
1
+ class HomeController < Spree::BaseController
2
+ helper :products, :taxons
3
+
4
+ def index
5
+ @taxons = Rails.cache.fetch('homepage-taxons', :expires_in => LONG_INTERVAL) do
6
+ home_taxonomy = get_taxonomies.find{|t| t.show_on_homepage? }
7
+ home_taxonomy ? home_taxonomy.root.children : []
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,3 @@
1
+ ProductsController.class_eval do
2
+ helper :reviews
3
+ end
@@ -0,0 +1,14 @@
1
+ Spree::BaseHelper.module_eval do
2
+ def link_to_cart(text = t('cart'))
3
+ #return "" if current_page?(cart_path)
4
+ #css_class = nil
5
+ if current_order.nil? or current_order.line_items.empty?
6
+ text = "#{text}"
7
+ css_class = 'empty'
8
+ else
9
+ text = "#{text} (#{current_order.item_count})"
10
+ css_class = 'full'
11
+ end
12
+ link_to text, cart_path, :class => css_class
13
+ end
14
+ end
@@ -0,0 +1,5 @@
1
+ OrdersHelper.module_eval do
2
+ def truncate(text, options = {})
3
+ super(strip_tags(text), options)
4
+ end
5
+ end
@@ -0,0 +1,22 @@
1
+ ProductsHelper.module_eval do
2
+ def variant_price_diff(variant)
3
+ return product_price(variant) unless variant.product.master.price
4
+ diff = product_price(variant, :format_as_currency => false) - product_price(variant.product, :format_as_currency => false)
5
+ return nil if diff == 0
6
+ if diff > 0
7
+ "(+ #{format_price diff.abs})"
8
+ else
9
+ "(- #{format_price diff.abs})"
10
+ end
11
+ end
12
+
13
+ def product_description(product)
14
+ raw(product.description)
15
+ end
16
+
17
+ def large_sizes
18
+ return @large_sizes if @large_sizes
19
+ match = Image.attachment_definitions[:attachment][:styles][:large].match(/(\d+)x(\d+)/)
20
+ @large_sizes = {:width => match[1], :height => match[2]}
21
+ end
22
+ end
@@ -0,0 +1,7 @@
1
+ TaxonsHelper.module_eval do
2
+ def taxon_preview(taxon, max=6)
3
+ Rails.cache.fetch([taxon, 'preview'], :expires_in => LONG_INTERVAL) do
4
+ taxon.active_products.includes(:master, :images).order("rand()").limit(max).all
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,20 @@
1
+ class PageSweeper < ActionController::Caching::Sweeper
2
+ observe Page
3
+ def after_create(page)
4
+ expire_cache_for(page)
5
+ end
6
+
7
+ def after_update(page)
8
+ expire_cache_for(page)
9
+ end
10
+
11
+ def after_destroy(page)
12
+ expire_cache_for(page)
13
+ end
14
+
15
+ private
16
+
17
+ def expire_cache_for(page)
18
+ expire_fragment('footer_menu')
19
+ end
20
+ end
@@ -0,0 +1,20 @@
1
+ class TrackerSweeper < ActionController::Caching::Sweeper
2
+ observe Tracker
3
+ def after_create(tracker)
4
+ expire_cache_for(tracker)
5
+ end
6
+
7
+ def after_update(tracker)
8
+ expire_cache_for(tracker)
9
+ end
10
+
11
+ def after_destroy(tracker)
12
+ expire_cache_for(tracker)
13
+ end
14
+
15
+ private
16
+
17
+ def expire_cache_for(tracker)
18
+ expire_fragment('google_analytics')
19
+ end
20
+ end
@@ -0,0 +1,42 @@
1
+ <h1><%= t('review_management_description') %></h1>
2
+
3
+ <% for reviews in [["Unapproved", @unapproved_reviews], ["Approved", @approved_reviews]] %>
4
+ <h2><%= t(reviews[0]+"_reviews") %></h2>
5
+
6
+ <table cellspacing=6 class="index">
7
+ <tr>
8
+ <th><%= t('date_') %></th>
9
+ <th><%= t('user') %></th>
10
+ <th><%= t('product') %></th>
11
+ <th><%= t('review_content') %></th>
12
+ <th></th>
13
+ </tr>
14
+
15
+ <% for review in reviews[1] %>
16
+ <tr>
17
+ <td>
18
+ <%= l review.created_at %>
19
+ </td>
20
+ <td>
21
+ <%= review.name %><%= t('from') %> <%= review.location %>
22
+ </td>
23
+ <td>
24
+ <%= link_to review.product.name, product_path(review.product) %>
25
+ </td>
26
+ <td style="border: 1px dashed green" width="60%">
27
+ <br/>
28
+ <%= h review.review %>
29
+ </td>
30
+ <td>
31
+ <% unless review.approved %>
32
+ <%= link_to t('approve'), {:action => 'approve', :id => review.id} %> <br />
33
+ <% end %>
34
+ <%= link_to t('edit'), [:edit, :admin, review] %> <br/>
35
+ <%= link_to t('destroy'), [:admin, review], :method => :delete, :confirm => t('are_you_sure_review') %>
36
+
37
+ </td>
38
+ </tr>
39
+ <% end %>
40
+ </table>
41
+ <br/>
42
+ <% end %>
@@ -0,0 +1,19 @@
1
+ <table class="index">
2
+ <tr>
3
+ <th><%= t('name') %></th>
4
+ <th><%= t('compare_products.comparable_container') %></th>
5
+ <th>Отображать на главной странице</th>
6
+ <th></th>
7
+ </tr>
8
+
9
+ <% for taxonomy in @taxonomies %>
10
+ <tr id="<%= dom_id taxonomy %>">
11
+ <td><%= taxonomy.name %></td>
12
+ <td><%= icon('tick') if taxonomy.comparable? %></td>
13
+ <td><%= icon('tick') if taxonomy.show_on_homepage? %></td>
14
+ <td class="actions">
15
+ <%= link_to_edit taxonomy.id %> &nbsp; <%= link_to_delete taxonomy %>
16
+ </td>
17
+ </tr>
18
+ <% end %>
19
+ </table>
@@ -0,0 +1,4 @@
1
+ <% field_container :taxonomy, :show_on_homepage do %>
2
+ <%= check_box :taxonomy, :show_on_homepage %>
3
+ <%= label :taxonomy, :show_on_homepage, 'отображать на главной странице' %>
4
+ <% end %>
@@ -0,0 +1,25 @@
1
+ <fieldset id='shipping_method'>
2
+ <legend><%= t("shipping_method") %></legend>
3
+ <div class="inner">
4
+ <div id="methods">
5
+ <p class="field radios">
6
+ <% @order.rate_hash.each do |shipping_method| %>
7
+ <label>
8
+ <%= radio_button(:order, :shipping_method_id, shipping_method[:id]) %>
9
+ <%= shipping_method[:name] %> <%= number_to_currency shipping_method[:cost] if shipping_method[:cost] > 0 %>
10
+ </label><br />
11
+ <% end %>
12
+ </p>
13
+ </div>
14
+ <% if Spree::Config[:shipping_instructions] && @order.rate_hash.present? %>
15
+ <p id="minstrs">
16
+ <%= form.label :special_instructions, t("shipping_instructions") %><br />
17
+ <%= form.text_area :special_instructions, :cols => 40, :rows => 7 %>
18
+ </p>
19
+ <% end %>
20
+ </div>
21
+ </fieldset>
22
+
23
+ <div class="form-buttons">
24
+ <input type="submit" class="continue button primary" value="<%=t("save_and_continue") %>"/>
25
+ </div>
@@ -0,0 +1,34 @@
1
+ <fieldset id="payment">
2
+ <legend><%= t("payment_information") %></legend>
3
+ <%= hook :checkout_payment_step, {:form => form} do %>
4
+ <% @order.available_payment_methods.each do |method| %>
5
+ <div>
6
+ <label>
7
+ <%= radio_button_tag "order[payments_attributes][][payment_method_id]", method.id, method == @order.payment_method %>
8
+ <%= t(method.name, :scope => :payment_methods, :default => method.name) %>
9
+ </label>
10
+ <div class="description">
11
+ <%= method.description %>
12
+ </div>
13
+ </div>
14
+
15
+ <% end %>
16
+
17
+ <ul id="payment-methods">
18
+ <% @order.available_payment_methods.each do |method| %>
19
+ <li id="payment_method_<%= method.id %>"<%= ' class="last"' if method == @order.available_payment_methods.last %>>
20
+ <fieldset>
21
+ <%= render "checkout/payment/#{method.method_type}", :payment_method => method %>
22
+ </fieldset>
23
+ </li>
24
+ <% end %>
25
+ </ul>
26
+ <br style='clear:both;' />
27
+ <%= hook :coupon_code_field, {:form => form} %>
28
+ <% end %>
29
+ </fieldset>
30
+
31
+ <hr class="space" />
32
+ <div class="form-buttons">
33
+ <input type="submit" class="continue button primary" value="<%=t("save_and_continue") %>" />
34
+ </div>
@@ -0,0 +1,22 @@
1
+ <% content_for :page_title do %>
2
+ <h1 class="font-41 black"><%= t("robokassa.pay")%></h1>
3
+ <% end %>
4
+ <%= form_tag @gateway.url, :method => "POST" do %>
5
+ <%= hidden_field_tag(:"MrchLogin", @gateway.options[:mrch_login]) %>
6
+ <%= hidden_field_tag(:"OutSum", @order.total)%>
7
+ <%= hidden_field_tag(:"InvId", @order.id)%>
8
+ <%= hidden_field_tag(:"Desc", I18n.t("robokassa.details_of_payment", :order_number => @order.number)) %>
9
+ <%= hidden_field_tag(:"SignatureValue", @signature) %>
10
+ <h1 class="font-41 black"><%= "#{t('order')} #{@order.number}" %></h1>
11
+ <%= render :partial => 'shared/order_details', :locals => {:order => @order} %>
12
+ <div class="clear"></div>
13
+ <div class="font-41">&nbsp;</div>
14
+ <button class="button_buy left" href="">
15
+ <span class="left_b"></span>
16
+ <span class="line_b">
17
+ <span class="text_z_1"><%=t("pay") %></span>
18
+ </span>
19
+ <span class="right_b"></span>
20
+ </button>
21
+ <div class="clear"></div>
22
+ <% end %>
@@ -0,0 +1,11 @@
1
+ <% content_for :sidebar do %>
2
+ <%= render "shared/taxonomies" %>
3
+ <% end %>
4
+
5
+ <% @taxons.each do |taxon| %>
6
+ <div class="taxon">
7
+ <h2><%= taxon.name %></h2>
8
+
9
+ <%= render :partial => "shared/products", :locals => {:products => taxon_preview(taxon, 6), :taxon => taxon} %>
10
+ </div>
11
+ <% end %>
@@ -0,0 +1,110 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
+ <html xmlns="http://www.w3.org/1999/xhtml">
3
+ <head>
4
+ <%= hook :inside_head do %>
5
+ <%= render 'shared/head' %>
6
+ <% end %>
7
+ <%= render 'shared/synergy_compare_products_js' if defined?(SpreeCompareProducts) %>
8
+ <%= stylesheet_link_tag 'style' %>
9
+ </head>
10
+ <%
11
+ if @body_class.nil?
12
+ if content_for?(:sidebar)
13
+ @body_class = 'two-col'
14
+ else
15
+ @body_class = 'one-col'
16
+ end
17
+ end
18
+ %>
19
+
20
+ <body class="<%= @body_class %>" id="<%= @body_id %>">
21
+
22
+ <div class="wrapper">
23
+ <div class="main_top" align="center">
24
+ <div class="header_panel">
25
+ <ul>
26
+ <li style="text-align: center; width: 265px">
27
+ <div><%= link_to image_tag("logo.png", :alt => "Synergy logo"), root_url %></div></li>
28
+ <li style="padding-left: 16px; width: 400px"><%= render 'shared/search' %></li>
29
+ <li>
30
+ <div><%= link_to_cart %></div>
31
+ </li>
32
+ <li>
33
+ <% if @comparable_products %>
34
+ <div><%= link_to "Сравнение товаров (#{@comparable_products.count})", compare_products_path, {:id => "compare_products"} %></div>
35
+ <div id="tooltip" class="tooltip" style="display: none">
36
+ <div class="tooltip_top"></div>
37
+ <div class="tooltip_middle">
38
+ <div style="font-size: 0px">&nbsp;</div>
39
+ <div class="tooltip_content" id="tooltip_content"></div>
40
+ <div style="font-size: 0px">&nbsp;</div>
41
+ </div>
42
+ <div class="tooltip_bottom"></div>
43
+ </div>
44
+ <% end %>
45
+ </li>
46
+ </ul>
47
+ </div>
48
+ </div>
49
+ <div align="center">
50
+ <div class="fixed_width">
51
+ <div id="top_panel">
52
+ <div id="top_login_bar">
53
+ <%= hook :shared_login_bar %>
54
+ </div>
55
+ <div id="header_menu">
56
+ <ul class="header_menu">
57
+ <% for page in Page.header_links do %>
58
+ <li><%= link_to page.title, page.link %></li>
59
+ <% end %>
60
+ </ul>
61
+ </div>
62
+ </div>
63
+ <%= render :partial => 'shared/comparable_products' if defined?(SpreeCompareProducts) %>
64
+ <% if content_for?(:sidebar) %>
65
+ <div class="sidebar">
66
+ <%= hook :sidebar do %>
67
+ <%= yield :sidebar %>
68
+ <% end %>
69
+
70
+ <% if Page.sidebar_links.any? %>
71
+ <div id="sidebar_menu">
72
+ <ul class="sidebar_menu">
73
+ <% for page in Page.sidebar_links do %>
74
+ <li><%= link_to page.title, page.link %></li>
75
+ <% end %>
76
+ </ul>
77
+ </div>
78
+ <% end %>
79
+ </div>
80
+ <% end %>
81
+ <div id="content" class="content">
82
+ <% if flash.notice %>
83
+ <div class="flash notice"><%= flash.notice %></div>
84
+ <% end %>
85
+ <% if flash[:error] %>
86
+ <div class="flash errors"><%= flash[:error] %></div>
87
+ <% end %>
88
+ <%= yield %>
89
+ </div>
90
+ <div style="height: 10px;"></div>
91
+ </div>
92
+ </div>
93
+ <div class="footer_fake"></div>
94
+ </div>
95
+
96
+ <div class="footer" align="center">
97
+ <% cache 'footer_menu' do %>
98
+ <ul class="footer_menu">
99
+ <% for page in Page.footer_links do %>
100
+ <li><%= link_to page.title, page.link %></li>
101
+ <% end %>
102
+ </ul>
103
+ <% end %>
104
+ </div>
105
+ <%= hook :footer_right %>
106
+ <% cache 'google_analytics' do %>
107
+ <%= render 'shared/google_analytics' %>
108
+ <% end %>
109
+ </body>
110
+ </html>