Class: RubyApp::Elements::Mobile::Document

Inherits:
RubyApp::Element show all
Defined in:
lib/ruby_app/elements/mobile/document.rb

Defined Under Namespace

Classes: LoadedEvent

Instance Attribute Summary collapse

Attributes inherited from RubyApp::Element

#attributes

Instance Method Summary collapse

Methods inherited from RubyApp::Element

#element_id, get_element

Methods included from Mixins::ConfigurationMixin

#configuration

Methods included from Mixins::TranslateMixin

#localize, #translate

Methods included from Mixins::TemplateMixin

#exclude_parent_template, #exclude_parent_template?, #get_cache, #get_default_template, #get_template, #get_template_name, #get_templates, #template_path

Methods included from Mixins::RenderMixin

#content_for, #get_cache, #get_default_template, #get_templates, #render

Constructor Details

#initializeDocument

Returns a new instance of Document.



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/ruby_app/elements/mobile/document.rb', line 34

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('http://code.jquery.com/ui/1.8.21/jquery-ui.min.js')
  @scripts.push('/ruby_app/resources/elements/mobile/document/jquery.ui.touch-punch.min.js')
  @scripts.push('/ruby_app/resources/elements/mobile/document/document.js')
  @scripts.push('http://code.jquery.com/mobile/1.1.0/jquery.mobile-1.1.0.min.js')

end

Instance Attribute Details

Returns the value of attribute links.



26
27
28
# File 'lib/ruby_app/elements/mobile/document.rb', line 26

def links
  @links
end

#metadataObject (readonly)

Returns the value of attribute metadata.



25
26
27
# File 'lib/ruby_app/elements/mobile/document.rb', line 25

def 
  @metadata
end

#pagesObject (readonly)

Returns the value of attribute pages.



30
31
32
# File 'lib/ruby_app/elements/mobile/document.rb', line 30

def pages
  @pages
end

#scriptsObject (readonly)

Returns the value of attribute scripts.



28
29
30
# File 'lib/ruby_app/elements/mobile/document.rb', line 28

def scripts
  @scripts
end

#stylesheetsObject (readonly)

Returns the value of attribute stylesheets.



27
28
29
# File 'lib/ruby_app/elements/mobile/document.rb', line 27

def stylesheets
  @stylesheets
end

Instance Method Details

#hide(event, url = '/') ⇒ Object



65
66
67
68
# File 'lib/ruby_app/elements/mobile/document.rb', line 65

def hide(event, url = '/')
  RubyApp::Session.documents.pop
  event.go(url)
end

#pageObject



56
57
58
# File 'lib/ruby_app/elements/mobile/document.rb', line 56

def page
  return @pages.last
end

#show(event, url = '/') ⇒ Object



60
61
62
63
# File 'lib/ruby_app/elements/mobile/document.rb', line 60

def show(event, url = '/')
  RubyApp::Session.documents.push(self)
  event.go(url)
end