middleman-sculptor 0.16 → 0.17

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 02827e1d57fc45ca687d67099a6f7589af9e0a11
4
- data.tar.gz: 732e3d365f4d9dcd5d48989dd5e9afa126d04128
3
+ metadata.gz: c1ce098f5a9ebe72b5c144539983712625380c5a
4
+ data.tar.gz: 361bdd7aee1229c517e9f8eda1838b487be61f63
5
5
  SHA512:
6
- metadata.gz: 41ab5524edab1c38161144e20baf1c4881a90cbae387722badcefc1f78080888cbec172d873ea0ac2660a01606b18bf2e76258498b6a94c556bdf0f23bd53e72
7
- data.tar.gz: 1ebb779121b2bacf3c27fe8ac4a1fff657504b20db9e1e99294f1b2c29b8ee4a7a0edcfe123d2bd2dd6700157ceae9e05d81e1d4992acddb1e31d20b426f62ed
6
+ metadata.gz: 183877d32a1dfa97e8cd168b5ab6b3d235738e950bf2ab6acb2dade16d3dadba098630be510dfb93762e0e7dd5ec87cb0d3b84ffed320ae44e1310d41bb1ec23
7
+ data.tar.gz: b42109276f344b3648ec4a2bc903f18921b0f4a0c50dd41b3019fdb61d6bacd7163f23cc6ba369a86463406373c9a4df3e7caf82e15f9c6a941c6a7f37fc336c
data/LICENCE.md ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Tyom Semonov
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -131,12 +131,8 @@ module Middleman::Sculptor
131
131
  end
132
132
  end
133
133
 
134
- dir = File.dirname(r.path)
135
134
  r.add_metadata(locals: {
136
- section: {
137
- title: dir.upcase,
138
- slug: dir.downcase.strip.gsub(' ', '-').gsub(/[^\w-]/, '-')
139
- }
135
+ section: get_section_of_resource(r)
140
136
  })
141
137
 
142
138
  options[:data_fields].each do |field|
@@ -163,6 +159,41 @@ module Middleman::Sculptor
163
159
  relative_path = args ? args.join('/') : ''
164
160
  Pathname(path).dirname.join(relative_path)
165
161
  end
162
+
163
+ def breadcrumbs(page=current_page, separator="›", remove_current=true)
164
+ hierarchy = [page]
165
+ hierarchy.unshift hierarchy.first.parent while hierarchy.first.parent
166
+ hierarchy.pop if remove_current
167
+ hierarchy.collect {|page|
168
+ link_to(
169
+ page.data.title || get_section_of_resource(page).title,
170
+ "#{page.url}"
171
+ )
172
+ }.join(" <span class='sep'>#{separator}</span> ")
173
+ end
174
+
175
+ def page_title(page=current_page, separator='›')
176
+ title = strip_tags(breadcrumbs(current_page, separator, false))
177
+ .split(separator)
178
+ .reverse
179
+ .join(" #{separator} ")
180
+ end
181
+
182
+ def get_section_of_resource(resource)
183
+ dir = File.dirname(resource.path)
184
+ title = dir.upcase
185
+
186
+ if resource.url == '/'
187
+ title = resource.data.title || site_title
188
+ elsif resource.metadata.locals[:section]
189
+ title = resource.data.title if resource.data.title
190
+ end
191
+
192
+ {
193
+ title: title,
194
+ slug: dir.downcase.strip.gsub(' ', '-').gsub(/[^\w-]/, '-')
195
+ }
196
+ end
166
197
  end
167
198
  end
168
199
  end
@@ -15,12 +15,7 @@ set :site_title, 'Styleguide'
15
15
  ready do
16
16
  # Proxy default site index to Glyptotheque index template
17
17
  unless sitemap.find_resource_by_path '/index.html'
18
- proxy 'index.html', 'glyptotheque/site-index.html', locals: {
19
- section: {
20
- title: site_title,
21
- slug: 'index'
22
- }
23
- }
18
+ proxy 'index.html', 'glyptotheque/site-index.html'
24
19
  end
25
20
  proxy 'sitemap.json', 'glyptotheque/sitemap.json'
26
21
 
@@ -35,23 +30,25 @@ ready do
35
30
  # Create virtual index files
36
31
  dir = File.dirname(r.path)
37
32
  index_exists = !!sitemap.find_resource_by_path("#{dir}/index.html")
33
+
38
34
  if last_dir != dir && !index_exists
39
35
  proxy "#{dir}/index.html", 'glyptotheque/directory-index.html', locals: {
40
- section: {
41
- title: dir.upcase,
42
- slug: dir.downcase.strip.gsub(' ', '-').gsub(/[^\w-]/, '-')
43
- }
36
+ section: get_section_of_resource(r)
44
37
  }
45
38
  last_dir = dir
46
39
  end
47
40
 
48
41
  if r.metadata[:models]
42
+ dir = File.dirname(r.path)
49
43
  r.metadata.models.each do |id, model|
50
44
  proxy "#{r.path.sub(r.ext, '')}-#{id}-isolated.html",
51
45
  r.path,
52
46
  layout: 'isolated',
53
47
  iframe: model.iframe,
54
- id: id
48
+ id: id,
49
+ locals: {
50
+ section: get_section_of_resource(r)
51
+ }
55
52
  end
56
53
  end
57
54
  end
@@ -6,6 +6,13 @@
6
6
  }
7
7
  }
8
8
 
9
+ body {
10
+ padding: 0;
11
+ margin: 0;
12
+ font-family: Helvetica Neue, Helvetica, Arial, sans-serif;
13
+ min-height: 100%;
14
+ }
15
+
9
16
  html,
10
17
  body {
11
18
  height: 100%;
@@ -13,12 +20,6 @@ body {
13
20
  color: white;
14
21
  }
15
22
 
16
- body {
17
- padding: 0;
18
- margin: 0;
19
- font-family: Helvetica Neue, Helvetica, Arial, sans-serif;
20
- }
21
-
22
23
  button {
23
24
  cursor: pointer;
24
25
  }
@@ -30,7 +31,7 @@ button {
30
31
  overflow: hidden;
31
32
  background: white;
32
33
  color: #343434;
33
- box-shadow: -1px 0 0 rgba(black, .1);
34
+ box-shadow: 0 0 20px black;
34
35
  }
35
36
 
36
37
  .glypto-section {
@@ -90,23 +91,24 @@ button {
90
91
 
91
92
  .glypto-header {
92
93
  margin: -40px -40px 40px;
93
- padding: 40px;
94
- background: #ddd;
95
- background: linear-gradient(58deg, #ddd, #f6f6f6);
94
+ padding: 36px 40px;
95
+ background: lighten($dark-grey, 15);
96
+ color: white;
96
97
  box-shadow: inset 0 -10px 0 rgba(black, .13);
97
98
 
98
99
  .glypto-title {
99
100
  margin: 0;
101
+ line-height: 1;
100
102
  }
101
103
  }
102
104
 
103
105
  .glypto-breadcrumbs {
106
+ position: absolute;
104
107
  transition: 160ms;
105
- margin-top: -30px;
108
+ margin-top: -26px;
106
109
  font-weight: bold;
107
110
  font-size: em(12);
108
111
  line-height: 27px;
109
- color: $dark-grey;
110
112
  opacity: .7;
111
113
 
112
114
  &:hover {
@@ -129,3 +131,46 @@ button {
129
131
  margin: 0 em(4);
130
132
  }
131
133
  }
134
+
135
+
136
+ .glypto-section-list {
137
+ @include clearfix;
138
+ background: #eee;
139
+ padding: 5px;
140
+ margin: 0;
141
+ list-style: none;
142
+ }
143
+
144
+ .glypto-section-list-item {
145
+ padding: 5px;
146
+
147
+ @include breakpoint(540px) {
148
+ float: left;
149
+ width: 50%;
150
+ }
151
+
152
+ a:link,
153
+ a:hover,
154
+ a:visited {
155
+ display: block;
156
+ padding: em(20);
157
+ background: white;
158
+ text-decoration: none;
159
+ border: 1px solid transparent;
160
+ color: inherit;
161
+ min-height: 160px;
162
+
163
+ &:hover {
164
+ border-color: $dark-grey;
165
+ }
166
+ }
167
+
168
+ .glypto-section-name {
169
+ font-size: em(30);
170
+ margin: 0;
171
+ }
172
+
173
+ .glypto-section-meta {
174
+ color: #aaa;
175
+ }
176
+ }
@@ -10,6 +10,7 @@
10
10
  -webkit-font-smoothing: antialiased;
11
11
  color: #ddd;
12
12
  font-size: 14px;
13
+ min-height: 100%;
13
14
 
14
15
  &.s-hidden {
15
16
  transition: 120ms ease-out;
@@ -19,10 +20,6 @@
19
20
  margin-right: -35px;
20
21
  opacity: .7;
21
22
 
22
- &:before {
23
- box-shadow: 0 2px 0 1px black, 0 7px 0 1px black, 0 12px 0 1px black;
24
- }
25
-
26
23
  &:active {
27
24
  background: rgba(black, .2);
28
25
  }
@@ -1,4 +1,5 @@
1
1
  @import 'bourbon';
2
+ @import 'breakpoint';
2
3
 
3
4
  @import 'glyptotheque/$variables';
4
5
  @import 'glyptotheque/base';
@@ -1,10 +1,14 @@
1
1
  .glypto-model-utils
2
2
  menu
3
- button._tab-toggle(ng-class="{'__active': show == 'outline'}" ng-click="show = show === 'outline' ? null : 'outline'") Outline
4
- button._tab-toggle(ng-class="{'__active': show == 'source'}" ng-click="show = show === 'source' ? null : 'source'") HTML source
3
+ button._tab-toggle(ng-class="{'__active': show == 'outline'}" ng-click="show = show === 'outline' ? null : 'outline'" tabindex="-1") Outline
4
+ button._tab-toggle(ng-class="{'__active': show == 'source'}" ng-click="show = show === 'source' ? null : 'source'" tabindex="-1") HTML source
5
5
 
6
6
  - if id
7
- = link_to isolated_url, class: '_isolated', target: '_blank', title: 'Isolated version'
7
+ = link_to isolated_url,
8
+ class: '_isolated',
9
+ target: '_blank',
10
+ title: 'Isolated version',
11
+ tabindex: -1
8
12
  span> Isolate
9
13
  i.fa.fa-external-link
10
14
 
@@ -20,7 +20,13 @@ article.glypto-model
20
20
  - unless locals[:iframe]
21
21
  - stylesheets = current_page.metadata.page[:stylesheet] || current_page.metadata.page[:stylesheets] || current_page.data[:stylesheet] || current_page.data[:stylesheets]
22
22
  - javascripts = current_page.metadata.page[:javascript] || current_page.metadata.page[:javascripts] || current_page.data[:javascript] || current_page.data[:javascripts]
23
- - if stylesheets && include_stylesheets(stylesheets) != yield_content(:stylesheets)
23
+
24
+ - current_js = include_javascripts(javascripts)
25
+ - included_js = yield_content(:javascripts)
26
+
27
+ - if include_stylesheets(stylesheets) != yield_content(:stylesheets)
24
28
  - content_for :stylesheets, include_stylesheets(stylesheets)
25
- - if javascripts && include_stylesheets(javascripts) != yield_content(:javascripts)
26
- - content_for :javascripts, include_javascripts(javascripts)
29
+
30
+ - if current_js
31
+ - unless (included_js && included_js.match(current_js))
32
+ - content_for :javascripts, current_js
@@ -13,7 +13,7 @@ glypto-menu
13
13
  script type="text/ng-template" id="glyptotheque/menu.html"
14
14
  nav.glypto-nav ng-class="{'s-hidden' : navIsHidden}"
15
15
  button.glypto-nav-toggle ng-click="toggle()" title="Toggle menu: Command + Shift + E"
16
- = link_to yield_content(:page_title), url_for('/index.html'), class: '_logo'
16
+ = link_to site_title, url_for('/index.html'), class: '_logo'
17
17
  .search: input.mousetrap(ng-model="search" type="search" placeholder="Filter (/ to focus)" glypto-search)
18
18
 
19
19
  glypto-menu-tree items="items" filter="search"
@@ -1,5 +1,10 @@
1
1
  - if resources_for('/').empty?
2
2
  h1 Site is empty, create some pages
3
3
  - else
4
- - main_sections.each do |section|
5
- h2.glypto-title = link_to section.metadata.locals.section.title, section.path
4
+ - if main_sections.any?
5
+ ul.glypto-section-list
6
+ - main_sections.each do |r|
7
+ li.glypto-section-list-item
8
+ = link_to r.url
9
+ h2.glypto-section-name = get_section_of_resource(r).title
10
+ .glypto-section-meta = pluralize(resources_for(r.url).count, 'item')
@@ -1,10 +1,7 @@
1
- - content_for :page_title, site_title
1
+ - content_for :page_title, page_title
2
2
  - content_for :ng_app, 'glyptotheque'
3
3
  - content_for :stylesheets, stylesheet_link_tag('glyptotheque')
4
-
5
- - current_section = current_page.metadata.locals[:section]
6
- - if current_section
7
- - content_for :body_class, "section-#{current_section[:slug]}"
4
+ - content_for :body_class, "section-#{get_section_of_resource(current_page).slug}"
8
5
 
9
6
  = wrap_layout :layout do
10
7
  - if resource_tree('/').any?
@@ -14,12 +11,12 @@
14
11
  header.glypto-header
15
12
  .glypto-container
16
13
  - if current_page.parent
17
- = partial 'glyptotheque/breadcrumbs'
14
+ .glypto-breadcrumbs = breadcrumbs
18
15
 
19
16
  - if current_page.data.title
20
- h1.glypto-title = current_page.data.title
21
- - elsif current_page.metadata.locals[:section]
22
- h1.glypto-title = current_page.metadata.locals.section.title
17
+ h1.glypto-title = current_page.data.title || getcurrent_page
18
+ - elsif get_section_of_resource(current_page)
19
+ h1.glypto-title = get_section_of_resource(current_page).title
23
20
  .glypto-container = yield
24
21
 
25
22
  javascript:
@@ -2,14 +2,7 @@ doctype html
2
2
  html
3
3
  head
4
4
  meta charset='utf-8'
5
- title
6
- - current_section = current_page.metadata.locals[:section]
7
- - if current_section
8
- => current_section.title
9
- - else
10
- => current_page.data.title || yield_content(:page_title) || resource_file(current_page)
11
- - if current_page.data.title || current_section
12
- | › #{site_title}
5
+ title = page_title
13
6
  meta name='viewport' content='width=device-width'
14
7
  = yield_content :stylesheets
15
8
  - if current_resource.metadata.options.iframe
@@ -2,21 +2,13 @@ doctype html
2
2
  html ng-app=(yield_content(:ng_app))
3
3
  head
4
4
  meta charset='utf-8'
5
- title
6
- - current_section = current_page.metadata.locals[:section]
7
- - if current_section
8
- => current_section.title
9
- - else
10
- => current_page.data.title || yield_content(:page_title) || resource_file(current_page)
11
- - if current_page.data.title || current_section
12
- | › #{site_title}
5
+ title = yield_content :page_title
13
6
  meta name='viewport' content='width=device-width'
14
7
  = stylesheet_link_tag '//netdna.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css'
15
8
  = yield_content :stylesheets
16
9
  = javascript_include_tag 'head-js'
17
10
 
18
11
  body class="#{yield_content(:body_class)}"
19
-
20
12
  = yield
21
13
 
22
14
  = yield_content :javascripts
@@ -1,5 +1,5 @@
1
1
  module Middleman
2
2
  module Sculptor
3
- VERSION = "0.16"
3
+ VERSION = "0.17"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,103 +1,103 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: middleman-sculptor
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.16'
4
+ version: '0.17'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tyom Semonov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-04 00:00:00.000000000 Z
11
+ date: 2015-05-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: middleman-core
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ~>
18
18
  - !ruby/object:Gem::Version
19
19
  version: '3.3'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ~>
25
25
  - !ruby/object:Gem::Version
26
26
  version: '3.3'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rest-client
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - '>='
32
32
  - !ruby/object:Gem::Version
33
33
  version: 1.7.3
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ">="
38
+ - - '>='
39
39
  - !ruby/object:Gem::Version
40
40
  version: 1.7.3
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: nokogiri
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ">="
45
+ - - '>='
46
46
  - !ruby/object:Gem::Version
47
47
  version: '1.6'
48
- - - "<"
48
+ - - <
49
49
  - !ruby/object:Gem::Version
50
50
  version: '2.0'
51
51
  type: :runtime
52
52
  prerelease: false
53
53
  version_requirements: !ruby/object:Gem::Requirement
54
54
  requirements:
55
- - - ">="
55
+ - - '>='
56
56
  - !ruby/object:Gem::Version
57
57
  version: '1.6'
58
- - - "<"
58
+ - - <
59
59
  - !ruby/object:Gem::Version
60
60
  version: '2.0'
61
61
  - !ruby/object:Gem::Dependency
62
62
  name: oj
63
63
  requirement: !ruby/object:Gem::Requirement
64
64
  requirements:
65
- - - "~>"
65
+ - - ~>
66
66
  - !ruby/object:Gem::Version
67
67
  version: 2.10.2
68
68
  type: :runtime
69
69
  prerelease: false
70
70
  version_requirements: !ruby/object:Gem::Requirement
71
71
  requirements:
72
- - - "~>"
72
+ - - ~>
73
73
  - !ruby/object:Gem::Version
74
74
  version: 2.10.2
75
75
  - !ruby/object:Gem::Dependency
76
76
  name: slim
77
77
  requirement: !ruby/object:Gem::Requirement
78
78
  requirements:
79
- - - ">="
79
+ - - '>='
80
80
  - !ruby/object:Gem::Version
81
81
  version: '3.0'
82
82
  type: :runtime
83
83
  prerelease: false
84
84
  version_requirements: !ruby/object:Gem::Requirement
85
85
  requirements:
86
- - - ">="
86
+ - - '>='
87
87
  - !ruby/object:Gem::Version
88
88
  version: '3.0'
89
89
  - !ruby/object:Gem::Dependency
90
90
  name: pry
91
91
  requirement: !ruby/object:Gem::Requirement
92
92
  requirements:
93
- - - ">="
93
+ - - '>='
94
94
  - !ruby/object:Gem::Version
95
95
  version: '0'
96
96
  type: :runtime
97
97
  prerelease: false
98
98
  version_requirements: !ruby/object:Gem::Requirement
99
99
  requirements:
100
- - - ">="
100
+ - - '>='
101
101
  - !ruby/object:Gem::Version
102
102
  version: '0'
103
103
  description: Generate style guides and static components in Middleman
@@ -109,9 +109,10 @@ executables:
109
109
  extensions: []
110
110
  extra_rdoc_files: []
111
111
  files:
112
- - ".editorconfig"
113
- - ".gitignore"
112
+ - .editorconfig
113
+ - .gitignore
114
114
  - Gemfile
115
+ - LICENCE.md
115
116
  - Rakefile
116
117
  - bin/middleman-sculptor
117
118
  - bin/sculpt
@@ -154,7 +155,6 @@ files:
154
155
  - lib/middleman-sculptor/template/source/assets/styles/pygments/colorful.css
155
156
  - lib/middleman-sculptor/template/source/assets/styles/pygments/github.css
156
157
  - lib/middleman-sculptor/template/source/assets/styles/pygments/trac.css
157
- - lib/middleman-sculptor/template/source/glyptotheque/_breadcrumbs.html.slim
158
158
  - lib/middleman-sculptor/template/source/glyptotheque/_model-outline-element.slim
159
159
  - lib/middleman-sculptor/template/source/glyptotheque/_model-outline.slim
160
160
  - lib/middleman-sculptor/template/source/glyptotheque/_model-utils.slim
@@ -179,18 +179,19 @@ require_paths:
179
179
  - lib
180
180
  required_ruby_version: !ruby/object:Gem::Requirement
181
181
  requirements:
182
- - - ">="
182
+ - - '>='
183
183
  - !ruby/object:Gem::Version
184
184
  version: 1.9.3
185
185
  required_rubygems_version: !ruby/object:Gem::Requirement
186
186
  requirements:
187
- - - ">="
187
+ - - '>='
188
188
  - !ruby/object:Gem::Version
189
189
  version: '0'
190
190
  requirements: []
191
191
  rubyforge_project:
192
- rubygems_version: 2.4.2
192
+ rubygems_version: 2.2.2
193
193
  signing_key:
194
194
  specification_version: 4
195
195
  summary: Style guide generator for Middleman
196
196
  test_files: []
197
+ has_rdoc:
@@ -1,8 +0,0 @@
1
- .glypto-breadcrumbs
2
- => link_to site_title, '/'
3
- - if current_page.parent.url != '/'
4
- span.sep ›
5
- - if current_page.parent.data.title
6
- =< link_to current_page.parent.data.title, current_page.parent.url
7
- - else
8
- =< link_to current_page.parent.metadata.locals.section.title, current_page.parent.url