Commit e7eecf9f4afa67e1fe3e1bc6b34f002387c851e4

Authored by Thiago Ribeiro
Committed by Fabio Teixeira
1 parent 5c1eb238

Autocomplete for isntitution in software ratings.

Signed-off-by: Thiago Ribeiro <thiagitosouza@hotmail.com>
Signed-off-by: Fabio Teixeira <fabio1079@gmail.com>
lib/gov_user_plugin.rb
... ... @@ -153,6 +153,7 @@ class GovUserPlugin &lt; Noosfero::Plugin
153 153 views/create-institution.js
154 154 views/new-community.js
155 155 views/user-edit-profile.js
  156 + views/gov-user-comments-extra-fields.js
156 157 initializer.js
157 158 app.js
158 159 )
... ... @@ -232,6 +233,10 @@ class GovUserPlugin &lt; Noosfero::Plugin
232 233 end
233 234 end
234 235  
  236 + def communities_ratings_plugin_comments_extra_fields
  237 + Proc::new do render :file => 'comments_extra_field' end
  238 + end
  239 +
235 240 private
236 241  
237 242 def call_model_transaction(model,name)
... ...
public/initializer.js
... ... @@ -6,7 +6,8 @@
6 6 'CreateInstitution',
7 7 'CompleteRegistration',
8 8 'UserEditProfile',
9   - 'NewCommunity'
  9 + 'NewCommunity',
  10 + 'GovUserCommentsExtraFields'
10 11 ];
11 12  
12 13  
... ...
public/views/create-institution.js
... ... @@ -398,6 +398,10 @@ modulejs.define(&#39;CreateInstitution&#39;, [&#39;jquery&#39;, &#39;NoosferoRoot&#39;, &#39;SelectElement&#39;]
398 398 init: function() {
399 399 set_form_count_custom_data();
400 400 set_events();
  401 + },
  402 +
  403 + institution_autocomplete: function(){
  404 + institution_autocomplete();
401 405 }
402 406 }
403 407 });
... ...
public/views/gov-user-comments-extra-fields.js 0 → 100644
... ... @@ -0,0 +1,27 @@
  1 +modulejs.define("GovUserCommentsExtraFields", ['jquery','CreateInstitution'], function($,CreateInstitution) {
  2 +
  3 + function set_events() {
  4 + CreateInstitution.institution_autocomplete();
  5 + }
  6 +
  7 +
  8 + function prepend_to_aditional_information() {
  9 + var aditional_information = $(".comments-software-extra-fields");
  10 + var institution_comments = $("#input_institution_comments");
  11 +
  12 + aditional_information.prepend(institution_comments.remove());
  13 + }
  14 +
  15 +
  16 + return {
  17 + isCurrentPage: function() {
  18 + return $(".star-rate-form").length === 1;
  19 + },
  20 +
  21 + init: function() {
  22 + prepend_to_aditional_information();
  23 + set_events();
  24 + }
  25 + }
  26 +
  27 +})
... ...
views/comments_extra_field.html.erb 0 → 100644
... ... @@ -0,0 +1,7 @@
  1 +<div id="input_institution_comments">
  2 + <%= label_tag "input_institution", _("Organiztion name or Enterprise name")%>
  3 + <%= text_field_tag "comments[instituton_name]", "", id: "input_institution" %>
  4 + <%= content_tag(:div, _("No institution found"),
  5 + :id=>"institution_empty_ajax_message",
  6 + :class=>"errorExplanation hide-field") %>
  7 +</div>
... ...