Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Using flash :notice key everywhere now instead of :success and :failu…

…re. More in line with Rails conventions.
  • Loading branch information...
commit d955f096cc1377d53f1f7bd30dba76bfaa4fc9b9 1 parent b2cd877
@croaky croaky authored
View
1  CHANGELOG.md
@@ -3,6 +3,7 @@
* [#129] Denying access redirects to root_url when signed in, sign_in_url when signed out. (Dan Croak)
* New configuration setting: denied_access_url. (Dan Croak)
+* Using flash :notice key everywhere now instead of :success and :failure. More in line with Rails conventions. (Dan Croak)
0.11.2
-------------------
View
8 app/controllers/clearance/passwords_controller.rb
@@ -59,7 +59,7 @@ def forbid_non_existent_user
end
def flash_failure_when_forbidden
- flash.now[:failure] = translate(:forbidden,
+ flash.now[:notice] = translate(:forbidden,
:scope => [:clearance, :controllers, :passwords],
:default => "Please double check the URL or try submitting the form again.")
end
@@ -72,17 +72,17 @@ def flash_notice_after_create
end
def flash_failure_after_create
- flash.now[:failure] = translate(:unknown_email,
+ flash.now[:notice] = translate(:unknown_email,
:scope => [:clearance, :controllers, :passwords],
:default => "Unknown email.")
end
def flash_success_after_update
- flash[:success] = translate(:signed_in, :default => "Signed in.")
+ flash[:notice] = translate(:signed_in, :default => "Signed in.")
end
def flash_failure_after_update
- flash.now[:failure] = translate(:blank_password,
+ flash.now[:notice] = translate(:blank_password,
:scope => [:clearance, :controllers, :passwords],
:default => "Password can't be blank.")
end
View
6 app/controllers/clearance/sessions_controller.rb
@@ -29,13 +29,13 @@ def destroy
private
def flash_failure_after_create
- flash.now[:failure] = translate(:bad_email_or_password,
+ flash.now[:notice] = translate(:bad_email_or_password,
:scope => [:clearance, :controllers, :sessions],
:default => "Bad email or password.")
end
def flash_success_after_create
- flash[:success] = translate(:signed_in, :default => "Signed in.")
+ flash[:notice] = translate(:signed_in, :default => "Signed in.")
end
def url_after_create
@@ -43,7 +43,7 @@ def url_after_create
end
def flash_success_after_destroy
- flash[:success] = translate(:signed_out, :default => "Signed out.")
+ flash[:notice] = translate(:signed_out, :default => "Signed out.")
end
def url_after_destroy
View
6 app/controllers/clearance/users_controller.rb
@@ -13,7 +13,7 @@ def create
@user = ::User.new(params[:user])
if @user.save
sign_in(@user)
- flash_notice_after_create
+ flash_success_after_create
redirect_to(url_after_create)
else
flash_failure_after_create
@@ -23,14 +23,14 @@ def create
private
- def flash_notice_after_create
+ def flash_success_after_create
flash[:notice] = translate(:signed_up,
:scope => [:clearance, :controllers, :users],
:default => "You are now signed up.")
end
def flash_failure_after_create
- flash.now[:failure] = translate(:bad_email_or_password,
+ flash.now[:notice] = translate(:bad_email_or_password,
:scope => [:clearance, :controllers, :passwords],
:default => "Must be a valid email address. Password can't be blank.")
end
View
1  gemfiles/3.1.0.rc4.gemfile
@@ -19,4 +19,5 @@ gem "sass-rails"
gem "coffee-script"
gem "uglifier"
gem "jquery-rails"
+gem "turn"
View
4 gemfiles/3.1.0.rc4.gemfile.lock
@@ -53,6 +53,7 @@ GEM
activesupport (= 3.1.0.rc4)
activesupport (3.1.0.rc4)
multi_json (~> 1.0)
+ ansi (1.2.5)
arel (2.1.1)
aruba (0.4.3)
bcat (>= 0.6.1)
@@ -182,6 +183,8 @@ GEM
tilt (1.3.2)
treetop (1.4.9)
polyglot (>= 0.3.1)
+ turn (0.8.2)
+ ansi (>= 1.2.2)
tzinfo (0.3.28)
uglifier (0.5.4)
execjs (>= 0.3.0)
@@ -209,4 +212,5 @@ DEPENDENCIES
sass-rails
shoulda-matchers!
sqlite3
+ turn
uglifier
View
5 spec/controllers/passwords_controller_spec.rb
@@ -53,10 +53,7 @@
ActionMailer::Base.deliveries.should be_empty
end
- it "should set the failure flash to Unknown email" do
- flash.now[:failure].should =~ /unknown email/i
- end
-
+ it { should set_the_flash.to(/unknown email/i).now }
it { should render_template(:new) }
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.