Commit 008c7b1fced9d3b8cdccf87f28b0168f70a931fd

Authored by Gabriela Navarro
1 parent 53dc9a7b

software_search: New template to search community, software and institution

Signed-off-by: Gabriela Navarro <navarro1703@gmail.com>
Signed-off-by: Parley Martins <parley@outlook.com>
lib/mpog_software_plugin.rb
... ... @@ -134,7 +134,7 @@ class MpogSoftwarePlugin &lt; Noosfero::Plugin
134 134 end
135 135  
136 136 def js_files
137   - ["mpog-software-validations.js", "mpog-user-validations.js", "mpog-institution-validations.js", "mpog-incomplete-registration.js"]
  137 + ["mpog-software-validations.js", "mpog-user-validations.js", "mpog-institution-validations.js", "mpog-incomplete-registration.js", "mpog-search.js"]
138 138 end
139 139  
140 140 def add_new_organization_button
... ... @@ -325,8 +325,12 @@ class MpogSoftwarePlugin &lt; Noosfero::Plugin
325 325 end
326 326 end
327 327  
328   - def add_new_user_search_filter
329   - expanded_template('user_search/search_filter.html.erb')
  328 + def add_new_search_filter type
  329 + if type == "People"
  330 + expanded_template('search/search_user_filter.html.erb')
  331 + else type == "Community"
  332 + expanded_template('search/search_community_filter.html.erb')
  333 + end
330 334 end
331 335  
332 336 def custom_people_search params
... ...
public/mpog-search.js 0 → 100644
... ... @@ -0,0 +1,32 @@
  1 +(function(){
  2 +
  3 + function show_institutions_fields() {
  4 + jQuery(".institution_fields").show();
  5 + jQuery(".software_fields").hide();
  6 + jQuery(".community_fields").hide();
  7 + }
  8 +
  9 + function show_software_fields() {
  10 + jQuery(".institution_fields").hide();
  11 + jQuery(".software_fields").show();
  12 + jQuery(".community_fields").hide();
  13 + }
  14 +
  15 + function show_community_fields() {
  16 + jQuery(".institution_fields").hide();
  17 + jQuery(".software_fields").hide();
  18 + jQuery(".community_fields").show();
  19 + }
  20 +
  21 + function set_events() {
  22 + show_community_fields();
  23 +
  24 + jQuery("#type_Community").click(show_community_fields);
  25 +
  26 + jQuery("#type_Software").click(show_software_fields);
  27 +
  28 + jQuery("#type_Institution").click(show_institutions_fields);
  29 + }
  30 +
  31 + jQuery(document).ready(set_events);
  32 +})();
... ...
views/search/search_community_filter.html.erb 0 → 100644
... ... @@ -0,0 +1,127 @@
  1 +<form action="/search/community" name="user_filter" method="POST" class="search_form">
  2 + <div id="search_content">
  3 + <div class="search_options">
  4 +
  5 + <table class="search-table formfield type-radio">
  6 + <tr>
  7 + <td>
  8 + <%= label_tag("type_Community", _("Community")) %>
  9 + <%= radio_button_tag(:type, "Community", true) %>
  10 + <%= label_tag("type_Software", _("Software")) %>
  11 + <%= radio_button_tag(:type, "Software") %>
  12 + <%= label_tag("type_Institution", _("Institution")) %>
  13 + <%= radio_button_tag(:type, "Institution") %>
  14 + </td>
  15 + </tr>
  16 + </table>
  17 + </div>
  18 +
  19 + </br>
  20 +
  21 + <span class="community_fields">
  22 + <table>
  23 + <tr>
  24 + <td>
  25 + <%= label_tag("name", _("Name"))%>
  26 + <%= text_field_tag(:name) %>
  27 + </td>
  28 + </tr>
  29 + </table>
  30 + </span>
  31 +
  32 + <span class="software_fields">
  33 + <table>
  34 + <tr>
  35 + <td>
  36 + <%= label_tag("name", _("Name"))%>
  37 + <%= text_field_tag(:name) %>
  38 + </td>
  39 + </tr>
  40 +
  41 + <tr>
  42 + <td>
  43 + <%= select_tag("database[][database_description_id]", SoftwareHelper.select_options(DatabaseDescription.all)) %>
  44 + </td>
  45 + </tr>
  46 +
  47 + <tr>
  48 + <td>
  49 + <%= select_tag("language[][programming_language_id]", SoftwareHelper.select_options(ProgrammingLanguage.all)) %>
  50 + </td>
  51 + </tr>
  52 +
  53 + <tr>
  54 + <td>
  55 + <%= select_tag("operating_system[][operating_system_name_id]", SoftwareHelper.select_options(OperatingSystemName.all)) %>
  56 + </td>
  57 + </tr>
  58 +
  59 +
  60 + <% category = [] %>
  61 + <% ControlledVocabulary.attribute_names.each do |attribute| %>
  62 + <% if attribute.to_s != "id" && attribute.to_s != "software_info_id" %>
  63 + <% category << "<option>#{attribute.titleize}</option>".html_safe %>
  64 + <% end %>
  65 + <% end %>
  66 +
  67 + <tr>
  68 + <td>
  69 + <%= select_tag("controlled_vocabulary[][controlled_vocabulary]", category) %>
  70 + </td>
  71 + </tr>
  72 +
  73 + <% licenses = [] %>
  74 + <% LicenseInfo.all.map do |license| %>
  75 + <% licenses << "<option>#{license.version}</option>".html_safe %>
  76 + <% end %>
  77 +
  78 + <tr>
  79 + <td>
  80 + <%= select_tag("license_select", licenses) %>
  81 + </td>
  82 + </tr>
  83 +
  84 +
  85 + <tr>
  86 + <td>
  87 + <%= labelled_check_box _("Adherent to e-PING ?"), "e-ping" %>
  88 + </td>
  89 + </tr>
  90 +
  91 + <tr>
  92 + <td>
  93 + <%= labelled_check_box _("Adherent to e-MAG ?"), "e-mag" %>
  94 + </td>
  95 + </tr>
  96 +
  97 + <tr>
  98 + <td>
  99 + <%= labelled_check_box _("Adherent to ICP-Brasil ?"), "icp-brasil" %>
  100 + </td>
  101 + </tr>
  102 +
  103 + <tr>
  104 + <td>
  105 + <%= labelled_check_box _("Adherent to e-ARQ ?"), "e-arq" %>
  106 + </td>
  107 + </tr>
  108 +
  109 + <tr>
  110 + <td>
  111 + <%= labelled_check_box _("Internacionalizable ?"), "internacionalizable"%>
  112 + </td>
  113 + </tr>
  114 +
  115 + </table>
  116 + </span>
  117 +
  118 + <span class="institution_fields">
  119 + </span>
  120 +
  121 +
  122 + <tr>
  123 + <td> <%= submit_button(:search, _('Search')) %> </td>
  124 + </tr>
  125 + </div>
  126 +
  127 +</form>
... ...
views/search/search_user_filter.html.erb 0 → 100644
... ... @@ -0,0 +1,35 @@
  1 +<form action="/search/people" name="user_filter" method="POST" class="search_form">
  2 + <div id="user_filter_content">
  3 + <div class="user_filter_options">
  4 +
  5 + <table class="search-table">
  6 + <tr>
  7 + <td> <%= label_tag :name, _("Name") %> </td>
  8 + <td> <%= text_field_tag :name %> </td>
  9 + </tr>
  10 + <tr>
  11 + <td> <%= label_tag :state, _("State") %> </td>
  12 + <td> <%= text_field_tag :state %> </td>
  13 + </tr>
  14 + <tr>
  15 + <td> <%= label_tag :city, _("City") %> </td>
  16 + <td> <%= text_field_tag :city %> </td>
  17 + </tr>
  18 + <tr>
  19 + <td> <%= label_tag :email, _("Email") %> </td>
  20 + <td> <%= text_field_tag :email %> </td>
  21 + </tr>
  22 + <tr>
  23 + <td> </td>
  24 + <td> <%= submit_button(:search, _('Search')) %> </td>
  25 + </tr>
  26 + </table>
  27 + </div>
  28 +
  29 + </br>
  30 +
  31 + <div class="user_filter_actions">
  32 +
  33 + </div>
  34 + </div>
  35 +</form>
0 36 \ No newline at end of file
... ...
views/user_search/search_filter.html.erb
... ... @@ -1,35 +0,0 @@
1   -<form action="/search/people" name="user_filter" method="POST" class="search_form">
2   - <div id="user_filter_content">
3   - <div class="user_filter_options">
4   -
5   - <table class="search-table">
6   - <tr>
7   - <td> <%= label_tag :name, _("Name") %> </td>
8   - <td> <%= text_field_tag :name %> </td>
9   - </tr>
10   - <tr>
11   - <td> <%= label_tag :state, _("State") %> </td>
12   - <td> <%= text_field_tag :state %> </td>
13   - </tr>
14   - <tr>
15   - <td> <%= label_tag :city, _("City") %> </td>
16   - <td> <%= text_field_tag :city %> </td>
17   - </tr>
18   - <tr>
19   - <td> <%= label_tag :email, _("Email") %> </td>
20   - <td> <%= text_field_tag :email %> </td>
21   - </tr>
22   - <tr>
23   - <td> </td>
24   - <td> <%= submit_button(:search, _('Search')) %> </td>
25   - </tr>
26   - </table>
27   - </div>
28   -
29   - </br>
30   -
31   - <div class="user_filter_actions">
32   -
33   - </div>
34   - </div>
35   -</form>
36 0 \ No newline at end of file