Commit b1cfe255e381103508b2c88ed46e3d5290714b52
1 parent
c23f40da
Exists in
master
and in
29 other branches
Improving design of new content view and helper
Showing
3 changed files
with
5 additions
and
5 deletions
Show diff stats
app/controllers/my_profile/cms_controller.rb
| @@ -92,7 +92,7 @@ class CmsController < MyProfileController | @@ -92,7 +92,7 @@ class CmsController < MyProfileController | ||
| 92 | @article_types = [] | 92 | @article_types = [] |
| 93 | available_article_types.each do |type| | 93 | available_article_types.each do |type| |
| 94 | @article_types.push({ | 94 | @article_types.push({ |
| 95 | - :name => type.name, | 95 | + :class => type, |
| 96 | :short_description => type.short_description, | 96 | :short_description => type.short_description, |
| 97 | :description => type.description | 97 | :description => type.description |
| 98 | }) | 98 | }) |
app/helpers/folder_helper.rb
| @@ -52,8 +52,8 @@ module FolderHelper | @@ -52,8 +52,8 @@ module FolderHelper | ||
| 52 | end | 52 | end |
| 53 | end | 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 | end | 57 | end |
| 58 | 58 | ||
| 59 | def custom_options_for_article(article) | 59 | def custom_options_for_article(article) |
app/views/cms/select_article_type.rhtml
| @@ -2,9 +2,9 @@ | @@ -2,9 +2,9 @@ | ||
| 2 | 2 | ||
| 3 | <ul id="article_types"> | 3 | <ul id="article_types"> |
| 4 | <% for type in @article_types %> | 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 | <% content_tag('a', :href => url_for(action.merge(:parent_id => @parent_id, :back_to => @back_to))) do %> | 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 | <strong><%= type[:short_description] %></strong> | 8 | <strong><%= type[:short_description] %></strong> |
| 9 | <div class='description'><%= type[:description] %></div> | 9 | <div class='description'><%= type[:description] %></div> |
| 10 | </li> | 10 | </li> |