Commit a375bb4c64db0d1270d1935b4e277a2fb78e729c
1 parent
2920c5c0
Exists in
master
and in
28 other branches
Removes trailing spaces from display content plugin
Showing
8 changed files
with
28 additions
and
28 deletions
Show diff stats
plugins/display_content/README
@@ -33,7 +33,7 @@ As a Noosfero administrator user, go to administrator panel: | @@ -33,7 +33,7 @@ As a Noosfero administrator user, go to administrator panel: | ||
33 | DEVELOPMENT | 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 | 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. | 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 | Get the Display Content (Noosfero with Display Content Plugin) development repository: | 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,6 +4,6 @@ class DisplayContentPluginAdminController < AdminController | ||
4 | 4 | ||
5 | append_view_path File.join(File.dirname(__FILE__) + '/../views') | 5 | append_view_path File.join(File.dirname(__FILE__) + '/../views') |
6 | 6 | ||
7 | - include DisplayContentPluginController | 7 | + include DisplayContentPluginController |
8 | 8 | ||
9 | end | 9 | end |
plugins/display_content/controllers/display_content_plugin_module.rb
@@ -18,10 +18,10 @@ module DisplayContentPluginController | @@ -18,10 +18,10 @@ module DisplayContentPluginController | ||
18 | node[:data] = article.title | 18 | node[:data] = article.title |
19 | node[:attr] = { 'node_id' => article.id, 'parent_id' => article.parent_id} | 19 | node[:attr] = { 'node_id' => article.id, 'parent_id' => article.parent_id} |
20 | if block.nodes.include?(article.id) | 20 | if block.nodes.include?(article.id) |
21 | - node[:attr].merge!('class' => 'jstree-checked') | 21 | + node[:attr].merge!('class' => 'jstree-checked') |
22 | elsif block.parent_nodes.include?(article.id) | 22 | elsif block.parent_nodes.include?(article.id) |
23 | node[:children] = get_node(block, article.children) | 23 | node[:children] = get_node(block, article.children) |
24 | - node[:attr].merge!('class' => 'jstree-undetermined') | 24 | + node[:attr].merge!('class' => 'jstree-undetermined') |
25 | end | 25 | end |
26 | node[:state] = 'closed' if Article.exists?(:parent_id => article.id) | 26 | node[:state] = 'closed' if Article.exists?(:parent_id => article.id) |
27 | nodes.push(node) | 27 | nodes.push(node) |
plugins/display_content/controllers/display_content_plugin_myprofile_controller.rb
@@ -4,6 +4,6 @@ class DisplayContentPluginMyprofileController < MyProfileController | @@ -4,6 +4,6 @@ class DisplayContentPluginMyprofileController < MyProfileController | ||
4 | 4 | ||
5 | append_view_path File.join(File.dirname(__FILE__) + '/../views') | 5 | append_view_path File.join(File.dirname(__FILE__) + '/../views') |
6 | 6 | ||
7 | - include DisplayContentPluginController | 7 | + include DisplayContentPluginController |
8 | 8 | ||
9 | end | 9 | end |
plugins/display_content/lib/display_content_block.rb
@@ -41,7 +41,7 @@ class DisplayContentBlock < Block | @@ -41,7 +41,7 @@ class DisplayContentBlock < Block | ||
41 | 41 | ||
42 | def articles_of_parent(parent = nil) | 42 | def articles_of_parent(parent = nil) |
43 | return [] if self.holder.nil? | 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 | end | 45 | end |
46 | 46 | ||
47 | include ActionController::UrlWriter | 47 | include ActionController::UrlWriter |
@@ -74,14 +74,14 @@ class DisplayContentBlock < Block | @@ -74,14 +74,14 @@ class DisplayContentBlock < Block | ||
74 | end | 74 | end |
75 | 75 | ||
76 | def display_attribute?(attr) | 76 | def display_attribute?(attr) |
77 | - chosen_attributes.include?(attr) | 77 | + chosen_attributes.include?(attr) |
78 | end | 78 | end |
79 | 79 | ||
80 | protected | 80 | protected |
81 | 81 | ||
82 | def holder | 82 | def holder |
83 | return nil if self.box.nil? || self.box.owner.nil? | 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 | return nil if self.box.owner.portal_community.nil? | 85 | return nil if self.box.owner.portal_community.nil? |
86 | self.box.owner.portal_community | 86 | self.box.owner.portal_community |
87 | else | 87 | else |
plugins/display_content/test/functional/display_content_plugin_admin_controller_test.rb
@@ -19,7 +19,7 @@ class DisplayContentPluginAdminControllerTest < ActionController::TestCase | @@ -19,7 +19,7 @@ class DisplayContentPluginAdminControllerTest < ActionController::TestCase | ||
19 | @environment.enabled_plugins = ['DisplayContentPlugin'] | 19 | @environment.enabled_plugins = ['DisplayContentPlugin'] |
20 | @environment.portal_community = fast_create(Community, :name => 'my test profile', :identifier => 'mytestcommunity') | 20 | @environment.portal_community = fast_create(Community, :name => 'my test profile', :identifier => 'mytestcommunity') |
21 | @environment.save! | 21 | @environment.save! |
22 | - | 22 | + |
23 | box = Box.new(:owner => @environment, :position => 1) | 23 | box = Box.new(:owner => @environment, :position => 1) |
24 | box.save | 24 | box.save |
25 | 25 |
plugins/display_content/test/unit/display_content_block_test.rb
@@ -312,7 +312,7 @@ class DisplayContentBlockTest < ActiveSupport::TestCase | @@ -312,7 +312,7 @@ class DisplayContentBlockTest < ActiveSupport::TestCase | ||
312 | Article.delete_all | 312 | Article.delete_all |
313 | a1 = fast_create(invalid_article, :name => 'test article 1', :profile_id => profile.id) | 313 | a1 = fast_create(invalid_article, :name => 'test article 1', :profile_id => profile.id) |
314 | a2 = fast_create(VALID_KIND_OF_ARTICLE.first, :name => 'test article 2', :profile_id => profile.id) | 314 | a2 = fast_create(VALID_KIND_OF_ARTICLE.first, :name => 'test article 2', :profile_id => profile.id) |
315 | - | 315 | + |
316 | block = DisplayContentBlock.new | 316 | block = DisplayContentBlock.new |
317 | box = mock() | 317 | box = mock() |
318 | box.stubs(:owner).returns(profile) | 318 | box.stubs(:owner).returns(profile) |
@@ -320,7 +320,7 @@ class DisplayContentBlockTest < ActiveSupport::TestCase | @@ -320,7 +320,7 @@ class DisplayContentBlockTest < ActiveSupport::TestCase | ||
320 | assert_equal [], [a2] - block.articles_of_parent | 320 | assert_equal [], [a2] - block.articles_of_parent |
321 | assert_equal [], block.articles_of_parent - [a2] | 321 | assert_equal [], block.articles_of_parent - [a2] |
322 | end | 322 | end |
323 | - | 323 | + |
324 | end | 324 | end |
325 | 325 | ||
326 | VALID_KIND_OF_ARTICLE.map do |valid_article| | 326 | VALID_KIND_OF_ARTICLE.map do |valid_article| |
@@ -330,14 +330,14 @@ class DisplayContentBlockTest < ActiveSupport::TestCase | @@ -330,14 +330,14 @@ class DisplayContentBlockTest < ActiveSupport::TestCase | ||
330 | Article.delete_all | 330 | Article.delete_all |
331 | a1 = fast_create(valid_article, :name => 'test article 1', :profile_id => profile.id) | 331 | a1 = fast_create(valid_article, :name => 'test article 1', :profile_id => profile.id) |
332 | a2 = fast_create(INVALID_KIND_OF_ARTICLE.first, :name => 'test article 2', :profile_id => profile.id) | 332 | a2 = fast_create(INVALID_KIND_OF_ARTICLE.first, :name => 'test article 2', :profile_id => profile.id) |
333 | - | 333 | + |
334 | block = DisplayContentBlock.new | 334 | block = DisplayContentBlock.new |
335 | box = mock() | 335 | box = mock() |
336 | box.stubs(:owner).returns(profile) | 336 | box.stubs(:owner).returns(profile) |
337 | block.stubs(:box).returns(box) | 337 | block.stubs(:box).returns(box) |
338 | assert_equal [a1], block.articles_of_parent | 338 | assert_equal [a1], block.articles_of_parent |
339 | end | 339 | end |
340 | - | 340 | + |
341 | end | 341 | end |
342 | 342 | ||
343 | should 'list links for all articles title defined in nodes' do | 343 | should 'list links for all articles title defined in nodes' do |
@@ -351,7 +351,7 @@ class DisplayContentBlockTest < ActiveSupport::TestCase | @@ -351,7 +351,7 @@ class DisplayContentBlockTest < ActiveSupport::TestCase | ||
351 | box = mock() | 351 | box = mock() |
352 | block.stubs(:box).returns(box) | 352 | block.stubs(:box).returns(box) |
353 | box.stubs(:owner).returns(profile) | 353 | box.stubs(:owner).returns(profile) |
354 | - | 354 | + |
355 | assert_match /.*<a.*>#{a1.title}<\/a>/, block.content | 355 | assert_match /.*<a.*>#{a1.title}<\/a>/, block.content |
356 | assert_match /.*<a.*>#{a2.title}<\/a>/, block.content | 356 | assert_match /.*<a.*>#{a2.title}<\/a>/, block.content |
357 | end | 357 | end |
@@ -368,7 +368,7 @@ class DisplayContentBlockTest < ActiveSupport::TestCase | @@ -368,7 +368,7 @@ class DisplayContentBlockTest < ActiveSupport::TestCase | ||
368 | box = mock() | 368 | box = mock() |
369 | block.stubs(:box).returns(box) | 369 | block.stubs(:box).returns(box) |
370 | box.stubs(:owner).returns(profile) | 370 | box.stubs(:owner).returns(profile) |
371 | - | 371 | + |
372 | assert_match /<div class="lead">#{a1.lead}<\/div>/, block.content | 372 | assert_match /<div class="lead">#{a1.lead}<\/div>/, block.content |
373 | assert_match /<div class="lead">#{a2.lead}<\/div>/, block.content | 373 | assert_match /<div class="lead">#{a2.lead}<\/div>/, block.content |
374 | end | 374 | end |
@@ -382,7 +382,7 @@ class DisplayContentBlockTest < ActiveSupport::TestCase | @@ -382,7 +382,7 @@ class DisplayContentBlockTest < ActiveSupport::TestCase | ||
382 | box = mock() | 382 | box = mock() |
383 | block.stubs(:box).returns(box) | 383 | block.stubs(:box).returns(box) |
384 | box.stubs(:owner).returns(profile) | 384 | box.stubs(:owner).returns(profile) |
385 | - | 385 | + |
386 | Article.delete_all | 386 | Article.delete_all |
387 | assert_match /<ul><\/ul>/, block.content | 387 | assert_match /<ul><\/ul>/, block.content |
388 | end | 388 | end |
@@ -392,7 +392,7 @@ class DisplayContentBlockTest < ActiveSupport::TestCase | @@ -392,7 +392,7 @@ class DisplayContentBlockTest < ActiveSupport::TestCase | ||
392 | block = DisplayContentBlock.new | 392 | block = DisplayContentBlock.new |
393 | block.box = profile.boxes.first | 393 | block.box = profile.boxes.first |
394 | block.save! | 394 | block.save! |
395 | - | 395 | + |
396 | params = {:block_id => block.id} | 396 | params = {:block_id => block.id} |
397 | params[:controller] = "display_content_plugin_myprofile" | 397 | params[:controller] = "display_content_plugin_myprofile" |
398 | params[:profile] = profile.identifier | 398 | params[:profile] = profile.identifier |
@@ -404,7 +404,7 @@ class DisplayContentBlockTest < ActiveSupport::TestCase | @@ -404,7 +404,7 @@ class DisplayContentBlockTest < ActiveSupport::TestCase | ||
404 | block = DisplayContentBlock.new | 404 | block = DisplayContentBlock.new |
405 | block.box = environment.boxes.first | 405 | block.box = environment.boxes.first |
406 | block.save! | 406 | block.save! |
407 | - | 407 | + |
408 | params = {:block_id => block.id} | 408 | params = {:block_id => block.id} |
409 | params[:controller] = "display_content_plugin_admin" | 409 | params[:controller] = "display_content_plugin_admin" |
410 | assert_equal params, block.url_params | 410 | assert_equal params, block.url_params |
@@ -420,7 +420,7 @@ class DisplayContentBlockTest < ActiveSupport::TestCase | @@ -420,7 +420,7 @@ class DisplayContentBlockTest < ActiveSupport::TestCase | ||
420 | box = mock() | 420 | box = mock() |
421 | block.stubs(:box).returns(box) | 421 | block.stubs(:box).returns(box) |
422 | box.stubs(:owner).returns(profile) | 422 | box.stubs(:owner).returns(profile) |
423 | - | 423 | + |
424 | assert_match /.*<a.*>#{a.title}<\/a>/, block.content | 424 | assert_match /.*<a.*>#{a.title}<\/a>/, block.content |
425 | end | 425 | end |
426 | 426 | ||
@@ -434,7 +434,7 @@ class DisplayContentBlockTest < ActiveSupport::TestCase | @@ -434,7 +434,7 @@ class DisplayContentBlockTest < ActiveSupport::TestCase | ||
434 | box = mock() | 434 | box = mock() |
435 | block.stubs(:box).returns(box) | 435 | block.stubs(:box).returns(box) |
436 | box.stubs(:owner).returns(profile) | 436 | box.stubs(:owner).returns(profile) |
437 | - | 437 | + |
438 | assert_match /#{a.abstract}/, block.content | 438 | assert_match /#{a.abstract}/, block.content |
439 | end | 439 | end |
440 | 440 | ||
@@ -448,7 +448,7 @@ class DisplayContentBlockTest < ActiveSupport::TestCase | @@ -448,7 +448,7 @@ class DisplayContentBlockTest < ActiveSupport::TestCase | ||
448 | box = mock() | 448 | box = mock() |
449 | block.stubs(:box).returns(box) | 449 | block.stubs(:box).returns(box) |
450 | box.stubs(:owner).returns(profile) | 450 | box.stubs(:owner).returns(profile) |
451 | - | 451 | + |
452 | assert_match /#{a.body}/, block.content | 452 | assert_match /#{a.body}/, block.content |
453 | end | 453 | end |
454 | 454 | ||
@@ -456,7 +456,7 @@ class DisplayContentBlockTest < ActiveSupport::TestCase | @@ -456,7 +456,7 @@ class DisplayContentBlockTest < ActiveSupport::TestCase | ||
456 | profile = create_user('testuser').person | 456 | profile = create_user('testuser').person |
457 | 457 | ||
458 | block = DisplayContentBlock.new | 458 | block = DisplayContentBlock.new |
459 | - | 459 | + |
460 | assert block.display_attribute?('title') | 460 | assert block.display_attribute?('title') |
461 | end | 461 | end |
462 | 462 | ||
@@ -465,7 +465,7 @@ class DisplayContentBlockTest < ActiveSupport::TestCase | @@ -465,7 +465,7 @@ class DisplayContentBlockTest < ActiveSupport::TestCase | ||
465 | 465 | ||
466 | block = DisplayContentBlock.new | 466 | block = DisplayContentBlock.new |
467 | block.chosen_attributes = ['body'] | 467 | block.chosen_attributes = ['body'] |
468 | - | 468 | + |
469 | assert block.display_attribute?('body') | 469 | assert block.display_attribute?('body') |
470 | end | 470 | end |
471 | 471 |
plugins/display_content/views/box_organizer/_display_content_block.rhtml
@@ -20,15 +20,15 @@ | @@ -20,15 +20,15 @@ | ||
20 | jQuery_1_8_3("#display_content").jstree({ | 20 | jQuery_1_8_3("#display_content").jstree({ |
21 | plugins : ["themes","json_data", "checkbox"], | 21 | plugins : ["themes","json_data", "checkbox"], |
22 | checkbox : { | 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 | themes : {"theme" : "classic", "icons" : true, "url": "/plugins/display_content/javascripts/jstree/themes/classic/style.css"}, | 26 | themes : {"theme" : "classic", "icons" : true, "url": "/plugins/display_content/javascripts/jstree/themes/classic/style.css"}, |
27 | json_data : { | 27 | json_data : { |
28 | - ajax : { | ||
29 | - url : '<%= url_for @block.url_params %>', | 28 | + ajax : { |
29 | + url : '<%= url_for @block.url_params %>', | ||
30 | async: true, | 30 | async: true, |
31 | - data : function (m) { | 31 | + data : function (m) { |
32 | return m.attr ? {"id" : m.attr("node_id")} : {}; | 32 | return m.attr ? {"id" : m.attr("node_id")} : {}; |
33 | } | 33 | } |
34 | } | 34 | } |