Skip to content
Open
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
Empty file modified LICENSE.md
100644 → 100755
Empty file.
7 changes: 6 additions & 1 deletion README.md
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,9 @@
Silk icon set 1.3 - Mark James<br/>
[http://www.famfamfam.com/lab/icons/silk/](http://www.famfamfam.com/lab/icons/silk/)

The JIRA icon is directly from [Atlassian Software](https://www.atlassian.com/).
The JIRA icon is directly from [Atlassian Software](https://www.atlassian.com/).

**Contributors**

David Wolverton
Vodori (https://www.vodori.com/)
Empty file modified bigtime.js
100644 → 100755
Empty file.
10 changes: 5 additions & 5 deletions bower.json
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"name": "mytime",
"version": "0.0",
"version": "1.0",
"dependencies": {
"dojo": "1.8.4",
"dojox": "1.8.4",
"dijit": "1.8.4",
"lodash": "2.4.1"
"dojo": "1.10",
"dojox": "1.10",
"dijit": "1.10",
"lodash": "3.8.0"
},
"devDependencies": {
"mocha": "*",
Expand Down
Empty file modified docs/notes.txt
100644 → 100755
Empty file.
Empty file modified docs/testing-notes.txt
100644 → 100755
Empty file.
Empty file modified images/jira-icon.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 8 additions & 8 deletions index.html
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
<!doctype html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
<title>Time Logger</title>
<title>My Time</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/png" href="images/time.png" />
<link rel="stylesheet" href="bower_components/dijit/themes/nihilo/nihilo.css" />
<link rel="stylesheet" href="styles.css" />
Expand All @@ -13,11 +15,9 @@
"></script>
</head>
<body class="nihilo">
<div data-dojo-type="dijit/layout/TabContainer" style="width: 100%; height: 100%;">
<div data-dojo-id="pane" data-dojo-type="mytime/view/TimeEntryPane" data-dojo-props="title: 'Time Entry'"></div>
</div>
<div class="footer">
Context: <a href="?">Work</a> <a href="?ctx=home">Home</a>
</div>
<div data-dojo-type="mytime/view/TimeEntryPane"></div>
<div class="footer">
Context: <a href="?">Work</a> <a href="?ctx=home">Home</a>
</div>
</body>
</html>
2 changes: 1 addition & 1 deletion script/bootstrap.js
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
require({
packages: [
{ name: 'mytime', location: '../../script/mytime' },
{ name: 'lodash', location: '../lodash/dist', main: 'lodash.min' }
{ name: 'lodash', location: '../lodash', main: 'lodash.min' }
]
}, ['mytime/debug-helper', 'dojo/parser', 'dojo/ready'].concat(main), function(_1, parser, ready) {
ready(function() {
Expand Down
Empty file modified script/mytime/command/CreateTaskCommand.js
100644 → 100755
Empty file.
Empty file modified script/mytime/command/CreateTimeEntryCommand.js
100644 → 100755
Empty file.
Empty file modified script/mytime/command/DeleteTaskCommand.js
100644 → 100755
Empty file.
Empty file modified script/mytime/command/DeleteTimeEntryCommand.js
100644 → 100755
Empty file.
12 changes: 12 additions & 0 deletions script/mytime/command/GetJiraPickListCommand.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/**
* @license
* Copyright 2014 David Wolverton
* Available under MIT license <https://raw.githubusercontent.com/dwolverton/my/master/LICENSE.txt>
*/
define(["./_Command"],
function (_Command) {
return _Command.makeCommand({
commandTopic: "integration/jira/list",
query: null
});
});
12 changes: 12 additions & 0 deletions script/mytime/command/UpdateJiraIntegrationCommand.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/**
* @license
* Copyright 2014 David Wolverton
* Available under MIT license <https://raw.githubusercontent.com/dwolverton/my/master/LICENSE.txt>
*/
define(["./_Command"],
function (_Command) {
return _Command.makeCommand({
commandTopic: "time-entry/update",
timeEntry: null
});
});
Empty file modified script/mytime/command/UpdateTaskCommand.js
100644 → 100755
Empty file.
Empty file modified script/mytime/command/UpdateTimeEntryCommand.js
100644 → 100755
Empty file.
Empty file modified script/mytime/command/_Command.js
100644 → 100755
Empty file.
28 changes: 28 additions & 0 deletions script/mytime/controller/JiraController.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
define(['dojo/_base/lang', 'dojo/_base/declare', "dijit/Destroyable",
"mytime/command/GetJiraPicklistCommand", "mytime/rest/GetJiraPicklistRequest"],
function (lang, declare, Destroyable,
GetJiraPicklistCommand, GetJiraPicklistRequest) {

return declare([Destroyable], {

requestQueue: null,

constructor: function(args) {
lang.mixin(this, args);
this.own(
GetJiraPicklistCommand.subscribe(lang.hitch(this, "handlePicklist"))
);
},

handlePicklist: function(command) {
var request = new GetJiraPicklistRequest(command.query);
request.then(lang.hitch(command, 'resolve'));
this.requestQueue.push(request);
},

handleUpdate: function(command) {

}

});
});
18 changes: 17 additions & 1 deletion script/mytime/controller/TaskController.js
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@ define([
"mytime/model/modelRegistry", "mytime/model/Task",
"mytime/command/CreateTaskCommand", "mytime/command/UpdateTaskCommand",
"mytime/command/DeleteTaskCommand",
"mytime/rest/PutTaskRequest", "mytime/rest/DeleteTaskRequest",
"mytime/controller/_CrudController",
"mytime/util/syncFrom", "mytime/util/ColorGenerator"
], function(
lang, declare, when,
modelRegistry, Task,
CreateTaskCommand, UpdateTaskCommand, DeleteTaskCommand,
PutTaskRequest, DeleteTaskRequest,
_CrudController,
syncFrom, ColorGenerator
) {
Expand All @@ -35,8 +37,10 @@ define([
colorGenerator: null,

timeEntryStore: null,
requestQueue: null,

constructor: function() {
constructor: function(args) {
lang.mixin(this, args);
this.colorGenerator = new ColorGenerator();
this.own( syncFrom(modelRegistry, "taskStore", this, "store") );
this.own( syncFrom(modelRegistry, "timeEntryStore", this) );
Expand All @@ -61,6 +65,18 @@ define([
this.timeEntryStore.put(timeEntry);
}, this);
}));
},

_afterCreate: function(command, task) {
//this.requestQueue.push(new PutTaskRequest(task));
},

_afterUpdate: function(command, task) {
//this.requestQueue.push(new PutTaskRequest(task));
},

_afterDelete: function(command, task) {
//this.requestQueue.push(new DeleteTaskRequest(task));
}
});

Expand Down
21 changes: 18 additions & 3 deletions script/mytime/controller/TimeEntryController.js
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,18 @@
* Available under MIT license <https://raw.githubusercontent.com/dwolverton/my/master/LICENSE.txt>
*/
define([
"dojo/_base/declare",
"dojo/_base/declare", "dojo/_base/lang",
"mytime/model/modelRegistry", "mytime/model/TimeEntry",
"mytime/command/CreateTimeEntryCommand", "mytime/command/UpdateTimeEntryCommand",
"mytime/command/DeleteTimeEntryCommand",
"mytime/rest/PutEntryRequest", "mytime/rest/DeleteEntryRequest",
"mytime/controller/_CrudController",
"mytime/util/syncFrom"
], function(
declare,
declare, lang,
modelRegistry, TimeEntry,
CreateTimeEntryCommand, UpdateTimeEntryCommand, DeleteTimeEntryCommand,
PutEntryRequest, DeleteEntryRequest,
_CrudController,
syncFrom
) {
Expand All @@ -32,7 +34,8 @@ define([
objectTypeStringForMessages: "time entry",
storageKey: "timeEntryStore",

constructor: function() {
constructor: function(args) {
lang.mixin(this, args);
this.own( syncFrom(modelRegistry, "timeEntryStore", this, "store") );
},

Expand All @@ -56,6 +59,18 @@ define([
entry.endHour = swap;
}
return true;
},

_afterCreate: function(command, entry) {
//this.requestQueue.push(new PutEntryRequest(entry));
},

_afterUpdate: function(command, entry) {
//this.requestQueue.push(new PutEntryRequest(entry));
},

_afterDelete: function(command, entry) {
//this.requestQueue.push(new DeleteEntryRequest(entry));
}
});

Expand Down
78 changes: 54 additions & 24 deletions script/mytime/controller/_CrudController.js
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -48,18 +48,19 @@ define([
if (!this.store) {
command.reject(this._getCommandError("Cannot add {} before system is initialized."));
} else {
var entry = new this.objectTypeConstructor(command[this.commandObjectProperty]);
entry.set("id", IdGenerator.nextIdForType(this.objectTypeName));
var object = new this.objectTypeConstructor(command[this.commandObjectProperty]);
object.set("id", IdGenerator.nextIdForType(this.objectTypeName));

this._beforeCreate(command, entry);
this._beforeCreate(command, object);
if (command.isFulfilled()) {
return;
}

console.log("PUT NEW " + JSON.stringify(entry));
this.store.put(entry);
command.resolve(this._getCommandResult(entry));
console.log("PUT NEW " + JSON.stringify(object));
this.store.put(object);
command.resolve(this._getCommandResult(object));
this._persistStore();
this._afterCreate(command, object);
}
},

Expand All @@ -68,33 +69,43 @@ define([
* resolve or reject the command.
*
* @param {Object} command
* @param {Object} entry new object about to be created. an instance of objectTypeConstructor
* @param {Object} object new object about to be created. an instance of objectTypeConstructor
* @private
*/
_beforeCreate: function(command, entry) {},
_beforeCreate: function(command, object) {},

/**
* Override this to extend behavior. Called after creating a new object.
*
* @param {Object} command
* @param {Object} object new object created. an instance of objectTypeConstructor
* @private
*/
_afterCreate: function(command, object) {},

handleUpdate: function(command) {
if (!this.store) {
command.reject(this._getCommandError("Cannot update {} before system is initialized."));
} else {
var updateObject = command[this.commandObjectProperty];
var id = updateObject.id;
var existingEntry = this.store.get(id);
if (!existingEntry) {
var existingObject = this.store.get(id);
if (!existingObject) {
command.reject(this._getCommandError("Cannot update {}. It does not exist."));
return;
}

this._beforeUpdate(command, existingEntry);
this._beforeUpdate(command, existingObject);
if (command.isFulfilled()) {
return;
}

existingEntry.updateFrom(updateObject);
console.log("PUT " + JSON.stringify(existingEntry));
this.store.put(existingEntry);
command.resolve(this._getCommandResult(existingEntry));
existingObject.updateFrom(updateObject);
console.log("PUT " + JSON.stringify(existingObject));
this.store.put(existingObject);
command.resolve(this._getCommandResult(existingObject));
this._persistStore();
this._afterUpdate(command, existingObject);
}
},

Expand All @@ -103,31 +114,41 @@ define([
* or reject the command.
*
* @param command
* @param existingEntry the entry from the store before updates are applied
* @param existingObject the object from the store before updates are applied
* @private
*/
_beforeUpdate: function(command, existingObject) {},

/**
* Override this to extend behavior. Called after updating an object.
*
* @param {Object} command
* @param {Object} object in the store after updates made. an instance of objectTypeConstructor
* @private
*/
_beforeUpdate: function(command, existingEntry) {},
_afterUpdate: function(command, object) {},

handleDelete: function(command) {
if (!this.store) {
command.reject(this._getCommandError("Cannot delete {} before system is initialized."));
} else {
var id = command[this.commandIdProperty];
var existingEntry = this.store.get(id);
if (!existingEntry) {
var existingObject = this.store.get(id);
if (!existingObject) {
command.reject(this._getCommandError("Cannot delete {}. It does not exist."));
return;
}

this._beforeDelete(command, existingEntry);
this._beforeDelete(command, existingObject);
if (command.isFulfilled()) {
return;
}

console.log("REMOVE " + JSON.stringify(existingEntry));
console.log("REMOVE " + JSON.stringify(existingObject));
this.store.remove(id);
command.resolve(this._getCommandResult(existingEntry, id));
command.resolve(this._getCommandResult(existingObject, id));
this._persistStore();
this._afterDelete(command, existingObject);
}
},

Expand All @@ -136,10 +157,19 @@ define([
* or reject the command.
*
* @param command
* @param existingEntry the entry from the store that will be deleted.
* @param existingObject the object from the store that will be deleted.
* @private
*/
_beforeDelete: function(command, existingObject) {},

/**
* Override this to extend behavior. Called after deleting an object.
*
* @param {Object} command
* @param {Object} object that was removed from the store. an instance of objectTypeConstructor
* @private
*/
_beforeDelete: function(command, existingEntry) {},
_afterDelete: function(command, existingObject) {},

_getCommandResult: function(object, id) {
var result = {};
Expand Down
Empty file modified script/mytime/debug-helper.js
100644 → 100755
Empty file.
Loading