* Refactor event handling in controllers to use a method to define the hash (and thereby allow inheritance) * Refactor link handling so that links which should be handled by the router can be handled by the base class * Change the router to throw out controllers for pages which aren't on-screen (and thereby avoid a lot of weirdness)
34 lines
1.0 KiB
CoffeeScript
34 lines
1.0 KiB
CoffeeScript
###
|
|
Crafting Guide - header_controller.coffee
|
|
|
|
Copyright (c) 2015 by Redwood Labs
|
|
All rights reserved.
|
|
###
|
|
|
|
BaseController = require './base_controller'
|
|
|
|
########################################################################################################################
|
|
|
|
module.exports = class HeaderController extends BaseController
|
|
|
|
constructor: (options={})->
|
|
super options
|
|
|
|
# Event Methods ################################################################################
|
|
|
|
onLogoClicked: ->
|
|
router.navigate '/', trigger:true
|
|
return false
|
|
|
|
# BaseController Overrides #####################################################################
|
|
|
|
render: ->
|
|
# Overriding render because the header is already part of the stock page layout, and we
|
|
# don't need to replace it here.
|
|
|
|
# Backbone.View Overrides ######################################################################
|
|
|
|
events: ->
|
|
return _.extend super,
|
|
'click a.logo': 'onLogoClicked'
|