toolsmith 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +38 -0
- data/README.md +49 -0
- data/Rakefile +6 -0
- data/app/assets/javascripts/toolsmith.coffee +1 -0
- data/app/assets/stylesheets/toolsmith-responsive.css.scss +3 -0
- data/app/assets/stylesheets/toolsmith.css.scss +2 -0
- data/app/assets/stylesheets/toolsmith/_variables.scss +217 -0
- data/lib/tasks/toolsmith_tasks.rake +4 -0
- data/lib/toolsmith.rb +17 -0
- data/lib/toolsmith/core_ext/array.rb +6 -0
- data/lib/toolsmith/engine.rb +9 -0
- data/lib/toolsmith/helpers/bootstrap_helpers.rb +19 -0
- data/lib/toolsmith/helpers/definition_list_helpers.rb +11 -0
- data/lib/toolsmith/helpers/grid_helpers.rb +23 -0
- data/lib/toolsmith/helpers/page_header_helpers.rb +17 -0
- data/lib/toolsmith/version.rb +3 -0
- data/lib/toolsmith/view_helpers.rb +13 -0
- data/lib/toolsmith/views/base.rb +27 -0
- data/lib/toolsmith/views/definition_list.rb +27 -0
- data/lib/toolsmith/views/flash_div.rb +51 -0
- data/lib/toolsmith/views/page_header.rb +56 -0
- metadata +195 -0
data/CHANGELOG.md
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
## v0.0.9
|
4
|
+
|
5
|
+
* Fix Definition List to include `dl-horizontal` class.
|
6
|
+
* Fix Page Header to be wrapped in a `page-header` class.
|
7
|
+
|
8
|
+
## v0.0.8
|
9
|
+
|
10
|
+
* Add default variable definitions.
|
11
|
+
|
12
|
+
## v0.0.7
|
13
|
+
|
14
|
+
* Allow rows, fullwidth columns, and page headers to get fluid-rows.
|
15
|
+
|
16
|
+
## v0.0.6
|
17
|
+
|
18
|
+
* Change functionality of Page Headers. Not backwards compatible.
|
19
|
+
|
20
|
+
## v0.0.5
|
21
|
+
|
22
|
+
* Fixes bug that broke JavaScripts
|
23
|
+
|
24
|
+
## v0.0.4
|
25
|
+
|
26
|
+
* Move stylesheets to app from vendor
|
27
|
+
|
28
|
+
## v0.0.3
|
29
|
+
|
30
|
+
* Change SCSS files to have .css.scss extension
|
31
|
+
|
32
|
+
## v0.0.2
|
33
|
+
|
34
|
+
* Misc. improvements
|
35
|
+
|
36
|
+
## v0.0.1
|
37
|
+
|
38
|
+
* Initial release
|
data/README.md
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
# Toolsmith
|
2
|
+
|
3
|
+
A crafty tool to craft crafty UI's.
|
4
|
+
|
5
|
+
### Install
|
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
|
+
In your projects gemfile, slap this in there:
|
19
|
+
|
20
|
+
```
|
21
|
+
gem "toolsmith", "~> 0.0.1"
|
22
|
+
```
|
23
|
+
|
24
|
+
Then...
|
25
|
+
|
26
|
+
```bundle install```
|
27
|
+
|
28
|
+
Profit.
|
29
|
+
|
30
|
+
|
31
|
+
### Usage
|
32
|
+
|
33
|
+
When including toolsmith CSS and JS, you automatically get Bootstrap for free.
|
34
|
+
|
35
|
+
#### CSS
|
36
|
+
|
37
|
+
In your application.scss file, include an import directive like so:
|
38
|
+
|
39
|
+
```sass
|
40
|
+
import "toolsmith";
|
41
|
+
```
|
42
|
+
|
43
|
+
You also have ```toolsmith-responsive``` has an option.
|
44
|
+
|
45
|
+
#### Javascript
|
46
|
+
|
47
|
+
```js
|
48
|
+
#= require toolsmith
|
49
|
+
```
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
#= require bootstrap
|
@@ -0,0 +1,217 @@
|
|
1
|
+
$black: #000;
|
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);
|
data/lib/toolsmith.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
require "toolsmith/view_helpers"
|
2
|
+
require "compass-rails"
|
3
|
+
require "bootstrap-sass"
|
4
|
+
require "toolsmith/engine" if defined?(Rails) && Rails.version >= "3.1"
|
5
|
+
|
6
|
+
require "toolsmith/core_ext/array"
|
7
|
+
|
8
|
+
module Toolsmith
|
9
|
+
module Views
|
10
|
+
autoload :Base, "toolsmith/views/base"
|
11
|
+
autoload :PageHeader, "toolsmith/views/page_header"
|
12
|
+
autoload :FlashDiv, "toolsmith/views/flash_div"
|
13
|
+
autoload :DefinitionList, "toolsmith/views/definition_list"
|
14
|
+
end
|
15
|
+
|
16
|
+
MissingParameter = Class.new(StandardError)
|
17
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Toolsmith
|
2
|
+
module ViewHelpers
|
3
|
+
module BootstrapHelpers
|
4
|
+
FLASH_LEVELS = [:success, :error, :notice]
|
5
|
+
|
6
|
+
def form_actions(&block)
|
7
|
+
content_tag(:div, class: "form-actions", &block)
|
8
|
+
end
|
9
|
+
|
10
|
+
def flash_divs
|
11
|
+
FLASH_LEVELS.map { |l| flash_div(l).to_s }.join.html_safe
|
12
|
+
end
|
13
|
+
|
14
|
+
def flash_div(level)
|
15
|
+
Toolsmith::Views::FlashDiv.new(self, level)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Toolsmith
|
2
|
+
module ViewHelpers
|
3
|
+
module GridHelpers
|
4
|
+
def row(options={}, &block)
|
5
|
+
row_class = options[:fluid] ? "row-fluid" : "row"
|
6
|
+
content_tag(:div, class: row_class, &block)
|
7
|
+
end
|
8
|
+
|
9
|
+
def column(width, options = {}, &block)
|
10
|
+
classes = %W[span#{width}]
|
11
|
+
classes << "offset#{options[:offset]}" if options[:offset]
|
12
|
+
|
13
|
+
content_tag(:div, class: classes, &block)
|
14
|
+
end
|
15
|
+
|
16
|
+
def full_width_column(options={}, &block)
|
17
|
+
row(options) do
|
18
|
+
column(12, &block)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Toolsmith
|
2
|
+
module ViewHelpers
|
3
|
+
module PageHeaderHelpers
|
4
|
+
def page_header(title, *args, &block)
|
5
|
+
options = args.extract_options!
|
6
|
+
subtitle = args.first
|
7
|
+
|
8
|
+
header = Toolsmith::Views::PageHeader.new(self, title, subtitle)
|
9
|
+
yield header if block_given?
|
10
|
+
|
11
|
+
full_width_column(options) do
|
12
|
+
header.to_s
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require "toolsmith/helpers/bootstrap_helpers"
|
2
|
+
require "toolsmith/helpers/grid_helpers"
|
3
|
+
require "toolsmith/helpers/page_header_helpers"
|
4
|
+
require "toolsmith/helpers/definition_list_helpers"
|
5
|
+
|
6
|
+
module Toolsmith
|
7
|
+
module ViewHelpers
|
8
|
+
include BootstrapHelpers
|
9
|
+
include GridHelpers
|
10
|
+
include PageHeaderHelpers
|
11
|
+
include DefinitionListHelpers
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Toolsmith
|
2
|
+
module Views
|
3
|
+
class Base
|
4
|
+
attr_reader :context
|
5
|
+
|
6
|
+
def initialize(context, &block)
|
7
|
+
@context = context
|
8
|
+
|
9
|
+
if block_given?
|
10
|
+
block.arity > 0 ? block.call(self) : yield
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def content_tag(*args, &block)
|
15
|
+
context.content_tag(*args, &block)
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def missing_parameter(key, params)
|
21
|
+
unless params[key]
|
22
|
+
raise Toolsmith::MissingParameter, "Missing parameter: #{key}"
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Toolsmith
|
2
|
+
module Views
|
3
|
+
class DefinitionList < Base
|
4
|
+
Definition = Struct.new(:term, :description)
|
5
|
+
|
6
|
+
def definitions
|
7
|
+
@definitions ||= []
|
8
|
+
end
|
9
|
+
|
10
|
+
def define(term, description)
|
11
|
+
definitions << Definition.new(term, description)
|
12
|
+
end
|
13
|
+
|
14
|
+
def to_s
|
15
|
+
content_tag :dl, list_body, class: "dl-horizontal"
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def list_body
|
21
|
+
definitions.map do |definition|
|
22
|
+
"#{content_tag :dt, definition.term}#{content_tag :dd, definition.description}".html_safe
|
23
|
+
end.html_join
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
module Toolsmith
|
2
|
+
module Views
|
3
|
+
class FlashDiv < Base
|
4
|
+
LEVEL_MAPPING = {
|
5
|
+
error: :error,
|
6
|
+
success: :success,
|
7
|
+
notice: :info
|
8
|
+
}
|
9
|
+
|
10
|
+
attr_reader :level
|
11
|
+
attr_reader :view_level
|
12
|
+
|
13
|
+
def initialize(context, level)
|
14
|
+
super(context)
|
15
|
+
@level = level
|
16
|
+
@view_level = LEVEL_MAPPING[level]
|
17
|
+
end
|
18
|
+
|
19
|
+
def to_s
|
20
|
+
if context.flash[level].present?
|
21
|
+
container do
|
22
|
+
close_link + context.flash[level].html_safe
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def close_link
|
28
|
+
context.link_to(
|
29
|
+
close_link_text,
|
30
|
+
"#",
|
31
|
+
class: "close",
|
32
|
+
data: {
|
33
|
+
dismiss: "alert"
|
34
|
+
}
|
35
|
+
)
|
36
|
+
end
|
37
|
+
|
38
|
+
def container
|
39
|
+
context.full_width_column do
|
40
|
+
content_tag :div, class: "alert alert-#{view_level}" do
|
41
|
+
yield
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def close_link_text
|
47
|
+
context.raw("×")
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
module Toolsmith
|
2
|
+
module Views
|
3
|
+
class PageHeader < Base
|
4
|
+
attr_accessor :title, :subtitle, :options
|
5
|
+
|
6
|
+
def initialize(context, title, *args)
|
7
|
+
super(context)
|
8
|
+
|
9
|
+
@options = args.extract_options!
|
10
|
+
@title = title
|
11
|
+
@subtitle = args.first
|
12
|
+
end
|
13
|
+
|
14
|
+
def button(options)
|
15
|
+
[:title, :icon, :path].each { |param| missing_parameter(param, options) }
|
16
|
+
buttons << options
|
17
|
+
end
|
18
|
+
|
19
|
+
def button_markup(options)
|
20
|
+
anchor_options = options.fetch(:anchor, {})
|
21
|
+
context.link_to options[:path], anchor_options.merge(class: "btn"), title: options[:title] do
|
22
|
+
content_tag :i, "", class: "icon-#{options[:icon]}"
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def buttons
|
27
|
+
@buttons ||= []
|
28
|
+
end
|
29
|
+
|
30
|
+
def full_title
|
31
|
+
subtitle ? "#{ERB::Util.h(title)} #{content_tag(:small, self.subtitle)}".html_safe : ERB::Util.h(title)
|
32
|
+
end
|
33
|
+
|
34
|
+
def to_s
|
35
|
+
content_tag :div, h1_tag, class: "page-header"
|
36
|
+
end
|
37
|
+
|
38
|
+
private
|
39
|
+
|
40
|
+
def h1_tag
|
41
|
+
content_tag(:h1) do
|
42
|
+
content_tag(:div, button_group, class: "pull-right") +
|
43
|
+
full_title
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def button_group
|
48
|
+
content_tag(:div, class: "btn-group") do
|
49
|
+
buttons.map do |button|
|
50
|
+
button_markup(button)
|
51
|
+
end.html_join
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
metadata
ADDED
@@ -0,0 +1,195 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: toolsmith
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.9
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Robert Ross
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-02-01 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rails
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 3.2.11
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 3.2.11
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: compass-rails
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ~>
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: 1.0.3
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 1.0.3
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: bootstrap-sass
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ~>
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: 2.2.2.0
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 2.2.2.0
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: rspec-rails
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ~>
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: 2.11.0
|
70
|
+
type: :development
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ~>
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: 2.11.0
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: guard-rspec
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ~>
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: 2.3.3
|
86
|
+
type: :development
|
87
|
+
prerelease: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ~>
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: 2.3.3
|
94
|
+
- !ruby/object:Gem::Dependency
|
95
|
+
name: rb-fsevent
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
98
|
+
requirements:
|
99
|
+
- - ~>
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: 0.9.1
|
102
|
+
type: :development
|
103
|
+
prerelease: false
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ~>
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: 0.9.1
|
110
|
+
- !ruby/object:Gem::Dependency
|
111
|
+
name: nokogiri
|
112
|
+
requirement: !ruby/object:Gem::Requirement
|
113
|
+
none: false
|
114
|
+
requirements:
|
115
|
+
- - ~>
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: 1.5.6
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
122
|
+
requirements:
|
123
|
+
- - ~>
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: 1.5.6
|
126
|
+
- !ruby/object:Gem::Dependency
|
127
|
+
name: awesome_print
|
128
|
+
requirement: !ruby/object:Gem::Requirement
|
129
|
+
none: false
|
130
|
+
requirements:
|
131
|
+
- - ! '>='
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
version: '0'
|
134
|
+
type: :development
|
135
|
+
prerelease: false
|
136
|
+
version_requirements: !ruby/object:Gem::Requirement
|
137
|
+
none: false
|
138
|
+
requirements:
|
139
|
+
- - ! '>='
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
version: '0'
|
142
|
+
description: Toolsmith provides common helpers for UI components and styles.
|
143
|
+
email:
|
144
|
+
- bobby@gophilosophie.com
|
145
|
+
executables: []
|
146
|
+
extensions: []
|
147
|
+
extra_rdoc_files: []
|
148
|
+
files:
|
149
|
+
- app/assets/javascripts/toolsmith.coffee
|
150
|
+
- app/assets/stylesheets/toolsmith/_variables.scss
|
151
|
+
- app/assets/stylesheets/toolsmith-responsive.css.scss
|
152
|
+
- app/assets/stylesheets/toolsmith.css.scss
|
153
|
+
- lib/tasks/toolsmith_tasks.rake
|
154
|
+
- lib/toolsmith/core_ext/array.rb
|
155
|
+
- lib/toolsmith/engine.rb
|
156
|
+
- lib/toolsmith/helpers/bootstrap_helpers.rb
|
157
|
+
- lib/toolsmith/helpers/definition_list_helpers.rb
|
158
|
+
- lib/toolsmith/helpers/grid_helpers.rb
|
159
|
+
- lib/toolsmith/helpers/page_header_helpers.rb
|
160
|
+
- lib/toolsmith/version.rb
|
161
|
+
- lib/toolsmith/view_helpers.rb
|
162
|
+
- lib/toolsmith/views/base.rb
|
163
|
+
- lib/toolsmith/views/definition_list.rb
|
164
|
+
- lib/toolsmith/views/flash_div.rb
|
165
|
+
- lib/toolsmith/views/page_header.rb
|
166
|
+
- lib/toolsmith.rb
|
167
|
+
- Rakefile
|
168
|
+
- README.md
|
169
|
+
- CHANGELOG.md
|
170
|
+
homepage: http://gophilosophie.com
|
171
|
+
licenses: []
|
172
|
+
post_install_message:
|
173
|
+
rdoc_options: []
|
174
|
+
require_paths:
|
175
|
+
- lib
|
176
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
177
|
+
none: false
|
178
|
+
requirements:
|
179
|
+
- - ! '>='
|
180
|
+
- !ruby/object:Gem::Version
|
181
|
+
version: '0'
|
182
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
183
|
+
none: false
|
184
|
+
requirements:
|
185
|
+
- - ! '>='
|
186
|
+
- !ruby/object:Gem::Version
|
187
|
+
version: '0'
|
188
|
+
requirements: []
|
189
|
+
rubyforge_project:
|
190
|
+
rubygems_version: 1.8.23
|
191
|
+
signing_key:
|
192
|
+
specification_version: 3
|
193
|
+
summary: A gem to craft UI's easily.
|
194
|
+
test_files: []
|
195
|
+
has_rdoc:
|