Commit c12f8abdb8076feeb85a073c64f8d50dd022dddc
1 parent
b5a544e6
Exists in
master
and in
1 other branch
Add title to badge
Showing
6 changed files
with
15 additions
and
5 deletions
Show diff stats
db/migrate/20150330102818_create_badges.rb
@@ -3,6 +3,7 @@ class CreateBadges < ActiveRecord::Migration | @@ -3,6 +3,7 @@ class CreateBadges < ActiveRecord::Migration | ||
3 | create_table :gamification_plugin_badges do |t| | 3 | create_table :gamification_plugin_badges do |t| |
4 | t.string :name | 4 | t.string :name |
5 | t.integer :level | 5 | t.integer :level |
6 | + t.string :title | ||
6 | t.string :description | 7 | t.string :description |
7 | t.string :custom_fields | 8 | t.string :custom_fields |
8 | t.references :owner, :polymorphic => true | 9 | t.references :owner, :polymorphic => true |
lib/gamification_plugin/badge.rb
@@ -4,7 +4,7 @@ class GamificationPlugin::Badge < Noosfero::Plugin::ActiveRecord | @@ -4,7 +4,7 @@ class GamificationPlugin::Badge < Noosfero::Plugin::ActiveRecord | ||
4 | 4 | ||
5 | has_many :badges_sash, :class_name => 'Merit::BadgesSash' | 5 | has_many :badges_sash, :class_name => 'Merit::BadgesSash' |
6 | 6 | ||
7 | - attr_accessible :owner, :name, :description, :level, :custom_fields | 7 | + attr_accessible :owner, :name, :description, :level, :custom_fields, :title |
8 | 8 | ||
9 | serialize :custom_fields | 9 | serialize :custom_fields |
10 | 10 |
views/gamification/dashboard.html.erb
@@ -38,9 +38,9 @@ | @@ -38,9 +38,9 @@ | ||
38 | <ul class="badge-list"> | 38 | <ul class="badge-list"> |
39 | <% environment.gamification_plugin_badges.each do |badge| %> | 39 | <% environment.gamification_plugin_badges.each do |badge| %> |
40 | <li class="badge <%= badge.name %> <%= @target.badges.include?(badge) ? 'earned' : 'not-earned' %>"> | 40 | <li class="badge <%= badge.name %> <%= @target.badges.include?(badge) ? 'earned' : 'not-earned' %>"> |
41 | - <div class="badge"> | 41 | + <div class="badge" title="<%= badge.description %>"> |
42 | <div class="image <%= badge.name %>"></div> | 42 | <div class="image <%= badge.name %>"></div> |
43 | - <div class="description"><%= badge.description %></div> | 43 | + <div class="title"><%= badge.title %></div> |
44 | <div class="level"><%= _('Level %s' % badge.level) %></div> | 44 | <div class="level"><%= _('Level %s' % badge.level) %></div> |
45 | </div> | 45 | </div> |
46 | </li> | 46 | </li> |
views/gamification_plugin_badges/_form.html.erb
@@ -16,6 +16,10 @@ | @@ -16,6 +16,10 @@ | ||
16 | <%= f.select :name, Merit::BadgeRules::AVAILABLE_RULES.map{ |key, rule| key } %> | 16 | <%= f.select :name, Merit::BadgeRules::AVAILABLE_RULES.map{ |key, rule| key } %> |
17 | </div> | 17 | </div> |
18 | <div class="field"> | 18 | <div class="field"> |
19 | + <%= f.label :title %><br /> | ||
20 | + <%= f.text_field :title %> | ||
21 | + </div> | ||
22 | + <div class="field"> | ||
19 | <%= f.label :description %><br /> | 23 | <%= f.label :description %><br /> |
20 | <%= f.text_field :description %> | 24 | <%= f.text_field :description %> |
21 | </div> | 25 | </div> |
views/gamification_plugin_badges/index.html.erb
@@ -3,7 +3,7 @@ | @@ -3,7 +3,7 @@ | ||
3 | <table> | 3 | <table> |
4 | <tr> | 4 | <tr> |
5 | <th>Name</th> | 5 | <th>Name</th> |
6 | - <th>Description</th> | 6 | + <th>Title</th> |
7 | <th>Level</th> | 7 | <th>Level</th> |
8 | <th>Threshold</th> | 8 | <th>Threshold</th> |
9 | <th></th> | 9 | <th></th> |
@@ -14,7 +14,7 @@ | @@ -14,7 +14,7 @@ | ||
14 | <% @gamification_plugin_badges.each do |gamification_plugin_badge| %> | 14 | <% @gamification_plugin_badges.each do |gamification_plugin_badge| %> |
15 | <tr> | 15 | <tr> |
16 | <td><%= gamification_plugin_badge.name %></td> | 16 | <td><%= gamification_plugin_badge.name %></td> |
17 | - <td><%= gamification_plugin_badge.description %></td> | 17 | + <td><%= gamification_plugin_badge.title %></td> |
18 | <td><%= gamification_plugin_badge.level %></td> | 18 | <td><%= gamification_plugin_badge.level %></td> |
19 | <td><%= gamification_plugin_badge.threshold %></td> | 19 | <td><%= gamification_plugin_badge.threshold %></td> |
20 | <td><%= link_to 'Show', :action => :show, :id => gamification_plugin_badge.id %></td> | 20 | <td><%= link_to 'Show', :action => :show, :id => gamification_plugin_badge.id %></td> |
views/gamification_plugin_badges/show.html.erb
@@ -8,6 +8,11 @@ | @@ -8,6 +8,11 @@ | ||
8 | </p> | 8 | </p> |
9 | 9 | ||
10 | <p> | 10 | <p> |
11 | + <b>Title:</b> | ||
12 | + <%= @gamification_plugin_badge.title %> | ||
13 | +</p> | ||
14 | + | ||
15 | +<p> | ||
11 | <b>Description:</b> | 16 | <b>Description:</b> |
12 | <%= @gamification_plugin_badge.description %> | 17 | <%= @gamification_plugin_badge.description %> |
13 | </p> | 18 | </p> |