Sha256: 001a98db598247f04f07581b2ac0b84da7bfcfe39e34cd06b4e4d5e13d95d69f

Contents?: true

Size: 1.54 KB

Versions: 9

Compression:

Stored size: 1.54 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')
          @stylesheets.push("/#{RubyApp::Language.locale.code}/document.css")

          @scripts.push('http://code.jquery.com/jquery-1.7.1.js')
          @scripts.push('http://code.jquery.com/mobile/1.1.0-rc.1/jquery.mobile-1.1.0-rc.1.js')
          @scripts.push("/#{RubyApp::Language.locale.code}/document.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

9 entries across 9 versions & 1 rubygems

Version Path
RubyApp-0.5.30 lib/ruby_app/elements/mobile/document.rb
RubyApp-0.5.29 lib/ruby_app/elements/mobile/document.rb
RubyApp-0.5.28 lib/ruby_app/elements/mobile/document.rb
RubyApp-0.5.23 lib/ruby_app/elements/mobile/document.rb
RubyApp-0.5.18 lib/ruby_app/elements/mobile/document.rb
RubyApp-0.5.17 lib/ruby_app/elements/mobile/document.rb
RubyApp-0.5.16 lib/ruby_app/elements/mobile/document.rb
RubyApp-0.5.15 lib/ruby_app/elements/mobile/document.rb
RubyApp-0.5.13 lib/ruby_app/elements/mobile/document.rb