Sha256: 91444f9b0416d4c511a184d5e52c427c0f1849352bc2278151cd41c6066ae31f

Contents?: true

Size: 1.16 KB

Versions: 70

Compression:

Stored size: 1.16 KB

Contents

require 'rubygems'
require 'bundler/setup'

require 'ruby-event'

module RubyApp

  module Elements

    module Navigation

      module Base
        require 'ruby_app/element'

        class BaseBreadcrumbs < RubyApp::Element

          class ClickedEvent < RubyApp::Element::Event

            attr_reader :page

            def initialize(data)
              super(data)
              @page = RubyApp::Element.get_element(data['page_id'])
            end

            def to_hash
              super.merge('page_id' => @page.element_id)
            end

          end

          template_path(:all, File.dirname(__FILE__))

          def initialize
            super
          end

          protected

            def on_event(event)
              on_clicked(event) if event.is_a?(RubyApp::Elements::Navigation::Base::BaseBreadcrumbs::ClickedEvent)
              super(event)
            end

            def on_clicked(event)
              RubyApp::Session.pages.slice!(RubyApp::Session.pages.index(event.page) + 1, RubyApp::Session.pages.length - ( RubyApp::Session.pages.index(event.page) + 1 ))
              event.refresh
            end

        end

      end

    end

  end

end

Version data entries

70 entries across 70 versions & 1 rubygems

Version Path
RubyApp-0.0.71 lib/ruby_app/elements/navigation/base/base_breadcrumbs.rb
RubyApp-0.0.70 lib/ruby_app/elements/navigation/base/base_breadcrumbs.rb
RubyApp-0.0.69 lib/ruby_app/elements/navigation/base/base_breadcrumbs.rb
RubyApp-0.0.68 lib/ruby_app/elements/navigation/base/base_breadcrumbs.rb
RubyApp-0.0.64 lib/ruby_app/elements/navigation/base/base_breadcrumbs.rb
RubyApp-0.0.63 lib/ruby_app/elements/navigation/base/base_breadcrumbs.rb
RubyApp-0.0.62 lib/ruby_app/elements/navigation/base/base_breadcrumbs.rb
RubyApp-0.0.61 lib/ruby_app/elements/navigation/base/base_breadcrumbs.rb
RubyApp-0.0.60 lib/ruby_app/elements/navigation/base/base_breadcrumbs.rb
RubyApp-0.0.59 lib/ruby_app/elements/navigation/base/base_breadcrumbs.rb
RubyApp-0.0.58 lib/ruby_app/elements/navigation/base/base_breadcrumbs.rb
RubyApp-0.0.57 lib/ruby_app/elements/navigation/base/base_breadcrumbs.rb
RubyApp-0.0.56 lib/ruby_app/elements/navigation/base/base_breadcrumbs.rb
RubyApp-0.0.55 lib/ruby_app/elements/navigation/base/base_breadcrumbs.rb
RubyApp-0.0.54 lib/ruby_app/elements/navigation/base/base_breadcrumbs.rb
RubyApp-0.0.53 lib/ruby_app/elements/navigation/base/base_breadcrumbs.rb
RubyApp-0.0.52 lib/ruby_app/elements/navigation/base/base_breadcrumbs.rb
RubyApp-0.0.51 lib/ruby_app/elements/navigation/base/base_breadcrumbs.rb
RubyApp-0.0.50 lib/ruby_app/elements/navigation/base/base_breadcrumbs.rb
RubyApp-0.0.49 lib/ruby_app/elements/navigation/base/base_breadcrumbs.rb