mirror of
https://gitlab.com/bmcgonag/get_my.git
synced 2026-03-27 08:18:50 +00:00
Lots of changes and additions to the project. Still early, and not usable.
This commit is contained in:
parent
8636f8cf9b
commit
266dbd0856
41 changed files with 836 additions and 67 deletions
6
client/AdminMgmt/CategoryMgMt/catMgmt.html
Normal file
6
client/AdminMgmt/CategoryMgMt/catMgmt.html
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
<template name="catMgmt">
|
||||
<h4>Category Management</h4>
|
||||
{{> catMgmtForm}}
|
||||
<hr>
|
||||
{{> catMgmtTbl}}
|
||||
</template>
|
||||
17
client/AdminMgmt/CategoryMgMt/catMgmt.js
Normal file
17
client/AdminMgmt/CategoryMgMt/catMgmt.js
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
import { Categories } from '../../../imports/api/category.js';
|
||||
|
||||
Template.catMgmt.onCreated(function() {
|
||||
this.subscribe("myCategories");
|
||||
});
|
||||
|
||||
Template.catMgmt.onRendered(function() {
|
||||
|
||||
});
|
||||
|
||||
Template.catMgmt.helpers({
|
||||
|
||||
});
|
||||
|
||||
Template.catMgmt.events({
|
||||
|
||||
});
|
||||
16
client/AdminMgmt/CategoryMgMt/catMgmtForm.html
Normal file
16
client/AdminMgmt/CategoryMgMt/catMgmtForm.html
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
<template name="catMgmtForm">
|
||||
<div class="row">
|
||||
<div class="col s12 m6 l6 input-field">
|
||||
<input type="text" class="catNameInp" id="catNameInp" style="{{#if $eq catNameErr true}}border: 2px solid red;{{/if}}" />
|
||||
<label for="catNameInp">Name*</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col s6 m6 l6">
|
||||
<a class="waves-effect waves-light btn cancelCatMgmt orange">Cancel</a>
|
||||
</div>
|
||||
<div class="col s6 m6 l6">
|
||||
<a class="waves-effect waves-light btn saveCatMgmt green right">Add</a>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
39
client/AdminMgmt/CategoryMgMt/catMgmtForm.js
Normal file
39
client/AdminMgmt/CategoryMgMt/catMgmtForm.js
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
import { Categories } from '../../../imports/api/category.js';
|
||||
|
||||
Template.catMgmtForm.onCreated(function() {
|
||||
this.subscribe("myCategories");
|
||||
});
|
||||
|
||||
Template.catMgmtForm.onRendered(function() {
|
||||
Session.set("catNameMiss", false);
|
||||
});
|
||||
|
||||
Template.catMgmtForm.helpers({
|
||||
catNameErr: function() {
|
||||
return Session.get("catNameMiss");
|
||||
},
|
||||
});
|
||||
|
||||
Template.catMgmtForm.events({
|
||||
'click .saveCatMgmt' (event) {
|
||||
event.preventDefault();
|
||||
let catName = $("#catNameInp").val();
|
||||
if (catName == null || catName == "") {
|
||||
Session.set("catNameMiss", true);
|
||||
return;
|
||||
} else {
|
||||
Meteor.call('add.category', catName, function(err, result) {
|
||||
if (err) {
|
||||
// console.log(" ERROR: Can't add category: " + err);
|
||||
} else {
|
||||
// console.log(" SUCCESS adding category.");
|
||||
$("#catNameInp").val("");
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
'click .cancelCatMgmt' (event) {
|
||||
event.preventDefault();
|
||||
$("#catNameInp").val("");
|
||||
}
|
||||
});
|
||||
21
client/AdminMgmt/CategoryMgMt/catMgmtTbl.html
Normal file
21
client/AdminMgmt/CategoryMgMt/catMgmtTbl.html
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
<template name="catMgmtTbl">
|
||||
<table class="highlight striped responsive-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{#each cats}}
|
||||
<tr>
|
||||
<td>{{categoryName}}</td>
|
||||
<td>
|
||||
<i class="material-icons clickable deleteCategory">delete</i>
|
||||
<i class="material-icons clickable editCategory">edit</i>
|
||||
</td>
|
||||
</tr>
|
||||
{{/each}}
|
||||
</tbody>
|
||||
</table>
|
||||
</template>
|
||||
19
client/AdminMgmt/CategoryMgMt/catMgmtTbl.js
Normal file
19
client/AdminMgmt/CategoryMgMt/catMgmtTbl.js
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
import { Categories } from '../../../imports/api/category.js';
|
||||
|
||||
Template.catMgmtTbl.onCreated(function() {
|
||||
this.subscribe("myCategories");
|
||||
});
|
||||
|
||||
Template.catMgmtTbl.onRendered(function() {
|
||||
|
||||
});
|
||||
|
||||
Template.catMgmtTbl.helpers({
|
||||
cats: function() {
|
||||
return Categories.find({});
|
||||
}
|
||||
});
|
||||
|
||||
Template.catMgmtTbl.events({
|
||||
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue