box-cutter 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: b5038a44f23b9cc2cf8f8428fa0de25a824f5ddb
4
+ data.tar.gz: 1407440d4eef81443a9ca163c62d6853d0c85981
5
+ SHA512:
6
+ metadata.gz: 72466cd92071c8dba16b6efbb8a0775cabbbf20f8b957c942d85b4bf48378be3b8e73ec70bfdf5bf6e6df251ceab25c8b5d2475b03dec7a28b37ccaa56b042f5
7
+ data.tar.gz: 914a98ce49ca1dc7e97c03fc1325bbe7af3b0ec8af09b23dd66bf740bd47f1de6f70a95019864eff69f5a15dc0752a4a094494acc41006035bcb88468907a365
@@ -0,0 +1,19 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ .idea/
19
+ .DS_Store
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in box-cutter.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Ryan Buckley
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,57 @@
1
+ # Box Cutter
2
+
3
+ Adds a `box` helper method to your views. Comes complete with styles and options for any occasion!
4
+
5
+ ## Requirements
6
+
7
+ * >= Rails 3
8
+ * >= Ruby 1.9
9
+
10
+ ## Installation
11
+
12
+ Add this line to your application's Gemfile:
13
+
14
+ gem 'box-cutter', git: 'https://github.com/ridiculous/box-cutter'
15
+
16
+ And then execute:
17
+
18
+ $ bundle
19
+
20
+ Or install it yourself as:
21
+
22
+ $ gem install box-cutter
23
+
24
+ ## Usage
25
+
26
+ No bootstrap required, just add the styesheet to application.css:
27
+
28
+ require box-cutter
29
+
30
+ Now your ready to use it in your views:
31
+
32
+ <%= box(title: 'Welcome') do %>
33
+ # ...
34
+ <% end %>
35
+
36
+ Or, you can just use it as a box by passing no title (or options):
37
+
38
+ <%= box { 'Time to block out' } %>
39
+
40
+ Options:
41
+
42
+ title: '', # Title for the box
43
+ if: true, # Conditionally show the box
44
+ span: nil, # N/A unless you include Twitter Bootstraps .span* classes
45
+ class: nil, # Custom CSS classes
46
+ color: nil, # We have grey, purple, dark-purple, green, dark-green, white, blue, dark-blue, red, dark-red
47
+ offset: nil, #
48
+ padding: 20, # Padding for box
49
+ links: [] # Array of arrays: [['Home', root_path], ['Logout', logout_path]]
50
+
51
+ ## Contributing
52
+
53
+ 1. Fork it
54
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
55
+ 3. Commit your changes (`git commit -am 'Added some feature'`)
56
+ 4. Push to the branch (`git push origin my-new-feature`)
57
+ 5. Create new Pull Request
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
@@ -0,0 +1,441 @@
1
+ .well.compact {
2
+ padding-top: 0;
3
+ padding-bottom: 0;
4
+ }
5
+
6
+ .well-light {
7
+ display: block;
8
+ background-color: #f8fff3;
9
+ padding: 5px 20px;
10
+ line-height: 20px;
11
+ border: 1px solid #ddd;
12
+ -webkit-border-radius: 4px;
13
+ -moz-border-radius: 4px;
14
+ border-radius: 4px;
15
+ -webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.055);
16
+ -moz-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.055);
17
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.055);
18
+ -webkit-transition: all 0.2s ease-in-out;
19
+ -moz-transition: all 0.2s ease-in-out;
20
+ -o-transition: all 0.2s ease-in-out;
21
+ transition: all 0.2s ease-in-out;
22
+ margin-bottom: 10px;
23
+ }
24
+
25
+ .well-error {
26
+ display: block;
27
+ background-color: #ffd6d5;
28
+ padding: 5px 20px;
29
+ line-height: 20px;
30
+ border: 1px solid #ffc6c3;
31
+ -webkit-border-radius: 4px;
32
+ -moz-border-radius: 4px;
33
+ border-radius: 4px;
34
+ -webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.055);
35
+ -moz-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.055);
36
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.055);
37
+ -webkit-transition: all 0.2s ease-in-out;
38
+ -moz-transition: all 0.2s ease-in-out;
39
+ -o-transition: all 0.2s ease-in-out;
40
+ transition: all 0.2s ease-in-out;
41
+ margin-bottom: 10px;
42
+ }
43
+
44
+ .centered-block {
45
+ margin: 0 auto;
46
+ }
47
+
48
+ hr {
49
+ margin: 5px 0 10px 0;
50
+ border: 0;
51
+ border-top: 1px solid #ccc;
52
+ border-bottom: 1px solid #ffffff;
53
+ }
54
+
55
+ .width-50 {
56
+ width: 50%;
57
+ }
58
+
59
+ .form-hr {
60
+ margin: 30px 0 20px;
61
+ }
62
+
63
+ hr {
64
+ &.dotted {
65
+ margin: 30px 0 20px;
66
+ border: 0;
67
+ border-bottom: 1px dotted #CCCCCC;
68
+ }
69
+
70
+ &.dotted-short {
71
+ margin: 10px 0;
72
+ border: 0;
73
+ border-bottom: 1px dotted #CCCCCC;
74
+ }
75
+ }
76
+
77
+ .text-center, .center {
78
+ text-align: center !important;
79
+ }
80
+
81
+ .text-right {
82
+ text-align: right !important;
83
+ }
84
+
85
+ .text-left {
86
+ text-align: left !important;
87
+ }
88
+
89
+ .text-small {
90
+ font-size: 85%;
91
+ }
92
+
93
+ .flow-group {
94
+ margin-bottom: 10px;
95
+ border-bottom: 1px dotted #DDD;
96
+ padding-bottom: 10px;
97
+
98
+ label {
99
+ font-weight: bold;
100
+ }
101
+
102
+ &.last {
103
+ border: 0;
104
+ margin-bottom: 0;
105
+ }
106
+ }
107
+
108
+ .control-group label {
109
+ font-weight: none;
110
+ }
111
+
112
+ a.anchor {
113
+ position: relative;
114
+ top: 80px;
115
+ height: 2px;
116
+ }
117
+
118
+ label.radio {
119
+ cursor: pointer;
120
+ }
121
+
122
+ .document-highlight {
123
+ background-color: #d9edf7;
124
+ border: 1px solid #90a8d6;
125
+ border-width: 1px 0 1px 0;
126
+ }
127
+
128
+ a.animate:hover i {
129
+ text-decoration: none;
130
+ font-size: 170%;
131
+ position: relative;
132
+ left: -5px;
133
+ }
134
+
135
+ td.actions {
136
+ text-align: right;
137
+ }
138
+
139
+ td.actions {
140
+ a {
141
+ color: black;
142
+ }
143
+
144
+ a:hover {
145
+ color: #4b8c27;
146
+ text-decoration: none;
147
+ }
148
+ }
149
+
150
+ td.actions a:hover, td.action:hover {
151
+ background-color: transparent;
152
+ }
153
+
154
+ .required, .conditional {
155
+ font-size: 8pt;
156
+ }
157
+
158
+ .required {
159
+ color: #669ef7;
160
+ }
161
+
162
+ .conditional {
163
+ color: #f7b620;
164
+ }
165
+
166
+ .popover-title {
167
+ color: #000;
168
+ font-weight: bold;
169
+ font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
170
+ font-family: 13pt;
171
+ }
172
+
173
+ @mixin box($color) {
174
+ //background-color: $background;
175
+ $background: lighten($color, 55%);
176
+ $header-end: lighten($color, 15%);
177
+ background-color: $background;
178
+ border: 1px solid desaturate(darken($background, 15%), 10%);
179
+
180
+ color: darken($color, 20%);
181
+
182
+ .tab-header {
183
+ @include box-header($color);
184
+
185
+ a {
186
+ color: lighten($header-end, 20%);
187
+
188
+ &:hover {
189
+ color: lighten($header-end, 90%);
190
+ }
191
+ }
192
+ }
193
+
194
+ a {
195
+ color: $color;
196
+ border-bottom: 1px dotted $color;
197
+ text-decoration: none;
198
+
199
+ &:hover {
200
+ background-color: transparent;
201
+ border-bottom: 1px solid $color;
202
+ }
203
+ }
204
+
205
+ .actions a, .action a, a.action {
206
+ border: 0;
207
+ color: black;
208
+ &:hover {
209
+ background-color: transparent;
210
+ border: 0;
211
+ text-decoration: none;
212
+ }
213
+ }
214
+
215
+ &.link-list {
216
+ a {
217
+ border-bottom: 0;
218
+
219
+ &:hover {
220
+ border-bottom: 1px dotted $color;
221
+ }
222
+
223
+ [class^="icon-"], [class*="icon-"] {
224
+ margin-right: 5px;
225
+ }
226
+ }
227
+ }
228
+ }
229
+
230
+ @mixin box-header($color) {
231
+ color: #fff;
232
+ $header-end: lighten($color, 3%);
233
+ background: $color;
234
+ background-image: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgi…pZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbGw9InVybCgjZ3JhZCkiIC8+PC9zdmc+IA==');
235
+ background-size: 100%;
236
+ background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, $color), color-stop(100%, $header-end));
237
+ background-image: -webkit-linear-gradient(bottom, $header-end, $color);
238
+ background-image: -moz-linear-gradient(bottom, $header-end, $color);
239
+ background-image: -o-linear-gradient(bottom, $header-end, $color);
240
+ background-image: linear-gradient(bottom, $header-end, $color);
241
+ text-shadow: 0px 1px 1px fade-out($color, 0.25);
242
+ border-bottom: 1px solid darken($color, 10%);
243
+ }
244
+
245
+ .box.box-grey {
246
+ @include box(#F5F5F5);
247
+
248
+ .tab-header {
249
+ color: #666;
250
+ }
251
+ a {
252
+ color: #427d21;
253
+ }
254
+ }
255
+
256
+ .box {
257
+ -webkit-box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.3);
258
+ -moz-box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.3);
259
+ box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.3);
260
+ -webkit-border-radius: 5px;
261
+ -moz-border-radius: 5px;
262
+ -ms-border-radius: 5px;
263
+ -o-border-radius: 5px;
264
+ border-radius: 5px;
265
+ background: #f6f7fb;
266
+ border: 1px solid #d8d9dd;
267
+ border-width: 0 1px 1px 1px;
268
+ margin-bottom: 20px;
269
+
270
+ a {
271
+ color: black;
272
+ border-bottom: 1px dotted black;
273
+ text-decoration: none;
274
+
275
+ &:hover {
276
+ background-color: transparent;
277
+ border-bottom: 1px solid black;
278
+ }
279
+
280
+ &.qtip2:hover {
281
+ background-color: transparent;
282
+ color: black;
283
+ border-bottom: 0;
284
+ }
285
+ }
286
+ }
287
+
288
+ .box .tab-header,
289
+ .tab-header {
290
+ $green: #55a02a;
291
+ line-height: 32px;
292
+ height: 32px;
293
+ padding: 0 15px;
294
+ font-size: 14px;
295
+ color: #fff;
296
+ font-weight: bold;
297
+ -webkit-border-radius: 5px 5px;
298
+ -moz-border-radius: 5px 5px 0 0 / 5px 5px 0 0;
299
+ border-radius: 5px 5px 0 0 / 5px 5px 0 0;
300
+ background: #2a2a30;
301
+ background-image: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgi…pZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbGw9InVybCgjZ3JhZCkiIC8+PC9zdmc+IA==');
302
+ background-size: 100%;
303
+ background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, lighten($green, 15%)), color-stop(100%, $green));
304
+ background-image: -webkit-linear-gradient(top, lighten($green, 15%), $green);
305
+ background-image: -moz-linear-gradient(top, lighten($green, 15%), $green);
306
+ background-image: -o-linear-gradient(top, lighten($green, 15%), $green);
307
+ background-image: linear-gradient(top, lighten($green, 15%), $green);
308
+ -webkit-box-shadow: inset 0px 1px 0px rgba(255, 255, 255, 0.1);
309
+ -moz-box-shadow: inset 0px 1px 0px rgba(255, 255, 255, 0.1);
310
+ box-shadow: inset 0px 1px 0px rgba(255, 255, 255, 0.1);
311
+ border-bottom: 1px solid darken($green, 5%);
312
+ text-shadow: 0px 1px 1px #3A6F1E;
313
+ font-family: 'Scada', 'Telex', sans-serif;
314
+ font-size: 14pt;
315
+ font-weight: normal;
316
+ }
317
+
318
+ .box.box-green {
319
+ @include box(#55a02a);
320
+
321
+ a {
322
+ color: #427d21;
323
+ }
324
+ }
325
+
326
+ .box.box-dark-green {
327
+ @include box(#346119);
328
+
329
+ a {
330
+ color: #43af00;
331
+ &:hover {
332
+ background-color: lighten(#acf484, 15%);
333
+ }
334
+ }
335
+ }
336
+
337
+ .box.box-white {
338
+ @include box(#fff);
339
+ $link-hover-green: #427d21;
340
+ color: #333;
341
+
342
+ .tab-header {
343
+ color: #3e751f;
344
+
345
+ a {
346
+ color: #5cae2f;
347
+ &:hover {
348
+ color: #5cae2f;
349
+ background-color: transparent;
350
+ }
351
+ }
352
+ }
353
+
354
+ a {
355
+ color: $link-hover-green;
356
+ border-bottom: 1px dotted $link-hover-green;
357
+ &:hover {
358
+ color: $link-hover-green;
359
+ border-bottom: 1px solid $link-hover-green;
360
+ }
361
+ &.emphasis {
362
+ background-color: #d5fdc1;
363
+ }
364
+
365
+ &.btn {
366
+ color: white;
367
+ }
368
+ }
369
+
370
+ }
371
+
372
+ .box.box-purple {
373
+ @include box(#5d2b88);
374
+ }
375
+
376
+ .box.box-dark-purple {
377
+ @include box(#3d1b58);
378
+
379
+ a {
380
+ &:hover {
381
+ color: #d8b6fb;
382
+ background-color: #6f31a0;
383
+ }
384
+ }
385
+
386
+ .muted {
387
+ color: #79737e;
388
+ }
389
+ }
390
+
391
+ .box.box-blue {
392
+ @include box(#1b46ae);
393
+ }
394
+
395
+ .box.box-dark-blue {
396
+ @include box(#123074);
397
+ }
398
+
399
+ .box.box-red {
400
+ @include box(#cc0009);
401
+ }
402
+
403
+ .box.box-dark-red {
404
+ @include box(#940007);
405
+ }
406
+
407
+ .padded20 {
408
+ padding: 20px;
409
+ }
410
+
411
+ .padded10 {
412
+ padding: 10px 20px;
413
+ }
414
+
415
+ .padded5 {
416
+ padding: 5px 20px;
417
+ }
418
+
419
+ .box .tab-header .qtip2:hover {
420
+ background-color: transparent;
421
+ }
422
+
423
+ .tip-top {
424
+ cursor: pointer;
425
+ }
426
+
427
+ .qtip2-content {
428
+ display: none;
429
+ }
430
+
431
+ .box .ml5 {
432
+ margin-left: 5px;
433
+ }
434
+
435
+ .pull-right {
436
+ float: right;
437
+ }
438
+
439
+ .tab-header-right a {
440
+ font-size: 14px;
441
+ }
@@ -0,0 +1,17 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/box-cutter/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.authors = ["Ryan Buckley"]
6
+ gem.email = ["arebuckley@gmail.com"]
7
+ gem.description = %q{helper methods for creating boxes}
8
+ gem.summary = %q{Helper methods for creating boxes}
9
+ gem.homepage = ''
10
+
11
+ gem.files = `git ls-files`.split($\)
12
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
13
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
14
+ gem.name = "box-cutter"
15
+ gem.require_paths = ["lib"]
16
+ gem.version = Box::Cutter::VERSION
17
+ end
@@ -0,0 +1,5 @@
1
+ if defined? Rails
2
+ class Engine < Rails::Engine
3
+ end
4
+ require 'box-cutter/railtie'
5
+ end
@@ -0,0 +1,45 @@
1
+ module BoxCutter
2
+ module BoxHelpers
3
+ class BoxOptions
4
+
5
+ attr_reader :title, :if, :span, :klass, :color, :offset, :padding, :links
6
+
7
+ def initialize(options={})
8
+ @title = options[:title] || ''
9
+ @if = options[:if] || 1
10
+ @span = options[:span]
11
+ @span.try(:prepend, 'span')
12
+ @klass = options[:class]
13
+ @color = options[:color]
14
+ @color.try(:insert, 0, 'box-')
15
+ @offset = options[:offset]
16
+ @offset.try(:prepend, 'offset')
17
+ @padding = options[:padding] || 20
18
+ @links = options[:links]
19
+ @links = @links ? !options[:links][0].is_a?(Array) ? [@links] : @links : []
20
+ end
21
+ end
22
+
23
+ def box(options={}, &block)
24
+ opts = BoxOptions.new(options)
25
+
26
+ buffer = []
27
+ if opts.if
28
+ buffer << "<div class='#{opts.span}#{opts.offset}'><div>"
29
+ buffer << "<div class='box #{opts.color}#{opts.klass}'>"
30
+ if !opts.title.empty? || opts.links.any?
31
+ buffer << "<div class='tab-header'>#{opts.title}<div class='pull-right tab-header-right'><div class='space-right actions'>"
32
+ buffer << opts.links.map { |l| link_to(l[0], l[1], {class: 'ml5'}.merge(l[2] || {})) }
33
+ buffer << '</div></div></div>'
34
+ end
35
+ if block_given?
36
+ buffer << "<div class='box-content padded#{opts.padding}'>"
37
+ buffer << capture(&block)
38
+ buffer << '</div>'
39
+ end
40
+ buffer << '</div></div></div>'
41
+ end
42
+ buffer.flatten.join('').html_safe
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,9 @@
1
+ require_relative 'helpers/box_helpers'
2
+
3
+ module BoxCutter
4
+ class Railtie < Rails::Railtie
5
+ initializer "helpers.box_helpers" do |app|
6
+ ActionView::Base.send :include, BoxHelpers
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,5 @@
1
+ module Box
2
+ module Cutter
3
+ VERSION = '0.0.3'
4
+ end
5
+ end
metadata ADDED
@@ -0,0 +1,55 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: box-cutter
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.3
5
+ platform: ruby
6
+ authors:
7
+ - Ryan Buckley
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-04-07 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: helper methods for creating boxes
14
+ email:
15
+ - arebuckley@gmail.com
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - .gitignore
21
+ - Gemfile
22
+ - LICENSE
23
+ - README.md
24
+ - Rakefile
25
+ - app/assets/stylesheets/box-cutter.scss
26
+ - box-cutter.gemspec
27
+ - lib/box-cutter.rb
28
+ - lib/box-cutter/helpers/box_helpers.rb
29
+ - lib/box-cutter/railtie.rb
30
+ - lib/box-cutter/version.rb
31
+ homepage: ''
32
+ licenses: []
33
+ metadata: {}
34
+ post_install_message:
35
+ rdoc_options: []
36
+ require_paths:
37
+ - lib
38
+ required_ruby_version: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - '>='
41
+ - !ruby/object:Gem::Version
42
+ version: '0'
43
+ required_rubygems_version: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ requirements: []
49
+ rubyforge_project:
50
+ rubygems_version: 2.2.2
51
+ signing_key:
52
+ specification_version: 4
53
+ summary: Helper methods for creating boxes
54
+ test_files: []
55
+ has_rdoc: