Commit 9f6725b97f390c4a2aada88b66f30611221aa59f

Authored by Junior Silva
1 parent 1b7dcab6

cms: use css instead of short_filename() to articles titles in cms-articles table

ActionItem2752
app/helpers/cms_helper.rb
... ... @@ -28,7 +28,7 @@ module CmsHelper
28 28 end
29 29  
30 30 def link_to_article(article)
31   - article_name = short_filename(article.title, 30)
  31 + article_name = article.title
32 32 if article.folder?
33 33 link_to article_name, {:action => 'view', :id => article.id}, :class => icon_for_article(article)
34 34 else
... ...
app/views/cms/view.rhtml
... ... @@ -41,7 +41,7 @@
41 41 <% end %>
42 42  
43 43 <% @articles.each do |article| %>
44   - <tr>
  44 + <tr title="<%= article.title%>" >
45 45 <td>
46 46 <%= link_to_article(article) %>
47 47 </td>
... ...
public/stylesheets/application.css
... ... @@ -3064,15 +3064,38 @@ div#activation_enterprise label, div#activation_enterprise input, div#activation
3064 3064  
3065 3065 /* ==> public/stylesheets/controller_cms.css <== */
3066 3066  
  3067 +table.cms-articles {
  3068 + table-layout: fixed;
  3069 + width: 100%;
  3070 +}
  3071 +
  3072 +table.cms-articles td:first-child,
  3073 +table.cms-articles th:first-child {
  3074 + width: 50%;
  3075 +}
  3076 +
  3077 +table.cms-articles td:nth-child(2) {
  3078 + font-size: 10px;
  3079 +}
  3080 +
  3081 +table.cms-articles td:last-child,
  3082 +table.cms-articles th:last-child {
  3083 + width: 121px;
  3084 +}
3067 3085  
3068 3086 table.cms-articles img {
3069 3087 width: 16px;
3070 3088 height: 16px;
3071 3089 }
  3090 +
3072 3091 table.cms-articles a.icon {
3073 3092 display: block;
3074 3093 border: none;
  3094 + white-space: nowrap;
  3095 + overflow: hidden;
  3096 + text-overflow: ellipsis;
3075 3097 }
  3098 +
3076 3099 table.cms-articles a.icon, table.cms-articles a.icon-parent-folder {
3077 3100 padding: 0px 0px 3px 20px;
3078 3101 background-repeat: no-repeat;
... ... @@ -3081,6 +3104,17 @@ table.cms-articles .icon:hover {
3081 3104 background-color: transparent;
3082 3105 }
3083 3106  
  3107 +#content table.cms-articles .button:hover,
  3108 +#content table.cms-articles .button {
  3109 + margin: 0;
  3110 + float: left;
  3111 + border-right: none;
  3112 +}
  3113 +
  3114 +#content table.cms-articles .button:last-child {
  3115 + border-right: 1px solid #ccc;
  3116 +}
  3117 +
3084 3118 .select-article-type {
3085 3119 padding: 5px 20px;
3086 3120 width: 455px;
... ...
test/unit/cms_helper_test.rb
... ... @@ -112,6 +112,16 @@ class CmsHelperTest &lt; ActiveSupport::TestCase
112 112 result = display_delete_button(article)
113 113 end
114 114  
  115 + should 'display shortened name correctly' do
  116 + name = "Notícias do ENSOL - Encontro de Software Livre do Vale do Açu/RN"
  117 + profile = fast_create(Profile)
  118 + content = fast_create(Article, :name => name, :profile_id => profile.id)
  119 + link = link_to_article(content)
  120 +
  121 + assert_match /#{name[0..26] + '...'}/, link
  122 + end
  123 +
  124 +
115 125 def link_to(text, *args); puts text; puts args.inspect; text; end
116 126  
117 127 end
... ...