From 9f6725b97f390c4a2aada88b66f30611221aa59f Mon Sep 17 00:00:00 2001 From: Junior Silva Date: Fri, 9 Aug 2013 17:35:57 +0000 Subject: [PATCH] cms: use css instead of short_filename() to articles titles in cms-articles table --- app/helpers/cms_helper.rb | 2 +- app/views/cms/view.rhtml | 2 +- public/stylesheets/application.css | 34 ++++++++++++++++++++++++++++++++++ test/unit/cms_helper_test.rb | 10 ++++++++++ 4 files changed, 46 insertions(+), 2 deletions(-) diff --git a/app/helpers/cms_helper.rb b/app/helpers/cms_helper.rb index 7d84e6d..6b19184 100644 --- a/app/helpers/cms_helper.rb +++ b/app/helpers/cms_helper.rb @@ -28,7 +28,7 @@ module CmsHelper end def link_to_article(article) - article_name = short_filename(article.title, 30) + article_name = article.title if article.folder? link_to article_name, {:action => 'view', :id => article.id}, :class => icon_for_article(article) else diff --git a/app/views/cms/view.rhtml b/app/views/cms/view.rhtml index 8a32f89..7b71ebe 100644 --- a/app/views/cms/view.rhtml +++ b/app/views/cms/view.rhtml @@ -41,7 +41,7 @@ <% end %> <% @articles.each do |article| %> - + <%= link_to_article(article) %> diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css index 4f215df..7be728a 100644 --- a/public/stylesheets/application.css +++ b/public/stylesheets/application.css @@ -3064,15 +3064,38 @@ div#activation_enterprise label, div#activation_enterprise input, div#activation /* ==> public/stylesheets/controller_cms.css <== */ +table.cms-articles { + table-layout: fixed; + width: 100%; +} + +table.cms-articles td:first-child, +table.cms-articles th:first-child { + width: 50%; +} + +table.cms-articles td:nth-child(2) { + font-size: 10px; +} + +table.cms-articles td:last-child, +table.cms-articles th:last-child { + width: 121px; +} table.cms-articles img { width: 16px; height: 16px; } + table.cms-articles a.icon { display: block; border: none; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; } + table.cms-articles a.icon, table.cms-articles a.icon-parent-folder { padding: 0px 0px 3px 20px; background-repeat: no-repeat; @@ -3081,6 +3104,17 @@ table.cms-articles .icon:hover { background-color: transparent; } +#content table.cms-articles .button:hover, +#content table.cms-articles .button { + margin: 0; + float: left; + border-right: none; +} + +#content table.cms-articles .button:last-child { + border-right: 1px solid #ccc; +} + .select-article-type { padding: 5px 20px; width: 455px; diff --git a/test/unit/cms_helper_test.rb b/test/unit/cms_helper_test.rb index 9bc0626..98798e8 100644 --- a/test/unit/cms_helper_test.rb +++ b/test/unit/cms_helper_test.rb @@ -112,6 +112,16 @@ class CmsHelperTest < ActiveSupport::TestCase result = display_delete_button(article) end + should 'display shortened name correctly' do + name = "Notícias do ENSOL - Encontro de Software Livre do Vale do Açu/RN" + profile = fast_create(Profile) + content = fast_create(Article, :name => name, :profile_id => profile.id) + link = link_to_article(content) + + assert_match /#{name[0..26] + '...'}/, link + end + + def link_to(text, *args); puts text; puts args.inspect; text; end end -- libgit2 0.21.2