Skip to content
This repository has been archived by the owner on Dec 4, 2023. It is now read-only.

Updates the About Page #101

Merged
merged 1 commit into from
Apr 19, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"extends": "@meteorjs/eslint-config-meteor",
"rules": {
"id-length": ["error", {"min": 3, "exceptions": ["i", "j", "k", "id"]}],
"max-len": ["error", 120],
"require-jsdoc": ["error", {
"require": {
"FunctionDeclaration": true,
"MethodDefinition": false,
"ClassDeclaration": false,
"ArrowFunctionExpression": false
}
}],
"no-undef": ["error"],
"keyword-spacing": ["error"],
"object-curly-spacing": "off"
},
"globals": {
"Meteor": true
}
}
7 changes: 7 additions & 0 deletions app/imports/ui/pages/about/about.jade
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ template(name='about')
= recordCount
| Total Records

p.smaller
i ({{badRecordCount}}) Records with errors

+currentHarvestsTable data=harvests

template(name='currentHarvestsTable')
Expand All @@ -40,6 +43,8 @@ template(name='currentHarvestsTable')
th Organization
th URL
th Records
th Records with Errors
th Harvest Type
tbody
each data
tr
Expand All @@ -48,5 +53,7 @@ template(name='currentHarvestsTable')
a(href=url)
= url
td= last_record_count
td= last_bad_count
td {{parseHarvestType harvest_type}}


81 changes: 60 additions & 21 deletions app/imports/ui/pages/about/about.js
Original file line number Diff line number Diff line change
@@ -1,48 +1,87 @@
import './about.jade';
import './about.less';
import { Template } from 'meteor/templating';
import { Harvests } from '/imports/api/harvests/harvests.js';
import './about.jade';
import './about.less';

/*****************************************************************************/
/* about: Event Handlers */
/*****************************************************************************/
/*
* about: Event Handlers
*/
Template.about.events({
});

/*****************************************************************************/
/* about: Helpers */
/*****************************************************************************/
/*
* about: Helpers
*/
Template.about.helpers({
/**
* Returns the Harvests sorted by organization
*
* @return {Array<Harvest>}
*/
harvests() {
console.log(Harvests.find({}).count());
return Harvests.find({}, {sort: {organization:1}});
return Harvests.find({}, {sort: {organization: 1} });
},
/**
* Returns the aboslute path for the URL.
*
* @param {string} path - Relative Path
* @return {string}
*/
absoluteUrl(path) {
return Meteor.absoluteUrl(path);
},
/**
* Returns the total number of records by summing last_record_count of each
* Harvest
*
* @return {number}
*/
recordCount() {
let count = 0;
Harvests.find({last_record_count: {$gt: 0}}).forEach(function(harvest) {
Harvests.find({last_record_count: {$gt: 0} }).forEach((harvest) => {
count += harvest.last_record_count;
});
return count;
}
},
/**
* Returns the total number of bad records by summing all last_bad_count in
* each Harvest
*
* @return {number}
*/
badRecordCount() {
let count = 0;
Harvests.find({last_bad_count: {$gt: 0} }).forEach((harvest) => {
count += harvest.last_bad_count;
});
return count;
},
});

/*****************************************************************************/
/* about: Lifecycle Hooks */
/*****************************************************************************/
/**
* Subscribes to harvests.public
*/
Template.about.onCreated(function() {
this.autorun(() => {
this.subscribe('harvests.public');
});
});

Template.about.onRendered(function() {
});

Template.about.onDestroyed(function() {
});

/*
* currentHarvestsTable: helpers
*/
Template.currentHarvestsTable.helpers({
/**
* Returns a well formatted harvest type that is readable.
*
* @param {string} harvestType - The harvest_type attribute from the Harvests
* collection.
* @return {string}
*/
parseHarvestType(harvestType) {
if (harvestType === 'CSW') {
return 'CS-W';
}
return harvestType;
},
});
6 changes: 6 additions & 0 deletions app/imports/ui/pages/about/about.less
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@
font-weight: 300;
line-height: 28px;
}

p.smaller {
font-size: 14px;
color: #999;
}
}

@media (min-width: 1400px) {
Expand All @@ -43,3 +48,4 @@

}


11 changes: 11 additions & 0 deletions app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,16 @@
"bcrypt": "^0.8.7",
"jquery": "^2.2.4",
"url-join": "^1.1.0"
},
"devDependencies": {
"@meteorjs/eslint-config-meteor": "^1.0.5",
"babel-eslint": "^7.2.2",
"eslint": "^3.19.0",
"eslint-config-airbnb": "^14.1.0",
"eslint-import-resolver-meteor": "^0.4.0",
"eslint-plugin-import": "^2.2.0",
"eslint-plugin-jsx-a11y": "^4.0.0",
"eslint-plugin-meteor": "^4.0.1",
"eslint-plugin-react": "^6.10.3"
}
}