require 'sinatra/base' require 'sinatra/assetpack' require 'erector' require 'active_support/all' require 'dvl/flashes' class App < Sinatra::Base set :root, File.dirname(__FILE__) register Sinatra::AssetPack assets do serve '/js', from: '../vendor/assets/javascripts' serve '/css', from: '../vendor/assets/stylesheets' end get '/' do Erector.inline { rawtext '' html { head { link href: '/css/dvl/flashes.css', rel: 'stylesheet', type: 'text/css', media: 'all' } body { # Uncomment to test rendering from existing HTML # widget Dvl::Flashes::Views::Flashes.new(flash: { success: 'You did it!' }) ul { li { a 'Success', href: 'javascript:DvlFlash("success", "You did it!")' } li { a 'Info', href: 'javascript:DvlFlash("info", "An informational message...")' } li { a 'Error', href: 'javascript:DvlFlash("error", "Oh no, an error occured!")' } } script src: '//code.jquery.com/jquery-1.11.1.min.js' script src: '/js/dvl/flashes.js' } } }.to_html end run! if app_file == $0 end