cbrain
cbrain copied to clipboard
Replace control and action checks in page view code with page_is?()
In commit https://github.com/aces/cbrain/commit/6030bf1b8bc2f02c56299b6c6b8727867a4ecb0c I added two new
helper methods, page_is?()
and page_is_not?()
. See their description for more info.
I have used these helpers in one layout page (see them in the same commit), but now we should go through the rest of the interface code and search for code that say things like
if params[:controller] == "contname"
if params[:action] == "actname"
if params[:controller] == "contname" && params[:action] == "actname"
and replace them by (respectively)
if page_is?("contname")
if page_is?("#actname")
if page_is?("contname#actname")
Since sometimes the pages are checking that a page is NOT a particular controller and action, there is also the method page_is_not?()
, which is the equivalent of ! page_is()
.