bard-static 2.5.0 → 3.0.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8d3eff103b9d52769e649c7ecae01bef27515bf3
4
- data.tar.gz: 9a8f7e2a5222778d878a49bfeccae515d5c22f5e
3
+ metadata.gz: 60e7004e2b16c79a49aba612c843800eecf12335
4
+ data.tar.gz: e455800b3bd4e7b4ae089dc94f8c811b1f913a62
5
5
  SHA512:
6
- metadata.gz: 4da0839166fbab55d856827bd415ee91082cdae6ff0579c85664c29a7fa4ce798d2538b38923df1b61ed8c942c08bab9142303f5dab234dc0128841d61ba20ee
7
- data.tar.gz: 9d462ade5f65a72e0e6a5411f7804fa24826b6933899a590e0823c0a52d92bb340e309b4a2aaeea03a755f0a85f300bff25a8e2a140ff5c55f6d70a86215f4f4
6
+ metadata.gz: cff9928ff08b7b74be432810a3a569496e28a2f919df3e286a1335d110b7aefe99be7a9725ab7f5bae77f1d39154db239c708b340edcae8571c64b8adfcab935
7
+ data.tar.gz: fa5790a613e2026acd4bd6c50b5897ee0c852368266fd9001fdd2e48b9a1744a96592aa76e6c80b3b3e72a72f293e514ca0183675d0dd13cd911d58252de6777
data/Gemfile CHANGED
@@ -1,7 +1,8 @@
1
1
  source "https://rubygems.org"
2
2
 
3
- gem "rails"
3
+ gem "rails", "~> 5.0"
4
4
  gem "rake"
5
5
  gem "capybara"
6
6
  gem "rspec-rails"
7
+ gem "byebug"
7
8
 
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
- Hooks
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]}", :layout => false }
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]}", :layout => layout }
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 :text => "Not Found", :status => 404
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(:template => path)
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", :module => "bard/static" do
3
- root :to => "static#mockups", :file_path => "index"
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 :to => "bard/static/static#static", :file_path => "index", :as => "bard_static_default_root"
7
- get "*file_path" => "bard/static/static#static", :constraints => (lambda do |request|
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
- end)
10
+ }
11
11
  end
12
+
@@ -1,5 +1,5 @@
1
1
  module Bard
2
2
  module Static
3
- VERSION = "2.5.0"
3
+ VERSION = "3.0.0"
4
4
  end
5
5
  end
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: 2.5.0
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: 2017-11-23 00:00:00.000000000 Z
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.4.8
56
+ rubygems_version: 2.6.14
57
57
  signing_key:
58
58
  specification_version: 4
59
59
  summary: Protoyping engine for Rails.