diff --git a/lib/controlled_vocabulary_helper.rb b/lib/controlled_vocabulary_helper.rb new file mode 100644 index 0000000..e17a6a3 --- /dev/null +++ b/lib/controlled_vocabulary_helper.rb @@ -0,0 +1,14 @@ +module ControlledVocabularyHelper + + def self.get_categories_as_options + categories = [] + + ControlledVocabulary.attribute_names.each do |attribute| + if attribute.to_s != "id" && attribute.to_s != "software_info_id" then + categories << "".html_safe + end + end + + categories + end +end diff --git a/lib/mpog_software_plugin.rb b/lib/mpog_software_plugin.rb index d848767..9bc57bd 100644 --- a/lib/mpog_software_plugin.rb +++ b/lib/mpog_software_plugin.rb @@ -325,10 +325,10 @@ class MpogSoftwarePlugin < Noosfero::Plugin end end - def add_new_search_filter type - if type == "People" + def add_new_search_filter + if context.params[:action] == "people" expanded_template('search/search_user_filter.html.erb') - else type == "Community" + else context.params[:action] == "communities" expanded_template('search/search_community_filter.html.erb') end end diff --git a/public/style.css b/public/style.css index 2ba04b8..bf14f0c 100644 --- a/public/style.css +++ b/public/style.css @@ -77,28 +77,25 @@ height: auto; } -.user_filter_options { +.mpog_search_form_fields { + margin-top: 10px; width: 80%; height: auto; position: relative; float: left; } -.user_filter_options input[type='text'] { - width: 78%; - +.mpog_search_form_button { + margin-top: 10px; } -.user_filter_actions { - width: 18 %; - height: auto; - position: relative; - float: right; - text-align: right; +.mpog_search_form_fields input[type='text'] { + width: 90%; + } -.search-table tr td:first-child { - width: 40px; +.mpog_search_form_table tr td:first-child { + width: 22%; } .formfieldline { diff --git a/views/search/search_community_filter.html.erb b/views/search/search_community_filter.html.erb index abd5cbd..1d15a85 100644 --- a/views/search/search_community_filter.html.erb +++ b/views/search/search_community_filter.html.erb @@ -1,8 +1,8 @@
-
- +
+
<%= label_tag("type_Community", _("Community")) %> @@ -16,112 +16,21 @@
-
- - - - - - -
- <%= label_tag("name", _("Name"))%> - <%= text_field_tag(:name) %> -
-
- - - - - - - - - - - - - - - - - - - - - <% category = [] %> - <% ControlledVocabulary.attribute_names.each do |attribute| %> - <% if attribute.to_s != "id" && attribute.to_s != "software_info_id" %> - <% category << "".html_safe %> - <% end %> - <% end %> - - - - - - <% licenses = [] %> - <% LicenseInfo.all.map do |license| %> - <% licenses << "".html_safe %> - <% end %> - - - - - - - - - - - - - - - - - - - - - - - - - - -
- <%= label_tag("name", _("Name"))%> - <%= text_field_tag(:name) %> -
- <%= select_tag("database[][database_description_id]", SoftwareHelper.select_options(DatabaseDescription.all)) %> -
- <%= select_tag("language[][programming_language_id]", SoftwareHelper.select_options(ProgrammingLanguage.all)) %> -
- <%= select_tag("operating_system[][operating_system_name_id]", SoftwareHelper.select_options(OperatingSystemName.all)) %> -
- <%= select_tag("controlled_vocabulary[][controlled_vocabulary]", category) %> -
- <%= select_tag("license_select", licenses) %> -
- <%= labelled_check_box _("Adherent to e-PING ?"), "e-ping" %> -
- <%= labelled_check_box _("Adherent to e-MAG ?"), "e-mag" %> -
- <%= labelled_check_box _("Adherent to ICP-Brasil ?"), "icp-brasil" %> -
- <%= labelled_check_box _("Adherent to e-ARQ ?"), "e-arq" %> -
- <%= labelled_check_box _("Internacionalizable ?"), "internacionalizable"%> -
-
+
+ <%= expanded_template "search/search_forms/_community_fields.html.erb" %> +
- - +
+ <%= expanded_template "search/search_forms/_software_fields.html.erb" %> +
+
+ <%= expanded_template "search/search_forms/_institution_fields.html.erb" %> +
- - <%= submit_button(:search, _('Search')) %> - +
+ <%= submit_button(:search, _('Search')) %> +
diff --git a/views/search/search_forms/_community_fields.html.erb b/views/search/search_forms/_community_fields.html.erb new file mode 100644 index 0000000..e32860d --- /dev/null +++ b/views/search/search_forms/_community_fields.html.erb @@ -0,0 +1,8 @@ + + + + +
+ <%= label_tag("name", _("Name"))%> + <%= text_field_tag(:name) %> +
\ No newline at end of file diff --git a/views/search/search_forms/_institution_fields.html.erb b/views/search/search_forms/_institution_fields.html.erb new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/views/search/search_forms/_institution_fields.html.erb diff --git a/views/search/search_forms/_software_fields.html.erb b/views/search/search_forms/_software_fields.html.erb new file mode 100644 index 0000000..9aa877e --- /dev/null +++ b/views/search/search_forms/_software_fields.html.erb @@ -0,0 +1,141 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
<%= label_tag("name", _("Name"))%> <%= text_field_tag(:name) %>
<%= _("Database") %> + <%= select_tag("database_description", SoftwareHelper.select_options(DatabaseDescription.all)) %> +
<%= _("Programming Language") %> + <%= select_tag("programming_language", SoftwareHelper.select_options(ProgrammingLanguage.all)) %> +
<%= _("Operating System") %> + <%= select_tag("operating_system", SoftwareHelper.select_options(OperatingSystemName.all)) %> +
<%= _("Controlled Vocabulary") %> + <%= select_tag("controlled_vocabulary", ControlledVocabularyHelper.get_categories_as_options) %> +
<%= _("License Used") %> + <%= collection_select(:license_info, :id, LicenseInfo.all, :id, :version, :prompt=>_("Any")) %> +
<%= _("Adherent to e-PING ?") %> + + + + + +
<%= _("Adherent to e-MAG ?") %> + + + + + +
<%= _("Adherent to ICP-Brasil ?") %> + + + + + +
<%= _("Adherent to e-ARQ ?") %> + + + + + +
<%= _("Internacionalizable ?") %> + + + + + +
\ No newline at end of file diff --git a/views/search/search_user_filter.html.erb b/views/search/search_user_filter.html.erb index 5ca0e16..ea39459 100644 --- a/views/search/search_user_filter.html.erb +++ b/views/search/search_user_filter.html.erb @@ -1,8 +1,8 @@
-
+
- +
@@ -25,11 +25,5 @@
<%= label_tag :name, _("Name") %> <%= text_field_tag :name %>
- -
- -
- -
\ No newline at end of file -- libgit2 0.21.2