added some commments
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
note
|
||||
description: "Request handler related to /blogs/user/{id}/. Displays all posts of the given user"
|
||||
description: "Request handler related to /blogs/user/{id}/ or /blogs/user/{id}/page/{page}. Displays all posts of the given user"
|
||||
author: "Dario B<>sch <daboesch@student.ethz.ch>"
|
||||
date: "$Date: 2015-05-22 15:13:00 +0100 (lun., 18 mai 2015) $"
|
||||
revision: "$Revision 96616$"
|
||||
@@ -35,9 +35,10 @@ feature -- HTTP Methods
|
||||
-- Check if userID valid
|
||||
if user_valid (req) then
|
||||
user := load_user(req)
|
||||
-- Output the results, similar as in the blog hanlder (but with other queries)
|
||||
precursor(req, res)
|
||||
else
|
||||
-- Throw a bad request error if the user is not valid
|
||||
-- Throw a bad request error because the user is not valid
|
||||
create l_error.make (req, res, api)
|
||||
l_error.set_main_content ("<h1>Error</h1>User with id " + user_path_parameter(req).out + " doesn't exist!")
|
||||
l_error.execute
|
||||
@@ -88,7 +89,7 @@ feature -- Query
|
||||
end
|
||||
|
||||
posts : LIST[CMS_NODE]
|
||||
-- The posts to list on the given page
|
||||
-- The posts to list on the given page. Filters out the posts of the current user
|
||||
do
|
||||
if attached user as l_user then
|
||||
Result := node_api.blogs_from_user_order_created_desc_limited (l_user.id.to_integer_32, entries_per_page, (page_number-1) * entries_per_page)
|
||||
@@ -98,7 +99,7 @@ feature -- Query
|
||||
end
|
||||
|
||||
total_entries : NATURAL_32
|
||||
-- Returns the number of total entries/posts
|
||||
-- Returns the number of total entries/posts of the current user
|
||||
do
|
||||
if attached user as l_user then
|
||||
Result := node_api.blogs_count_from_user(l_user.id).to_natural_32
|
||||
@@ -111,7 +112,7 @@ feature -- Query
|
||||
feature -- HTML Output
|
||||
|
||||
page_title_html : STRING
|
||||
-- Returns the title of the page as a html string. It shows the current page number
|
||||
-- Returns the title of the page as a html string. It shows the current page number and the name of the current user
|
||||
do
|
||||
create Result.make_from_string ("<h2>Posts from ")
|
||||
if attached user as l_user then
|
||||
@@ -127,7 +128,7 @@ feature -- HTML Output
|
||||
end
|
||||
|
||||
base_path : STRING
|
||||
-- the path to the page that lists all blogs
|
||||
-- the path to the page that lists all blogs. It must include the user id
|
||||
do
|
||||
if attached user as l_user then
|
||||
Result := "/blogs/user/" + l_user.id.out
|
||||
|
||||
Reference in New Issue
Block a user