2015-07-06 13:20:21 +02:00
|
|
|
# By default Volt generates this controller for your Main component
|
2015-07-11 20:41:38 +02:00
|
|
|
require "salama"
|
2015-07-06 20:55:34 +02:00
|
|
|
|
2015-07-06 21:25:55 +02:00
|
|
|
if RUBY_PLATFORM == 'opal'
|
2015-07-09 14:23:36 +02:00
|
|
|
require "main/lib/main_view"
|
2015-07-06 21:25:55 +02:00
|
|
|
end
|
2015-07-09 14:23:36 +02:00
|
|
|
|
2015-07-06 13:20:21 +02:00
|
|
|
module Main
|
|
|
|
class MainController < Volt::ModelController
|
2015-07-06 21:22:57 +02:00
|
|
|
|
2015-07-06 13:20:21 +02:00
|
|
|
def index
|
2015-07-09 14:23:36 +02:00
|
|
|
MainView.new()
|
2015-07-06 13:20:21 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
def about
|
2015-07-11 20:41:38 +02:00
|
|
|
promise = ParseTask.parse(1).then do |result|
|
|
|
|
puts result
|
|
|
|
end.fail do |error|
|
|
|
|
puts "Error: #{error}"
|
|
|
|
end
|
2015-07-06 13:20:21 +02:00
|
|
|
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._component, 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
|