Skip to content

Commit

Permalink
Fix missng preview_source helper error
Browse files Browse the repository at this point in the history
  • Loading branch information
allmarkedup committed Jul 30, 2021
1 parent 5a671c3 commit f8cca2e
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
lookbook (0.1.0)
lookbook (0.1.1)
actioncable
listen
rails
Expand Down
3 changes: 0 additions & 3 deletions app/controllers/lookbook/browser_controller.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@


module Lookbook
class BrowserController < ActionController::Base
protect_from_forgery with: :exception
prepend_view_path File.expand_path("../../views/lookbook", __dir__)

helper Lookbook::Engine.helpers
layout "layouts/app"

before_action :assign_previews
Expand Down
3 changes: 3 additions & 0 deletions app/helpers/lookbook/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,8 @@ def highlight(source, language)
lexer = Rouge::Lexer.find(language)
formatter.format(lexer.lex(source)).html_safe
end

def preview_source
end
end
end
5 changes: 5 additions & 0 deletions lib/lookbook/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ class Engine < Rails::Engine
end
end

config.to_prepare do
Lookbook::BrowserController.helper Lookbook::Engine.helpers
Lookbook::BrowserController.prepend_view_path Lookbook::Engine.root.join("app/views")
end

config.after_initialize do |app|
if app.config.lookbook.auto_refresh
@listener = Listen.to(*app.config.lookbook.listen_paths, only: /\.(rb|html.*)$/) do |modified, added, removed|
Expand Down

0 comments on commit f8cca2e

Please sign in to comment.