Skip to content

Commit

Permalink
Uses latest version of publisher and use ViewMapper instead of deprec…
Browse files Browse the repository at this point in the history
…ated renderer
  • Loading branch information
stevenjack committed Jul 22, 2014
1 parent 56da974 commit b500fb5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
1 change: 0 additions & 1 deletion alephant-preview.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ Gem::Specification.new do |spec|
spec.add_runtime_dependency 'rake'
spec.add_runtime_dependency 'mustache', '>= 0.99.5'

spec.add_runtime_dependency 'alephant-renderer'
spec.add_runtime_dependency 'alephant-support'
spec.add_runtime_dependency 'alephant-publisher'
end
11 changes: 8 additions & 3 deletions lib/alephant/preview/server.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'alephant/renderer'
require 'alephant/publisher/views/html'
require 'alephant/publisher/views/json'
require 'alephant/publisher/view_mapper'

require 'alephant/support/parser'

Expand Down Expand Up @@ -53,13 +53,13 @@ def render_preview
end

def render_component
::Alephant::Renderer.create(template, base_path, model).render
view_mapper.generate(fixture_data)[template].render
end

private
def model
require model_location
::Alephant::Publisher::Views.get_registered_class(template).new(fixture_data)
Alephant::Publisher::Views.get_registered_class(template).new(fixture_data)
end

def base_path
Expand Down Expand Up @@ -107,6 +107,11 @@ def fixture_location
def preview_template_location
"#{Template.path}/templates/preview.mustache"
end

def view_mapper
Alephant::Publisher::ViewMapper.new(id, BASE_LOCATION)
end

end
end
end

0 comments on commit b500fb5

Please sign in to comment.