Sha256: 6fa8bb13e007294f5049f8666e99ce91b5aae78d45744a03081ec850267cfb40
Contents?: true
Size: 1.7 KB
Versions: 1
Compression:
Stored size: 1.7 KB
Contents
require 'rubygems' require 'bundler/setup' require 'ruby-event' module RubyApp module Elements module Mobile require 'ruby_app/element' class List < RubyApp::Element class ClickedEvent < RubyApp::Element::Event attr_reader :index, :item def initialize(data) super(data) @index = data['index'].to_i @item = self.source.items[@index] end def to_hash super.merge('index' => @index) end end class ItemClickedEvent < RubyApp::Elements::Mobile::List::ClickedEvent def initialize(data) super(data) end end class LinkClickedEvent < RubyApp::Elements::Mobile::List::ClickedEvent def initialize(data) super(data) end end template_path(:all, File.dirname(__FILE__)) attr_accessor :items attr_accessor :is_split event :item_clicked event :link_clicked def initialize super self.attributes.merge!('data-role' => 'listview') @items = [] @is_split = false end def split? return self.is_split end protected def on_event(event) on_item_clicked(event) if event.is_a?(RubyApp::Elements::Mobile::List::ItemClickedEvent) on_link_clicked(event) if event.is_a?(RubyApp::Elements::Mobile::List::LinkClickedEvent) super(event) end def on_item_clicked(event) item_clicked(event) end def on_link_clicked(event) link_clicked(event) end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
RubyApp-0.5.17 | lib/ruby_app/elements/mobile/list.rb |