flash_it 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +30 -9
- data/flash_it.gemspec +1 -3
- data/lib/flash_it.rb +1 -1
- data/lib/flash_it/version.rb +1 -1
- metadata +4 -32
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6a84067f5dd08b1b7d820fe70a76f91223e7332c
|
4
|
+
data.tar.gz: 07846550ae97bf026652bcf47e9eff88014a4a79
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2c7c98c3dbcb1137d9bcfbe11eef02d870ff9ecf03142ed558375ac63c586bdb1de5d2d3202956b83667ecd6569286d90abc9f387c912815ab79385526c08785
|
7
|
+
data.tar.gz: 5a63d9cb8770252b91873ce98eb9f1a71bb0e6a1b2c95ae9fc6bd7085929491de4f355e029578d443f4a8a7dd5486335c59d0c8b7444ad30411a9372b08e4011
|
data/README.md
CHANGED
@@ -1,6 +1,7 @@
|
|
1
|
-
#
|
1
|
+
# flash_it
|
2
|
+
### Welcome to flash_it !
|
3
|
+
The long desired flash message translation helper
|
2
4
|
|
3
|
-
Welcome to flash_it - the flash helper for translating your flash messages with ease!
|
4
5
|
|
5
6
|
## Installation
|
6
7
|
|
@@ -13,25 +14,43 @@ gem 'flash_it'
|
|
13
14
|
|
14
15
|
## Usage
|
15
16
|
|
17
|
+
### Default usage
|
16
18
|
```ruby
|
17
19
|
class UsersController < ApplicationController
|
18
20
|
def update
|
19
21
|
if current_user.profile.update_attributes(user_params)
|
20
|
-
flash_it
|
21
|
-
|
22
|
+
flash_it :success
|
23
|
+
redirect_to :back
|
22
24
|
else
|
23
|
-
flash_it
|
25
|
+
flash_it :error
|
24
26
|
render :edit
|
25
27
|
end
|
26
28
|
end
|
27
29
|
end
|
28
30
|
```
|
29
31
|
|
30
|
-
flash_it will make a lookup in your translation files for
|
32
|
+
flash_it will make a lookup in your translation files for
|
33
|
+
```yml
|
34
|
+
en:
|
35
|
+
flash_messages:
|
36
|
+
users:
|
37
|
+
update:
|
38
|
+
success: This was sucessfully
|
39
|
+
error: Oops, there was something wrong
|
40
|
+
```
|
41
|
+
|
31
42
|
|
32
|
-
|
43
|
+
### Advanced usage
|
33
44
|
|
34
|
-
|
45
|
+
By default, the type of the flash message is `success` if the argument was not `:error`.
|
46
|
+
You can change this behavior and set the type of the flash message by passing a second argument.
|
47
|
+
``flash_it :success, :notice`` then will be a ``flash[:notice]``
|
48
|
+
|
49
|
+
Also you can do something like ``flash_it(:attention, :warning)``
|
50
|
+
|
51
|
+
|
52
|
+
There is no need to give an argument ``:success`` this is the default lookup.
|
53
|
+
``flash_it`` is exactly equal to ``flash_it :success``
|
35
54
|
|
36
55
|
### Controller Namespacing
|
37
56
|
|
@@ -43,7 +62,9 @@ en:
|
|
43
62
|
admin:
|
44
63
|
users:
|
45
64
|
payment_history:
|
46
|
-
|
65
|
+
update:
|
66
|
+
success: "This was successfull!"
|
67
|
+
|
47
68
|
|
48
69
|
```
|
49
70
|
|
data/flash_it.gemspec
CHANGED
@@ -11,7 +11,7 @@ Gem::Specification.new do |spec|
|
|
11
11
|
|
12
12
|
spec.summary = "Helper for using translated flash messages with ease"
|
13
13
|
spec.description = "Helper for using translated flash messages with ease"
|
14
|
-
spec.homepage = "https://github.com/krtschmr/flash_it
|
14
|
+
spec.homepage = "https://github.com/krtschmr/flash_it"
|
15
15
|
|
16
16
|
# Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
|
17
17
|
# delete this section to allow pushing this gem to any host.
|
@@ -26,6 +26,4 @@ Gem::Specification.new do |spec|
|
|
26
26
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
27
27
|
spec.require_paths = ["lib"]
|
28
28
|
|
29
|
-
spec.add_development_dependency "bundler", "~> 1.10"
|
30
|
-
spec.add_development_dependency "rake", "~> 10.0"
|
31
29
|
end
|
data/lib/flash_it.rb
CHANGED
data/lib/flash_it/version.rb
CHANGED
metadata
CHANGED
@@ -1,43 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flash_it
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tim Kretschmer
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-09-
|
12
|
-
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: bundler
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - "~>"
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '1.10'
|
20
|
-
type: :development
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - "~>"
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '1.10'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: rake
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - "~>"
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '10.0'
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - "~>"
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '10.0'
|
11
|
+
date: 2015-09-28 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
41
13
|
description: Helper for using translated flash messages with ease
|
42
14
|
email:
|
43
15
|
- tim@krtschmr.de
|
@@ -55,7 +27,7 @@ files:
|
|
55
27
|
- flash_it.gemspec
|
56
28
|
- lib/flash_it.rb
|
57
29
|
- lib/flash_it/version.rb
|
58
|
-
homepage: https://github.com/krtschmr/flash_it
|
30
|
+
homepage: https://github.com/krtschmr/flash_it
|
59
31
|
licenses: []
|
60
32
|
metadata:
|
61
33
|
allowed_push_host: https://rubygems.org
|