Commit fba92e059456df3e3e3e9b4aa6491c37a1055d74
Exists in
master
and in
5 other branches
Merge branch 'software-catalog'
Showing
10 changed files
with
149 additions
and
45 deletions
Show diff stats
lib/ext/search_controller.rb
| ... | ... | @@ -9,6 +9,16 @@ class SearchController |
| 9 | 9 | @search = results |
| 10 | 10 | end |
| 11 | 11 | |
| 12 | + def institutions | |
| 13 | + @titles[:institutions] = _("Institution Catalog") | |
| 14 | + @category_filters = [] | |
| 15 | + results = filter_communities_list{|community| community.institution?} | |
| 16 | + results = results.paginate(:per_page => 24, :page => params[:page]) | |
| 17 | + @searches[@asset] = {:results => results} | |
| 18 | + @search = results | |
| 19 | + end | |
| 20 | + | |
| 21 | + | |
| 12 | 22 | def software_infos |
| 13 | 23 | @titles[:software_infos] = _("Software Catalog") |
| 14 | 24 | @category_filters = [] |
| ... | ... | @@ -40,4 +50,4 @@ class SearchController |
| 40 | 50 | end |
| 41 | 51 | communities_list |
| 42 | 52 | end |
| 43 | -end | |
| 44 | 53 | \ No newline at end of file |
| 54 | +end | ... | ... |
lib/ext/search_helper.rb
| ... | ... | @@ -2,6 +2,8 @@ require_dependency 'search_helper' |
| 2 | 2 | |
| 3 | 3 | module SearchHelper |
| 4 | 4 | |
| 5 | - COMMON_PROFILE_LIST_BLOCK << :software_infos | |
| 5 | + COMMON_PROFILE_LIST_BLOCK ||= [] | |
| 6 | + COMMON_PROFILE_LIST_BLOCK << :software_infos | |
| 7 | + COMMON_PROFILE_LIST_BLOCK << :institutions | |
| 6 | 8 | |
| 7 | -end | |
| 8 | 9 | \ No newline at end of file |
| 10 | +end | ... | ... |
lib/institution.rb
lib/software_info.rb
| 1 | 1 | class SoftwareInfo < ActiveRecord::Base |
| 2 | 2 | SEARCH_FILTERS = [] |
| 3 | + SEARCH_DISPLAYS = %w[compact] | |
| 4 | + | |
| 5 | + def self.default_search_display | |
| 6 | + 'compact' | |
| 7 | + end | |
| 3 | 8 | |
| 4 | 9 | attr_accessible :e_mag, :icp_brasil, :intern, :e_ping, :e_arq, :operating_platform |
| 5 | 10 | attr_accessible :demonstration_url, :acronym, :objectives, :features, :license_info |
| ... | ... | @@ -50,10 +55,6 @@ class SoftwareInfo < ActiveRecord::Base |
| 50 | 55 | } |
| 51 | 56 | } |
| 52 | 57 | |
| 53 | - def self.default_search_display | |
| 54 | - 'compact' | |
| 55 | - end | |
| 56 | - | |
| 57 | 58 | def validate_name_lenght |
| 58 | 59 | if self.community.name.size > 100 |
| 59 | 60 | self.errors.add(:base, _("Name is too long (maximum is %{count} characters)")) | ... | ... |
lib/softwares_block.rb
| ... | ... | @@ -31,7 +31,7 @@ class SoftwaresBlock < CommunitiesBlock |
| 31 | 31 | end |
| 32 | 32 | when Environment |
| 33 | 33 | lambda do |context| |
| 34 | - link_to s_('softwares|View all'), :controller => 'search', :action => 'communities', :type => 'Software' | |
| 34 | + link_to s_('softwares|View all'), :controller => 'search', :action => 'software_infos' | |
| 35 | 35 | end |
| 36 | 36 | else |
| 37 | 37 | '' | ... | ... |
public/style.css
| ... | ... | @@ -197,4 +197,36 @@ |
| 197 | 197 | |
| 198 | 198 | .improve_input_size { |
| 199 | 199 | width: 315px !important; |
| 200 | +} | |
| 201 | + | |
| 202 | +.search-community-content-block span { | |
| 203 | + width: auto; | |
| 204 | +} | |
| 205 | + | |
| 206 | +#catalog-list ul li { | |
| 207 | + display: inline; | |
| 208 | + margin-right: 5px; | |
| 209 | + font-size: 14px; | |
| 210 | + padding: 5px; | |
| 211 | + } | |
| 212 | + | |
| 213 | +#catalog-list ul li span { | |
| 214 | + cursor: pointer; | |
| 215 | + margin-left: 5px; | |
| 216 | +} | |
| 217 | + | |
| 218 | +.catalog-remove-item { | |
| 219 | + padding: 3px; | |
| 220 | + border: solid 1px #999; | |
| 221 | + border-radius: 3px; | |
| 222 | +} | |
| 223 | + | |
| 224 | +.category_box { | |
| 225 | + font-size: 11px; | |
| 226 | + border:1px solid #e9e8ed; | |
| 227 | + border-radius:8px; | |
| 228 | + background-color:#e9e8ed; | |
| 229 | + padding:3px 6px; | |
| 230 | + margin:10px 3px; | |
| 231 | + color: blue; | |
| 200 | 232 | } |
| 201 | 233 | \ No newline at end of file | ... | ... |
test/functional/search_controller_test.rb
| ... | ... | @@ -58,4 +58,15 @@ class SearchControllerTest < ActionController::TestCase |
| 58 | 58 | assert_not_includes assigns(:searches)[:software_infos][:results], software_without_category.community |
| 59 | 59 | end |
| 60 | 60 | |
| 61 | + should "institutions_search don't have community or software" do | |
| 62 | + community = create_community("New Community") | |
| 63 | + software = create_software_info("New Software") | |
| 64 | + institution = create_private_institution("New Private Institution", "NPI" , "Brazil", "DF", "Gama", "66.544.314/0001-63") | |
| 65 | + | |
| 66 | + get :institutions, :query => "New" | |
| 67 | + | |
| 68 | + assert_includes assigns(:searches)[:institutions][:results], institution.community | |
| 69 | + assert_not_includes assigns(:searches)[:institutions][:results], community | |
| 70 | + assert_not_includes assigns(:searches)[:institutions][:results], software.community | |
| 71 | + end | |
| 61 | 72 | end | ... | ... |
views/search/_catalog_filter.html.erb
| 1 | -<!-- Remove CSS when design team send corrections --> | |
| 2 | -<style type="text/css"> | |
| 3 | - #catalog-list ul li { | |
| 4 | - display: inline; | |
| 5 | - margin-right: 5px; | |
| 6 | - font-size: 14px; | |
| 7 | - padding: 5px; | |
| 8 | - } | |
| 9 | - | |
| 10 | - #catalog-list ul li span { | |
| 11 | - display: none; | |
| 12 | - cursor: pointer; | |
| 13 | - } | |
| 14 | - | |
| 15 | - #catalog-list ul li:hover span { | |
| 16 | - display: inline-block; | |
| 17 | - } | |
| 18 | - | |
| 19 | - .catalog-remove-item { | |
| 20 | - padding: 3px; | |
| 21 | - border: solid 1px #999; | |
| 22 | - border-radius: 3px; | |
| 23 | - background: #d4d4d4; | |
| 24 | - } | |
| 25 | - | |
| 26 | - .category_box { | |
| 27 | - font-size: 11px !important; | |
| 28 | - border:1px solid #e9e8ed; | |
| 29 | - border-radius:8px; | |
| 30 | - background-color:#e9e8ed; | |
| 31 | - padding:3px 6px; | |
| 32 | - margin:10px 3px; | |
| 33 | - color: blue; | |
| 34 | - } | |
| 35 | -</style> | |
| 36 | - | |
| 37 | 1 | <div> |
| 38 | 2 | <div id="catalog-list"> |
| 39 | 3 | <ul> |
| ... | ... | @@ -46,6 +10,7 @@ |
| 46 | 10 | </div> |
| 47 | 11 | |
| 48 | 12 | <div id="catalog-filter"> |
| 49 | - <%= text_field(:software, :catalog, :id=>"software-catalog") %> | |
| 13 | + <span><%= _("Categories filter") %>:</span> | |
| 14 | + <%= text_field(:software, :catalog, :id=>"software-catalog", :placeholder=>_("Type a category name here")) %> | |
| 50 | 15 | </div> |
| 51 | 16 | </div> |
| 52 | 17 | \ No newline at end of file | ... | ... |
| ... | ... | @@ -0,0 +1,57 @@ |
| 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(@filter + '_label') + show_date(community.created_at) %> | |
| 6 | + </div> | |
| 7 | + | |
| 8 | + <div class="search-enterprise-item-column-right"> | |
| 9 | + | |
| 10 | + <div class="search-community-content-block"> | |
| 11 | + <span> | |
| 12 | + <% link_name = software.acronym.blank? ? community.name : "#{software.acronym} - #{community.name}" %> | |
| 13 | + <%= link_to_homepage(link_name, community.identifier, :class => "search-result-title") %> | |
| 14 | + </span> | |
| 15 | + | |
| 16 | + <p> | |
| 17 | + <% body_stripped = strip_tags(software.finality) %> | |
| 18 | + <%= excerpt(body_stripped, body_stripped.first(3), 200) if body_stripped %> | |
| 19 | + </p> | |
| 20 | + </div> | |
| 21 | + | |
| 22 | + <div class="search-community-content-block"> | |
| 23 | + <span> | |
| 24 | + <%= _("Software licence") %>: | |
| 25 | + <%= link_to(software.license_info.version, software.license_info.link, :target=>"blank", :class => "search-result-title") %> | |
| 26 | + </span> | |
| 27 | + </div> | |
| 28 | + | |
| 29 | + <div class="search-community-content-block"> | |
| 30 | + <span> | |
| 31 | + <%= _("Link software repository") %>: | |
| 32 | + <%= link_to(software.repository_link, software.repository_link, :target=>"blank", :class => "search-result-title") %> | |
| 33 | + </span> | |
| 34 | + </div> | |
| 35 | + | |
| 36 | + <div class="search-community-content-block"> | |
| 37 | + <span> | |
| 38 | + <%= _("Software Categories") %> | |
| 39 | + </span> | |
| 40 | + | |
| 41 | + <% if not community.categories.empty? %> | |
| 42 | + <ul> | |
| 43 | + <% community.categories.each do |category| %> | |
| 44 | + <li> <%= category.name %> </li> | |
| 45 | + <% end %> | |
| 46 | + </ul> | |
| 47 | + <% else %> | |
| 48 | + <p> | |
| 49 | + <span><%= _("This software doesn't has categories") %></span> | |
| 50 | + </p> | |
| 51 | + <% end %> | |
| 52 | + </div> | |
| 53 | + </div> | |
| 54 | + | |
| 55 | + <hr class="clearfix" /> | |
| 56 | + </div> | |
| 57 | +</li> | ... | ... |
| ... | ... | @@ -0,0 +1,18 @@ |
| 1 | +<%= search_page_title( @titles[@asset], @category ) %> | |
| 2 | + | |
| 3 | +<%= render :partial => 'search_form', :locals => { :hint => _("Type words about the %s you're looking for") % @asset.to_s.singularize } %> | |
| 4 | + | |
| 5 | +<%= render :partial => 'results_header' %> | |
| 6 | + | |
| 7 | +<%= display_results(@searches, @asset) %> | |
| 8 | +<% if params[:display] != 'map' %> | |
| 9 | + <%= pagination_links @searches[@asset][:results] %> | |
| 10 | +<% end %> | |
| 11 | + | |
| 12 | +<div style="clear: both"></div> | |
| 13 | + | |
| 14 | +<% if @asset == :product %> | |
| 15 | + <%= javascript_tag do %> | |
| 16 | + jQuery('.search-product-price-details').altBeautify(); | |
| 17 | + <% end %> | |
| 18 | +<% end %> | ... | ... |