vivus 1.0.6 → 1.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/vivus/application.js +1 -17
- data/app/assets/stylesheets/vivus/module/component.scss +1 -1
- data/app/assets/stylesheets/vivus/module/nav.scss +6 -0
- data/app/controllers/vivus/styles_controller.rb +18 -3
- data/app/models/component.rb +4 -0
- data/app/views/vivus/styles/_nav.html.erb +18 -2
- data/app/views/vivus/styles/index.html.erb +3 -18
- data/app/views/vivus/styles/show.html.erb +12 -7
- data/config/routes.rb +1 -0
- data/lib/vivus/version.rb +1 -1
- metadata +20 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e91f68c5d5976fc293b0ddc92a60dee74a50ed96
|
4
|
+
data.tar.gz: abdb3ddeea7a3354350d403d518be53d1fb9f336
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dfad9b9bf091e40c0bb2650ec29d5d87d140a0cf06a3def21013a4c08ba7d2350ce2ac8bab6841088884a3d06698e06876af9faf5165dd4c0119611d90b25ba4
|
7
|
+
data.tar.gz: 5a6ae28163548adf7022ad5053bdf54c01c589b449ef58b51bd07cb3a9ed8ee2cc65469a378b74fe2daed42e3fa6e436babf5c96be84404d815d6e217ec6d72d
|
@@ -8,24 +8,8 @@ $(document).ready(function() {
|
|
8
8
|
hljs.highlightBlock(el);
|
9
9
|
});
|
10
10
|
|
11
|
-
$('h1.vivus-section-title').each(function(i, el) {
|
12
|
-
var text = $(el).text().toLowerCase();
|
13
|
-
var link = text.replace(/ /g, '-');
|
14
|
-
var anchor = "<a href='#" + link + "'>" + $(el).text() + "</a>";
|
15
|
-
$('#vivus-navigation > ul').append("<li class=" + $(el).prop("tagName").toLowerCase() + ">" + anchor + "<ul></ul></li>");
|
16
|
-
$(el).prepend("<a name='" + link + "'></a>");
|
17
|
-
})
|
18
|
-
|
19
11
|
$('h2.vivus-name').each(function(i, el) {
|
20
|
-
|
21
|
-
var section_title = section.children("h1.vivus-section-title").text().toLowerCase().replace(/ /g, '-');
|
22
|
-
|
23
|
-
var anchor = "<a href='#" + section_title + "|" + $(el).text().toLowerCase().replace(/ /g, '-') + "'>" + $(el).text() + "</a>"
|
24
|
-
|
25
|
-
var navParent = $('#vivus-navigation ul').find("a[href='#" + section_title + "']").parent();
|
26
|
-
|
27
|
-
$(navParent).find("ul").append("<li class=" + $(el).prop("tagName").toLowerCase() + ">" + anchor + "</li>");
|
28
|
-
$(el).prepend("<a name='" + section_title + "|" + $(el).text().toLowerCase().replace(/ /g, '-') +"'></a>");
|
12
|
+
$(el).before("<a name='" + $(el).text().toLowerCase().replace(/ /g, '-') +"'></a>");
|
29
13
|
})
|
30
14
|
|
31
15
|
$('.vivus-documentation *:contains("TODO:")').html(function(_, html) {
|
@@ -1,6 +1,16 @@
|
|
1
1
|
# Controller for dsiplaying the documentation for the styles
|
2
2
|
class Vivus::StylesController < Vivus::ApplicationController
|
3
3
|
def index
|
4
|
+
gather_stylesheets
|
5
|
+
end
|
6
|
+
|
7
|
+
def show
|
8
|
+
gather_stylesheets
|
9
|
+
end
|
10
|
+
|
11
|
+
private
|
12
|
+
|
13
|
+
def gather_stylesheets
|
4
14
|
sprockets = Rails.application.assets
|
5
15
|
|
6
16
|
@css_paths = %w{application.css}
|
@@ -12,10 +22,15 @@ class Vivus::StylesController < Vivus::ApplicationController
|
|
12
22
|
.map{|file_path| Stylesheet.new(css: sprockets[file_path].body)}
|
13
23
|
.map{|stylesheet| stylesheet.parse}
|
14
24
|
.reject{|stylesheet| stylesheet.empty?}
|
15
|
-
.inject({}){ |
|
16
|
-
|
25
|
+
.inject({}){ | accum, data |
|
26
|
+
data.each do |section, components|
|
27
|
+
accum[section] ||= []
|
28
|
+
accum[section] += components
|
29
|
+
end
|
17
30
|
|
18
|
-
|
31
|
+
accum
|
32
|
+
}
|
33
|
+
end
|
19
34
|
|
20
35
|
def is_a_file? file
|
21
36
|
File.file?(file)
|
data/app/models/component.rb
CHANGED
@@ -1,7 +1,23 @@
|
|
1
1
|
<nav id="vivus-navigation">
|
2
2
|
<ul>
|
3
|
-
<% @stylesheets.each do |
|
4
|
-
|
3
|
+
<% @stylesheets.each do |group| %>
|
4
|
+
<% section = group[0] %>
|
5
|
+
<% section_slug = section.downcase.gsub(/[^a-z1-9]+/, '-').chomp('-') %>
|
6
|
+
<% chunks = group[1] %>
|
7
|
+
|
8
|
+
<li class="h1 <%= "active" if section.downcase.gsub(/[^a-z1-9]+/, '-').chomp('-') == params[:section] %>">
|
9
|
+
<%= link_to section, vivus_section_path(section_slug) %>
|
10
|
+
|
11
|
+
<% if chunks.present? %>
|
12
|
+
<ul>
|
13
|
+
<% chunks.each do |chunk| %>
|
14
|
+
<li class="h2">
|
15
|
+
<%= link_to chunk.name, vivus_section_path(section_slug, anchor: chunk.slug) %>
|
16
|
+
</li>
|
17
|
+
<% end %>
|
18
|
+
</ul>
|
19
|
+
<% end %>
|
20
|
+
</li>
|
5
21
|
<% end %>
|
6
22
|
</ul>
|
7
23
|
</nav>
|
@@ -1,25 +1,11 @@
|
|
1
|
-
|
2
|
-
<div id="vivus-navigation">
|
3
|
-
<ul>
|
4
|
-
|
5
|
-
</ul>
|
6
|
-
</div>
|
1
|
+
<%= render partial: "nav" %>
|
7
2
|
<div id="vivus-body">
|
8
3
|
<ul class="vivus-sections">
|
9
|
-
<% @stylesheets.each do |title, components| %>
|
10
|
-
<li class="vivus-section">
|
11
|
-
<h1 class="vivus-section-title"><%= title %></h1>
|
12
|
-
<ul class="vivus-components">
|
13
|
-
<%= render partial: "component", collection: components %>
|
14
|
-
</ul>
|
15
|
-
</li>
|
16
|
-
<% end %>
|
17
|
-
|
18
|
-
<% if @stylesheets.flatten.blank? %>
|
19
4
|
<li class="vivus-section">
|
20
5
|
<h2></h2>
|
21
6
|
<h1 class="vivus-section-title">Let's begin!</h1>
|
22
|
-
|
7
|
+
|
8
|
+
<p>Above each block of code in your CSS, start documenting your styleguide by writing comments.</p>
|
23
9
|
<p>Use the below example as a starting point.</p>
|
24
10
|
<pre>
|
25
11
|
/*
|
@@ -49,7 +35,6 @@ need be.
|
|
49
35
|
*/
|
50
36
|
</pre>
|
51
37
|
</li>
|
52
|
-
<% end %>
|
53
38
|
</ul>
|
54
39
|
</div>
|
55
40
|
|
@@ -1,8 +1,13 @@
|
|
1
1
|
<%= render partial: "nav" %>
|
2
|
-
|
3
|
-
|
4
|
-
<% @
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
2
|
+
<div id="vivus-body">
|
3
|
+
<ul class="vivus-sections">
|
4
|
+
<% @stylesheets.select{ |section| section.downcase.gsub(/[^a-z1-9]+/, '-').chomp('-') == params[:section]}.each do |title, components| %>
|
5
|
+
<li class="vivus-section">
|
6
|
+
<h1 class="vivus-section-title"><%= title %></h1>
|
7
|
+
<ul class="vivus-components">
|
8
|
+
<%= render partial: "component", collection: components %>
|
9
|
+
</ul>
|
10
|
+
</li>
|
11
|
+
<% end %>
|
12
|
+
</ul>
|
13
|
+
</div>
|
data/config/routes.rb
CHANGED
data/lib/vivus/version.rb
CHANGED
metadata
CHANGED
@@ -1,75 +1,75 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vivus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mark Cipolla
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-06-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '4.0'
|
20
|
-
- - "
|
20
|
+
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version:
|
22
|
+
version: '5'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
|
-
- - "
|
27
|
+
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
29
|
version: '4.0'
|
30
|
-
- - "
|
30
|
+
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version:
|
32
|
+
version: '5'
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: rdiscount
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
36
36
|
requirements:
|
37
|
-
- - "
|
37
|
+
- - ">="
|
38
38
|
- !ruby/object:Gem::Version
|
39
39
|
version: '2.1'
|
40
|
-
- - "
|
40
|
+
- - "<"
|
41
41
|
- !ruby/object:Gem::Version
|
42
|
-
version:
|
42
|
+
version: '3'
|
43
43
|
type: :runtime
|
44
44
|
prerelease: false
|
45
45
|
version_requirements: !ruby/object:Gem::Requirement
|
46
46
|
requirements:
|
47
|
-
- - "
|
47
|
+
- - ">="
|
48
48
|
- !ruby/object:Gem::Version
|
49
49
|
version: '2.1'
|
50
|
-
- - "
|
50
|
+
- - "<"
|
51
51
|
- !ruby/object:Gem::Version
|
52
|
-
version:
|
52
|
+
version: '3'
|
53
53
|
- !ruby/object:Gem::Dependency
|
54
54
|
name: rspec
|
55
55
|
requirement: !ruby/object:Gem::Requirement
|
56
56
|
requirements:
|
57
|
-
- - "
|
57
|
+
- - ">="
|
58
58
|
- !ruby/object:Gem::Version
|
59
59
|
version: '2.14'
|
60
|
-
- - "
|
60
|
+
- - "<"
|
61
61
|
- !ruby/object:Gem::Version
|
62
|
-
version:
|
62
|
+
version: '3'
|
63
63
|
type: :development
|
64
64
|
prerelease: false
|
65
65
|
version_requirements: !ruby/object:Gem::Requirement
|
66
66
|
requirements:
|
67
|
-
- - "
|
67
|
+
- - ">="
|
68
68
|
- !ruby/object:Gem::Version
|
69
69
|
version: '2.14'
|
70
|
-
- - "
|
70
|
+
- - "<"
|
71
71
|
- !ruby/object:Gem::Version
|
72
|
-
version:
|
72
|
+
version: '3'
|
73
73
|
description: Styleguides can be a pain to keep as a living documentation for your
|
74
74
|
CSS. By analysing the comments in your SASS files, and by adding markdown to your
|
75
75
|
stylesheets, you can generate a living, breathing documentation styleguide that
|