Commit f44989e5 by cahrens

Use Brian's open external method.

parent fd9c29f4
...@@ -167,10 +167,15 @@ function linkSmoothScroll(e) { ...@@ -167,10 +167,15 @@ function linkSmoothScroll(e) {
} }
function linkNewWindow(e) { function linkNewWindow(e) {
window.open($(this).attr('href')); window.open($(e.target).attr('href'));
e.preventDefault(); e.preventDefault();
} }
// On AWS instances, base.js gets wrapped in a separate scope as part of Django static
// pipelining (note, this doesn't happen on local runtimes). So if we set it on window,
// when we can access it from other scopes (namely the checklists)
window.cmsLinkNewWindow = linkNewWindow;
function toggleSections(e) { function toggleSections(e) {
e.preventDefault(); e.preventDefault();
......
...@@ -6,7 +6,7 @@ CMS.Views.Checklists = Backbone.View.extend({ ...@@ -6,7 +6,7 @@ CMS.Views.Checklists = Backbone.View.extend({
events : { events : {
'click .course-checklist .checklist-title' : "toggleChecklist", 'click .course-checklist .checklist-title' : "toggleChecklist",
'click .course-checklist .task input' : "toggleTask", 'click .course-checklist .task input' : "toggleTask",
'click a[rel="external"]' : "openInNewTab" 'click a[rel="external"]' : window.cmsLinkNewWindow
}, },
initialize : function() { initialize : function() {
...@@ -85,11 +85,5 @@ CMS.Views.Checklists = Backbone.View.extend({ ...@@ -85,11 +85,5 @@ CMS.Views.Checklists = Backbone.View.extend({
}, },
error : CMS.ServerError error : CMS.ServerError
}); });
},
openInNewTab : function(e) {
e.preventDefault();
window.open($(e.target).attr('href'));
} }
}); });
\ No newline at end of file
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