style-guide 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. data/.gitignore +1 -0
  2. data/.travis.yml +1 -1
  3. data/Gemfile.lock +6 -4
  4. data/README.md +1 -1
  5. data/app/assets/javascripts/style_guide/docs.js +7 -152
  6. data/app/assets/javascripts/style_guide/sidebar.js +18 -0
  7. data/app/assets/stylesheets/docs.css +153 -0
  8. data/app/assets/stylesheets/responsive.css +164 -0
  9. data/app/assets/stylesheets/style_guide/ars-maquette-web.css +35 -0
  10. data/app/assets/stylesheets/style_guide/example.css +20 -0
  11. data/app/assets/stylesheets/style_guide/footer.css +23 -0
  12. data/app/assets/stylesheets/style_guide/header.css +31 -0
  13. data/app/assets/stylesheets/style_guide/layout.css +69 -0
  14. data/app/assets/stylesheets/style_guide/navbar.css +141 -0
  15. data/app/assets/stylesheets/style_guide/sidebar.css +48 -0
  16. data/app/controllers/style_guide/style_controller.rb +8 -0
  17. data/app/views/layouts/style_guide/application.html.erb +14 -25
  18. data/app/views/style_guide/partials/_button_disabled_state.erb +2 -0
  19. data/app/views/style_guide/partials/_button_element.erb +2 -0
  20. data/app/views/style_guide/partials/_button_sizes.erb +16 -0
  21. data/app/views/style_guide/partials/_buttons.erb +51 -167
  22. data/app/views/style_guide/partials/_code_blocks.erb +12 -0
  23. data/app/views/style_guide/partials/_code_inline.erb +1 -0
  24. data/app/views/style_guide/style/_header.erb +3 -0
  25. data/app/views/style_guide/style/_sidebar.erb +2 -2
  26. data/app/views/style_guide/style/show.html.erb +18 -0
  27. data/config/routes.rb +1 -1
  28. data/lib/style_guide/section.rb +2 -2
  29. data/lib/style_guide/version.rb +1 -1
  30. data/spec/controllers/style_guide/style_controller_spec.rb +27 -0
  31. data/spec/dummy/app/assets/stylesheets/application.css +38 -2
  32. data/spec/dummy/app/assets/stylesheets/swatches.css +16 -0
  33. data/spec/dummy/app/views/styles/_00swatches.erb +8 -0
  34. data/spec/spec_helper.rb +4 -6
  35. data/style-guide.gemspec +1 -0
  36. metadata +39 -5
  37. data/app/assets/stylesheets/style_guide/docs.css +0 -1015
  38. data/app/views/style_guide/partials/_code.erb +0 -31
  39. data/app/views/style_guide/style/index.html.erb +0 -23
data/.gitignore CHANGED
@@ -10,3 +10,4 @@ spec/dummy/app/assets/.DS_Store
10
10
 
11
11
  spec/dummy/app/assets/stylesheets/.DS_Store
12
12
  /tmp
13
+ *.gem
data/.travis.yml CHANGED
@@ -3,7 +3,7 @@ rvm:
3
3
  script: script/ci.sh
4
4
  env:
5
5
  global:
6
- secure: "Qwe5ArAGqbJeTk//8mwd5GSHazoJ+3L5B/MxhI7Ixx7Oe+Jmr54xU2T+q8c1\nQaxYKuACVjtUF/1Os8AiYeNL4OMVG4b+Zg285NkgHf7ouhg+y6PFTEUerSyi\nzJWK/h7Jqsj392BU6Anr5mf+SmySp3kphjGxe9TsR/2DPJC4OoQ="
6
+ secure: "bQg1DmRx33r7EQTMcZlgc0F9o7q0puzF2ErTOQoZgZQCq5FHhKRwR+lHXmmb\ncolCx2CPrgGa9LT1pLNxApdZVhxLHMUa8Cd7vieem1Spr83km5VRx1CAIFLz\nOztkyIOpQ48ofbr5sJzP8tdV3pNRnFolCi68sbNKbFxIeXp2Zk0="
7
7
  after_script:
8
8
  - gem install heroku
9
9
  - git remote add heroku git@heroku.com:swivel.git
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- style-guide (0.0.1)
4
+ style-guide (0.1.0)
5
5
  jquery-rails
6
6
  rails
7
7
 
@@ -69,7 +69,7 @@ GEM
69
69
  railties (>= 3.0, < 5.0)
70
70
  thor (>= 0.14, < 2.0)
71
71
  json (1.7.5)
72
- libv8 (3.3.10.4)
72
+ libv8 (3.11.8.4)
73
73
  listen (0.6.0)
74
74
  lumberjack (1.0.2)
75
75
  mail (2.4.4)
@@ -110,6 +110,7 @@ GEM
110
110
  rb-fsevent (0.9.2)
111
111
  rdoc (3.12)
112
112
  json (~> 1.4)
113
+ ref (1.0.2)
113
114
  rspec (2.12.0)
114
115
  rspec-core (~> 2.12.0)
115
116
  rspec-expectations (~> 2.12.0)
@@ -132,8 +133,8 @@ GEM
132
133
  rack (~> 1.0)
133
134
  tilt (~> 1.1, != 1.3.0)
134
135
  terminal-notifier-guard (1.5.3)
135
- therubyracer (0.10.2)
136
- libv8 (~> 3.3.10)
136
+ therubyracer (0.11.0)
137
+ ref
137
138
  thor (0.16.0)
138
139
  tilt (1.3.3)
139
140
  treetop (1.4.12)
@@ -149,6 +150,7 @@ DEPENDENCIES
149
150
  guard-bundler
150
151
  guard-livereload
151
152
  guard-rspec
153
+ libv8
152
154
  rb-fsevent
153
155
  rspec-rails
154
156
  style-guide!
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # StyleGuide
2
2
 
3
- [![Build Status](https://secure.travis-ci.org/pivotalexperimental/style-guide.png?branch=master)](https://travis-ci.org/pivotalexperimental/style-guide)
3
+ [![Build Status](https://secure.travis-ci.org/pivotalexperimental/style-guide.png?branch=master)](https://travis-ci.org/pivotalexperimental/style-guide) [![Dependency Status](https://gemnasium.com/pivotalexperimental/style-guide.png)](https://gemnasium.com/pivotalexperimental/style-guide) [![Code Climate](https://codeclimate.com/badge.png)](https://codeclimate.com/github/pivotalexperimental/style-guide)
4
4
 
5
5
  Quickly see the styled output of your application.
6
6
 
@@ -1,154 +1,9 @@
1
- // NOTICE!! DO NOT USE ANY OF THIS JAVASCRIPT
2
- // IT'S ALL JUST JUNK FOR OUR DOCS!
3
- // ++++++++++++++++++++++++++++++++++++++++++
4
-
5
- !function ($) {
6
-
1
+ (function($) {
7
2
  $(function(){
3
+ $(".style-guide-example [href^=#]").click(function(e) {
4
+ e.preventDefault();
5
+ });
8
6
 
9
- var $window = $(window)
10
-
11
- // Disable certain links in docs
12
- $('section [href^=#]').click(function (e) {
13
- e.preventDefault()
14
- })
15
-
16
- // side bar
17
- $('.bs-docs-sidenav').affix({
18
- offset: {
19
- top: function () { return $window.width() <= 980 ? 290 : 210 }
20
- , bottom: 270
21
- }
22
- })
23
-
24
- // make code pretty
25
- window.prettyPrint && prettyPrint()
26
-
27
- // add-ons
28
- $('.add-on :checkbox').on('click', function () {
29
- var $this = $(this)
30
- , method = $this.attr('checked') ? 'addClass' : 'removeClass'
31
- $(this).parents('.add-on')[method]('active')
32
- })
33
-
34
- // add tipsies to grid for scaffolding
35
- if ($('#gridSystem').length) {
36
- $('#gridSystem').tooltip({
37
- selector: '.show-grid > div'
38
- , title: function () { return $(this).width() + 'px' }
39
- })
40
- }
41
-
42
- // tooltip demo
43
- $('.tooltip-demo').tooltip({
44
- selector: "a[rel=tooltip]"
45
- })
46
-
47
- $('.tooltip-test').tooltip()
48
- $('.popover-test').popover()
49
-
50
- // popover demo
51
- $("a[rel=popover]")
52
- .popover()
53
- .click(function(e) {
54
- e.preventDefault()
55
- })
56
-
57
- // button state demo
58
- $('#fat-btn')
59
- .click(function () {
60
- var btn = $(this)
61
- btn.button('loading')
62
- setTimeout(function () {
63
- btn.button('reset')
64
- }, 3000)
65
- })
66
-
67
- // carousel demo
68
- $('#myCarousel').carousel()
69
-
70
- // javascript build logic
71
- var inputsComponent = $("#components.download input")
72
- , inputsPlugin = $("#plugins.download input")
73
- , inputsVariables = $("#variables.download input")
74
-
75
- // toggle all plugin checkboxes
76
- $('#components.download .toggle-all').on('click', function (e) {
77
- e.preventDefault()
78
- inputsComponent.attr('checked', !inputsComponent.is(':checked'))
79
- })
80
-
81
- $('#plugins.download .toggle-all').on('click', function (e) {
82
- e.preventDefault()
83
- inputsPlugin.attr('checked', !inputsPlugin.is(':checked'))
84
- })
85
-
86
- $('#variables.download .toggle-all').on('click', function (e) {
87
- e.preventDefault()
88
- inputsVariables.val('')
89
- })
90
-
91
- // request built javascript
92
- $('.download-btn').on('click', function () {
93
-
94
- var css = $("#components.download input:checked")
95
- .map(function () { return this.value })
96
- .toArray()
97
- , js = $("#plugins.download input:checked")
98
- .map(function () { return this.value })
99
- .toArray()
100
- , vars = {}
101
- , img = ['glyphicons-halflings.png', 'glyphicons-halflings-white.png']
102
-
103
- $("#variables.download input")
104
- .each(function () {
105
- $(this).val() && (vars[ $(this).prev().text() ] = $(this).val())
106
- })
107
-
108
- $.ajax({
109
- type: 'POST'
110
- , url: /\?dev/.test(window.location) ? 'http://localhost:3000' : 'http://bootstrap.herokuapp.com'
111
- , dataType: 'jsonpi'
112
- , params: {
113
- js: js
114
- , css: css
115
- , vars: vars
116
- , img: img
117
- }
118
- })
119
- })
120
- })
121
-
122
- // Modified from the original jsonpi https://github.com/benvinegar/jquery-jsonpi
123
- $.ajaxTransport('jsonpi', function(opts, originalOptions, jqXHR) {
124
- var url = opts.url;
125
-
126
- return {
127
- send: function(_, completeCallback) {
128
- var name = 'jQuery_iframe_' + jQuery.now()
129
- , iframe, form
130
-
131
- iframe = $('<iframe>')
132
- .attr('name', name)
133
- .appendTo('head')
134
-
135
- form = $('<form>')
136
- .attr('method', opts.type) // GET or POST
137
- .attr('action', url)
138
- .attr('target', name)
139
-
140
- $.each(opts.params, function(k, v) {
141
-
142
- $('<input>')
143
- .attr('type', 'hidden')
144
- .attr('name', k)
145
- .attr('value', typeof v == 'string' ? v : JSON.stringify(v))
146
- .appendTo(form)
147
- })
148
-
149
- form.appendTo('body').submit()
150
- }
151
- }
152
- })
153
-
154
- }(window.jQuery)
7
+ window.prettyPrint && prettyPrint();
8
+ });
9
+ })(window.jQuery);
@@ -0,0 +1,18 @@
1
+ (function($){
2
+ var $window = $(window);
3
+ var $content = $(".style-guide-content");
4
+ var $sideBar = $(".style-guide-sidebar");
5
+ var contentTop = $content.offset().top;
6
+
7
+ function adjustScroll() {
8
+ var windowScrollTop = $window.scrollTop();
9
+
10
+ if (windowScrollTop > contentTop) {
11
+ $sideBar.addClass("style-guide-fixed");
12
+ } else {
13
+ $sideBar.removeClass("style-guide-fixed");
14
+ }
15
+ }
16
+
17
+ $window.scroll(function(){ setTimeout(adjustScroll, 1); });
18
+ })(window.jQuery);
@@ -0,0 +1,153 @@
1
+ /* Add additional stylesheets below
2
+ -------------------------------------------------- */
3
+ /*
4
+ Bootstrap's documentation styles
5
+ Special styles for presenting Bootstrap's documentation and examples
6
+ */
7
+
8
+
9
+
10
+
11
+
12
+
13
+ /* Special grid styles
14
+ -------------------------------------------------- */
15
+
16
+ .show-grid {
17
+ margin-top: 10px;
18
+ margin-bottom: 20px;
19
+ }
20
+ .show-grid [class*="span"] {
21
+ background-color: #eee;
22
+ text-align: center;
23
+ -webkit-border-radius: 3px;
24
+ -moz-border-radius: 3px;
25
+ border-radius: 3px;
26
+ min-height: 40px;
27
+ line-height: 40px;
28
+ }
29
+ .show-grid:hover [class*="span"] {
30
+ background: #ddd;
31
+ }
32
+ .show-grid .show-grid {
33
+ margin-top: 0;
34
+ margin-bottom: 0;
35
+ }
36
+ .show-grid .show-grid [class*="span"] {
37
+ background-color: #ccc;
38
+ }
39
+
40
+
41
+
42
+ /* Misc
43
+ -------------------------------------------------- */
44
+
45
+ /* Make tables spaced out a bit more */
46
+ h2 + table,
47
+ h3 + table,
48
+ h4 + table,
49
+ h2 + .row {
50
+ margin-top: 5px;
51
+ }
52
+
53
+ /* Fake the :focus state to demo it */
54
+ .focused {
55
+ border-color: rgba(82,168,236,.8);
56
+ -webkit-box-shadow: inset 0 1px 3px rgba(0,0,0,.1), 0 0 8px rgba(82,168,236,.6);
57
+ -moz-box-shadow: inset 0 1px 3px rgba(0,0,0,.1), 0 0 8px rgba(82,168,236,.6);
58
+ box-shadow: inset 0 1px 3px rgba(0,0,0,.1), 0 0 8px rgba(82,168,236,.6);
59
+ outline: 0;
60
+ }
61
+
62
+ /* For input sizes, make them display block */
63
+ .docs-input-sizes select,
64
+ .docs-input-sizes input[type=text] {
65
+ display: block;
66
+ margin-bottom: 9px;
67
+ }
68
+
69
+ /* Icons
70
+ ------------------------- */
71
+ .the-icons {
72
+ margin-left: 0;
73
+ list-style: none;
74
+ }
75
+ .the-icons li {
76
+ float: left;
77
+ width: 25%;
78
+ line-height: 25px;
79
+ }
80
+ .the-icons i:hover {
81
+ background-color: rgba(255,0,0,.25);
82
+ }
83
+
84
+
85
+
86
+ /* Responsive docs
87
+ -------------------------------------------------- */
88
+
89
+ /* Utility classes table
90
+ ------------------------- */
91
+ .responsive-utilities th small {
92
+ display: block;
93
+ font-weight: normal;
94
+ color: #999;
95
+ }
96
+ .responsive-utilities tbody th {
97
+ font-weight: normal;
98
+ }
99
+ .responsive-utilities td {
100
+ text-align: center;
101
+ }
102
+ .responsive-utilities td.is-visible {
103
+ color: #468847;
104
+ background-color: #dff0d8 !important;
105
+ }
106
+ .responsive-utilities td.is-hidden {
107
+ color: #ccc;
108
+ background-color: #f9f9f9 !important;
109
+ }
110
+
111
+ /* Responsive tests
112
+ ------------------------- */
113
+ .responsive-utilities-test {
114
+ margin-top: 5px;
115
+ margin-left: 0;
116
+ list-style: none;
117
+ overflow: hidden; /* clear floats */
118
+ }
119
+ .responsive-utilities-test li {
120
+ position: relative;
121
+ float: left;
122
+ width: 25%;
123
+ height: 43px;
124
+ font-size: 14px;
125
+ font-weight: bold;
126
+ line-height: 43px;
127
+ color: #999;
128
+ text-align: center;
129
+ border: 1px solid #ddd;
130
+ -webkit-border-radius: 4px;
131
+ -moz-border-radius: 4px;
132
+ border-radius: 4px;
133
+ }
134
+ .responsive-utilities-test li + li {
135
+ margin-left: 10px;
136
+ }
137
+ .responsive-utilities-test span {
138
+ position: absolute;
139
+ top: -1px;
140
+ left: -1px;
141
+ right: -1px;
142
+ bottom: -1px;
143
+ -webkit-border-radius: 4px;
144
+ -moz-border-radius: 4px;
145
+ border-radius: 4px;
146
+ }
147
+ .responsive-utilities-test span {
148
+ color: #468847;
149
+ background-color: #dff0d8;
150
+ border: 1px solid #d6e9c6;
151
+ }
152
+
153
+
@@ -0,0 +1,164 @@
1
+ @media (min-width: 1200px) {
2
+ .bs-docs-container {
3
+ max-width: 970px;
4
+ }
5
+ .bs-docs-sidenav {
6
+ width: 258px;
7
+ }
8
+ .bs-docs-sidenav > li > a {
9
+ }
10
+ }
11
+
12
+ @media (max-width: 980px) {
13
+ body > .navbar-fixed-top .brand {
14
+ float: left;
15
+ margin-left: 0;
16
+ padding-left: 10px;
17
+ padding-right: 10px;
18
+ }
19
+
20
+ .quick-links li {
21
+ display: inline-block;
22
+ margin: 5px;
23
+ }
24
+
25
+ .bs-docs-sidenav {
26
+ top: 0;
27
+ margin-top: 30px;
28
+ margin-right: 0;
29
+ }
30
+ }
31
+
32
+ @media (min-width: 768px) and (max-width: 980px) {
33
+ body {
34
+ padding-top: 0;
35
+ }
36
+ .jumbotron {
37
+ }
38
+ .bs-docs-sidenav {
39
+ width: 166px;
40
+ margin-top: 20px;
41
+ }
42
+ .bs-docs-sidenav.affix {
43
+ top: 0;
44
+ }
45
+ }
46
+
47
+ @media (max-width: 767px) {
48
+ body {
49
+ padding-top: 0;
50
+ }
51
+
52
+ .jumbotron {
53
+ padding: 40px 20px;
54
+ margin-right: -20px;
55
+ margin-left: -20px;
56
+ }
57
+ .masthead h1 {
58
+ font-size: 90px;
59
+ }
60
+ .masthead p,
61
+ .masthead .btn {
62
+ font-size: 24px;
63
+ }
64
+ .marketing .span4 {
65
+ margin-bottom: 40px;
66
+ }
67
+ .bs-docs-social {
68
+ margin: 0 -20px;
69
+ }
70
+
71
+ .show-grid [class*="span"] {
72
+ margin-bottom: 5px;
73
+ }
74
+
75
+ .bs-docs-sidenav {
76
+ width: auto;
77
+ margin-bottom: 20px;
78
+ }
79
+ .bs-docs-sidenav.affix {
80
+ position: static;
81
+ width: auto;
82
+ top: 0;
83
+ }
84
+
85
+ .footer {
86
+ margin-left: -20px;
87
+ margin-right: -20px;
88
+ padding-left: 20px;
89
+ padding-right: 20px;
90
+ }
91
+ .footer p {
92
+ margin-bottom: 9px;
93
+ }
94
+ }
95
+
96
+ @media (max-width: 480px) {
97
+ body {
98
+ padding-top: 0;
99
+ }
100
+
101
+ h2 small {
102
+ display: block;
103
+ }
104
+
105
+ .jumbotron h1 {
106
+ font-size: 45px;
107
+ }
108
+ .jumbotron p,
109
+ .jumbotron .btn {
110
+ font-size: 18px;
111
+ }
112
+ .jumbotron .btn {
113
+ display: block;
114
+ margin: 0 auto;
115
+ }
116
+
117
+ .subhead h1,
118
+ .subhead p {
119
+ text-align: center;
120
+ }
121
+
122
+ .marketing h1 {
123
+ font-size: 30px;
124
+ }
125
+ .marketing-byline {
126
+ font-size: 18px;
127
+ }
128
+
129
+ .example-sites {
130
+ margin-left: 0;
131
+ }
132
+ .example-sites > li {
133
+ float: none;
134
+ display: block;
135
+ max-width: 280px;
136
+ margin: 0 auto 18px;
137
+ text-align: center;
138
+ }
139
+ .example-sites .thumbnail > img {
140
+ max-width: 270px;
141
+ }
142
+
143
+ table code {
144
+ white-space: normal;
145
+ word-wrap: break-word;
146
+ word-break: break-all;
147
+ }
148
+
149
+ .modal-example .modal {
150
+ position: relative;
151
+ top: auto;
152
+ right: auto;
153
+ bottom: auto;
154
+ left: auto;
155
+ }
156
+
157
+ .footer {
158
+ padding-top: 20px;
159
+ padding-bottom: 20px;
160
+ }
161
+ .footer .pull-right {
162
+ float: none;
163
+ }
164
+ }