Commit c0c7b903847d18c257c3444114528fd78a9bb3e6
Exists in
master
and in
29 other branches
Merge branch 'stable'
Conflicts: public/stylesheets/application.css test/functional/content_viewer_controller_test.rb
Showing
7 changed files
with
54 additions
and
24 deletions
Show diff stats
app/controllers/my_profile/cms_controller.rb
... | ... | @@ -94,7 +94,11 @@ class CmsController < MyProfileController |
94 | 94 | @article.last_changed_by = user |
95 | 95 | if @article.update_attributes(params[:article]) |
96 | 96 | if !continue |
97 | - redirect_to @article.view_url | |
97 | + if @article.content_type.nil? || @article.image? | |
98 | + redirect_to @article.view_url | |
99 | + else | |
100 | + redirect_to :action => (@article.parent ? 'view' : 'index'), :id => @article.parent | |
101 | + end | |
98 | 102 | end |
99 | 103 | end |
100 | 104 | end | ... | ... |
app/helpers/display_helper.rb
... | ... | @@ -31,9 +31,10 @@ module DisplayHelper |
31 | 31 | gsub( /\n\s*\n/, ' <p/> ' ). |
32 | 32 | gsub( /\n/, ' <br/> ' ). |
33 | 33 | gsub( /(^|\s)(www\.[^\s])/, '\1http://\2' ). |
34 | - gsub( /(https?:\/\/([^\s]+))/, | |
35 | - '<a href="\1" target="_blank" rel="nofolow" onclick="return confirm(\'' + | |
36 | - escape_javascript( _('Are you sure you want to visit this web site?') ) + | |
37 | - '\n\n\'+this.href)">\2</a>' ) | |
34 | + gsub( /(https?:\/\/([^\s]+))/ ) do | |
35 | + href, content = $1, $2.scan(/.{4}/).join('​') | |
36 | + content_tag(:a, content, :href => href, :target => '_blank', :rel => 'nofolow', | |
37 | + :onclick => "return confirm('%s')" % escape_javascript(_('Are you sure you want to visit this web site?'))) | |
38 | + end | |
38 | 39 | end |
39 | 40 | end | ... | ... |
app/views/content_viewer/view_page.rhtml
... | ... | @@ -55,10 +55,10 @@ |
55 | 55 | <%= link_to content_tag( 'span', _('Suggest an article') ), profile.admin_url.merge({ :controller => 'cms', :action => 'suggest_an_article'}), :class => 'button with-text icon-new' %> |
56 | 56 | <% end %> |
57 | 57 | <% end %> |
58 | - <%= article_translations(@page) %> | |
59 | 58 | <div id="article-header"> |
60 | 59 | <%= link_to(image_tag('icons-mime/rss-feed.png'), @page.feed.url, :class => 'blog-feed-link') if @page.has_posts? && @page.feed %> |
61 | 60 | <%= article_title(@page, :no_link => true) %> |
61 | + <%= article_translations(@page) %> | |
62 | 62 | </div> |
63 | 63 | </div> |
64 | 64 | ... | ... |
public/stylesheets/application.css
... | ... | @@ -1066,6 +1066,7 @@ a.comment-picture { |
1066 | 1066 | .comment-text { |
1067 | 1067 | font-size: 11px; |
1068 | 1068 | padding-right: 10px; |
1069 | + overflow: hidden; | |
1069 | 1070 | } |
1070 | 1071 | |
1071 | 1072 | .comment-logged-out .comment-text { |
... | ... | @@ -5685,23 +5686,14 @@ h1#agenda-title { |
5685 | 5686 | margin-top: 10px; |
5686 | 5687 | } |
5687 | 5688 | |
5688 | - | |
5689 | 5689 | .article-translations-menu { |
5690 | - float: right; | |
5691 | - bottom: -15px; | |
5692 | -} | |
5693 | - | |
5694 | -.opera .article-translations-menu { | |
5695 | - bottom: -8px; | |
5696 | -} | |
5697 | - | |
5698 | -.webkit .article-translations-menu { | |
5699 | - bottom: -10px; | |
5690 | + bottom: 17px; | |
5700 | 5691 | } |
5701 | 5692 | |
5702 | 5693 | .article-translations-menu { |
5703 | 5694 | text-decoration: none !important; |
5704 | 5695 | height: 0; |
5696 | + float: right; | |
5705 | 5697 | } |
5706 | 5698 | |
5707 | 5699 | .article-translations .menu-submenu-header, |
... | ... | @@ -5712,18 +5704,11 @@ h1#agenda-title { |
5712 | 5704 | |
5713 | 5705 | .article-translations .menu-submenu { |
5714 | 5706 | bottom: auto; |
5715 | - top: 60px; | |
5716 | 5707 | right: 0; |
5717 | 5708 | border: 1px solid; |
5718 | 5709 | background: #fff; |
5719 | 5710 | } |
5720 | 5711 | |
5721 | -.msie7 .article-translations .menu-submenu, | |
5722 | -.webkit .article-translations .menu-submenu, | |
5723 | -.opera .article-translations .menu-submenu { | |
5724 | - top: 30px; | |
5725 | -} | |
5726 | - | |
5727 | 5712 | .article-translations .menu-submenu-list { |
5728 | 5713 | list-style: none; |
5729 | 5714 | } | ... | ... |
test/functional/catalog_controller_test.rb
... | ... | @@ -80,4 +80,11 @@ class CatalogControllerTest < Test::Unit::TestCase |
80 | 80 | assert_tag :tag => 'a', :attributes => {:href => /assets\/products\?product_category=#{pc.id}/} |
81 | 81 | end |
82 | 82 | |
83 | + should 'add an zero width space every 4 caracters of comment urls' do | |
84 | + url = 'www.an.url.to.be.splited.com' | |
85 | + prod = @enterprise.products.create!(:name => 'Product test', :price => 50.00, :product_category => @product_category, :description => url) | |
86 | + get :index, :profile => @enterprise.identifier | |
87 | + assert_tag :a, :attributes => { :href => "http://" + url}, :content => url.scan(/.{4}/).join('​') | |
88 | + end | |
89 | + | |
83 | 90 | end | ... | ... |
test/functional/cms_controller_test.rb
... | ... | @@ -1551,4 +1551,29 @@ class CmsControllerTest < Test::Unit::TestCase |
1551 | 1551 | assert_tag :a, :content => "An image" |
1552 | 1552 | end |
1553 | 1553 | |
1554 | + should 'update image and be redirect to view_page' do | |
1555 | + image = UploadedFile.create!(:profile => @profile, :uploaded_data => fixture_file_upload('files/rails.png', 'image/png')) | |
1556 | + post :edit, :profile => @profile.identifier, :id => image.id, :article => { } | |
1557 | + assert_redirected_to image.view_url | |
1558 | + end | |
1559 | + | |
1560 | + should 'update article and be redirect to view_page' do | |
1561 | + a = fast_create(TextileArticle, :profile_id => @profile.id) | |
1562 | + post :edit, :profile => @profile.identifier, :id => a.id, :article => { } | |
1563 | + assert_redirected_to a.view_url | |
1564 | + end | |
1565 | + | |
1566 | + should 'update file and be redirect to cms' do | |
1567 | + file = UploadedFile.create!(:profile => @profile, :uploaded_data => fixture_file_upload('files/test.txt', 'text/plain')) | |
1568 | + post :edit, :profile => @profile.identifier, :id => file.id, :article => { } | |
1569 | + assert_redirected_to :action => 'index' | |
1570 | + end | |
1571 | + | |
1572 | + should 'update file and be redirect to cms folder' do | |
1573 | + f = fast_create(Folder, :profile_id => @profile.id, :name => 'foldername') | |
1574 | + file = UploadedFile.create!(:profile => @profile, :uploaded_data => fixture_file_upload('files/test.txt', 'text/plain'), :parent_id => f.id) | |
1575 | + post :edit, :profile => @profile.identifier, :id => file.id, :article => { :title => 'text file' } | |
1576 | + assert_redirected_to :action => 'view', :id => f | |
1577 | + end | |
1578 | + | |
1554 | 1579 | end | ... | ... |
test/functional/content_viewer_controller_test.rb
... | ... | @@ -1316,4 +1316,12 @@ class ContentViewerControllerTest < Test::Unit::TestCase |
1316 | 1316 | assert_tag :tag => 'div', :attributes => { :id => 'page-comment-form' }, :descendant => { :tag => 'div', :attributes => { :class => /post_comment_box opened/ } } |
1317 | 1317 | end |
1318 | 1318 | |
1319 | + should 'add an zero width space every 4 caracters of comment urls' do | |
1320 | + url = 'www.an.url.to.be.splited.com' | |
1321 | + a = fast_create(TextileArticle, :profile_id => @profile.id, :path => 'textile', :language => 'en') | |
1322 | + c = a.comments.create!(:author => @profile, :title => 'An url', :body => url) | |
1323 | + get :view_page, :profile => @profile.identifier, :page => [ 'textile' ] | |
1324 | + assert_tag :a, :attributes => { :href => "http://" + url}, :content => url.scan(/.{4}/).join('​') | |
1325 | + end | |
1326 | + | |
1319 | 1327 | end | ... | ... |