Sha256: 0e81c13930a1964de3f83819b772058d2eb46e0a78c79b1d47e844c5232255d5

Contents?: true

Size: 1.21 KB

Versions: 6

Compression:

Stored size: 1.21 KB

Contents

module Main
  class MainController < Volt::ModelController
    model :page

    def index
      a = {}
      a[{}] = 5
    end

    def flash_notice
      flash._notices << 'A notice message'
    end

    def flash_success
      flash._successes << 'A success message'
    end

    def flash_warning
      flash._warnings << 'A warning message'
    end

    def flash_error
      flash._errors << 'An error message'
    end

    def cookie_test
      self.model = page._new_cookie!.buffer
    end

    def add_cookie
      cookies.send(:"_#{_name.to_s}=", _value)

      self.model = page._new_cookie!.buffer
    end

    def content_string
      'content'
    end

    private

    # the main template contains a #template binding that shows another
    # template.  This is the path to that template.  It may change based
    # on the params._controller and params._action values.
    def main_path
      "#{params._component || 'main'}/#{params._controller || 'main'}/#{params._action || 'index'}"
    end

    # Determine if the current nav component is the active one by looking
    # at the first part of the url against the href attribute.
    def active_tab?
      url.path.split('/')[1] == attrs.href.split('/')[1]
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
volt-0.9.0.pre4 spec/apps/kitchen_sink/app/main/controllers/main_controller.rb
volt-0.9.0.pre3 spec/apps/kitchen_sink/app/main/controllers/main_controller.rb
volt-0.9.0.pre2 spec/apps/kitchen_sink/app/main/controllers/main_controller.rb
volt-0.9.0.pre1 spec/apps/kitchen_sink/app/main/controllers/main_controller.rb
volt-0.8.27.beta9 spec/apps/kitchen_sink/app/main/controllers/main_controller.rb
volt-0.8.27.beta8 spec/apps/kitchen_sink/app/main/controllers/main_controller.rb