diff --git a/lib/mpog_software_plugin.rb b/lib/mpog_software_plugin.rb index 5b8c002..d8fc558 100644 --- a/lib/mpog_software_plugin.rb +++ b/lib/mpog_software_plugin.rb @@ -134,7 +134,7 @@ class MpogSoftwarePlugin < Noosfero::Plugin end def js_files - ["mpog-software-validations.js", "mpog-user-validations.js", "mpog-institution-validations.js", "mpog-incomplete-registration.js"] + ["mpog-software-validations.js", "mpog-user-validations.js", "mpog-institution-validations.js", "mpog-incomplete-registration.js", "mpog-search.js"] end def add_new_organization_button @@ -325,8 +325,12 @@ class MpogSoftwarePlugin < Noosfero::Plugin end end - def add_new_user_search_filter - expanded_template('user_search/search_filter.html.erb') + def add_new_search_filter type + if type == "People" + expanded_template('search/search_user_filter.html.erb') + else type == "Community" + expanded_template('search/search_community_filter.html.erb') + end end def custom_people_search params diff --git a/public/mpog-search.js b/public/mpog-search.js new file mode 100644 index 0000000..d234763 --- /dev/null +++ b/public/mpog-search.js @@ -0,0 +1,32 @@ +(function(){ + + function show_institutions_fields() { + jQuery(".institution_fields").show(); + jQuery(".software_fields").hide(); + jQuery(".community_fields").hide(); + } + + function show_software_fields() { + jQuery(".institution_fields").hide(); + jQuery(".software_fields").show(); + jQuery(".community_fields").hide(); + } + + function show_community_fields() { + jQuery(".institution_fields").hide(); + jQuery(".software_fields").hide(); + jQuery(".community_fields").show(); + } + + function set_events() { + show_community_fields(); + + jQuery("#type_Community").click(show_community_fields); + + jQuery("#type_Software").click(show_software_fields); + + jQuery("#type_Institution").click(show_institutions_fields); + } + + jQuery(document).ready(set_events); +})(); diff --git a/views/search/search_community_filter.html.erb b/views/search/search_community_filter.html.erb new file mode 100644 index 0000000..e429705 --- /dev/null +++ b/views/search/search_community_filter.html.erb @@ -0,0 +1,127 @@ +
+
+
+ + + + + +
+ <%= label_tag("type_Community", _("Community")) %> + <%= radio_button_tag(:type, "Community", true) %> + <%= label_tag("type_Software", _("Software")) %> + <%= radio_button_tag(:type, "Software") %> + <%= label_tag("type_Institution", _("Institution")) %> + <%= radio_button_tag(:type, "Institution") %> +
+
+ +
+ + + + + + +
+ <%= 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"%> +
+
+ + + + + + + <%= submit_button(:search, _('Search')) %> + +
+ +
diff --git a/views/search/search_user_filter.html.erb b/views/search/search_user_filter.html.erb new file mode 100644 index 0000000..5ca0e16 --- /dev/null +++ b/views/search/search_user_filter.html.erb @@ -0,0 +1,35 @@ +
+
+
+ + + + + + + + + + + + + + + + + + + + + + +
<%= label_tag :name, _("Name") %> <%= text_field_tag :name %>
<%= label_tag :state, _("State") %> <%= text_field_tag :state %>
<%= label_tag :city, _("City") %> <%= text_field_tag :city %>
<%= label_tag :email, _("Email") %> <%= text_field_tag :email %>
<%= submit_button(:search, _('Search')) %>
+
+ +
+ +
+ +
+
+
\ No newline at end of file diff --git a/views/user_search/search_filter.html.erb b/views/user_search/search_filter.html.erb deleted file mode 100644 index 5ca0e16..0000000 --- a/views/user_search/search_filter.html.erb +++ /dev/null @@ -1,35 +0,0 @@ -
-
-
- - - - - - - - - - - - - - - - - - - - - - -
<%= label_tag :name, _("Name") %> <%= text_field_tag :name %>
<%= label_tag :state, _("State") %> <%= text_field_tag :state %>
<%= label_tag :city, _("City") %> <%= text_field_tag :city %>
<%= label_tag :email, _("Email") %> <%= text_field_tag :email %>
<%= submit_button(:search, _('Search')) %>
-
- -
- -
- -
-
-
\ No newline at end of file -- libgit2 0.21.2