Commit 3dbe1ff599d82faaaa9421a78388a66ccbbb145f

Authored by Fabio Teixeira
1 parent afd60bff

software_search: Search template's adjustments

Signed-off-by: Arthur Del Esposte <arthurmde@gmail.com>
Signed-off-by: Fabio Teixeira <fabio1079@gmail.com>
lib/controlled_vocabulary_helper.rb 0 → 100644
@@ -0,0 +1,14 @@ @@ -0,0 +1,14 @@
  1 +module ControlledVocabularyHelper
  2 +
  3 + def self.get_categories_as_options
  4 + categories = []
  5 +
  6 + ControlledVocabulary.attribute_names.each do |attribute|
  7 + if attribute.to_s != "id" && attribute.to_s != "software_info_id" then
  8 + categories << "<option>#{attribute.titleize}</option>".html_safe
  9 + end
  10 + end
  11 +
  12 + categories
  13 + end
  14 +end
lib/mpog_software_plugin.rb
@@ -325,10 +325,10 @@ class MpogSoftwarePlugin &lt; Noosfero::Plugin @@ -325,10 +325,10 @@ class MpogSoftwarePlugin &lt; Noosfero::Plugin
325 end 325 end
326 end 326 end
327 327
328 - def add_new_search_filter type  
329 - if type == "People" 328 + def add_new_search_filter
  329 + if context.params[:action] == "people"
330 expanded_template('search/search_user_filter.html.erb') 330 expanded_template('search/search_user_filter.html.erb')
331 - else type == "Community" 331 + else context.params[:action] == "communities"
332 expanded_template('search/search_community_filter.html.erb') 332 expanded_template('search/search_community_filter.html.erb')
333 end 333 end
334 end 334 end
public/style.css
@@ -77,28 +77,25 @@ @@ -77,28 +77,25 @@
77 height: auto; 77 height: auto;
78 } 78 }
79 79
80 -.user_filter_options { 80 +.mpog_search_form_fields {
  81 + margin-top: 10px;
81 width: 80%; 82 width: 80%;
82 height: auto; 83 height: auto;
83 position: relative; 84 position: relative;
84 float: left; 85 float: left;
85 } 86 }
86 87
87 -.user_filter_options input[type='text'] {  
88 - width: 78%;  
89 - 88 +.mpog_search_form_button {
  89 + margin-top: 10px;
90 } 90 }
91 91
92 -.user_filter_actions {  
93 - width: 18 %;  
94 - height: auto;  
95 - position: relative;  
96 - float: right;  
97 - text-align: right; 92 +.mpog_search_form_fields input[type='text'] {
  93 + width: 90%;
  94 +
98 } 95 }
99 96
100 -.search-table tr td:first-child {  
101 - width: 40px; 97 +.mpog_search_form_table tr td:first-child {
  98 + width: 22%;
102 } 99 }
103 100
104 .formfieldline { 101 .formfieldline {
views/search/search_community_filter.html.erb
1 <form action="/search/communities" name="community_filter" method="POST" class="search_form"> 1 <form action="/search/communities" name="community_filter" method="POST" class="search_form">
2 <div id="search_content"> 2 <div id="search_content">
3 - <div class="search_options">  
4 3
5 - <table class="search-table formfield type-radio"> 4 + <div class="search_options">
  5 + <table class="mpog_search_form_table formfield type-radio">
6 <tr> 6 <tr>
7 <td> 7 <td>
8 <%= label_tag("type_Community", _("Community")) %> 8 <%= label_tag("type_Community", _("Community")) %>
@@ -16,112 +16,21 @@ @@ -16,112 +16,21 @@
16 </table> 16 </table>
17 </div> 17 </div>
18 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> 19 + <div class="community_fields mpog_search_form_fields">
  20 + <%= expanded_template "search/search_forms/_community_fields.html.erb" %>
  21 + </div>
117 22
118 - <span class="institution_fields">  
119 - </span> 23 + <div class="software_fields mpog_search_form_fields">
  24 + <%= expanded_template "search/search_forms/_software_fields.html.erb" %>
  25 + </div>
120 26
  27 + <div class="institution_fields mpog_search_form_fields">
  28 + <%= expanded_template "search/search_forms/_institution_fields.html.erb" %>
  29 + </div>
121 30
122 - <tr>  
123 - <td> <%= submit_button(:search, _('Search')) %> </td>  
124 - </tr> 31 + <div class="mpog_search_form_button">
  32 + <%= submit_button(:search, _('Search')) %>
  33 + </div>
125 </div> 34 </div>
126 35
127 </form> 36 </form>
views/search/search_forms/_community_fields.html.erb 0 → 100644
@@ -0,0 +1,8 @@ @@ -0,0 +1,8 @@
  1 +<table class="mpog_search_form_table">
  2 + <tr>
  3 + <td>
  4 + <%= label_tag("name", _("Name"))%>
  5 + <%= text_field_tag(:name) %>
  6 + </td>
  7 + </tr>
  8 +</table>
0 \ No newline at end of file 9 \ No newline at end of file
views/search/search_forms/_institution_fields.html.erb 0 → 100644
views/search/search_forms/_software_fields.html.erb 0 → 100644
@@ -0,0 +1,141 @@ @@ -0,0 +1,141 @@
  1 +<table class="mpog_search_form_table">
  2 + <tr>
  3 + <td> <%= label_tag("name", _("Name"))%> </td>
  4 + <td> <%= text_field_tag(:name) %> </td>
  5 + </tr>
  6 +
  7 + <tr>
  8 + <td> <%= _("Database") %> </td>
  9 + <td>
  10 + <%= select_tag("database_description", SoftwareHelper.select_options(DatabaseDescription.all)) %>
  11 + </td>
  12 + </tr>
  13 +
  14 + <tr>
  15 + <td> <%= _("Programming Language") %> </td>
  16 + <td>
  17 + <%= select_tag("programming_language", SoftwareHelper.select_options(ProgrammingLanguage.all)) %>
  18 + </td>
  19 + </tr>
  20 +
  21 + <tr>
  22 + <td> <%= _("Operating System") %> </td>
  23 + <td>
  24 + <%= select_tag("operating_system", SoftwareHelper.select_options(OperatingSystemName.all)) %>
  25 + </td>
  26 + </tr>
  27 +
  28 + <tr>
  29 + <td> <%= _("Controlled Vocabulary") %> </td>
  30 + <td>
  31 + <%= select_tag("controlled_vocabulary", ControlledVocabularyHelper.get_categories_as_options) %>
  32 + </td>
  33 + </tr>
  34 +
  35 + <tr>
  36 + <td> <%= _("License Used") %> </td>
  37 + <td>
  38 + <%= collection_select(:license_info, :id, LicenseInfo.all, :id, :version, :prompt=>_("Any")) %>
  39 + </td>
  40 + </tr>
  41 +
  42 + <tr>
  43 + <td> <%= _("Adherent to e-PING ?") %> </td>
  44 + <td>
  45 + <label>
  46 + <%= radio_button_tag(:e_ping, "any", true) %>
  47 + <%= _("Any") %>
  48 + </label>
  49 +
  50 + <label>
  51 + <%= radio_button_tag(:e_ping, "yes") %>
  52 + <%= _("Yes") %>
  53 + </label>
  54 +
  55 + <label>
  56 + <%= radio_button_tag(:e_ping, "no") %>
  57 + <%= _("No") %>
  58 + </label>
  59 + </td>
  60 + </tr>
  61 +
  62 + <tr>
  63 + <td> <%= _("Adherent to e-MAG ?") %> </td>
  64 + <td>
  65 + <label>
  66 + <%= radio_button_tag(:e_mag, "any", true) %>
  67 + <%= _("Any") %>
  68 + </label>
  69 +
  70 + <label>
  71 + <%= radio_button_tag(:e_mag, "yes") %>
  72 + <%= _("Yes") %>
  73 + </label>
  74 +
  75 + <label>
  76 + <%= radio_button_tag(:e_mag, "no") %>
  77 + <%= _("No") %>
  78 + </label>
  79 + </td>
  80 + </tr>
  81 +
  82 + <tr>
  83 + <td> <%= _("Adherent to ICP-Brasil ?") %> </td>
  84 + <td>
  85 + <label>
  86 + <%= radio_button_tag(:icp_brasil, "any", true) %>
  87 + <%= _("Any") %>
  88 + </label>
  89 +
  90 + <label>
  91 + <%= radio_button_tag(:icp_brasil, "yes") %>
  92 + <%= _("Yes") %>
  93 + </label>
  94 +
  95 + <label>
  96 + <%= radio_button_tag(:icp_brasil, "no") %>
  97 + <%= _("No") %>
  98 + </label>
  99 + </td>
  100 + </tr>
  101 +
  102 + <tr>
  103 + <td> <%= _("Adherent to e-ARQ ?") %> </td>
  104 + <td>
  105 + <label>
  106 + <%= radio_button_tag(:e_arq, "any", true) %>
  107 + <%= _("Any") %>
  108 + </label>
  109 +
  110 + <label>
  111 + <%= radio_button_tag(:e_arq, "yes") %>
  112 + <%= _("Yes") %>
  113 + </label>
  114 +
  115 + <label>
  116 + <%= radio_button_tag(:e_arq, "no") %>
  117 + <%= _("No") %>
  118 + </label>
  119 + </td>
  120 + </tr>
  121 +
  122 + <tr>
  123 + <td> <%= _("Internacionalizable ?") %> </td>
  124 + <td>
  125 + <label>
  126 + <%= radio_button_tag(:internacionalizable, "any", true) %>
  127 + <%= _("Any") %>
  128 + </label>
  129 +
  130 + <label>
  131 + <%= radio_button_tag(:internacionalizable, "yes") %>
  132 + <%= _("Yes") %>
  133 + </label>
  134 +
  135 + <label>
  136 + <%= radio_button_tag(:internacionalizable, "no") %>
  137 + <%= _("No") %>
  138 + </label>
  139 + </td>
  140 + </tr>
  141 +</table>
0 \ No newline at end of file 142 \ No newline at end of file
views/search/search_user_filter.html.erb
1 <form action="/search/people" name="user_filter" method="POST" class="search_form"> 1 <form action="/search/people" name="user_filter" method="POST" class="search_form">
2 <div id="user_filter_content"> 2 <div id="user_filter_content">
3 - <div class="user_filter_options"> 3 + <div class="mpog_search_form_fields">
4 4
5 - <table class="search-table"> 5 + <table class="mpog_search_form_table">
6 <tr> 6 <tr>
7 <td> <%= label_tag :name, _("Name") %> </td> 7 <td> <%= label_tag :name, _("Name") %> </td>
8 <td> <%= text_field_tag :name %> </td> 8 <td> <%= text_field_tag :name %> </td>
@@ -25,11 +25,5 @@ @@ -25,11 +25,5 @@
25 </tr> 25 </tr>
26 </table> 26 </table>
27 </div> 27 </div>
28 -  
29 - </br>  
30 -  
31 - <div class="user_filter_actions">  
32 -  
33 - </div>  
34 </div> 28 </div>
35 </form> 29 </form>
36 \ No newline at end of file 30 \ No newline at end of file