lib/parade/server.rb in parade-0.9.2 vs lib/parade/server.rb in parade-0.10.0

- old
+ new

@@ -92,19 +92,23 @@ helpers do # # A shortcut to define a CSS resource file within a view template # - def css(filepath) - %{<link rel="stylesheet" href="#{File.join "css", filepath}" type="text/css"/>} + def css(*filepaths) + filepaths.map do |filepath| + %{<link rel="stylesheet" href="#{File.join "css", filepath}" type="text/css"/>} + end.join("\n") end # # A shortcut to define a Javascript resource file within a view template # - def js(filepath) - %{<script type="text/javascript" src="#{File.join "js", filepath}"></script>} + def js(*filepaths) + filepaths.map do |filepath| + %{<script type="text/javascript" src="#{File.join "js", filepath}"></script>} + end.join("\n") end def custom_resource(resource_extension) load_presentation.resources.map do |resource_path| Dir.glob("#{resource_path}/*.#{resource_extension}").map do |path| @@ -124,11 +128,12 @@ end end def plugin_css_files self.class.plugin_stylesheet_files.map do |path| - "<style>\n#{File.read(path)}\n</style>" + content = File.read(path) + erb :inline_css, locals: { content: content } end.join("\n") end # # This helper method is called within the header to return the theme specified by the @@ -138,11 +143,12 @@ css("themes/#{load_presentation.theme}.css") if load_presentation.theme end def plugin_js_files self.class.plugin_javascript_files.map do |path| - "<script type='text/javascript'>#{File.read(path)}</script>" + content = File.read(path) + erb :inline_js, locals: { content: content } end.join("\n") end # # Create resources links to all the Javascript files found at the root of @@ -164,14 +170,18 @@ def title presentation.title end - def slides - presentation.to_html + def slides(options = {}) + presentation.to_html(options) end + def footer + presentation.footer + end + def pause_message presentation.pause_message end end @@ -186,19 +196,22 @@ # # The request for slides is used by the client-side javascript presentation # and returns all the slides HTML. # + # A hash of params may contain: + # * height - the current height of the window + # * width - the current width of the window get "/slides" do - slides + slides(params) end get "/" do erb :index end - get "/onepage" do - erb :onepage + get "/print" do + erb :print end end end \ No newline at end of file