Commit b146a7838c978b0397fc6a41b53e9dd4572b5715
1 parent
bf0acf42
Exists in
staging
and in
26 other branches
Remove traling spaces at display_content plugin
Showing
9 changed files
with
41 additions
and
42 deletions
Show diff stats
plugins/display_content/README
| ... | ... | @@ -33,7 +33,7 @@ As a Noosfero administrator user, go to administrator panel: |
| 33 | 33 | DEVELOPMENT |
| 34 | 34 | =========== |
| 35 | 35 | |
| 36 | -Noosfero uses jQuery 1.5.1 and the jsTree doesn't works fine with this jQuery version. | |
| 36 | +Noosfero uses jQuery 1.5.1 and the jsTree doesn't works fine with this jQuery version. | |
| 37 | 37 | Until Noosfero upgrade its JQuery version to a newer one is necessary to load jQuery 1.8.3 inside plugin and apply some changes in jsTree to avoid jQuery conflit. |
| 38 | 38 | |
| 39 | 39 | Get the Display Content (Noosfero with Display Content Plugin) development repository: | ... | ... |
plugins/display_content/controllers/display_content_plugin_admin_controller.rb
plugins/display_content/controllers/display_content_plugin_module.rb
| ... | ... | @@ -18,10 +18,10 @@ module DisplayContentPluginController |
| 18 | 18 | node[:data] = article.title |
| 19 | 19 | node[:attr] = { 'node_id' => article.id, 'parent_id' => article.parent_id} |
| 20 | 20 | if block.nodes.include?(article.id) |
| 21 | - node[:attr].merge!('class' => 'jstree-checked') | |
| 21 | + node[:attr].merge!('class' => 'jstree-checked') | |
| 22 | 22 | elsif block.parent_nodes.include?(article.id) |
| 23 | 23 | node[:children] = get_node(block, article.children) |
| 24 | - node[:attr].merge!('class' => 'jstree-undetermined') | |
| 24 | + node[:attr].merge!('class' => 'jstree-undetermined') | |
| 25 | 25 | end |
| 26 | 26 | node[:state] = 'closed' if Article.exists?(:parent_id => article.id) |
| 27 | 27 | nodes.push(node) | ... | ... |
plugins/display_content/controllers/display_content_plugin_myprofile_controller.rb
plugins/display_content/lib/display_content_block.rb
| ... | ... | @@ -17,15 +17,15 @@ class DisplayContentBlock < Block |
| 17 | 17 | |
| 18 | 18 | settings_items :nodes, :type => Array, :default => [] |
| 19 | 19 | settings_items :parent_nodes, :type => Array, :default => [] |
| 20 | - settings_items :sections, | |
| 21 | - :type => Array, | |
| 20 | + settings_items :sections, | |
| 21 | + :type => Array, | |
| 22 | 22 | :default => [{:name => _('Publish date'), :checked => true}, |
| 23 | - {:name => _('Title'), :checked => true}, | |
| 24 | - {:name => _('Abstract'), :checked => true}, | |
| 25 | - {:name => _('Body'), :checked => false}, | |
| 23 | + {:name => _('Title'), :checked => true}, | |
| 24 | + {:name => _('Abstract'), :checked => true}, | |
| 25 | + {:name => _('Body'), :checked => false}, | |
| 26 | 26 | {:name => _('Image'), :checked => false}, |
| 27 | 27 | {:name => _('Tags'), :checked => false}] |
| 28 | - | |
| 28 | + | |
| 29 | 29 | def self.description |
| 30 | 30 | _('Display your contents') |
| 31 | 31 | end |
| ... | ... | @@ -55,7 +55,7 @@ class DisplayContentBlock < Block |
| 55 | 55 | |
| 56 | 56 | def articles_of_parent(parent = nil) |
| 57 | 57 | return [] if self.holder.nil? |
| 58 | - holder.articles.find(:all, :conditions => {:type => VALID_CONTENT, :parent_id => (parent.nil? ? nil : parent)}) | |
| 58 | + holder.articles.find(:all, :conditions => {:type => VALID_CONTENT, :parent_id => (parent.nil? ? nil : parent)}) | |
| 59 | 59 | end |
| 60 | 60 | |
| 61 | 61 | include ActionController::UrlWriter |
| ... | ... | @@ -69,16 +69,16 @@ class DisplayContentBlock < Block |
| 69 | 69 | read_more_section = '' |
| 70 | 70 | tags_section = '' |
| 71 | 71 | |
| 72 | - sections.select { |section| | |
| 72 | + sections.select { |section| | |
| 73 | 73 | case section[:name] |
| 74 | 74 | when 'Publish date' |
| 75 | - content_sections += (display_section?(section) ? (content_tag('div', show_date(item.published_at, false), :class => 'published-at') ) : '') | |
| 75 | + content_sections += (display_section?(section) ? (content_tag('div', show_date(item.published_at, false), :class => 'published-at') ) : '') | |
| 76 | 76 | when 'Title' |
| 77 | - content_sections += (display_section?(section) ? (content_tag('div', link_to(h(item.title), item.url), :class => 'title') ) : '') | |
| 77 | + content_sections += (display_section?(section) ? (content_tag('div', link_to(h(item.title), item.url), :class => 'title') ) : '') | |
| 78 | 78 | when 'Abstract' |
| 79 | 79 | content_sections += (display_section?(section) ? (content_tag('div', item.abstract , :class => 'lead')) : '' ) |
| 80 | 80 | if display_section?(section) |
| 81 | - read_more_section = content_tag('div', link_to(_('Read more'), item.url), :class => 'read_more') | |
| 81 | + read_more_section = content_tag('div', link_to(_('Read more'), item.url), :class => 'read_more') | |
| 82 | 82 | end |
| 83 | 83 | when 'Body' |
| 84 | 84 | content_sections += (display_section?(section) ? (content_tag('div', item.body ,:class => 'body')) : '' ) |
| ... | ... | @@ -116,12 +116,12 @@ class DisplayContentBlock < Block |
| 116 | 116 | def display_section?(section) |
| 117 | 117 | section[:checked] |
| 118 | 118 | end |
| 119 | - | |
| 119 | + | |
| 120 | 120 | protected |
| 121 | 121 | |
| 122 | 122 | def holder |
| 123 | 123 | return nil if self.box.nil? || self.box.owner.nil? |
| 124 | - if self.box.owner.kind_of?(Environment) | |
| 124 | + if self.box.owner.kind_of?(Environment) | |
| 125 | 125 | return nil if self.box.owner.portal_community.nil? |
| 126 | 126 | self.box.owner.portal_community |
| 127 | 127 | else | ... | ... |
plugins/display_content/public/style.css
| ... | ... | @@ -16,7 +16,7 @@ |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | 18 | .block.display-content-block .published-at, |
| 19 | -.block.display-content-block .title, | |
| 19 | +.block.display-content-block .title, | |
| 20 | 20 | .block.display-content-block .lead, |
| 21 | 21 | .block.display-content-block .body, |
| 22 | 22 | .block.display-content-block .image, | ... | ... |
plugins/display_content/test/functional/display_content_plugin_admin_controller_test.rb
| ... | ... | @@ -19,7 +19,7 @@ class DisplayContentPluginAdminControllerTest < ActionController::TestCase |
| 19 | 19 | @environment.enabled_plugins = ['DisplayContentPlugin'] |
| 20 | 20 | @environment.portal_community = fast_create(Community, :name => 'my test profile', :identifier => 'mytestcommunity') |
| 21 | 21 | @environment.save! |
| 22 | - | |
| 22 | + | |
| 23 | 23 | box = Box.new(:owner => @environment, :position => 1) |
| 24 | 24 | box.save |
| 25 | 25 | ... | ... |
plugins/display_content/test/unit/display_content_block_test.rb
| ... | ... | @@ -515,7 +515,7 @@ class DisplayContentBlockTest < ActiveSupport::TestCase |
| 515 | 515 | Article.delete_all |
| 516 | 516 | a1 = fast_create(invalid_article, :name => 'test article 1', :profile_id => profile.id) |
| 517 | 517 | a2 = fast_create(VALID_KIND_OF_ARTICLE.first, :name => 'test article 2', :profile_id => profile.id) |
| 518 | - | |
| 518 | + | |
| 519 | 519 | block = DisplayContentBlock.new |
| 520 | 520 | box = mock() |
| 521 | 521 | box.stubs(:owner).returns(profile) |
| ... | ... | @@ -523,7 +523,7 @@ class DisplayContentBlockTest < ActiveSupport::TestCase |
| 523 | 523 | assert_equal [], [a2] - block.articles_of_parent |
| 524 | 524 | assert_equal [], block.articles_of_parent - [a2] |
| 525 | 525 | end |
| 526 | - | |
| 526 | + | |
| 527 | 527 | end |
| 528 | 528 | |
| 529 | 529 | VALID_KIND_OF_ARTICLE.map do |valid_article| |
| ... | ... | @@ -533,14 +533,14 @@ class DisplayContentBlockTest < ActiveSupport::TestCase |
| 533 | 533 | Article.delete_all |
| 534 | 534 | a1 = fast_create(valid_article, :name => 'test article 1', :profile_id => profile.id) |
| 535 | 535 | a2 = fast_create(INVALID_KIND_OF_ARTICLE.first, :name => 'test article 2', :profile_id => profile.id) |
| 536 | - | |
| 536 | + | |
| 537 | 537 | block = DisplayContentBlock.new |
| 538 | 538 | box = mock() |
| 539 | 539 | box.stubs(:owner).returns(profile) |
| 540 | 540 | block.stubs(:box).returns(box) |
| 541 | 541 | assert_equal [a1], block.articles_of_parent |
| 542 | 542 | end |
| 543 | - | |
| 543 | + | |
| 544 | 544 | end |
| 545 | 545 | |
| 546 | 546 | should 'list links for all articles title defined in nodes' do |
| ... | ... | @@ -554,7 +554,7 @@ class DisplayContentBlockTest < ActiveSupport::TestCase |
| 554 | 554 | box = mock() |
| 555 | 555 | block.stubs(:box).returns(box) |
| 556 | 556 | box.stubs(:owner).returns(profile) |
| 557 | - | |
| 557 | + | |
| 558 | 558 | assert_match /.*<a.*>#{a1.title}<\/a>/, block.content |
| 559 | 559 | assert_match /.*<a.*>#{a2.title}<\/a>/, block.content |
| 560 | 560 | end |
| ... | ... | @@ -571,7 +571,7 @@ class DisplayContentBlockTest < ActiveSupport::TestCase |
| 571 | 571 | box = mock() |
| 572 | 572 | block.stubs(:box).returns(box) |
| 573 | 573 | box.stubs(:owner).returns(profile) |
| 574 | - | |
| 574 | + | |
| 575 | 575 | assert_match /<div class="lead">#{a1.lead}<\/div>/, block.content |
| 576 | 576 | assert_match /<div class="lead">#{a2.lead}<\/div>/, block.content |
| 577 | 577 | end |
| ... | ... | @@ -585,7 +585,7 @@ class DisplayContentBlockTest < ActiveSupport::TestCase |
| 585 | 585 | box = mock() |
| 586 | 586 | block.stubs(:box).returns(box) |
| 587 | 587 | box.stubs(:owner).returns(profile) |
| 588 | - | |
| 588 | + | |
| 589 | 589 | Article.delete_all |
| 590 | 590 | assert_match /<ul><\/ul>/, block.content |
| 591 | 591 | end |
| ... | ... | @@ -595,7 +595,7 @@ class DisplayContentBlockTest < ActiveSupport::TestCase |
| 595 | 595 | block = DisplayContentBlock.new |
| 596 | 596 | block.box = profile.boxes.first |
| 597 | 597 | block.save! |
| 598 | - | |
| 598 | + | |
| 599 | 599 | params = {:block_id => block.id} |
| 600 | 600 | params[:controller] = "display_content_plugin_myprofile" |
| 601 | 601 | params[:profile] = profile.identifier |
| ... | ... | @@ -607,7 +607,7 @@ class DisplayContentBlockTest < ActiveSupport::TestCase |
| 607 | 607 | block = DisplayContentBlock.new |
| 608 | 608 | block.box = environment.boxes.first |
| 609 | 609 | block.save! |
| 610 | - | |
| 610 | + | |
| 611 | 611 | params = {:block_id => block.id} |
| 612 | 612 | params[:controller] = "display_content_plugin_admin" |
| 613 | 613 | assert_equal params, block.url_params |
| ... | ... | @@ -623,7 +623,7 @@ class DisplayContentBlockTest < ActiveSupport::TestCase |
| 623 | 623 | box = mock() |
| 624 | 624 | block.stubs(:box).returns(box) |
| 625 | 625 | box.stubs(:owner).returns(profile) |
| 626 | - | |
| 626 | + | |
| 627 | 627 | assert_match /.*<a.*>#{a.title}<\/a>/, block.content |
| 628 | 628 | end |
| 629 | 629 | |
| ... | ... | @@ -637,7 +637,7 @@ class DisplayContentBlockTest < ActiveSupport::TestCase |
| 637 | 637 | box = mock() |
| 638 | 638 | block.stubs(:box).returns(box) |
| 639 | 639 | box.stubs(:owner).returns(profile) |
| 640 | - | |
| 640 | + | |
| 641 | 641 | assert_match /#{a.abstract}/, block.content |
| 642 | 642 | end |
| 643 | 643 | |
| ... | ... | @@ -651,7 +651,7 @@ class DisplayContentBlockTest < ActiveSupport::TestCase |
| 651 | 651 | box = mock() |
| 652 | 652 | block.stubs(:box).returns(box) |
| 653 | 653 | box.stubs(:owner).returns(profile) |
| 654 | - | |
| 654 | + | |
| 655 | 655 | assert_match /#{a.body}/, block.content |
| 656 | 656 | end |
| 657 | 657 | |
| ... | ... | @@ -659,13 +659,13 @@ class DisplayContentBlockTest < ActiveSupport::TestCase |
| 659 | 659 | profile = create_user('testuser').person |
| 660 | 660 | |
| 661 | 661 | block = DisplayContentBlock.new |
| 662 | - | |
| 662 | + | |
| 663 | 663 | assert block.display_section?({:name => 'Title', :checked => true}) |
| 664 | 664 | end |
| 665 | 665 | |
| 666 | 666 | should 'display_attribute be true if the attribute was chosen' do |
| 667 | 667 | profile = create_user('testuser').person |
| 668 | - | |
| 668 | + | |
| 669 | 669 | block = DisplayContentBlock.new |
| 670 | 670 | |
| 671 | 671 | block.sections = [{:name => 'Body', :checked => true}] |
| ... | ... | @@ -678,7 +678,7 @@ class DisplayContentBlockTest < ActiveSupport::TestCase |
| 678 | 678 | profile = create_user('testuser').person |
| 679 | 679 | |
| 680 | 680 | block = DisplayContentBlock.new |
| 681 | - | |
| 681 | + | |
| 682 | 682 | assert block.display_section?({:name => 'Publish date', :checked => true}) |
| 683 | 683 | end |
| 684 | 684 | |
| ... | ... | @@ -692,9 +692,8 @@ class DisplayContentBlockTest < ActiveSupport::TestCase |
| 692 | 692 | box = mock() |
| 693 | 693 | block.stubs(:box).returns(box) |
| 694 | 694 | box.stubs(:owner).returns(profile) |
| 695 | - | |
| 695 | + | |
| 696 | 696 | assert_match /#{a.published_at}/, block.content |
| 697 | 697 | end |
| 698 | 698 | |
| 699 | - | |
| 700 | 699 | end | ... | ... |
plugins/display_content/views/box_organizer/_display_content_block.rhtml
| ... | ... | @@ -22,15 +22,15 @@ |
| 22 | 22 | jQuery_1_8_3("#display_content").jstree({ |
| 23 | 23 | plugins : ["themes","json_data", "checkbox"], |
| 24 | 24 | checkbox : { |
| 25 | - real_checkboxes : true, | |
| 26 | - real_checkboxes_names : function (n) { return [("block[checked_nodes[" + n.attr('node_id') + "]]"), 1]; } | |
| 25 | + real_checkboxes : true, | |
| 26 | + real_checkboxes_names : function (n) { return [("block[checked_nodes[" + n.attr('node_id') + "]]"), 1]; } | |
| 27 | 27 | }, |
| 28 | 28 | themes : {"theme" : "classic", "icons" : true, "url": "/plugins/display_content/javascripts/jstree/themes/classic/style.css"}, |
| 29 | 29 | json_data : { |
| 30 | - ajax : { | |
| 31 | - url : '<%= url_for @block.url_params %>', | |
| 30 | + ajax : { | |
| 31 | + url : '<%= url_for @block.url_params %>', | |
| 32 | 32 | async: true, |
| 33 | - data : function (m) { | |
| 33 | + data : function (m) { | |
| 34 | 34 | return m.attr ? {"id" : m.attr("node_id")} : {}; |
| 35 | 35 | } |
| 36 | 36 | } | ... | ... |