Permalink
Browse files

Update to Spree 1.3 compatibility

  • Loading branch information...
1 parent 1206027 commit 62f40f066bd1bf7da620074a7033c62435c8b07f @lenart lenart committed with radar Oct 31, 2012
@@ -6,7 +6,7 @@ def update
respond_to do |format|
format.html {
- redirect_to admin_captcha_settings_path
+ redirect_to edit_admin_captcha_settings_path
}
end
end
@@ -1,4 +1,7 @@
class Spree::EmailSenderController < Spree::BaseController
+
+ include Spree::Core::ControllerHelpers::Order
+
before_filter :find_object
def send_mail
@@ -1,5 +1,6 @@
class Spree::ToFriendMailer < ActionMailer::Base
- default :from => Spree::MailMethod.current.preferred_mails_from
+ default :from => Spree::MailMethod.current.try(:preferred_mails_from) || ''
+
def mail_to_friend(object, mail)
@object = object
@@ -1,5 +1,5 @@
-Deface::Override.new(:virtual_path => "spree/admin/configurations/index",
- :name => "converted_admin_configurations_menu_384123912",
- :insert_after => "[data-hook='admin_configurations_menu'], #admin_configurations_menu[data-hook]",
- :text => "<%= configurations_menu_item(I18n.t('captcha.captcha_settings'), admin_captcha_settings_path, I18n.t('captcha.manage_keys')) %>",
- :disabled => false)
+Deface::Override.new(:virtual_path => "spree/admin/shared/_configuration_menu",
+ :name => "add_captcha_admin_option",
+ :insert_bottom => "[data-hook='admin_configurations_sidebar_menu']",
+ :text => "<%= configurations_sidebar_menu_item t('captcha.captcha_settings'), edit_admin_captcha_settings_path %>",
+ :disabled => false)
@@ -1,22 +1,48 @@
<%= render :partial => 'spree/admin/shared/configuration_menu' %>
-<h1><%= t('captcha.captcha_settings') %></h1>
-
-<%= form_tag(admin_captcha_settings_path, :method => :put) do -%>
- <p>
- <label><%= t('captcha.public_key') %>:</label>
- <%= text_field_tag('preferences[public_key]', Spree::Captcha::Config[:public_key], :size => 40) %>
- </p>
- <p>
- <label><%= t('captcha.private_key') %>:</label>
- <%= text_field_tag('preferences[private_key]', Spree::Captcha::Config[:private_key], :size => 40)%>
- </p>
- <p>
- <label><%= t('captcha.theme') %>:</label>
- <%= select_tag('preferences[theme]', options_for_select(Spree::CaptchaConfiguration::THEMES, Spree::Captcha::Config[:theme])) %>
- </p>
- <p class="form-buttons">
- <%= button t(:update) %>
- <%= t(:or) %> <%= link_to t(:cancel), admin_captcha_settings_url %>
- </p>
+<% content_for :page_title do %>
+ <%= t('captcha.captcha_settings') %>
+<% end %>
+
+<%= form_tag(admin_captcha_settings_path, :method => :put) do |f| -%>
+
+ <fieldset class="no-border-top">
+ <div data-hook="admin_captcha_settings" class="row">
+
+ <div class="field choices">
+ <label><%= t('captcha.use_captcha') %></label><br>
+ <%= label_tag do %>
+ <%= radio_button_tag 'preferences[use_captcha]', true, Spree::Captcha::Config[:use_captcha] %>
+ <%= t(:yes) %>
+ <% end %>
+
+ <%= label_tag do %>
+ <%= radio_button_tag 'preferences[use_captcha]', false, !Spree::Captcha::Config[:use_captcha] %>
+ <%= t(:no) %>
+ <% end %>
+ </div>
+
+ <div data-hook="public_key" class="field">
+ <label><%= t('captcha.public_key') %></label><br>
+ <%= text_field_tag('preferences[public_key]', Spree::Captcha::Config[:public_key], :size => 40) %>
+ </div>
+
+ <div data-hook="private_key" class="field">
+ <label><%= t('captcha.private_key') %></label><br>
+ <%= text_field_tag('preferences[private_key]', Spree::Captcha::Config[:private_key], :size => 40) %>
+ </div>
+
+ <div data-hook="private_key" class="field">
+ <label><%= t('captcha.theme') %>:</label><br>
+ <%= select_tag('preferences[theme]', options_for_select(Spree::CaptchaConfiguration::THEMES, Spree::Captcha::Config[:theme]), class: "select2") %>
+ </div>
+
+ </div>
+
+ <div class="form-buttons filter-actions actions" data-hook="buttons">
+ <%= button t(:update), 'icon-refresh' %>
+ </div>
+
+ </fieldset>
+
<% end -%>
@@ -1,22 +0,0 @@
-<%= render :partial => 'spree/admin/shared/configuration_menu' %>
-
-<h1><%= t('captcha.captcha_settings') %></h1>
-
-<table>
- <tr>
- <th scope="row"><%= t('captcha.public_key') %>:</th>
- <td><%= Spree::Captcha::Config[:public_key] %></td>
- </tr>
- <tr>
- <th scope="row"><%= t('captcha.private_key') %>:</th>
- <td><%= Spree::Captcha::Config[:private_key] %></td>
- </tr>
- <tr>
- <th scope="row"><%= t('captcha.theme') %>:</th>
- <td><%= Spree::Captcha::Config[:theme] %></td>
- </tr>
-</table>
-
-<p>
- <%= link_to_with_icon('edit', t(:edit), edit_admin_captcha_settings_path) %>
-</p>
@@ -1,6 +1,6 @@
<h1><%= t('email_to_friend.tell_about', :product => @object.name) %></h1>
-<%= form_for(@mail_to_friend, :url => '') do |f| -%>
+<%= form_for(@mail_to_friend, :url => email_to_friend_path(params[:type], @object)) do |f| -%>
<%= render 'spree/shared/error_messages', :target => @mail_to_friend %>
<p>
<%= f.label(:sender_name, t('email_to_friend.sender_name')) %><br/>
@@ -28,4 +28,4 @@
<p>
<%= f.submit t('email_to_friend.send_message') %>
</p>
-<% end -%>
+<% end -%>
View
@@ -19,4 +19,5 @@ en:
public_key: "Public key"
private_key: "Private key"
manage_keys: "Manage your (re)captcha keys"
+ use_captcha: "Use Captha?"
theme: "Theme"
View
@@ -0,0 +1,23 @@
+---
+sl:
+ email_to_friend:
+ send_to_friend: "Pošlji prijatelju"
+ tell_about: "Povej prijatelju o: %{product}"
+ sender_name: "Tvoje ime"
+ sender_email: "Tvoj email naslov"
+ recipient_name: "Ime prejemnika"
+ recipient_email: "Email prejemnika"
+ recipient_emails: "Email naslovi (ločeni z vejico)"
+ message: "Sporočilo"
+ send_message: "Povej prijatelju!"
+ mail_sent_to: "Sporočilo poslano na %{email} "
+ send_to_other: "Pošlji novemu prijatelju"
+ you_would_like_this: "%{sender_name} ti pošilja zanimivost s strani %{site}"
+
+ captcha:
+ captcha_settings: "CAPTCHA nastavitve"
+ public_key: "Javni ključ"
+ private_key: "Zasebni ključ"
+ manage_keys: "Uredi svoje (re)captcha ključe"
+ use_captcha: "Uporabi CAPTCHA zaščito?"
+ theme: "Tema"
@@ -2,7 +2,7 @@
Gem::Specification.new do |s|
s.platform = Gem::Platform::RUBY
s.name = 'spree_email_to_friend'
- s.version = '1.2'
+ s.version = '1.3'
s.summary = 'Spree extension to send product recommendations to friends'
s.description = 'Spree extension to send product recommendations to friends'
s.required_ruby_version = '>= 1.8.7'
@@ -15,7 +15,7 @@ Gem::Specification.new do |s|
s.require_paths = ["lib"]
s.requirements << 'none'
- s.add_dependency 'spree_core', '~> 1.2.0'
+ s.add_dependency 'spree_core', '~> 1.3.0'
s.add_dependency 'recaptcha', '>= 0.3.1'
s.add_development_dependency 'rspec-rails'
end

0 comments on commit 62f40f0

Please sign in to comment.