Commit f166ad89 by Calen Pennington

Add global methods used by video module to CMS

parent 7aaf2218
jQuery.postWithPrefix = (url, data, callback, type) ->
$.post("#{CMS.prefix}#{url}", data, callback, type)
jQuery.getWithPrefix = (url, data, callback, type) ->
$.get("#{CMS.prefix}#{url}", data, callback, type)
@CMS = @CMS =
Models: {} Models: {}
Views: {} Views: {}
prefix: $("meta[name='path_prefix']").attr('content')
viewStack: [] viewStack: []
start: (el) -> start: (el) ->
...@@ -32,4 +40,11 @@ $ -> ...@@ -32,4 +40,11 @@ $ ->
$.ajaxSetup $.ajaxSetup
headers : { 'X-CSRFToken': $.cookie 'csrftoken' } headers : { 'X-CSRFToken': $.cookie 'csrftoken' }
window.onTouchBasedDevice = ->
navigator.userAgent.match /iPhone|iPod|iPad/i
$('body').addClass 'touch-based-device' if onTouchBasedDevice()
CMS.start($('section.main-container')) CMS.start($('section.main-container'))
...@@ -11,6 +11,8 @@ ...@@ -11,6 +11,8 @@
<link rel="stylesheet" type="text/css" href="${static.url('js/vendor/markitup/sets/wiki/style.css')}" /> <link rel="stylesheet" type="text/css" href="${static.url('js/vendor/markitup/sets/wiki/style.css')}" />
<title><%block name="title"></%block></title> <title><%block name="title"></%block></title>
<meta name="viewport" content="width=device-width,initial-scale=1"> <meta name="viewport" content="width=device-width,initial-scale=1">
<meta name="path_prefix" content="${MITX_ROOT_URL}">
</head> </head>
<body> <body>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment