Initial commit
This commit is contained in:
parent
9ed5089508
commit
78e0e82449
16 changed files with 317 additions and 15 deletions
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();
|
||||
}
|
||||
}
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue