Skip to content
This repository has been archived by the owner on Jan 25, 2019. It is now read-only.

Blog demo updated #3

Closed
wants to merge 4 commits into from
Closed

Blog demo updated #3

wants to merge 4 commits into from

Conversation

leledumbo
Copy link
Collaborator

I updated the blog demo to include edit and remove functionality, feel free if you want to include in the main distribution. Please analyze my changes, have I done it right?

@silvioprog
Copy link
Owner

Very nice update, thank you.
Can I refactore your code before apply it in official demo? This update will be applied in online demo too.

@leledumbo
Copy link
Collaborator Author

Sure, I've realized also that the code is not very good when I write a post in my blog. I should've created one path registration per action, so I don't need to use ?action=blablabla thing

@silvioprog
Copy link
Owner

Can you made a new implementation using a register by action? That would be even better, because it would be using REST instead query_string (ie, routing instead ?action=blablabla).

@leledumbo
Copy link
Collaborator Author

OK, please wait

@leledumbo leledumbo closed this Jan 1, 2013
@silvioprog
Copy link
Owner

So, can I refactore and merge your changes (https://github.com/leledumbo/brookframework/commit/cd94690eb9416a35c0da7bcfd8d58bb8c054cb9f) to the official demo?

@leledumbo
Copy link
Collaborator Author

Yes, please do

silvioprog added a commit that referenced this pull request Jan 2, 2013
@silvioprog
Copy link
Owner

Done (724fabb).
I made very few changes just to let the code more generic.
Thank you very much, now I'll recompile the online demo! :)

@silvioprog
Copy link
Owner

The online demo was updated:

http://brookframework.org/demos/db/blog/blog.bf

@silvioprog
Copy link
Owner

A question...

In:

procedure TPostRemove.Get;
var
  ID: TJSONStringType;
  Row: TBrookTable;
begin
  ID := Values['id'].AsString;
  Row := Table.Get('id', ID);
  if not Row.EOF then
    Row.Delete.Apply;
  Redirect(UrlFor(THome), BROOK_HTTP_STATUS_CODE_FOUND);
end; 

You can use this:

procedure TPostRemove.Get;
begin
  Table.Find(Values).Delete.Apply;
  Redirect(UrlFor(THome), BROOK_HTTP_STATUS_CODE_FOUND);
end; 

What do you think? :)

@leledumbo
Copy link
Collaborator Author

If that's safe, OK. I just do the checking for safety.

@silvioprog
Copy link
Owner

That's safe. 👍

silvioprog added a commit that referenced this pull request Jan 2, 2013
@silvioprog
Copy link
Owner

Done (9e0d7eb).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants