Most JS files, all helpers and simple reconciliations
This commit is contained in:
1 parent
21400c5836
commit
9e69c43dda
58 files changed
+776
-1025
No files matched your search
@@ -1,3 +1,5 @@
|
||||
import { Blaze } from 'meteor/blaze';
|
||||
|
||||
/**
|
||||
* A global Blaze UI helper to capitalizes the first letter of an input String
|
||||
*
|
||||
@@ -5,10 +7,10 @@
|
||||
*
|
||||
* http://stackoverflow.com/questions/1026069/capitalize-the-first-letter-of-string-in-javascript
|
||||
*/
|
||||
UI.registerHelper('capitalizeFirstLetter', function (context) {
|
||||
Blaze.registerHelper('capitalizeFirstLetter', function (context) {
|
||||
if (!context) {
|
||||
return;
|
||||
}
|
||||
|
||||
return context.charAt(0).toUpperCase() + context.slice(1);
|
||||
});
|
||||
});
|
||||
@@ -1,7 +1,11 @@
|
||||
import { Blaze } from 'meteor/blaze';
|
||||
import { moment } from 'meteor/momentjs:moment';
|
||||
|
||||
/**
|
||||
* A global Blaze UI helper function to format DICOM Dates using the Moment library
|
||||
*/
|
||||
UI.registerHelper('formatDA', function (context, format, options) {
|
||||
|
||||
const formatDA = (context, format, options) => {
|
||||
if (!context) {
|
||||
return undefined;
|
||||
}
|
||||
@@ -11,4 +15,8 @@ UI.registerHelper('formatDA', function (context, format, options) {
|
||||
strFormat = format;
|
||||
}
|
||||
return dateAsMoment.format(strFormat);
|
||||
});
|
||||
};
|
||||
|
||||
Blaze.registerHelper('formatDA', formatDA);
|
||||
|
||||
export { formatDA };
|
||||
@@ -1,7 +1,10 @@
|
||||
import { Blaze } from 'meteor/blaze';
|
||||
import { moment } from 'meteor/momentjs:moment';
|
||||
|
||||
/**
|
||||
* A global Blaze UI helper function to format JavaScript Dates using the Moment library
|
||||
*/
|
||||
UI.registerHelper('formatJSDate', function(context, format, options) {
|
||||
Blaze.registerHelper('formatJSDate', function(context, format, options) {
|
||||
if (!context) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
import { Blaze } from 'meteor/blaze';
|
||||
|
||||
/**
|
||||
* A global Blaze UI helper to format a float value to a specified precision
|
||||
*/
|
||||
UI.registerHelper('formatNumberPrecision', function(context, precision) {
|
||||
Blaze.registerHelper('formatNumberPrecision', function(context, precision) {
|
||||
if (context != null) {
|
||||
return parseFloat(context).toFixed(precision);
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -1,7 +1,8 @@
|
||||
import { Blaze } from 'meteor/blaze';
|
||||
/**
|
||||
* Formats a patient name for display purposes
|
||||
*/
|
||||
formatPN = function(context) {
|
||||
const formatPN = context => {
|
||||
if (!context) {
|
||||
return;
|
||||
}
|
||||
@@ -11,4 +12,6 @@ formatPN = function(context) {
|
||||
/**
|
||||
* A global Blaze UI helper to format a patient name for display purposes
|
||||
*/
|
||||
UI.registerHelper('formatPN', formatPN);
|
||||
Blaze.registerHelper('formatPN', formatPN);
|
||||
|
||||
export { formatPN };
|
||||
@@ -1,7 +1,11 @@
|
||||
import { Blaze } from 'meteor/blaze';
|
||||
import { moment } from 'meteor/momentjs:moment';
|
||||
|
||||
/**
|
||||
* A global Blaze UI helper to format a DICOM Time for display using the Moment library
|
||||
*/
|
||||
UI.registerHelper('formatTM', function(context, options) {
|
||||
|
||||
const formatTM = (context, options) => {
|
||||
if (!context) {
|
||||
return;
|
||||
}
|
||||
@@ -21,4 +25,8 @@ UI.registerHelper('formatTM', function(context, options) {
|
||||
}
|
||||
|
||||
return dateTime.format(format);
|
||||
});
|
||||
};
|
||||
|
||||
Blaze.registerHelper('formatTM', formatTM);
|
||||
|
||||
export { formatTM };
|
||||
@@ -1,7 +1,10 @@
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
import { Blaze } from 'meteor/blaze';
|
||||
|
||||
/**
|
||||
* Helper for retrieving username given userId
|
||||
*/
|
||||
UI.registerHelper('getUsername', function(userId) {
|
||||
Blaze.registerHelper('getUsername', function(userId) {
|
||||
var user = Meteor.users.findOne({
|
||||
userId: userId
|
||||
});
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
import { Blaze } from 'meteor/blaze';
|
||||
|
||||
/**
|
||||
* Helper for checking datatype of a variable
|
||||
*/
|
||||
UI.registerHelper('ifTypeIs', function(value, match, attributeName) {
|
||||
Blaze.registerHelper('ifTypeIs', function(value, match, attributeName) {
|
||||
if (typeof(value) === match) {
|
||||
return attributeName;
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
UI.registerHelper('inc', function(value) {
|
||||
import { Blaze } from 'meteor/blaze';
|
||||
|
||||
Blaze.registerHelper('inc', function(value) {
|
||||
return parseInt(value) + 1;
|
||||
});
|
||||
@@ -1,3 +1,11 @@
|
||||
import { Template } from 'meteor/templating';
|
||||
import { Session } from 'meteor/session';
|
||||
import { $ } from 'meteor/jquery';
|
||||
import { viewportUtils } from '../viewportUtils';
|
||||
|
||||
import { OHIF } from 'meteor/ohif:core';
|
||||
import 'meteor/ohif:viewerbase';
|
||||
|
||||
/**
|
||||
* Boolean helper to identify if a series instance is active in some viewport
|
||||
*/
|
||||
@@ -6,7 +14,7 @@ Template.registerHelper('isDisplaySetActive', (displaySetInstanceUid, viewportIn
|
||||
Session.get('LayoutManagerUpdated');
|
||||
|
||||
// Stop here if layoutManager is not defined yet
|
||||
if (!window.layoutManager) {
|
||||
if (!OHIF.viewerbase.layoutManager) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -22,22 +30,28 @@ Template.registerHelper('isDisplaySetActive', (displaySetInstanceUid, viewportIn
|
||||
if (_.isUndefined(viewportIndex)) {
|
||||
// Get the number of viewports that are currently displayed
|
||||
// (Note, viewportData may have more entries!)
|
||||
const currentNumberOfViewports = layoutManager.getNumberOfViewports();
|
||||
const currentNumberOfViewports = OHIF.viewerbase.layoutManager.getNumberOfViewports();
|
||||
|
||||
// Get active viewport element
|
||||
const activeViewport = viewportUtils.getActiveViewportElement();
|
||||
|
||||
// Get viewports elements
|
||||
const viewportsElement = $('.imageViewerViewport');
|
||||
|
||||
// Loop through the viewport data up until the currently displayed
|
||||
// number of viewports
|
||||
let viewportData = window.layoutManager.viewportData;
|
||||
const viewportData = OHIF.viewerbase.layoutManager.viewportData;
|
||||
for (let i = 0; i < currentNumberOfViewports; i++) {
|
||||
const data = viewportData[i];
|
||||
|
||||
// If the display set is displayed in this viewport, stop here
|
||||
if (data && data.displaySetInstanceUid === displaySetInstanceUid) {
|
||||
// If the display set is displayed in this viewport and is active, stop here
|
||||
if (data && data.displaySetInstanceUid === displaySetInstanceUid && viewportsElement.get(data.viewportIndex) === activeViewport) {
|
||||
result = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
const data = window.layoutManager.viewportData[viewportIndex];
|
||||
const data = OHIF.viewerbase.layoutManager.viewportData[viewportIndex];
|
||||
|
||||
// If the display set is displayed in this viewport, stop here
|
||||
if (data && data.displaySetInstanceUid === displaySetInstanceUid) {
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import { Blaze } from 'meteor/blaze';
|
||||
|
||||
/**
|
||||
* Helper function to determine if the current client devices
|
||||
* is touch-capable. This can be used to modify certain aspects of the UI.
|
||||
@@ -6,7 +8,7 @@
|
||||
*
|
||||
* @returns {boolean} true if the client device is touch-capable, false otherwise
|
||||
*/
|
||||
isTouchDevice = function() {
|
||||
const isTouchDevice = () => {
|
||||
return (('ontouchstart' in window) ||
|
||||
(navigator.MaxTouchPoints > 0) ||
|
||||
(navigator.msMaxTouchPoints > 0));
|
||||
@@ -17,4 +19,6 @@ isTouchDevice = function() {
|
||||
*
|
||||
* @returns {boolean} true if the client device is touch-capable, false otherwise
|
||||
*/
|
||||
UI.registerHelper('isTouchDevice', isTouchDevice);
|
||||
Blaze.registerHelper('isTouchDevice', isTouchDevice);
|
||||
|
||||
export { isTouchDevice };
|
||||
@@ -1,7 +1,11 @@
|
||||
import { Blaze } from 'meteor/blaze';
|
||||
import { Session } from 'meteor/session';
|
||||
import { moment } from 'meteor/momentjs:moment';
|
||||
|
||||
/**
|
||||
* A global Blaze UI helper function to format JavaScript Dates using the Moment library
|
||||
*/
|
||||
UI.registerHelper('jsDateFromNow', function(context, format, options) {
|
||||
Blaze.registerHelper('jsDateFromNow', function(context, format, options) {
|
||||
if (!context) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
UI.registerHelper('objectEach', function(object) {
|
||||
import { Blaze } from 'meteor/blaze';
|
||||
import { _ } from 'meteor/underscore';
|
||||
|
||||
Blaze.registerHelper('objectEach', function(object) {
|
||||
// http://stackoverflow.com/questions/30234732/how-to-print-key-and-values-in-meteor-template
|
||||
return _.map(object, function(value, key) {
|
||||
return _.extend({key: key}, value);
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
UI.registerHelper('objectToPairs', function(object) {
|
||||
import { Blaze } from 'meteor/blaze';
|
||||
import { _ } from 'meteor/underscore';
|
||||
|
||||
Blaze.registerHelper('objectToPairs', function(object) {
|
||||
// http://stackoverflow.com/questions/30234732/how-to-print-key-and-values-in-meteor-template
|
||||
return _.map(object, function(value, key) {
|
||||
return {
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import { Blaze } from 'meteor/blaze';
|
||||
|
||||
/**
|
||||
* A global Blaze UI helper to Stringify a JavaScript object
|
||||
*
|
||||
@@ -5,7 +7,7 @@
|
||||
*
|
||||
* http://stackoverflow.com/questions/1026069/capitalize-the-first-letter-of-string-in-javascript
|
||||
*/
|
||||
UI.registerHelper('prettyPrintStringify', function(context) {
|
||||
Blaze.registerHelper('prettyPrintStringify', function(context) {
|
||||
if (!context) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { _ } from 'meteor/underscore';
|
||||
import { Template } from 'meteor/templating';
|
||||
import { _ } from 'meteor/underscore';
|
||||
|
||||
/**
|
||||
* Global Blaze UI helper to sort array elements
|
||||
@@ -54,4 +54,4 @@ function getKeyValue(object, keyPath) {
|
||||
}
|
||||
}
|
||||
return object;
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,6 @@
|
||||
import { Template } from 'meteor/templating';
|
||||
import { _ } from 'meteor/underscore';
|
||||
|
||||
/**
|
||||
* A global Blaze UI helper to get the thumbnails for the given study
|
||||
*/
|
||||
|
||||
Reference in new issue
Block a user