Sha256: ceb2b4096bb1dbc45627e6d7bdb2bfcd7f77d9d9fea7ce6604a94e756aaec30c

Contents?: true

Size: 1.3 KB

Versions: 2

Compression:

Stored size: 1.3 KB

Contents

require 'sinatra/base'
require 'sinatra/assetpack'
require 'active_support/all'
require 'erector'
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 '<!doctype html>'
      html {
        head {
          link href: '/css/dvl/flashes.css', rel: 'stylesheet', type: 'text/css', media: 'all'
          style '* {box-sizing:border-box;}'.html_safe, type: 'text/css'
        }
        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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
dvl-flashes-0.0.3 preview/app.rb
dvl-flashes-0.0.2 preview/app.rb