Initial commit
This commit is contained in:
parent
9ed5089508
commit
78e0e82449
16 changed files with 317 additions and 15 deletions
3
client/General/Home/Home.css
Normal file
3
client/General/Home/Home.css
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
.infoCard {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
|
@ -1,6 +1,22 @@
|
|||
<template name="home">
|
||||
{{#if currentUser}}
|
||||
<h1>This is Home.</h1>
|
||||
<div class="grid">
|
||||
<div>
|
||||
<article class="infoCard" id="workouts">
|
||||
<h3>Workouts</h3>
|
||||
</article>
|
||||
</div>
|
||||
<div>
|
||||
<article class="infoCard" id="meals">
|
||||
<h3>Meals</h3>
|
||||
</article>
|
||||
</div>
|
||||
<div>
|
||||
<article class="infoCard" id="measurements">
|
||||
<h3>Measurements</h3>
|
||||
</article>
|
||||
</div>
|
||||
</div>
|
||||
{{else}}
|
||||
{{#if $eq loginOrReg 'login'}}
|
||||
{{> login}}
|
||||
|
|
|
|||
|
|
@ -1,11 +1,14 @@
|
|||
import { FlowRouter } from 'meteor/ostrio:flow-router-extra';
|
||||
|
||||
Template.home.helpers({
|
||||
loginOrReg: function() {
|
||||
loginOrReg: function () {
|
||||
return Session.get("loginOrReg");
|
||||
},
|
||||
});
|
||||
|
||||
Template.home.events({
|
||||
|
||||
'click .infoCard'(e) {
|
||||
let route = e.currentTarget.id;
|
||||
FlowRouter.go('/' + route);
|
||||
},
|
||||
});
|
||||
5
client/General/Workouts/WorkoutLogs/workoutLog.html
Normal file
5
client/General/Workouts/WorkoutLogs/workoutLog.html
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
<template name="workoutLog">
|
||||
<h1>Workout Log</h1>
|
||||
<h2>{{routineName}}</h2>
|
||||
|
||||
</template>
|
||||
18
client/General/Workouts/WorkoutLogs/workoutLog.js
Normal file
18
client/General/Workouts/WorkoutLogs/workoutLog.js
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
import { FlowRouter } from 'meteor/ostrio:flow-router-extra';
|
||||
import { Workouts } from '../../../imports/api/workouts.js';
|
||||
|
||||
Template.workoutsLog.onCreated(function() {
|
||||
this.subscribe("myWorkoutRoutines");
|
||||
});
|
||||
|
||||
Template.workoutsLog.onRendered(function() {
|
||||
|
||||
});
|
||||
|
||||
Template.workoutsLog.helpers({
|
||||
|
||||
});
|
||||
|
||||
Template.workoutsLog.events({
|
||||
|
||||
});
|
||||
25
client/General/Workouts/workouts.html
Normal file
25
client/General/Workouts/workouts.html
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
<template name="workouts">
|
||||
<h1>Workouts</h1>
|
||||
{{#if $eq showAddRoutineForm true}}
|
||||
<div id="addRouTineForm">
|
||||
<div class="grid">
|
||||
<div>
|
||||
<label for="routineName">Workout Routine Name *</label>
|
||||
<input type="text" required class="routineName" id="routineName" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="grid">
|
||||
<div>
|
||||
<button class="primary right" id="addRoutineForm">Save</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{/if}}
|
||||
<ul class="collection">
|
||||
{{#each workoutRoutines}}
|
||||
<li class="collection-item clickable" id="{{_id}}">{{routineName}}</li>
|
||||
{{/each}}
|
||||
<li class="collection-footer clickable" id="addRoutine"> + Add a Workout Routine</li>
|
||||
</ul>
|
||||
{{> snackbar}}
|
||||
</template>
|
||||
49
client/General/Workouts/workouts.js
Normal file
49
client/General/Workouts/workouts.js
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
import { FlowRouter } from 'meteor/ostrio:flow-router-extra';
|
||||
import { Workouts } from '../../../imports/api/workouts.js';
|
||||
import { WorkoutLog } from '../../../imports/api/workoutLog.js';
|
||||
|
||||
Template.workouts.onCreated(function() {
|
||||
this.subscribe("myWorkoutRoutines");
|
||||
});
|
||||
|
||||
Template.workouts.onRendered(function() {
|
||||
Session.set("showAddRoutineForm", false);
|
||||
});
|
||||
|
||||
Template.workouts.helpers({
|
||||
showAddRoutineForm: function() {
|
||||
return Session.get("showAddRoutineForm");
|
||||
},
|
||||
workoutRoutines: function() {
|
||||
return Workouts.find({});
|
||||
},
|
||||
});
|
||||
|
||||
Template.workouts.events({
|
||||
'click #addRoutine' (e) {
|
||||
Session.set("showAddRoutineForm", true);
|
||||
},
|
||||
'click #addRoutineForm' (e) {
|
||||
let routineName = $("#routineName").val();
|
||||
|
||||
if (routineName == "" || routineName == null) {
|
||||
showSnackbar("Routine Name is Required!", "red");
|
||||
return;
|
||||
} else {
|
||||
console.log("Routine Name: " + routineName);
|
||||
const addWorkout = async() => {
|
||||
try {
|
||||
const result = await Meteor.callAsync('add.workoutRoutine', routineName);
|
||||
if (!result) {
|
||||
console.log("An issue occurred adding the routing name.");
|
||||
} else {
|
||||
console.log("Routine added : " + result);
|
||||
}
|
||||
} catch(error) {
|
||||
console.log(" ERROR adding routine nemae: " + error);
|
||||
}
|
||||
}
|
||||
addWorkout();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
<template name="headerBar">
|
||||
<nav>
|
||||
<ul>
|
||||
<li><h2>[Project Name]</h2></li>
|
||||
<li><h2>Get Healthy</h2></li>
|
||||
</ul>
|
||||
<ul>
|
||||
{{#if currentUser}}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,59 @@
|
|||
.right {
|
||||
float: right;
|
||||
}
|
||||
}
|
||||
|
||||
.clickable {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
/* Collection container */
|
||||
.collection {
|
||||
width: 100%;
|
||||
margin: 1rem 0;
|
||||
padding: 0;
|
||||
border-radius: 4px;
|
||||
box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
|
||||
list-style: none;
|
||||
background-color: #100f0f;
|
||||
border: 1px solid #454444;
|
||||
color: #dfdfdf;
|
||||
}
|
||||
|
||||
/* Collection item */
|
||||
.collection-item {
|
||||
position: relative;
|
||||
display: block;
|
||||
padding: 16px 16px;
|
||||
border-bottom: 1px solid #454444;
|
||||
color: #dfdfdf;
|
||||
transition: background-color 0.2s ease;
|
||||
}
|
||||
|
||||
.collection-item:hover {
|
||||
background-color: #282828
|
||||
}
|
||||
|
||||
/* Remove bottom border from last item */
|
||||
.collection-item:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
/* Collection header */
|
||||
.collection-header {
|
||||
padding: 16px 16px;
|
||||
display: block;
|
||||
background-color: #1b1b1b;
|
||||
border-bottom: 1px solid #454444;
|
||||
font-weight: 500;
|
||||
color: #dfdfdf;
|
||||
}
|
||||
|
||||
/* Collection footer */
|
||||
.collection-footer {
|
||||
padding: 16px 16px;
|
||||
display: block;
|
||||
background-color: #1b1b1b;
|
||||
border-top: 1px solid #454444;
|
||||
font-weight: 500;
|
||||
color: #dfdfdf;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue