toolsmith 0.0.9 → 0.0.10
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.
- data/CHANGELOG.md +5 -0
- data/README.md +22 -15
- data/app/assets/stylesheets/toolsmith/_variables.scss +1 -217
- data/lib/toolsmith/helpers/definition_list_helpers.rb +18 -4
- data/lib/toolsmith/helpers/grid_helpers.rb +53 -0
- data/lib/toolsmith/version.rb +1 -1
- data/lib/toolsmith/views/definition_list.rb +12 -9
- metadata +12 -4
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -4,21 +4,10 @@ A crafty tool to craft crafty UI's.
|
|
4
4
|
|
5
5
|
### Install
|
6
6
|
|
7
|
-
In your gemfile, specify the private gem source. You can find our private source in http://know.gophilosophie.com
|
8
|
-
|
9
|
-
```ruby
|
10
|
-
if ENV["TOOLSMITH_GEM_URL"]
|
11
|
-
source ENV["TOOLSMITH_GEM_URL"]
|
12
|
-
else
|
13
|
-
raise "Missing ENV var \"TOOLSMITH_GEM_URL\". Please see the README"
|
14
|
-
end
|
15
|
-
|
16
|
-
```
|
17
|
-
|
18
7
|
In your projects gemfile, slap this in there:
|
19
8
|
|
20
9
|
```
|
21
|
-
gem "toolsmith"
|
10
|
+
gem "toolsmith"
|
22
11
|
```
|
23
12
|
|
24
13
|
Then...
|
@@ -30,7 +19,7 @@ Profit.
|
|
30
19
|
|
31
20
|
### Usage
|
32
21
|
|
33
|
-
When including toolsmith CSS and JS, you automatically get Bootstrap for free.
|
22
|
+
When including toolsmith CSS and JS, you automatically get the Bootstrap CSS / JS for free as well.
|
34
23
|
|
35
24
|
#### CSS
|
36
25
|
|
@@ -40,10 +29,28 @@ In your application.scss file, include an import directive like so:
|
|
40
29
|
import "toolsmith";
|
41
30
|
```
|
42
31
|
|
43
|
-
You also have ```toolsmith-responsive``` has an option.
|
32
|
+
You also have ```toolsmith-responsive``` has an option, which includes `bootstrap-responsive` and any other responsive designs provided.
|
44
33
|
|
45
34
|
#### Javascript
|
46
35
|
|
47
36
|
```js
|
48
37
|
#= require toolsmith
|
49
|
-
```
|
38
|
+
```
|
39
|
+
|
40
|
+
|
41
|
+
### What do I get?
|
42
|
+
|
43
|
+
Toolsmith's aim is to provide very common UI components with simple methods. Things like Page Headers, Flash messages, etc...
|
44
|
+
|
45
|
+
As an example:
|
46
|
+
|
47
|
+
```erb
|
48
|
+
<%= page_header "Projects", @project.name do |header| %>
|
49
|
+
<% header.button title: "Edit", path: edit_project_path(@project), icon: "pencil" %>
|
50
|
+
<% header.button title: "Delete", path: project_path(@project), icon: "trash", anchor: anchor: { method: :delete, confirm: "Are you sure?" } %>
|
51
|
+
<% end %>
|
52
|
+
|
53
|
+
```
|
54
|
+
|
55
|
+
Gives you something like this for free:
|
56
|
+

|
@@ -1,217 +1 @@
|
|
1
|
-
|
2
|
-
$grayDarker: #222;
|
3
|
-
$grayDark: #333;
|
4
|
-
$gray: #555;
|
5
|
-
$grayLight: #999;
|
6
|
-
$grayLighter: #eee;
|
7
|
-
$white: #fff;
|
8
|
-
|
9
|
-
$blue: #049cdb;
|
10
|
-
$blueDark: #0064cd;
|
11
|
-
$green: #46a546;
|
12
|
-
$red: #9d261d;
|
13
|
-
$yellow: #ffc40d;
|
14
|
-
$orange: #f89406;
|
15
|
-
$pink: #c3325f;
|
16
|
-
$purple: #7a43b6;
|
17
|
-
|
18
|
-
$bodyBackground: rgb(255, 255, 255);
|
19
|
-
$textColor: $grayDark;
|
20
|
-
|
21
|
-
$linkColor: #E22D60;
|
22
|
-
$linkColorHover: darken($linkColor, 15%);
|
23
|
-
|
24
|
-
|
25
|
-
$sansFontFamily: "Helvetica Neue", Helvetica, Arial, sans-serif;
|
26
|
-
$serifFontFamily: Georgia, "Times New Roman", Times, serif;
|
27
|
-
$monoFontFamily: Monaco, Menlo, Consolas, "Courier New", monospace;
|
28
|
-
|
29
|
-
$baseFontSize: 14px;
|
30
|
-
$baseFontFamily: $sansFontFamily;
|
31
|
-
$baseLineHeight: 20px;
|
32
|
-
$altFontFamily: $serifFontFamily;
|
33
|
-
|
34
|
-
$headingsFontFamily: inherit;
|
35
|
-
$headingsFontWeight: bold;
|
36
|
-
$headingsColor: inherit;
|
37
|
-
|
38
|
-
$fontSizeLarge: $baseFontSize * 1.25;
|
39
|
-
$fontSizeSmall: $baseFontSize * 0.85;
|
40
|
-
$fontSizeMini: $baseFontSize * 0.75;
|
41
|
-
|
42
|
-
$paddingLarge: 11px 19px;
|
43
|
-
$paddingSmall: 2px 10px;
|
44
|
-
$paddingMini: 0 6px;
|
45
|
-
|
46
|
-
$baseBorderRadius: 4px;
|
47
|
-
$borderRadiusLarge: 6px;
|
48
|
-
$borderRadiusSmall: 3px;
|
49
|
-
|
50
|
-
$tableBackground: transparent;
|
51
|
-
$tableBackgroundAccent: #f9f9f9;
|
52
|
-
$tableBackgroundHover: #f5f5f5;
|
53
|
-
$tableBorder: #ddd;
|
54
|
-
|
55
|
-
$btnBackground: $white;
|
56
|
-
$btnBackgroundHighlight: darken($white, 10%);
|
57
|
-
$btnBorder: #bbb;
|
58
|
-
|
59
|
-
$btnPrimaryBackground: #6d6d6d;
|
60
|
-
$btnPrimaryBackgroundHighlight: darken($btnPrimaryBackground, 10%);
|
61
|
-
|
62
|
-
$btnInfoBackground: #6d6d6d;
|
63
|
-
$btnInfoBackgroundHighlight: darken($btnInfoBackground, 10%);
|
64
|
-
|
65
|
-
$btnSuccessBackground: #6d6d6d;
|
66
|
-
$btnSuccessBackgroundHighlight: darken($btnSuccessBackground, 10%);
|
67
|
-
|
68
|
-
$btnWarningBackground: #E22D60;
|
69
|
-
$btnWarningBackgroundHighlight: darken($btnWarningBackground, 10%);
|
70
|
-
|
71
|
-
$btnDangerBackground: #E22D60;
|
72
|
-
$btnDangerBackgroundHighlight: darken($btnDangerBackground, 10%);
|
73
|
-
|
74
|
-
$btnInverseBackground: #444;
|
75
|
-
$btnInverseBackgroundHighlight: $grayDarker;
|
76
|
-
|
77
|
-
$inputBackground: $white;
|
78
|
-
$inputBorder: #ccc;
|
79
|
-
$inputBorderRadius: $baseBorderRadius;
|
80
|
-
$inputDisabledBackground: $grayLighter;
|
81
|
-
$formActionsBackground: #f5f5f5;
|
82
|
-
$inputHeight: $baseLineHeight + 10px;
|
83
|
-
|
84
|
-
$dropdownBackground: $white;
|
85
|
-
$dropdownBorder: rgba(0,0,0,.2);
|
86
|
-
$dropdownDividerTop: #e5e5e5;
|
87
|
-
$dropdownDividerBottom: $white;
|
88
|
-
|
89
|
-
$dropdownLinkColor: #6d6d6d;
|
90
|
-
$dropdownLinkColorHover: $white;
|
91
|
-
$dropdownLinkColorActive: $white;
|
92
|
-
|
93
|
-
$dropdownLinkBackgroundActive: #E22D60;
|
94
|
-
$dropdownLinkBackgroundHover: #E22D60;
|
95
|
-
|
96
|
-
$zindexDropdown: 1000;
|
97
|
-
$zindexPopover: 1010;
|
98
|
-
$zindexTooltip: 1030;
|
99
|
-
$zindexFixedNavbar: 1030;
|
100
|
-
$zindexModalBackdrop: 1040;
|
101
|
-
$zindexModal: 1050;
|
102
|
-
|
103
|
-
$placeholderText: $grayLight;
|
104
|
-
|
105
|
-
$hrBorder: $grayLighter;
|
106
|
-
$horizontalComponentOffset: 180px;
|
107
|
-
|
108
|
-
$wellBackground: #f5f5f5;
|
109
|
-
|
110
|
-
$navbarCollapseWidth: 900px;
|
111
|
-
$navbarCollapseDesktopWidth: $navbarCollapseWidth + 1;
|
112
|
-
|
113
|
-
$navbarHeight: 40px;
|
114
|
-
$navbarBackgroundHighlight: #202020;
|
115
|
-
$navbarBackground: darken($navbarBackgroundHighlight, 5%);
|
116
|
-
$navbarBorder: darken($navbarBackground, 12%);
|
117
|
-
|
118
|
-
$navbarText: #E22D60;
|
119
|
-
$navbarLinkColor: #6d6d6d;
|
120
|
-
$navbarLinkColorHover: #aaaaaa;
|
121
|
-
$navbarLinkColorActive: #E22D60;
|
122
|
-
$navbarLinkBackgroundHover: transparent;
|
123
|
-
$navbarLinkBackgroundActive: darken($navbarBackground, 5%);
|
124
|
-
|
125
|
-
$navbarBrandColor: #E22D60;
|
126
|
-
|
127
|
-
$navbarInverseBackground: #111111;
|
128
|
-
$navbarInverseBackgroundHighlight: #222222;
|
129
|
-
$navbarInverseBorder: #252525;
|
130
|
-
|
131
|
-
$navbarInverseText: $grayLight;
|
132
|
-
$navbarInverseLinkColor: $navbarLinkColor;
|
133
|
-
$navbarInverseLinkColorHover: $navbarLinkColorHover;
|
134
|
-
$navbarInverseLinkColorActive: $navbarLinkColorActive;
|
135
|
-
$navbarInverseLinkBackgroundHover: transparent;
|
136
|
-
$navbarInverseLinkBackgroundActive: $navbarInverseBackground;
|
137
|
-
|
138
|
-
$navbarInverseSearchBackground: lighten($navbarInverseBackground, 25%);
|
139
|
-
$navbarInverseSearchBackgroundFocus: $white;
|
140
|
-
$navbarInverseSearchBorder: $navbarInverseBackground;
|
141
|
-
$navbarInverseSearchPlaceholderColor: #ccc;
|
142
|
-
|
143
|
-
$navbarInverseBrandColor: $navbarBrandColor;
|
144
|
-
|
145
|
-
|
146
|
-
// Pagination
|
147
|
-
// -------------------------
|
148
|
-
$paginationBackground: #fff;
|
149
|
-
$paginationBorder: #ddd;
|
150
|
-
$paginationActiveBackground: #f5f5f5;
|
151
|
-
|
152
|
-
|
153
|
-
// Hero unit
|
154
|
-
// -------------------------
|
155
|
-
$heroUnitBackground: #F5F5F5;
|
156
|
-
$heroUnitHeadingColor: inherit;
|
157
|
-
$heroUnitLeadColor: inherit;
|
158
|
-
|
159
|
-
|
160
|
-
// Form states and alerts
|
161
|
-
// -------------------------
|
162
|
-
$warningText: #c09853;
|
163
|
-
$warningBackground: #fcf8e3;
|
164
|
-
$warningBorder: darken(adjust-hue($warningBackground, -10), 3%);
|
165
|
-
|
166
|
-
$errorText: #E22D60;
|
167
|
-
$errorBackground: #f9e3e9;
|
168
|
-
$errorBorder: darken(adjust-hue($errorBackground, -10), 3%);
|
169
|
-
|
170
|
-
$successText: #333333;
|
171
|
-
$successBackground: #ededed;
|
172
|
-
$successBorder: darken(adjust-hue($successBackground, -10), 5%);
|
173
|
-
|
174
|
-
$infoText: #333333;
|
175
|
-
$infoBackground: #ededed;
|
176
|
-
$infoBorder: darken(adjust-hue($infoBackground, -10), 7%);
|
177
|
-
|
178
|
-
|
179
|
-
// Tooltips and popovers
|
180
|
-
// -------------------------
|
181
|
-
$tooltipColor: #fff;
|
182
|
-
$tooltipBackground: #000;
|
183
|
-
$tooltipArrowWidth: 5px;
|
184
|
-
$tooltipArrowColor: $tooltipBackground;
|
185
|
-
|
186
|
-
$popoverBackground: #fff;
|
187
|
-
$popoverArrowWidth: 10px;
|
188
|
-
$popoverArrowColor: #fff;
|
189
|
-
$popoverTitleBackground: darken($popoverBackground, 3%);
|
190
|
-
|
191
|
-
// Special enhancement for popovers
|
192
|
-
$popoverArrowOuterWidth: $popoverArrowWidth + 1;
|
193
|
-
$popoverArrowOuterColor: rgba(0,0,0,.25);
|
194
|
-
|
195
|
-
|
196
|
-
$gridColumns: 12;
|
197
|
-
$gridColumnWidth: 60px;
|
198
|
-
$gridGutterWidth: 20px;
|
199
|
-
$gridRowWidth: ($gridColumns * $gridColumnWidth) + ($gridGutterWidth * ($gridColumns - 1));
|
200
|
-
|
201
|
-
$gridColumnWidth1200: 70px;
|
202
|
-
$gridGutterWidth1200: 30px;
|
203
|
-
$gridRowWidth1200: ($gridColumns * $gridColumnWidth1200) + ($gridGutterWidth1200 * ($gridColumns - 1));
|
204
|
-
|
205
|
-
$gridColumnWidth768: 42px;
|
206
|
-
$gridGutterWidth768: 20px;
|
207
|
-
$gridRowWidth768: ($gridColumns * $gridColumnWidth768) + ($gridGutterWidth768 * ($gridColumns - 1));
|
208
|
-
|
209
|
-
|
210
|
-
$fluidGridColumnWidth: percentage($gridColumnWidth/$gridRowWidth);
|
211
|
-
$fluidGridGutterWidth: percentage($gridGutterWidth/$gridRowWidth);
|
212
|
-
|
213
|
-
$fluidGridColumnWidth1200: percentage($gridColumnWidth1200/$gridRowWidth1200);
|
214
|
-
$fluidGridGutterWidth1200: percentage($gridGutterWidth1200/$gridRowWidth1200);
|
215
|
-
|
216
|
-
$fluidGridColumnWidth768: percentage($gridColumnWidth768/$gridRowWidth768);
|
217
|
-
$fluidGridGutterWidth768: percentage($gridGutterWidth768/$gridRowWidth768);
|
1
|
+
@import "bootstrap/variables";
|
@@ -1,10 +1,24 @@
|
|
1
1
|
module Toolsmith
|
2
2
|
module ViewHelpers
|
3
3
|
module DefinitionListHelpers
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
4
|
+
# Generates a Definition List
|
5
|
+
#
|
6
|
+
# ```
|
7
|
+
# <%= definition_list do |dl| %>
|
8
|
+
# <%= dl.define "Name", "Robert Ross" %>
|
9
|
+
# <% end %>
|
10
|
+
# ```
|
11
|
+
#
|
12
|
+
# Will output:
|
13
|
+
#
|
14
|
+
# ```
|
15
|
+
# <dl class="dl-horizontal">
|
16
|
+
# <dt>Name</dt><dd>Robert Ross</dd>
|
17
|
+
# </dl>
|
18
|
+
# ```
|
19
|
+
#
|
20
|
+
def definition_list(options={}, &block)
|
21
|
+
Toolsmith::Views::DefinitionList.new(self, options, &block)
|
8
22
|
end
|
9
23
|
end
|
10
24
|
end
|
@@ -1,11 +1,46 @@
|
|
1
1
|
module Toolsmith
|
2
2
|
module ViewHelpers
|
3
3
|
module GridHelpers
|
4
|
+
|
5
|
+
# Generates a grid row.
|
6
|
+
#
|
7
|
+
# ```
|
8
|
+
# <%= row do %>
|
9
|
+
# Content
|
10
|
+
# <% end %>
|
11
|
+
# ```
|
12
|
+
# Will output:
|
13
|
+
#
|
14
|
+
# ```
|
15
|
+
# <div class="row">
|
16
|
+
# Content
|
17
|
+
# </div>
|
18
|
+
# ```
|
19
|
+
# @param options [Hash]
|
20
|
+
# @return [String] `<div class="row">Content</div>`
|
4
21
|
def row(options={}, &block)
|
5
22
|
row_class = options[:fluid] ? "row-fluid" : "row"
|
6
23
|
content_tag(:div, class: row_class, &block)
|
7
24
|
end
|
8
25
|
|
26
|
+
# Returns a grid column element.
|
27
|
+
#
|
28
|
+
# ```
|
29
|
+
# <%= column 12 do %>
|
30
|
+
# I'm in a column!
|
31
|
+
# <% end %>
|
32
|
+
# ```
|
33
|
+
# Will output:
|
34
|
+
#
|
35
|
+
# ```
|
36
|
+
# <div class="span12">
|
37
|
+
# I'm in a column!
|
38
|
+
# </div>
|
39
|
+
# ```
|
40
|
+
#
|
41
|
+
# @param width [Fixnum]
|
42
|
+
# @param options [Hash]
|
43
|
+
# @return [String]
|
9
44
|
def column(width, options = {}, &block)
|
10
45
|
classes = %W[span#{width}]
|
11
46
|
classes << "offset#{options[:offset]}" if options[:offset]
|
@@ -13,6 +48,24 @@ module Toolsmith
|
|
13
48
|
content_tag(:div, class: classes, &block)
|
14
49
|
end
|
15
50
|
|
51
|
+
# Create a row and fullwidth column (based on the standard 12 wide)
|
52
|
+
#
|
53
|
+
# ```
|
54
|
+
# <%= full_width_column do %>
|
55
|
+
# My more-to-love column.
|
56
|
+
# <% end %>
|
57
|
+
# ```
|
58
|
+
# Will output:
|
59
|
+
#
|
60
|
+
# ```
|
61
|
+
# <div class="row">
|
62
|
+
# <div class="span12">
|
63
|
+
# My more-to-love column.
|
64
|
+
# </div>
|
65
|
+
# </div>
|
66
|
+
# ```
|
67
|
+
# @see #row
|
68
|
+
# @see #column
|
16
69
|
def full_width_column(options={}, &block)
|
17
70
|
row(options) do
|
18
71
|
column(12, &block)
|
data/lib/toolsmith/version.rb
CHANGED
@@ -1,26 +1,29 @@
|
|
1
1
|
module Toolsmith
|
2
2
|
module Views
|
3
3
|
class DefinitionList < Base
|
4
|
-
|
4
|
+
DEFAULT_CLASS = "dl-horizontal"
|
5
5
|
|
6
|
-
|
7
|
-
|
6
|
+
attr_reader :content_block, :options
|
7
|
+
|
8
|
+
def initialize(context, options={}, &block)
|
9
|
+
@content_block = block if block_given?
|
10
|
+
@options = options
|
11
|
+
super(context, &nil)
|
8
12
|
end
|
9
13
|
|
10
14
|
def define(term, description)
|
11
|
-
|
15
|
+
content_tag(:dt, term) + content_tag(:dd, description || " ")
|
12
16
|
end
|
13
17
|
|
14
18
|
def to_s
|
15
|
-
|
19
|
+
content = context.capture(self, &content_block)
|
20
|
+
content_tag :dl, content, dl_options
|
16
21
|
end
|
17
22
|
|
18
23
|
private
|
19
24
|
|
20
|
-
def
|
21
|
-
|
22
|
-
"#{content_tag :dt, definition.term}#{content_tag :dd, definition.description}".html_safe
|
23
|
-
end.html_join
|
25
|
+
def dl_options
|
26
|
+
{ class: !options[:horizontal] ? DEFAULT_CLASS : "" }
|
24
27
|
end
|
25
28
|
end
|
26
29
|
end
|
metadata
CHANGED
@@ -1,32 +1,39 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: toolsmith
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.10
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Robert Ross
|
9
|
+
- Brendan Loudermilk
|
9
10
|
autorequire:
|
10
11
|
bindir: bin
|
11
12
|
cert_chain: []
|
12
|
-
date: 2013-02-
|
13
|
+
date: 2013-02-15 00:00:00.000000000 Z
|
13
14
|
dependencies:
|
14
15
|
- !ruby/object:Gem::Dependency
|
15
16
|
name: rails
|
16
17
|
requirement: !ruby/object:Gem::Requirement
|
17
18
|
none: false
|
18
19
|
requirements:
|
19
|
-
- -
|
20
|
+
- - ! '>='
|
20
21
|
- !ruby/object:Gem::Version
|
21
22
|
version: 3.2.11
|
23
|
+
- - <
|
24
|
+
- !ruby/object:Gem::Version
|
25
|
+
version: '4.1'
|
22
26
|
type: :runtime
|
23
27
|
prerelease: false
|
24
28
|
version_requirements: !ruby/object:Gem::Requirement
|
25
29
|
none: false
|
26
30
|
requirements:
|
27
|
-
- -
|
31
|
+
- - ! '>='
|
28
32
|
- !ruby/object:Gem::Version
|
29
33
|
version: 3.2.11
|
34
|
+
- - <
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: '4.1'
|
30
37
|
- !ruby/object:Gem::Dependency
|
31
38
|
name: compass-rails
|
32
39
|
requirement: !ruby/object:Gem::Requirement
|
@@ -142,6 +149,7 @@ dependencies:
|
|
142
149
|
description: Toolsmith provides common helpers for UI components and styles.
|
143
150
|
email:
|
144
151
|
- bobby@gophilosophie.com
|
152
|
+
- brendan@gophilosophie.com
|
145
153
|
executables: []
|
146
154
|
extensions: []
|
147
155
|
extra_rdoc_files: []
|