Add new utils.

This commit is contained in:
Fatih Acet 2016-06-09 04:21:50 +03:00
parent c1818eec1d
commit 7df512d5a2
1 changed files with 16 additions and 3 deletions

View File

@ -3,11 +3,24 @@
w.gl or= {}
w.gl.utils or= {}
w.gl.utils.isInGroupsPage = ->
return $('body').data('page').split(':')[0] is 'groups'
w.gl.utils.isInProjectPage = ->
return $('body').data('page').split(':')[0] is 'projects'
w.gl.utils.getProjectSlug = ->
$body = $ 'body'
isInProjectPage = $body.data('page').split(':')[0] is 'projects'
return if @isInProjectPage() then $('body').data 'project' else null
w.gl.utils.getGroupSlug = ->
return if @isInGroupsPage() then $('body').data 'group' else null
return if isInProjectPage then $body.data 'project' else null
) window