Sha256: c33091afd1d818ae28c7910d3e6dda4f4772d2276781322e33328c9d909038e9

Contents?: true

Size: 1.52 KB

Versions: 1

Compression:

Stored size: 1.52 KB

Contents

require 'sinatra/base'
require 'sinatra/asset_pipeline'
require 'active_support/all'
require 'erector'
require 'dvl/flashes'
require 'dvl/core'

class App < Sinatra::Base

  set :root, File.dirname(__FILE__)
  set :assets_prefix, [
    'vendor/assets',
    "#{Gem::Specification.find_by_name("dvl-core").gem_dir}/vendor/assets"
  ]

  register Sinatra::AssetPipeline

  get '/' do
    Erector.inline {
      rawtext '<!doctype html>'
      html {
        head {
          link href: '//fonts.googleapis.com/css?family=Open+Sans:400,300,700,600', rel: 'stylesheet', type: 'text/css'
          link href: '/assets/dvl/core.css', rel: 'stylesheet', type: 'text/css', media: 'all'
          link href: '/assets/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: '/assets/dvl/core.js'
          script src: '/assets/dvl/flashes.js'
        }
      }
    }.to_html
  end

  run! if app_file == $0
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dvl-flashes-0.0.4 preview/app.rb