mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-13 19:54:02 +00:00
Use 'Feature's to toggle optional functionality
TODO: Wrap every incomplete project in a feature, and _turn it off_.
This commit is contained in:
parent
a7fce677fc
commit
0aa782711d
5 changed files with 19 additions and 3 deletions
4
Gemfile
4
Gemfile
|
|
@ -185,6 +185,10 @@ gem 'cloudinary'
|
|||
# for setting app configuration in the environment
|
||||
gem 'dotenv-rails'
|
||||
|
||||
# configurable toggles for functionality
|
||||
# https://github.com/mgsnova/feature
|
||||
gem 'feature'
|
||||
|
||||
# For countable.js
|
||||
gem "countable-rails", "~> 0.0.1"
|
||||
|
||||
|
|
|
|||
|
|
@ -179,6 +179,7 @@ GEM
|
|||
multipart-post (>= 1.2, < 3)
|
||||
fastimage (2.0.0)
|
||||
addressable (~> 2)
|
||||
feature (1.4.0)
|
||||
ffi (1.9.18)
|
||||
font-awesome-rails (4.7.0.2)
|
||||
railties (>= 3.2, < 5.2)
|
||||
|
|
@ -591,6 +592,7 @@ DEPENDENCIES
|
|||
dotenv-rails
|
||||
factory_girl_rails
|
||||
faker
|
||||
feature
|
||||
font-awesome-rails
|
||||
formtastic (~> 3.1.1)
|
||||
formtastic-bootstrap
|
||||
|
|
|
|||
|
|
@ -45,11 +45,10 @@ class RegistrationsController < Devise::RegistrationsController
|
|||
end
|
||||
|
||||
def check_captcha
|
||||
unless verify_recaptcha
|
||||
unless Feature.inactive?(:recaptcha) || verify_recaptcha
|
||||
self.resource = resource_class.new sign_up_params
|
||||
resource.validate # Look for any other validation errors besides Recaptcha
|
||||
respond_with_navigational(resource) { render :new }
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@
|
|||
= f.input :name, input_html: { required: true }, hint: 'This is your real name'
|
||||
= f.input :password, input_html: { required: true }
|
||||
= f.input :password_confirmation, input_html: { required: true }
|
||||
- Feature.with(:recaptcha) do
|
||||
= recaptcha_tags
|
||||
%p.text-right
|
||||
= f.action :submit, as: :button, label: 'Sign Up', button_html: { class: 'btn btn-success' }
|
||||
|
|
|
|||
10
config/initializers/feature.rb
Normal file
10
config/initializers/feature.rb
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
require 'feature'
|
||||
|
||||
repo = Feature::Repository::SimpleRepository.new
|
||||
|
||||
# configure features here
|
||||
unless(ENV['RECAPTCHA_SITE_KEY'].blank? || ENV['RECAPTCHA_SECRET_KEY'].blank?)
|
||||
repo.add_active_feature :recaptcha
|
||||
end
|
||||
|
||||
Feature.set_repository repo
|
||||
Loading…
Add table
Add a link
Reference in a new issue