lib/server.rb in machinery-tool-1.20.0 vs lib/server.rb in machinery-tool-1.21.0

- old
+ new

@@ -100,10 +100,15 @@ def in_both "<h3>In both descriptions:</h3>" end + def offset_class(first_col) + return "" if first_col + "col-md-offset-6" + end + def changed "<h3>In both with different attributes:</h3>" end def pluralize_scope(object, singular, plural) @@ -249,11 +254,11 @@ attachment File.basename(filename) content end - get "/" do + def all_descriptions check_session_for_error descriptions = settings.system_description_store.list @all_descriptions = Hash.new descriptions.each do |name| @@ -281,15 +286,25 @@ Machinery::Errors::SystemDescriptionError => e @errors ||= Array.new @errors.push(e) end end + end - haml File.read(File.join(Machinery::ROOT, "html/landing_page.html.haml")) + get "/" do + all_descriptions + + haml File.read(File.join(Machinery::ROOT, "html/homepage.html.haml")) end + get "/fonts/:font" do + File.read(File.join(Machinery::ROOT, "html/assets/fonts/#{params[:font]}")) + end + get "/compare/:a/:b" do + all_descriptions + @description_a = SystemDescription.load(params[:a], settings.system_description_store) @description_b = SystemDescription.load(params[:b], settings.system_description_store) @meta = {} @diff = {} @@ -328,9 +343,11 @@ diff.to_s(:html) end get "/:id" do + all_descriptions + begin @description = SystemDescription.load(params[:id], settings.system_description_store) rescue Machinery::Errors::SystemDescriptionNotFound => e session[:error] = e.to_s redirect "/"