Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
101 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
class Admin::CaptchaSettingsController < Admin::BaseController | ||
def update | ||
Spree::Captcha::Config.set(params[:preferences]) | ||
|
||
respond_to do |format| | ||
format.html { | ||
redirect_to admin_captcha_settings_path | ||
} | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
class CaptchaConfiguration < Configuration | ||
THEMES = ['red', 'white', 'blackglass', 'clean', 'custom'] | ||
|
||
# this keys works for localhost | ||
preference :private_key, :string, :default => '6LfIsgEAAAAAAGfB6Z0lEUtdL3GVuBkRa9cYlMZz' | ||
preference :public_key, :string, :default => '6LfIsgEAAAAAALpT20eiC3RslZQmmCbiNS-AUvSe' | ||
preference :theme, :string, :default => 'red' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<%= render :partial => '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(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> | ||
<% end -%> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<%= render :partial => '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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
module Spree::Captcha | ||
class Config < Spree::Config | ||
class << self | ||
def instance | ||
return nil unless ActiveRecord::Base.connection.tables.include?('configurations') | ||
CaptchaConfiguration.find_or_create_by_name("Captcha configuration") | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters