box_of_tricks 0.0.4 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
data/README.md
CHANGED
@@ -6,26 +6,23 @@ This gem contains a bunch of CSS classes and Rails helper methods that we rely u
|
|
6
6
|
|
7
7
|
### BoxOfTricks#title
|
8
8
|
|
9
|
+
Sets the page title if passed an argument, otherwise returns the page title.
|
10
|
+
|
9
11
|
``` rhtml
|
10
|
-
|
11
|
-
#
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
#
|
23
|
-
|
24
|
-
# Content may be passed as a block or as the first argument
|
25
|
-
# @author Gavin Morrice
|
26
|
-
def title(content = nil)
|
27
|
-
content ? @content = content : @content
|
28
|
-
end
|
12
|
+
|
13
|
+
# layouts/application.html.erb
|
14
|
+
<!DOCTYPE>
|
15
|
+
<html>
|
16
|
+
<head>
|
17
|
+
<title><%= title %></title>
|
18
|
+
</head>
|
19
|
+
<body>
|
20
|
+
<%= yield %>
|
21
|
+
</body>
|
22
|
+
</html>
|
23
|
+
|
24
|
+
# users/show.hmtl.erb
|
25
|
+
<% title @user.username %>
|
29
26
|
```
|
30
27
|
|
31
28
|
### BoxOfTricks#field
|
@@ -76,11 +73,11 @@ To include an HTML reset to your CSS, simply add the following to your applicati
|
|
76
73
|
*/
|
77
74
|
```
|
78
75
|
|
79
|
-
There's also a file named [**box_of_tricks.css.scss
|
76
|
+
There's also a file named [**box_of_tricks.css.scss**](https://github.com/KatanaCode/box_of_tricks/blob/master/app/assets/stylesheets/box_of_tricks.css.scss) which comes with a bunch of CSS
|
80
77
|
classes that I constantly rely on.
|
81
78
|
|
82
79
|
``` css
|
83
80
|
/*
|
84
|
-
*= require
|
81
|
+
*= require box_of_tricks
|
85
82
|
*/
|
86
83
|
```
|
@@ -53,11 +53,18 @@ module BoxOfTricksHelper
|
|
53
53
|
content_tag(:div, *args, &block)
|
54
54
|
end
|
55
55
|
|
56
|
+
# Load a JS file if browser is Internet Explorer to ensure backward-compatibility
|
57
|
+
# of HTML5 elements
|
58
|
+
def html5_shim
|
59
|
+
%{<!--[if lt IE 9]><script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script><![endif]-->}.html_safe
|
60
|
+
end
|
61
|
+
|
56
62
|
|
57
63
|
private
|
58
64
|
|
59
65
|
# Create a div with default class. This is used as a helper to the other
|
60
|
-
# div helper methods
|
66
|
+
# div helper methods.
|
67
|
+
# @note This should be the first child of your document's head element
|
61
68
|
def div_with_class(*args, &block)
|
62
69
|
tag_with_class :div, *args, &block
|
63
70
|
end
|
@@ -48,4 +48,9 @@ class BoxOfTricksHelperTest < ActionView::TestCase
|
|
48
48
|
div(class: "muppet") { "Muppet 1" }
|
49
49
|
end
|
50
50
|
|
51
|
+
test "html5_shim" do
|
52
|
+
assert_dom_equal %{<!--[if lt IE 9]><script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script><![endif]-->},
|
53
|
+
html5_shim
|
54
|
+
end
|
55
|
+
|
51
56
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: box_of_tricks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2011-11-05 00:00:00.000000000Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
16
|
-
requirement: &
|
16
|
+
requirement: &70193675178700 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 3.1.1
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70193675178700
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: sqlite3
|
27
|
-
requirement: &
|
27
|
+
requirement: &70193675177920 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70193675177920
|
36
36
|
description: A collection of CSS classes and Rails helper methods. View the README
|
37
37
|
for more info
|
38
38
|
email:
|
@@ -104,7 +104,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
104
104
|
version: '0'
|
105
105
|
segments:
|
106
106
|
- 0
|
107
|
-
hash:
|
107
|
+
hash: 842224441413171138
|
108
108
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
109
109
|
none: false
|
110
110
|
requirements:
|
@@ -113,7 +113,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
113
113
|
version: '0'
|
114
114
|
segments:
|
115
115
|
- 0
|
116
|
-
hash:
|
116
|
+
hash: 842224441413171138
|
117
117
|
requirements: []
|
118
118
|
rubyforge_project:
|
119
119
|
rubygems_version: 1.8.11
|