Configuration File added
Created CMS_BLOG_CONFIG at moved the feature entries_per_page to this new class. The blog hander inherits from the config class
This commit is contained in:
21
examples/demo/modules/blog/cms_blog_config.e
Normal file
21
examples/demo/modules/blog/cms_blog_config.e
Normal file
@@ -0,0 +1,21 @@
|
||||
note
|
||||
description: "Configuration class for the blog module."
|
||||
author: "Dario B<>sch <daboesch@student.ethz.ch"
|
||||
date: "$Date: 2015-05-22 11:26:00 +0100$"
|
||||
revision: "$Revision: 96616 $"
|
||||
|
||||
class
|
||||
CMS_BLOG_CONFIG
|
||||
|
||||
|
||||
feature {BLOG_HANDLER}-- Configuration of blog handler
|
||||
|
||||
entries_per_page : INTEGER
|
||||
-- The numbers of posts that are shown on one page. If there are more post a pagination is generated
|
||||
do
|
||||
-- For test reasons this is 2, so we don't have to create a lot of blog entries.
|
||||
-- TODO: Set to bigger constant.
|
||||
Result := 2
|
||||
end
|
||||
|
||||
end
|
||||
@@ -8,6 +8,8 @@ class
|
||||
BLOG_HANDLER
|
||||
|
||||
inherit
|
||||
CMS_BLOG_CONFIG
|
||||
|
||||
CMS_BLOG_HANDLER
|
||||
|
||||
WSF_URI_HANDLER
|
||||
@@ -54,20 +56,6 @@ feature -- execute
|
||||
execute (req, res)
|
||||
end
|
||||
|
||||
feature -- Settings
|
||||
entries_per_page : INTEGER
|
||||
-- The numbers of posts that are shown on one page. If there are more post a pagination is generated
|
||||
do
|
||||
-- For test reasons this is 2, so we don't have to create a lot of blog entries.
|
||||
-- TODO: Set to bigger constant or load from global configuration file.
|
||||
Result := 2
|
||||
end
|
||||
|
||||
more_than_one_page : BOOLEAN
|
||||
-- Checks if all posts fit on one page (FALSE) or if more than one page is needed (TRUE)
|
||||
do
|
||||
Result := entries_per_page < node_api.blogs_count
|
||||
end
|
||||
|
||||
feature -- HTTP Methods
|
||||
do_get (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
@@ -163,6 +151,12 @@ feature -- HTTP Methods
|
||||
|
||||
feature -- Query
|
||||
|
||||
more_than_one_page : BOOLEAN
|
||||
-- Checks if all posts fit on one page (FALSE) or if more than one page is needed (TRUE)
|
||||
do
|
||||
Result := entries_per_page < node_api.blogs_count
|
||||
end
|
||||
|
||||
page_number_path_parameter (req: WSF_REQUEST): NATURAL_16
|
||||
-- Returns the page number from the path /blogs/{page}. It's an unsigned integere since negative pages are not allowed
|
||||
local
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
note
|
||||
description: "Summary description for {CMS_BLOG_STORAGE_SQL}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
description: "Access to the sql database for the blog module"
|
||||
author: "Dario B<>sch <daboesch@student.ethz.ch>"
|
||||
date: "$Date: 2015-05-21 14:46:00 +0100$"
|
||||
revision: "$Revision: 96616 $"
|
||||
|
||||
class
|
||||
CMS_BLOG_STORAGE_SQL
|
||||
|
||||
Reference in New Issue
Block a user