zurb-awesome-buttons 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.mkd +15 -0
- data/lib/app_helper.rb +25 -0
- data/lib/awesome_buttons.rb +2 -0
- data/lib/engine.rb +10 -0
- data/lib/generators/awesome/USAGE +9 -0
- data/lib/generators/awesome/install_generator.rb +18 -0
- data/lib/generators/awesome/templates/awesome-overlay.png +0 -0
- data/lib/generators/awesome/templates/awesome.css +72 -0
- data/lib/generators/awesome/templates/awesome.sass +69 -0
- data/spec/application_helper_spec.rb +58 -0
- data/spec/spec_helper.rb +7 -0
- metadata +78 -0
data/README.mkd
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
packaging for styles from http://www.zurb.com/article/266/super-awesome-buttons-with-css3-and-rgba, with some helpers
|
2
|
+
|
3
|
+
to use, add the following to your Gemfile and run `bundle install`
|
4
|
+
|
5
|
+
gem "zurb-awesome-buttons", :require => "awesome_buttons"
|
6
|
+
|
7
|
+
to install static content, run
|
8
|
+
|
9
|
+
rake awesome:install
|
10
|
+
|
11
|
+
by default, that will install awesome.sass into your stylesheets/sass directory. if you want awesome.css instead, just pass `--css`
|
12
|
+
|
13
|
+
rake awesome:install --css
|
14
|
+
|
15
|
+
note that this is in no way official, these styles are property of zurb, I am not an employee of zurb, and this is subject to whatever license they happen to choose (currently there is a blog comment saying feel free to use these in your projects)
|
data/lib/app_helper.rb
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
module AppHelper
|
2
|
+
def awesome_button title, path=nil, o={}
|
3
|
+
html_options = {}.tap do |h|
|
4
|
+
size = case o[:size]
|
5
|
+
when nil then ''
|
6
|
+
when :s then 'small '
|
7
|
+
when :l then 'large '
|
8
|
+
end
|
9
|
+
hide = o[:hide] ? " hidden" : ""
|
10
|
+
klass = " " << o[:class].to_s unless o[:class].blank?
|
11
|
+
h[:class] = "#{size.to_s}awesome#{hide}#{klass}"
|
12
|
+
h[:onclick] = o[:onclick] << ';return false;' unless o[:onclick].blank?
|
13
|
+
end
|
14
|
+
|
15
|
+
link_to title, path || '', html_options
|
16
|
+
end
|
17
|
+
|
18
|
+
def awesome_submit o={}
|
19
|
+
klass = o[:class]
|
20
|
+
click = o[:onclick]
|
21
|
+
title = o[:title] || 'Create'
|
22
|
+
|
23
|
+
awesome_button title, nil, :class => klass, :onclick => [click, "$(this).parents('form').submit()"].compact.join(';')
|
24
|
+
end
|
25
|
+
end
|
data/lib/engine.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'rails'
|
2
|
+
require 'rails/generators'
|
3
|
+
|
4
|
+
module Awesome
|
5
|
+
class InstallGenerator < Rails::Generators::Base
|
6
|
+
source_root File.expand_path('../templates', __FILE__)
|
7
|
+
class_option :css, :type => :boolean, :default => false
|
8
|
+
|
9
|
+
def install
|
10
|
+
copy_file 'awesome-overlay.png', 'public/images/awesome.png'
|
11
|
+
if options.css?
|
12
|
+
copy_file 'awesome.css', 'public/stylesheets/awesome.css'
|
13
|
+
else
|
14
|
+
copy_file 'awesome.sass', 'public/stylesheets/sass/awesome.sass'
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
Binary file
|
@@ -0,0 +1,72 @@
|
|
1
|
+
.awesome, .awesome:visited {
|
2
|
+
background: #222222 url(/images/awesome-overlay.png) repeat-x;
|
3
|
+
display: inline-block;
|
4
|
+
padding: 5px 10px 6px;
|
5
|
+
color: white;
|
6
|
+
text-decoration: none;
|
7
|
+
-moz-border-radius: 5px;
|
8
|
+
-webkit-border-radius: 5px;
|
9
|
+
-moz-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
|
10
|
+
-webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
|
11
|
+
text-shadow: 0 -1px 1px rgba(0, 0, 0, 0.25);
|
12
|
+
border-bottom: 1px solid rgba(0, 0, 0, 0.25);
|
13
|
+
position: relative;
|
14
|
+
cursor: pointer; }
|
15
|
+
|
16
|
+
.awesome:hover {
|
17
|
+
background-color: #111111;
|
18
|
+
color: white; }
|
19
|
+
|
20
|
+
.awesome:active {
|
21
|
+
top: 1px; }
|
22
|
+
|
23
|
+
.small.awesome, .small.awesome:visited {
|
24
|
+
font-size: 11px;
|
25
|
+
padding: 5px; }
|
26
|
+
|
27
|
+
.awesome, .awesome:visited,
|
28
|
+
.medium.awesome, .medium.awesome:visited {
|
29
|
+
font-size: 13px;
|
30
|
+
font-weight: bold;
|
31
|
+
line-height: 1;
|
32
|
+
text-shadow: 0 -1px 1px rgba(0, 0, 0, 0.25); }
|
33
|
+
|
34
|
+
.large.awesome, .large.awesome:visited {
|
35
|
+
font-size: 14px;
|
36
|
+
padding: 8px 14px 9px; }
|
37
|
+
|
38
|
+
.green.awesome, .green.awesome:visited {
|
39
|
+
background-color: #91bd09; }
|
40
|
+
|
41
|
+
.green.awesome:hover {
|
42
|
+
background-color: #749a02; }
|
43
|
+
|
44
|
+
.blue.awesome, .blue.awesome:visited {
|
45
|
+
background-color: #2daebf; }
|
46
|
+
|
47
|
+
.blue.awesome:hover {
|
48
|
+
background-color: #007d9a; }
|
49
|
+
|
50
|
+
.red.awesome, .red.awesome:visited {
|
51
|
+
background-color: #e33100; }
|
52
|
+
|
53
|
+
.red.awesome:hover {
|
54
|
+
background-color: #872300; }
|
55
|
+
|
56
|
+
.magenta.awesome, .magenta.awesome:visited {
|
57
|
+
background-color: #a9014b; }
|
58
|
+
|
59
|
+
.magenta.awesome:hover {
|
60
|
+
background-color: #630030; }
|
61
|
+
|
62
|
+
.orange.awesome, .orange.awesome:visited {
|
63
|
+
background-color: #ff5c00; }
|
64
|
+
|
65
|
+
.orange.awesome:hover {
|
66
|
+
background-color: #d45500; }
|
67
|
+
|
68
|
+
.yellow.awesome, .yellow.awesome:visited {
|
69
|
+
background-color: #ffb515; }
|
70
|
+
|
71
|
+
.yellow.awesome:hover {
|
72
|
+
background-color: #fc9200; }
|
@@ -0,0 +1,69 @@
|
|
1
|
+
.awesome, .awesome:visited
|
2
|
+
background: #222 url(/images/awesome-overlay.png) repeat-x
|
3
|
+
display: inline-block
|
4
|
+
padding: 5px 10px 6px
|
5
|
+
color: #fff
|
6
|
+
text-decoration: none
|
7
|
+
-moz-border-radius: 5px
|
8
|
+
-webkit-border-radius: 5px
|
9
|
+
-moz-box-shadow: 0 1px 3px rgba(0,0,0,0.5)
|
10
|
+
-webkit-box-shadow: 0 1px 3px rgba(0,0,0,0.5)
|
11
|
+
text-shadow: 0 -1px 1px rgba(0,0,0,0.25)
|
12
|
+
border-bottom: 1px solid rgba(0,0,0,0.25)
|
13
|
+
position: relative
|
14
|
+
cursor: pointer
|
15
|
+
|
16
|
+
|
17
|
+
.awesome:hover
|
18
|
+
background-color: #111
|
19
|
+
color: #fff
|
20
|
+
.awesome:active
|
21
|
+
top: 1px
|
22
|
+
|
23
|
+
.small.awesome, .small.awesome:visited
|
24
|
+
font-size: 11px
|
25
|
+
padding: 5px
|
26
|
+
|
27
|
+
.awesome, .awesome:visited,
|
28
|
+
.medium.awesome, .medium.awesome:visited
|
29
|
+
font-size: 13px
|
30
|
+
font-weight: bold
|
31
|
+
line-height: 1
|
32
|
+
text-shadow: 0 -1px 1px rgba(0,0,0,0.25)
|
33
|
+
|
34
|
+
.large.awesome, .large.awesome:visited
|
35
|
+
font-size: 14px
|
36
|
+
padding: 8px 14px 9px
|
37
|
+
|
38
|
+
|
39
|
+
|
40
|
+
|
41
|
+
.green.awesome, .green.awesome:visited
|
42
|
+
background-color: #91bd09
|
43
|
+
.green.awesome:hover
|
44
|
+
background-color: #749a02
|
45
|
+
|
46
|
+
.blue.awesome, .blue.awesome:visited
|
47
|
+
background-color: #2daebf
|
48
|
+
.blue.awesome:hover
|
49
|
+
background-color: #007d9a
|
50
|
+
|
51
|
+
.red.awesome, .red.awesome:visited
|
52
|
+
background-color: #e33100
|
53
|
+
.red.awesome:hover
|
54
|
+
background-color: #872300
|
55
|
+
|
56
|
+
.magenta.awesome, .magenta.awesome:visited
|
57
|
+
background-color: #a9014b
|
58
|
+
.magenta.awesome:hover
|
59
|
+
background-color: #630030
|
60
|
+
|
61
|
+
.orange.awesome, .orange.awesome:visited
|
62
|
+
background-color: #ff5c00
|
63
|
+
.orange.awesome:hover
|
64
|
+
background-color: #d45500
|
65
|
+
|
66
|
+
.yellow.awesome, .yellow.awesome:visited
|
67
|
+
background-color: #ffb515
|
68
|
+
.yellow.awesome:hover
|
69
|
+
background-color: #fc9200
|
@@ -0,0 +1,58 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require '../app/lib/app_helper'
|
3
|
+
|
4
|
+
class H
|
5
|
+
include AppHelper
|
6
|
+
end
|
7
|
+
|
8
|
+
describe ApplicationHelper do
|
9
|
+
include HtmlStuff
|
10
|
+
|
11
|
+
before :each do
|
12
|
+
@h = H.new
|
13
|
+
end
|
14
|
+
|
15
|
+
describe "awesome_button" do
|
16
|
+
it "can set size to large" do
|
17
|
+
@h.awesome_button('foo', '', :size => :l).should =~ class_regex('large')
|
18
|
+
end
|
19
|
+
it "can set size to small" do
|
20
|
+
@h.awesome_button('foo', '', :size => :s).should =~ class_regex('small')
|
21
|
+
end
|
22
|
+
it "can set class" do
|
23
|
+
@h.awesome_button('foo', '', :class => 'bar').should =~ class_regex('bar')
|
24
|
+
end
|
25
|
+
it "sets an awesome class" do
|
26
|
+
has_awesome {@h.awesome_button '', ''}
|
27
|
+
end
|
28
|
+
it "is a link" do
|
29
|
+
@h.awesome_button('foo', '').should =~ is_a_tag('foo')
|
30
|
+
end
|
31
|
+
it "can set onclick" do
|
32
|
+
onclick {@h.awesome_button('foo', '', :onclick => 'bar;')}
|
33
|
+
end
|
34
|
+
|
35
|
+
it "has an optional href" do
|
36
|
+
@h.awesome_button('foo').should !~ /href=/
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
|
41
|
+
describe "awesome_submit" do
|
42
|
+
it "can set class" do
|
43
|
+
@h.awesome_submit(:class => 'bar').should =~ class_regex('bar')
|
44
|
+
end
|
45
|
+
it "can set title" do
|
46
|
+
@h.awesome_submit(:title => 'foo').should =~ is_a_tag('foo')
|
47
|
+
end
|
48
|
+
it "sets an awesome class" do
|
49
|
+
has_awesome {@h.awesome_submit}
|
50
|
+
end
|
51
|
+
it "is a link" do
|
52
|
+
@h.awesome_submit.should =~ is_a_tag('Create')
|
53
|
+
end
|
54
|
+
it "can set onclick" do
|
55
|
+
onclick {@h.awesome_submit(:onclick => 'bar')}
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,78 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: zurb-awesome-buttons
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 27
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
- 0
|
10
|
+
version: 0.1.0
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Matt Briggs
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2010-09-04 00:00:00 -04:00
|
19
|
+
default_executable:
|
20
|
+
dependencies: []
|
21
|
+
|
22
|
+
description:
|
23
|
+
email: matt@mattbriggs.net
|
24
|
+
executables: []
|
25
|
+
|
26
|
+
extensions: []
|
27
|
+
|
28
|
+
extra_rdoc_files:
|
29
|
+
- README.mkd
|
30
|
+
files:
|
31
|
+
- lib/app_helper.rb
|
32
|
+
- lib/awesome_buttons.rb
|
33
|
+
- lib/engine.rb
|
34
|
+
- lib/generators/awesome/USAGE
|
35
|
+
- lib/generators/awesome/install_generator.rb
|
36
|
+
- lib/generators/awesome/templates/awesome-overlay.png
|
37
|
+
- lib/generators/awesome/templates/awesome.css
|
38
|
+
- lib/generators/awesome/templates/awesome.sass
|
39
|
+
- README.mkd
|
40
|
+
- spec/application_helper_spec.rb
|
41
|
+
- spec/spec_helper.rb
|
42
|
+
has_rdoc: true
|
43
|
+
homepage: http://www.zurb.com/article/266/super-awesome-buttons-with-css3-and-rgba
|
44
|
+
licenses: []
|
45
|
+
|
46
|
+
post_install_message:
|
47
|
+
rdoc_options:
|
48
|
+
- --charset=UTF-8
|
49
|
+
require_paths:
|
50
|
+
- lib
|
51
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
52
|
+
none: false
|
53
|
+
requirements:
|
54
|
+
- - ">="
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
hash: 3
|
57
|
+
segments:
|
58
|
+
- 0
|
59
|
+
version: "0"
|
60
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
61
|
+
none: false
|
62
|
+
requirements:
|
63
|
+
- - ">="
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
hash: 3
|
66
|
+
segments:
|
67
|
+
- 0
|
68
|
+
version: "0"
|
69
|
+
requirements: []
|
70
|
+
|
71
|
+
rubyforge_project:
|
72
|
+
rubygems_version: 1.3.7
|
73
|
+
signing_key:
|
74
|
+
specification_version: 3
|
75
|
+
summary: packaging for styles from http://www.zurb.com/article/266/super-awesome-buttons-with-css3-and-rgba, with some helpers
|
76
|
+
test_files:
|
77
|
+
- spec/application_helper_spec.rb
|
78
|
+
- spec/spec_helper.rb
|