volt-string_as_key_combo 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +19 -0
- data/Gemfile +4 -0
- data/README.md +29 -0
- data/Rakefile +1 -0
- data/VERSION +1 -0
- data/app/string_as_key_combo/assets/css/key.css.scss +52 -0
- data/app/string_as_key_combo/controllers/main_controller.rb +23 -0
- data/app/string_as_key_combo/views/main/index.html +1 -0
- data/lib/volt/string_as_key_combo.rb +5 -0
- data/volt-string_as_key_combo.gemspec +25 -0
- metadata +83 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: a289125197bd694291116e506ca46d087a379507
|
4
|
+
data.tar.gz: 580739b12160887e7e326c3ce64cba08ad0e3a08
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 018c326dff0dff5ce60b63bc91d93e2346be98b3b9f2a6845589f8da3a519680a2312d22bce2412249f5b26e7c944618b8549793614cf5f462aa94f047b54d44
|
7
|
+
data.tar.gz: 229fa4c9a5ba7e993d7ace32a46afdd6c8115e424ccb81504c44fb848c7cc649da310d4b70dcc19caccdfe8b3e3eb179893f59d517ae3298369cdbbc1a205330
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# Volt::StringAsKeyCombo
|
2
|
+
|
3
|
+
Volt gem for displaying a string representing a combination of keypresses (e.g. "ctrl+alt+delete") as keyboard keys.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'volt-string_as_key_combo'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install volt-string_as_key_combo
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
```<:string_as_key_combo value="{{plus_separated_key_combination_string}}">```
|
22
|
+
|
23
|
+
## Contributing
|
24
|
+
|
25
|
+
1. Fork it ( http://bitbucket.com/neurordynamic/volt-string_as_key_combo/fork )
|
26
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
27
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
28
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
29
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
1.0.0
|
@@ -0,0 +1,52 @@
|
|
1
|
+
.keyboard-key.outer {
|
2
|
+
height: 32px;
|
3
|
+
padding: 1px 4px;
|
4
|
+
font-weight: bold;
|
5
|
+
color: gray;
|
6
|
+
background-color: lightgray;
|
7
|
+
display: inline-block;
|
8
|
+
font-family: monospace;
|
9
|
+
font-size: 14px;
|
10
|
+
line-height: 20px;
|
11
|
+
text-align: center;
|
12
|
+
vertical-align: middle;
|
13
|
+
white-space: nowrap;
|
14
|
+
box-sizing: border-box;
|
15
|
+
touch-action: manipulation;
|
16
|
+
margin: 2px;
|
17
|
+
|
18
|
+
-moz-border-radius: 4px;
|
19
|
+
-webkit-border-radius: 4px;
|
20
|
+
-khtml-border-radius: 4px;
|
21
|
+
border-radius: 4px;
|
22
|
+
|
23
|
+
.inner {
|
24
|
+
height: 25px;
|
25
|
+
padding: 3px 6px;
|
26
|
+
background-color: transparent;
|
27
|
+
border: 2px solid rgba(255,255,255,0.65);
|
28
|
+
font-size: 14px;
|
29
|
+
line-height: 14px;
|
30
|
+
text-align: center;
|
31
|
+
touch-action: manipulation;
|
32
|
+
vertical-align: middle;
|
33
|
+
white-space: nowrap;
|
34
|
+
min-width: 25px;
|
35
|
+
|
36
|
+
|
37
|
+
color: rgb(51, 51, 51);
|
38
|
+
display: inline-block;
|
39
|
+
|
40
|
+
|
41
|
+
-moz-border-radius: 3px;
|
42
|
+
-webkit-border-radius: 3px;
|
43
|
+
-khtml-border-radius: 3px;
|
44
|
+
border-radius: 3px;
|
45
|
+
}
|
46
|
+
|
47
|
+
&:active {
|
48
|
+
margin-top: 4px;
|
49
|
+
margin-bottom: 0px;
|
50
|
+
border-bottom: 1px solid transparent;
|
51
|
+
}
|
52
|
+
}
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module KeyboardKeys
|
2
|
+
class MainController < Volt::ModelController
|
3
|
+
|
4
|
+
def keys(plus_separated_key_combination_string)
|
5
|
+
combo = plus_separated_key_combination_string
|
6
|
+
|
7
|
+
if combo.nil?
|
8
|
+
[]
|
9
|
+
else
|
10
|
+
# makes sure the plus key is correctly read with
|
11
|
+
# the plus delimiters
|
12
|
+
inner_plus_subbed = combo.gsub(/\+\s*\+\s*\+/,'+plus+')
|
13
|
+
edge_plus_subbed = inner_plus_subbed.
|
14
|
+
sub(/^\s*\+\s*\+/,'plus+').
|
15
|
+
sub(/\+\s*\+\s*$/,'+plus')
|
16
|
+
|
17
|
+
strokes = edge_plus_subbed.split(/\s*\+\s*/)
|
18
|
+
plus_translated_strokes = strokes.map { |k| k == 'plus' ? '+' : k }
|
19
|
+
plus_translated_strokes.reject { |k| k.strip == '' }
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
{{ keys(attrs.value).each do |key| }}<div class='keyboard-key outer'><div class='inner'>{{ key }}</div></div>{{ end }}
|
@@ -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-string_as_key_combo"
|
10
|
+
spec.version = version
|
11
|
+
spec.authors = ["Neurodynamic"]
|
12
|
+
spec.email = ["developer@neurodynamic.io"]
|
13
|
+
spec.summary = %q{Volt gem for displaying a string representing a combination of keypresses (e.g. "ctrl+alt+delete") as keyboard keys.}
|
14
|
+
spec.description = %q{}
|
15
|
+
spec.homepage = ""
|
16
|
+
spec.license = "MIT"
|
17
|
+
|
18
|
+
spec.files = `git ls-files -z`.split("\x0")
|
19
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
20
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
21
|
+
spec.require_paths = ["lib"]
|
22
|
+
|
23
|
+
spec.add_development_dependency "volt", "~> 0.9.0"
|
24
|
+
spec.add_development_dependency "rake"
|
25
|
+
end
|
metadata
ADDED
@@ -0,0 +1,83 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: volt-string_as_key_combo
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Neurodynamic
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-04-29 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.9.0
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.9.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
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
|
+
description: ''
|
42
|
+
email:
|
43
|
+
- developer@neurodynamic.io
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- ".gitignore"
|
49
|
+
- Gemfile
|
50
|
+
- README.md
|
51
|
+
- Rakefile
|
52
|
+
- VERSION
|
53
|
+
- app/string_as_key_combo/assets/css/key.css.scss
|
54
|
+
- app/string_as_key_combo/controllers/main_controller.rb
|
55
|
+
- app/string_as_key_combo/views/main/index.html
|
56
|
+
- lib/volt/string_as_key_combo.rb
|
57
|
+
- volt-string_as_key_combo.gemspec
|
58
|
+
homepage: ''
|
59
|
+
licenses:
|
60
|
+
- MIT
|
61
|
+
metadata: {}
|
62
|
+
post_install_message:
|
63
|
+
rdoc_options: []
|
64
|
+
require_paths:
|
65
|
+
- lib
|
66
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
67
|
+
requirements:
|
68
|
+
- - ">="
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: '0'
|
71
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
requirements: []
|
77
|
+
rubyforge_project:
|
78
|
+
rubygems_version: 2.4.5
|
79
|
+
signing_key:
|
80
|
+
specification_version: 4
|
81
|
+
summary: Volt gem for displaying a string representing a combination of keypresses
|
82
|
+
(e.g. "ctrl+alt+delete") as keyboard keys.
|
83
|
+
test_files: []
|