Commit b1cfe255e381103508b2c88ed46e3d5290714b52

Authored by Rodrigo Souto
1 parent c23f40da

Improving design of new content view and helper

app/controllers/my_profile/cms_controller.rb
... ... @@ -92,7 +92,7 @@ class CmsController < MyProfileController
92 92 @article_types = []
93 93 available_article_types.each do |type|
94 94 @article_types.push({
95   - :name => type.name,
  95 + :class => type,
96 96 :short_description => type.short_description,
97 97 :description => type.description
98 98 })
... ...
app/helpers/folder_helper.rb
... ... @@ -52,8 +52,8 @@ module FolderHelper
52 52 end
53 53 end
54 54  
55   - def icon_for_new_article(type)
56   - "icon-new icon-new%s" % type.constantize.icon_name
  55 + def icon_for_new_article(klass)
  56 + "icon-new icon-new%s" % klass.icon_name
57 57 end
58 58  
59 59 def custom_options_for_article(article)
... ...
app/views/cms/select_article_type.rhtml
... ... @@ -2,9 +2,9 @@
2 2  
3 3 <ul id="article_types">
4 4 <% for type in @article_types %>
5   - <% action = type[:name] == 'UploadedFile' ? {:action => 'upload_files'} : {:action => 'new', :type => type[:name]} %>
  5 + <% action = type[:class].name == 'UploadedFile' ? {:action => 'upload_files'} : {:action => 'new', :type => type[:class].name} %>
6 6 <% content_tag('a', :href => url_for(action.merge(:parent_id => @parent_id, :back_to => @back_to))) do %>
7   - <li class="<%= icon_for_new_article(type[:name]) %>" onmouseover="javascript: jQuery(this).addClass('mouseover')" onmouseout="jQuery(this).removeClass('mouseover')">
  7 + <li class="<%= icon_for_new_article(type[:class]) %>" onmouseover="javascript: jQuery(this).addClass('mouseover')" onmouseout="jQuery(this).removeClass('mouseover')">
8 8 <strong><%= type[:short_description] %></strong>
9 9 <div class='description'><%= type[:description] %></div>
10 10 </li>
... ...