lib/rack/oauth2/admin/js/application.coffee in rack-oauth2-server-2.0.1 vs lib/rack/oauth2/admin/js/application.coffee in rack-oauth2-server-2.1.0
- old
+ new
@@ -2,11 +2,11 @@
@.use Sammy.Tmpl
@.use Sammy.Session
@.use Sammy.Title
@.setTitle "OAuth Admin - "
@.use Sammy.OAuth2
- @.authorize = "#{document.location.pathname}/authorize"
+ @.authorize = document.location.pathname + "/authorize"
# All XHR errors we don't catch explicitly handled here
$(document).ajaxError (evt, xhr)->
if xhr.status == 401
app.loseAccessToken()
@@ -190,9 +190,10 @@
# Draw chart inside the specified container element.
# data -- Array of objects, each one having a timestamp (ts) and some value we
# want to chart
# series -- Name of the value we want to chart
$.fn.chart = (data, series)->
+ return if typeof pv == "undefined" # no PV in test environment
canvas = $(@)
w = canvas.width()
h = canvas.height()
today = Math.floor(new Date() / 86400000)
x = pv.Scale.linear(today - 60, today + 1).range(0, w)