box_of_tricks 0.0.1 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -4,6 +4,30 @@ This gem contains a bunch of CSS classes and Rails helper methods that we rely u
4
4
 
5
5
  ## View Helpers
6
6
 
7
+ ### BoxOfTricks#title
8
+
9
+ ``` rhtml
10
+ # Sets the page title if passed an argument, otherwise returns the page title.
11
+ # # layouts/application.html.erb
12
+ # <DOCTYPE!>
13
+ # <html>
14
+ # <head>
15
+ # <title><%= title %></title>
16
+ # </head>
17
+ # <body>
18
+ # <%= yield %>
19
+ # </body>
20
+ # </html>
21
+ #
22
+ # # users/show.hmtl.erb
23
+ # <% title @user.username %>
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
29
+ ```
30
+
7
31
  ### BoxOfTricks#field
8
32
 
9
33
  ``` rhtml
@@ -16,8 +40,6 @@ This gem contains a bunch of CSS classes and Rails helper methods that we rely u
16
40
  </div>
17
41
  ```
18
42
 
19
-
20
-
21
43
  ### BoxOfTricks#actions
22
44
 
23
45
  ``` rhtml
@@ -40,4 +62,25 @@ This gem contains a bunch of CSS classes and Rails helper methods that we rely u
40
62
  <div id="some_div" class="vague_class">
41
63
  <a href="#">Click here</a>
42
64
  </div>
65
+ ```
66
+
67
+ ## CSS
68
+
69
+ ### HTML5 Reset Sheet
70
+
71
+ To include an HTML reset to your CSS, simply add the following to your application.css file:
72
+
73
+ ``` css
74
+ /*
75
+ *= require html5reset
76
+ */
77
+ ```
78
+
79
+ 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
+ classes that I constantly rely on.
81
+
82
+ ``` css
83
+ /*
84
+ *= require html5reset
85
+ */
43
86
  ```
@@ -1,7 +1,20 @@
1
- // Some common classes
1
+ // Text alignment
2
2
  .align_left{text-align: left}
3
3
  .align_center{text-align: center}
4
4
  .align_right{text-align: right}
5
+
6
+ // Floated
7
+ .float_left{float: left}
8
+ .float_right{float: right}
9
+
10
+ // Clearing floats
5
11
  .clear{clear:both}
6
12
  .clear_left{clear:left}
7
- .clear_right{clear:right}
13
+ .clear_right{clear:right}
14
+
15
+ // Hidden
16
+ .hidden{display:none;visibility: hidden;}
17
+
18
+ // Font styles
19
+ .serif{font-family: Times;}
20
+ .sans_serif{font-family: Arial;}
@@ -1,5 +1,25 @@
1
1
  module BoxOfTricksHelper
2
2
 
3
+ # Sets the page title if passed an argument, otherwise returns the page title.
4
+ # # layouts/application.html.erb
5
+ # <DOCTYPE!>
6
+ # <html>
7
+ # <head>
8
+ # <title><%= title %></title>
9
+ # </head>
10
+ # <body>
11
+ # <%= yield %>
12
+ # </body>
13
+ # </html>
14
+ #
15
+ # # users/show.hmtl.erb
16
+ # <% title @user.username %>
17
+ # Content may be passed as a block or as the first argument
18
+ # @author Gavin Morrice
19
+ def title(content = nil)
20
+ content ? @content = content : @content
21
+ end
22
+
3
23
  # Creates a div with class 'field'. All of the usual options may also be applied
4
24
  # here including the class argument.
5
25
  # <%= field "Hello", class: "my_field", id: "field_1" %>
@@ -1,5 +1,6 @@
1
1
  module BoxOfTricks
2
2
  class Engine < Rails::Engine
3
+ # no need to namespace this bad-boy
3
4
  # isolate_namespace BoxOfTricks
4
5
  end
5
6
  end
@@ -1,3 +1,3 @@
1
1
  module BoxOfTricks
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.4"
3
3
  end
@@ -1,6 +1,12 @@
1
1
  require 'test_helper'
2
2
 
3
3
  class BoxOfTricksHelperTest < ActionView::TestCase
4
+
5
+ test "title" do
6
+ title("Set Title")
7
+ assert_equal title, "Set Title"
8
+ end
9
+
4
10
  test "div_with_class" do
5
11
  assert_dom_equal %{<div class="user">Bodacious</div>},
6
12
  div_with_class(:user, "Bodacious")
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.1
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-11-04 00:00:00.000000000Z
12
+ date: 2011-11-05 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
16
- requirement: &70208968317680 !ruby/object:Gem::Requirement
16
+ requirement: &70348645952540 !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: *70208968317680
24
+ version_requirements: *70348645952540
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: sqlite3
27
- requirement: &70208968347720 !ruby/object:Gem::Requirement
27
+ requirement: &70348645952000 !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: *70208968347720
35
+ version_requirements: *70348645952000
36
36
  description: A collection of CSS classes and Rails helper methods. View the README
37
37
  for more info
38
38
  email:
@@ -102,12 +102,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
102
102
  - - ! '>='
103
103
  - !ruby/object:Gem::Version
104
104
  version: '0'
105
+ segments:
106
+ - 0
107
+ hash: 1241802162581579125
105
108
  required_rubygems_version: !ruby/object:Gem::Requirement
106
109
  none: false
107
110
  requirements:
108
111
  - - ! '>='
109
112
  - !ruby/object:Gem::Version
110
113
  version: '0'
114
+ segments:
115
+ - 0
116
+ hash: 1241802162581579125
111
117
  requirements: []
112
118
  rubyforge_project:
113
119
  rubygems_version: 1.8.11