the_notification 0.0.1 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5bc2d717d5e0cc126b7c8dc93351f47fec2f1272
4
- data.tar.gz: 6eb52510b458ed2aed7d0370b55820b8bf62bec6
3
+ metadata.gz: 0f9f5b9ca91322370d894e56d4d3cd4153cd707a
4
+ data.tar.gz: da5515d0df3b16eb6cdaadef86a4e30c1bef38e5
5
5
  SHA512:
6
- metadata.gz: 64b1389ee3867e58dfcb6403014c1a0b5e48b93fb35e4528ac55e40d5aa4d572800a75e4db8f054d45aec3a00b9e986d06225ce937a8b231009db86a140ee4e5
7
- data.tar.gz: 37b5e61f3cbfa23aa3c365d9da9951dcad38cb4cde1ef51ed54e022ea17c71ca122c16f12723335076e63efeac726251a072e1f18fd3cd602e9cb704f482330c
6
+ metadata.gz: 8b0c4ca58a9ee0054f746a55a010bbfec5968e730a2826abf7737899fa4d6cf1a35930a6a0a1dbcfe7e899328d89de3635bd261beb8727a2ab975044fd6d637d
7
+ data.tar.gz: f9678e61d0429f83b9c6d5eb03d9d246c788f3110a9e4577b1a9d7f6821163069ba98c9a2cee78369dfeaf33c82000a0a4e9da0ace2fef892e7e8fae3d836991
data/README.md CHANGED
@@ -46,29 +46,32 @@ and add to Layout
46
46
  <%= yield %>
47
47
  ```
48
48
 
49
+ *application.css*
50
+ ```js
51
+ *= require bootstrap
52
+ *= require the_notification/vendors/toastr
53
+ ```
54
+
49
55
  *application.js*
50
56
  ```js
51
57
  //= require the_notification/vendors/toastr
52
58
  //= require the_notification
53
- ```
54
59
 
55
- *application.css*
56
- ```js
57
- *= require bootstrap
58
- *= require the_notification/vendors/toastr
60
+ $ ->
61
+ TheNotification.show_notifications()
59
62
  ```
60
63
 
61
64
  ### HTML or JSON
62
65
 
63
66
  ```erb
64
- <%= render partial: 'the_notification/flash' locals: { format: :html } %>
67
+ <%= render partial: 'the_notification/flash', locals: { format: :html } %>
65
68
  <%= render partial: 'the_notification/form', locals: { object: @post, format: :html } %>
66
69
  ```
67
70
 
68
71
  or
69
72
 
70
73
  ```erb
71
- <%= render partial: 'the_notification/flash' locals: { format: :json } %>
74
+ <%= render partial: 'the_notification/flash', locals: { format: :json } %>
72
75
  <%= render partial: 'the_notification/form', locals: { object: @post, format: :json } %>
73
76
  ```
74
77
 
@@ -122,4 +125,4 @@ $ bundle
122
125
 
123
126
  ### Usage
124
127
 
125
- TODO: Write usage instructions here
128
+ TODO: Write usage instructions here
@@ -1,18 +1,21 @@
1
+ - flash = self.flash
1
2
  - format = (format || TheNotification.config.default_type).to_s
2
3
  - flash_types = %w[ notice alert error errors ]
3
4
 
4
5
  - if format == 'html'
5
6
  - flash_types.each do |level|
6
- - unless flash[level].blank?
7
+ - msg = flash.try(:[], level) || flash.try(:[], level.to_sym)
8
+ - if msg.present?
7
9
  .alert.flash_msgs class=flash_class(level)
8
- = content_tag :p, flash[level]
10
+ = content_tag :p, msg
9
11
  - else
10
- - unless flash.blank?
12
+ - if flash.present?
11
13
  = javascript_tag defer: :defer, type: "text/javascript" do
12
14
  | window.the_notifications = window.the_notifications || {};
13
15
  | window.the_notifications['flash'] = window.the_notifications['flash'] || {};
14
16
 
15
17
  - flash_types.each do |level|
16
- - unless flash[level].blank?
18
+ - msg = flash.try(:[], level) || flash.try(:[], level.to_sym)
19
+ - if msg.present?
17
20
  = javascript_tag defer: :defer, type: "text/javascript" do
18
- | window.the_notifications['flash']['#{ level }'] = JSON.parse('#{ raw j flash[level].to_json }');
21
+ | window.the_notifications['flash']['#{ level }'] = '#{ j msg }';
@@ -4,7 +4,7 @@
4
4
  - format = (format || TheNotification.config.default_type).to_s
5
5
 
6
6
  - if object.try(:errors).try(:any?)
7
- - _errors = object.try(:localized_errors) || object.errors
7
+ - _errors = object.respond_to?(:localized_errors) ? object.localized_errors : object.errors
8
8
  - if format == 'html'
9
9
  .error_explanation.alert.alert-danger
10
10
  h4= t "the_notification.form_errors"
data/gem_version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module TheNotification
2
- VERSION = "0.0.1"
2
+ VERSION = "0.5.0"
3
3
  end
@@ -8,9 +8,9 @@ Gem::Specification.new do |spec|
8
8
  spec.version = TheNotification::VERSION
9
9
  spec.authors = ["Ilya N. Zykin"]
10
10
  spec.email = ["zykin-ilya@ya.ru"]
11
- spec.description = %q{notifications and alerts}
11
+ spec.description = %q{Notifications and Alerts for Rails}
12
12
  spec.summary = %q{common code for notifications and alerts}
13
- spec.homepage = ""
13
+ spec.homepage = "https://github.com/TheProfitCMS/the_notification"
14
14
  spec.license = "MIT"
15
15
 
16
16
  spec.files = `git ls-files`.split($/)
@@ -18,8 +18,7 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
21
- spec.add_dependency 'slim'
22
-
23
21
  spec.add_development_dependency "bundler", "~> 1.3"
24
- spec.add_development_dependency "rake"
22
+ spec.add_development_dependency "rake", "~> 0"
23
+ spec.add_dependency 'slim', "~> 0"
25
24
  end
metadata CHANGED
@@ -1,58 +1,58 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: the_notification
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ilya N. Zykin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-28 00:00:00.000000000 Z
11
+ date: 2015-02-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: slim
14
+ name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
20
- type: :runtime
19
+ version: '1.3'
20
+ type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">="
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0'
26
+ version: '1.3'
27
27
  - !ruby/object:Gem::Dependency
28
- name: bundler
28
+ name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '1.3'
33
+ version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '1.3'
40
+ version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
- name: rake
42
+ name: slim
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ">="
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
- type: :development
48
+ type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ">="
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
- description: notifications and alerts
55
+ description: Notifications and Alerts for Rails
56
56
  email:
57
57
  - zykin-ilya@ya.ru
58
58
  executables: []
@@ -79,7 +79,7 @@ files:
79
79
  - lib/the_notification/config.rb
80
80
  - lib/the_notification/version.rb
81
81
  - the_notification.gemspec
82
- homepage: ''
82
+ homepage: https://github.com/TheProfitCMS/the_notification
83
83
  licenses:
84
84
  - MIT
85
85
  metadata: {}