diff --git a/db/test/DECISION_TAB.LOG b/db/test/DECISION_TAB.LOG index b7cfd43..f9db568 100644 Binary files a/db/test/DECISION_TAB.LOG and b/db/test/DECISION_TAB.LOG differ diff --git a/db/test/LATEST.LOG b/db/test/LATEST.LOG index 3facf33..9385302 100644 Binary files a/db/test/LATEST.LOG and b/db/test/LATEST.LOG differ diff --git a/doc/model.txt b/doc/model.txt new file mode 100644 index 0000000..ea15525 --- /dev/null +++ b/doc/model.txt @@ -0,0 +1,34 @@ +Data +---- +UserModel +TimelineModel +TimelineListModel +EntryListModel +EntryModel + + +Views +----- +EntryView +NewEntryInput +TimelineListView +TimelineView +UserView + + +Data Dependencies +----------------- +UserModel: none +TimelineModel: UserModel +TimelineListModel: UserModel +EntryModel: TimelineModel +EntryListModel: TimelineModel + + +View Dependencies +----------------- +UserView: UserModel +TimelineView: TimelineModel, UserView +TimelineListView: TimelineListModel, UserView +EntryView: EntryModel, EntryListView +EntryListView: EntryListModel, TimelineView diff --git a/doc/model.xcf b/doc/model.xcf new file mode 100644 index 0000000..670924f Binary files /dev/null and b/doc/model.xcf differ diff --git a/www/css/ts-screen.css b/www/css/ts-screen.css index 21b405a..46af972 100644 --- a/www/css/ts-screen.css +++ b/www/css/ts-screen.css @@ -34,10 +34,12 @@ body { display: inline-block; } #user.fullname-edit .fullname { display: none; } - #user ul#user-controls { + #user .drop-menu { + display: inline-block; } + #user .drop-menu .drop-menu-items { float: right; list-style: none; } - #user ul#user-controls li { + #user .drop-menu .drop-menu-items li { float: right; text-align: center; padding-right: 1em; } @@ -54,13 +56,25 @@ body { #timeline .timeline-desc { display: inline-block; width: 70%; } + #timeline .timeline-desc-input { + width: 70%; } #timeline .timeline-id { display: inline-block; } - #timeline .timeline-menu { + #timeline .timeline-desc-input, #timeline .timeline-id-input { + display: none; } + #timeline.edit-id .timeline-id-input { + display: inline-block; } + #timeline.edit-id .timeline-id { + display: none; } + #timeline.edit-desc .timeline-desc-input { + display: inline-block; } + #timeline.edit-desc .timeline-desc { + display: none; } + #timeline .drop-menu { text-align: right; display: inline-block; width: 29%; } - #timeline .timeline-menu .drop-menu-items { + #timeline .drop-menu .drop-menu-items { text-align: right; right: 0; } diff --git a/www/css/ts-screen.scss b/www/css/ts-screen.scss index 06ecf7d..d8c2c04 100644 --- a/www/css/ts-screen.scss +++ b/www/css/ts-screen.scss @@ -48,7 +48,10 @@ body { .fullname { display: none; } } - ul#user-controls { + .drop-menu { display: inline-block; } + + .drop-menu .drop-menu-items { + float: right; list-style: none; @@ -81,9 +84,23 @@ body { width: 70%; } + .timeline-desc-input { width: 70% } + .timeline-id { display: inline-block; } - .timeline-menu { + .timeline-desc-input, .timeline-id-input { display: none; } + + &.edit-id { + .timeline-id-input { display: inline-block; } + .timeline-id { display: none; } + } + + &.edit-desc { + .timeline-desc-input { display: inline-block; } + .timeline-desc { display: none; } + } + + .drop-menu { text-align: right; display: inline-block; width: 29%; diff --git a/www/index.yaws b/www/index.yaws index 98afab9..aef2d14 100644 --- a/www/index.yaws +++ b/www/index.yaws @@ -3,8 +3,8 @@ TimeStamper - Simple Time Tracking - - + + @@ -13,44 +13,54 @@ --> - - + + - - - - + + + + - +
- Work-related events. + No timeline loaded. -
-
( work )
+
+
( none )
    -
  • jdb-labs
  • -
  • timestamper
-
Jonathan Bernard
+
Not Logged In
-
- jdbernard
- +
+
- not_logged_in
+ +
@@ -74,6 +84,20 @@ + +
+
+
+ + + + +
+
+

+
diff --git a/www/js/ts.js b/www/js/ts.js index e94e1b2..4b27d4e 100644 --- a/www/js/ts.js +++ b/www/js/ts.js @@ -35,7 +35,11 @@ $(document).ready(function(){ * - join_date */ TS.UserModel = Backbone.Model.extend({ + url: function() { return '/ts_api/users/' + this.get('id'); }, + initialize: function(attrs, options) { + _.bind(this, 'url'); + } }); TS.EntryList = Backbone.Collection.extend({ @@ -84,7 +88,7 @@ $(document).ready(function(){ events: { "dblclick div.mark" : "editMark", "dblclick div.timestamp" : "editTimestamp", - "keypress .mark-input" : "updateOnEnter" + "keypress .mark-input" : "updateOnEnter", "keypress .timestamp-input" : "updateOnEnter" }, @@ -181,7 +185,7 @@ $(document).ready(function(){ $(this.el).addClass('edit-desc'); this.$('.timeline-desc-input').focus(); return this; - }; + }, close: function() { this.model.save({ @@ -195,40 +199,9 @@ $(document).ready(function(){ } }); - TS.TimelineListView = Backbone.View.extend({ - - el: $("#timeline .drop-menu-items"), - - events: { - 'click #timeline .drop-menu-items a': 'selectTimeline' - }, - - initialize: function() { - _.bindAll(this, 'addOne', 'render'); - this.collection.bind('add', this.addOne); - this.collection.bind('refresh', this.refresh); - this.collection.view = this; - }, - - addOne: function(timeline) { - $(this.el).append(ich.timelineLink(timeline.toJSON())); - }, - - render: function() { - $(this.el).empty(); - this.collection.each(this.addOne); - return this; - }, - - selectTimeline: function() { - // note that this refers to the element that initiated this event - // TODO - } - }); - TS.UserView = Backbone.View.extend({ - el: $("user"), + el: $("#user"), model: TS.UserModel, @@ -245,7 +218,7 @@ $(document).ready(function(){ render: function() { this.$('.fullname').text(this.model.get('name')); - this.$('.username').text(this.model.get('id')); + this.$('.username').text(" - " + this.model.get('id')); return this; }, @@ -266,6 +239,37 @@ $(document).ready(function(){ } }); + TS.AppView = Backbone.View.extend({ + + el: $("body"), + + events: { + 'click #timeline .drop-menu-items a': 'selectTimeline', + 'keypress #new-entry-input' : 'newTimestamp', + }, + + initialize: function() { + _.bindAll(this, 'render'); + }, + + renderTimelineList: function() { + var tlUL = this.$('#timeline ul.drop-menu-items'); + //var curTimeline = + //var remTimelines = TS.user.timelines.filter(function(timeline) + } + }); + + // wire the login dialog using jQuery UI + $("#login-dialog").dialog({ + autoOpen: false, + height: 400, + width: 400, + modal: true, + buttons: { Login: function(){login()} } + }); + + $('#login-dialog').dialog('open'); + }) function login() { @@ -296,35 +300,15 @@ function login() { // create the user model TS.user = new TS.UserModel({ - id: name.val();, + id: name.val(), name: '' }); - // create the user view - new TS.UserView({model: TS.user}); - // fetch the initial user data from the server TS.user.fetch(); - // create the user's timelines - TS.timelineList = new TS.TimelineList([], {user: TS.user}); + // create the user view + new TS.UserView({model: TS.user}); + TS.user.view.render(); - // create the timeline list view - new TS.TimelineListView({collection: TS.timelineList}); - TS.timelineList.fetch(); - - // load the current timeline - TS.currentTimeline = TS.timelineList.at(0); - - // create the timeline view - new TS.TimelineView({model: TS.currentTimeline}); - - // render the timeline view - TS.currentTimeline.view.render(); - - // load the entries for this timeline - TS.entryList = new TS.EntryList([], {timeline: TS.currentTimeline}); - - // create the new entry list view - new TS.EntryListView }}); }