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
55
# 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')

  @links.merge!('icon' => "#{RubyApp::Application.root_or_nil}/ruby_app/resources/elements/mobile/document/icon.ico")

  @stylesheets.push("#{RubyApp::Application.root_or_nil}/ruby_app/resources/elements/mobile/document/jquery.mobile-1.3.0/jquery.mobile-1.3.0.min.css")

  @scripts.push("#{RubyApp::Application.root_or_nil}/ruby_app/resources/elements/mobile/document/jquery-1.8.3.min.js")
  @scripts.push("#{RubyApp::Application.root_or_nil}/ruby_app/resources/elements/mobile/document/jquery-ui-1.9.2.custom/js/jquery-ui-1.9.2.custom.min.js")
  @scripts.push("#{RubyApp::Application.root_or_nil}/ruby_app/resources/elements/mobile/document/document.js")
  @scripts.push("#{RubyApp::Application.root_or_nil}/ruby_app/resources/elements/mobile/document/jquery.mobile-1.3.0/jquery.mobile-1.3.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 = RubyApp::Application.root) ⇒ Object



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

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

#pageObject



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

def page
  return @pages.last
end

#show(event, url = RubyApp::Application.root) ⇒ Object



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

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