Sha256: dce4a430f5c7ef6e16725ceb401b6bebfef690a1b0daa434c09730fe6be41d36

Contents?: true

Size: 1.45 KB

Versions: 8

Compression:

Stored size: 1.45 KB

Contents

require 'rubygems'
require 'bundler/setup'

require 'ruby-event'

module RubyApp

  module Elements

    module Mobile
      require 'ruby_app/element'

      class Document < RubyApp::Element

        class LoadedEvent < RubyApp::Element::Event

          def initialize(data)
            super(data)
          end

        end

        template_path(:all, File.dirname(__FILE__))

        attr_reader :metadata
        attr_reader :links
        attr_reader :stylesheets
        attr_reader :scripts

        attr_reader :pages

        event :loaded

        def initialize
          super

          @metadata = {}
          @links = {}
          @stylesheets = []
          @scripts = []

          @pages = []

          @metadata.merge!('viewport' => 'width=device-width, initial-scale=1')

          @stylesheets.push('http://code.jquery.com/mobile/1.1.0/jquery.mobile-1.1.0.min.css')

          @scripts.push('http://code.jquery.com/jquery-1.7.1.min.js')
          @scripts.push('/ruby_app/resources/elements/mobile/document.js')
          @scripts.push('http://code.jquery.com/mobile/1.1.0/jquery.mobile-1.1.0.min.js')

        end

        def page
          return @pages.last
        end

        protected

          def on_event(event)
            on_loaded(event) if event.is_a?(RubyApp::Elements::Mobile::Document::LoadedEvent)
            super(event)
          end

          def on_loaded(event)
            loaded(event)
          end

      end

    end

  end

end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
RubyApp-0.5.64 lib/ruby_app/elements/mobile/document.rb
RubyApp-0.5.63 lib/ruby_app/elements/mobile/document.rb
RubyApp-0.5.62 lib/ruby_app/elements/mobile/document.rb
RubyApp-0.5.61 lib/ruby_app/elements/mobile/document.rb
RubyApp-0.5.60 lib/ruby_app/elements/mobile/document.rb
RubyApp-0.5.59 lib/ruby_app/elements/mobile/document.rb
RubyApp-0.5.58 lib/ruby_app/elements/mobile/document.rb
RubyApp-0.5.57 lib/ruby_app/elements/mobile/document.rb