Skip to content

Commit

Permalink
Version bump to 0.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
kristianmandrup committed Mar 29, 2012
1 parent da243b8 commit a53a796
Show file tree
Hide file tree
Showing 7 changed files with 87 additions and 16 deletions.
10 changes: 5 additions & 5 deletions .gitignore
Expand Up @@ -28,22 +28,22 @@ pkg
#
# For MacOS:
#
#.DS_Store
.DS_Store

# For TextMate
#*.tmproj
#tmtags
*.tmproj
tmtags

# For emacs:
#*~
#\#*
#.\#*

# For vim:
#*.swp
*.swp

# For redcar:
#.redcar
.redcar

# For rubinius:
#*.rbc
15 changes: 6 additions & 9 deletions Gemfile
@@ -1,14 +1,11 @@
source "http://rubygems.org"
# Add dependencies required to use your gem here.
# Example:
# gem "activesupport", ">= 2.3.5"
source :rubygems

# Add dependencies to develop your gem here.
# Include everything needed to run rake, tests, features, etc.
group :development do
gem "rspec", "~> 2.8.0"
gem "rdoc", "~> 3.12"
gem "bundler", "~> 1.0.0"
gem "jeweler", "~> 1.8.3"
gem "rcov", ">= 0"
gem "rspec", "~> 2.8.0"
gem "rdoc", "~> 3.12"
gem "bundler", ">= 1.0.0"
gem "jeweler", ">= 1.8.3"
gem "simplecov", ">= 0"
end
37 changes: 37 additions & 0 deletions Gemfile.lock
@@ -0,0 +1,37 @@
GEM
remote: http://rubygems.org/
specs:
diff-lcs (1.1.3)
git (1.2.5)
jeweler (1.8.3)
bundler (~> 1.0)
git (>= 1.2.5)
rake
rdoc
json (1.6.6)
multi_json (1.2.0)
rake (0.9.2.2)
rdoc (3.12)
json (~> 1.4)
rspec (2.8.0)
rspec-core (~> 2.8.0)
rspec-expectations (~> 2.8.0)
rspec-mocks (~> 2.8.0)
rspec-core (2.8.0)
rspec-expectations (2.8.0)
diff-lcs (~> 1.1.2)
rspec-mocks (2.8.0)
simplecov (0.6.1)
multi_json (~> 1.0)
simplecov-html (~> 0.5.3)
simplecov-html (0.5.3)

PLATFORMS
ruby

DEPENDENCIES
bundler (>= 1.0.0)
jeweler (>= 1.8.3)
rdoc (~> 3.12)
rspec (~> 2.8.0)
simplecov
22 changes: 20 additions & 2 deletions README.rdoc
@@ -1,6 +1,24 @@
= flasher
= Flasher

Description goes here.
Includes a small flasher helper in your base controller in order to do translations for flash messages using the Rails locale standard:

config/locales/flash/[controller]/[country_code].yml

Content of YAML flash translation file:

en:
flash:
redemptions:
success: "The voucher has been redeemed"
code_invalid: "Invalid voucher code"
code_already_used: "The voucher has already been redeemed"
unknown_voucher: "No voucher could be found for the reference no."

Then use it in your controller, here in the RedemptionsController

<%= flash_t('.success') %>

Enjoy!

== Contributing to flasher

Expand Down
1 change: 1 addition & 0 deletions VERSION
@@ -0,0 +1 @@
0.0.0
9 changes: 9 additions & 0 deletions lib/flasher.rb
@@ -0,0 +1,9 @@
module Flasher
module Translate
def flash_t(key)
t("flash.#{params[:controller].gsub('/', '.')}#{key}")
end
end
end

require 'flasher/rails_engine' if defined?(::Rails::Engine)
9 changes: 9 additions & 0 deletions lib/flasher/rails_engine.rb
@@ -0,0 +1,9 @@
module Flasher
class Engine < ::Rails::Engine

initializer "setup for rails" do
ActionController::Base.send(:include, Flasher::Translate)
end

end
end

0 comments on commit a53a796

Please sign in to comment.