Merge pull request #15 from iloveitaly/spree-1.0
Deface Instead of Copied Delivery Partials
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
Deface::Override.new(:virtual_path => "spree/checkout/_delivery",
|
||||
:name => "modify_shipping_options_display",
|
||||
:replace_contents => "#shipping_method #methods p.radios",
|
||||
:original => %q{
|
||||
<% @order.rate_hash.each do |shipping_method| %>
|
||||
<label>
|
||||
<%= radio_button(:order, :shipping_method_id, shipping_method[:id]) %>
|
||||
<% if Spree::Config[:shipment_inc_vat] %>
|
||||
<%= shipping_method[:name] %> <%= format_price (1 + Spree::TaxRate.default) * shipping_method[:cost] %>
|
||||
<% else %>
|
||||
<%= shipping_method[:name] %> <%= number_to_currency shipping_method[:cost] %>
|
||||
<% end %>
|
||||
</label>
|
||||
<% end %>
|
||||
},
|
||||
:text => %q{
|
||||
<% if @order.digital? && @order.digital_shipping_method.present? %>
|
||||
<label>
|
||||
<%= radio_button :order, :shipping_method_id, @order.digital_shipping_method[:id] %>
|
||||
<%== t 'digital_shipping', :email => @order.email %> (<%= number_to_currency @order.digital_shipping_method[:cost] %>)
|
||||
</label>
|
||||
<% else %>
|
||||
<% filtered_rate_hash = @order.rate_hash.select { |m| !(@order.digital_shipping_method && shipping_method[:id] == @order.digital_shipping_method[:id]) } %>
|
||||
<% if filtered_rate_hash.count > 0 %>
|
||||
<% filtered_rate_hash.each do |shipping_method| %>
|
||||
<% next if @order.digital_shipping_method && shipping_method[:id] == @order.digital_shipping_method[:id] %>
|
||||
<label>
|
||||
<%= radio_button(:order, :shipping_method_id, shipping_method[:id]) %>
|
||||
<% if Spree::Config[:shipment_inc_vat] %>
|
||||
<%= shipping_method[:name] %> <%= format_price (1 + Spree::TaxRate.default) * shipping_method[:cost] %>
|
||||
<% else %>
|
||||
<%= shipping_method[:name] %> <%= number_to_currency shipping_method[:cost] %>
|
||||
<% end %>
|
||||
</label>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<%= t :no_shipping_methods %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
})
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
<%= hidden_field_tag 'digital[variant_id]', variant.id %>
|
||||
|
||||
<%= button t("upload") %>
|
||||
<%= button t('spree_digital.upload') %>
|
||||
<% end %>
|
||||
</p>
|
||||
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
<%#
|
||||
This is basically a switch that will render the appropriate "delivery choice" partial.
|
||||
When there are no physical items at all, there should be no different shipping methods to choose.
|
||||
%>
|
||||
<%= render @order.digital? && @order.digital_shipping_method.present? ? 'delivery_digital' : 'delivery_original' %>
|
||||
@@ -1,12 +0,0 @@
|
||||
<fieldset id='shipping_method'>
|
||||
<legend><%= t("shipping_method") %></legend>
|
||||
|
||||
<%= radio_button :order, :shipping_method_id, @order.digital_shipping_method[:id] %>
|
||||
<%==t 'digital_shipping', :email => current_user.email %> (<%= number_to_currency @order.digital_shipping_method[:cost] %>)
|
||||
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<div class="form-buttons">
|
||||
<input type="submit" class="continue button primary" value="<%=t("save_and_continue") %>"/>
|
||||
</div>
|
||||
@@ -1,32 +0,0 @@
|
||||
<%#
|
||||
NOTE: The code below is an exact duplication of `spree_core/views/checkout/_delivery.html.erb´
|
||||
We overwrote the original so we retain access to it by cloning it here.
|
||||
Feel free to update the code below according to the original if needed!
|
||||
%>
|
||||
|
||||
<fieldset id='shipping_method'>
|
||||
<legend><%= t("shipping_method") %></legend>
|
||||
<div class="inner">
|
||||
<div id="methods">
|
||||
<p class="field radios">
|
||||
<% @order.rate_hash.each do |shipping_method| %>
|
||||
<% next if @order.digital_shipping_method && shipping_method[:id] == @order.digital_shipping_method[:id] %>
|
||||
<label>
|
||||
<%= radio_button(:order, :shipping_method_id, shipping_method[:id]) %>
|
||||
<%= shipping_method[:name] %> <%= number_to_currency shipping_method[:cost] %>
|
||||
</label><br />
|
||||
<% end %>
|
||||
</p>
|
||||
</div>
|
||||
<% if Spree::Config[:shipping_instructions] && @order.rate_hash.present? %>
|
||||
<p id="minstrs">
|
||||
<%= form.label :special_instructions, t("shipping_instructions") %><br />
|
||||
<%= form.text_area :special_instructions, :cols => 40, :rows => 7 %>
|
||||
</p>
|
||||
<% end %>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<div class="form-buttons">
|
||||
<input type="submit" class="continue button primary" value="<%=t("save_and_continue") %>"/>
|
||||
</div>
|
||||
@@ -1,12 +1,11 @@
|
||||
en:
|
||||
digital_versions: Digital Versions
|
||||
|
||||
current_file: Current File
|
||||
new_file: New File
|
||||
upload: Upload
|
||||
delete_file: Delete this file
|
||||
broken_file: Warning! this file is broken
|
||||
delete_file_cofirmation: Are you sure you want to delete the file %{filename}?
|
||||
|
||||
digital_shipping: Delivery per email to <strong>%{email}</strong>
|
||||
|
||||
|
||||
spree_digital:
|
||||
upload: Upload
|
||||
@@ -17,10 +17,6 @@ module SpreeDigital
|
||||
Dir.glob(File.join(File.dirname(__FILE__), "../../app/**/*_decorator*.rb")) do |c|
|
||||
Rails.application.config.cache_classes ? require(c) : load(c)
|
||||
end
|
||||
|
||||
Dir.glob(File.join(File.dirname(__FILE__), "../../app/overrides/*.rb")) do |c|
|
||||
Rails.application.config.cache_classes ? require(c) : load(c)
|
||||
end
|
||||
end
|
||||
|
||||
config.to_prepare &method(:activate).to_proc
|
||||
|
||||
Reference in New Issue
Block a user