[katello-devel] Katello Notices - UI changes to enable generation from controller or delayed job
Brad Buckingham
bbuckingham at redhat.com
Thu Jan 5 14:39:17 UTC 2012
Team,
I just pushed a commit to the 'notices' logic that folks should be aware
of. Prior to the commit, the notices were included as part of the
application controller. As a result, they were only accessible to
controller actions. While that is 'nice', it didn't allow us to
generate notices from delayed (asynchronous) jobs. For example, we
couldn't use notices to display error messages resulting from a failed
promotion.
In order to address this, I moved the notices logic to a generic module
(lib/utils/notices.rb). This module has been included in the
application controller making it available to all controllers that
inherit from it. It can also be included where needed to support
delayed jobs. For example, in the case of promotions, we now include it
as part of the changeset model.
With this change comes one additional change that developers need to be
aware of. In order to enable notices to be included within a model, I
removed the 'errors' method which we used in the controllers to generate
an error notice, but is a name conflict for ActiveRecord. The
following is an example of the impact to the code:
Before the commit:
errors error_text
After the commit:
notice error_text, {:level => :error}
Since this commit touches all of the 'error' notices, please let me know
if you encounter any problems.
Commit:
http://git.fedorahosted.org/git/?p=katello.git;a=commit;h=61dbb74c6c47832fb6d91b8b71cede682b2f1c94
Thanks,
Brad
More information about the katello-devel
mailing list