Commit d6077c5689740068d5de91cd3a351786f3ce99aa
Committed by
Antonio Terceiro
1 parent
604ed17a
Exists in
master
and in
29 other branches
A lightbox is displayed with all available articles
* Added rss-feed-16.png (a 16x16 image of rss feed) * icon_name now is a class method * removing image_tags with article's icons * added icon_for_article on class to display icons (ActionItem1770)
Showing
41 changed files
with
355 additions
and
112 deletions
Show diff stats
app/controllers/my_profile/cms_controller.rb
... | ... | @@ -44,6 +44,7 @@ class CmsController < MyProfileController |
44 | 44 | TextileArticle, |
45 | 45 | Event |
46 | 46 | ] |
47 | + articles += special_article_types if params && params[:cms] | |
47 | 48 | parent_id = params ? params[:parent_id] : nil |
48 | 49 | if !parent_id or !Article.find(parent_id).has_posts? |
49 | 50 | articles += [ | ... | ... |
app/helpers/assets_helper.rb
... | ... | @@ -9,7 +9,7 @@ module AssetsHelper |
9 | 9 | [ options.merge(:asset => 'products'), "icon-menu-product", _('Products') ], |
10 | 10 | [ options.merge(:asset => 'enterprises'), "icon-menu-enterprise", __('Enterprises') ], |
11 | 11 | [ options.merge(:asset => 'communities'), "icon-menu-community", __('Communities') ], |
12 | - [ options.merge(:asset => 'events'), "icon-menu-events", __('Events') ], | |
12 | + [ options.merge(:asset => 'events'), "icon-event", __('Events') ], | |
13 | 13 | |
14 | 14 | ].select do |target, css_class, name| |
15 | 15 | !environment.enabled?('disable_asset_' + target[:asset]) | ... | ... |
app/helpers/cms_helper.rb
... | ... | @@ -30,9 +30,13 @@ module CmsHelper |
30 | 30 | def link_to_article(article) |
31 | 31 | article_name = short_filename(article.name, 30) |
32 | 32 | if article.folder? |
33 | - link_to article_name, :action => 'view', :id => article.id | |
33 | + link_to article_name, {:action => 'view', :id => article.id}, :class => icon_for_article(article) | |
34 | 34 | else |
35 | - link_to article_name, article.url | |
35 | + if article.image? | |
36 | + image_tag(icon_for_article(article)) + link_to(article_name, article.url) | |
37 | + else | |
38 | + link_to article_name, article.url, :class => icon_for_article(article) | |
39 | + end | |
36 | 40 | end |
37 | 41 | end |
38 | 42 | ... | ... |
app/helpers/events_helper.rb
... | ... | @@ -15,7 +15,7 @@ module EventsHelper |
15 | 15 | def display_event_in_listing(article) |
16 | 16 | content_tag( |
17 | 17 | 'tr', |
18 | - content_tag('td', link_to(image_tag(icon_for_article(article)) + article.name, article.url)), | |
18 | + content_tag('td', link_to(article.name, article.url, :class => icon_for_article(article))), | |
19 | 19 | :class => 'agenda-item' |
20 | 20 | ) |
21 | 21 | end | ... | ... |
app/helpers/folder_helper.rb
... | ... | @@ -21,9 +21,14 @@ module FolderHelper |
21 | 21 | end |
22 | 22 | |
23 | 23 | def display_article_in_listing(article, recursive = false, level = 0) |
24 | + article_link = if article.image? | |
25 | + link_to(' ' * (level * 4) + image_tag(icon_for_article(article)) + short_filename(article.name), article.url.merge(:view => true)) | |
26 | + else | |
27 | + link_to(' ' * (level * 4) + short_filename(article.name), article.url.merge(:view => true), :class => icon_for_article(article)) | |
28 | + end | |
24 | 29 | result = content_tag( |
25 | 30 | 'tr', |
26 | - content_tag('td', link_to((' ' * (level * 4) ) + image_tag(icon_for_article(article)) + short_filename(article.name), article.url.merge(:view => true)))+ | |
31 | + content_tag('td', article_link )+ | |
27 | 32 | content_tag('td', show_date(article.updated_at), :class => 'last-update'), |
28 | 33 | :class => 'sitemap-item' |
29 | 34 | ) |
... | ... | @@ -35,18 +40,18 @@ module FolderHelper |
35 | 40 | end |
36 | 41 | |
37 | 42 | def icon_for_article(article) |
38 | - icon = article.icon_name | |
43 | + icon = article.class.icon_name(article) | |
39 | 44 | if (icon =~ /\//) |
40 | 45 | icon |
41 | 46 | else |
42 | - if File.exists?(File.join(RAILS_ROOT, 'public', 'images', 'icons-mime', "#{icon}.png")) | |
43 | - "icons-mime/#{icon}.png" | |
44 | - else | |
45 | - "icons-mime/unknown.png" | |
46 | - end | |
47 | + 'icon icon-' + icon | |
47 | 48 | end |
48 | 49 | end |
49 | 50 | |
51 | + def icon_for_new_article(type) | |
52 | + "icon-new icon-new%s" % type.constantize.icon_name | |
53 | + end | |
54 | + | |
50 | 55 | def custom_options_for_article(article) |
51 | 56 | @article = article |
52 | 57 | content_tag('h4', _('Options')) + | ... | ... |
app/models/article.rb
app/models/blog.rb
... | ... | @@ -54,6 +54,10 @@ class Blog < Folder |
54 | 54 | end |
55 | 55 | end |
56 | 56 | |
57 | + def self.icon_name(article = nil) | |
58 | + 'blog' | |
59 | + end | |
60 | + | |
57 | 61 | settings_items :visualization_format, :type => :string, :default => 'full' |
58 | 62 | validates_inclusion_of :visualization_format, :in => [ 'full', 'short' ], :if => :visualization_format |
59 | 63 | ... | ... |
app/models/event.rb
app/models/folder.rb
app/models/forum.rb
app/models/gallery.rb
app/models/link_list_block.rb
app/models/organization.rb
... | ... | @@ -102,7 +102,7 @@ class Organization < Profile |
102 | 102 | links = [ |
103 | 103 | {:name => _("Community's profile"), :address => '/profile/{profile}', :icon => 'ok'}, |
104 | 104 | {:name => _('Invite Friends'), :address => '/profile/{profile}/invite/friends', :icon => 'send'}, |
105 | - {:name => _('Agenda'), :address => '/profile/{profile}/events', :icon => 'menu-events'}, | |
105 | + {:name => _('Agenda'), :address => '/profile/{profile}/events', :icon => 'event'}, | |
106 | 106 | {:name => _('Image gallery'), :address => '/{profile}/gallery', :icon => 'photos'}, |
107 | 107 | {:name => _('Blog'), :address => '/{profile}/blog', :icon => 'edit'}, |
108 | 108 | ] | ... | ... |
app/models/person.rb
... | ... | @@ -210,7 +210,7 @@ class Person < Profile |
210 | 210 | links = [ |
211 | 211 | {:name => _('Profile'), :address => '/profile/{profile}', :icon => 'menu-people'}, |
212 | 212 | {:name => _('Image gallery'), :address => '/{profile}/gallery', :icon => 'photos'}, |
213 | - {:name => _('Agenda'), :address => '/profile/{profile}/events', :icon => 'menu-events'}, | |
213 | + {:name => _('Agenda'), :address => '/profile/{profile}/events', :icon => 'event'}, | |
214 | 214 | {:name => _('Blog'), :address => '/{profile}/blog', :icon => 'edit'}, |
215 | 215 | ] |
216 | 216 | [ | ... | ... |
app/models/rss_feed.rb
app/models/uploaded_file.rb
... | ... | @@ -46,8 +46,12 @@ class UploadedFile < Article |
46 | 46 | |
47 | 47 | delay_attachment_fu_thumbnails |
48 | 48 | |
49 | - def icon_name | |
50 | - self.image? ? public_filename(:icon) : self.content_type.gsub('/', '-') | |
49 | + def self.icon_name(article = nil) | |
50 | + if article && article.image? | |
51 | + article.public_filename(:icon) | |
52 | + else | |
53 | + 'upload-file' | |
54 | + end | |
51 | 55 | end |
52 | 56 | |
53 | 57 | def mime_type | ... | ... |
app/views/cms/_document_link.rhtml
1 | 1 | <div id='media-listing-folder-documents' > |
2 | 2 | <ul> |
3 | 3 | <% documents.each do |document| %> |
4 | - <li><%= link_to(image_tag(icon_for_article(document)) + document.name, document.view_url) %></li> | |
4 | + <li><%= link_to(document.name, document.view_url, :class => icon_for_article(document)) %></li> | |
5 | 5 | <% end %> |
6 | 6 | </ul> |
7 | 7 | <div id='pagination-documents'> | ... | ... |
app/views/cms/select_article_type.rhtml
1 | -<h2> <%= _('Choose the type of article:') %> </h2> | |
1 | +<h2> <%= _('Choose the type of content:') %> </h2> | |
2 | 2 | |
3 | 3 | <ul id="article_types"> |
4 | 4 | <% for type in @article_types %> |
5 | - <li> | |
6 | - <%= link_to type[:short_description], :action => 'new', :type => type[:name], :parent_id => @parent_id, :back_to => @back_to %> | |
7 | - <br/> <%= type[:description] %> | |
8 | - </li> | |
5 | + <% action = type[:name] == 'UploadedFile' ? {:action => 'upload_files'} : {:action => 'new', :type => type[:name]} %> | |
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')"> | |
8 | + <strong><%= type[:short_description] %></strong> | |
9 | + <div class='description'><%= type[:description] %></div> | |
10 | + </li> | |
11 | + <% end %> | |
9 | 12 | <% end %> |
10 | 13 | </ul> |
14 | +<br style="clear:both" /> | |
11 | 15 | |
12 | 16 | <%= lightbox_close_button(_('Cancel')) %> | ... | ... |
app/views/cms/view.rhtml
... | ... | @@ -5,14 +5,7 @@ |
5 | 5 | <% button_bar(:style => 'margin-bottom: 1em;') do %> |
6 | 6 | <% parent_id = ((@article && @article.allow_children?) ? @article : nil) %> |
7 | 7 | |
8 | - <% if !@article or !@article.has_posts? %> | |
9 | - <%= button :newfolder, _('New folder'), :action => 'new', :type => 'Folder', :parent_id => parent_id %> | |
10 | - <%= button :newblog, _('New Blog'), :action => 'new', :type => 'Blog', :parent_id => parent_id %> | |
11 | - <%= button :newforum, _('New Forum'), :action => 'new', :type => 'Forum', :parent_id => parent_id %> | |
12 | - <%= button :newgallery, _('New Gallery'), :action => 'new', :type => 'Gallery', :parent_id => parent_id %> | |
13 | - <%= button('upload-file', _('Upload files'), :action => 'upload_files', :parent_id => parent_id) %> | |
14 | - <% end %> | |
15 | - <%= lightbox_button('new', label_for_new_article(@article), :action => 'new', :parent_id => parent_id) %> | |
8 | + <%= lightbox_button('new', _('New content'), :action => 'new', :parent_id => parent_id, :cms => true) %> | |
16 | 9 | <%= button(:back, _('Back to control panel'), :controller => 'profile_editor', :action => "index") %> |
17 | 10 | <% end %> |
18 | 11 | |
... | ... | @@ -36,11 +29,10 @@ |
36 | 29 | <% if @article %> |
37 | 30 | <tr> |
38 | 31 | <td> |
39 | - <%= image_tag 'icons-mime/gnome-folder.png' %> | |
40 | 32 | <% if @article.parent %> |
41 | - <%= link_to '.. (' + _('parent folder') + ')', :action => 'view', :id => @article.parent.id %> | |
33 | + <%= link_to '.. (' + _('parent folder') + ')', {:action => 'view', :id => @article.parent.id}, :class => 'icon-parent-folder' %> | |
42 | 34 | <% else %> |
43 | - <%= link_to '.. (' + _('parent folder') + ')', :action => 'index' %> | |
35 | + <%= link_to '.. (' + _('parent folder') + ')', {:action => 'index'}, :class => 'icon-parent-folder' %> | |
44 | 36 | <% end %> |
45 | 37 | </td> |
46 | 38 | <td><%= Folder.short_description %></td> |
... | ... | @@ -51,7 +43,6 @@ |
51 | 43 | <% @articles.each do |article| %> |
52 | 44 | <tr> |
53 | 45 | <td> |
54 | - <%= image_tag(icon_for_article(article)) %> | |
55 | 46 | <%= link_to_article(article) %> |
56 | 47 | </td> |
57 | 48 | <td> | ... | ... |
app/views/search/_article.rhtml
1 | 1 | <li> |
2 | - <%= image_tag 'icons-mime/text-html.png', :style => 'float: left' %> | |
3 | - <strong><%= link_to(article.title, article.url) %></strong> | |
2 | + <strong><%= link_to(article.title, article.url, :class => icon_for_article(article)) %></strong> | |
4 | 3 | <div class="item_meta"> |
5 | 4 | <% if article.last_changed_by %> |
6 | 5 | <span class="cat_item_by"> | ... | ... |
app/views/search/_event.rhtml
1 | 1 | <li> |
2 | - <%= image_tag 'icons-mime/event.png', :style => 'float: left' %> | |
3 | - <strong><%= link_to(event.title, event.url) %></strong> | |
2 | + <strong><%= link_to(event.title, event.url, :class => icon_for_article(event)) %></strong> | |
4 | 3 | <div class="item_meta"> |
5 | 4 | <%= show_period(event.start_date, event.end_date) %> |
6 | 5 | </div> | ... | ... |
features/blog.feature
... | ... | @@ -30,7 +30,8 @@ Feature: blog |
30 | 30 | Scenario: redirect to blog after create blog from cms |
31 | 31 | Given I go to the Control panel |
32 | 32 | And I follow "Manage Content" |
33 | - When I follow "New Blog" | |
33 | + And I follow "New content" | |
34 | + When I follow "Blog" | |
34 | 35 | And I fill in "Title" with "Blog from cms" |
35 | 36 | And I press "Save" |
36 | 37 | Then I should be on /joaosilva/blog-from-cms |
... | ... | @@ -38,12 +39,14 @@ Feature: blog |
38 | 39 | Scenario: create multiple blogs |
39 | 40 | Given I go to the Control panel |
40 | 41 | And I follow "Manage Content" |
41 | - And I follow "New Blog" | |
42 | + And I follow "New content" | |
43 | + And I follow "Blog" | |
42 | 44 | And I fill in "Title" with "Blog One" |
43 | 45 | And I press "Save" |
44 | 46 | Then I go to the Control panel |
45 | 47 | And I follow "Manage Content" |
46 | - And I follow "New Blog" | |
48 | + And I follow "New content" | |
49 | + And I follow "Blog" | |
47 | 50 | And I fill in "Title" with "Blog Two" |
48 | 51 | And I press "Save" |
49 | 52 | Then I should not see "error" |
... | ... | @@ -52,7 +55,8 @@ Feature: blog |
52 | 55 | Scenario: cancel button back to cms |
53 | 56 | Given I go to the Control panel |
54 | 57 | And I follow "Manage Content" |
55 | - And I follow "New Blog" | |
58 | + And I follow "New content" | |
59 | + And I follow "Blog" | |
56 | 60 | When I follow "Cancel" within ".main-block" |
57 | 61 | Then I should be on /myprofile/joaosilva/cms |
58 | 62 | |
... | ... | @@ -101,5 +105,6 @@ Feature: blog |
101 | 105 | Scenario: display tag list field when creating new blog |
102 | 106 | Given I go to the Control panel |
103 | 107 | And I follow "Manage Content" |
104 | - When I follow "New blog" | |
108 | + And I follow "New content" | |
109 | + When I follow "Blog" | |
105 | 110 | Then I should see "Tag list" | ... | ... |
features/edit_article.feature
... | ... | @@ -15,7 +15,8 @@ Feature: edit article |
15 | 15 | Scenario: create a folder |
16 | 16 | Given I am on Joao Silva's control panel |
17 | 17 | And I follow "Manage Content" |
18 | - When I follow "New Folder" | |
18 | + And I follow "New content" | |
19 | + When I follow "Folder" | |
19 | 20 | And I fill in "Title" with "My Folder" |
20 | 21 | And I press "Save" |
21 | 22 | And I go to Joao Silva's control panel |
... | ... | @@ -24,7 +25,8 @@ Feature: edit article |
24 | 25 | Scenario: redirect to the created folder |
25 | 26 | Given I am on Joao Silva's control panel |
26 | 27 | And I follow "Manage Content" |
27 | - When I follow "New Folder" | |
28 | + And I follow "New content" | |
29 | + When I follow "Folder" | |
28 | 30 | And I fill in "Title" with "My Folder" |
29 | 31 | And I press "Save" |
30 | 32 | Then I should see "My Folder" |
... | ... | @@ -33,27 +35,29 @@ Feature: edit article |
33 | 35 | Scenario: cancel button back to cms |
34 | 36 | Given I go to the Control panel |
35 | 37 | And I follow "Manage Content" |
36 | - And I follow "New Folder" | |
38 | + And I follow "New content" | |
39 | + And I follow "Folder" | |
37 | 40 | When I follow "Cancel" within ".main-block" |
38 | 41 | Then I should be on Joao Silva's cms |
39 | 42 | |
40 | 43 | Scenario: display tag list field when creating event |
41 | 44 | Given I go to the Control panel |
42 | 45 | And I follow "Manage Content" |
43 | - And I follow "New article" | |
46 | + And I follow "New content" | |
44 | 47 | When I follow "Event" |
45 | 48 | Then I should see "Tag list" |
46 | 49 | |
47 | 50 | Scenario: display tag list field when creating folder |
48 | 51 | Given I go to the Control panel |
49 | 52 | And I follow "Manage Content" |
50 | - When I follow "New folder" | |
53 | + And I follow "New content" | |
54 | + When I follow "Folder" | |
51 | 55 | Then I should see "Tag list" |
52 | 56 | |
53 | 57 | Scenario: create new article with tags |
54 | 58 | Given I go to the Control panel |
55 | 59 | And I follow "Manage Content" |
56 | - And I follow "New article" | |
60 | + And I follow "New content" | |
57 | 61 | When I follow "Text article with Textile markup language" |
58 | 62 | Then I should see "Tag list" |
59 | 63 | When I fill in "Title" with "Article with tags" |
... | ... | @@ -66,7 +70,7 @@ Feature: edit article |
66 | 70 | Scenario: redirect to the created article |
67 | 71 | Given I am on Joao Silva's control panel |
68 | 72 | And I follow "Manage Content" |
69 | - When I follow "New article" | |
73 | + When I follow "New content" | |
70 | 74 | When I follow "Text article with visual editor" |
71 | 75 | And I fill in "Title" with "My Article" |
72 | 76 | And I press "Save" |
... | ... | @@ -91,7 +95,8 @@ Feature: edit article |
91 | 95 | Scenario: create an article inside a folder |
92 | 96 | Given I am on Joao Silva's control panel |
93 | 97 | And I follow "Manage Content" |
94 | - And I follow "New Folder" | |
98 | + And I follow "New content" | |
99 | + And I follow "Folder" | |
95 | 100 | And I fill in "Title" with "My Folder" |
96 | 101 | And I press "Save" |
97 | 102 | Then I should be on /joaosilva/my-folder |
... | ... | @@ -105,7 +110,8 @@ Feature: edit article |
105 | 110 | Scenario: cancel button back to folder after giving up creating |
106 | 111 | Given I am on Joao Silva's control panel |
107 | 112 | And I follow "Manage Content" |
108 | - And I follow "New Folder" | |
113 | + And I follow "New content" | |
114 | + And I follow "Folder" | |
109 | 115 | And I fill in "Title" with "My Folder" |
110 | 116 | And I press "Save" |
111 | 117 | Then I should be on /joaosilva/my-folder |
... | ... | @@ -125,7 +131,7 @@ Feature: edit article |
125 | 131 | Scenario: save and continue when creating a new article |
126 | 132 | Given I am on Joao Silva's control panel |
127 | 133 | When I follow "Manage Content" |
128 | - And I follow "New article" | |
134 | + And I follow "New content" | |
129 | 135 | And I follow "Text article with visual editor" |
130 | 136 | And I fill in "Title" with "My new article" |
131 | 137 | And I fill in "Text" with "text for the new article" | ... | ... |
features/forum.feature
... | ... | @@ -13,7 +13,8 @@ Feature: forum |
13 | 13 | Scenario: create a forum |
14 | 14 | Given I go to the Control panel |
15 | 15 | And I follow "Manage Content" |
16 | - When I follow "New Forum" | |
16 | + And I follow "New content" | |
17 | + When I follow "Forum" | |
17 | 18 | And I fill in "Title" with "My Forum" |
18 | 19 | And I press "Save" |
19 | 20 | Then I should see "Configure forum" |
... | ... | @@ -21,7 +22,8 @@ Feature: forum |
21 | 22 | Scenario: redirect to forum after create forum from cms |
22 | 23 | Given I go to the Control panel |
23 | 24 | And I follow "Manage Content" |
24 | - When I follow "New Forum" | |
25 | + And I follow "New content" | |
26 | + When I follow "Forum" | |
25 | 27 | And I fill in "Title" with "Forum from cms" |
26 | 28 | And I press "Save" |
27 | 29 | Then I should be on /joaosilva/forum-from-cms |
... | ... | @@ -29,12 +31,14 @@ Feature: forum |
29 | 31 | Scenario: create multiple forums |
30 | 32 | Given I go to the Control panel |
31 | 33 | And I follow "Manage Content" |
32 | - And I follow "New Forum" | |
34 | + And I follow "New content" | |
35 | + And I follow "Forum" | |
33 | 36 | And I fill in "Title" with "Forum One" |
34 | 37 | And I press "Save" |
35 | 38 | Then I go to the Control panel |
36 | 39 | And I follow "Manage Content" |
37 | - And I follow "New Forum" | |
40 | + And I follow "New content" | |
41 | + And I follow "Forum" | |
38 | 42 | And I fill in "Title" with "Forum Two" |
39 | 43 | And I press "Save" |
40 | 44 | Then I should not see "error" |
... | ... | @@ -43,14 +47,16 @@ Feature: forum |
43 | 47 | Scenario: cancel button back to cms |
44 | 48 | Given I go to the Control panel |
45 | 49 | And I follow "Manage Content" |
46 | - And I follow "New Forum" | |
50 | + And I follow "New content" | |
51 | + And I follow "Forum" | |
47 | 52 | When I follow "Cancel" within ".main-block" |
48 | 53 | Then I should be on /myprofile/joaosilva/cms |
49 | 54 | |
50 | 55 | Scenario: cancel button back to myprofile |
51 | 56 | Given I go to the Control panel |
52 | 57 | And I follow "Manage Content" |
53 | - And I follow "New Forum" | |
58 | + And I follow "New content" | |
59 | + And I follow "Forum" | |
54 | 60 | When I follow "Cancel" within ".main-block" |
55 | 61 | Then I should be on /myprofile/joaosilva/cms |
56 | 62 | ... | ... |
... | ... | @@ -0,0 +1,68 @@ |
1 | +Feature: create content on cms | |
2 | + As a noosfero user | |
3 | + I want to create articles and upload files | |
4 | + | |
5 | + Background: | |
6 | + Given the following users | |
7 | + | login | name | | |
8 | + | joaosilva | Joao Silva | | |
9 | + And I am logged in as "joaosilva" | |
10 | + And I am on Joao Silva's cms | |
11 | + | |
12 | + Scenario: open page to select type of content | |
13 | + Given I follow "New Content" | |
14 | + Then I should see "Choose the type of content" | |
15 | + | |
16 | + Scenario: list all content types | |
17 | + Given I follow "New content" | |
18 | + Then I should see "Text article with visual editor" | |
19 | + And I should see "Text article with Textile markup" | |
20 | + And I should see "Folder" | |
21 | + And I should see "Blog" | |
22 | + And I should see "Uploaded file" | |
23 | + And I should see "Event" | |
24 | + | |
25 | + Scenario: create a folder | |
26 | + Given I follow "New content" | |
27 | + When I follow "Folder" | |
28 | + And I fill in "Title" with "My Folder" | |
29 | + And I press "Save" | |
30 | + And I go to Joao Silva's cms | |
31 | + Then I should see "My Folder" | |
32 | + | |
33 | + Scenario: create a tiny_mce article | |
34 | + Given I follow "New content" | |
35 | + When I follow "Text article with visual editor" | |
36 | + And I fill in "Title" with "My tiny_mce article" | |
37 | + And I press "Save" | |
38 | + And I go to Joao Silva's cms | |
39 | + Then I should see "My tiny_mce article" | |
40 | + | |
41 | + Scenario: create a textile article | |
42 | + Given I follow "New content" | |
43 | + When I follow "Text article with Textile markup" | |
44 | + And I fill in "Title" with "My textile article" | |
45 | + And I press "Save" | |
46 | + And I go to Joao Silva's cms | |
47 | + Then I should see "My textile article" | |
48 | + | |
49 | + Scenario: create a Blog | |
50 | + Given I follow "New content" | |
51 | + When I follow "Blog" | |
52 | + And I fill in "Title" with "My blog" | |
53 | + And I press "Save" | |
54 | + And I go to Joao Silva's cms | |
55 | + Then I should see "My blog" | |
56 | + | |
57 | + Scenario: create an event | |
58 | + Given I follow "New content" | |
59 | + When I follow "Event" | |
60 | + And I fill in "Title" with "My event" | |
61 | + And I press "Save" | |
62 | + And I go to Joao Silva's cms | |
63 | + Then I should see "My event" | |
64 | + | |
65 | + Scenario: redirect to upload files if choose UploadedFile | |
66 | + Given I follow "New content" | |
67 | + When I follow "Uploaded file" | |
68 | + Then I should be on /myprofile/joaosilva/cms/upload_files | ... | ... |
features/publish_article.feature
... | ... | @@ -55,7 +55,7 @@ Feature: publish article |
55 | 55 | And "Maria Silva" is a member of "Sample Community" |
56 | 56 | And I am on Maria Silva's control panel |
57 | 57 | And I follow "Manage Content" |
58 | - And I follow "New article" | |
58 | + And I follow "New content" | |
59 | 59 | And I follow "Text article with Textile markup language" |
60 | 60 | And I fill in the following: |
61 | 61 | | Title | Sample Article | | ... | ... |
public/designs/icons/tango/style.css
... | ... | @@ -6,7 +6,9 @@ |
6 | 6 | .icon-close { background-image: url(Tango/16x16/actions/gtk-cancel.png) } |
7 | 7 | .icon-newfolder { background-image: url(Tango/16x16/actions/folder-new.png) } |
8 | 8 | .icon-folder { background-image: url(Tango/16x16/places/folder.png) } |
9 | +.icon-parent-folder { background-image: url(Tango/16x16/places/folder_home.png) } | |
9 | 10 | .icon-newblog { background-image: url(mod/16x16/apps/text-editor.png) } |
11 | +.icon-blog { background-image: url(mod/16x16/apps/text-editor.png) } | |
10 | 12 | /*.icon-open { background-image: url(folder-open.gif) } UNUSED*/ |
11 | 13 | /*.icon-cms { background-image: url(abiword_48.png) } UNUSED*/ |
12 | 14 | .icon-save { background-image: url(Tango/16x16/actions/filesave.png) } |
... | ... | @@ -57,13 +59,17 @@ |
57 | 59 | .icon-menu-search { background-image: url(Tango/16x16/actions/search.png) } |
58 | 60 | /*.icon-menu-ed-design { background-image: url(edit-design-HC.gif) } UNUSED */ |
59 | 61 | .icon-menu-events { background-image: url(Tango/16x16/mimetypes/stock_calendar.png) } |
62 | +.icon-event { background-image: url(Tango/16x16/mimetypes/stock_calendar.png) } | |
63 | +.icon-newevent { background-image: url(Tango/16x16/mimetypes/stock_calendar.png) } | |
60 | 64 | .icon-menu-articles { background-image: url(Tango/16x16/apps/text-editor.png) } |
61 | 65 | /*.icon-menu-comments { background-image: url(blog-HC.gif) } UNUSED */ |
62 | 66 | .icon-menu-people { background-image: url(mod/16x16/apps/user.png) } |
63 | 67 | .icon-menu-mail { background-image: url(Tango/16x16/apps/email.png) } |
64 | 68 | .icon-upload-file { background-image: url(Tango/16x16/actions/filesave.png) } |
69 | +.icon-newupload-file { background-image: url(Tango/16x16/actions/filesave.png) } | |
65 | 70 | .icon-slideshow { background-image: url(Tango/16x16/mimetypes/x-office-presentation.png) } |
66 | 71 | .icon-photos { background-image: url(Tango/16x16/devices/camera-photo.png) } |
72 | +.icon-text-html { background-image: url(Tango/16x16/mimetypes/text-html.png) } | |
67 | 73 | |
68 | 74 | .icon-media-pause { background-image: url(Tango/16x16/actions/media-playback-pause.png) } |
69 | 75 | .icon-media-play { background-image: url(Tango/16x16/actions/media-playback-start.png) } |
... | ... | @@ -74,5 +80,6 @@ |
74 | 80 | .icon-scrap { background-image: url(Tango/16x16/actions/format-justify-left.png) } |
75 | 81 | .icon-reply { background-image: url(Tango/16x16/actions/mail-reply-sender.png) } |
76 | 82 | .icon-newforum { background-image: url(Tango/16x16/apps/system-users.png) } |
83 | +.icon-forum { background-image: url(Tango/16x16/apps/system-users.png) } | |
77 | 84 | .icon-newgallery { background-image: url(Tango/16x16/mimetypes/image-x-generic.png) } |
78 | 85 | .icon-locale { background-image: url(Tango/16x16/apps/preferences-desktop-locale.png) } |
79 | 86 | \ No newline at end of file | ... | ... |
849 Bytes
public/stylesheets/application.css
... | ... | @@ -315,11 +315,21 @@ div.pending-tasks { |
315 | 315 | |
316 | 316 | /* sitemap and agenda */ |
317 | 317 | |
318 | +.agenda-item a.icon, | |
319 | +.sitemap-item a.icon { | |
320 | + background-repeat: no-repeat; | |
321 | + padding-left: 20px; | |
322 | +} | |
323 | + | |
324 | +.agenda-item .icon:hover, | |
325 | +.sitemap-item .icon:hover { | |
326 | + background-color: transparent; | |
327 | +} | |
328 | + | |
318 | 329 | .sitemap-item a:link, |
319 | 330 | .agenda-item a:link, |
320 | 331 | .sitemap-item a:visited, |
321 | 332 | .agenda-item a:visited { |
322 | - display: block; | |
323 | 333 | border: none; |
324 | 334 | text-decoration: none; |
325 | 335 | } |
... | ... | @@ -329,7 +339,6 @@ div.pending-tasks { |
329 | 339 | } |
330 | 340 | .sitemap-item a:hover, |
331 | 341 | .agenda-item a:hover { |
332 | - background: #e0e0e0; | |
333 | 342 | color: red; |
334 | 343 | text-decoration: underline; |
335 | 344 | } |
... | ... | @@ -2750,13 +2759,64 @@ div#activation_enterprise div { |
2750 | 2759 | |
2751 | 2760 | /* ==> public/stylesheets/controller_cms.css <== */ |
2752 | 2761 | |
2753 | -.controller-cms #article_types li { | |
2754 | - margin-bottom: 14px; | |
2762 | + | |
2763 | +table.cms-articles img { | |
2764 | + width: 16px; | |
2765 | + height: 16px; | |
2766 | +} | |
2767 | + | |
2768 | +table.cms-articles a.icon { | |
2769 | + display: block; | |
2770 | + border: none; | |
2771 | +} | |
2772 | + | |
2773 | +table.cms-articles a.icon, | |
2774 | +table.cms-articles a.icon-parent-folder { | |
2775 | + padding: 0px 0px 3px 20px; | |
2776 | + background-repeat: no-repeat; | |
2777 | +} | |
2778 | + | |
2779 | +table.cms-articles .icon:hover { | |
2780 | + background-color: transparent; | |
2781 | +} | |
2782 | + | |
2783 | +#article_types { | |
2784 | + padding-left: 5px; | |
2785 | + margin-top: 20px; | |
2786 | +} | |
2787 | + | |
2788 | +#article_types li { | |
2755 | 2789 | list-style: none; |
2790 | + float: left; | |
2791 | + width: 180px; | |
2792 | + height: 50px; | |
2793 | + background-repeat: no-repeat; | |
2794 | + background-position: 5px 5px; | |
2795 | + padding-left: 30px; | |
2796 | + padding-right: 12px; | |
2797 | + padding-top: 5px; | |
2798 | + padding-bottom: 5px; | |
2799 | + -moz-border-radius: 5px; | |
2800 | + -webkit-border-radius: 5px; | |
2756 | 2801 | } |
2757 | 2802 | |
2758 | -.controller-cms #article_types a { | |
2759 | - font-weight: bold; | |
2803 | +#article_types .description { | |
2804 | + color: #888a85; | |
2805 | + font-size: smaller; | |
2806 | +} | |
2807 | + | |
2808 | +#article_types .icon-newrss-feed, | |
2809 | +#content .icon-rss-feed { | |
2810 | + background-image: url(../images/icons-mime/rss-feed-16.png); | |
2811 | +} | |
2812 | + | |
2813 | +#article_types a { | |
2814 | + text-decoration: none; | |
2815 | + color: black; | |
2816 | +} | |
2817 | + | |
2818 | +#article_types li.mouseover { | |
2819 | + background-color: #eeeeec; | |
2760 | 2820 | } |
2761 | 2821 | |
2762 | 2822 | .controller-cms #article-subitems-hide.hide-button { |
... | ... | @@ -3736,6 +3796,21 @@ h1#agenda-title { |
3736 | 3796 | width: 100%; |
3737 | 3797 | } |
3738 | 3798 | |
3799 | +#search-results li a.icon { | |
3800 | + display: block; | |
3801 | + border: none; | |
3802 | + padding-left: 20px; | |
3803 | + background-repeat: no-repeat; | |
3804 | +} | |
3805 | + | |
3806 | +#search-results li .icon:hover { | |
3807 | + background-color: transparent; | |
3808 | +} | |
3809 | + | |
3810 | +#search-results li:hover { | |
3811 | + background-color: #F0F0F0; | |
3812 | +} | |
3813 | + | |
3739 | 3814 | .controller-search .has_cat_list #map, |
3740 | 3815 | .controller-search .msie .has_cat_list #map, |
3741 | 3816 | .controller-search .has_cat_list .only-one-result-box .search-results-box, | ... | ... |
public/stylesheets/media_listing.css
... | ... | @@ -40,6 +40,10 @@ h4 { |
40 | 40 | margin: 0px; |
41 | 41 | } |
42 | 42 | |
43 | +#media-listing li:hover { | |
44 | + background-color: #CCC; | |
45 | +} | |
46 | + | |
43 | 47 | #media-listing a { |
44 | 48 | text-decoration: none; |
45 | 49 | } |
... | ... | @@ -97,10 +101,24 @@ h4 { |
97 | 101 | text-align: center; |
98 | 102 | } |
99 | 103 | |
100 | -#media-listing-folder-documents img { | |
104 | +#media-listing-documents li { | |
105 | + padding-bottom: 5px; | |
106 | +} | |
107 | + | |
108 | +#media-listing-folder-documents a.icon { | |
109 | + background-repeat: no-repeat; | |
110 | + padding-left: 20px; | |
101 | 111 | border: none; |
102 | 112 | } |
103 | 113 | |
114 | +#media-listing-folder-documents .icon:hover { | |
115 | + background-color: transparent; | |
116 | +} | |
117 | + | |
118 | +#media-listing .icon-rss-feed { | |
119 | + background-image: url(../images/icons-mime/rss-feed-16.png); | |
120 | +} | |
121 | + | |
104 | 122 | #media-listing-upload { |
105 | 123 | width: 98%; |
106 | 124 | padding: 3px; | ... | ... |
test/functional/cms_controller_test.rb
... | ... | @@ -314,6 +314,21 @@ class CmsControllerTest < Test::Unit::TestCase |
314 | 314 | assert_template 'upload_files' |
315 | 315 | end |
316 | 316 | |
317 | + should 'offer to create new content' do | |
318 | + get :index, :profile => profile.identifier | |
319 | + assert_response :success | |
320 | + assert_template 'view' | |
321 | + assert_tag :tag => 'a', :attributes => { :title => 'New content', :href => "/myprofile/#{profile.identifier}/cms/new?cms=true"} | |
322 | + end | |
323 | + | |
324 | + should 'offer to create new content when viewing an article' do | |
325 | + article = fast_create(Article, :profile_id => profile.id) | |
326 | + get :view, :profile => profile.identifier, :id => article.id | |
327 | + assert_response :success | |
328 | + assert_template 'view' | |
329 | + assert_tag :tag => 'a', :attributes => { :title => 'New content', :href => "/myprofile/#{profile.identifier}/cms/new?cms=true&parent_id=#{article.id}"} | |
330 | + end | |
331 | + | |
317 | 332 | should 'offer to create children' do |
318 | 333 | Article.any_instance.stubs(:allow_children?).returns(true) |
319 | 334 | |
... | ... | @@ -321,10 +336,8 @@ class CmsControllerTest < Test::Unit::TestCase |
321 | 336 | article.profile = profile |
322 | 337 | article.save! |
323 | 338 | |
324 | - get :view, :profile => profile.identifier, :id => article.id | |
325 | - assert_response :success | |
326 | - assert_template 'view' | |
327 | - assert_tag :tag => 'a', :attributes => { :href => "/myprofile/#{profile.identifier}/cms/new?parent_id=#{article.id}"} | |
339 | + get :new, :profile => profile.identifier, :parent_id => article.id, :cms => true | |
340 | + assert_tag :tag => 'a', :attributes => { :href => "/myprofile/#{profile.identifier}/cms/new?parent_id=#{article.id}&type=TextileArticle"} | |
328 | 341 | end |
329 | 342 | |
330 | 343 | should 'not offer to create children if article does not accept them' do |
... | ... | @@ -476,13 +489,13 @@ class CmsControllerTest < Test::Unit::TestCase |
476 | 489 | end |
477 | 490 | |
478 | 491 | should 'offer to create new top-level folder' do |
479 | - get :index, :profile => profile.identifier | |
492 | + get :new, :profile => profile.identifier, :cms => true | |
480 | 493 | assert_tag :tag => 'a', :attributes => { :href => "/myprofile/#{profile.identifier}/cms/new?type=Folder"} |
481 | 494 | end |
482 | 495 | |
483 | 496 | should 'offer to create sub-folder' do |
484 | 497 | f = Folder.new(:name => 'f'); profile.articles << f; f.save! |
485 | - get :view, :profile => profile.identifier, :id => f.id | |
498 | + get :new, :profile => profile.identifier, :parent_id => f.id, :cms => true | |
486 | 499 | |
487 | 500 | assert_tag :tag => 'a', :attributes => { :href => "/myprofile/#{profile.identifier}/cms/new?parent_id=#{f.id}&type=Folder" } |
488 | 501 | end |
... | ... | @@ -866,18 +879,18 @@ class CmsControllerTest < Test::Unit::TestCase |
866 | 879 | assert_equal 5, profile.blog.posts_per_page |
867 | 880 | end |
868 | 881 | |
869 | - should "display 'New article' when create children of folder" do | |
882 | + should "display 'New content' when create children of folder" do | |
870 | 883 | a = Folder.new(:name => 'article folder'); profile.articles << a; a.save! |
871 | 884 | Article.stubs(:short_description).returns('bli') |
872 | 885 | get :view, :profile => profile.identifier, :id => a |
873 | - assert_tag :tag => 'a', :content => 'New article' | |
886 | + assert_tag :tag => 'a', :content => 'New content' | |
874 | 887 | end |
875 | 888 | |
876 | - should "display 'New post' when create children of blog" do | |
889 | + should "display 'New content' when create children of blog" do | |
877 | 890 | a = Blog.create!(:name => 'blog_for_test', :profile => profile) |
878 | 891 | Article.stubs(:short_description).returns('bli') |
879 | 892 | get :view, :profile => profile.identifier, :id => a |
880 | - assert_tag :tag => 'a', :content => 'New post' | |
893 | + assert_tag :tag => 'a', :content => 'New content' | |
881 | 894 | end |
882 | 895 | |
883 | 896 | should 'offer confirmation to remove article' do |
... | ... | @@ -927,7 +940,7 @@ class CmsControllerTest < Test::Unit::TestCase |
927 | 940 | |
928 | 941 | process_delayed_job_queue |
929 | 942 | file = profile.articles.find_by_name('rails.png') |
930 | - assert File.exists?(file.icon_name) | |
943 | + assert File.exists?(file.class.icon_name(file)) | |
931 | 944 | file.destroy |
932 | 945 | end |
933 | 946 | |
... | ... | @@ -938,7 +951,7 @@ class CmsControllerTest < Test::Unit::TestCase |
938 | 951 | |
939 | 952 | process_delayed_job_queue |
940 | 953 | file = profile.articles.find_by_name('rails.png') |
941 | - assert File.exists?(file.icon_name) | |
954 | + assert File.exists?(file.class.icon_name(file)) | |
942 | 955 | file.destroy |
943 | 956 | end |
944 | 957 | |
... | ... | @@ -1368,13 +1381,6 @@ class CmsControllerTest < Test::Unit::TestCase |
1368 | 1381 | assert_equal 5, profile.forum.posts_per_page |
1369 | 1382 | end |
1370 | 1383 | |
1371 | - should "display 'New post' when create children of forum" do | |
1372 | - a = Forum.create!(:name => 'forum_for_test', :profile => profile) | |
1373 | - Article.stubs(:short_description).returns('bli') | |
1374 | - get :view, :profile => profile.identifier, :id => a | |
1375 | - assert_tag :tag => 'a', :content => 'New discussion topic' | |
1376 | - end | |
1377 | - | |
1378 | 1384 | should 'go to forum after create it' do |
1379 | 1385 | assert_difference Forum, :count do |
1380 | 1386 | post :new, :type => Forum.name, :profile => profile.identifier, :article => { :name => 'my-forum' }, :back_to => 'control_panel' | ... | ... |
test/unit/article_test.rb
... | ... | @@ -94,7 +94,7 @@ class ArticleTest < Test::Unit::TestCase |
94 | 94 | end |
95 | 95 | |
96 | 96 | should 'inform the icon to be used' do |
97 | - assert_equal 'text-html', Article.new.icon_name | |
97 | + assert_equal 'text-html', Article.icon_name | |
98 | 98 | end |
99 | 99 | |
100 | 100 | should 'provide a (translatable) description' do | ... | ... |
test/unit/blog_test.rb
... | ... | @@ -15,7 +15,11 @@ class BlogTest < ActiveSupport::TestCase |
15 | 15 | end |
16 | 16 | |
17 | 17 | should 'provide own icon name' do |
18 | - assert_not_equal Article.new.icon_name, Blog.new.icon_name | |
18 | + assert_not_equal Article.icon_name, Blog.icon_name | |
19 | + end | |
20 | + | |
21 | + should 'provide blog as icon name' do | |
22 | + assert_equal 'blog', Blog.icon_name | |
19 | 23 | end |
20 | 24 | |
21 | 25 | should 'identify as folder' do | ... | ... |
test/unit/cms_helper_test.rb
... | ... | @@ -21,7 +21,7 @@ class CmsHelperTest < Test::Unit::TestCase |
21 | 21 | should 'display link to folder content if article is folder' do |
22 | 22 | profile = fast_create(Profile) |
23 | 23 | folder = fast_create(Folder, :name => 'My folder', :profile_id => profile.id) |
24 | - expects(:link_to).with('My folder', :action => 'view', :id => folder.id) | |
24 | + expects(:link_to).with('My folder', {:action => 'view', :id => folder.id}, :class => icon_for_article(folder)) | |
25 | 25 | |
26 | 26 | result = link_to_article(folder) |
27 | 27 | end |
... | ... | @@ -29,11 +29,21 @@ class CmsHelperTest < Test::Unit::TestCase |
29 | 29 | should 'display link to article if article is not folder' do |
30 | 30 | profile = fast_create(Profile) |
31 | 31 | article = fast_create(TinyMceArticle, :name => 'My article', :profile_id => profile.id) |
32 | - expects(:link_to).with('My article', article.url) | |
32 | + expects(:link_to).with('My article', article.url, :class => icon_for_article(article)) | |
33 | 33 | |
34 | 34 | result = link_to_article(article) |
35 | 35 | end |
36 | 36 | |
37 | + should 'display image and link if article is an image' do | |
38 | + profile = fast_create(Profile) | |
39 | + file = UploadedFile.create!(:profile => profile, :uploaded_data => fixture_file_upload('/files/rails.png', 'image/png')) | |
40 | + icon = icon_for_article(file) | |
41 | + expects(:image_tag).with(icon).returns('icon') | |
42 | + | |
43 | + expects(:link_to).with('rails.png', file.url).returns('link') | |
44 | + result = link_to_article(file) | |
45 | + end | |
46 | + | |
37 | 47 | should 'display spread button when profile is a person' do |
38 | 48 | profile = fast_create(Person) |
39 | 49 | article = fast_create(TinyMceArticle, :name => 'My article', :profile_id => profile.id) | ... | ... |
test/unit/event_test.rb
test/unit/folder_helper_test.rb
... | ... | @@ -11,14 +11,29 @@ class FolderHelperTest < Test::Unit::TestCase |
11 | 11 | include FolderHelper |
12 | 12 | |
13 | 13 | should 'display icon for articles' do |
14 | - art1 = mock; art1.expects(:icon_name).returns('icon1') | |
15 | - art2 = mock; art2.expects(:icon_name).returns('icon2') | |
14 | + art1 = mock; art1_class = mock | |
15 | + art1.expects(:class).returns(art1_class) | |
16 | + art1_class.expects(:icon_name).returns('icon1') | |
16 | 17 | |
17 | - File.expects(:exists?).with(File.join(RAILS_ROOT, 'public', 'images', 'icons-mime', 'icon1.png')).returns(true) | |
18 | - File.expects(:exists?).with(File.join(RAILS_ROOT, 'public', 'images', 'icons-mime', 'icon2.png')).returns(false) | |
18 | + art2 = mock; art2_class = mock | |
19 | + art2.expects(:class).returns(art2_class) | |
20 | + art2_class.expects(:icon_name).returns('icon2') | |
19 | 21 | |
20 | - assert_equal 'icons-mime/icon1.png', icon_for_article(art1) | |
21 | - assert_equal 'icons-mime/unknown.png', icon_for_article(art2) | |
22 | + assert_equal 'icon icon-icon1', icon_for_article(art1) | |
23 | + assert_equal 'icon icon-icon2', icon_for_article(art2) | |
24 | + end | |
25 | + | |
26 | + should 'display icon for images' do | |
27 | + profile = fast_create(Profile) | |
28 | + file = UploadedFile.create!(:uploaded_data => fixture_file_upload('/files/rails.png', 'image/png'), :profile => profile) | |
29 | + process_delayed_job_queue | |
30 | + | |
31 | + assert_match /rails_icon\.png/, icon_for_article(file.reload) | |
32 | + end | |
33 | + | |
34 | + should 'display icon for type of article' do | |
35 | + Article.expects(:icon_name).returns('article') | |
36 | + assert_match /icon-newarticle/, icon_for_new_article('Article') | |
22 | 37 | end |
23 | 38 | |
24 | 39 | should 'list all the folder\'s children to the owner' do | ... | ... |
test/unit/folder_test.rb
... | ... | @@ -15,7 +15,7 @@ class FolderTest < ActiveSupport::TestCase |
15 | 15 | end |
16 | 16 | |
17 | 17 | should 'provide own icon name' do |
18 | - assert_not_equal Article.new.icon_name, Folder.new.icon_name | |
18 | + assert_not_equal Article.icon_name, Folder.icon_name | |
19 | 19 | end |
20 | 20 | |
21 | 21 | should 'identify as folder' do | ... | ... |
test/unit/forum_test.rb
... | ... | @@ -11,7 +11,11 @@ class ForumTest < ActiveSupport::TestCase |
11 | 11 | end |
12 | 12 | |
13 | 13 | should 'provide own icon name' do |
14 | - assert_not_equal Article.new.icon_name, Forum.new.icon_name | |
14 | + assert_not_equal Article.icon_name, Forum.icon_name | |
15 | + end | |
16 | + | |
17 | + should 'provide forum as icon name' do | |
18 | + assert_equal 'forum', Forum.icon_name | |
15 | 19 | end |
16 | 20 | |
17 | 21 | should 'identify as folder' do | ... | ... |
test/unit/gallery_test.rb
... | ... | @@ -15,7 +15,11 @@ class GalleryTest < ActiveSupport::TestCase |
15 | 15 | end |
16 | 16 | |
17 | 17 | should 'provide own icon name' do |
18 | - assert_not_equal Article.new.icon_name, Gallery.new.icon_name | |
18 | + assert_not_equal Article.icon_name, Gallery.icon_name | |
19 | + end | |
20 | + | |
21 | + should 'provide gallery as icon name' do | |
22 | + assert_not_equal Article.icon_name, Gallery.icon_name | |
19 | 23 | end |
20 | 24 | |
21 | 25 | should 'identify as folder' do | ... | ... |
test/unit/rss_feed_test.rb
... | ... | @@ -190,7 +190,7 @@ class RssFeedTest < Test::Unit::TestCase |
190 | 190 | end |
191 | 191 | |
192 | 192 | should 'provide the correct icon name' do |
193 | - assert_equal 'rss-feed', RssFeed.new.icon_name | |
193 | + assert_equal 'rss-feed', RssFeed.icon_name | |
194 | 194 | end |
195 | 195 | |
196 | 196 | should 'advertise is false before create' do | ... | ... |
test/unit/uploaded_file_test.rb
... | ... | @@ -11,14 +11,11 @@ class UploadedFileTest < Test::Unit::TestCase |
11 | 11 | f = UploadedFile.new |
12 | 12 | f.expects(:image?).returns(true) |
13 | 13 | f.expects(:public_filename).with(:icon).returns('/path/to/file.xyz') |
14 | - assert_equal '/path/to/file.xyz', f.icon_name | |
14 | + assert_equal '/path/to/file.xyz', UploadedFile.icon_name(f) | |
15 | 15 | end |
16 | 16 | |
17 | - should 'return mime-type icon for non-image files' do | |
18 | - f= UploadedFile.new | |
19 | - f.expects(:image?).returns(false) | |
20 | - f.expects(:content_type).returns('application/pdf') | |
21 | - assert_equal 'application-pdf', f.icon_name | |
17 | + should 'return a default icon for uploaded files' do | |
18 | + assert_equal 'upload-file', UploadedFile.icon_name | |
22 | 19 | end |
23 | 20 | |
24 | 21 | should 'use attachment_fu content_type method to return mime_type' do |
... | ... | @@ -213,7 +210,7 @@ class UploadedFileTest < Test::Unit::TestCase |
213 | 210 | f = UploadedFile.new |
214 | 211 | f.expects(:image?).returns(true) |
215 | 212 | f.expects(:public_filename).with(:icon).returns('/path/to/file.xyz') |
216 | - assert_equal '/path/to/file.xyz', f.icon_name | |
213 | + assert_equal '/path/to/file.xyz', UploadedFile.icon_name(f) | |
217 | 214 | end |
218 | 215 | |
219 | 216 | should 'store width and height after processing' do | ... | ... |