Commit a375bb4c64db0d1270d1935b4e277a2fb78e729c

Authored by Victor Costa
1 parent 2920c5c0

Removes trailing spaces from display content plugin

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
... ... @@ -4,6 +4,6 @@ class DisplayContentPluginAdminController < AdminController
4 4  
5 5 append_view_path File.join(File.dirname(__FILE__) + '/../views')
6 6  
7   - include DisplayContentPluginController
  7 + include DisplayContentPluginController
8 8  
9 9 end
... ...
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
... ... @@ -4,6 +4,6 @@ class DisplayContentPluginMyprofileController < MyProfileController
4 4  
5 5 append_view_path File.join(File.dirname(__FILE__) + '/../views')
6 6  
7   - include DisplayContentPluginController
  7 + include DisplayContentPluginController
8 8  
9 9 end
... ...
plugins/display_content/lib/display_content_block.rb
... ... @@ -41,7 +41,7 @@ class DisplayContentBlock < Block
41 41  
42 42 def articles_of_parent(parent = nil)
43 43 return [] if self.holder.nil?
44   - holder.articles.find(:all, :conditions => {:type => VALID_CONTENT, :parent_id => (parent.nil? ? nil : parent)})
  44 + holder.articles.find(:all, :conditions => {:type => VALID_CONTENT, :parent_id => (parent.nil? ? nil : parent)})
45 45 end
46 46  
47 47 include ActionController::UrlWriter
... ... @@ -74,14 +74,14 @@ class DisplayContentBlock < Block
74 74 end
75 75  
76 76 def display_attribute?(attr)
77   - chosen_attributes.include?(attr)
  77 + chosen_attributes.include?(attr)
78 78 end
79 79  
80 80 protected
81 81  
82 82 def holder
83 83 return nil if self.box.nil? || self.box.owner.nil?
84   - if self.box.owner.kind_of?(Environment)
  84 + if self.box.owner.kind_of?(Environment)
85 85 return nil if self.box.owner.portal_community.nil?
86 86 self.box.owner.portal_community
87 87 else
... ...
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
... ... @@ -312,7 +312,7 @@ class DisplayContentBlockTest < ActiveSupport::TestCase
312 312 Article.delete_all
313 313 a1 = fast_create(invalid_article, :name => 'test article 1', :profile_id => profile.id)
314 314 a2 = fast_create(VALID_KIND_OF_ARTICLE.first, :name => 'test article 2', :profile_id => profile.id)
315   -
  315 +
316 316 block = DisplayContentBlock.new
317 317 box = mock()
318 318 box.stubs(:owner).returns(profile)
... ... @@ -320,7 +320,7 @@ class DisplayContentBlockTest < ActiveSupport::TestCase
320 320 assert_equal [], [a2] - block.articles_of_parent
321 321 assert_equal [], block.articles_of_parent - [a2]
322 322 end
323   -
  323 +
324 324 end
325 325  
326 326 VALID_KIND_OF_ARTICLE.map do |valid_article|
... ... @@ -330,14 +330,14 @@ class DisplayContentBlockTest < ActiveSupport::TestCase
330 330 Article.delete_all
331 331 a1 = fast_create(valid_article, :name => 'test article 1', :profile_id => profile.id)
332 332 a2 = fast_create(INVALID_KIND_OF_ARTICLE.first, :name => 'test article 2', :profile_id => profile.id)
333   -
  333 +
334 334 block = DisplayContentBlock.new
335 335 box = mock()
336 336 box.stubs(:owner).returns(profile)
337 337 block.stubs(:box).returns(box)
338 338 assert_equal [a1], block.articles_of_parent
339 339 end
340   -
  340 +
341 341 end
342 342  
343 343 should 'list links for all articles title defined in nodes' do
... ... @@ -351,7 +351,7 @@ class DisplayContentBlockTest < ActiveSupport::TestCase
351 351 box = mock()
352 352 block.stubs(:box).returns(box)
353 353 box.stubs(:owner).returns(profile)
354   -
  354 +
355 355 assert_match /.*<a.*>#{a1.title}<\/a>/, block.content
356 356 assert_match /.*<a.*>#{a2.title}<\/a>/, block.content
357 357 end
... ... @@ -368,7 +368,7 @@ class DisplayContentBlockTest &lt; ActiveSupport::TestCase
368 368 box = mock()
369 369 block.stubs(:box).returns(box)
370 370 box.stubs(:owner).returns(profile)
371   -
  371 +
372 372 assert_match /<div class="lead">#{a1.lead}<\/div>/, block.content
373 373 assert_match /<div class="lead">#{a2.lead}<\/div>/, block.content
374 374 end
... ... @@ -382,7 +382,7 @@ class DisplayContentBlockTest &lt; ActiveSupport::TestCase
382 382 box = mock()
383 383 block.stubs(:box).returns(box)
384 384 box.stubs(:owner).returns(profile)
385   -
  385 +
386 386 Article.delete_all
387 387 assert_match /<ul><\/ul>/, block.content
388 388 end
... ... @@ -392,7 +392,7 @@ class DisplayContentBlockTest &lt; ActiveSupport::TestCase
392 392 block = DisplayContentBlock.new
393 393 block.box = profile.boxes.first
394 394 block.save!
395   -
  395 +
396 396 params = {:block_id => block.id}
397 397 params[:controller] = "display_content_plugin_myprofile"
398 398 params[:profile] = profile.identifier
... ... @@ -404,7 +404,7 @@ class DisplayContentBlockTest &lt; ActiveSupport::TestCase
404 404 block = DisplayContentBlock.new
405 405 block.box = environment.boxes.first
406 406 block.save!
407   -
  407 +
408 408 params = {:block_id => block.id}
409 409 params[:controller] = "display_content_plugin_admin"
410 410 assert_equal params, block.url_params
... ... @@ -420,7 +420,7 @@ class DisplayContentBlockTest &lt; ActiveSupport::TestCase
420 420 box = mock()
421 421 block.stubs(:box).returns(box)
422 422 box.stubs(:owner).returns(profile)
423   -
  423 +
424 424 assert_match /.*<a.*>#{a.title}<\/a>/, block.content
425 425 end
426 426  
... ... @@ -434,7 +434,7 @@ class DisplayContentBlockTest &lt; ActiveSupport::TestCase
434 434 box = mock()
435 435 block.stubs(:box).returns(box)
436 436 box.stubs(:owner).returns(profile)
437   -
  437 +
438 438 assert_match /#{a.abstract}/, block.content
439 439 end
440 440  
... ... @@ -448,7 +448,7 @@ class DisplayContentBlockTest &lt; ActiveSupport::TestCase
448 448 box = mock()
449 449 block.stubs(:box).returns(box)
450 450 box.stubs(:owner).returns(profile)
451   -
  451 +
452 452 assert_match /#{a.body}/, block.content
453 453 end
454 454  
... ... @@ -456,7 +456,7 @@ class DisplayContentBlockTest &lt; ActiveSupport::TestCase
456 456 profile = create_user('testuser').person
457 457  
458 458 block = DisplayContentBlock.new
459   -
  459 +
460 460 assert block.display_attribute?('title')
461 461 end
462 462  
... ... @@ -465,7 +465,7 @@ class DisplayContentBlockTest &lt; ActiveSupport::TestCase
465 465  
466 466 block = DisplayContentBlock.new
467 467 block.chosen_attributes = ['body']
468   -
  468 +
469 469 assert block.display_attribute?('body')
470 470 end
471 471  
... ...
plugins/display_content/views/box_organizer/_display_content_block.rhtml
... ... @@ -20,15 +20,15 @@
20 20 jQuery_1_8_3("#display_content").jstree({
21 21 plugins : ["themes","json_data", "checkbox"],
22 22 checkbox : {
23   - real_checkboxes : true,
24   - real_checkboxes_names : function (n) { return [("block[checked_nodes[" + n.attr('node_id') + "]]"), 1]; }
  23 + real_checkboxes : true,
  24 + real_checkboxes_names : function (n) { return [("block[checked_nodes[" + n.attr('node_id') + "]]"), 1]; }
25 25 },
26 26 themes : {"theme" : "classic", "icons" : true, "url": "/plugins/display_content/javascripts/jstree/themes/classic/style.css"},
27 27 json_data : {
28   - ajax : {
29   - url : '<%= url_for @block.url_params %>',
  28 + ajax : {
  29 + url : '<%= url_for @block.url_params %>',
30 30 async: true,
31   - data : function (m) {
  31 + data : function (m) {
32 32 return m.attr ? {"id" : m.attr("node_id")} : {};
33 33 }
34 34 }
... ...