volt-materialize-notices 0.0.1
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 +7 -0
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/README.md +45 -0
- data/Rakefile +1 -0
- data/VERSION +1 -0
- data/app/toast/config/dependencies.rb +1 -0
- data/app/toast/config/routes.rb +1 -0
- data/app/toast/controllers/notices_controller.rb +25 -0
- data/app/toast/views/notices/index.html +19 -0
- data/lib/volt/toast.rb +5 -0
- data/volt-notices.gemspec +25 -0
- metadata +97 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 2e67b8a54da2b2c7e6c803152cd0ec1131d7982a
|
4
|
+
data.tar.gz: 458cc05a4562b46d273ff7ee1f2f581b9b32b40e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 04c0f2bc1b47d9eb0099531d20bc2e1bd4a0f3a59af5d378a3ab85ab3d1281b86d4fb924b3a78b5addf22d655f4d87ce5c996a220ee967d0651369038f748b6a
|
7
|
+
data.tar.gz: 8e6baead2bffaa5c161abffc85f11fa5e9982828f8debd27a7a7af7c8e821d69a7b4f67c30bc3aaf1c5fd04b3f5e56553b9e30e818439814bec0d57de7f1b5c2
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
# Volt::Flash-Notices for Materialize
|
2
|
+
|
3
|
+
Utilizes toasts for flash messages with customizable css classes in Volt.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
This gem requires Volt -v '0.8.27.beta3' or higher and volt-materialize
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
gem 'volt-materialize-notices'
|
12
|
+
|
13
|
+
Add the toast component to your application's `app/main/config/dependencies.rb`:
|
14
|
+
|
15
|
+
component 'toast'
|
16
|
+
|
17
|
+
And then execute:
|
18
|
+
|
19
|
+
$ bundle
|
20
|
+
|
21
|
+
Replace `<:volt:notices />` inside `app/main/views/main/main.html` with:
|
22
|
+
|
23
|
+
<:toast:notices />
|
24
|
+
|
25
|
+
### Customizable CSS
|
26
|
+
|
27
|
+
The toasts have a default look with a black background, however you can customize them depending on their status:
|
28
|
+
|
29
|
+
`flash._successes << "Success Message"` -> `.toast.success{background-color: green;}`
|
30
|
+
|
31
|
+
`flash._warnings << "Warning Message"` -> `.toast.warning{background-color: orange;}`
|
32
|
+
|
33
|
+
`flash._errors << "Error Message"` -> `.toast.error{background-color: red;}`
|
34
|
+
|
35
|
+
`flash._notices << "Default Message"` -> `.toast.default{background-color: black;}`
|
36
|
+
|
37
|
+
The container style can be accessed through `#toast-container` which is good if you want to reposition it.
|
38
|
+
|
39
|
+
## Contributing
|
40
|
+
|
41
|
+
1. Fork it ( http://github.com/acapro/volt-materialize-notices/fork )
|
42
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
43
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
44
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
45
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.0.1
|
@@ -0,0 +1 @@
|
|
1
|
+
# Component dependencies
|
@@ -0,0 +1 @@
|
|
1
|
+
# Component routes
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Toast
|
2
|
+
class NoticesController < Volt::ModelController
|
3
|
+
def index
|
4
|
+
end
|
5
|
+
|
6
|
+
def call_toast(text, css_class)
|
7
|
+
`toast(text, 4000, css_class)`
|
8
|
+
end
|
9
|
+
|
10
|
+
def map_key_class(key)
|
11
|
+
case key
|
12
|
+
when 'errors'
|
13
|
+
'error'
|
14
|
+
when 'warnings'
|
15
|
+
'warning'
|
16
|
+
when 'successes'
|
17
|
+
'success'
|
18
|
+
else
|
19
|
+
# notices
|
20
|
+
'default'
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<:Body>
|
2
|
+
{{ if page._reloading }}
|
3
|
+
{{call_toast("Reloading...")}}
|
4
|
+
{{ end }}
|
5
|
+
{{ if channel.status == :reconnecting }}
|
6
|
+
{{call_toast("Connection Lost... Trying to reconnect.")}}
|
7
|
+
{{ end }}
|
8
|
+
{{ if page._reconnected }}
|
9
|
+
{{call_toast("Reconnected!")}}
|
10
|
+
{{ end }}
|
11
|
+
|
12
|
+
|
13
|
+
{{ flash.keys.each do |key| }}
|
14
|
+
{{ if flash.send(:"_#{key}").present? }}
|
15
|
+
{{ flash.send(:"_#{key}").each do |notice| }}
|
16
|
+
{{call_toast(notice, map_key_class(key))}}
|
17
|
+
{{ end }}
|
18
|
+
{{ end }}
|
19
|
+
{{ end }}
|
data/lib/volt/toast.rb
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
|
5
|
+
version = File.read(File.expand_path('../VERSION', __FILE__)).strip
|
6
|
+
|
7
|
+
|
8
|
+
Gem::Specification.new do |spec|
|
9
|
+
spec.name = "volt-materialize-notices"
|
10
|
+
spec.version = version
|
11
|
+
spec.authors = ["Adam Cooper"]
|
12
|
+
spec.email = ["mail@adamcooper.de"]
|
13
|
+
spec.summary = %q{Utilizes toasts for flash messages with customizable css classes in Volt.}
|
14
|
+
spec.homepage = ""
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0")
|
18
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
19
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
20
|
+
spec.require_paths = ["lib"]
|
21
|
+
|
22
|
+
spec.add_development_dependency "volt", '>= 0.8.27.beta3'
|
23
|
+
spec.add_development_dependency "volt-materialize"
|
24
|
+
spec.add_development_dependency "rake"
|
25
|
+
end
|
metadata
ADDED
@@ -0,0 +1,97 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: volt-materialize-notices
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Adam Cooper
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-03-05 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: volt
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.8.27.beta3
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.8.27.beta3
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: volt-materialize
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
description:
|
56
|
+
email:
|
57
|
+
- mail@adamcooper.de
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- ".gitignore"
|
63
|
+
- Gemfile
|
64
|
+
- README.md
|
65
|
+
- Rakefile
|
66
|
+
- VERSION
|
67
|
+
- app/toast/config/dependencies.rb
|
68
|
+
- app/toast/config/routes.rb
|
69
|
+
- app/toast/controllers/notices_controller.rb
|
70
|
+
- app/toast/views/notices/index.html
|
71
|
+
- lib/volt/toast.rb
|
72
|
+
- volt-notices.gemspec
|
73
|
+
homepage: ''
|
74
|
+
licenses:
|
75
|
+
- MIT
|
76
|
+
metadata: {}
|
77
|
+
post_install_message:
|
78
|
+
rdoc_options: []
|
79
|
+
require_paths:
|
80
|
+
- lib
|
81
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
82
|
+
requirements:
|
83
|
+
- - ">="
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
86
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - ">="
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: '0'
|
91
|
+
requirements: []
|
92
|
+
rubyforge_project:
|
93
|
+
rubygems_version: 2.2.2
|
94
|
+
signing_key:
|
95
|
+
specification_version: 4
|
96
|
+
summary: Utilizes toasts for flash messages with customizable css classes in Volt.
|
97
|
+
test_files: []
|