Sha256: 655c4ebe9a696738ba32f5dbadf985b5f3e23dab443865faab6ee49319023599

Contents?: true

Size: 931 Bytes

Versions: 2

Compression:

Stored size: 931 Bytes

Contents

# = Methods for the Articles part.
#
#--
# code:
# George Moschovitis  <gm@navel.gr>
#
# (c) 2004 Navel, all rights reserved.
# $Id: methods.rb 84 2004-10-19 13:57:01Z gmosx $
#++

module P

module ArticlesMethods

	# Add an article
	#
	def add_article(request)
		if request.delete("add_article")
			article = N::Article.new
			request.update_entity(article)
			$db << article
			request.redirect("index.sx")
		end
	end
	
	# Delete an article
	#
	def del_article(request)
		if oid = request.delete("del_article_oid")
			$db.delete(oid.to_i, N::Article)
		end
	end

	# Add a comment
	#
	def add_comment(request)
		if pid = request.delete("add_comment_pid")
			comment = N::Comment.new
			comment.pid = pid
			request.update_entity(comment)
			$db << comment
		end
	end
	
	# Delete a comment
	#
	def del_comment(request)
		if oid = request.delete("del_comment_oid")
			$db.delete(oid.to_i, N::Comment)
		end
	end
	
end

end # module

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
nitro-0.1.2 examples/simple/lib/articles/methods.rb
nitro-0.2.0 examples/simple/lib/articles/methods.rb