Commit 343a24b417647c57bbcce612f5e0f32a13c37dbf
Exists in
master
and in
5 other branches
Merge branch 'html_classes_revision' into 'master'
Html classes revision See merge request !3
Showing
29 changed files
with
464 additions
and
322 deletions
Show diff stats
@@ -0,0 +1,13 @@ | @@ -0,0 +1,13 @@ | ||
1 | +class AddNewFieldsToComments < ActiveRecord::Migration | ||
2 | + def self.up | ||
3 | + change_table :comments do |t| | ||
4 | + t.integer :people_benefited | ||
5 | + t.decimal :saved_value | ||
6 | + end | ||
7 | + end | ||
8 | + | ||
9 | + def self.down | ||
10 | + remove_column :comments, :people_benefited | ||
11 | + remove_column :comments, :saved_value | ||
12 | + end | ||
13 | +end |
db/migrate/20150814185902_add_people_benefited_and_saved_value_to_create_community_rating_comment.rb
0 → 100644
@@ -0,0 +1,11 @@ | @@ -0,0 +1,11 @@ | ||
1 | +class AddPeopleBenefitedAndSavedValueToCreateCommunityRatingComment < ActiveRecord::Migration | ||
2 | + def up | ||
3 | + add_column :tasks, :people_benefited, :integer | ||
4 | + add_column :tasks, :saved_value, :decimal | ||
5 | + end | ||
6 | + | ||
7 | + def down | ||
8 | + remove_column :tasks, :people_benefited | ||
9 | + remove_column :tasks, :saved_value | ||
10 | + end | ||
11 | +end |
@@ -0,0 +1,23 @@ | @@ -0,0 +1,23 @@ | ||
1 | +require_dependency 'profile_controller' | ||
2 | + | ||
3 | +class ProfileController | ||
4 | + | ||
5 | + def communities | ||
6 | + type = [] | ||
7 | + params[:type].downcase! unless params[:type].nil? | ||
8 | + | ||
9 | + if params[:type] == "software" | ||
10 | + type = profile.softwares | ||
11 | + elsif params[:type] == "institution" | ||
12 | + type = profile.institutions | ||
13 | + else | ||
14 | + profile.communities.select do |community| | ||
15 | + type << community unless community.software? || community.institution? | ||
16 | + end | ||
17 | + end | ||
18 | + | ||
19 | + if is_cache_expired?(profile.communities_cache_key(params)) | ||
20 | + @communities = type.paginate(:per_page => per_page, :page => params[:npage], :total_entries => type.count) | ||
21 | + end | ||
22 | + end | ||
23 | +end |
lib/ext/search_controller.rb
@@ -59,8 +59,15 @@ class SearchController | @@ -59,8 +59,15 @@ class SearchController | ||
59 | 59 | ||
60 | def get_filtered_software_list | 60 | def get_filtered_software_list |
61 | params[:query] ||= "" | 61 | params[:query] ||= "" |
62 | + | ||
62 | filtered_software_list = SoftwareInfo.search_by_query(params[:query]) | 63 | filtered_software_list = SoftwareInfo.search_by_query(params[:query]) |
63 | 64 | ||
65 | + if params[:only_softwares] | ||
66 | + params[:only_softwares].collect!{ |software_name| software_name.to_slug } | ||
67 | + filtered_software_list = SoftwareInfo.all.select{ |s| params[:only_softwares].include?(s.identifier) } | ||
68 | + @public_software_selected = false | ||
69 | + end | ||
70 | + | ||
64 | category_ids = get_filter_category_ids | 71 | category_ids = get_filter_category_ids |
65 | 72 | ||
66 | unless category_ids.empty? | 73 | unless category_ids.empty? |
@@ -80,7 +87,7 @@ class SearchController | @@ -80,7 +87,7 @@ class SearchController | ||
80 | def get_communities_list software_list | 87 | def get_communities_list software_list |
81 | filtered_community_list = [] | 88 | filtered_community_list = [] |
82 | software_list.each do |software| | 89 | software_list.each do |software| |
83 | - if @include_non_public || software.public_software? | 90 | + if @all_selected || software.public_software? |
84 | filtered_community_list << software.community unless software.community.nil? | 91 | filtered_community_list << software.community unless software.community.nil? |
85 | end | 92 | end |
86 | end | 93 | end |
@@ -110,7 +117,8 @@ class SearchController | @@ -110,7 +117,8 @@ class SearchController | ||
110 | @selected_categories_id = params[:selected_categories_id] | 117 | @selected_categories_id = params[:selected_categories_id] |
111 | @selected_categories_id ||= [] | 118 | @selected_categories_id ||= [] |
112 | @selected_categories_id = @selected_categories_id.map(&:to_i) | 119 | @selected_categories_id = @selected_categories_id.map(&:to_i) |
113 | - @include_non_public = params[:include_non_public] == "true" | 120 | + @all_selected = params[:software_type] == "all" |
121 | + @public_software_selected = !@all_selected | ||
114 | @per_page = prepare_per_page | 122 | @per_page = prepare_per_page |
115 | end | 123 | end |
116 | 124 | ||
@@ -140,14 +148,6 @@ class SearchController | @@ -140,14 +148,6 @@ class SearchController | ||
140 | 148 | ||
141 | def prepare_software_infos_category_groups | 149 | def prepare_software_infos_category_groups |
142 | @categories = Category.software_categories.sort{|a, b| a.name <=> b.name} | 150 | @categories = Category.software_categories.sort{|a, b| a.name <=> b.name} |
143 | - @categories_groupe_one = [] | ||
144 | - @categories_groupe_two = [] | ||
145 | - | ||
146 | - if @categories && @categories.count > 1 | ||
147 | - categories_sliced = @categories.each_slice(@categories.count/2) | ||
148 | - @categories_groupe_one = categories_sliced.next | ||
149 | - @categories_groupe_two = categories_sliced.next | ||
150 | - end | ||
151 | end | 151 | end |
152 | 152 | ||
153 | def prepare_software_infos_category_enable | 153 | def prepare_software_infos_category_enable |
lib/software_communities_plugin.rb
@@ -39,7 +39,8 @@ class SoftwareCommunitiesPlugin < Noosfero::Plugin | @@ -39,7 +39,8 @@ class SoftwareCommunitiesPlugin < Noosfero::Plugin | ||
39 | RepositoryBlock => { :type => [Community] }, | 39 | RepositoryBlock => { :type => [Community] }, |
40 | CategoriesAndTagsBlock => { :type => [Community] }, | 40 | CategoriesAndTagsBlock => { :type => [Community] }, |
41 | CategoriesSoftwareBlock => { :type => [Environment] }, | 41 | CategoriesSoftwareBlock => { :type => [Environment] }, |
42 | - SearchCatalogBlock => { :type => [Environment] } | 42 | + SearchCatalogBlock => { :type => [Environment] }, |
43 | + SoftwareHighlightsBlock => { :type => [Environment] } | ||
43 | } | 44 | } |
44 | end | 45 | end |
45 | 46 | ||
@@ -63,12 +64,47 @@ class SoftwareCommunitiesPlugin < Noosfero::Plugin | @@ -63,12 +64,47 @@ class SoftwareCommunitiesPlugin < Noosfero::Plugin | ||
63 | views/search-software-catalog.js | 64 | views/search-software-catalog.js |
64 | views/profile-tabs-software.js | 65 | views/profile-tabs-software.js |
65 | views/new-community.js | 66 | views/new-community.js |
67 | + views/comments-software-extra-fields.js | ||
66 | blocks/software-download.js | 68 | blocks/software-download.js |
67 | initializer.js | 69 | initializer.js |
68 | app.js | 70 | app.js |
69 | ) | 71 | ) |
70 | end | 72 | end |
71 | 73 | ||
74 | + module Hotspots | ||
75 | + def display_community_average_rating community | ||
76 | + nil | ||
77 | + end | ||
78 | + end | ||
79 | + | ||
80 | + def communities_ratings_plugin_comments_extra_fields | ||
81 | + if context.profile.software? | ||
82 | + Proc::new { render :file => 'comments_extra_fields' } | ||
83 | + end | ||
84 | + end | ||
85 | + | ||
86 | + def communities_ratings_plugin_star_message | ||
87 | + Proc::new do _("Rate this software") end | ||
88 | + end | ||
89 | + | ||
90 | + def communities_ratings_title | ||
91 | + Proc::new do "<h1 class='title'>#{_("Use reports")}</h1>" end | ||
92 | + end | ||
93 | + | ||
94 | + def communities_ratings_plugin_extra_fields_show_data user_rating | ||
95 | + if logged_in? | ||
96 | + is_admin = environment.admins.include?(current_user.person) | ||
97 | + is_admin ||= user_rating.community.admins.include?(current_user.person) | ||
98 | + | ||
99 | + if is_admin and context.profile.software? | ||
100 | + Proc::new { | ||
101 | + render :file => 'communities_ratings_extra_fields_show_data', | ||
102 | + :locals => {:user_rating => user_rating} | ||
103 | + } | ||
104 | + end | ||
105 | + end | ||
106 | + end | ||
107 | + | ||
72 | # FIXME - if in error log apears has_permission?, try to use this method | 108 | # FIXME - if in error log apears has_permission?, try to use this method |
73 | def has_permission?(person, permission, target) | 109 | def has_permission?(person, permission, target) |
74 | person.has_permission_without_plugins?(permission, target) | 110 | person.has_permission_without_plugins?(permission, target) |
@@ -0,0 +1,20 @@ | @@ -0,0 +1,20 @@ | ||
1 | +class SoftwareHighlightsBlock < HighlightsBlock | ||
2 | + | ||
3 | + def self.description | ||
4 | + _('Software Highlights Block') | ||
5 | + end | ||
6 | + | ||
7 | + def help | ||
8 | + _('This block displays the softwares icon into a highlight') | ||
9 | + end | ||
10 | + | ||
11 | + def content(args={}) | ||
12 | + softwares = self.settings[:images].collect {|h| h[:address].split('/').last} | ||
13 | + block = self | ||
14 | + proc do | ||
15 | + render :file => 'blocks/software_highlights', :locals => { :block => block, :softwares => softwares} | ||
16 | + end | ||
17 | + end | ||
18 | + | ||
19 | + | ||
20 | +end |
lib/software_information_block.rb
@@ -15,10 +15,11 @@ class SoftwareInformationBlock < Block | @@ -15,10 +15,11 @@ class SoftwareInformationBlock < Block | ||
15 | def content(args={}) | 15 | def content(args={}) |
16 | block = self | 16 | block = self |
17 | s = show_name | 17 | s = show_name |
18 | + | ||
18 | lambda do |object| | 19 | lambda do |object| |
19 | render( | 20 | render( |
20 | :file => 'blocks/software_information', | 21 | :file => 'blocks/software_information', |
21 | - :locals => { :block => block, :show_name => s } | 22 | + :locals => { :block => block, :show_name => s} |
22 | ) | 23 | ) |
23 | end | 24 | end |
24 | end | 25 | end |
@@ -26,4 +27,11 @@ class SoftwareInformationBlock < Block | @@ -26,4 +27,11 @@ class SoftwareInformationBlock < Block | ||
26 | def cacheable? | 27 | def cacheable? |
27 | false | 28 | false |
28 | end | 29 | end |
30 | + | ||
31 | + private | ||
32 | + | ||
33 | + def owner_has_ratings? | ||
34 | + ratings = CommunityRating.where(community_id: block.owner.id) | ||
35 | + !ratings.empty? | ||
36 | + end | ||
29 | end | 37 | end |
po/pt/software_communities.po
@@ -1181,4 +1181,4 @@ msgstr "Sistema Operacional" | @@ -1181,4 +1181,4 @@ msgstr "Sistema Operacional" | ||
1181 | #~ msgstr "Atualizado Recentemente" | 1181 | #~ msgstr "Atualizado Recentemente" |
1182 | 1182 | ||
1183 | #~ msgid "New in portal" | 1183 | #~ msgid "New in portal" |
1184 | -#~ msgstr "Novo no portal" | 1184 | -#~ msgstr "Novo no portal" |
1185 | +#~ msgstr "Novo no portal" | ||
1185 | \ No newline at end of file | 1186 | \ No newline at end of file |
public/initializer.js
public/lib/software-catalog-component.js
@@ -3,39 +3,7 @@ modulejs.define('SoftwareCatalogComponent', ['jquery'], function($) { | @@ -3,39 +3,7 @@ modulejs.define('SoftwareCatalogComponent', ['jquery'], function($) { | ||
3 | 3 | ||
4 | var dispatch_ajax_function; | 4 | var dispatch_ajax_function; |
5 | 5 | ||
6 | - | ||
7 | - function show_head_message() { | ||
8 | - if ($("#filter-categories-select-catalog").text().length === 0){ | ||
9 | - $("#filter-categories-select-catalog").hide(); | ||
10 | - $("#filter-option-catalog-software").show(); | ||
11 | - }else{ | ||
12 | - $("#filter-categories-select-catalog").show(); | ||
13 | - $("#filter-option-catalog-software").hide(); | ||
14 | - } | ||
15 | - } | ||
16 | - | ||
17 | - | ||
18 | - function slideDowsCategoriesOptionAndHideOptionCatalog() { | ||
19 | - $("#filter-categories-option").slideDown(); | ||
20 | - $("#filter-option-catalog-software").hide(); | ||
21 | - } | ||
22 | - | ||
23 | - | ||
24 | - function slideDownCategoriesOptionAndHideCategoriesSelect() { | ||
25 | - $("#filter-categories-option").slideDown(); | ||
26 | - $("#filter-categories-select-catalog").hide(); | ||
27 | - } | ||
28 | - | ||
29 | - | ||
30 | - function slideUpCategoriesAndShowHeadMessage() { | ||
31 | - $("#filter-categories-option").slideUp(); | ||
32 | - show_head_message(); | ||
33 | - } | ||
34 | - | ||
35 | - | ||
36 | function clearCatalogCheckbox() { | 6 | function clearCatalogCheckbox() { |
37 | - $("#filter-categories-option").slideUp(); | ||
38 | - $("#filter-option-catalog-software").show(); | ||
39 | $("#group-categories input:checked").each(function() { | 7 | $("#group-categories input:checked").each(function() { |
40 | $(this).prop('checked', false); | 8 | $(this).prop('checked', false); |
41 | }); | 9 | }); |
@@ -45,39 +13,26 @@ modulejs.define('SoftwareCatalogComponent', ['jquery'], function($) { | @@ -45,39 +13,26 @@ modulejs.define('SoftwareCatalogComponent', ['jquery'], function($) { | ||
45 | 13 | ||
46 | 14 | ||
47 | function selectCheckboxCategory(dispatch_ajax) { | 15 | function selectCheckboxCategory(dispatch_ajax) { |
48 | - $("#filter-categories-option").slideUp(); | ||
49 | - $("#filter-categories-select-catalog").show(); | ||
50 | - $("#filter-option-catalog-software").hide(); | ||
51 | - | ||
52 | dispatch_ajax_function(true); | 16 | dispatch_ajax_function(true); |
53 | } | 17 | } |
54 | 18 | ||
55 | 19 | ||
56 | function selectProjectSoftwareCheckbox() { | 20 | function selectProjectSoftwareCheckbox() { |
57 | - $("#filter-categories-option").slideUp(); | ||
58 | - $("#filter-categories-select-catalog").show(); | ||
59 | - $("#filter-option-catalog-software").hide(); | ||
60 | - | ||
61 | dispatch_ajax_function(true); | 21 | dispatch_ajax_function(true); |
62 | - show_head_message(); | ||
63 | } | 22 | } |
64 | 23 | ||
65 | 24 | ||
66 | function set_events() { | 25 | function set_events() { |
67 | - $("#filter-option-catalog-software").click(slideDowsCategoriesOptionAndHideOptionCatalog); | ||
68 | - $("#filter-categories-select-catalog").click(slideDownCategoriesOptionAndHideCategoriesSelect); | ||
69 | - $("#close-filter-catalog").click(slideUpCategoriesAndShowHeadMessage); | ||
70 | $("#cleanup-filter-catalg").click(clearCatalogCheckbox); | 26 | $("#cleanup-filter-catalg").click(clearCatalogCheckbox); |
71 | $(".categories-catalog").click(selectCheckboxCategory); | 27 | $(".categories-catalog").click(selectCheckboxCategory); |
72 | $(".project-software").click(selectProjectSoftwareCheckbox); | 28 | $(".project-software").click(selectProjectSoftwareCheckbox); |
73 | } | 29 | } |
74 | 30 | ||
75 | - | ||
76 | return { | 31 | return { |
77 | init: function(dispatch_ajax) { | 32 | init: function(dispatch_ajax) { |
78 | dispatch_ajax_function = dispatch_ajax; | 33 | dispatch_ajax_function = dispatch_ajax; |
79 | set_events(); | 34 | set_events(); |
80 | - show_head_message(); | ||
81 | }, | 35 | }, |
82 | } | 36 | } |
83 | }); | 37 | }); |
38 | + |
public/style.css
@@ -45,36 +45,21 @@ | @@ -45,36 +45,21 @@ | ||
45 | 45 | ||
46 | #profile-data .validated { | 46 | #profile-data .validated { |
47 | box-shadow: 0px 0px 7px green; | 47 | box-shadow: 0px 0px 7px green; |
48 | - border-color: rgb(0, 80, 0) | 48 | + border-color: rgb(0, 80, 0); |
49 | } | 49 | } |
50 | 50 | ||
51 | -#software-name-field | ||
52 | -{ | 51 | +#software-name-field { |
53 | padding-bottom: 10px; | 52 | padding-bottom: 10px; |
54 | } | 53 | } |
55 | 54 | ||
56 | -#software-hostname | ||
57 | -{ | ||
58 | - float: left; | ||
59 | - display: inline-block; | ||
60 | - vertical-align: middle; | ||
61 | - | ||
62 | - background: #EEE; | ||
63 | - border: 1px solid #CFCFCF; | ||
64 | - | ||
65 | - line-height: 22px; | 55 | +#software-hostname { |
66 | padding: 0px 7px; | 56 | padding: 0px 7px; |
67 | - color: #4A4A4A; | ||
68 | - font-size: 20px; | ||
69 | - text-transform: lowercase; | ||
70 | - min-width: 190px; | ||
71 | - border-spacing: 20px; | 57 | + font-size: 18px; |
72 | } | 58 | } |
73 | 59 | ||
74 | -.mandatory::after | ||
75 | -{ | 60 | +.mandatory::after { |
76 | color: red; | 61 | color: red; |
77 | - content: ' (*)' | 62 | + content: ' (*)'; |
78 | } | 63 | } |
79 | 64 | ||
80 | .autocomplete_validation_message { | 65 | .autocomplete_validation_message { |
@@ -94,71 +79,34 @@ | @@ -94,71 +79,34 @@ | ||
94 | } | 79 | } |
95 | 80 | ||
96 | #content .softwares-block .block-footer-content a { | 81 | #content .softwares-block .block-footer-content a { |
97 | - position: absolute; | ||
98 | - top: 2px; | ||
99 | - right: 0px; | ||
100 | - font-size: 11px; | ||
101 | - color: #000; | ||
102 | - text-decoration: none; | ||
103 | - padding-right: 15px; | ||
104 | -} | ||
105 | - | ||
106 | -#content .softwares-block .block-footer-content a { | ||
107 | background: url(../../../designs/themes/base/imgs/arrow-right-p.png) 100% 50% no-repeat; | 82 | background: url(../../../designs/themes/base/imgs/arrow-right-p.png) 100% 50% no-repeat; |
108 | } | 83 | } |
109 | 84 | ||
85 | +/*FIX-ME: necessary while there is | ||
86 | +* not a defined theme style for the | ||
87 | +* forms */ | ||
110 | .improve_input_size { | 88 | .improve_input_size { |
111 | width: 315px !important; | 89 | width: 315px !important; |
112 | } | 90 | } |
113 | 91 | ||
114 | -.search-community-content-block span { | ||
115 | - width: auto; | ||
116 | -} | ||
117 | - | ||
118 | -#catalog-list ul li { | ||
119 | - display: inline; | ||
120 | - margin-right: 5px; | ||
121 | - font-size: 14px; | ||
122 | - padding: 5px; | ||
123 | - } | ||
124 | - | ||
125 | -#catalog-list ul li span { | ||
126 | - cursor: pointer; | ||
127 | - margin-left: 5px; | ||
128 | -} | ||
129 | - | ||
130 | -/* Fix software catalog list bug(it does not happen in fix_for_beta) */ | ||
131 | -.search-results-type-software_info .search-profile-item { | ||
132 | - width: 100% !important; | ||
133 | -} | ||
134 | - | ||
135 | .software-block { | 92 | .software-block { |
136 | position: relative; | 93 | position: relative; |
137 | float: left; | 94 | float: left; |
138 | - margin: 0px 10px 10px 0px; | ||
139 | - width: 30%; | ||
140 | - height: 200px; | ||
141 | - word-wrap: break-word; | ||
142 | overflow: hidden; | 95 | overflow: hidden; |
143 | } | 96 | } |
144 | 97 | ||
145 | -.software-block-logo { | ||
146 | - width: 150px; | ||
147 | - height: 150px; | ||
148 | - margin: 0px auto; | ||
149 | -} | ||
150 | - | ||
151 | .software-block-content, .software-block-finality { | 98 | .software-block-content, .software-block-finality { |
152 | width: 100%; | 99 | width: 100%; |
153 | - height: 100%; | ||
154 | position: absolute; | 100 | position: absolute; |
155 | - top: 0px; | ||
156 | - left: 0px; | ||
157 | } | 101 | } |
158 | 102 | ||
159 | -.software-block-finality { | ||
160 | - background-color: #fff; | ||
161 | - top: 100%; | ||
162 | - display: block; | ||
163 | - background-color:rgba(255, 255, 255, 0.9); | 103 | +/*===== Communities rate hotspot extra fields =====*/ |
104 | + | ||
105 | +.comments-software-extra-fields div { | ||
106 | + display: none; | ||
107 | +} | ||
108 | + | ||
109 | +#content .star-rate-form .star-comment-container .comments-display-fields { | ||
110 | + cursor: pointer; | ||
164 | } | 111 | } |
112 | + |
@@ -0,0 +1,30 @@ | @@ -0,0 +1,30 @@ | ||
1 | +modulejs.define('CommentsSoftwareExtraFields', ['jquery'], function($) { | ||
2 | + 'use strict'; | ||
3 | + | ||
4 | + var DATA = { | ||
5 | + information_display_state: "hidden" | ||
6 | + } | ||
7 | + | ||
8 | + function set_show_additional_information() { | ||
9 | + $(".comments-display-fields").on("click", function() { | ||
10 | + if (DATA.information_display_state === "hidden") { | ||
11 | + DATA.information_display_state = "show"; | ||
12 | + $(".comments-software-extra-fields div").show(); | ||
13 | + } else { | ||
14 | + DATA.information_display_state = "hidden"; | ||
15 | + $(".comments-software-extra-fields div").hide(); | ||
16 | + } | ||
17 | + }); | ||
18 | + } | ||
19 | + | ||
20 | + return { | ||
21 | + isCurrentPage: function() { | ||
22 | + return $(".star-rate-form").length === 1; | ||
23 | + }, | ||
24 | + | ||
25 | + | ||
26 | + init: function() { | ||
27 | + set_show_additional_information(); | ||
28 | + } | ||
29 | + } | ||
30 | +}); |
public/views/search-software-catalog.js
@@ -39,7 +39,11 @@ modulejs.define('SearchSoftwareCatalog', ['jquery', 'NoosferoRoot', 'SoftwareCat | @@ -39,7 +39,11 @@ modulejs.define('SearchSoftwareCatalog', ['jquery', 'NoosferoRoot', 'SoftwareCat | ||
39 | params.software_display = $("#software_display").val(); | 39 | params.software_display = $("#software_display").val(); |
40 | params.sort = $("#sort").val(); | 40 | params.sort = $("#sort").val(); |
41 | 41 | ||
42 | - params.include_non_public = $("#include_non_public").is(":checked"); | 42 | + if($("#all_radio_button").is(":checked")) { |
43 | + params.software_type = $("#all_radio_button").val(); | ||
44 | + } else { | ||
45 | + params.software_type = $("#public_software_radio_button").val(); | ||
46 | + } | ||
43 | 47 | ||
44 | return params; | 48 | return params; |
45 | } | 49 | } |
@@ -161,10 +165,8 @@ modulejs.define('SearchSoftwareCatalog', ['jquery', 'NoosferoRoot', 'SoftwareCat | @@ -161,10 +165,8 @@ modulejs.define('SearchSoftwareCatalog', ['jquery', 'NoosferoRoot', 'SoftwareCat | ||
161 | init: function() { | 165 | init: function() { |
162 | set_events(); | 166 | set_events(); |
163 | catalog_message(); | 167 | catalog_message(); |
164 | - | ||
165 | - $("#filter-categories-option").hide(); | ||
166 | - | ||
167 | SoftwareCatalogComponent.init(dispatch_search_ajax); | 168 | SoftwareCatalogComponent.init(dispatch_search_ajax); |
168 | } | 169 | } |
169 | } | 170 | } |
170 | -}); | ||
171 | \ No newline at end of file | 171 | \ No newline at end of file |
172 | +}); | ||
173 | + |
test/functional/search_controller_test.rb
@@ -68,6 +68,7 @@ class SearchControllerTest < ActionController::TestCase | @@ -68,6 +68,7 @@ class SearchControllerTest < ActionController::TestCase | ||
68 | 68 | ||
69 | community_template = create_community("Community Template") | 69 | community_template = create_community("Community Template") |
70 | community_template.is_template = true | 70 | community_template.is_template = true |
71 | + community_template.visible = false | ||
71 | community_template.save! | 72 | community_template.save! |
72 | 73 | ||
73 | get :communities, :query => "Comm" | 74 | get :communities, :query => "Comm" |
@@ -164,6 +165,55 @@ class SearchControllerTest < ActionController::TestCase | @@ -164,6 +165,55 @@ class SearchControllerTest < ActionController::TestCase | ||
164 | assert_equal assigns(:searches)[:software_infos][:results][2], @softwares[0].community | 165 | assert_equal assigns(:searches)[:software_infos][:results][2], @softwares[0].community |
165 | end | 166 | end |
166 | 167 | ||
168 | + should "software_infos search only public_software" do | ||
169 | + software_one = create_software_info("Software One", :acronym => "SFO", :finality => "Help") | ||
170 | + software_two = create_software_info("Java", :acronym => "SFT", :finality => "Task") | ||
171 | + software_three = create_software_info("Software Three", :acronym => "SFW", :finality => "Java") | ||
172 | + software_three.public_software = false | ||
173 | + software_three.save! | ||
174 | + | ||
175 | + get( | ||
176 | + :software_infos, | ||
177 | + :software_type => "public_software" | ||
178 | + ) | ||
179 | + | ||
180 | + assert_includes assigns(:searches)[:software_infos][:results], software_one.community | ||
181 | + assert_includes assigns(:searches)[:software_infos][:results], software_two.community | ||
182 | + assert_not_includes assigns(:searches)[:software_infos][:results], software_three.community | ||
183 | + end | ||
184 | + | ||
185 | + should "software_infos search public_software and other all" do | ||
186 | + software_one = create_software_info("Software One", :acronym => "SFO", :finality => "Help") | ||
187 | + software_two = create_software_info("Java", :acronym => "SFT", :finality => "Task") | ||
188 | + software_three = create_software_info("Software Three", :acronym => "SFW", :finality => "Java") | ||
189 | + software_three.public_software = false | ||
190 | + software_three.save! | ||
191 | + | ||
192 | + get( | ||
193 | + :software_infos, | ||
194 | + :software_type => "all" | ||
195 | + ) | ||
196 | + | ||
197 | + assert_includes assigns(:searches)[:software_infos][:results], software_one.community | ||
198 | + assert_includes assigns(:searches)[:software_infos][:results], software_two.community | ||
199 | + assert_includes assigns(:searches)[:software_infos][:results], software_three.community | ||
200 | + end | ||
201 | + | ||
202 | + should "software_infos search return only the software in params" do | ||
203 | + software_one = create_software_info("Software One", :acronym => "SFO", :finality => "Help") | ||
204 | + software_two = create_software_info("Java", :acronym => "SFT", :finality => "Task") | ||
205 | + software_three = create_software_info("Software Three", :acronym => "SFW", :finality => "Java") | ||
206 | + | ||
207 | + get( | ||
208 | + :software_infos, | ||
209 | + :only_softwares => ["software-three", "java"] | ||
210 | + ) | ||
211 | + | ||
212 | + assert_includes assigns(:searches)[:software_infos][:results], software_two.community | ||
213 | + assert_includes assigns(:searches)[:software_infos][:results], software_three.community | ||
214 | + assert_not_includes assigns(:searches)[:software_infos][:results], software_one.community | ||
215 | + end | ||
216 | + | ||
167 | private | 217 | private |
168 | 218 | ||
169 | def create_software_categories | 219 | def create_software_categories |
test/helpers/plugin_test_helper.rb
@@ -3,6 +3,7 @@ module PluginTestHelper | @@ -3,6 +3,7 @@ module PluginTestHelper | ||
3 | def create_community name | 3 | def create_community name |
4 | community = fast_create(Community) | 4 | community = fast_create(Community) |
5 | community.name = name | 5 | community.name = name |
6 | + community.identifier = name.to_slug | ||
6 | community.save | 7 | community.save |
7 | community | 8 | community |
8 | end | 9 | end |
@@ -0,0 +1,17 @@ | @@ -0,0 +1,17 @@ | ||
1 | +require File.dirname(__FILE__) + '/../../../../test/test_helper' | ||
2 | +require File.dirname(__FILE__) + '/../../lib/ext/comments.rb' | ||
3 | + | ||
4 | +class CommentsTest < ActiveSupport::TestCase | ||
5 | + | ||
6 | + def teardown | ||
7 | + Comment.destroy_all | ||
8 | + end | ||
9 | + | ||
10 | + should 'create comments with new fields' do | ||
11 | + @person = fast_create(Person) | ||
12 | + @article = Article.create(:profile => @person, :name => "Test") | ||
13 | + | ||
14 | + comment = Comment.new(:body => "Comment new", :author => @person, :people_benefited => 2, :saved_value => 38.5) | ||
15 | + assert comment.save | ||
16 | + end | ||
17 | +end |
views/blocks/download.html.erb
1 | <% if block.owner.software_info.nil? %> | 1 | <% if block.owner.software_info.nil? %> |
2 | <%= _("This community needs a software to use this block") %> | 2 | <%= _("This community needs a software to use this block") %> |
3 | <% else %> | 3 | <% else %> |
4 | - <div id="download-block-2"> | ||
5 | - <div id="download_spb-2"><h3> <%= _("Download #{block.owner.software_info.community.name}") %> </h3></div> | ||
6 | - | 4 | + <h3 class="block-title"> <%= _("Download #{block.owner.software_info.community.name}") %> </h3> |
5 | + <ul class="download-list"> | ||
7 | <% block.downloads.each_with_index do |download, index| %> | 6 | <% block.downloads.each_with_index do |download, index| %> |
8 | - <div id="download-info-<%=(index+1)%>"> | ||
9 | - <div id="version01"> | ||
10 | - <%= link_to download[:link], title: _("Download the software"), download: block.owner.name do %> | ||
11 | - <span id="image-download"></span> | ||
12 | - <span id="size-download"><%= download[:size] %></span> | ||
13 | - <% end %> | ||
14 | - </div> | ||
15 | - <div id="info-software-download"> | ||
16 | - <span class="download-name"><%= _("#{download[:name]}") %></span> | ||
17 | - <span class="download-system"><%= _("Platform:#{download[:software_description]}") %> </span> | ||
18 | - <span class="req_min_spb"><%= link_to _("Minimum Requirements"), download[:minimum_requirements] %></span> | ||
19 | - </div> | 7 | + <li id="download-item-<%=(index+1)%>"> |
8 | + <div class="download-button"> | ||
9 | + <%= link_to download[:link], title: _("Download the software") do %> | ||
10 | + <span class="download-image"></span> | ||
11 | + <span class="download-size"><%= download[:size] %></span> | ||
12 | + <% end %> | ||
20 | </div> | 13 | </div> |
14 | + <div class="download-info"> | ||
15 | + <span class="download-name"><%= _("#{download[:name]}") %></span> | ||
16 | + <span class="download-platform"><%= _("Platform:#{download[:software_description]}") %> </span> | ||
17 | + <span class="min-requirements"><%= link_to _("Minimum Requirements"), download[:minimum_requirements] %></span> | ||
18 | + </div> | ||
19 | + </li> | ||
21 | <% end %> | 20 | <% end %> |
22 | - | 21 | + </ul> |
23 | <div id="licensed-software"> | 22 | <div id="licensed-software"> |
24 | <%= link_to _("License: #{block.owner.software_info.license_info.version}"), block.owner.software_info.license_info.link %> | 23 | <%= link_to _("License: #{block.owner.software_info.license_info.version}"), block.owner.software_info.license_info.link %> |
25 | - </div> | ||
26 | </div> | 24 | </div> |
27 | <% end %> | 25 | <% end %> |
views/blocks/software_information.html.erb
@@ -27,6 +27,8 @@ | @@ -27,6 +27,8 @@ | ||
27 | <b> | 27 | <b> |
28 | <%= block.owner.software_info.finality %> | 28 | <%= block.owner.software_info.finality %> |
29 | </b> | 29 | </b> |
30 | + | ||
31 | + <%= @plugins.dispatch(:display_community_average_rating, block.owner).collect { |content| instance_exec(&content) }.join("") %> | ||
30 | </td> | 32 | </td> |
31 | </tr> | 33 | </tr> |
32 | </table> | 34 | </table> |
@@ -0,0 +1,21 @@ | @@ -0,0 +1,21 @@ | ||
1 | +<div class="comments-display-fields"> | ||
2 | + <span id="comments-additional-information"> | ||
3 | + <%= _("Additional informations") %> | ||
4 | + </span> | ||
5 | + | ||
6 | + <span class="comments-arrow-down"></span> | ||
7 | +</div> | ||
8 | + | ||
9 | +<div class="comments-software-extra-fields"> | ||
10 | + <div class="comments-software-people-benefited"> | ||
11 | + <%= label_tag "comments_people_benefited", _("Number of Beneficiaries")%> | ||
12 | + <span class="star-tooltip" title="Quantidade de pessoas beneficiadas com a utilização do software"></span> | ||
13 | + <%= text_field_tag "comments[people_benefited]", "" %> | ||
14 | + </div> | ||
15 | + | ||
16 | + <div class="comments-software-saved-values"> | ||
17 | + <%= label_tag "comments_saved_value", _("Saved resources")%> | ||
18 | + <span class="star-tooltip" title="Valores em “Real” economizados com a utilização do software"></span> | ||
19 | + <%= text_field_tag "comments[saved_value]", "", :placeholder=>"R$"%> | ||
20 | + </div> | ||
21 | +</div> |
views/communities_ratings_extra_fields_show_data.html.erb
0 → 100644
@@ -0,0 +1,10 @@ | @@ -0,0 +1,10 @@ | ||
1 | +<div class="aditional-informations"> | ||
2 | + <div class="comments-people-benefited"> | ||
3 | + <span>People benefited :</span> <%= user_rating.comment.people_benefited unless user_rating.comment.nil? %> | ||
4 | + </div> | ||
5 | + | ||
6 | + <div class="comments-saved-value"> | ||
7 | + <span>Saved Value :</span> <%= user_rating.comment.saved_value unless user_rating.comment.nil? %> | ||
8 | + </div> | ||
9 | +</div> | ||
10 | + |
views/search/_catalog_filter.html.erb
1 | -<div id="main-content-wrapper-8"> <!-- id do Noosfero --> | ||
2 | - | ||
3 | - <div id="filter-catalog-software"> | ||
4 | - | ||
5 | - <div id="filter-option-catalog-software"><%= _("More options") %></div> | ||
6 | - <!--Quando tiver filtros(categorias)selecionados mostrar esta opção: Opções selecionadas--> | ||
7 | - | ||
8 | - <div id="filter-categories-select-catalog"><%= @message_selected_options %></div> | ||
9 | - | ||
10 | - <div id="filter-categories-option"> | ||
11 | - | ||
12 | - <div id="filter-categories-catalog"><h4> <%= _("Categories") %> </h4></div> | ||
13 | - <div id="group-categories"> | ||
14 | - <div id="gruop-catalog-01"> | ||
15 | - <% @categories_groupe_one.each do |category| %> | ||
16 | - <label> | ||
17 | - <%= check_box_tag("selected_categories_id[]", category.id, @selected_categories_id.include?(category.id), :class => "categories-catalog", @enabled_check_box[category] => "true") %> | ||
18 | - <span><%= _("#{category.name}") %></span> | ||
19 | - </label> <br> | ||
20 | - <% end %> | ||
21 | - </div> | ||
22 | - <div id="group-catalog-02"> | ||
23 | - <% @categories_groupe_two.each do |category| %> | ||
24 | - <label> | ||
25 | - <%= check_box_tag("selected_categories_id[]", category.id, @selected_categories_id.include?(category.id), :class => "categories-catalog", @enabled_check_box[category] => "true") %> | ||
26 | - <%= _("#{category.name}") %> | ||
27 | - </label> <br> | ||
28 | - <% end %> | ||
29 | - <br /> | ||
30 | - </div> | ||
31 | - </div> | ||
32 | - | ||
33 | - <div class="project-software"> <%= _("Software Projects:") %> | ||
34 | - <label> | ||
35 | - <%= check_box_tag("include_non_public", true, @include_non_public) %> | ||
36 | - <%= _("Include in results") %> | ||
37 | - </label> | ||
38 | - <span class"doubts-catalog-software" title="<%= _('Include software development projects that are not yet officially Brazilian Public Software.') %>">(?)</span> | ||
39 | - </div> | ||
40 | - | ||
41 | - <br /> | ||
42 | - | ||
43 | - <%= button_tag _("Clean up"), :id => "cleanup-filter-catalg", :type => "button" %> | ||
44 | - <%= button_tag _("Close"), :id => "close-filter-catalog", :type => "button" %> | 1 | +<div id="filter-catalog-software"> |
2 | + | ||
3 | + <div id="filter-categories-option"> | ||
4 | + <div id="filter-categories-catalog"><h4> <%= _("Categories") %> </h4></div> | ||
5 | + <div id="group-categories"> | ||
6 | + <ul> | ||
7 | + <% @categories.each do |category| %> | ||
8 | + <li> | ||
9 | + <%= check_box_tag("selected_categories_id[]", category.id, @selected_categories_id.include?(category.id), :class => "categories-catalog", @enabled_check_box[category] => "true") %> | ||
10 | + <span><%= _("#{category.name}") %></span> | ||
11 | + </li> | ||
12 | + <% end %> | ||
13 | + </ul> | ||
45 | </div> | 14 | </div> |
46 | - | ||
47 | -</div> | 15 | + </div> |
16 | + <div id="filter-option-catalog-software"><%= _("More options") %></div> | ||
17 | + <div id="filter-option-catalog-close"> | ||
18 | + <%= button_tag _("Clean up"), :id => "cleanup-filter-catalg", :type => "button" %> | ||
19 | + <%= button_tag _("Close"), :id => "close-filter-catalog", :type => "button" %> | ||
20 | + </div> |
views/search/_catalog_result_list.html.erb
@@ -4,47 +4,45 @@ | @@ -4,47 +4,45 @@ | ||
4 | 4 | ||
5 | <input type="hidden" id="empty_result" value="<%= search[:results].blank? %>" /> | 5 | <input type="hidden" id="empty_result" value="<%= search[:results].blank? %>" /> |
6 | 6 | ||
7 | - <div class="search-results-<%= name %> search-results-box"> | ||
8 | - <% if !search[:results].blank? %> | 7 | + <% if !search[:results].blank? %> |
9 | 8 | ||
10 | - <% if multiple_search?(@searches) %> | ||
11 | - <h3><%= @names[name] %></h3> | ||
12 | - <% if search[:results].total_entries > SearchController::MULTIPLE_SEARCH_LIMIT %> | ||
13 | - <%= link_to(_('see all (%d)') % search[:results].total_entries, params.merge(:action => name), :class => 'see-more' ) %> | ||
14 | - <% end %> | 9 | + <% if multiple_search?(@searches) %> |
10 | + <h3><%= @names[name] %></h3> | ||
11 | + <% if search[:results].total_entries > SearchController::MULTIPLE_SEARCH_LIMIT %> | ||
12 | + <%= link_to(_('see all (%d)') % search[:results].total_entries, params.merge(:action => name), :class => 'see-more' ) %> | ||
15 | <% end %> | 13 | <% end %> |
14 | + <% end %> | ||
16 | 15 | ||
17 | - <% display = display_filter(name, params[:display]) %> | ||
18 | - | ||
19 | - <div class="search-results-innerbox search-results-type-<%= name.to_s.singularize %> <%= 'common-profile-list-block' if SearchHelper::COMMON_PROFILE_LIST_BLOCK.include?(name) %>"> | ||
20 | - <ul> | ||
21 | - <% search[:results].each do |hit| %> | ||
22 | - <% partial = partial_for_class(hit.class, display) %> | ||
23 | - <% variable_name = partial.gsub("#{display}_", '').to_sym %> | ||
24 | - <%= render :partial => partial, :locals => {variable_name => hit} %> | ||
25 | - <% end %> | ||
26 | - </ul> | ||
27 | - </div> | ||
28 | - <% else %> | ||
29 | - <% if multiple_search? %> | ||
30 | - <h3><%= @names[name] %></h3> | ||
31 | - <% end %> | 16 | + <% display = display_filter(name, params[:display]) %> |
32 | 17 | ||
33 | - <div id="search-results-empty"></div> | 18 | + <div class="search-results-innerbox <%= 'common-profile-list-block' if SearchHelper::COMMON_PROFILE_LIST_BLOCK.include?(name) %>"> |
19 | + <ul> | ||
20 | + <% search[:results].each do |hit| %> | ||
21 | + <% partial = partial_for_class(hit.class, display) %> | ||
22 | + <% variable_name = partial.gsub("#{display}_", '').to_sym %> | ||
23 | + <%= render :partial => partial, :locals => {variable_name => hit} %> | ||
24 | + <% end %> | ||
25 | + </ul> | ||
26 | + </div> | ||
27 | + <% else %> | ||
28 | + <% if multiple_search? %> | ||
29 | + <h3><%= @names[name] %></h3> | ||
30 | + <% end %> | ||
34 | 31 | ||
35 | - <input type="hidden" id="message-no-catalog-selected" value="<%= _('No software found. Try more general filters') %>" /> | 32 | + <div id="search-results-empty"></div> |
36 | 33 | ||
37 | - <input type="hidden" id="message-catalog-selected" value="<%= _('No software found. Try more general filters or check the software category individually') %>" /> | 34 | + <input type="hidden" id="message-no-catalog-selected" value="<%= _('No software found. Try more general filters') %>" /> |
38 | 35 | ||
39 | - <div id="individually-category"> | ||
40 | - <% @selected_categories.each do |category| %> | ||
41 | - <br /> | ||
42 | - <%= link_to _("#{category.name}") + " (#{category.software_infos.count})", {:controller => :search, :action => :software_infos, :selected_categories_id => [category.id]} %> | ||
43 | - <% end %> | ||
44 | - </div> | 36 | + <input type="hidden" id="message-catalog-selected" value="<%= _('No software found. Try more general filters or check the software category individually') %>" /> |
45 | 37 | ||
46 | - <% end %> | ||
47 | - </div> | 38 | + <div id="individually-category"> |
39 | + <% @selected_categories.each do |category| %> | ||
40 | + <br /> | ||
41 | + <%= link_to _("#{category.name}") + " (#{category.software_infos.count})", {:controller => :search, :action => :software_infos, :selected_categories_id => [category.id]} %> | ||
42 | + <% end %> | ||
43 | + </div> | ||
44 | + | ||
45 | + <% end %> | ||
48 | <% end %> | 46 | <% end %> |
49 | 47 | ||
50 | <div style="clear:both"></div> | 48 | <div style="clear:both"></div> |
views/search/_full_community.html.erb
1 | <% software = community.software_info %> | 1 | <% software = community.software_info %> |
2 | -<li class="search-profile-item"> | ||
3 | - <div class="search-enterprise-item"> | ||
4 | - <div class="search-enterprise-item-column-left"> | ||
5 | - <%= profile_image_link community, :portrait, 'div', community.send(@order + '_label') + show_date(community.created_at) %> | ||
6 | - </div> | 2 | +<li class="search-software-item"> |
3 | + <div class="search-software-item-column-left"> | ||
4 | + <%= profile_image_link community, :portrait, 'div', community.send(@order + '_label') + show_date(community.created_at) %> | ||
5 | + </div> | ||
7 | 6 | ||
8 | - <div class="search-enterprise-item-column-right"> | 7 | + <div class="search-software-item-column-right"> |
9 | 8 | ||
10 | - <div class="search-community-content-block"> | ||
11 | - <span> | ||
12 | - <% link_name = software.acronym.blank? ? community.name : "#{software.acronym} - #{community.name}" %> | ||
13 | - <h4> | ||
14 | - <%= link_to_homepage(link_name, community.identifier) %> | ||
15 | - </h4> | ||
16 | - </span> | ||
17 | - <span class="search-content-result"> | ||
18 | - <% body_stripped = strip_tags(software.finality) %> | ||
19 | - <%= excerpt(body_stripped, body_stripped.first(3), 200) if body_stripped %> | ||
20 | - </span> | ||
21 | - </div> | 9 | + <div class="search-software-content-block"> |
10 | + <span> | ||
11 | + <% link_name = software.acronym.blank? ? community.name : "#{software.acronym} - #{community.name}" %> | ||
12 | + <h4> | ||
13 | + <%= link_to_homepage(link_name, community.identifier) %> | ||
14 | + </h4> | ||
15 | + </span> | ||
16 | + <span class="search-content-result"> | ||
17 | + <% body_stripped = strip_tags(software.finality) %> | ||
18 | + <%= excerpt(body_stripped, body_stripped.first(3), 200) if body_stripped %> | ||
19 | + </span> | ||
20 | + </div> | ||
21 | + | ||
22 | + <br /> | ||
22 | 23 | ||
23 | - <br /> | 24 | + <div class="search-software-content-block"> |
25 | + <span> | ||
26 | + <b> | ||
27 | + <%= _("Software Categories") %>: | ||
28 | + </b> | ||
29 | + </span> | ||
24 | 30 | ||
25 | - <div class="search-community-content-block"> | 31 | + <% if !community.categories.empty? %> |
32 | + <ul id="categories-list"> | ||
33 | + <% community.categories.each do |category| %> | ||
34 | + <li> | ||
35 | + <%= link_to _("#{category.name}"), { | ||
36 | + :controller => :search, | ||
37 | + :action => :software_infos, | ||
38 | + :selected_categories_id => [category.id], | ||
39 | + :include_non_public => !community.software_info.public_software? | ||
40 | + } %> | ||
41 | + </li> | ||
42 | + <% end %> | ||
43 | + </ul> | ||
44 | + <% else %> | ||
26 | <span> | 45 | <span> |
27 | - <b> | ||
28 | - <%= _("Software Categories") %>: | ||
29 | - </b> | 46 | + <%= _("This software doesn't have categories") %> |
30 | </span> | 47 | </span> |
31 | - | ||
32 | - <% if !community.categories.empty? %> | ||
33 | - <ul id="categories-list"> | ||
34 | - <% community.categories.each do |category| %> | ||
35 | - <li> | ||
36 | - <%= link_to _("#{category.name}"), { | ||
37 | - :controller => :search, | ||
38 | - :action => :software_infos, | ||
39 | - :selected_categories => [category.id], | ||
40 | - :include_non_public => !community.software_info.public_software? | ||
41 | - } %> | ||
42 | - </li> | ||
43 | - <% end %> | ||
44 | - </ul> | ||
45 | - <% else %> | ||
46 | - <span> | ||
47 | - <%= _("This software doesn't have categories") %> | ||
48 | - </span> | ||
49 | - <% end %> | ||
50 | - </div> | 48 | + <% end %> |
51 | </div> | 49 | </div> |
52 | - | ||
53 | - <hr class="clearfix" /> | ||
54 | </div> | 50 | </div> |
51 | + | ||
52 | + <hr class="clearfix" /> | ||
55 | </li> | 53 | </li> |
views/search/_software_search_form.html.erb
1 | -<div class='search-form'> | ||
2 | - <h3> <%= _("Search Public Software Catalog") %> </h3> | 1 | +<div> |
2 | + <div class='search-form'> | ||
3 | + <h3> <%= _("Search Public Software Catalog") %> </h3> | ||
3 | 4 | ||
4 | - <%= form_tag( { :controller => 'search', :action => @asset ? @asset : 'index', :asset => nil, :category_path => ( @category ? @category.path : nil ) }, | ||
5 | - :method => 'get', :class => 'search_form' ) do %> | 5 | + <%= form_tag( { :controller => 'search', :action => @asset ? @asset : 'index', :asset => nil, :category_path => ( @category ? @category.path : nil ) }, |
6 | + :method => 'get') do %> | ||
6 | 7 | ||
7 | - <div style="margin:0;padding:0;display:inline"> | 8 | + <div style="margin:0;padding:0;display:inline"> |
8 | <input name="utf8" type="hidden" value="✓" /></div> | 9 | <input name="utf8" type="hidden" value="✓" /></div> |
9 | - <%= hidden_field_tag :display, params[:display] %> | ||
10 | - <%= hidden_field_tag :filter, params[:filter] %> | ||
11 | 10 | ||
12 | - <div class="search-field"> | ||
13 | - <span class="formfield"> | ||
14 | - <%= text_field_tag 'query', @query, :id => 'search-input', :size => 50, :placeholder=>_("Type words about the software you're looking for (the search begins after 3 characters)") %> | ||
15 | - </span> | 11 | + <%= hidden_field_tag :display, params[:display] %> |
12 | + <%= hidden_field_tag :filter, params[:filter] %> | ||
13 | + | ||
14 | + <%= labelled_radio_button _('Public Software'), :software_type, 'public_software', @public_software_selected, :id => "public_software_radio_button", :class => "project-software" %> | ||
15 | + <span class"doubts-catalog-software" title="<%= _('Public Software.') %>">?</span> | ||
16 | + | ||
17 | + <%= labelled_radio_button _('All'), :software_type, 'all', @all_selected, :id => "all_radio_button", :class => "project-software" %> | ||
18 | + <span class"doubts-catalog-software" title="<%= _('All.') %>">?</span> | ||
19 | + | ||
20 | + <div class="search-field"> | ||
21 | + <span class="formfield"> | ||
22 | + <%= text_field_tag 'query', @query, :id => 'search-input', :size => 50, :placeholder=>_("Type words about the software you're looking for (the search begins after 3 characters)") %> | ||
23 | + </span> | ||
16 | 24 | ||
17 | <%= submit_button(:search, _('Filter')) %> | 25 | <%= submit_button(:search, _('Filter')) %> |
18 | - </div> | 26 | + </div> |
19 | <%= render :partial => 'search_form_extra_fields' %> | 27 | <%= render :partial => 'search_form_extra_fields' %> |
20 | <%= render :partial => 'catalog_filter' %> | 28 | <%= render :partial => 'catalog_filter' %> |
29 | + <% end %> | ||
30 | + </div> | ||
21 | 31 | ||
22 | - <br /> | 32 | + <div id="catalog-display-options"> |
33 | + <div id="catalog-display-options-count"> | ||
34 | + <strong id="software-count"><%= "#{@software_count} Software(s)" %></strong> | ||
35 | + </div> | ||
23 | 36 | ||
24 | - <div id="catalog-display-options"> | ||
25 | - <div id="catalog-display-options-count"> | ||
26 | - <strong id="software-count"><%= "#{@software_count} Software(s)" %></strong> | 37 | + <div id="catalog-display-options-show-and-sort"> |
38 | + <div id="catalog-display-options-show"> | ||
39 | + Show: | ||
40 | + <%= select_tag("software_display", | ||
41 | + options_for_select(['15', '30', '90', 'All'], :selected=>params[:display]) | ||
42 | + ) %> | ||
27 | </div> | 43 | </div> |
28 | 44 | ||
29 | - <div id="catalog-display-options-show-and-sort"> | ||
30 | - <div id="catalog-display-options-show"> | ||
31 | - Show: | ||
32 | - <%= select_tag("software_display", | ||
33 | - options_for_select(['15', '30', '90', 'All'], :selected=>params[:display]) | ||
34 | - ) %> | ||
35 | - </div> | ||
36 | - | ||
37 | - <div id="catalog-display-options-sort"> | ||
38 | - Sort by: | ||
39 | - <%= select_tag("sort", | ||
40 | - options_for_select( | ||
41 | - [ | ||
42 | - [_("Name A-Z"), 'asc'], | ||
43 | - [_("Name Z-A"), 'desc'], | ||
44 | - [_("Relevance"), 'relevance'] | 45 | + <div id="catalog-display-options-sort"> |
46 | + Sort by: | ||
47 | + <%= select_tag("sort", | ||
48 | + options_for_select( | ||
49 | + [ | ||
50 | + [_("Name A-Z"), 'asc'], | ||
51 | + [_("Name Z-A"), 'desc'], | ||
52 | + [_("Relevance"), 'relevance'] | ||
45 | ], :selected=>params[:sort]) | 53 | ], :selected=>params[:sort]) |
46 | - ) %> | ||
47 | - </div> | 54 | + ) %> |
48 | </div> | 55 | </div> |
49 | </div> | 56 | </div> |
50 | - <% end %> | 57 | + </div> |
58 | +</div> | ||
51 | 59 | ||
52 | - <% if @empty_query %> | ||
53 | - <% hint = environment.search_hints[@asset] %> | ||
54 | - <% if hint and !hint.blank? %> | ||
55 | - <div class="search-hint"><%= hint %></div> | ||
56 | - <% end %> | 60 | +<% if @empty_query %> |
61 | + <% hint = environment.search_hints[@asset] %> | ||
62 | + <% if hint and !hint.blank? %> | ||
63 | + <div class="search-hint"><%= hint %></div> | ||
57 | <% end %> | 64 | <% end %> |
58 | - | ||
59 | - <div style="clear: both"></div> | ||
60 | -</div> | 65 | +<% end %> |
views/search/software_infos.html.erb
@@ -5,8 +5,6 @@ | @@ -5,8 +5,6 @@ | ||
5 | 5 | ||
6 | <%= render :partial => 'software_search_form', :locals => { :hint => _("Type words about the %s you're looking for") % @asset.to_s.singularize } %> | 6 | <%= render :partial => 'software_search_form', :locals => { :hint => _("Type words about the %s you're looking for") % @asset.to_s.singularize } %> |
7 | 7 | ||
8 | - <div style="clear: both"></div> | ||
9 | - | ||
10 | <% if @asset == :product %> | 8 | <% if @asset == :product %> |
11 | <%= javascript_tag do %> | 9 | <%= javascript_tag do %> |
12 | jQuery('.search-product-price-details').altBeautify(); | 10 | jQuery('.search-product-price-details').altBeautify(); |
@@ -20,4 +18,4 @@ | @@ -20,4 +18,4 @@ | ||
20 | <% if params[:display] != 'map' %> | 18 | <% if params[:display] != 'map' %> |
21 | <%= pagination_links @searches[@asset][:results] %> | 19 | <%= pagination_links @searches[@asset][:results] %> |
22 | <% end %> | 20 | <% end %> |
23 | -</div> | ||
24 | \ No newline at end of file | 21 | \ No newline at end of file |
22 | +</div> |