Permalink
Browse files

Version bump to 0.0.0

  • Loading branch information...
1 parent da243b8 commit a53a79670e9abeee60f381f2e81349b4294d05ff @kristianmandrup committed Mar 29, 2012
Showing with 87 additions and 16 deletions.
  1. +5 −5 .gitignore
  2. +6 −9 Gemfile
  3. +37 −0 Gemfile.lock
  4. +20 −2 README.rdoc
  5. +1 −0 VERSION
  6. +9 −0 lib/flasher.rb
  7. +9 −0 lib/flasher/rails_engine.rb
View
@@ -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
View
15 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
View
@@ -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
View
@@ -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
View
@@ -0,0 +1 @@
+0.0.0
View
@@ -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)
@@ -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.