Skip to content

Commit

Permalink
date object created in wiki.putAction
Browse files Browse the repository at this point in the history
  • Loading branch information
hallahan committed Apr 18, 2012
1 parent 6130f05 commit e08ff56
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
5 changes: 3 additions & 2 deletions client/lib/legacy.coffee
Expand Up @@ -92,6 +92,7 @@ $ ->
$(".login").length > 0

putAction = wiki.putAction = (pageElement, action) ->
action.date = (new Date()).getTime()
if (site = pageElement.data('site'))?
action.fork = site
pageElement.find('h1 img').attr('src', '/favicon.png')
Expand Down Expand Up @@ -136,9 +137,9 @@ $ ->
if item.text = textarea.val()
plugin.do div.empty(), item
return if item.text == original
putAction div.parents('.page:first'), {type: 'edit', id: item.id, item: item, date: (new Date()).getTime()}
putAction div.parents('.page:first'), {type: 'edit', id: item.id, item: item}
else
putAction div.parents('.page:first'), {type: 'remove', id: item.id, date: (new Date()).getTime()}
putAction div.parents('.page:first'), {type: 'remove', id: item.id}
div.remove()
null
.bind 'keydown', (e) ->
Expand Down
8 changes: 4 additions & 4 deletions client/lib/refresh.coffee
Expand Up @@ -18,14 +18,14 @@ handleDragging = (evt, ui) ->

action = if moveWithinPage
order = $(this).children().map((_, value) -> $(value).attr('data-id')).get()
{type: 'move', order: order, date: (new Date()).getTime()}
{type: 'move', order: order}
else if moveFromPage
{type: 'remove', date: (new Date()).getTime()}
{type: 'remove'}
else if moveToPage
itemElement.data 'pageElement', thisPageElement
beforeElement = itemElement.prev('.item')
before = wiki.getItem(beforeElement)
{type: 'add', item: item, after: before?.id, date: (new Date()).getTime()}
{type: 'add', item: item, after: before?.id}
action.id = item.id
wiki.putAction thisPageElement, action

Expand All @@ -47,7 +47,7 @@ initAddButton = (pageElement) ->
plugin.do itemElement, item
beforeElement = itemElement.prev('.item')
before = wiki.getItem(beforeElement)
wiki.putAction pageElement, {item: item, id: item.id, type: "add", after: before?.id, date: (new Date()).getTime()}
wiki.putAction pageElement, {item: item, id: item.id, type: "add", after: before?.id}

emitHeader = (pageElement, page) ->
site = $(pageElement).data('site')
Expand Down

0 comments on commit e08ff56

Please sign in to comment.