Sha256: e06b769cce7fbb102ca005ffa5969acd24c4e4d6cfc9026bfe991dbf337974c2

Contents?: true

Size: 1.4 KB

Versions: 6

Compression:

Stored size: 1.4 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-rc.1/jquery.mobile-1.1.0-rc.1.min.css')

          @scripts.push('http://code.jquery.com/jquery-1.7.1.min.js')
          @scripts.push('http://code.jquery.com/mobile/1.1.0-rc.1/jquery.mobile-1.1.0-rc.1.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

6 entries across 6 versions & 1 rubygems

Version Path
RubyApp-0.5.45 lib/ruby_app/elements/mobile/document.rb
RubyApp-0.5.44 lib/ruby_app/elements/mobile/document.rb
RubyApp-0.5.43 lib/ruby_app/elements/mobile/document.rb
RubyApp-0.5.42 lib/ruby_app/elements/mobile/document.rb
RubyApp-0.5.41 lib/ruby_app/elements/mobile/document.rb
RubyApp-0.5.40 lib/ruby_app/elements/mobile/document.rb