Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uri root path issues for themes and sessions. #196

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions coffees/ext/sessions.coffee
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
_root_path = document.body.getAttribute('data-root-path')

document.addEventListener 'keydown', (e) ->
return true unless e.altKey and e.keyCode is 69
oReq = new XMLHttpRequest()
Expand All @@ -10,13 +12,14 @@ document.addEventListener 'keydown', (e) ->
else
out += '<ul>'
for session in response.sessions
out += "<li><a href=\"/session/#{session}\">#{session}</a></li>"
path = "{_root_path}/session/#{session}"
out += "<li><a href=\"{path}\">#{session}</a></li>"
out += '</ul>'

out += '</div>'

popup.open out

oReq.open("GET", "/sessions/list.json")
oReq.open("GET", _root_path + "/sessions/list.json")
oReq.send()
cancel e
10 changes: 6 additions & 4 deletions coffees/ext/theme.coffee
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
_root_path = document.body.getAttribute('data-root-path')

_set_theme_href = (href) ->
document.getElementById('style').setAttribute('href', href)
img = document.createElement('img')
Expand Down Expand Up @@ -48,18 +50,18 @@ document.addEventListener 'keydown', (e) ->
inner += theme
inner += '</option>'

option "/static/main.css", 'default'
option _root_path + "/static/main.css", 'default'

if themes.length
inner += '<optgroup label="Local themes">'
for theme in themes
url = "/theme/#{theme}/style.css"
url = _root_path + "/theme/#{theme}/style.css"
option url, theme
inner += '</optgroup>'

inner += '<optgroup label="Built-in themes">'
for theme in builtin_themes
url = "/theme/#{theme}/style.css"
url = _root_path + "/theme/#{theme}/style.css"
option url, theme.slice('built-in-'.length)
inner += '</optgroup>'

Expand All @@ -74,7 +76,7 @@ document.addEventListener 'keydown', (e) ->

theme_list.addEventListener 'change', -> set_theme theme_list.value

oReq.open("GET", "/themes/list.json")
oReq.open("GET", _root_path + "/themes/list.json")
oReq.send()

cancel e