Commit a54bd711da21ebb5a85b873a78b66455358cf5a8
Exists in
master
and in
29 other branches
Merge branch 'stable'
Showing
4 changed files
with
35 additions
and
3 deletions
Show diff stats
app/helpers/application_helper.rb
... | ... | @@ -978,7 +978,7 @@ module ApplicationHelper |
978 | 978 | end |
979 | 979 | |
980 | 980 | def article_to_html(article, options = {}) |
981 | - options.merge(:page => params[:npage]) | |
981 | + options.merge!(:page => params[:npage]) | |
982 | 982 | content = article.to_html(options) |
983 | 983 | return self.instance_eval(&content) if content.kind_of?(Proc) |
984 | 984 | content | ... | ... |
app/views/friends/add.rhtml
... | ... | @@ -13,7 +13,7 @@ |
13 | 13 | <% form_tag do %> |
14 | 14 | <%= hidden_field_tag(:confirmation, 1) %> |
15 | 15 | |
16 | - <div> | |
16 | + <div class="add-friend-tags"> | |
17 | 17 | <%= __('Classify your new friend %s: ') % @friend.name %> |
18 | 18 | <%= text_field_with_local_autocomplete('group', profile.suggested_friend_groups, :maxlength => 150) %> |
19 | 19 | <p> | ... | ... |
app/views/tasks/_add_friend.rhtml
... | ... | @@ -21,7 +21,7 @@ |
21 | 21 | :onclick => "Element.hide('group-for-friend-#{task.id}')") %> |
22 | 22 | <label for="<%= "decision-cancel-#{task.id}" %>"><b><%= _('Ignore') %></b></label> |
23 | 23 | |
24 | - <% content_tag('div', :id => "group-for-friend-#{task.id}") do %> | |
24 | + <% content_tag('div', :id => "group-for-friend-#{task.id}", :class => "add-friend-tags") do %> | |
25 | 25 | <%= _('Classify your new friend:') %> |
26 | 26 | <%= text_field_with_local_autocomplete("task[group_for_friend]", |
27 | 27 | profile.suggested_friend_groups, | ... | ... |
test/functional/content_viewer_controller_test.rb
... | ... | @@ -614,6 +614,38 @@ class ContentViewerControllerTest < Test::Unit::TestCase |
614 | 614 | assert_tag :tag => 'a', :attributes => { :href => "/#{profile.identifier}/#{blog.path}?npage=2", :rel => 'next' } |
615 | 615 | end |
616 | 616 | |
617 | + should 'display first page of blog posts' do | |
618 | + blog = Blog.create!(:name => 'My blog', :profile => profile, :posts_per_page => 5) | |
619 | + for n in 1..10 | |
620 | + blog.children << TextileArticle.create!(:name => "Post #{n}", :profile => profile, :parent => blog) | |
621 | + end | |
622 | + assert_equal 10, blog.posts.size | |
623 | + | |
624 | + get :view_page, :profile => profile.identifier, :page => [blog.path] | |
625 | + for n in 1..5 | |
626 | + assert_no_tag :tag => 'h1', :attributes => { :class => 'title' }, :descendant => {:tag => 'a', :attributes => {:href => /\/#{profile.identifier}\/my-blog\/post-#{n}/}, :content => "Post #{n}"} | |
627 | + end | |
628 | + for n in 6..10 | |
629 | + assert_tag :tag => 'h1', :attributes => { :class => 'title' }, :descendant => {:tag => 'a', :attributes => {:href => /\/#{profile.identifier}\/my-blog\/post-#{n}/}, :content => "Post #{n}"} | |
630 | + end | |
631 | + end | |
632 | + | |
633 | + should 'display others pages of blog posts' do | |
634 | + blog = Blog.create!(:name => 'My blog', :profile => profile, :posts_per_page => 5) | |
635 | + for n in 1..10 | |
636 | + blog.children << TextileArticle.create!(:name => "Post #{n}", :profile => profile, :parent => blog) | |
637 | + end | |
638 | + assert_equal 10, blog.posts.size | |
639 | + | |
640 | + get :view_page, :profile => profile.identifier, :page => [blog.path], :npage => 2 | |
641 | + for n in 1..5 | |
642 | + assert_tag :tag => 'h1', :attributes => { :class => 'title' }, :descendant => {:tag => 'a', :attributes => {:href => /\/#{profile.identifier}\/my-blog\/post-#{n}/}, :content => "Post #{n}"} | |
643 | + end | |
644 | + for n in 6..10 | |
645 | + assert_no_tag :tag => 'h1', :attributes => { :class => 'title' }, :descendant => {:tag => 'a', :attributes => {:href => /\/#{profile.identifier}\/my-blog\/post-#{n}/}, :content => "Post #{n}"} | |
646 | + end | |
647 | + end | |
648 | + | |
617 | 649 | should 'set year and month filter from URL params' do |
618 | 650 | profile.articles << Blog.new(:name => 'A blog test', :profile => profile) |
619 | 651 | year, month = profile.blog.created_at.year.to_s, '%02d' % profile.blog.created_at.month | ... | ... |