Commit 7af94bbc3ff8dfe30d83988dd90d1d31fb4d2376
1 parent
9480201d
Exists in
master
and in
29 other branches
Revert "Order tags alphabetically. Closes ActionItem1325"
This reverts commit 45f1288a6a729ade3a800cc5f197d31d48115b1a.
Showing
5 changed files
with
4 additions
and
29 deletions
Show diff stats
app/helpers/tags_helper.rb
... | ... | @@ -28,14 +28,13 @@ module TagsHelper |
28 | 28 | # courtesy of Aurelio: http://www.colivre.coop.br/Aurium/Nuvem |
29 | 29 | # (pt_BR only). |
30 | 30 | def tag_cloud(tags, tagname_option, url, options = {}) |
31 | + | |
31 | 32 | |
32 | 33 | return content_tag('em', _('No tags yet.')) + |
33 | 34 | ' <a href="' + _('http://en.wikipedia.org/wiki/Tag_%28metadata%29') + |
34 | 35 | '" target="wptags"><span>(' + |
35 | 36 | _('What are tags?') + ')</span></a>' if tags.empty? |
36 | 37 | |
37 | - tags = tags.sort_by{ |k,v| k.downcase } | |
38 | - | |
39 | 38 | max_size = options[:max_size] || Cloud::MAX_SIZE |
40 | 39 | min_size = options[:min_size] || Cloud::MIN_SIZE |
41 | 40 | ... | ... |
app/models/tags_block.rb
... | ... | @@ -24,7 +24,9 @@ class TagsBlock < Block |
24 | 24 | return '' if tags.empty? |
25 | 25 | |
26 | 26 | if limit |
27 | - tags = tags.sort_by{ |k,v| -v }[0..(limit-1)] | |
27 | + tags_tmp = tags.sort_by{ |k,v| -v }[0..(limit-1)] | |
28 | + tags = {} | |
29 | + tags_tmp.map{ |k,v| tags[k] = v } | |
28 | 30 | end |
29 | 31 | |
30 | 32 | block_title(title) + | ... | ... |
public/designs/themes/base/style.css
test/unit/tags_block_test.rb
... | ... | @@ -37,8 +37,4 @@ class TagsBlockTest < Test::Unit::TestCase |
37 | 37 | assert_match /profile\/testinguser\/tags\/first-tag/, block.content |
38 | 38 | end |
39 | 39 | |
40 | - should 'order tags alphabetically' do | |
41 | - assert /\/first-tag".*\/second-tag".*\/third-tag"/m =~ block.content | |
42 | - end | |
43 | - | |
44 | 40 | end | ... | ... |
test/unit/tags_helper_test.rb
... | ... | @@ -1,21 +0,0 @@ |
1 | -require File.dirname(__FILE__) + '/../test_helper' | |
2 | - | |
3 | -class TagsHelperTest < Test::Unit::TestCase | |
4 | - | |
5 | - include ApplicationHelper | |
6 | - include TagsHelper | |
7 | - include ActionController::UrlWriter | |
8 | - | |
9 | - def h(s); s; end | |
10 | - def link_to(text, *args); text; end | |
11 | - | |
12 | - should 'order tags alphabetically' do | |
13 | - result = tag_cloud( | |
14 | - { 'tag1'=>9, 'Tag3'=>2, 'Tag2'=>2, 'aTag'=>2, 'beTag'=>2 }, | |
15 | - :id, | |
16 | - { :host=>'noosfero.org', :controller=>'test', :action=>'tag' } | |
17 | - ) | |
18 | - assert_equal %w(aTag beTag tag1 Tag2 Tag3).join("\n"), result | |
19 | - end | |
20 | - | |
21 | -end |