Merge Request #7

Merged
softwarepublico/mpog_software!7
Created by Thiago Ribeiro

R4 add portal suggest values in software statistics block

Assignee: Thiago Ribeiro
Milestone: None

Merged by Thiago Ribeiro

Source branch has been removed
Commits (6)
1 participants
db/migrate/20150814185902_add_people_benefited_and_saved_value_to_create_community_rating.rb 0 → 100644
@@ -0,0 +1,11 @@ @@ -0,0 +1,11 @@
  1 +class AddPeopleBenefitedAndSavedValueToCreateCommunityRating < ActiveRecord::Migration
  2 + def up
  3 + add_column :community_ratings, :people_benefited, :integer
  4 + add_column :community_ratings, :saved_value, :decimal
  5 + end
  6 +
  7 + def down
  8 + remove_column :community_ratings, :people_benefited
  9 + remove_column :community_ratings, :saved_value
  10 + end
  11 +end
lib/ext/community_rating.rb 0 → 100644
@@ -0,0 +1,5 @@ @@ -0,0 +1,5 @@
  1 +require_dependency "community_rating"
  2 +
  3 +class CommunityRating
  4 + attr_accessible :people_benefited, :saved_value
  5 +end
views/box_organizer/_statistic_block.html.erb
1 <div id='edit-softwares-block'> 1 <div id='edit-softwares-block'>
  2 + <% suggestion_benefited_people = @block.owner.community_ratings.collect{|community_rating| community_rating.people_benefited.to_f}.inject(:+) || 0.0 %>
  3 + <% suggestion_saved_resources = @block.owner.community_ratings.collect{|community_rating| community_rating.saved_value.to_f}.inject(:+) || 0.0 %>
  4 +
2 <%= labelled_form_field _('Benefited People'), text_field(:block, :benefited_people) %> 5 <%= labelled_form_field _('Benefited People'), text_field(:block, :benefited_people) %>
  6 + <p> <%= _("Portal suggested value: ") %> <span> <%= "%d" % (suggestion_benefited_people) %> <span> </p>
3 <%= labelled_form_field _('Saved Resources'), text_field(:block, :saved_resources) %> 7 <%= labelled_form_field _('Saved Resources'), text_field(:block, :saved_resources) %>
  8 + <p> <%= _("Portal suggested value: ") %> <span> <%= "R$%.2f" % (suggestion_saved_resources) %> <span> </p>
4 </div> 9 </div>
5 10
views/comments_extra_fields.html.erb
@@ -10,12 +10,12 @@ @@ -10,12 +10,12 @@
10 <div class="comments-software-people-benefited"> 10 <div class="comments-software-people-benefited">
11 <%= label_tag "comments_people_benefited", _("Number of Beneficiaries")%> 11 <%= label_tag "comments_people_benefited", _("Number of Beneficiaries")%>
12 <span class="star-tooltip" title="Quantidade de pessoas beneficiadas com a utilização do software"></span> 12 <span class="star-tooltip" title="Quantidade de pessoas beneficiadas com a utilização do software"></span>
13 - <%= text_field_tag "comments[people_benefited]", "" %> 13 + <%= text_field_tag "community_rating[people_benefited]", "" %>
14 </div> 14 </div>
15 15
16 <div class="comments-software-saved-values"> 16 <div class="comments-software-saved-values">
17 <%= label_tag "comments_saved_value", _("Saved resources")%> 17 <%= label_tag "comments_saved_value", _("Saved resources")%>
18 <span class="star-tooltip" title="Valores em “Real” economizados com a utilização do software"></span> 18 <span class="star-tooltip" title="Valores em “Real” economizados com a utilização do software"></span>
19 - <%= text_field_tag "comments[saved_value]", "", :placeholder=>"R$"%> 19 + <%= text_field_tag "community_rating[saved_value]", "", :placeholder=>"R$"%>
20 </div> 20 </div>
21 </div> 21 </div>
views/communities_ratings_extra_fields_show_data.html.erb
1 <div class="aditional-informations"> 1 <div class="aditional-informations">
2 <div class="comments-people-benefited"> 2 <div class="comments-people-benefited">
3 - <span>People benefited :</span> <%= user_rating.comment.people_benefited unless user_rating.comment.nil? %> 3 + <span>People benefited :</span> <%= user_rating.people_benefited unless user_rating.nil? %>
4 </div> 4 </div>
5 5
6 <div class="comments-saved-value"> 6 <div class="comments-saved-value">
7 - <span>Saved Value :</span> <%= user_rating.comment.saved_value unless user_rating.comment.nil? %> 7 + <span>Saved Value :</span> <%= user_rating.saved_value unless user_rating.nil? %>
8 </div> 8 </div>
9 </div> 9 </div>
10 10
views/search/_software_search_form.html.erb
@@ -12,10 +12,12 @@ @@ -12,10 +12,12 @@
12 <%= hidden_field_tag :filter, params[:filter] %> 12 <%= hidden_field_tag :filter, params[:filter] %>
13 13
14 <%= labelled_radio_button _('Public Software'), :software_type, 'public_software', @public_software_selected, :id => "public_software_radio_button", :class => "project-software" %> 14 <%= labelled_radio_button _('Public Software'), :software_type, 'public_software', @public_software_selected, :id => "public_software_radio_button", :class => "project-software" %>
15 - <span class="doubts-catalog-software" title="<%= _('Public Software.') %>">?</span> 15 + <span class="doubts-catalog-software" title="<%= _('Projects that have passed by the Avalia SPB process according to the requirements of IN 01/2011.') %>">?</span>
  16 + <!-- Projetos que passaram pelo processo do Avalia SPB de acordo com os requisitos da IN 01/2011. -->
16 17
17 <%= labelled_radio_button _('All'), :software_type, 'all', @all_selected, :id => "all_radio_button", :class => "project-software" %> 18 <%= labelled_radio_button _('All'), :software_type, 'all', @all_selected, :id => "all_radio_button", :class => "project-software" %>
18 - <span class="doubts-catalog-software" title="<%= _('All.') %>">?</span> 19 + <span class="doubts-catalog-software" title="<%= _('Projects included in the portal as cases provided by the IN 01/2011.') %>">?</span>
  20 + <!-- Projetos incluídos no portal, conforme casos previstos na IN 01/2011. -->
19 21
20 <div class="search-field"> 22 <div class="search-field">
21 <span class="formfield"> 23 <span class="formfield">