bard-static 2.5.0 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +2 -1
- data/README.md +6 -8
- data/app/controllers/bard/static/static_controller.rb +4 -9
- data/config/routes.rb +7 -6
- data/lib/bard/static/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 60e7004e2b16c79a49aba612c843800eecf12335
|
4
|
+
data.tar.gz: e455800b3bd4e7b4ae089dc94f8c811b1f913a62
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cff9928ff08b7b74be432810a3a569496e28a2f919df3e286a1335d110b7aefe99be7a9725ab7f5bae77f1d39154db239c708b340edcae8571c64b8adfcab935
|
7
|
+
data.tar.gz: fa5790a613e2026acd4bd6c50b5897ee0c852368266fd9001fdd2e48b9a1744a96592aa76e6c80b3b3e72a72f293e514ca0183675d0dd13cd911d58252de6777
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -48,15 +48,12 @@ if you like.
|
|
48
48
|
|
49
49
|
All available Rails helpers work nicely. Pure prototyping bliss!
|
50
50
|
|
51
|
+
Helpers
|
52
|
+
-------
|
51
53
|
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
BardStatic let's you add a `#before_bard_static` method in
|
56
|
-
`ApplicationController`, that will be run before any prototype. You can
|
57
|
-
use it, for example, to provide authentication or prevent prototypes
|
58
|
-
from being rendered in production.
|
59
|
-
|
54
|
+
`mockup_form_for`: create a dummy form using rails form helpers
|
55
|
+
`link_to_current`: adds a `current` class if the current url matches the link
|
56
|
+
`link_to_nav`: same as `link_to_current` but also matches if the current url is a child of the link
|
60
57
|
|
61
58
|
Gotchas
|
62
59
|
-------
|
@@ -64,3 +61,4 @@ Gotchas
|
|
64
61
|
When rendering a partial, you must specify the full path
|
65
62
|
(e.g. `mockups/posts/form`) unless the partial is in
|
66
63
|
`app/views/mockups/`.
|
64
|
+
|
@@ -1,19 +1,14 @@
|
|
1
1
|
module Bard
|
2
2
|
module Static
|
3
3
|
class StaticController < ApplicationController
|
4
|
-
skip_before_action :verify_authenticity_token
|
5
|
-
|
6
|
-
before_action :before_bard_static,
|
7
|
-
:if => proc { respond_to?(:before_bard_static, true) }
|
8
|
-
|
9
4
|
def mockups
|
10
5
|
request.env["bard_static.prototype"] = true
|
11
|
-
with_404_handler { render_with_index "mockups/#{params[:file_path]}", :
|
6
|
+
with_404_handler { render_with_index "mockups/#{params[:file_path]}", layout: false }
|
12
7
|
end
|
13
8
|
|
14
9
|
def static
|
15
10
|
layout = !request.xhr? # render ajax responses with no layout
|
16
|
-
with_404_handler { render_with_index "static/#{params[:file_path]}", :
|
11
|
+
with_404_handler { render_with_index "static/#{params[:file_path]}", layout: layout }
|
17
12
|
end
|
18
13
|
|
19
14
|
private
|
@@ -22,14 +17,14 @@ module Bard
|
|
22
17
|
begin
|
23
18
|
yield
|
24
19
|
rescue ActionView::MissingTemplate
|
25
|
-
render :
|
20
|
+
render text: "Not Found", status: 404
|
26
21
|
end
|
27
22
|
end
|
28
23
|
|
29
24
|
def render_with_index path, options = {}
|
30
25
|
begin
|
31
26
|
options = options.dup # render is destructive to the options hash!
|
32
|
-
options = options.merge(:
|
27
|
+
options = options.merge(template: path)
|
33
28
|
render options
|
34
29
|
rescue ActionView::MissingTemplate
|
35
30
|
options[:template] = "#{path}/index"
|
data/config/routes.rb
CHANGED
@@ -1,11 +1,12 @@
|
|
1
1
|
Rails.application.routes.draw do
|
2
|
-
namespace "mockups", :
|
3
|
-
root :
|
2
|
+
namespace "mockups", module: "bard/static" do
|
3
|
+
root to: "static#mockups", file_path: "index"
|
4
4
|
get "/*file_path" => "static#mockups"
|
5
5
|
end
|
6
|
-
root :
|
7
|
-
get "*file_path" => "bard/static/static#static", :
|
8
|
-
lookup_context = ActionView::Base.new("app/views/static").lookup_context
|
6
|
+
root to: "bard/static/static#static", file_path: "index", as: "bard_static_default_root"
|
7
|
+
get "*file_path" => "bard/static/static#static", constraints: ->(request){
|
8
|
+
lookup_context = ActionView::Base.new(Rails.root.join("app/views/static")).lookup_context
|
9
9
|
lookup_context.exists?(request.path) || lookup_context.exists?(request.path + "/index")
|
10
|
-
|
10
|
+
}
|
11
11
|
end
|
12
|
+
|
data/lib/bard/static/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bard-static
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Micah Geisel
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date:
|
15
|
+
date: 2018-04-20 00:00:00.000000000 Z
|
16
16
|
dependencies: []
|
17
17
|
description: Handcrafted prototypes for Rails.
|
18
18
|
email:
|
@@ -53,7 +53,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
53
53
|
version: '0'
|
54
54
|
requirements: []
|
55
55
|
rubyforge_project:
|
56
|
-
rubygems_version: 2.
|
56
|
+
rubygems_version: 2.6.14
|
57
57
|
signing_key:
|
58
58
|
specification_version: 4
|
59
59
|
summary: Protoyping engine for Rails.
|