Implemented edit and update for entries.

- Added ts_entry:delete/1 to delete an entry from the database.
- Implemented ts_api:delete_entry/3.
- Added a form to facilitate editing individual entries.
- Moved the small show/hide functions directly into the HTML.
- Wired up the update timeline form.
- Wired up the edit and update entry form.
This commit is contained in:
Jonathan Bernard
2011-03-08 18:02:33 -06:00
parent 1b1e31059b
commit 39c3b83d3f
12 changed files with 150 additions and 47 deletions

View File

@ -482,7 +482,22 @@ post_entry(YArg, Username, TimelineId, EntryId) ->
_Error -> make_json_500(YArg)
end.
delete_entry(_YArg, _Username, _TimelineId, _EntryId) -> todo.
delete_entry(YArg, Username, TimelineId, EntryId) ->
% find the record to delete
case ts_entry:lookup(Username, TimelineId, EntryId) of
Record ->
% try to delete
case ts_entry:delete(Record) of
ok -> {status, 200};
Error ->
io:format("Error occurred deleting entry record: ~p", [Error]),
make_json_500(YArg)
end;
no_record -> make_json_404(YArg)
end.
% ============================== %
% ======== UTIL METHODS ======== %