Skip to content

Commit

Permalink
Merge pull request #106 from open-craft/omar/edx-release/report-download
Browse files Browse the repository at this point in the history
Fix dashboard report image download (edx-release hotfix)
  • Loading branch information
omarkhan committed Mar 14, 2016
2 parents a4e1e42 + 85f9a26 commit fe0e825
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ install:
- "pip install -r requirements.txt"
- "pip install -r $VIRTUAL_ENV/src/xblock-sdk/requirements/base.txt"
- "pip install -r $VIRTUAL_ENV/src/xblock-sdk/requirements/test.txt"
- "pip uninstall -y xblock-problem-builder && python setup.py sdist && pip install dist/xblock-problem-builder-2.0.2.tar.gz"
- "pip uninstall -y xblock-problem-builder && python setup.py sdist && pip install dist/xblock-problem-builder-2.0.3.tar.gz"
- "pip install -r test_requirements.txt"
- "mkdir var"
script:
Expand Down
12 changes: 12 additions & 0 deletions problem_builder/public/js/dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,18 @@ function PBDashboardBlock(runtime, element, initData) {
var generateDataUriFromImageURL = function(imgURL) {
// Given the URL to an image, IF the image has already been cached by the browser,
// returns a data: URI with the contents of the image (image will be converted to PNG)

// Expand relative urls and urls without an explicit protocol into absolute urls
var a = document.createElement('a');
a.href = imgURL;
imgURL = a.href;

// If the image is from another domain, just return its URL. We can't
// create a data URL from cross-domain images:
// https://html.spec.whatwg.org/multipage/scripting.html#dom-canvas-todataurl
if (a.origin !== window.location.origin)
return imgURL;

var img = new Image();
img.src = imgURL;
if (!img.complete)
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def package_data(pkg, root_list):

setup(
name='xblock-problem-builder',
version='2.0.2',
version='2.0.3',
description='XBlock - Problem Builder',
packages=['problem_builder', 'problem_builder.v1'],
install_requires=[
Expand Down

0 comments on commit fe0e825

Please sign in to comment.