lookbook 0.8.0.beta.0 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -3
- data/app/assets/lookbook/js/stores/sidebar.js +13 -2
- data/app/controllers/lookbook/previews_controller.rb +5 -3
- data/lib/lookbook/engine.rb +7 -3
- data/lib/lookbook/version.rb +1 -1
- data/public/lookbook-assets/js/app.js +1 -1
- data/public/lookbook-assets/js/app.js.map +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 79511e3188b92969dfb927515e82464ad712490ed56d4651316f237f2792d9be
|
4
|
+
data.tar.gz: 7afbe921d118e685c4d7ec1619f9431296099a9690947baca8bc041b609e8b46
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e300adbcb09915cb48862621e6809a5713c8250e9122c109b3eaadcf770c1c11f4ac7865a78caac233b452f38ca05e499899baf07edcce82d499b3110c4580dc
|
7
|
+
data.tar.gz: 4385b86b3115d4ed88d13f8d7b2cb57a15792ac8ccdeb526ff6ffe3a2e35d45b6047b17b10d322d711d7087b26af7f7352aec717f01932263118fd75d40aa475
|
data/README.md
CHANGED
@@ -541,7 +541,7 @@ config.lookbook.page_options = {
|
|
541
541
|
footer: false,
|
542
542
|
data: {
|
543
543
|
brand_colors: {
|
544
|
-
red: #ff0000
|
544
|
+
red: "#ff0000"
|
545
545
|
}
|
546
546
|
}
|
547
547
|
}
|
@@ -704,8 +704,10 @@ rake lookbook:previews:preparse
|
|
704
704
|
If you wish to run this as part of your existing assets precompilation step, you can add the following into your app's `Rakefile`:
|
705
705
|
|
706
706
|
```ruby
|
707
|
-
|
708
|
-
Rake::Task[
|
707
|
+
if Rails.env.production?
|
708
|
+
Rake::Task['assets:precompile'].enhance do
|
709
|
+
Rake::Task["lookbook:previews:preparse"].invoke
|
710
|
+
end
|
709
711
|
end
|
710
712
|
```
|
711
713
|
|
@@ -3,13 +3,24 @@ import config from "../config";
|
|
3
3
|
export default function createSidebarStore(Alpine) {
|
4
4
|
const { defaultWidth, minWidth, maxWidth } = config.sidebar;
|
5
5
|
return {
|
6
|
-
|
6
|
+
openDesktop: Alpine.$persist(true).as("sidebar-open-desktop"),
|
7
|
+
openMobile: Alpine.$persist(false).as("sidebar-open-mobile"),
|
7
8
|
width: Alpine.$persist(defaultWidth).as("sidebar-width"),
|
8
9
|
panelSplits: Alpine.$persist([1.0, 1.0]).as(`sidebar-panel-splits`),
|
9
10
|
minWidth,
|
10
11
|
maxWidth,
|
12
|
+
get open() {
|
13
|
+
return Alpine.store("sidebar")[
|
14
|
+
Alpine.store("layout").desktop ? "openDesktop" : "openMobile"
|
15
|
+
];
|
16
|
+
},
|
11
17
|
toggle() {
|
12
|
-
|
18
|
+
const sidebar = Alpine.store("sidebar");
|
19
|
+
if (Alpine.store("layout").desktop) {
|
20
|
+
sidebar.openDesktop = !sidebar.openDesktop;
|
21
|
+
} else {
|
22
|
+
sidebar.openMobile = !sidebar.openMobile;
|
23
|
+
}
|
13
24
|
},
|
14
25
|
};
|
15
26
|
}
|
@@ -47,6 +47,9 @@ module Lookbook
|
|
47
47
|
if params[:path] == @preview&.lookup_path
|
48
48
|
redirect_to show_path "#{params[:path]}/#{@preview.default_example.name}"
|
49
49
|
end
|
50
|
+
else
|
51
|
+
first_example = Lookbook.previews.find(params[:path])&.examples&.first
|
52
|
+
redirect_to show_path(first_example.lookup_path) if first_example
|
50
53
|
end
|
51
54
|
end
|
52
55
|
|
@@ -143,9 +146,8 @@ module Lookbook
|
|
143
146
|
end
|
144
147
|
|
145
148
|
def preview_controller
|
146
|
-
return @preview_controller if @preview_controller
|
147
|
-
|
148
|
-
controller = controller_class.new
|
149
|
+
return @preview_controller if @preview_controller
|
150
|
+
controller = Lookbook::Engine.preview_controller.new
|
149
151
|
controller.request = request
|
150
152
|
controller.response = response
|
151
153
|
@preview_controller ||= controller
|
data/lib/lookbook/engine.rb
CHANGED
@@ -76,9 +76,6 @@ module Lookbook
|
|
76
76
|
end
|
77
77
|
|
78
78
|
config.after_initialize do
|
79
|
-
preview_controller = Lookbook.config.preview_controller.constantize
|
80
|
-
preview_controller.class_eval { include Lookbook::PreviewController }
|
81
|
-
|
82
79
|
if config.lookbook.listen
|
83
80
|
@preview_listener = Listen.to(*config.lookbook.listen_paths, only: /\.(rb|html.*)$/) do |modified, added, removed|
|
84
81
|
begin
|
@@ -154,6 +151,13 @@ module Lookbook
|
|
154
151
|
def parser
|
155
152
|
@parser ||= Lookbook::Parser.new(config.lookbook.preview_paths, config.lookbook.parser_registry_path)
|
156
153
|
end
|
154
|
+
|
155
|
+
def preview_controller
|
156
|
+
return @preview_controller if @preview_controller
|
157
|
+
controller = Lookbook.config.preview_controller.constantize
|
158
|
+
controller.class_eval { include Lookbook::PreviewController }
|
159
|
+
@preview_controller || controller
|
160
|
+
end
|
157
161
|
end
|
158
162
|
end
|
159
163
|
end
|
data/lib/lookbook/version.rb
CHANGED