bard-static 2.5.0 → 3.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/Gemfile +3 -1
- data/README.md +9 -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
- data/lib/bard/static.rb +1 -0
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: f5c0a15784402a02d998d165b0874b30b9f5fcd16bae4e4e42141956ecae5105
|
4
|
+
data.tar.gz: 1cddd42f5dae9577077cfeb7ab4dfb45c0baeb0bf8b651e0f1e3bfa03dcacf81
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 626a7c99080a7c1a8d73b0e9ea0280fd1e9d55fa746b9a50d6f8b2c7ea8761e7971d105be39ef1d84585d3a63ad222b0843f334cf22edf995ddb08b26ac8d2aa
|
7
|
+
data.tar.gz: be8e49f33a4cca5f4a4caaf9ba06ac01cfee7ff3c11ebdc98c1d967a9410bfb4632191e048b48563e9db533e7eb182f5a5d94ab198ac4205d41b087be42d38a2
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -14,6 +14,9 @@ Bard::Static
|
|
14
14
|
|| ||
|
15
15
|
|
16
16
|
|
17
|
+
[](https://github.com/botandrose/bard-static/actions?query=workflow%3ACI+branch%3Amaster)
|
18
|
+
[](https://codeclimate.com/github/botandrose/bard-static)
|
19
|
+
|
17
20
|
Installation
|
18
21
|
------------
|
19
22
|
|
@@ -48,15 +51,12 @@ if you like.
|
|
48
51
|
|
49
52
|
All available Rails helpers work nicely. Pure prototyping bliss!
|
50
53
|
|
54
|
+
Helpers
|
55
|
+
-------
|
51
56
|
|
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
|
-
|
57
|
+
`mockup_form_for`: create a dummy form using rails form helpers
|
58
|
+
`link_to_current`: adds a `current` class if the current url matches the link
|
59
|
+
`link_to_nav`: same as `link_to_current` but also matches if the current url is a child of the link
|
60
60
|
|
61
61
|
Gotchas
|
62
62
|
-------
|
@@ -64,3 +64,4 @@ Gotchas
|
|
64
64
|
When rendering a partial, you must specify the full path
|
65
65
|
(e.g. `mockups/posts/form`) unless the partial is in
|
66
66
|
`app/views/mockups/`.
|
67
|
+
|
@@ -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::
|
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::LookupContext.new([Rails.root.join("app/views/static")])
|
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
data/lib/bard/static.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.1.1
|
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: 2022-03-16 00:00:00.000000000 Z
|
16
16
|
dependencies: []
|
17
17
|
description: Handcrafted prototypes for Rails.
|
18
18
|
email:
|
@@ -52,8 +52,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
52
52
|
- !ruby/object:Gem::Version
|
53
53
|
version: '0'
|
54
54
|
requirements: []
|
55
|
-
|
56
|
-
rubygems_version: 2.4.8
|
55
|
+
rubygems_version: 3.2.3
|
57
56
|
signing_key:
|
58
57
|
specification_version: 4
|
59
58
|
summary: Protoyping engine for Rails.
|