Commit 9a6825430d61f5af2c0a83998e267cf6cc38e6d8
Exists in
master
and in
22 other branches
Merge remote-tracking branch 'origin/rails3'
Showing
8 changed files
with
51 additions
and
46 deletions
Show diff stats
app/helpers/application_helper.rb
| ... | ... | @@ -671,7 +671,7 @@ module ApplicationHelper |
| 671 | 671 | |
| 672 | 672 | def theme_javascript_ng |
| 673 | 673 | script = File.join(theme_path, 'theme.js') |
| 674 | - if File.exists?(Rails.root.join('public', script)) | |
| 674 | + if File.join(Rails.root, 'public', script) | |
| 675 | 675 | javascript_include_tag script |
| 676 | 676 | else |
| 677 | 677 | nil | ... | ... |
app/views/box_organizer/_link_list_block.html.erb
| ... | ... | @@ -10,40 +10,15 @@ |
| 10 | 10 | </ul> |
| 11 | 11 | <ul id="dropable-link-list"> |
| 12 | 12 | <% for link in @block.links do %> |
| 13 | - <li> | |
| 14 | - <ul class="link-list-row"> | |
| 15 | - <li> | |
| 16 | - <%= icon_selector(link['icon']) %> | |
| 17 | - </li> | |
| 18 | - <li> | |
| 19 | - <%= text_field_tag 'block[links][][name]', link[:name], :class => 'link-name', :maxlength => 20 %> | |
| 20 | - </li> | |
| 21 | - <li> | |
| 22 | - <%= text_field_tag 'block[links][][address]', link[:address], :class => 'link-address' %> | |
| 23 | - </li> | |
| 24 | - <li> | |
| 25 | - <%= select_tag('block[links][][target]', options_for_select(LinkListBlock::TARGET_OPTIONS, link[:target])) %> | |
| 26 | - </li> | |
| 27 | - <li> | |
| 28 | - <%= button_without_text(:delete, _('Delete'), "#" , :class=>"delete-link-list-row") %> | |
| 29 | - </li> | |
| 30 | - </ul> | |
| 31 | - </li> | |
| 13 | + <%= render :partial => 'link_list_item', :locals => {:link => link} %> | |
| 32 | 14 | <% end %> |
| 33 | 15 | </ul> |
| 34 | 16 | <input type="hidden" id="page_url" value="<%=url_for(:action=>'search_autocomplete')%>" /> |
| 17 | + | |
| 18 | + <div id="new-template"> | |
| 19 | + <% template_link = {'icon' => 'ok'} %> | |
| 20 | + <%= render :partial => 'link_list_item', :locals => {:link => template_link} %> | |
| 21 | + </div> | |
| 35 | 22 | </div> |
| 36 | 23 | |
| 37 | -<%= link_to_function(_('New link'), nil, :class => 'button icon-add with-text') do |page| | |
| 38 | - page.insert_html :bottom, 'dropable-link-list', content_tag('li', | |
| 39 | - content_tag('ul', | |
| 40 | - content_tag('li', icon_selector('ok')) + | |
| 41 | - content_tag('li', text_field_tag('block[links][][name]', '', :maxlength => 20)) + | |
| 42 | - content_tag('li', text_field_tag('block[links][][address]', nil, :class => 'link-address')) + | |
| 43 | - content_tag('li', select_tag('block[links][][target]', | |
| 44 | - options_for_select(LinkListBlock::TARGET_OPTIONS, '_self'))) + | |
| 45 | - content_tag('li', button_without_text(:delete, _('Delete'), "#" , :class=>"delete-link-list-row")), | |
| 46 | - :class=>"link-list-row new_link_row") | |
| 47 | - ) + | |
| 48 | - javascript_tag("new_link_action()") | |
| 49 | -end %> | |
| 24 | +<%= link_to_function(_('New link'), 'add_new_link();', :class => 'button icon-add with-text') %> | ... | ... |
| ... | ... | @@ -0,0 +1,19 @@ |
| 1 | +<li> | |
| 2 | + <ul class="link-list-row"> | |
| 3 | + <li> | |
| 4 | + <%= icon_selector(link['icon']) %> | |
| 5 | + </li> | |
| 6 | + <li> | |
| 7 | + <%= text_field_tag 'block[links][][name]', link[:name], :class => 'link-name', :maxlength => 20 %> | |
| 8 | + </li> | |
| 9 | + <li> | |
| 10 | + <%= text_field_tag 'block[links][][address]', link[:address], :class => 'link-address' %> | |
| 11 | + </li> | |
| 12 | + <li> | |
| 13 | + <%= select_tag('block[links][][target]', options_for_select(LinkListBlock::TARGET_OPTIONS, link[:target])) %> | |
| 14 | + </li> | |
| 15 | + <li> | |
| 16 | + <%= button_without_text(:delete, _('Delete'), "#" , :class=>"delete-link-list-row") %> | |
| 17 | + </li> | |
| 18 | + </ul> | |
| 19 | +</li> | ... | ... |
app/views/comment/_comment_form.html.erb
| ... | ... | @@ -81,7 +81,7 @@ function check_captcha(button, confirm_action) { |
| 81 | 81 | <%= hidden_field_tag(:view, params[:view])%> |
| 82 | 82 | <%= f.hidden_field(:reply_of_id) %> |
| 83 | 83 | |
| 84 | - <%= @plugins.dispatch(:comment_form_extra_contents, local_assigns).collect { |content| instance_exec(&content) }.join("") %> | |
| 84 | + <%= @plugins.dispatch(:comment_form_extra_contents, local_assigns.merge(:comment => @comment)).collect { |content| instance_exec(&content) }.join("") %> | |
| 85 | 85 | |
| 86 | 86 | <% button_bar do %> |
| 87 | 87 | <%= submit_button('add', _('Post comment'), :onclick => "if(check_captcha(this)) { save_comment(this) } else { check_captcha(this, save_comment)};return false;") %> | ... | ... |
plugins/display_content/lib/display_content_block.rb
| ... | ... | @@ -26,7 +26,7 @@ class DisplayContentBlock < Block |
| 26 | 26 | settings_items :display_folder_children, :type => :boolean, :default => true |
| 27 | 27 | settings_items :types, :type => Array, :default => ['TextileArticle', 'TinyMceArticle', 'RawHTMLArticle'] |
| 28 | 28 | |
| 29 | - attr_accessible :sections, :checked_nodes, :display_folder_children | |
| 29 | + attr_accessible :sections, :checked_nodes, :display_folder_children, :types | |
| 30 | 30 | |
| 31 | 31 | def self.description |
| 32 | 32 | _('Display your contents') | ... | ... |
plugins/display_content/test/unit/display_content_block_test.rb
| ... | ... | @@ -350,10 +350,11 @@ class DisplayContentBlockTest < ActiveSupport::TestCase |
| 350 | 350 | should 'list links for all articles title defined in nodes' do |
| 351 | 351 | profile = create_user('testuser').person |
| 352 | 352 | Article.delete_all |
| 353 | - a1 = fast_create(TextArticle, :name => 'test article 1', :profile_id => profile.id) | |
| 354 | - a2 = fast_create(TextArticle, :name => 'test article 2', :profile_id => profile.id) | |
| 353 | + a1 = fast_create(TextileArticle, :name => 'test article 1', :profile_id => profile.id) | |
| 354 | + a2 = fast_create(TextileArticle, :name => 'test article 2', :profile_id => profile.id) | |
| 355 | 355 | |
| 356 | 356 | block = DisplayContentBlock.new |
| 357 | + block.sections = [{:value => 'title', :checked => true}] | |
| 357 | 358 | block.nodes = [a1.id, a2.id] |
| 358 | 359 | box = mock() |
| 359 | 360 | block.stubs(:box).returns(box) |
| ... | ... | @@ -366,8 +367,8 @@ class DisplayContentBlockTest < ActiveSupport::TestCase |
| 366 | 367 | should 'list content for all articles lead defined in nodes' do |
| 367 | 368 | profile = create_user('testuser').person |
| 368 | 369 | Article.delete_all |
| 369 | - a1 = fast_create(TextArticle, :name => 'test article 1', :profile_id => profile.id, :abstract => 'abstract article 1') | |
| 370 | - a2 = fast_create(TextArticle, :name => 'test article 2', :profile_id => profile.id, :abstract => 'abstract article 2') | |
| 370 | + a1 = fast_create(TinyMceArticle, :name => 'test article 1', :profile_id => profile.id, :abstract => 'abstract article 1') | |
| 371 | + a2 = fast_create(TinyMceArticle, :name => 'test article 2', :profile_id => profile.id, :abstract => 'abstract article 2') | |
| 371 | 372 | |
| 372 | 373 | block = DisplayContentBlock.new |
| 373 | 374 | block.sections = [{:value => 'abstract', :checked => true}] |
| ... | ... | @@ -421,7 +422,7 @@ class DisplayContentBlockTest < ActiveSupport::TestCase |
| 421 | 422 | |
| 422 | 423 | should 'show title if defined by user' do |
| 423 | 424 | profile = create_user('testuser').person |
| 424 | - a = fast_create(TextArticle, :name => 'test article 1', :profile_id => profile.id) | |
| 425 | + a = fast_create(TextileArticle, :name => 'test article 1', :profile_id => profile.id) | |
| 425 | 426 | |
| 426 | 427 | block = DisplayContentBlock.new |
| 427 | 428 | block.nodes = [a.id] |
| ... | ... | @@ -435,7 +436,7 @@ class DisplayContentBlockTest < ActiveSupport::TestCase |
| 435 | 436 | |
| 436 | 437 | should 'show abstract if defined by user' do |
| 437 | 438 | profile = create_user('testuser').person |
| 438 | - a = fast_create(TextArticle, :name => 'test article 1', :profile_id => profile.id, :abstract => 'some abstract') | |
| 439 | + a = fast_create(TextileArticle, :name => 'test article 1', :profile_id => profile.id, :abstract => 'some abstract') | |
| 439 | 440 | |
| 440 | 441 | block = DisplayContentBlock.new |
| 441 | 442 | block.nodes = [a.id] |
| ... | ... | @@ -449,7 +450,7 @@ class DisplayContentBlockTest < ActiveSupport::TestCase |
| 449 | 450 | |
| 450 | 451 | should 'show body if defined by user' do |
| 451 | 452 | profile = create_user('testuser').person |
| 452 | - a = fast_create(TextArticle, :name => 'test article 1', :profile_id => profile.id, :body => 'some body') | |
| 453 | + a = fast_create(TextileArticle, :name => 'test article 1', :profile_id => profile.id, :body => 'some body') | |
| 453 | 454 | |
| 454 | 455 | block = DisplayContentBlock.new |
| 455 | 456 | block.nodes = [a.id] |
| ... | ... | @@ -577,7 +578,7 @@ class DisplayContentBlockTest < ActiveSupport::TestCase |
| 577 | 578 | block.types = ['TinyMceArticle'] |
| 578 | 579 | |
| 579 | 580 | block.types = ['TinyMceArticle', 'Folder'] |
| 580 | - assert_equal [TinyMceArticle, Folder, UploadedFile, Event, TextileArticle, RawHTMLArticle, Blog, Forum, Gallery, RssFeed], block.available_content_types | |
| 581 | + assert_equivalent [TinyMceArticle, Folder, UploadedFile, Event, TextileArticle, RawHTMLArticle, Blog, Forum, Gallery, RssFeed], block.available_content_types | |
| 581 | 582 | end |
| 582 | 583 | |
| 583 | 584 | should 'return available content types' do |
| ... | ... | @@ -585,7 +586,7 @@ class DisplayContentBlockTest < ActiveSupport::TestCase |
| 585 | 586 | block = DisplayContentBlock.create! |
| 586 | 587 | block.types = ['TinyMceArticle'] |
| 587 | 588 | block.types = [] |
| 588 | - assert_equal [UploadedFile, Event, TinyMceArticle, TextileArticle, RawHTMLArticle, Folder, Blog, Forum, Gallery, RssFeed], block.available_content_types | |
| 589 | + assert_equivalent [UploadedFile, Event, TinyMceArticle, TextileArticle, RawHTMLArticle, Folder, Blog, Forum, Gallery, RssFeed], block.available_content_types | |
| 589 | 590 | end |
| 590 | 591 | |
| 591 | 592 | should 'return first 2 content types' do |
| ... | ... | @@ -629,7 +630,7 @@ class DisplayContentBlockTest < ActiveSupport::TestCase |
| 629 | 630 | Noosfero::Plugin::Manager.any_instance.stubs(:enabled_plugins).returns([SomePlugin.new]) |
| 630 | 631 | |
| 631 | 632 | block.types = [] |
| 632 | - assert_equal [UploadedFile, Event, TinyMceArticle, TextileArticle, RawHTMLArticle, Folder, Blog, Forum, Gallery, RssFeed, SomePluginContent], block.available_content_types | |
| 633 | + assert_equivalent [UploadedFile, Event, TinyMceArticle, TextileArticle, RawHTMLArticle, Folder, Blog, Forum, Gallery, RssFeed, SomePluginContent], block.available_content_types | |
| 633 | 634 | end |
| 634 | 635 | |
| 635 | 636 | should 'do not fail if a selected article was removed' do | ... | ... |
public/javascripts/edit-link-list.js
| ... | ... | @@ -29,6 +29,13 @@ function new_link_action(){ |
| 29 | 29 | jQuery(document).scrollTop(jQuery('#dropable-link-list').scrollTop()); |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | +function add_new_link() { | |
| 33 | + var new_link = jQuery('#edit-link-list-block #new-template>li').clone(); | |
| 34 | + new_link.show(); | |
| 35 | + jQuery('#dropable-link-list').append(new_link); | |
| 36 | + new_link_action(); | |
| 37 | +} | |
| 38 | + | |
| 32 | 39 | jQuery(document).ready(function(){ |
| 33 | 40 | new_link_action(); |
| 34 | 41 | |
| ... | ... | @@ -36,4 +43,4 @@ jQuery(document).ready(function(){ |
| 36 | 43 | revert: true, |
| 37 | 44 | axis: "y" |
| 38 | 45 | }); |
| 39 | -}); | |
| 40 | 46 | \ No newline at end of file |
| 47 | +}); | ... | ... |
public/stylesheets/application.css