gitlab-org--gitlab-foss/app/assets/javascripts/dispatcher.js.coffee

43 lines
974 B
CoffeeScript
Raw Normal View History

$ ->
new Dispatcher()
class Dispatcher
constructor: () ->
@initSearch()
@initPageScripts()
initPageScripts: ->
page = $('body').attr('data-page')
2013-05-02 11:36:53 +00:00
project_id = $('body').attr('data-project-id')
console.log(page)
2013-05-02 11:36:53 +00:00
unless page
return false
2013-05-02 11:36:53 +00:00
path = page.split(':')
switch page
2013-05-02 11:36:53 +00:00
when 'issues:index'
Issues.init()
when 'dashboard:show'
new Dashboard()
when 'commit:show'
new Commit()
when 'groups:show', 'teams:show', 'projects:show'
Pager.init(20, true)
when 'projects:new', 'projects:edit'
2013-05-02 11:36:53 +00:00
new Project()
when 'walls:show'
new Wall(project_id)
2013-05-30 07:57:10 +00:00
when 'teams:members:index'
new TeamMembers()
2013-05-02 11:36:53 +00:00
switch path.first()
when 'admin' then new Admin()
2013-05-02 11:36:53 +00:00
when 'wikis' then new Wikis()
initSearch: ->
autocomplete_json = $('.search-autocomplete-json').data('autocomplete-opts')
new SearchAutocomplete(autocomplete_json)