Add a helper function for getting the page path from JS.

This commit is contained in:
Connor Shea 2016-06-29 15:32:52 -06:00
parent a99e5cd810
commit 7b9b2ce3c5
No known key found for this signature in database
GPG key ID: E52237E5B35A83E6
2 changed files with 6 additions and 3 deletions

View file

@ -5,12 +5,12 @@
w.gl.utils.isInGroupsPage = ->
return $('body').data('page').split(':')[0] is 'groups'
return gl.utils.getPagePath() is 'groups'
w.gl.utils.isInProjectPage = ->
return $('body').data('page').split(':')[0] is 'projects'
return gl.utils.getPagePath() is 'projects'
w.gl.utils.getProjectSlug = ->
@ -40,6 +40,9 @@
e.stopImmediatePropagation()
return false
gl.utils.getPagePath = ->
return $('body').data('page').split(':')[0]
jQuery.timefor = (time, suffix, expiredLabel) ->

View file

@ -79,5 +79,5 @@ $ ->
if comment && comment.length > 1 && $title.val() == ''
$title.val(comment[1]).change()
if $('body').attr('data-page').split(':').first() == 'profiles'
if gl.utils.getPagePath() == 'profiles'
new Profile()