Skip to content
This repository has been archived by the owner on Jul 9, 2024. It is now read-only.

Commit

Permalink
fix(ie): Remove usage of const.
Browse files Browse the repository at this point in the history
- const is not supported in IE until version 11.
  This was causing the app to crash.

Closes #838, #805
  • Loading branch information
mjschranz committed Jun 2, 2015
1 parent aab4f42 commit a1d6efd
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 48 deletions.
16 changes: 8 additions & 8 deletions app/scripts/cart/cart.table.model.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
module ngApp.cart.models {
function withAnnotationFilter(value: number, filters: Object[], $filter: ng.IFilterService): string {
const filterString = $filter("makeFilter")(filters, true);
const href = 'annotations?filters=' + filterString;
const val = '{{' + value + '|number:0}}';
var filterString = $filter("makeFilter")(filters, true);
var href = 'annotations?filters=' + filterString;
var val = '{{' + value + '|number:0}}';
return "<a href='" + href + "'>" + val + '</a>';
}

function withFilter(value: number, filters: Object[], $filter: ng.IFilterService): string {
const filterString = $filter("makeFilter")(filters, true);
const href = 'search/p?filters=' + filterString;
const val = '{{' + value + '|number:0}}';
var filterString = $filter("makeFilter")(filters, true);
var href = 'search/p?filters=' + filterString;
var val = '{{' + value + '|number:0}}';
return "<a href='" + href + "'>" + val + '</a>';
}

Expand All @@ -30,8 +30,8 @@ module ngApp.cart.models {
name: "My Projects",
id: "my_projects",
td: (row, $scope) => {
const isUserProject = $scope.UserService.isUserProject(row);
const icon = isUserProject ? 'check-square-o' : 'square-o';
var isUserProject = $scope.UserService.isUserProject(row);
var icon = isUserProject ? 'check-square-o' : 'square-o';
return '<i class="fa fa-' + icon + '"></i>';
},
inactive: $scope => !$scope.UserService.currentUser,
Expand Down
18 changes: 9 additions & 9 deletions app/scripts/components/gql/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,16 @@ module ngApp.components.gql {
return element.selectionStart;
} else if (this.$document['selection']) {
element.focus();
const sel: any = this.$document['selection'].createRange();
const selLen: number = this.$document['selection'].createRange().text.length;
var sel: any = this.$document['selection'].createRange();
var selLen: number = this.$document['selection'].createRange().text.length;
sel.moveStart('character', -element.value.length);
return sel.text.length - selLen;
}
}

setPos(element: any, caretPos: number): void {
if (element.createTextRange) {
const range = element.createTextRange();
var range = element.createTextRange();
range.move('character', caretPos);
range.select();
} else {
Expand All @@ -56,14 +56,14 @@ module ngApp.components.gql {
}

isUnbalanced(stack: string, start: string, end: string): boolean {
const numStart = this.countNeedle(stack, start);
const numEnd = this.countNeedle(stack, end);
var numStart = this.countNeedle(stack, start);
var numEnd = this.countNeedle(stack, end);
return numStart > numEnd;
}

contains(phrase: string, sub: string): boolean {
if (sub.length === 0) return true;
const phraseStr = (phrase + this.GqlTokens.NOTHING).toLowerCase();
var phraseStr = (phrase + this.GqlTokens.NOTHING).toLowerCase();
return phraseStr.indexOf((sub + this.GqlTokens.NOTHING).toLowerCase()) > -1;
}

Expand Down Expand Up @@ -114,7 +114,7 @@ module ngApp.components.gql {
}

splitField(s: string): IFieldParts {
const xs = s.split(this.GqlTokens.PERIOD);
var xs = s.split(this.GqlTokens.PERIOD);

return {
docType: xs.shift(),
Expand All @@ -123,9 +123,9 @@ module ngApp.components.gql {
}

ajaxRequest(field: string): ng.IPromise<IDdItem[]> {
const parts = this.splitField(field);
var parts = this.splitField(field);

const params = {
var params = {
facets: [parts.facet],
size: 0,
filters: {}
Expand Down
6 changes: 3 additions & 3 deletions app/scripts/components/location/location.services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@ module ngApp.components.location.services {

filter2query(f: IFilters): string {
var q: string[] = _.map(f.content, (ftr: IFilter) => {
const c: IFilterValue = ftr.content;
const o = ftr.op;
const v = ftr.op === "in" ? angular.toJson(c.value) : c.value
var c: IFilterValue = ftr.content;
var o = ftr.op;
var v = ftr.op === "in" ? angular.toJson(c.value) : c.value
return [c.field, o, v].join(" ");
});

Expand Down
14 changes: 7 additions & 7 deletions app/scripts/projects/projects.table.model.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
module ngApp.projects.models {
function withFilter(value: number, filters: Object[], $filter: ng.IFilterService): string {
const filterString = $filter("makeFilter")(filters, true);
const href = 'search/p?filters=' + filterString;
const val = '{{' + value + '|number:0}}';
var filterString = $filter("makeFilter")(filters, true);
var href = 'search/p?filters=' + filterString;
var val = '{{' + value + '|number:0}}';
return value ? "<a href='" + href + "'>" + val + '</a>' : '0';
}
function getDataType(dataTypes: Object[], dataType:string): number {
const data = _.find(dataTypes, {data_type: dataType});
var data = _.find(dataTypes, {data_type: dataType});
return data ? data.participant_count : 0;
}
function dataTypeWithFilters(dataType: string, row: Object[], $filter: ng.IFilterService) {
const fs = [
var fs = [
{name: 'participants.project.project_id', value: row.project_id},
{name: 'files.data_type', value: dataType}
];
Expand Down Expand Up @@ -61,7 +61,7 @@ module ngApp.projects.models {
name: "Cases",
id: "summary.participant_count",
td: (row, $scope) => {
const fs = [{name: 'participants.project.project_id', value: row.project_id}]
var fs = [{name: 'participants.project.project_id', value: row.project_id}]
return withFilter(row.summary.participant_count, fs, $scope.$filter);
},
sortable: true,
Expand Down Expand Up @@ -137,7 +137,7 @@ module ngApp.projects.models {
name: "Files",
id: "summary.file_count",
td: (row, $scope) => {
const fs = [{name: 'participants.project.project_id', value: row.project_id}]
var fs = [{name: 'participants.project.project_id', value: row.project_id}]
return withFilter(row.summary.file_count, fs, $scope.$filter);
},
sortable: true,
Expand Down
16 changes: 8 additions & 8 deletions app/scripts/search/search.files.table.model.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
module ngApp.search.models {
function withAnnotationFilter(value: number, filters: Object[], $filter: ng.IFilterService): string {
const filterString = $filter("makeFilter")(filters, true);
const href = 'annotations?filters=' + filterString;
const val = '{{' + value + '|number:0}}';
var filterString = $filter("makeFilter")(filters, true);
var href = 'annotations?filters=' + filterString;
var val = '{{' + value + '|number:0}}';
return "<a href='" + href + "'>" + val + '</a>';
}

function withFilter(value: number, filters: Object[], $filter: ng.IFilterService): string {
const filterString = $filter("makeFilter")(filters, true);
const href = 'search/p?filters=' + filterString;
const val = '{{' + value + '|number:0}}';
var filterString = $filter("makeFilter")(filters, true);
var href = 'search/p?filters=' + filterString;
var val = '{{' + value + '|number:0}}';
return "<a href='" + href + "'>" + val + '</a>';
}

Expand All @@ -28,8 +28,8 @@ module ngApp.search.models {
name: "My Projects",
id: "my_projects",
td: (row, $scope) => {
const isUserProject = $scope.UserService.isUserProject(row);
const icon = isUserProject ? 'check-square-o' : 'square-o';
var isUserProject = $scope.UserService.isUserProject(row);
var icon = isUserProject ? 'check-square-o' : 'square-o';
return '<i class="fa fa-' + icon + '"></i>';
},
inactive: $scope => !$scope.UserService.currentUser,
Expand Down
26 changes: 13 additions & 13 deletions app/scripts/search/search.participants.table.model.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
module ngApp.search.models {
function withAnnotationFilter(value: number, filters: Object[], $filter: ng.IFilterService): string {
const filterString = $filter("makeFilter")(filters, true);
const href = 'annotations?filters=' + filterString;
const val = '{{' + value + '|number:0}}';
var filterString = $filter("makeFilter")(filters, true);
var href = 'annotations?filters=' + filterString;
var val = '{{' + value + '|number:0}}';
return "<a href='" + href + "'>" + val + '</a>';
}

function withFilter(value: number, filters: Object[], $filter: ng.IFilterService): string {
const filterString = $filter("makeFilter")(filters, true);
const href = 'search/f?filters=' + filterString;
const val = '{{' + value + '|number:0}}';
var filterString = $filter("makeFilter")(filters, true);
var href = 'search/f?filters=' + filterString;
var val = '{{' + value + '|number:0}}';
return value ? "<a href='" + href + "'>" + val + '</a>' : '0';
}
function getDataType(dataTypes: Object[], dataType:string): number {
const data = _.find(dataTypes, {data_type: dataType});
var data = _.find(dataTypes, {data_type: dataType});
return data ? data.file_count : 0;
}
function dataTypeWithFilters(dataType: string, row: Object[], $filter: ng.IFilterService) {
const fs = [
var fs = [
{name: 'participants.participant_id', value: row.participant_id},
{name: 'files.data_type', value: dataType}
];
Expand All @@ -37,9 +37,9 @@ module ngApp.search.models {
name: "My Projects",
id: "my_projects",
td: (row, $scope) => {
const fakeFile = {participants: [{project: row.project}]};
const isUserProject = $scope.UserService.isUserProject(fakeFile);
const icon = isUserProject ? 'check-square-o' : 'square-o';
var fakeFile = {participants: [{project: row.project}]};
var isUserProject = $scope.UserService.isUserProject(fakeFile);
var icon = isUserProject ? 'check-square-o' : 'square-o';
return '<i class="fa fa-' + icon + '"></i>';
},
inactive: $scope => !$scope.UserService.currentUser
Expand Down Expand Up @@ -75,8 +75,8 @@ module ngApp.search.models {
name: "Files",
id: "files",
td: (row, $scope) => {
const fs = [{name: 'participants.participant_id', value: row.participant_id}]
const sum = _.sum(_.pluck(row.summary.data_types, 'file_count'))
var fs = [{name: 'participants.participant_id', value: row.participant_id}]
var sum = _.sum(_.pluck(row.summary.data_types, 'file_count'))
return withFilter(sum, fs, $scope.$filter);
},
tdClassName: 'text-right'
Expand Down

0 comments on commit a1d6efd

Please sign in to comment.