vivus 0.0.4 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (33) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +52 -0
  3. data/app/assets/javascripts/vivus/application.js +28 -20
  4. data/app/assets/stylesheets/vivus/application.css.scss +2 -2
  5. data/app/assets/stylesheets/vivus/module/component.scss +106 -0
  6. data/app/assets/stylesheets/vivus/module/nav.scss +18 -23
  7. data/app/assets/stylesheets/vivus/module/section.scss +26 -0
  8. data/app/assets/stylesheets/vivus/module/syntax-highlighting.scss +30 -30
  9. data/app/controllers/vivus/styles_controller.rb +2 -11
  10. data/app/models/component.rb +13 -0
  11. data/app/models/stylesheet.rb +84 -9
  12. data/app/views/vivus/styles/_component.html.erb +22 -0
  13. data/app/views/vivus/styles/index.html.erb +32 -26
  14. data/config/routes.rb +0 -6
  15. data/lib/vivus/version.rb +1 -1
  16. metadata +35 -19
  17. data/README.rdoc +0 -0
  18. data/app/assets/fonts/DroidSansMono-webfont.eot +0 -0
  19. data/app/assets/fonts/DroidSansMono-webfont.svg +0 -248
  20. data/app/assets/fonts/DroidSansMono-webfont.ttf +0 -0
  21. data/app/assets/fonts/DroidSansMono-webfont.woff +0 -0
  22. data/app/assets/fonts/lmmono10-regular-webfont.eot +0 -0
  23. data/app/assets/fonts/lmmono10-regular-webfont.svg +0 -239
  24. data/app/assets/fonts/lmmono10-regular-webfont.ttf +0 -0
  25. data/app/assets/fonts/lmmono10-regular-webfont.woff +0 -0
  26. data/app/assets/stylesheets/vivus/core/typography.scss +0 -23
  27. data/app/assets/stylesheets/vivus/module/block.scss +0 -89
  28. data/app/helpers/vivus/application_helper.rb +0 -4
  29. data/app/models/block.rb +0 -21
  30. data/app/models/description.rb +0 -21
  31. data/app/models/example.rb +0 -25
  32. data/app/views/shared/_description.html.erb +0 -3
  33. data/app/views/shared/_example.html.erb +0 -9
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4b26453f767a461be30b9633bd194e6886a943a7
4
- data.tar.gz: da1761ef6d903eb45599c6a35d11ebd6ad7b16d8
3
+ metadata.gz: a66affde87ddb02379f5fc5189368b8a735f5fc8
4
+ data.tar.gz: e2091f6567c398970574f3de6249048fb84723b5
5
5
  SHA512:
6
- metadata.gz: d25ce19b32fd34f512ab47bc0b64d2b56547951af814f7eb93fb185da7261109a3c847f474a242c7a4c173aa8fe8b77456e427bfabe6b0117026f3a5fb870b12
7
- data.tar.gz: de318073341ba83255e2c8cc4ebef63210b90b441a02a4456131abe7dbdc1533cff5f6174a1759d75b0657da5e3d785032100c472bd6b1d067c67419fbe02096
6
+ metadata.gz: f34fe4a4b550ac8f1a6e3d65519578d2f354aaa09230d606e9b6159e4d0c43e16aed9ce16bdb695835af982a8afcbf0a6ee42474cebe4f53fbb45739001f46ec
7
+ data.tar.gz: 5d4113f3e35bb41cd53ab271b9a463c2a0ccbb1eda8bf1434a98f9067e7b2e267a979c0c448823a659b5a02ca5847b871e354d36bfc08685b56204de578ffde2
data/README.md ADDED
@@ -0,0 +1,52 @@
1
+ # Vivus Styleguide
2
+
3
+ ## Idea
4
+
5
+ Styleguides can be a pain to keep as a living documentation for your CSS.
6
+
7
+ By analysing the comments in your [SASS](http://sass-lang.com/) files, and by adding markdown to your stylesheets, you can generate a living, breathing documentation styleguide that has examples of how the CSS is used.
8
+
9
+ To get running, checkout the branch (it's still waaaay alpha) and add this to your Gemfile:
10
+ ```
11
+ gem 'vivus'
12
+ ```
13
+
14
+ Add this to your routes.rb
15
+ ```
16
+ if Rails.env.development?
17
+ mount Vivus::Engine, at: "styleguide"
18
+ end
19
+ ```
20
+
21
+ Then hit up ```localhost:3000/styleguide```
22
+
23
+ To document your CSS, use this as a template
24
+ ```
25
+ /*
26
+ [Name] The name of the component (e.g. Success Buttons)
27
+ [Section] A section that groups components together (e.g. Buttons)
28
+ [Description]
29
+
30
+ Write some documentation explaining the use / concept of the CSS
31
+ you've got below. This bit will be markdown rendered.
32
+
33
+ - You can use three backticks (`) to indicate a code block
34
+ - ```<div class="example"></div>```
35
+ - Code blocks will be syntax highlighted
36
+
37
+ When you've documented it nicely, use the Example markers to
38
+ indicate a block of HTML that uses the CSS.
39
+
40
+ Keeps your documentation right near the CSS.
41
+ So, if you update / refactor the CSS, update the HTML example if
42
+ need be.
43
+
44
+ [Example]
45
+ <div class="example">
46
+ <a href="#" class="button">Some text<a>
47
+ </div>
48
+ [Url] A web address pointing to further documentation / example (optional)
49
+ */
50
+ ```
51
+
52
+ This project rocks and uses MIT-LICENSE.
@@ -1,31 +1,30 @@
1
- // This is a manifest file that'll be compiled into application.js, which will include all the files
2
- // listed below.
3
- //
4
- // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
- // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
6
- //
7
- // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
- // the compiled file.
9
- //
10
- // WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
11
- // GO AFTER THE REQUIRES BELOW.
12
- //
13
1
  //= require jquery
14
2
  //= require highlight.pack
15
3
  //= require_tree .
16
4
 
17
5
  $(document).ready(function() {
18
- $('pre').each(function(i, el) {
19
- hljs.highlightBlock(el);
6
+ $('pre, code').each(function(i, el) {
7
+ hljs.highlightBlock(el);
20
8
  });
21
9
 
22
- $('code').each(function(i, el) {
23
- hljs.highlightBlock(el);
24
- });
10
+ $('h1.vivus-section-title').each(function(i, el) {
11
+ var text = $(el).text().toLowerCase();
12
+ var link = text.replace(/ /g, '-');
13
+ var anchor = "<a href='#" + link + "'>" + $(el).text() + "</a>";
14
+ $('#vivus-navigation > ul').append("<li class=" + $(el).prop("tagName").toLowerCase() + ">" + anchor + "<ul></ul></li>");
15
+ $(el).prepend("<a name='" + link + "'></a>");
16
+ })
17
+
18
+ $('h2.vivus-name').each(function(i, el) {
19
+ var section = $(el).parents(".vivus-section");
20
+ var section_title = section.children("h1.vivus-section-title").text().toLowerCase().replace(/ /g, '-');
21
+
22
+ var anchor = "<a href='#" + section_title + "|" + $(el).text().toLowerCase().replace(/ /g, '-') + "'>" + $(el).text() + "</a>"
25
23
 
26
- $('.vivus-documentation').find('h1, h2, h3, h4, h5, h6').each(function(i, el) {
27
- $('#vivus-navigation ul').append("<li class=" + $(el).prop("tagName").toLowerCase() + "><a href='#" + $(el).text().toLowerCase().replace(/ /g, '-') + "'>" + $(el).text() + "</a></li>");
28
- $(el).prepend("<a name='" + $(el).text().toLowerCase().replace(/ /g, '-') + "'></a>");
24
+ var navParent = $('#vivus-navigation ul').find("a[href='#" + section_title + "']").parent();
25
+
26
+ $(navParent).find("ul").append("<li class=" + $(el).prop("tagName").toLowerCase() + ">" + anchor + "</li>");
27
+ $(el).prepend("<a name='" + section_title + "|" + $(el).text().toLowerCase().replace(/ /g, '-') +"'></a>");
29
28
  })
30
29
 
31
30
  $('.vivus-documentation *:contains("TODO:")').html(function(_, html) {
@@ -35,4 +34,13 @@ $(document).ready(function() {
35
34
  $('.vivus-documentation *:contains("NOTE:")').html(function(_, html) {
36
35
  return html.split('NOTE:').join("<span class='note'>NOTE:</span>");
37
36
  });
37
+
38
+ $('a.vivus-tab').click(function(event) {
39
+ event.preventDefault();
40
+ var link = $(event.currentTarget);
41
+ var tabs = $(link).parent();
42
+ var blocks = $(tabs).parent().find('.vivus-block');
43
+ tabs.children("a").toggleClass("vivus-active");
44
+ blocks.toggleClass("vivus-block-opened");
45
+ });
38
46
  });
@@ -1,12 +1,12 @@
1
1
  @import "core/constants";
2
2
  @import "core/mixins";
3
3
  @import "core/mediaqueries";
4
- @import "core/typography";
5
4
 
6
5
  body#vivus {
7
6
  margin: 0;
8
7
  padding: 0;
9
8
 
10
9
  @import 'module/nav';
11
- @import 'module/block';
10
+ @import 'module/section';
11
+ @import 'module/component';
12
12
  }
@@ -0,0 +1,106 @@
1
+ li.vivus-component {
2
+ list-style: none;
3
+ margin-bottom: 40px;
4
+
5
+ .vivus-documentation {
6
+ margin: 0 0 40px 0;
7
+ font-size: 15px;
8
+ font-family: "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
9
+ font-weight: 300;
10
+
11
+ > h1 {
12
+ color: #C93312;
13
+ }
14
+
15
+ > h2 {
16
+ margin-top: 50px;
17
+ }
18
+
19
+ > ul, ol {
20
+ list-style-position: inside;
21
+ margin-bottom: 40px;
22
+ }
23
+
24
+ .todo {
25
+ color: #C93312;
26
+ }
27
+
28
+ code {
29
+ font-size: 13px;
30
+ color: #660000;
31
+ font-family: "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
32
+ font-weight: 300;
33
+ @import 'syntax-highlighting';
34
+ }
35
+ }
36
+
37
+ .vivus-example {
38
+ @include clearfix;
39
+ margin: 0 0 40px 0;
40
+ padding: 10px 0;
41
+ font-size: 15px;
42
+ border-bottom: 1px solid #eee;
43
+
44
+ .vivus-title {
45
+ font-family: "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
46
+ font-weight: 300;
47
+ padding-bottom: 10px;
48
+ border-bottom: 1px solid #eee;
49
+ }
50
+ }
51
+
52
+ .vivus-code {
53
+ > pre {
54
+ font-family: monospace;
55
+ word-wrap: break-word;
56
+ margin: 0px;
57
+ padding: 10px;
58
+ font-size: 14px;
59
+ margin-bottom: 20px;
60
+
61
+ @import 'syntax-highlighting';
62
+ }
63
+ }
64
+
65
+ .vivus-example, .vivus-code { display: none }
66
+
67
+ .vivus-block-opened { display: block }
68
+
69
+ .vivus-tabbed {
70
+ $tab_height: 32px;
71
+ $border_color: #999;
72
+
73
+ height: $tab_height;
74
+ border-bottom: 1px solid $border_color;
75
+ margin-bottom: 10px;
76
+
77
+ .vivus-tab{
78
+ border-top-left-radius: 4px;
79
+ border-top-right-radius: 4px;
80
+
81
+ border: 1px solid #bbb;
82
+ border-bottom: none;
83
+ position:relative;
84
+ z-index: 2;
85
+ float: right;
86
+ display: block;
87
+ font-weight: bold;
88
+ color: #b2b2b2;
89
+ height: $tab_height - 7px;
90
+ padding: 6px 32px 0 32px;
91
+ bottom: -1px;
92
+ margin-right: 10px;
93
+ font-size: 11px;
94
+
95
+ &.vivus-active{
96
+ border-color: $border_color;
97
+ color: #333333;
98
+ background-color: white;
99
+ }
100
+
101
+ &:hover{
102
+ color: #333333;
103
+ }
104
+ }
105
+ }
106
+ }
@@ -6,7 +6,7 @@
6
6
  margin: 0;
7
7
  background-color: #24281A;
8
8
  z-index: 1000000;
9
- overflow-y: scroll;
9
+ overflow-y: auto;
10
10
 
11
11
  @include respond-to("small") {
12
12
  display: none;
@@ -17,7 +17,8 @@
17
17
  left: 0;
18
18
  top: 0;
19
19
 
20
- font-family: "Open Sans", droid_sans_monoregular, mono, sans;
20
+ font-family: "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
21
+ font-weight: 300;
21
22
 
22
23
  ul {
23
24
  padding: 0;
@@ -31,44 +32,38 @@
31
32
  a {
32
33
  line-height: 1.45;
33
34
  text-decoration: none;
34
- color: #D5D5D3;
35
-
36
- &:hover {
37
- color: #F3DF6C;
38
- }
39
35
  }
40
36
 
41
37
  &.h1 {
42
38
  font-size: 15px;
43
39
 
44
- margin: 20px 0 5px 20px;
40
+ margin: 20px 0 10px 20px;
45
41
 
46
42
  a {
47
43
  color: #F3DF6C;
48
44
  }
49
- }
50
-
51
- &.h2 {
52
- font-size: 13px;
53
- color: #C3CED0;
54
- margin: 0 0 5px 30px;
55
- }
56
45
 
57
- &.h3 {
58
-
59
- }
46
+ ul {
47
+ margin-top: 10px;
48
+ }
60
49
 
61
- &.h4 {
62
50
 
63
- }
51
+ .h2 {
52
+ font-size: 13px;
53
+ color: #C3CED0;
54
+ margin: 0 10px 5px 10px;
64
55
 
65
- &.h5 {
56
+ a {
57
+ color: #D5D5D3;
66
58
 
59
+ &:hover {
60
+ color: #F3DF6C;
61
+ }
62
+ }
63
+ }
67
64
  }
68
65
 
69
- &.h6 {
70
66
 
71
- }
72
67
  }
73
68
  }
74
69
  }
@@ -0,0 +1,26 @@
1
+ #vivus-body {
2
+ margin-left: 250px;
3
+ max-width: 950px;
4
+ padding: 30px;
5
+
6
+ @include respond-to("small") {
7
+ margin: 0;
8
+ padding: 20px;
9
+ }
10
+
11
+ ul.vivus-sections {
12
+ margin: 0;
13
+ padding: 0;
14
+
15
+ li.vivus-section {
16
+ list-style: none;
17
+ margin-bottom: 40px;
18
+
19
+ ul.vivus-components {
20
+ list-style: none;
21
+ margin: 0;
22
+ padding: 0;
23
+ }
24
+ }
25
+ }
26
+ }
@@ -1,56 +1,56 @@
1
1
  /* http://jmblog.github.com/color-themes-for-google-code-highlightjs */
2
2
 
3
3
  /* Tomorrow Comment */
4
- .comment,
5
- .title {
4
+ .hljs-comment,
5
+ .hljs-title {
6
6
  color: #8e908c;
7
7
  }
8
8
 
9
9
  /* Tomorrow Red */
10
- .variable,
11
- .attribute,
12
- .tag,
13
- .regexp,
14
- .ruby .constant,
15
- .xml .tag .title,
16
- .xml .pi,
17
- .xml .doctype,
18
- .html .doctype,
19
- .css .id,
20
- .css .class,
21
- .css .pseudo {
10
+ .hljs-variable,
11
+ .hljs-attribute,
12
+ .hljs-tag,
13
+ .hljs-regexp,
14
+ .hljs-ruby .hljs-constant,
15
+ .hljs-xml .hljs-tag .hljs-title,
16
+ .hljs-xml .hljs-pi,
17
+ .hljs-xml .hljs-doctype,
18
+ .hljs-html .hljs-doctype,
19
+ .hljs-css .hljs-id,
20
+ .hljs-css .hljs-class,
21
+ .hljs-css .hljs-pseudo {
22
22
  color: #c82829;
23
23
  }
24
24
 
25
25
  /* Tomorrow Orange */
26
- .number,
27
- .preprocessor,
28
- .pragma,
29
- .built_in,
30
- .literal,
31
- .params,
32
- .constant {
26
+ .hljs-number,
27
+ .hljs-preprocessor,
28
+ .hljs-pragma,
29
+ .hljs-built_in,
30
+ .hljs-literal,
31
+ .hljs-params,
32
+ .hljs-constant {
33
33
  color: #f5871f;
34
34
  }
35
35
 
36
36
  /* Tomorrow Yellow */
37
- .ruby .class .title,
38
- .css .rules .attribute {
37
+ .hljs-ruby .hljs-class .hljs-title,
38
+ .hljs-css .hljs-rules .hljs-attribute {
39
39
  color: #eab700;
40
40
  }
41
41
 
42
42
  /* Tomorrow Green */
43
- .string,
44
- .value,
45
- .inheritance,
46
- .header,
47
- .ruby .symbol,
48
- .xml .cdata {
43
+ .hljs-string,
44
+ .hljs-value,
45
+ .hljs-inheritance,
46
+ .hljs-header,
47
+ .hljs-ruby .hljs-symbol,
48
+ .hljs-xml .hljs-cdata {
49
49
  color: #718c00;
50
50
  }
51
51
 
52
52
  /* Tomorrow Aqua */
53
- .css .hexcolor {
53
+ .hljs-css .hljs-hexcolor {
54
54
  color: #3e999f;
55
55
  }
56
56