     new SignupView()
 
 
-define 'signinView', ['jquery', 'view', 'renderTemplate', 'dataStore', 'navigationBar', 'jquery.form'], ($, View, renderTemplate, dataStore, navigationBar) ->
+define 'signinView', ['jquery', 'view', 'renderTemplate', 'dataStore', 'navigationBar', 'stateController', 'jquery.form'], ($, View, renderTemplate, dataStore, navigationBar, stateController) ->
     class SigninView extends View
         constructor: ->
             @urlRegex = /^\/signin$/

    viewController


define 'navigationBar', ['jquery', 'underscore', 'renderTemplate', 'metadataStore', 'jquery.history'], ($, _, renderTemplate, metadataStore, History) ->
    present: (options = {}) ->
        defaultOptions =
            show:
                news: yes
                about: yes
            urlPath: window.location.pathname
            identity: null
            active: null
        options = _.extend defaultOptions, options

        $navbar = $ '#themis-navbar'
        $navbar.html renderTemplate 'navbar', options

        $signout = $navbar.find 'a[data-action="signout"]'
        if $signout.length > 0
            $signout.on 'click', (e) ->
                e.preventDefault()
                e.stopPropagation()

                url = "#{metadataStore.getMetadata('domain-api')}/signout"
                $.ajax
                    method: 'POST'
                    url: url
                    dataType: 'json'
                    xhrFields:
                        withCredentials: yes
                    success: (responseText, textStatus, jqXHR) ->
                        window.location.reload()
                    error: (jqXHR, textStatus, errorThrown) ->
                        console.log errorThrown


    dismiss: ->
        $navbar = $ '#themis-navbar'
        $signout = $navbar.find 'a[data-action="signout"]'
        $signout.off 'click'
        $navbar.html ''


define 'themis', ['jquery', 'stateController', 'bootstrap'], ($, stateController) ->
    $(document).ready ->
        stateController.init()

    new SigninView()


define 'loginView', ['jquery', 'view', 'renderTemplate', 'dataStore', 'navigationBar', 'stateController', 'jquery.form'], ($, View, renderTemplate, dataStore, navigationBar, stateController) ->
    class LoginView extends View
        constructor: ->
            @urlRegex = /^\/login$/
