Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

First part of work on updating to Spree 0.70.x

  • Loading branch information...
commit ee43d85b16925b5329cc4b2b39afb183722924f6 1 parent e4d403a
@romul romul authored
View
0  public/images/admin/bg/admin_menu_back.png → app/assets/images/admin/bg/admin_menu_back.png
File renamed without changes
View
0  public/images/admin/bg/admin_sub_menu_back.png → app/assets/images/admin/bg/admin_sub_menu_back.png
File renamed without changes
View
0  public/images/admin/icons/help.png → app/assets/images/admin/icons/help.png
File renamed without changes
View
0  public/images/admin/logo.png → app/assets/images/admin/logo.png
File renamed without changes
View
2  public/javascripts/admin/inline_help.js → app/assets/javascripts/admin/inline_help.js
@@ -36,7 +36,7 @@ function register_help() {
jQuery.each(fields, function(element_id, help_msg) {
if (jQuery('#help_'+element_id).length == 0)
{
- jQuery('label[for='+element_id+']').append("&nbsp;<span class='help' id='help_"+element_id+"'><img src='/images/admin/icons/help.png' alt='help' /></span>");
+ jQuery('label[for='+element_id+']').append("&nbsp;<span class='help' id='help_"+element_id+"'><img src='/assets/admin/icons/help.png' alt='help' /></span>");
jQuery('#help_'+element_id).simpletip({ position: 'right', offset: [-10, -230], content: help_msg});
}
});
View
2  app/assets/javascripts/admin/synergy.js
@@ -0,0 +1,2 @@
+//= require admin/inline_help
+//= require 'admin/jquery.simpletip-1.3.1.pack'
View
4 public/stylesheets/courier_instruction.css → app/assets/stylesheets/admin/courier_instruction.css
@@ -1,5 +1,3 @@
-/* ----- */
-
html, body {
height: 100%;
}
@@ -133,4 +131,4 @@ b, strong {
#seller div {
margin: 1em 0;
-}
+}
View
0  public/stylesheets/admin/inline_help.css → app/assets/stylesheets/admin/inline_help.css
File renamed without changes
View
10 public/stylesheets/admin/synergy.css → app/assets/stylesheets/admin/synergy.css
@@ -1,3 +1,9 @@
+/*
+ * This is a manifest file that includes stylesheets for synergy
+ *= require admin/inline_help
+ *= require_self
+*/
+
ul#shipping-specs label {
display: block;
}
@@ -51,7 +57,7 @@ h2 {
}
#admin-menu {
- background: url("../../images/admin/bg/admin_menu_back.png") repeat-x scroll left top;
+ background: url("/assets/admin/bg/admin_menu_back.png") repeat-x scroll left top;
border-bottom: none;
border-right: none;
border-top: 1px solid white;
@@ -77,7 +83,7 @@ h2 {
}
#sub-menu {
- background: url("../../images/admin/bg/admin_sub_menu_back.png") repeat-x scroll left top;
+ background: url("/assets/admin/bg/admin_sub_menu_back.png") repeat-x scroll left top;
border-top: 1px solid black;
box-shadow: #A1A1A1 0 -1px 0;
border-left: none;
View
5 app/models/calculator/cash_on_delivery.rb
@@ -3,11 +3,6 @@ def self.description
I18n.t("cash_on_delivery")
end
- def self.register
- super
- ShippingMethod.register_calculator(self)
- end
-
def compute(object)
0
end
View
7 app/models/calculator/juridical.rb
@@ -3,12 +3,7 @@ def self.description
I18n.t("juridical_invoice")
end
- def self.register
- super
- ShippingMethod.register_calculator(self)
- end
-
def compute(object)
0
end
-end
+end
View
41 app/overrides/views_decorator.rb
@@ -0,0 +1,41 @@
+Deface::Override.new(
+ :virtual_path => "admin/orders/show",
+ :name => "synergy_admin_order_show_buttons",
+ :insert_before => "[data-hook='admin_order_show_buttons'], #admin_order_show_buttons[data-hook]",
+ :text => "
+ <%= button_link_to t(\"courier_instructions\"), orders_courier_instruction_path(@order), :target => \"_blank\" if @order.completed_at %>
+ ",
+ :disabled => false)
+
+Deface::Override.new(
+ :virtual_path => "admin/configurations/index",
+ :name => "synergy_admin_configurations_menu",
+ :insert_bottom => "[data-hook='admin_configurations_menu'], #admin_configurations_menu[data-hook]",
+ :text => "<tr>
+ <td><%= link_to t(\"synergy_settings\"), admin_synergy_settings_path %></td>
+ <td><%= t(\"synergy_settings_desc\") %></td>
+ </tr>",
+ :disabled => false)
+
+Deface::Override.new(
+ :virtual_path => "admin/shared/_configuration_menu",
+ :name => "synergy_admin_configurations_sidebar_menu",
+ :insert_bottom => "[data-hook='admin_configurations_sidebar_menu'], #admin_configurations_sidebar_menu[data-hook]",
+ :text => "<li<%== ' class=\"active\"' if controller.controller_name == 'synergy_settings' %>><%= link_to t(\"synergy_settings\"), admin_synergy_settings_path %></li>",
+ :disabled => false)
+
+Deface::Override.new(
+ :virtual_path => "admin/shared/_order_tabs",
+ :name => "synergy_admin_order_tabs",
+ :insert_bottom => "[data-hook='admin_order_tabs'], #admin_order_tabs[data-hook]",
+ :partial => "admin/orders/juridical_tabs",
+ :disabled => false)
+
+Deface::Override.new(
+ :virtual_path => "users/show",
+ :name => "synergy_account_summary",
+ :insert_bottom => "[data-hook='account_summary'], #account_summary[data-hook]",
+ :partial => "users/status",
+ :disabled => false)
+
+
View
15 app/views/admin/products/_import_from_yandex_market.html.erb
@@ -0,0 +1,15 @@
+<%= form_tag import_from_yandex_market_path, :method => :get do %>
+ <div class="box">
+ <h3>Импорт с Яндекс.Маркет</h3>
+ <p>
+ <%= label_tag :model_id, "ID товара на ЯМ" %><br />
+ <%= text_field_tag :model_id %>
+ </p>
+ <p>
+ <%= check_box_tag :available %>&nbsp;<%= label_tag :available, "сделать доступным" %>
+ </p>
+ <p class="form-buttons">
+ <%= button "Импорт" %>
+ </p>
+ </div>
+<% end %>
View
94 app/views/admin/products/index.html.erb
@@ -1,94 +0,0 @@
-<%= render :partial => 'admin/shared/product_sub_menu' %>
-
-<div class='toolbar'>
- <ul class='actions'>
- <li id="new_product_link">
- <%= button_link_to t("new_product"), new_object_url, {:remote => true, :icon => 'add', :id => 'admin_new_product'} %>
- </li>
- </ul>
- <br class='clear' />
-</div>
-
-<h1><%= "#{t("actions.listing")} #{t("products")}" %></h1>
-
-<div id="new_product"></div>
-
-<table class="index" id='listing_products'>
- <tr>
- <%= hook :admin_products_index_headers do %>
- <th><%= t("sku") %></th>
- <th><%= sort_link @search,:name, t("name"), {}, {:title => 'admin_products_listing_name_title'} %></th>
- <th><%= sort_link @search,:master_price, t("master_price") %></th>
- <% end %>
- <th>
- <%= hook :admin_products_index_header_actions %>
- </th>
- </tr>
-<% @collection.each do |product| %>
- <tr <%= 'style="color:red;"' if product.deleted? %> id="<%= dom_id product %>">
- <%- locals = {:product => product} %>
- <%= hook :admin_products_index_rows, locals do %>
- <td><%= product.sku %></td>
- <td><%= product.name %></td>
- <td><%= product.price %></td>
- <% end %>
- <td class="actions">
- <%= hook :admin_products_index_row_actions, locals do %>
- <%= link_to_edit product, :class => 'edit' unless product.deleted? %>
- &nbsp;
- <%= link_to_clone product, :class => 'clone' %>
- &nbsp;
- <%= link_to_delete product unless product.deleted? %>
- <% end %>
- </td>
- </tr>
-<% end %>
-</table>
-<%= will_paginate(:previous_label => "&#171; #{t('previous')}", :next_label => "#{t('next')} &#187;") %>
-
-<% content_for :sidebar do %>
-
- <%= form_for [:admin, @search] do |f| %>
- <div class="box">
- <h3><%= t(:search) %></h3>
-
- <%- locals = {:f => f} %>
- <%= hook :admin_products_index_search, locals do %>
- <p>
- <%= f.label :name_contains, t("name") %><br />
- <%= f.text_field :name_contains, :size => 15 %>
- </p>
- <p>
- <%= f.label :variants_including_master_sku_contains, t("sku") %><br />
- <%= f.text_field :variants_including_master_sku_contains, :size => 15 %>
- </p>
- <p>
- <%= f.label :deleted_at_is_null, t("show_deleted") %><br />
- <%= f.check_box :deleted_at_is_null, {:checked => params[:search][:deleted_at_is_null].blank?}, "", "1" %>
- </p>
- <% end %>
-
- <%= hook :admin_products_index_search_buttons, locals do %>
- <p class="form-buttons">
- <%= button t("search") %>
- </p>
- <% end %>
- </div>
- <% end %>
-
- <%= form_tag import_from_yandex_market_path, :method => :get do %>
- <div class="box">
- <h3>Импорт с Яндекс.Маркет</h3>
- <p>
- <%= label_tag :model_id, "ID товара на ЯМ" %><br />
- <%= text_field_tag :model_id %>
- </p>
- <p>
- <%= check_box_tag :available %>&nbsp;<%= label_tag :available, "сделать доступным" %>
- </p>
- <p class="form-buttons">
- <%= button "Импорт" %>
- </p>
- </div>
- <% end %>
-<% end %>
View
27 lib/generators/synergy/install_generator.rb
@@ -0,0 +1,27 @@
+module Synergy
+ module Generators
+ class InstallGenerator < Rails::Generators::Base
+
+ def add_javascripts
+ append_file "app/assets/javascripts/admin/all.js", "//= require admin/synergy\n"
+ end
+
+ def add_stylesheets
+ inject_into_file "app/assets/stylesheets/admin/all.css", " *= require admin/synergy\n", :before => /\*\//, :verbose => true
+ end
+
+ def add_migrations
+ run 'rake railties:install:migrations FROM=synergy'
+ end
+
+ def run_migrations
+ res = ask "Would you like to run the migrations now? [Y/n]"
+ if res == "" || res.downcase == "y"
+ run 'rake db:migrate'
+ else
+ puts "Skiping rake db:migrate, don't forget to run it!"
+ end
+ end
+ end
+ end
+end
View
34 lib/synergy.rb
@@ -8,7 +8,7 @@
require 'spree_static_content'
require 'spree_editor'
require 'spree_online_support'
-require 'spree_robokassa'
+#require 'spree_robokassa'
require 'spree_yandex_market'
require 'spree_address_book'
require 'spree_dynamic_sitemaps'
@@ -16,12 +16,12 @@
require 'russian'
require 'ru_propisju'
-require 'synergy_hooks'
require 'ext/number_helper'
module Synergy
class Engine < Rails::Engine
-
+ engine_name 'synergy'
+
config.autoload_paths += %W(#{config.root}/lib)
def self.activate
@@ -60,14 +60,6 @@ def to_url
end
end
- # зарегистрировать калькулятор для доставки наложенным платежём
- Calculator::CashOnDelivery.register
-
- PaymentMethod::SberBankInvoice.register
-
- # добавление способа оплаты (и калькулятора для него) для юридических лиц
- PaymentMethod::JuridicalInvoice.register
- Calculator::Juridical.register
# добавить событие для перехода от шага доставки к шагу подтверждения, минуя шаг оплаты
confirm_event = StateMachine::Event.new(Order.state_machine, :confirm_without_payment)
@@ -85,5 +77,25 @@ def to_url
end
config.to_prepare &method(:activate).to_proc
+
+ initializer "spree.register.calculators" do |app|
+ app.config.spree.calculators.shipping_methods = [
+ Calculator::FlatPercentItemTotal,
+ Calculator::FlatRate,
+ Calculator::CashOnDelivery,
+ Calculator::Juridical,
+ Calculator::FlexiRate,
+ Calculator::PerItem,
+ Calculator::PriceBucket]
+ end
+
+ initializer "spree.register.payment_methods" do |app|
+ app.config.spree.payment_methods = [
+ Gateway::Bogus,
+ Gateway::PayPal,
+ PaymentMethod::Check,
+ PaymentMethod::SberBankInvoice,
+ PaymentMethod::JuridicalInvoice ]
+ end
end
end
View
29 lib/synergy_hooks.rb
@@ -1,29 +0,0 @@
-class SecointHooks < Spree::ThemeSupport::HookListener
- insert_before :admin_order_show_buttons do
- %(
- <%= button_link_to t("courier_instructions"), orders_courier_instruction_path(@order), :target => "_blank" if @order.completed_at %>
- )
- end
-
- insert_after :admin_inside_head do
- %(
- <%= javascript_include_tag 'admin/inline_help.js', 'admin/jquery.simpletip-1.3.1.pack.js' %>
- <%= stylesheet_link_tag 'admin/inline_help.css', 'admin/synergy.css' %>
- )
- end
-
- insert_after :admin_configurations_menu do
- %(<tr>
- <td><%= link_to t("synergy_settings"), admin_synergy_settings_path %></td>
- <td><%= t("synergy_settings_desc") %></td>
- </tr>)
- end
-
- insert_after :admin_configurations_sidebar_menu do
- %(<li<%== ' class="active"' if controller.controller_name == 'synergy_settings' %>><%= link_to t("synergy_settings"), admin_synergy_settings_path %></li>)
- end
-
- insert_after :admin_order_tabs, 'admin/orders/juridical_tabs'
-
- insert_after :account_summary, 'users/status'
-end
View
0  public/stylesheets/reset.css → public/stylesheets/store/reset.css
File renamed without changes
View
20 synergy.gemspec
@@ -1,7 +1,7 @@
Gem::Specification.new do |s|
s.platform = Gem::Platform::RUBY
s.name = 'synergy'
- s.version = '0.60.1'
+ s.version = '0.70.0.beta'
s.summary = 'Russian e-commerce solution based on Spree'
s.description = ''
s.required_ruby_version = '>= 1.8.7'
@@ -17,15 +17,15 @@ Gem::Specification.new do |s|
s.requirements << 'none'
s.add_dependency('synergy_russian', '0.2.8')
- s.add_dependency('json', '~> 1.5.1')
- s.add_dependency('nokogiri', '~> 1.4.4')
- s.add_dependency('spree', '~> 0.60.0')
- s.add_dependency('spree_static_content', '~> 0.60.1')
- s.add_dependency('spree_editor', '~> 0.50.1')
- s.add_dependency('spree_robokassa', '~> 0.50.2')
- s.add_dependency('spree_yandex_market', '~> 1.2.0')
- s.add_dependency('spree_online_support', '~> 0.50.0')
- s.add_dependency('spree_address_book', '~> 0.50.1')
+ s.add_dependency('json', '>= 1.5')
+ s.add_dependency('nokogiri', '~> 1.5')
+ s.add_dependency('spree', '~> 0.70.0')
+ s.add_dependency('spree_static_content', '~> 0.70.0')
+ s.add_dependency('spree_editor', '~> 0.70.0')
+ #s.add_dependency('spree_robokassa', '~> 0.50.2')
+ s.add_dependency('spree_yandex_market', '~> 1.3.0')
+ s.add_dependency('spree_online_support', '~> 0.70.0')
+ s.add_dependency('spree_address_book', '~> 0.70.0')
s.add_dependency('spree_dynamic_sitemaps', '~> 0.50.1')
s.add_dependency('ru_propisju', '~> 1.1.0')
end
View
0  .../javascripts/admin/jquery.simpletip-1.3.1.pack.js → .../javascripts/admin/jquery.simpletip-1.3.1.pack.js
File renamed without changes
Please sign in to comment.
Something went wrong with that request. Please try again.