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:
@ -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 ======== %
|
||||
|
Reference in New Issue
Block a user