-
Notifications
You must be signed in to change notification settings - Fork 37
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
Added functionality for downloading spectrum image #245
Changes from 7 commits
4fedbce
4368655
2bd1101
7650ccf
692c7b2
24d7062
1962fa2
d7834a7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -161,6 +161,16 @@ $W = { | |
this_.getRecentCalibrations("#calibration_id"); | ||
}, | ||
|
||
downloadSpectrum: function() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This looks awesome. Is this something we ought to write a test for? It seems like it could be a pretty easy test? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure, in which file would it make more sense tho 😅 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So the test assertion would be to confirm what There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could we try using Cypress to press the download button and then assert if |
||
let base64_imgdata = $('#dataurl').val($W.canvas.toDataURL())[0].defaultValue; | ||
console.log(base64_imgdata); | ||
|
||
let a = document.createElement('a'); | ||
a.href = base64_imgdata; | ||
a.download = ('spectrum_img.png'); | ||
a.click(); | ||
}, | ||
|
||
getRecentCalibrations: function(selector) { | ||
$.ajax({ | ||
url: "/capture/recent_calibrations.json?calibration_id=" + $W.calibration_id, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -246,9 +246,14 @@ <h1> | |
</div> | ||
</div> | ||
|
||
<input name="dataurl" type="hidden" id="dataurl" /> | ||
|
||
<button class="demo-button next" id="capture-page-next">Save Capture</button> | ||
<p style="margin-top: 0.5em">Once you save the capture, you cannot go back here.</p> | ||
<img style="display:none;background:#333;" id="spectrum-preview" /> | ||
|
||
<button class="demo-button next" id="download-spectrum" onClick="$W.downloadSpectrum();">Download</button> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. here's the button |
||
|
||
</div> | ||
|
||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This failed. Great!