Skip to content

Commit

Permalink
Update admin layout for Spree v3.0.0.beta
Browse files Browse the repository at this point in the history
  • Loading branch information
futhr committed Jan 13, 2015
1 parent 5df4a83 commit 959e5b2
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 31 deletions.
50 changes: 25 additions & 25 deletions app/views/spree/admin/captcha_settings/edit.html.erb
Original file line number Diff line number Diff line change
@@ -1,46 +1,46 @@
<%= render partial: 'spree/admin/shared/configuration_menu' %>
<% content_for :page_title do %>
<%= Spree.t('captcha.captcha_settings') %>
<% end %>
<%= form_tag(admin_captcha_settings_path, method: :put) do |f| -%>

<fieldset class="no-border-top">
<fieldset>
<div data-hook="admin_captcha_settings" class="row">

<div class="field choices">
<label><%= Spree.t('captcha.use_captcha') %></label><br>
<%= label_tag do %>
<%= radio_button_tag 'preferences[use_captcha]', true, Spree::Captcha::Config[:use_captcha] %>
<%= Spree.t(:yes) %>
<% end %>
<%= label_tag do %>
<%= radio_button_tag 'preferences[use_captcha]', false, !Spree::Captcha::Config[:use_captcha] %>
<%= Spree.t(:no) %>
<% end %>
<div class="form-group choices">
<%= label_tag Spree.t('captcha.use_captcha') %>
<div class="inline-radio">
<%= label_tag do %>
<%= radio_button_tag 'preferences[use_captcha]', true, Spree::Captcha::Config[:use_captcha] %>
<%= Spree.t(:yes) %>
<% end %>
<%= label_tag do %>
<%= radio_button_tag 'preferences[use_captcha]', false, !Spree::Captcha::Config[:use_captcha] %>
<%= Spree.t(:no) %>
<% end %>
</div>
</div>

<div data-hook="public_key" class="field">
<label><%= Spree.t('captcha.public_key') %></label><br>
<%= text_field_tag('preferences[public_key]', Spree::Captcha::Config[:public_key], size: 40) %>
<div data-hook="public_key" class="form-group">
<%= label_tag Spree.t('captcha.public_key') %>
<%= text_field_tag 'preferences[public_key]', Spree::Captcha::Config[:public_key], class: 'control-form' %>
</div>

<div data-hook="private_key" class="field">
<label><%= Spree.t('captcha.private_key') %></label><br>
<%= text_field_tag('preferences[private_key]', Spree::Captcha::Config[:private_key], size: 40) %>
<div data-hook="private_key" class="form-group">
<%= label_tag Spree.t('captcha.private_key') %>
<%= text_field_tag 'preferences[private_key]', Spree::Captcha::Config[:private_key], class: 'control-form' %>
</div>

<div data-hook="private_key" class="field">
<label><%= Spree.t('captcha.theme') %>:</label><br>
<%= select_tag('preferences[theme]', options_for_select(Spree::CaptchaConfiguration::THEMES, Spree::Captcha::Config[:theme]), class: 'select2') %>
<div data-hook="theme" class="form-group">
<%= label_tag Spree.t('captcha.theme') %>
<%= 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 Spree.t(:update), 'icon-refresh' %>
<div class="form-actions actions" data-hook="buttons">
<%= button Spree.t(:update), 'update' %>
</div>

</fieldset>
Expand Down
9 changes: 3 additions & 6 deletions spec/features/admin/captcha_settings_spec.rb
Original file line number Diff line number Diff line change
@@ -1,22 +1,19 @@
RSpec.feature 'Admin Captcha Settings', :js, type: :feature do
RSpec.feature 'Admin Captcha Settings', :js do
stub_authorization!

context 'when update' do
background 'visits admin pannel' do
visit spree.admin_path
click_link 'Configuration'
visit spree.edit_admin_captcha_settings_path
end

scenario 'display Captcha Settings on front end' do
expect(page).to have_text 'Captcha Settings'.upcase
click_link 'Captcha Settings'
expect(page).to have_text 'Captcha Settings'
choose 'Yes'
click_button 'Update'
expect(find_field('Yes').value).not_to be_blank
end

scenario 'does not display Captcha Settings on frontend' do
click_link 'Captcha Settings'
choose 'No'
click_button 'Update'
expect(find_field('No').value).not_to be_blank
Expand Down

0 comments on commit 959e5b2

Please sign in to comment.