[Git][noosfero/noosfero][master] 2 commits: pg-search: adjust facets titles
Rodrigo Souto
gitlab at mg.gitlab.com
Wed Nov 1 12:26:41 BRST 2017
Rodrigo Souto pushed to branch master at Noosfero / noosfero
Commits:
bd635b83 by Rodrigo Souto at 2017-10-31T17:27:30-03:00
pg-search: adjust facets titles
- - - - -
687bf063 by Rodrigo Souto at 2017-11-01T14:26:28+00:00
Merge branch 'pg-search-facets-titles' into 'master'
pg-search: adjust facets titles
See merge request noosfero/noosfero!1335
- - - - -
2 changed files:
- plugins/pg_search/lib/pg_search_plugin.rb
- plugins/pg_search/test/unit/pg_search_plugin_test.rb
Changes:
=====================================
plugins/pg_search/lib/pg_search_plugin.rb
=====================================
--- a/plugins/pg_search/lib/pg_search_plugin.rb
+++ b/plugins/pg_search/lib/pg_search_plugin.rb
@@ -201,13 +201,26 @@ class PgSearchPlugin < Noosfero::Plugin
end
def attribute_label(klass, params)
- params[:attribute].to_s.humanize.pluralize
+ case params[:attribute]
+ when :content_type
+ :extension
+ when :type
+ :content_type
+ else
+ params[:attribute]
+ end.to_s.humanize.pluralize
end
def attribute_option_name(name, klass, params)
return nil if name.blank?
if params[:attribute].to_s == 'content_type'
Noosfero::FriendlyMIME.find(name)[1..-1].upcase
+ elsif params[:attribute].to_s == 'type'
+ begin
+ name.constantize.short_description
+ rescue
+ name
+ end
else
name
end
@@ -301,11 +314,9 @@ class PgSearchPlugin < Noosfero::Plugin
def translations
_('Created at')
_('Updated at')
- _('Types')
- _('TextArticle')
- _('UploadedFile')
- _('RSSFeed')
+ _('Extensions')
_('Content types')
_('Tags')
+ _('Categories')
end
end
=====================================
plugins/pg_search/test/unit/pg_search_plugin_test.rb
=====================================
--- a/plugins/pg_search/test/unit/pg_search_plugin_test.rb
+++ b/plugins/pg_search/test/unit/pg_search_plugin_test.rb
@@ -56,7 +56,7 @@ class PgSearchPluginTest < ActiveSupport::TestCase
end
should 'get attribute option name' do
- assert_equal 'TextArticle', plugin.send(:attribute_option_name, 'TextArticle', Article, {:attribute => 'type'})
+ assert_equal 'Text article', plugin.send(:attribute_option_name, 'TextArticle', Article, {:attribute => 'type'})
assert_equal 'TinyMce', plugin.send(:attribute_option_name, 'TinyMce', Article, {:attribute => 'editor'})
end
@@ -153,7 +153,7 @@ class PgSearchPluginTest < ActiveSupport::TestCase
kind = :attribute
results = plugin.send(:generic_facet, klass, scope, selected_facets, kind, {:attribute => :type})
- text_article = results[:options].select {|opt| opt[:label] == 'TextArticle'}.first
+ text_article = results[:options].select {|opt| opt[:label] == 'Text article'}.first
event = results[:options].select {|opt| opt[:label] == 'Event'}.first
blog = results[:options].select {|opt| opt[:label] == 'Blog'}.first
View it on GitLab: https://gitlab.com/noosfero/noosfero/compare/80e1a774788788b9e4b92fc9c1b2aa210008e200...687bf0636f64786913b76d9f9ad9d1837322edd3
---
View it on GitLab: https://gitlab.com/noosfero/noosfero/compare/80e1a774788788b9e4b92fc9c1b2aa210008e200...687bf0636f64786913b76d9f9ad9d1837322edd3
You're receiving this email because of your account on gitlab.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listas.softwarelivre.org/pipermail/noosfero-dev/attachments/20171101/7a77f51f/attachment-0001.html>
More information about the Noosfero-dev
mailing list