Updated to the latest iteration of the sales tracking app; Added some temporary photos for UBS.
This commit is contained in:
27
brainstorm.js
Normal file
27
brainstorm.js
Normal file
@@ -0,0 +1,27 @@
|
||||
//Server side brainstorm.
|
||||
|
||||
module.exports = function(app, sequelize) {
|
||||
var io = require('socket.io')(app);
|
||||
|
||||
io.on('connection', function(socket) {
|
||||
//TODO: Handle new connections.
|
||||
|
||||
//socket.emit("name", {param: 'value'});
|
||||
|
||||
//socket.on("name", function(data) {});
|
||||
socket.on("query", function(params) {
|
||||
var model = sequelize.models[params.class];
|
||||
|
||||
if(model) {
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
socket.on('disconnect', function() {
|
||||
//TODO: ?
|
||||
});
|
||||
});
|
||||
};
|
||||
BIN
downloaded tools/bootstrap-switch-master.zip
Normal file
BIN
downloaded tools/bootstrap-switch-master.zip
Normal file
Binary file not shown.
BIN
downloaded tools/bootstrap-toggle-master.zip
Normal file
BIN
downloaded tools/bootstrap-toggle-master.zip
Normal file
Binary file not shown.
73
package.json
73
package.json
@@ -1,38 +1,39 @@
|
||||
{
|
||||
"name": "PetitTeton",
|
||||
"version": "1.0.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"1. start": "node server.js",
|
||||
"3. update-db": "sequelize db:migrate",
|
||||
"4. create-db-migration": "sequelize migration:create",
|
||||
"2. install": "npm install"
|
||||
},
|
||||
"dependencies": {
|
||||
"bcrypt-nodejs": "^0.0.3",
|
||||
"bluebird": "^3.4.0",
|
||||
"body-parser": "^1.15.1",
|
||||
"connect-flash": "^0.1.1",
|
||||
"cookie-parser": "~1.3.3",
|
||||
"debug": "~2.1.1",
|
||||
"ejs": "~2.4.1",
|
||||
"express": "~4.11.1",
|
||||
"express-session": "~1.0.4",
|
||||
"html": "latest",
|
||||
"method-override": "~1.0.2",
|
||||
"moment": "latest",
|
||||
"morgan": "~1.5.1",
|
||||
"node-phantom": "latest",
|
||||
"nodemailer": "~1.0",
|
||||
"passport": "^0.3.2",
|
||||
"passport-local": "^1.0.0",
|
||||
"pg": "^4.4.3",
|
||||
"pg-hstore": "^2.3.2",
|
||||
"sequelize": "^3.0",
|
||||
"sequelize-cli": "^2.4.0",
|
||||
"serve-favicon": "~2.2.0",
|
||||
"session-file-store": "~0.0.24",
|
||||
"stylus": "~0.42.3",
|
||||
"swig": "~1.4.2"
|
||||
}
|
||||
"name": "PetitTeton",
|
||||
"version": "1.0.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"1. start": "node server.js",
|
||||
"3. update-db": "sequelize db:migrate",
|
||||
"4. create-db-migration": "sequelize migration:create",
|
||||
"2. install": "npm install"
|
||||
},
|
||||
"dependencies": {
|
||||
"bcrypt-nodejs": "^0.0.3",
|
||||
"bluebird": "^3.4.0",
|
||||
"body-parser": "^1.15.1",
|
||||
"connect-flash": "^0.1.1",
|
||||
"cookie-parser": "~1.3.3",
|
||||
"debug": "~2.1.1",
|
||||
"ejs": "~2.4.1",
|
||||
"express": "~4.11.1",
|
||||
"express-session": "~1.0.4",
|
||||
"html": "latest",
|
||||
"method-override": "~1.0.2",
|
||||
"moment": "latest",
|
||||
"morgan": "~1.5.1",
|
||||
"node-phantom": "latest",
|
||||
"nodemailer": "~1.0",
|
||||
"passport": "^0.3.2",
|
||||
"passport-local": "^1.0.0",
|
||||
"pg": "^4.4.3",
|
||||
"pg-hstore": "^2.3.2",
|
||||
"sequelize": "^3.0",
|
||||
"sequelize-cli": "^2.4.0",
|
||||
"serve-favicon": "~2.2.0",
|
||||
"session-file-store": "~0.0.24",
|
||||
"stylus": "~0.42.3",
|
||||
"swig": "~1.4.2",
|
||||
"socket.io": "^1.4.8"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,16 +98,16 @@
|
||||
dataTable.refresh();
|
||||
|
||||
//---- Create Dialog ----
|
||||
$("#createButton").on("click", function(event) {
|
||||
$("#createDialog").modal();
|
||||
$("#venues #createButton").on("click", function(event) {
|
||||
$("#venues #createDialog").modal();
|
||||
});
|
||||
$("#createDialog_CreateButton").on("click", function(event) {
|
||||
$("#venues #createDialog_CreateButton").on("click", function(event) {
|
||||
try {
|
||||
$.post("/admin/venues/create", {
|
||||
name: $("#createDialog_NameField").val()
|
||||
name: $("#venues #createDialog_NameField").val()
|
||||
}, function(data) {
|
||||
if(data.result == "success") {
|
||||
$("#createDialog").modal("hide");
|
||||
$("#venues #createDialog").modal("hide");
|
||||
dataTable.refresh();
|
||||
}
|
||||
else {
|
||||
@@ -118,24 +118,24 @@
|
||||
alert(e);
|
||||
}
|
||||
});
|
||||
$("#createDialog").on('shown.bs.modal', function() {
|
||||
$("#venues #createDialog").on('shown.bs.modal', function() {
|
||||
$('#createDialog_NameField').focus();
|
||||
});
|
||||
//----------------------------
|
||||
|
||||
//---- Delete Dialog ----
|
||||
$("#deleteButton").on("click", function(event) {
|
||||
$("#venues #deleteButton").on("click", function(event) {
|
||||
//debugger;
|
||||
if(dataTable.getSelectedRow() != null) {
|
||||
$("#deleteDialog_NameField").html(dataTable.getSelectedRow().data("model").name);
|
||||
$("#deleteDialog").modal();
|
||||
$("#venues #deleteDialog_NameField").html(dataTable.getSelectedRow().data("model").name);
|
||||
$("#venues #deleteDialog").modal();
|
||||
}
|
||||
});
|
||||
$("#deleteDialog_DeleteButton").on("click", function(event) {
|
||||
$("#venues #deleteDialog_DeleteButton").on("click", function(event) {
|
||||
if(dataTable.getSelectedRow() != null) {
|
||||
$.post("/admin/venues/delete", {id: dataTable.getSelectedRow().data("model").id}, function(data) {
|
||||
if(data.result == "success") {
|
||||
$("#deleteDialog").modal("hide");
|
||||
$("#venues #deleteDialog").modal("hide");
|
||||
dataTable.refresh();
|
||||
}
|
||||
else {
|
||||
@@ -147,21 +147,21 @@
|
||||
//-----------------------------
|
||||
|
||||
//----- Edit Dialog ----
|
||||
$("#editButton").on("click", function(event) {
|
||||
$("#venues #editButton").on("click", function(event) {
|
||||
//debugger;
|
||||
if(dataTable.getSelectedRow() != null) {
|
||||
$('#editDialog_NameField').val(dataTable.getSelectedRow().data("model").name);
|
||||
$("#editDialog").modal();
|
||||
$("#venues #editDialog").modal();
|
||||
}
|
||||
});
|
||||
$("#editDialog_SaveButton").on("click", function(event) {
|
||||
$("#venues #editDialog_SaveButton").on("click", function(event) {
|
||||
if(dataTable.getSelectedRow() != null) {
|
||||
$.post("/admin/venues/edit", {
|
||||
id: dataTable.getSelectedRow().data("model").id,
|
||||
name: $("#editDialog_NameField").val()
|
||||
name: $("#venues #editDialog_NameField").val()
|
||||
}, function(data) {
|
||||
if(data.result == "success") {
|
||||
$("#editDialog").modal("hide");
|
||||
$("#venues #editDialog").modal("hide");
|
||||
dataTable.refresh();
|
||||
}
|
||||
else {
|
||||
@@ -170,7 +170,7 @@
|
||||
}, "json");
|
||||
}
|
||||
});
|
||||
$("#editDialog").on('shown.bs.modal', function() {
|
||||
$("#venues #editDialog").on('shown.bs.modal', function() {
|
||||
$('#editDialog_NameField').focus().select();
|
||||
});
|
||||
//---------------------
|
||||
|
||||
@@ -97,16 +97,16 @@
|
||||
dataTable.refresh();
|
||||
|
||||
//---- Create Dialog ----
|
||||
$("#createButton").on("click", function(event) {
|
||||
$("#createDialog").modal();
|
||||
$("#categories #createButton").on("click", function(event) {
|
||||
$("#categories #createDialog").modal();
|
||||
});
|
||||
$("#createDialog_CreateButton").on("click", function(event) {
|
||||
$("#categories #createDialog_CreateButton").on("click", function(event) {
|
||||
try {
|
||||
$.post("/admin/categories/create", {
|
||||
name: $("#createDialog_NameField").val()
|
||||
name: $("#categories #createDialog_NameField").val()
|
||||
}, function(data) {
|
||||
if(data.result == "success") {
|
||||
$("#createDialog").modal("hide");
|
||||
$("#categories #createDialog").modal("hide");
|
||||
dataTable.refresh();
|
||||
}
|
||||
else {
|
||||
@@ -117,24 +117,24 @@
|
||||
alert(e);
|
||||
}
|
||||
});
|
||||
$("#createDialog").on('shown.bs.modal', function() {
|
||||
$("#categories #createDialog").on('shown.bs.modal', function() {
|
||||
$('#createDialog_NameField').focus();
|
||||
});
|
||||
//----------------------------
|
||||
|
||||
//---- Delete Dialog ----
|
||||
$("#deleteButton").on("click", function(event) {
|
||||
$("#categories #deleteButton").on("click", function(event) {
|
||||
//debugger;
|
||||
if(dataTable.getSelectedRow() != null) {
|
||||
$("#deleteDialog_NameField").html(dataTable.getSelectedRow().data("model").name);
|
||||
$("#deleteDialog").modal();
|
||||
$("#categories #deleteDialog_NameField").html(dataTable.getSelectedRow().data("model").name);
|
||||
$("#categories #deleteDialog").modal();
|
||||
}
|
||||
});
|
||||
$("#deleteDialog_DeleteButton").on("click", function(event) {
|
||||
$("#categories #deleteDialog_DeleteButton").on("click", function(event) {
|
||||
if(dataTable.getSelectedRow() != null) {
|
||||
$.post("/admin/categories/delete", {id: dataTable.getSelectedRow().data("model").id}, function(data) {
|
||||
if(data.result == "success") {
|
||||
$("#deleteDialog").modal("hide");
|
||||
$("#categories #deleteDialog").modal("hide");
|
||||
dataTable.refresh();
|
||||
}
|
||||
else {
|
||||
@@ -146,21 +146,21 @@
|
||||
//-----------------------------
|
||||
|
||||
//----- Edit Dialog ----
|
||||
$("#editButton").on("click", function(event) {
|
||||
$("#categories #editButton").on("click", function(event) {
|
||||
//debugger;
|
||||
if(dataTable.getSelectedRow() != null) {
|
||||
$('#editDialog_NameField').val(dataTable.getSelectedRow().data("model").name);
|
||||
$("#editDialog").modal();
|
||||
$("#categories #editDialog").modal();
|
||||
}
|
||||
});
|
||||
$("#editDialog_SaveButton").on("click", function(event) {
|
||||
$("#categories #editDialog_SaveButton").on("click", function(event) {
|
||||
if(dataTable.getSelectedRow() != null) {
|
||||
$.post("/admin/categories/edit", {
|
||||
id: dataTable.getSelectedRow().data("model").id,
|
||||
name: $("#editDialog_NameField").val()
|
||||
name: $("#categories #editDialog_NameField").val()
|
||||
}, function(data) {
|
||||
if(data.result == "success") {
|
||||
$("#editDialog").modal("hide");
|
||||
$("#categories #editDialog").modal("hide");
|
||||
dataTable.refresh();
|
||||
}
|
||||
else {
|
||||
@@ -169,7 +169,7 @@
|
||||
}, "json");
|
||||
}
|
||||
});
|
||||
$("#editDialog").on('shown.bs.modal', function() {
|
||||
$("#categories #editDialog").on('shown.bs.modal', function() {
|
||||
$('#editDialog_NameField').focus().select();
|
||||
});
|
||||
//---------------------
|
||||
|
||||
@@ -33,8 +33,12 @@
|
||||
<script type="text/javascript" language="JavaScript" src="js/jquery.shadow.js"></script>
|
||||
<script type="text/javascript" language="JavaScript" src="js/scroller.js"></script>
|
||||
<script type="text/javascript" language="JavaScript" src="js/framework_lite.js"></script>
|
||||
<script type="text/javascript" language="JavaScript" src="js/polyfills.js"></script>
|
||||
<script type="text/javascript" language="JavaScript" src="js/main.js"></script>
|
||||
<script type="text/javascript" language="JavaScript" src="js/socket.io.js"></script>
|
||||
<script type="text/javascript" language="JavaScript" src="js/brainstorm.js"></script>
|
||||
<script type="text/javascript" language="JavaScript" src="js/LinkedTable.js"></script>
|
||||
<script type="text/javascript" language="JavaScript" src="js/Dropdown.js"></script>
|
||||
<!--
|
||||
<script type="text/javascript" language="JavaScript">
|
||||
function check(x) {
|
||||
|
||||
@@ -115,18 +115,18 @@
|
||||
dataTable.refresh();
|
||||
|
||||
//---- Create Dialog ----
|
||||
$("#createButton").on("click", function(event) {
|
||||
$("#createDialog").modal();
|
||||
$("#items #createButton").on("click", function(event) {
|
||||
$("#items #createDialog").modal();
|
||||
});
|
||||
$("#createDialog_CreateButton").on("click", function(event) {
|
||||
$("#items #createDialog_CreateButton").on("click", function(event) {
|
||||
try {
|
||||
$.post("/admin/items/create", {
|
||||
name: $("#createDialog_NameField").val(),
|
||||
defaultPrice: $("#createDialog_DefaultPriceField").val(),
|
||||
measures: $("#createDialog_MeasuresField").val()
|
||||
name: $("#items #createDialog_NameField").val(),
|
||||
defaultPrice: $("#items #createDialog_DefaultPriceField").val(),
|
||||
measures: $("#items #createDialog_MeasuresField").val()
|
||||
}, function(data) {
|
||||
if(data.result == "success") {
|
||||
$("#createDialog").modal("hide");
|
||||
$("#items #createDialog").modal("hide");
|
||||
dataTable.refresh();
|
||||
}
|
||||
else {
|
||||
@@ -137,24 +137,24 @@
|
||||
alert(e);
|
||||
}
|
||||
});
|
||||
$("#createDialog").on('shown.bs.modal', function() {
|
||||
$("#items #createDialog").on('shown.bs.modal', function() {
|
||||
$('#createDialog_NameField').focus();
|
||||
});
|
||||
//----------------------------
|
||||
|
||||
//---- Delete Dialog ----
|
||||
$("#deleteButton").on("click", function(event) {
|
||||
$("#items #deleteButton").on("click", function(event) {
|
||||
//debugger;
|
||||
if(dataTable.getSelectedRow() != null) {
|
||||
$("#deleteDialog_NameField").html(dataTable.getSelectedRow().data("model").name);
|
||||
$("#deleteDialog").modal();
|
||||
$("#items #deleteDialog_NameField").html(dataTable.getSelectedRow().data("model").name);
|
||||
$("#items #deleteDialog").modal();
|
||||
}
|
||||
});
|
||||
$("#deleteDialog_DeleteButton").on("click", function(event) {
|
||||
$("#items #deleteDialog_DeleteButton").on("click", function(event) {
|
||||
if(dataTable.getSelectedRow() != null) {
|
||||
$.post("/admin/items/delete", {id: dataTable.getSelectedRow().data("model").id}, function(data) {
|
||||
if(data.result == "success") {
|
||||
$("#deleteDialog").modal("hide");
|
||||
$("#items #deleteDialog").modal("hide");
|
||||
dataTable.refresh();
|
||||
}
|
||||
else {
|
||||
@@ -166,25 +166,25 @@
|
||||
//-----------------------------
|
||||
|
||||
//----- Edit Dialog ----
|
||||
$("#editButton").on("click", function(event) {
|
||||
$("#items #editButton").on("click", function(event) {
|
||||
//debugger;
|
||||
if(dataTable.getSelectedRow() != null) {
|
||||
$('#editDialog_NameField').val(dataTable.getSelectedRow().data("model").name);
|
||||
$('#editDialog_DefaultPriceField').val(dataTable.getSelectedRow().data("model").defaultPrice);
|
||||
$('#editDialog_MeasuresField').val(dataTable.getSelectedRow().data("model").measures);
|
||||
$("#editDialog").modal();
|
||||
$("#items #editDialog").modal();
|
||||
}
|
||||
});
|
||||
$("#editDialog_SaveButton").on("click", function(event) {
|
||||
$("#items #editDialog_SaveButton").on("click", function(event) {
|
||||
if(dataTable.getSelectedRow() != null) {
|
||||
$.post("/admin/items/edit", {
|
||||
id: dataTable.getSelectedRow().data("model").id,
|
||||
name: $("#editDialog_NameField").val(),
|
||||
defaultPrice: $("#editDialog_DefaultPriceField").val(),
|
||||
measures: $("#editDialog_MeasuresField").val()
|
||||
name: $("#items #editDialog_NameField").val(),
|
||||
defaultPrice: $("#items #editDialog_DefaultPriceField").val(),
|
||||
measures: $("#items #editDialog_MeasuresField").val()
|
||||
}, function(data) {
|
||||
if(data.result == "success") {
|
||||
$("#editDialog").modal("hide");
|
||||
$("#items #editDialog").modal("hide");
|
||||
dataTable.refresh();
|
||||
}
|
||||
else {
|
||||
@@ -193,7 +193,7 @@
|
||||
}, "json");
|
||||
}
|
||||
});
|
||||
$("#editDialog").on('shown.bs.modal', function() {
|
||||
$("#items #editDialog").on('shown.bs.modal', function() {
|
||||
$('#editDialog_NameField').focus().select();
|
||||
});
|
||||
//---------------------
|
||||
|
||||
BIN
public/admin/js/248913.pdf
Normal file
BIN
public/admin/js/248913.pdf
Normal file
Binary file not shown.
82
public/admin/js/Dropdown.js
Normal file
82
public/admin/js/Dropdown.js
Normal file
@@ -0,0 +1,82 @@
|
||||
"use strict";
|
||||
|
||||
(function($) {
|
||||
var Dropdown = function($element, data, options) {
|
||||
var _this = this
|
||||
var textSpan = $("<span>" + options.defaultText + "</span>");
|
||||
|
||||
this.$element = $element;
|
||||
this.options = $.extend({}, Dropdown.DEFAULTS, options);
|
||||
this.$selected = null;
|
||||
this.$textSpan = null;
|
||||
|
||||
this.selectionHandler = function(event) {
|
||||
_this.$selected = $(this);
|
||||
_this.$selected.addClass(_this.options.selectionClass).siblings().removeClass(_this.options.selectionClass);
|
||||
textSpan.text(_this.$selected.text());
|
||||
};
|
||||
|
||||
var button = $("<button class='" + this.options.buttonClasses + "' style='" + this.options.buttonStyling + "' type='button' data-toggle='dropdown'></button>");
|
||||
var caretSpan = $("<span class='" + this.options.caretClasses + "' style='margin-left: 8px;'></span>");
|
||||
|
||||
button.appendTo($element);
|
||||
textSpan.appendTo(button);
|
||||
caretSpan.appendTo(button);
|
||||
//Save this for later use when setting the selection manually.
|
||||
this.$textSpan = textSpan;
|
||||
|
||||
var ul = $("<ul class='dropdown-menu' role='menu'></ul>");
|
||||
ul.appendTo($element);
|
||||
|
||||
for(var dataIndex = 0; dataIndex < data.length; dataIndex++) {
|
||||
var nextData = data[dataIndex];
|
||||
var text = $.isFunction(options.textAttr) ? options.textAttr(nextData) : nextData[options.textAttr];
|
||||
var li = $("<li role='presentation' class='" + this.options.listItemClasses + "'><a role='menuitem' href='javascript:;'>" + text + "</a></li>")
|
||||
|
||||
li.appendTo(ul);
|
||||
li.data('object', nextData);
|
||||
li.bind("click", this.selectionHandler);
|
||||
}
|
||||
};
|
||||
|
||||
Dropdown.DEFAULTS = {
|
||||
textAttr: 'name', //The attribute of the data elements to use for the name. This can also be a function that takes the data object and returns the text.
|
||||
defaultText: '', //The initial text if no selection is made. This will be taken from the
|
||||
selectionClass: '', //The class to use for the selected element in the dropdown list.
|
||||
buttonStyling: '',
|
||||
buttonClasses: 'btn btn-default dropdown-toggle',
|
||||
caretClasses: 'caret',
|
||||
listItemClasses: ''
|
||||
};
|
||||
|
||||
Dropdown.prototype.getSelection = Dropdown.prototype.getSelected = function() {
|
||||
return this.$selected.data('object');
|
||||
};
|
||||
|
||||
Dropdown.prototype.setSelection = Dropdown.prototype.setSelected = function(object) {
|
||||
var listElements = this.$element.find("li");
|
||||
|
||||
for(var index = 0; index < listElements.length; index++) {
|
||||
if($(listElements[index]).data('object').id == object.id) {
|
||||
this.$selected = $(listElements[index]);
|
||||
this.$selected.addClass(this.options.selectionClass).siblings().removeClass(this.options.selectionClass);
|
||||
this.$textSpan.text(this.$selected.text());
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
$.fn.buildDropdown = function(data, options) {
|
||||
for(var index = 0; index < this.length; index++) {
|
||||
var $next = $(this[index]);
|
||||
var nextDropdown = new Dropdown($next, data, options);
|
||||
|
||||
$next.data("dropdown", nextDropdown);
|
||||
}
|
||||
}
|
||||
$.fn.dropdown = function() {
|
||||
if(this.length > 0) {
|
||||
return $(this[0]).data('dropdown');
|
||||
}
|
||||
}
|
||||
})(jQuery);
|
||||
23
public/admin/js/brainstorm.js
Normal file
23
public/admin/js/brainstorm.js
Normal file
@@ -0,0 +1,23 @@
|
||||
//Client side brainstorm.
|
||||
|
||||
var Brainstorm;
|
||||
|
||||
+function($) {
|
||||
Brainstorm = function(options) {
|
||||
var _this = this;
|
||||
this.options = $.extend({}, Brainstorm.DEFAULTS, options);
|
||||
this.socket = io.connect(options.url);
|
||||
|
||||
this.socket.on('name', function(data) {
|
||||
|
||||
});
|
||||
};
|
||||
|
||||
Brainstorm.DEFAULTS = {
|
||||
url: '' //The url to make a websocket connection to.
|
||||
};
|
||||
|
||||
Brainstorm.prototype.query = function(params) {
|
||||
this.socket.emit("query", params);
|
||||
};
|
||||
}(jquery);
|
||||
@@ -19,6 +19,8 @@ var LinkedTable;
|
||||
attr: 'data-key-name',
|
||||
selectionCSS: 'selected',
|
||||
selection: 'row', //Currently only row is supported.
|
||||
supportingData: [], //An array of objects, one for each collection of supporting data. Each object must have a 'name', 'url', and optional 'parameters'. The url and parameters are used the same as for the primary query. The name is used to store the results for use in rendering the data. Optional 'postProcess' attribute can be a function that takes the data and returns a modified set of data.
|
||||
cellDataHandlers: {}, //An object containing a function for each attribute, where the attribute is the table header object key, and the function is called to convert the primary data object into a cell value. The function will be passed the jquery table data wrapper object for the cell, the primary data object for the row, and the object containing the supporting data returned from running the supporting data queries.
|
||||
postAddRowHandler: null, //Optional function that is passed the jquery table row and the data object sent by the server for that row. Allows post processing of the row prior to display.
|
||||
parameters: null //Optional function that returns an object, or an object whose attributes are passed to the URL as parameters.
|
||||
};
|
||||
@@ -38,6 +40,8 @@ var LinkedTable;
|
||||
var attr = this.options.attr;
|
||||
var selectionHandler = this.selectionHandler;
|
||||
var params;
|
||||
var deferreds = [];
|
||||
var supportingData = {};
|
||||
|
||||
if(thead.length == 0) {
|
||||
return;
|
||||
@@ -55,6 +59,7 @@ var LinkedTable;
|
||||
tbody.appendTo(table);
|
||||
}
|
||||
|
||||
//Build the parameters for the query for the primary set of data.
|
||||
if(typeof this.options.parameters == 'function') {
|
||||
params = this.options.parameters();
|
||||
|
||||
@@ -68,15 +73,58 @@ var LinkedTable;
|
||||
}
|
||||
else {params = {};}
|
||||
|
||||
$.getJSON(this.options.url, params, function(data) {
|
||||
//Load the primary set of data.
|
||||
deferreds.push($.getJSON(this.options.url, params));
|
||||
|
||||
//Load all supporting data.
|
||||
for(var supportingDataIndex = 0; supportingDataIndex < this.options.supportingData.length; supportingDataIndex++) {
|
||||
var nextSupportingData = this.options.supportingData[supportingDataIndex];
|
||||
|
||||
//Build the parameters for each supporting set of data.
|
||||
if(typeof nextSupportingData.parameters == 'function') {
|
||||
params = nextSupportingData.parameters();
|
||||
|
||||
//Must be an object.
|
||||
if(typeof params != 'object') {
|
||||
params = {};
|
||||
}
|
||||
}
|
||||
else if(typeof nextSupportingData.parameters == 'object') {
|
||||
params = nextSupportingData.parameters;
|
||||
}
|
||||
else {params = {};}
|
||||
|
||||
//Load the supporting data.
|
||||
deferreds.push($.getJSON(nextSupportingData.url, params));
|
||||
}
|
||||
|
||||
//Use apply to convert an array of parameters to individual parameters for the $.when(..) function. The success function will receive the results in order passed to when().
|
||||
$.when.apply($, deferreds).then(function() {
|
||||
var data = arguments[0][0]; //Note: The result of the first query returns an array of three values: the data (array in this case), the message, and XHR object. We only care about the data.
|
||||
var headers = thead.children();
|
||||
var attributes = [];
|
||||
|
||||
//Save each supporting set of data by name into the supportingData object.
|
||||
for(var argumentIndex = 1; argumentIndex < arguments.length; argumentIndex++) {
|
||||
var supportingResult = arguments[argumentIndex][0]; //We only care about the data. The other two array elements are the status and the XHR object.
|
||||
|
||||
if(_this.options.supportingData[argumentIndex - 1].postProcess) {
|
||||
supportingResult = _this.options.supportingData[argumentIndex - 1].postProcess(supportingResult);
|
||||
}
|
||||
|
||||
supportingData[_this.options.supportingData[argumentIndex - 1].name] = supportingResult;
|
||||
}
|
||||
|
||||
//Read the table headers to get the data object keys.
|
||||
for(var headerIndex = 0; headerIndex < headers.length; headerIndex++) {
|
||||
var nextHeader = headers[headerIndex];
|
||||
|
||||
attributes[headerIndex] = $(nextHeader).attr(attr);
|
||||
|
||||
//Replace the attribute name with the handler function if there is one in the mapping.
|
||||
if(_this.options.cellDataHandlers[attributes[headerIndex]]) {
|
||||
attributes[headerIndex] = _this.options.cellDataHandlers[attributes[headerIndex]];
|
||||
}
|
||||
}
|
||||
|
||||
//Add the table data.
|
||||
@@ -90,9 +138,18 @@ var LinkedTable;
|
||||
|
||||
for(var attributeIndex = 0; attributeIndex < attributes.length; attributeIndex++) {
|
||||
var attribute = attributes[attributeIndex];
|
||||
var cellData = rowData[attribute];
|
||||
|
||||
row.append("<td>" + cellData + "</td>");
|
||||
if($.isFunction(attribute)) {
|
||||
var cell = $("<td></td>");
|
||||
|
||||
cell.appendTo(row);
|
||||
attribute(cell, rowData, supportingData);
|
||||
}
|
||||
else {
|
||||
var cellData = rowData[attribute];
|
||||
|
||||
row.append("<td>" + cellData + "</td>");
|
||||
}
|
||||
}
|
||||
|
||||
if(_this.options.postAddRowHandler) {
|
||||
@@ -103,6 +160,8 @@ var LinkedTable;
|
||||
|
||||
//Setup the row selection handler.
|
||||
if(selection == 'row') table.on('click', 'tbody tr', selectionHandler);
|
||||
}).fail(function(err) {
|
||||
console.error("Unexpected error loading the table data?!?");
|
||||
});
|
||||
}
|
||||
}(jQuery);
|
||||
19
public/admin/js/polyfills.js
Normal file
19
public/admin/js/polyfills.js
Normal file
@@ -0,0 +1,19 @@
|
||||
//Make sure we have an Array.reduce() function.
|
||||
if (!Array.prototype.reduce) {
|
||||
Array.prototype.reduce = function(callbackfn, initVal) {
|
||||
"use strict";
|
||||
var arr = this,
|
||||
arrLen = arr.length,
|
||||
k = 0,
|
||||
accumulator = initVal === undefined ? undefined : initVal;
|
||||
|
||||
for(;k < arrLen;k++) {
|
||||
if (accumulator !== undefined && k in arr) {
|
||||
accumulator = callbackfn.call(undefined, accumulator, arr[k], k, arr);
|
||||
} else {
|
||||
accumulator = arr[k];
|
||||
}
|
||||
}
|
||||
return accumulator;
|
||||
};
|
||||
}
|
||||
7248
public/admin/js/socket.io.js
Normal file
7248
public/admin/js/socket.io.js
Normal file
File diff suppressed because it is too large
Load Diff
@@ -106,17 +106,17 @@
|
||||
dataTable.refresh();
|
||||
|
||||
//---- Create Dialog ----
|
||||
$("#createButton").on("click", function(event) {
|
||||
$("#createDialog").modal();
|
||||
$("#measures #createButton").on("click", function(event) {
|
||||
$("#measures #createDialog").modal();
|
||||
});
|
||||
$("#createDialog_CreateButton").on("click", function(event) {
|
||||
$("#measures #createDialog_CreateButton").on("click", function(event) {
|
||||
try {
|
||||
$.post("/admin/measures/create", {
|
||||
name: $("#createDialog_NameField").val(),
|
||||
postfix: $("#createDialog_PostfixField").val()
|
||||
name: $("#measures #createDialog_NameField").val(),
|
||||
postfix: $("#measures #createDialog_PostfixField").val()
|
||||
}, function(data) {
|
||||
if(data.result == "success") {
|
||||
$("#createDialog").modal("hide");
|
||||
$("#measures #createDialog").modal("hide");
|
||||
dataTable.refresh();
|
||||
}
|
||||
else {
|
||||
@@ -127,24 +127,24 @@
|
||||
alert(e);
|
||||
}
|
||||
});
|
||||
$("#createDialog").on('shown.bs.modal', function() {
|
||||
$("#measures #createDialog").on('shown.bs.modal', function() {
|
||||
$('#createDialog_NameField').focus();
|
||||
});
|
||||
//----------------------------
|
||||
|
||||
//---- Delete Dialog ----
|
||||
$("#deleteButton").on("click", function(event) {
|
||||
$("#measures #deleteButton").on("click", function(event) {
|
||||
//debugger;
|
||||
if(dataTable.getSelectedRow() != null) {
|
||||
$("#deleteDialog_NameField").html(dataTable.getSelectedRow().data("model").name);
|
||||
$("#deleteDialog").modal();
|
||||
$("#measures #deleteDialog_NameField").html(dataTable.getSelectedRow().data("model").name);
|
||||
$("#measures #deleteDialog").modal();
|
||||
}
|
||||
});
|
||||
$("#deleteDialog_DeleteButton").on("click", function(event) {
|
||||
$("#measures #deleteDialog_DeleteButton").on("click", function(event) {
|
||||
if(dataTable.getSelectedRow() != null) {
|
||||
$.post("/admin/measures/delete", {id: dataTable.getSelectedRow().data("model").id}, function(data) {
|
||||
if(data.result == "success") {
|
||||
$("#deleteDialog").modal("hide");
|
||||
$("#measures #deleteDialog").modal("hide");
|
||||
dataTable.refresh();
|
||||
}
|
||||
else {
|
||||
@@ -156,23 +156,23 @@
|
||||
//-----------------------------
|
||||
|
||||
//----- Edit Dialog ----
|
||||
$("#editButton").on("click", function(event) {
|
||||
$("#measures #editButton").on("click", function(event) {
|
||||
//debugger;
|
||||
if(dataTable.getSelectedRow() != null) {
|
||||
$('#editDialog_NameField').val(dataTable.getSelectedRow().data("model").name);
|
||||
$('#editDialog_PostfixField').val(dataTable.getSelectedRow().data("model").postfix);
|
||||
$("#editDialog").modal();
|
||||
$("#measures #editDialog").modal();
|
||||
}
|
||||
});
|
||||
$("#editDialog_SaveButton").on("click", function(event) {
|
||||
$("#measures #editDialog_SaveButton").on("click", function(event) {
|
||||
if(dataTable.getSelectedRow() != null) {
|
||||
$.post("/admin/measures/edit", {
|
||||
id: dataTable.getSelectedRow().data("model").id,
|
||||
name: $("#editDialog_NameField").val(),
|
||||
postfix: $("#createDialog_PostfixField").val()
|
||||
name: $("#measures #editDialog_NameField").val(),
|
||||
postfix: $("#measures #createDialog_PostfixField").val()
|
||||
}, function(data) {
|
||||
if(data.result == "success") {
|
||||
$("#editDialog").modal("hide");
|
||||
$("#measures #editDialog").modal("hide");
|
||||
dataTable.refresh();
|
||||
}
|
||||
else {
|
||||
@@ -181,7 +181,7 @@
|
||||
}, "json");
|
||||
}
|
||||
});
|
||||
$("#editDialog").on('shown.bs.modal', function() {
|
||||
$("#measures #editDialog").on('shown.bs.modal', function() {
|
||||
$('#editDialog_NameField').focus().select();
|
||||
});
|
||||
//---------------------
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
<thead>
|
||||
<tr>
|
||||
<th data-key-name="name">Name</th>
|
||||
<th data-key-name="category">Category</th>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
@@ -33,6 +34,10 @@
|
||||
<label>Name</label>
|
||||
<input type="text" class="form-control" name="name" id="createDialog_NameField" tabindex="0">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Category</label>
|
||||
<div id="createDialog_categoryDropdown" style="position: relative;"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default btn-md" id="createDialog_CreateButton" tabindex="0">Create</button>
|
||||
@@ -52,6 +57,10 @@
|
||||
<label>Name</label>
|
||||
<input type="text" class="form-control" name="name" id="editDialog_NameField" tabindex="0">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Category</label>
|
||||
<div id="editDialog_categoryDropdown" style="position: relative;"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default btn-md" id="editDialog_SaveButton" tabindex="0">Save</button>
|
||||
@@ -78,6 +87,8 @@
|
||||
|
||||
<script language="JavaScript" type="text/javascript">
|
||||
$(function() {
|
||||
var categoriesById;
|
||||
|
||||
//# sourceURL=subcategories.html
|
||||
var dataTable = new LinkedTable($('#subcategory-table'), {
|
||||
url: "subcategories/list",
|
||||
@@ -86,6 +97,34 @@
|
||||
parameters: function() {
|
||||
return {showDeleted: $('#includeDeletedToggle').is(":checked") ? true : false};
|
||||
},
|
||||
supportingData: [{name: "categories", url: "categories/List", parameters: {showDeleted: true}, postProcess: function(data) {
|
||||
var byId;
|
||||
|
||||
//Convert the category list into a map by category id.
|
||||
byId = data.reduce(function(map, category) {
|
||||
map[category.id] = category;
|
||||
return map;
|
||||
}, {});
|
||||
|
||||
//Setup the two dialogs (new & edit).
|
||||
$('#createDialog_categoryDropdown').buildDropdown(data, {textAttr: 'name', defaultText: 'Pick One', selectionClass: 'dropdownSelection', buttonStyling: 'min-width: 100px;'});
|
||||
$('#editDialog_categoryDropdown').buildDropdown(data, {textAttr: 'name', defaultText: 'Pick One', selectionClass: 'dropdownSelection', buttonStyling: 'min-width: 100px;'});
|
||||
|
||||
//Save the categories by id for use when setting the editor dialog's dropdown selection.
|
||||
categoriesById = byId;
|
||||
|
||||
return byId;
|
||||
}}],
|
||||
cellDataHandlers: {category: function($cell, subcategory, supportingData) {
|
||||
try {
|
||||
var category = supportingData.categories[subcategory.categoryId];
|
||||
|
||||
$cell.html(category.name);
|
||||
}catch(err) {
|
||||
console.log(err);
|
||||
$cell.html("Not Found");
|
||||
}
|
||||
}},
|
||||
postAddRowHandler: function($row, dataObject) {
|
||||
if(dataObject.deletedAt) {
|
||||
$("td:first", $row).prepend("<span class='glyphicon glyphicon-remove-circle' style='margin-right: 10px;' aria-hidden='true'></span>");
|
||||
@@ -97,16 +136,17 @@
|
||||
dataTable.refresh();
|
||||
|
||||
//---- Create Dialog ----
|
||||
$("#createButton").on("click", function(event) {
|
||||
$("#createDialog").modal();
|
||||
$("#subcategories #createButton").on("click", function(event) {
|
||||
$("#subcategories #createDialog").modal();
|
||||
});
|
||||
$("#createDialog_CreateButton").on("click", function(event) {
|
||||
$("#subcategories #createDialog_CreateButton").on("click", function(event) {
|
||||
try {
|
||||
$.post("/admin/subcategories/create", {
|
||||
name: $("#createDialog_NameField").val()
|
||||
name: $("#subcategories #createDialog_NameField").val(),
|
||||
categoryId: $('#subcategories #createDialog_CategoryDropdown').dropdown().getSelection().id
|
||||
}, function(data) {
|
||||
if(data.result == "success") {
|
||||
$("#createDialog").modal("hide");
|
||||
$("#subcategories #createDialog").modal("hide");
|
||||
dataTable.refresh();
|
||||
}
|
||||
else {
|
||||
@@ -117,24 +157,24 @@
|
||||
alert(e);
|
||||
}
|
||||
});
|
||||
$("#createDialog").on('shown.bs.modal', function() {
|
||||
$("#subcategories #createDialog").on('shown.bs.modal', function() {
|
||||
$('#createDialog_NameField').focus();
|
||||
});
|
||||
//----------------------------
|
||||
|
||||
//---- Delete Dialog ----
|
||||
$("#deleteButton").on("click", function(event) {
|
||||
$("#subcategories #deleteButton").on("click", function(event) {
|
||||
//debugger;
|
||||
if(dataTable.getSelectedRow() != null) {
|
||||
$("#deleteDialog_NameField").html(dataTable.getSelectedRow().data("model").name);
|
||||
$("#deleteDialog").modal();
|
||||
$("#subcategories #deleteDialog_NameField").html(dataTable.getSelectedRow().data("model").name);
|
||||
$("#subcategories #deleteDialog").modal();
|
||||
}
|
||||
});
|
||||
$("#deleteDialog_DeleteButton").on("click", function(event) {
|
||||
$("#subcategories #deleteDialog_DeleteButton").on("click", function(event) {
|
||||
if(dataTable.getSelectedRow() != null) {
|
||||
$.post("/admin/subcategories/delete", {id: dataTable.getSelectedRow().data("model").id}, function(data) {
|
||||
if(data.result == "success") {
|
||||
$("#deleteDialog").modal("hide");
|
||||
$("#subcategories #deleteDialog").modal("hide");
|
||||
dataTable.refresh();
|
||||
}
|
||||
else {
|
||||
@@ -146,21 +186,24 @@
|
||||
//-----------------------------
|
||||
|
||||
//----- Edit Dialog ----
|
||||
$("#editButton").on("click", function(event) {
|
||||
$("#subcategories #editButton").on("click", function(event) {
|
||||
//debugger;
|
||||
if(dataTable.getSelectedRow() != null) {
|
||||
$('#editDialog_NameField').val(dataTable.getSelectedRow().data("model").name);
|
||||
$("#editDialog").modal();
|
||||
var selectedModel = dataTable.getSelectedRow().data("model");
|
||||
|
||||
$('#editDialog_NameField').val(selectedModel.name);
|
||||
$('#subcategories #editDialog_categoryDropdown').dropdown().setSelection(categoriesById[selectedModel.categoryId]);
|
||||
$("#subcategories #editDialog").modal();
|
||||
}
|
||||
});
|
||||
$("#editDialog_SaveButton").on("click", function(event) {
|
||||
$("#subcategories #editDialog_SaveButton").on("click", function(event) {
|
||||
if(dataTable.getSelectedRow() != null) {
|
||||
$.post("/admin/subcategories/edit", {
|
||||
id: dataTable.getSelectedRow().data("model").id,
|
||||
name: $("#editDialog_NameField").val()
|
||||
name: $("#subcategories #editDialog_NameField").val()
|
||||
}, function(data) {
|
||||
if(data.result == "success") {
|
||||
$("#editDialog").modal("hide");
|
||||
$("#subcategories #editDialog").modal("hide");
|
||||
dataTable.refresh();
|
||||
}
|
||||
else {
|
||||
@@ -169,7 +212,7 @@
|
||||
}, "json");
|
||||
}
|
||||
});
|
||||
$("#editDialog").on('shown.bs.modal', function() {
|
||||
$("#subcategories #editDialog").on('shown.bs.modal', function() {
|
||||
$('#editDialog_NameField').focus().select();
|
||||
});
|
||||
//---------------------
|
||||
|
||||
@@ -1,2 +1,5 @@
|
||||
#subcategories {
|
||||
.dropdownSelection {
|
||||
background-color: #cad0ff;
|
||||
}
|
||||
}
|
||||
30
public/admin/test.html
Normal file
30
public/admin/test.html
Normal file
@@ -0,0 +1,30 @@
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<link rel="stylesheet" href="/admin/css/bootstrap/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="/admin/css/jquery-ui-1.11.4/jquery-ui.min.css">
|
||||
<link rel="stylesheet" href="/admin/css/bootstrap-toggle.min.css">
|
||||
|
||||
<script type="text/javascript" language="JavaScript" src="js/jquery-1.11.3.min.js"></script>
|
||||
<script type="text/javascript" language="JavaScript" src="js/jquery-migrate-1.2.1.min.js"></script>
|
||||
<script type="text/javascript" language="JavaScript" src="js/jquery.history.js"></script>
|
||||
<script type="text/javascript" language="JavaScript" src="js/jquery.cycle.min.js"></script>
|
||||
<script type="text/javascript" language="JavaScript" src="js/jquery.cycle2.min.js"></script>
|
||||
<script type="text/javascript" language="JavaScript" src="js/jquery.shadow.js"></script>
|
||||
<script type="text/javascript" language="JavaScript" src="js/scroller.js"></script>
|
||||
<script type="text/javascript" language="JavaScript" src="js/bootstrap.min.js"></script>
|
||||
<script type="text/javascript" language="JavaScript" src="js/LinkedTable.js"></script>
|
||||
<script type="text/javascript" language="JavaScript" src="js/bootstrap-toggle.min.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<input id="toggle-event" type="checkbox" data-toggle="toggle">
|
||||
<div id="console-event"></div>
|
||||
<script>
|
||||
$(function() {
|
||||
$('#toggle-event').change(function() {
|
||||
$('#console-event').html('Toggle: ' + $(this).prop('checked'))
|
||||
})
|
||||
})
|
||||
</script>
|
||||
</body>
|
||||
11
public/admin/test2.html
Normal file
11
public/admin/test2.html
Normal file
@@ -0,0 +1,11 @@
|
||||
|
||||
|
||||
<input id="toggle-event" type="checkbox" data-toggle="toggle">
|
||||
<div id="console-event"></div>
|
||||
<script>
|
||||
$(function() {
|
||||
$('#toggle-event').change(function() {
|
||||
$('#console-event').html('Toggle: ' + $(this).prop('checked'))
|
||||
})
|
||||
})
|
||||
</script>
|
||||
@@ -109,17 +109,17 @@
|
||||
userTable.refresh();
|
||||
|
||||
//---- Create User Dialog ----
|
||||
$("#createButton").on("click", function(event) {
|
||||
$("#createUserDialog").modal();
|
||||
$("#users #createButton").on("click", function(event) {
|
||||
$("#users #createUserDialog").modal();
|
||||
});
|
||||
$("#createUserDialogButton").on("click", function(event) {
|
||||
$("#users #createUserDialogButton").on("click", function(event) {
|
||||
try {
|
||||
$.post("/admin/user/create", {
|
||||
login: $("#loginDialogLogin").val(),
|
||||
password: $("#loginDialogPassword").val()
|
||||
login: $("#users #loginDialogLogin").val(),
|
||||
password: $("#users #loginDialogPassword").val()
|
||||
}, function(data) {
|
||||
if(data.result == "success") {
|
||||
$("#createUserDialog").modal("hide");
|
||||
$("#users #createUserDialog").modal("hide");
|
||||
userTable.refresh();
|
||||
}
|
||||
else {
|
||||
@@ -130,26 +130,26 @@
|
||||
alert(e);
|
||||
}
|
||||
});
|
||||
$("#createUserDialog").on('shown.bs.modal', function() {
|
||||
$("#users #createUserDialog").on('shown.bs.modal', function() {
|
||||
$('#createUserDialogLogin').focus();
|
||||
});
|
||||
//----------------------------
|
||||
|
||||
//---- Delete User Dialog ----
|
||||
$("#deleteButton").on("click", function(event) {
|
||||
$("#users #deleteButton").on("click", function(event) {
|
||||
//debugger;
|
||||
if(userTable.getSelectedRow() != null) {
|
||||
//Note: This assumes that the first column is the user login (name).
|
||||
//$("#deleteUserDialogUserName").html($("td", userTable.getSelectedRow())[0].innerHTML);
|
||||
$("#deleteUserDialogUserName").html(userTable.getSelectedRow().data("model").login);
|
||||
$("#deleteUserDialog").modal();
|
||||
//$("#users #deleteUserDialogUserName").html($("td", userTable.getSelectedRow())[0].innerHTML);
|
||||
$("#users #deleteUserDialogUserName").html(userTable.getSelectedRow().data("model").login);
|
||||
$("#users #deleteUserDialog").modal();
|
||||
}
|
||||
});
|
||||
$("#deleteUserDialogDeleteButton").on("click", function(event) {
|
||||
$("#users #deleteUserDialogDeleteButton").on("click", function(event) {
|
||||
if(userTable.getSelectedRow() != null) {
|
||||
$.post("/admin/user/delete", {id: userTable.getSelectedRow().data("model").id}, function(data) {
|
||||
if(data.result == "success") {
|
||||
$("#deleteUserDialog").modal("hide");
|
||||
$("#users #deleteUserDialog").modal("hide");
|
||||
userTable.refresh();
|
||||
}
|
||||
else {
|
||||
@@ -161,20 +161,20 @@
|
||||
//-----------------------------
|
||||
|
||||
//----- Change Login Dialog ----
|
||||
$("#changeLoginButton").on("click", function(event) {
|
||||
$("#users #changeLoginButton").on("click", function(event) {
|
||||
if(userTable.getSelectedRow() != null) {
|
||||
$('#changeLoginDialogLogin').val(userTable.getSelectedRow().data("model").login);
|
||||
$("#changeLoginDialog").modal();
|
||||
$("#users #changeLoginDialog").modal();
|
||||
}
|
||||
});
|
||||
$("#changeLoginDialogSaveButton").on("click", function(event) {
|
||||
$("#users #changeLoginDialogSaveButton").on("click", function(event) {
|
||||
if(userTable.getSelectedRow() != null) {
|
||||
$.post("/admin/user/changeLogin", {
|
||||
id: userTable.getSelectedRow().data("model").id,
|
||||
login: $("#changeLoginDialogLogin").val()
|
||||
login: $("#users #changeLoginDialogLogin").val()
|
||||
}, function(data) {
|
||||
if(data.result == "success") {
|
||||
$("#changeLoginDialog").modal("hide");
|
||||
$("#users #changeLoginDialog").modal("hide");
|
||||
userTable.refresh();
|
||||
}
|
||||
else {
|
||||
@@ -183,25 +183,25 @@
|
||||
}, "json");
|
||||
}
|
||||
});
|
||||
$("#changeLoginDialog").on('shown.bs.modal', function() {
|
||||
$("#users #changeLoginDialog").on('shown.bs.modal', function() {
|
||||
$('#changeLoginDialogLogin').focus().select();
|
||||
});
|
||||
//---------------------
|
||||
|
||||
//---- Reset Password Dialog ----
|
||||
$("#resetPasswordButton").on("click", function(event) {
|
||||
$("#users #resetPasswordButton").on("click", function(event) {
|
||||
if(userTable.getSelectedRow() != null) {
|
||||
$("#resetPasswordDialog").modal();
|
||||
$("#users #resetPasswordDialog").modal();
|
||||
}
|
||||
});
|
||||
$("#resetPasswordDialogSaveButton").on("click", function(event) {
|
||||
$("#users #resetPasswordDialogSaveButton").on("click", function(event) {
|
||||
if(userTable.getSelectedRow() != null) {
|
||||
$.post("/admin/user/resetPassword", {
|
||||
id: userTable.getSelectedRow().data("model").id,
|
||||
password: $("#resetPasswordDialogPassword").val()
|
||||
password: $("#users #resetPasswordDialogPassword").val()
|
||||
}, function(data) {
|
||||
if(data.result == "success") {
|
||||
$("#resetPasswordDialog").modal("hide");
|
||||
$("#users #resetPasswordDialog").modal("hide");
|
||||
userTable.refresh();
|
||||
}
|
||||
else {
|
||||
@@ -210,7 +210,7 @@
|
||||
}, "json");
|
||||
}
|
||||
});
|
||||
$("#resetPasswordDialog").on('shown.bs.modal', function() {
|
||||
$("#users #resetPasswordDialog").on('shown.bs.modal', function() {
|
||||
$('#resetPasswordDialogPassword').focus();
|
||||
});
|
||||
//----------------------------------
|
||||
|
||||
BIN
public/temp_photos/Sample1.png
Normal file
BIN
public/temp_photos/Sample1.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 8.1 MiB |
BIN
public/temp_photos/Sample2.png
Normal file
BIN
public/temp_photos/Sample2.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.5 MiB |
BIN
public/temp_photos/Sample3.png
Normal file
BIN
public/temp_photos/Sample3.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.5 MiB |
BIN
public/temp_photos/Sample4.png
Normal file
BIN
public/temp_photos/Sample4.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.4 MiB |
@@ -72,6 +72,9 @@ var models = require("./models");
|
||||
//Setup initial database data.
|
||||
require('./app/initialData.js')(models.sequelize);
|
||||
|
||||
//Setup the brainstorm communications system.
|
||||
require('./brainstorm.js')(app, models.sequelize);
|
||||
|
||||
//Ensure we have an endsWith method in String.
|
||||
String.prototype.endsWith = function(suffix) {
|
||||
return this.indexOf(suffix, this.length - suffix.length) !== -1;
|
||||
|
||||
Reference in New Issue
Block a user