[Git][noosfero/noosfero][master] 2 commits: plugin-hotspot: dinamic hotspot for models callbacks
Rodrigo Souto
gitlab at mg.gitlab.com
Tue Mar 22 14:47:03 BRT 2016
Rodrigo Souto pushed to branch master at Noosfero / noosfero
Commits:
3ca0b153 by Rodrigo Souto at 2016-03-21T13:11:26-03:00
plugin-hotspot: dinamic hotspot for models callbacks
With this, every model that includes Noosfero::Plugin::HotSpot will
provide callbacks hotspots for plugins to answer. The current callbacks
included are {after,before}_{create,destroy,save}.
So if a plugin wants to do something on a comment after_save, it should
define a hotspot somewhat like this:
def comment_after_save_callback(comment)
<code-goes-here>
end
Obviously, the callback provides the object in context as parameter.
This will replace the problematic common practice of creating a
lib/ext/my_model.rb and injecting the callbacks inside the class which
bypass the enabled plugins logic.
Signed-off-by: Rodrigo Souto <rodrigo at colivre.coop.br>
Signed-off-by: Marcos Ronaldo <marcos.rpj2 at gmail.com>
- - - - -
068f8f46 by Rodrigo Souto at 2016-03-22T17:46:05+00:00
Merge branch 'dynamic-callbacks' into 'master'
plugin-hotspot: dinamic hotspot for models callbacks
With this, every model that includes Noosfero::Plugin::HotSpot will
provide callbacks hotspots for plugins to answer. The current callbacks
included are {after,before}_{create,destroy,save}.
So if a plugin wants to do something on a comment after_save, it should
define a hotspot somewhat like this:
def comment_after_save_callback(comment)
<code-goes-here>
end
Obviously, the callback provides the object in context as parameter.
This will replace the problematic common practice of creating a
lib/ext/my_model.rb and injecting the callbacks inside the class which
bypass the enabled plugins logic.
Signed-off-by: Rodrigo Souto <rodrigo at colivre.coop.br>
Signed-off-by: Marcos Ronaldo <marcos.rpj2 at gmail.com>
See merge request !810
- - - - -
5 changed files:
- lib/noosfero/plugin.rb
- lib/noosfero/plugin/hot_spot.rb
- lib/noosfero/plugin/manager.rb
- test/unit/plugin_hot_spot_test.rb
- vendor/plugins/action_tracker/lib/action_tracker_model.rb
Changes:
=====================================
lib/noosfero/plugin.rb
=====================================
#<Gitlab::Git::Diff:0x007f4c946aa288>
=====================================
lib/noosfero/plugin/hot_spot.rb
=====================================
#<Gitlab::Git::Diff:0x007f4c946a9d88>
=====================================
lib/noosfero/plugin/manager.rb
=====================================
#<Gitlab::Git::Diff:0x007f4c946a9888>
=====================================
test/unit/plugin_hot_spot_test.rb
=====================================
#<Gitlab::Git::Diff:0x007f4c946a9388>
=====================================
vendor/plugins/action_tracker/lib/action_tracker_model.rb
=====================================
#<Gitlab::Git::Diff:0x007f4c946a8e88>
View it on GitLab: https://gitlab.com/noosfero/noosfero/compare/dd7e39a5dc2541c35f0477d89cab76961f1d8efc...068f8f46bed55116269265d295b46af64afedd1d
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listas.softwarelivre.org/pipermail/noosfero-dev/attachments/20160322/3ef08ce3/attachment-0001.html>
More information about the Noosfero-dev
mailing list