Commit 38213fecf97fea82664c9621bc7e0c21c926a776
1 parent
62c1d338
Exists in
master
and in
1 other branch
Adding ranking block
Showing
3 changed files
with
40 additions
and
0 deletions
Show diff stats
lib/gamification_plugin.rb
| @@ -53,6 +53,12 @@ class GamificationPlugin < Noosfero::Plugin | @@ -53,6 +53,12 @@ class GamificationPlugin < Noosfero::Plugin | ||
| 53 | ['jquery.noty.packaged.min.js', 'jquery.easypiechart.min.js', 'main.js'] | 53 | ['jquery.noty.packaged.min.js', 'jquery.easypiechart.min.js', 'main.js'] |
| 54 | end | 54 | end |
| 55 | 55 | ||
| 56 | + | ||
| 57 | + def self.extra_blocks | ||
| 58 | + { GamificationPlugin::RankingBlock => {}} | ||
| 59 | + end | ||
| 60 | + | ||
| 61 | + | ||
| 56 | ActionDispatch::Reloader.to_prepare do | 62 | ActionDispatch::Reloader.to_prepare do |
| 57 | Merit.setup do |config| | 63 | Merit.setup do |config| |
| 58 | config.checks_on_each_request = false | 64 | config.checks_on_each_request = false |
| @@ -0,0 +1,28 @@ | @@ -0,0 +1,28 @@ | ||
| 1 | +class GamificationPlugin::RankingBlock < Block | ||
| 2 | + | ||
| 3 | + settings_items :limit, :type => :integer, :default => 5 | ||
| 4 | + | ||
| 5 | + def self.description | ||
| 6 | + _('Gamification Ranking') | ||
| 7 | + end | ||
| 8 | + | ||
| 9 | + def help | ||
| 10 | + _('This block display te gamification rank.') | ||
| 11 | + end | ||
| 12 | + | ||
| 13 | + def self.pretty_name | ||
| 14 | + _('Gamification Ranking') | ||
| 15 | + end | ||
| 16 | + | ||
| 17 | + def embedable? | ||
| 18 | + true | ||
| 19 | + end | ||
| 20 | + | ||
| 21 | + def content(args={}) | ||
| 22 | + block = self | ||
| 23 | + proc do | ||
| 24 | + render :file => 'blocks/ranking', :locals => {:block => block} | ||
| 25 | + end | ||
| 26 | + end | ||
| 27 | + | ||
| 28 | +end |