diff --git a/app/controllers/my_profile/cms_controller.rb b/app/controllers/my_profile/cms_controller.rb index 8b9af2b..4f611f1 100644 --- a/app/controllers/my_profile/cms_controller.rb +++ b/app/controllers/my_profile/cms_controller.rb @@ -44,6 +44,7 @@ class CmsController < MyProfileController TextileArticle, Event ] + articles += special_article_types if params && params[:cms] parent_id = params ? params[:parent_id] : nil if !parent_id or !Article.find(parent_id).has_posts? articles += [ diff --git a/app/helpers/assets_helper.rb b/app/helpers/assets_helper.rb index d0f40e8..fb8d45d 100644 --- a/app/helpers/assets_helper.rb +++ b/app/helpers/assets_helper.rb @@ -9,7 +9,7 @@ module AssetsHelper [ options.merge(:asset => 'products'), "icon-menu-product", _('Products') ], [ options.merge(:asset => 'enterprises'), "icon-menu-enterprise", __('Enterprises') ], [ options.merge(:asset => 'communities'), "icon-menu-community", __('Communities') ], - [ options.merge(:asset => 'events'), "icon-menu-events", __('Events') ], + [ options.merge(:asset => 'events'), "icon-event", __('Events') ], ].select do |target, css_class, name| !environment.enabled?('disable_asset_' + target[:asset]) diff --git a/app/helpers/cms_helper.rb b/app/helpers/cms_helper.rb index 22c9b2a..e476b4e 100644 --- a/app/helpers/cms_helper.rb +++ b/app/helpers/cms_helper.rb @@ -30,9 +30,13 @@ module CmsHelper def link_to_article(article) article_name = short_filename(article.name, 30) if article.folder? - link_to article_name, :action => 'view', :id => article.id + link_to article_name, {:action => 'view', :id => article.id}, :class => icon_for_article(article) else - link_to article_name, article.url + if article.image? + image_tag(icon_for_article(article)) + link_to(article_name, article.url) + else + link_to article_name, article.url, :class => icon_for_article(article) + end end end diff --git a/app/helpers/events_helper.rb b/app/helpers/events_helper.rb index 9a656ab..530f966 100644 --- a/app/helpers/events_helper.rb +++ b/app/helpers/events_helper.rb @@ -15,7 +15,7 @@ module EventsHelper def display_event_in_listing(article) content_tag( 'tr', - content_tag('td', link_to(image_tag(icon_for_article(article)) + article.name, article.url)), + content_tag('td', link_to(article.name, article.url, :class => icon_for_article(article))), :class => 'agenda-item' ) end diff --git a/app/helpers/folder_helper.rb b/app/helpers/folder_helper.rb index 083fc27..abeff3c 100644 --- a/app/helpers/folder_helper.rb +++ b/app/helpers/folder_helper.rb @@ -21,9 +21,14 @@ module FolderHelper end def display_article_in_listing(article, recursive = false, level = 0) + article_link = if article.image? + link_to(' ' * (level * 4) + image_tag(icon_for_article(article)) + short_filename(article.name), article.url.merge(:view => true)) + else + link_to(' ' * (level * 4) + short_filename(article.name), article.url.merge(:view => true), :class => icon_for_article(article)) + end result = content_tag( 'tr', - content_tag('td', link_to((' ' * (level * 4) ) + image_tag(icon_for_article(article)) + short_filename(article.name), article.url.merge(:view => true)))+ + content_tag('td', article_link )+ content_tag('td', show_date(article.updated_at), :class => 'last-update'), :class => 'sitemap-item' ) @@ -35,18 +40,18 @@ module FolderHelper end def icon_for_article(article) - icon = article.icon_name + icon = article.class.icon_name(article) if (icon =~ /\//) icon else - if File.exists?(File.join(RAILS_ROOT, 'public', 'images', 'icons-mime', "#{icon}.png")) - "icons-mime/#{icon}.png" - else - "icons-mime/unknown.png" - end + 'icon icon-' + icon end end + def icon_for_new_article(type) + "icon-new icon-new%s" % type.constantize.icon_name + end + def custom_options_for_article(article) @article = article content_tag('h4', _('Options')) + diff --git a/app/models/article.rb b/app/models/article.rb index c6bc062..64ceacd 100644 --- a/app/models/article.rb +++ b/app/models/article.rb @@ -198,7 +198,7 @@ class Article < ActiveRecord::Base # to return their specific icons. # # FIXME use mime_type and generate this name dinamically - def icon_name + def self.icon_name(article = nil) 'text-html' end diff --git a/app/models/blog.rb b/app/models/blog.rb index 3fd7950..d4c1c6c 100644 --- a/app/models/blog.rb +++ b/app/models/blog.rb @@ -54,6 +54,10 @@ class Blog < Folder end end + def self.icon_name(article = nil) + 'blog' + end + settings_items :visualization_format, :type => :string, :default => 'full' validates_inclusion_of :visualization_format, :in => [ 'full', 'short' ], :if => :visualization_format diff --git a/app/models/event.rb b/app/models/event.rb index 5746dbb..2695bee 100644 --- a/app/models/event.rb +++ b/app/models/event.rb @@ -37,7 +37,7 @@ class Event < Article _('Event') end - def icon_name + def self.icon_name(article = nil) 'event' end diff --git a/app/models/folder.rb b/app/models/folder.rb index c5387d4..f72a8ac 100644 --- a/app/models/folder.rb +++ b/app/models/folder.rb @@ -15,7 +15,7 @@ class Folder < Article _('A folder, inside which you can put other articles.') end - def icon_name + def self.icon_name(article = nil) 'folder' end diff --git a/app/models/forum.rb b/app/models/forum.rb index 916aaff..b411e6d 100644 --- a/app/models/forum.rb +++ b/app/models/forum.rb @@ -21,4 +21,7 @@ class Forum < Folder true end + def self.icon_name(article = nil) + 'forum' + end end diff --git a/app/models/gallery.rb b/app/models/gallery.rb index a4307e3..60ceba8 100644 --- a/app/models/gallery.rb +++ b/app/models/gallery.rb @@ -20,4 +20,8 @@ class Gallery < Folder true end + def self.icon_name(article = nil) + 'gallery' + end + end diff --git a/app/models/link_list_block.rb b/app/models/link_list_block.rb index d7f4d0e..70ab83b 100644 --- a/app/models/link_list_block.rb +++ b/app/models/link_list_block.rb @@ -25,7 +25,7 @@ class LinkListBlock < Block ['eyes', N_('Eyes')], ['photos', N_('Photos')], ['menu-people', N_('Person')], - ['menu-events', N_('Event')] + ['event', N_('Event')] ] settings_items :links, Array, :default => [] diff --git a/app/models/organization.rb b/app/models/organization.rb index 122a77d..a1dcce0 100644 --- a/app/models/organization.rb +++ b/app/models/organization.rb @@ -102,7 +102,7 @@ class Organization < Profile links = [ {:name => _("Community's profile"), :address => '/profile/{profile}', :icon => 'ok'}, {:name => _('Invite Friends'), :address => '/profile/{profile}/invite/friends', :icon => 'send'}, - {:name => _('Agenda'), :address => '/profile/{profile}/events', :icon => 'menu-events'}, + {:name => _('Agenda'), :address => '/profile/{profile}/events', :icon => 'event'}, {:name => _('Image gallery'), :address => '/{profile}/gallery', :icon => 'photos'}, {:name => _('Blog'), :address => '/{profile}/blog', :icon => 'edit'}, ] diff --git a/app/models/person.rb b/app/models/person.rb index 2ec53d6..374541f 100644 --- a/app/models/person.rb +++ b/app/models/person.rb @@ -210,7 +210,7 @@ class Person < Profile links = [ {:name => _('Profile'), :address => '/profile/{profile}', :icon => 'menu-people'}, {:name => _('Image gallery'), :address => '/{profile}/gallery', :icon => 'photos'}, - {:name => _('Agenda'), :address => '/profile/{profile}/events', :icon => 'menu-events'}, + {:name => _('Agenda'), :address => '/profile/{profile}/events', :icon => 'event'}, {:name => _('Blog'), :address => '/{profile}/blog', :icon => 'edit'}, ] [ diff --git a/app/models/rss_feed.rb b/app/models/rss_feed.rb index 6cad49d..a688f0b 100644 --- a/app/models/rss_feed.rb +++ b/app/models/rss_feed.rb @@ -91,7 +91,7 @@ class RssFeed < Article _('Provides a news feed of your more recent articles.') end - def icon_name + def self.icon_name(article = nil) 'rss-feed' end diff --git a/app/models/uploaded_file.rb b/app/models/uploaded_file.rb index d75b5f4..45c3dcc 100644 --- a/app/models/uploaded_file.rb +++ b/app/models/uploaded_file.rb @@ -46,8 +46,12 @@ class UploadedFile < Article delay_attachment_fu_thumbnails - def icon_name - self.image? ? public_filename(:icon) : self.content_type.gsub('/', '-') + def self.icon_name(article = nil) + if article && article.image? + article.public_filename(:icon) + else + 'upload-file' + end end def mime_type diff --git a/app/views/cms/_document_link.rhtml b/app/views/cms/_document_link.rhtml index 2b856b2..ee7a31c 100644 --- a/app/views/cms/_document_link.rhtml +++ b/app/views/cms/_document_link.rhtml @@ -1,7 +1,7 @@
diff --git a/app/views/cms/select_article_type.rhtml b/app/views/cms/select_article_type.rhtml index 2534d13..1673dbb 100644 --- a/app/views/cms/select_article_type.rhtml +++ b/app/views/cms/select_article_type.rhtml @@ -1,12 +1,16 @@ -

<%= _('Choose the type of article:') %>

+

<%= _('Choose the type of content:') %>

+
<%= lightbox_close_button(_('Cancel')) %> diff --git a/app/views/cms/view.rhtml b/app/views/cms/view.rhtml index 0462ec5..2a4a37c 100644 --- a/app/views/cms/view.rhtml +++ b/app/views/cms/view.rhtml @@ -5,14 +5,7 @@ <% button_bar(:style => 'margin-bottom: 1em;') do %> <% parent_id = ((@article && @article.allow_children?) ? @article : nil) %> - <% if !@article or !@article.has_posts? %> - <%= button :newfolder, _('New folder'), :action => 'new', :type => 'Folder', :parent_id => parent_id %> - <%= button :newblog, _('New Blog'), :action => 'new', :type => 'Blog', :parent_id => parent_id %> - <%= button :newforum, _('New Forum'), :action => 'new', :type => 'Forum', :parent_id => parent_id %> - <%= button :newgallery, _('New Gallery'), :action => 'new', :type => 'Gallery', :parent_id => parent_id %> - <%= button('upload-file', _('Upload files'), :action => 'upload_files', :parent_id => parent_id) %> - <% end %> - <%= lightbox_button('new', label_for_new_article(@article), :action => 'new', :parent_id => parent_id) %> + <%= lightbox_button('new', _('New content'), :action => 'new', :parent_id => parent_id, :cms => true) %> <%= button(:back, _('Back to control panel'), :controller => 'profile_editor', :action => "index") %> <% end %> @@ -36,11 +29,10 @@ <% if @article %> - <%= image_tag 'icons-mime/gnome-folder.png' %> <% if @article.parent %> - <%= link_to '.. (' + _('parent folder') + ')', :action => 'view', :id => @article.parent.id %> + <%= link_to '.. (' + _('parent folder') + ')', {:action => 'view', :id => @article.parent.id}, :class => 'icon-parent-folder' %> <% else %> - <%= link_to '.. (' + _('parent folder') + ')', :action => 'index' %> + <%= link_to '.. (' + _('parent folder') + ')', {:action => 'index'}, :class => 'icon-parent-folder' %> <% end %> <%= Folder.short_description %> @@ -51,7 +43,6 @@ <% @articles.each do |article| %> - <%= image_tag(icon_for_article(article)) %> <%= link_to_article(article) %> diff --git a/app/views/search/_article.rhtml b/app/views/search/_article.rhtml index 1ceab9b..7f75cf5 100644 --- a/app/views/search/_article.rhtml +++ b/app/views/search/_article.rhtml @@ -1,6 +1,5 @@
  • - <%= image_tag 'icons-mime/text-html.png', :style => 'float: left' %> - <%= link_to(article.title, article.url) %> + <%= link_to(article.title, article.url, :class => icon_for_article(article)) %>
    <% if article.last_changed_by %> diff --git a/app/views/search/_event.rhtml b/app/views/search/_event.rhtml index 1d71a2b..c3ac2e9 100644 --- a/app/views/search/_event.rhtml +++ b/app/views/search/_event.rhtml @@ -1,6 +1,5 @@
  • - <%= image_tag 'icons-mime/event.png', :style => 'float: left' %> - <%= link_to(event.title, event.url) %> + <%= link_to(event.title, event.url, :class => icon_for_article(event)) %>
    <%= show_period(event.start_date, event.end_date) %>
    diff --git a/features/blog.feature b/features/blog.feature index ccd22c2..07f877c 100644 --- a/features/blog.feature +++ b/features/blog.feature @@ -30,7 +30,8 @@ Feature: blog Scenario: redirect to blog after create blog from cms Given I go to the Control panel And I follow "Manage Content" - When I follow "New Blog" + And I follow "New content" + When I follow "Blog" And I fill in "Title" with "Blog from cms" And I press "Save" Then I should be on /joaosilva/blog-from-cms @@ -38,12 +39,14 @@ Feature: blog Scenario: create multiple blogs Given I go to the Control panel And I follow "Manage Content" - And I follow "New Blog" + And I follow "New content" + And I follow "Blog" And I fill in "Title" with "Blog One" And I press "Save" Then I go to the Control panel And I follow "Manage Content" - And I follow "New Blog" + And I follow "New content" + And I follow "Blog" And I fill in "Title" with "Blog Two" And I press "Save" Then I should not see "error" @@ -52,7 +55,8 @@ Feature: blog Scenario: cancel button back to cms Given I go to the Control panel And I follow "Manage Content" - And I follow "New Blog" + And I follow "New content" + And I follow "Blog" When I follow "Cancel" within ".main-block" Then I should be on /myprofile/joaosilva/cms @@ -101,5 +105,6 @@ Feature: blog Scenario: display tag list field when creating new blog Given I go to the Control panel And I follow "Manage Content" - When I follow "New blog" + And I follow "New content" + When I follow "Blog" Then I should see "Tag list" diff --git a/features/edit_article.feature b/features/edit_article.feature index 5c2463a..c195d49 100644 --- a/features/edit_article.feature +++ b/features/edit_article.feature @@ -15,7 +15,8 @@ Feature: edit article Scenario: create a folder Given I am on Joao Silva's control panel And I follow "Manage Content" - When I follow "New Folder" + And I follow "New content" + When I follow "Folder" And I fill in "Title" with "My Folder" And I press "Save" And I go to Joao Silva's control panel @@ -24,7 +25,8 @@ Feature: edit article Scenario: redirect to the created folder Given I am on Joao Silva's control panel And I follow "Manage Content" - When I follow "New Folder" + And I follow "New content" + When I follow "Folder" And I fill in "Title" with "My Folder" And I press "Save" Then I should see "My Folder" @@ -33,27 +35,29 @@ Feature: edit article Scenario: cancel button back to cms Given I go to the Control panel And I follow "Manage Content" - And I follow "New Folder" + And I follow "New content" + And I follow "Folder" When I follow "Cancel" within ".main-block" Then I should be on Joao Silva's cms Scenario: display tag list field when creating event Given I go to the Control panel And I follow "Manage Content" - And I follow "New article" + And I follow "New content" When I follow "Event" Then I should see "Tag list" Scenario: display tag list field when creating folder Given I go to the Control panel And I follow "Manage Content" - When I follow "New folder" + And I follow "New content" + When I follow "Folder" Then I should see "Tag list" Scenario: create new article with tags Given I go to the Control panel And I follow "Manage Content" - And I follow "New article" + And I follow "New content" When I follow "Text article with Textile markup language" Then I should see "Tag list" When I fill in "Title" with "Article with tags" @@ -66,7 +70,7 @@ Feature: edit article Scenario: redirect to the created article Given I am on Joao Silva's control panel And I follow "Manage Content" - When I follow "New article" + When I follow "New content" When I follow "Text article with visual editor" And I fill in "Title" with "My Article" And I press "Save" @@ -91,7 +95,8 @@ Feature: edit article Scenario: create an article inside a folder Given I am on Joao Silva's control panel And I follow "Manage Content" - And I follow "New Folder" + And I follow "New content" + And I follow "Folder" And I fill in "Title" with "My Folder" And I press "Save" Then I should be on /joaosilva/my-folder @@ -105,7 +110,8 @@ Feature: edit article Scenario: cancel button back to folder after giving up creating Given I am on Joao Silva's control panel And I follow "Manage Content" - And I follow "New Folder" + And I follow "New content" + And I follow "Folder" And I fill in "Title" with "My Folder" And I press "Save" Then I should be on /joaosilva/my-folder @@ -125,7 +131,7 @@ Feature: edit article Scenario: save and continue when creating a new article Given I am on Joao Silva's control panel When I follow "Manage Content" - And I follow "New article" + And I follow "New content" And I follow "Text article with visual editor" And I fill in "Title" with "My new article" And I fill in "Text" with "text for the new article" diff --git a/features/forum.feature b/features/forum.feature index 5645dee..2d69e24 100644 --- a/features/forum.feature +++ b/features/forum.feature @@ -13,7 +13,8 @@ Feature: forum Scenario: create a forum Given I go to the Control panel And I follow "Manage Content" - When I follow "New Forum" + And I follow "New content" + When I follow "Forum" And I fill in "Title" with "My Forum" And I press "Save" Then I should see "Configure forum" @@ -21,7 +22,8 @@ Feature: forum Scenario: redirect to forum after create forum from cms Given I go to the Control panel And I follow "Manage Content" - When I follow "New Forum" + And I follow "New content" + When I follow "Forum" And I fill in "Title" with "Forum from cms" And I press "Save" Then I should be on /joaosilva/forum-from-cms @@ -29,12 +31,14 @@ Feature: forum Scenario: create multiple forums Given I go to the Control panel And I follow "Manage Content" - And I follow "New Forum" + And I follow "New content" + And I follow "Forum" And I fill in "Title" with "Forum One" And I press "Save" Then I go to the Control panel And I follow "Manage Content" - And I follow "New Forum" + And I follow "New content" + And I follow "Forum" And I fill in "Title" with "Forum Two" And I press "Save" Then I should not see "error" @@ -43,14 +47,16 @@ Feature: forum Scenario: cancel button back to cms Given I go to the Control panel And I follow "Manage Content" - And I follow "New Forum" + And I follow "New content" + And I follow "Forum" When I follow "Cancel" within ".main-block" Then I should be on /myprofile/joaosilva/cms Scenario: cancel button back to myprofile Given I go to the Control panel And I follow "Manage Content" - And I follow "New Forum" + And I follow "New content" + And I follow "Forum" When I follow "Cancel" within ".main-block" Then I should be on /myprofile/joaosilva/cms diff --git a/features/new_content_on_cms.feature b/features/new_content_on_cms.feature new file mode 100644 index 0000000..3be6219 --- /dev/null +++ b/features/new_content_on_cms.feature @@ -0,0 +1,68 @@ +Feature: create content on cms + As a noosfero user + I want to create articles and upload files + + Background: + Given the following users + | login | name | + | joaosilva | Joao Silva | + And I am logged in as "joaosilva" + And I am on Joao Silva's cms + + Scenario: open page to select type of content + Given I follow "New Content" + Then I should see "Choose the type of content" + + Scenario: list all content types + Given I follow "New content" + Then I should see "Text article with visual editor" + And I should see "Text article with Textile markup" + And I should see "Folder" + And I should see "Blog" + And I should see "Uploaded file" + And I should see "Event" + + Scenario: create a folder + Given I follow "New content" + When I follow "Folder" + And I fill in "Title" with "My Folder" + And I press "Save" + And I go to Joao Silva's cms + Then I should see "My Folder" + + Scenario: create a tiny_mce article + Given I follow "New content" + When I follow "Text article with visual editor" + And I fill in "Title" with "My tiny_mce article" + And I press "Save" + And I go to Joao Silva's cms + Then I should see "My tiny_mce article" + + Scenario: create a textile article + Given I follow "New content" + When I follow "Text article with Textile markup" + And I fill in "Title" with "My textile article" + And I press "Save" + And I go to Joao Silva's cms + Then I should see "My textile article" + + Scenario: create a Blog + Given I follow "New content" + When I follow "Blog" + And I fill in "Title" with "My blog" + And I press "Save" + And I go to Joao Silva's cms + Then I should see "My blog" + + Scenario: create an event + Given I follow "New content" + When I follow "Event" + And I fill in "Title" with "My event" + And I press "Save" + And I go to Joao Silva's cms + Then I should see "My event" + + Scenario: redirect to upload files if choose UploadedFile + Given I follow "New content" + When I follow "Uploaded file" + Then I should be on /myprofile/joaosilva/cms/upload_files diff --git a/features/publish_article.feature b/features/publish_article.feature index 06efdf5..2876db0 100644 --- a/features/publish_article.feature +++ b/features/publish_article.feature @@ -55,7 +55,7 @@ Feature: publish article And "Maria Silva" is a member of "Sample Community" And I am on Maria Silva's control panel And I follow "Manage Content" - And I follow "New article" + And I follow "New content" And I follow "Text article with Textile markup language" And I fill in the following: | Title | Sample Article | diff --git a/public/designs/icons/tango/style.css b/public/designs/icons/tango/style.css index bb88794..8f05425 100644 --- a/public/designs/icons/tango/style.css +++ b/public/designs/icons/tango/style.css @@ -6,7 +6,9 @@ .icon-close { background-image: url(Tango/16x16/actions/gtk-cancel.png) } .icon-newfolder { background-image: url(Tango/16x16/actions/folder-new.png) } .icon-folder { background-image: url(Tango/16x16/places/folder.png) } +.icon-parent-folder { background-image: url(Tango/16x16/places/folder_home.png) } .icon-newblog { background-image: url(mod/16x16/apps/text-editor.png) } +.icon-blog { background-image: url(mod/16x16/apps/text-editor.png) } /*.icon-open { background-image: url(folder-open.gif) } UNUSED*/ /*.icon-cms { background-image: url(abiword_48.png) } UNUSED*/ .icon-save { background-image: url(Tango/16x16/actions/filesave.png) } @@ -57,13 +59,17 @@ .icon-menu-search { background-image: url(Tango/16x16/actions/search.png) } /*.icon-menu-ed-design { background-image: url(edit-design-HC.gif) } UNUSED */ .icon-menu-events { background-image: url(Tango/16x16/mimetypes/stock_calendar.png) } +.icon-event { background-image: url(Tango/16x16/mimetypes/stock_calendar.png) } +.icon-newevent { background-image: url(Tango/16x16/mimetypes/stock_calendar.png) } .icon-menu-articles { background-image: url(Tango/16x16/apps/text-editor.png) } /*.icon-menu-comments { background-image: url(blog-HC.gif) } UNUSED */ .icon-menu-people { background-image: url(mod/16x16/apps/user.png) } .icon-menu-mail { background-image: url(Tango/16x16/apps/email.png) } .icon-upload-file { background-image: url(Tango/16x16/actions/filesave.png) } +.icon-newupload-file { background-image: url(Tango/16x16/actions/filesave.png) } .icon-slideshow { background-image: url(Tango/16x16/mimetypes/x-office-presentation.png) } .icon-photos { background-image: url(Tango/16x16/devices/camera-photo.png) } +.icon-text-html { background-image: url(Tango/16x16/mimetypes/text-html.png) } .icon-media-pause { background-image: url(Tango/16x16/actions/media-playback-pause.png) } .icon-media-play { background-image: url(Tango/16x16/actions/media-playback-start.png) } @@ -74,5 +80,6 @@ .icon-scrap { background-image: url(Tango/16x16/actions/format-justify-left.png) } .icon-reply { background-image: url(Tango/16x16/actions/mail-reply-sender.png) } .icon-newforum { background-image: url(Tango/16x16/apps/system-users.png) } +.icon-forum { background-image: url(Tango/16x16/apps/system-users.png) } .icon-newgallery { background-image: url(Tango/16x16/mimetypes/image-x-generic.png) } .icon-locale { background-image: url(Tango/16x16/apps/preferences-desktop-locale.png) } \ No newline at end of file diff --git a/public/images/icons-mime/rss-feed-16.png b/public/images/icons-mime/rss-feed-16.png new file mode 100644 index 0000000..f1b8742 Binary files /dev/null and b/public/images/icons-mime/rss-feed-16.png differ diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css index 96b09db..3989d98 100644 --- a/public/stylesheets/application.css +++ b/public/stylesheets/application.css @@ -315,11 +315,21 @@ div.pending-tasks { /* sitemap and agenda */ +.agenda-item a.icon, +.sitemap-item a.icon { + background-repeat: no-repeat; + padding-left: 20px; +} + +.agenda-item .icon:hover, +.sitemap-item .icon:hover { + background-color: transparent; +} + .sitemap-item a:link, .agenda-item a:link, .sitemap-item a:visited, .agenda-item a:visited { - display: block; border: none; text-decoration: none; } @@ -329,7 +339,6 @@ div.pending-tasks { } .sitemap-item a:hover, .agenda-item a:hover { - background: #e0e0e0; color: red; text-decoration: underline; } @@ -2750,13 +2759,64 @@ div#activation_enterprise div { /* ==> public/stylesheets/controller_cms.css <== */ -.controller-cms #article_types li { - margin-bottom: 14px; + +table.cms-articles img { + width: 16px; + height: 16px; +} + +table.cms-articles a.icon { + display: block; + border: none; +} + +table.cms-articles a.icon, +table.cms-articles a.icon-parent-folder { + padding: 0px 0px 3px 20px; + background-repeat: no-repeat; +} + +table.cms-articles .icon:hover { + background-color: transparent; +} + +#article_types { + padding-left: 5px; + margin-top: 20px; +} + +#article_types li { list-style: none; + float: left; + width: 180px; + height: 50px; + background-repeat: no-repeat; + background-position: 5px 5px; + padding-left: 30px; + padding-right: 12px; + padding-top: 5px; + padding-bottom: 5px; + -moz-border-radius: 5px; + -webkit-border-radius: 5px; } -.controller-cms #article_types a { - font-weight: bold; +#article_types .description { + color: #888a85; + font-size: smaller; +} + +#article_types .icon-newrss-feed, +#content .icon-rss-feed { + background-image: url(../images/icons-mime/rss-feed-16.png); +} + +#article_types a { + text-decoration: none; + color: black; +} + +#article_types li.mouseover { + background-color: #eeeeec; } .controller-cms #article-subitems-hide.hide-button { @@ -3736,6 +3796,21 @@ h1#agenda-title { width: 100%; } +#search-results li a.icon { + display: block; + border: none; + padding-left: 20px; + background-repeat: no-repeat; +} + +#search-results li .icon:hover { + background-color: transparent; +} + +#search-results li:hover { + background-color: #F0F0F0; +} + .controller-search .has_cat_list #map, .controller-search .msie .has_cat_list #map, .controller-search .has_cat_list .only-one-result-box .search-results-box, diff --git a/public/stylesheets/media_listing.css b/public/stylesheets/media_listing.css index ec9965c..26304fe 100644 --- a/public/stylesheets/media_listing.css +++ b/public/stylesheets/media_listing.css @@ -40,6 +40,10 @@ h4 { margin: 0px; } +#media-listing li:hover { + background-color: #CCC; +} + #media-listing a { text-decoration: none; } @@ -97,10 +101,24 @@ h4 { text-align: center; } -#media-listing-folder-documents img { +#media-listing-documents li { + padding-bottom: 5px; +} + +#media-listing-folder-documents a.icon { + background-repeat: no-repeat; + padding-left: 20px; border: none; } +#media-listing-folder-documents .icon:hover { + background-color: transparent; +} + +#media-listing .icon-rss-feed { + background-image: url(../images/icons-mime/rss-feed-16.png); +} + #media-listing-upload { width: 98%; padding: 3px; diff --git a/test/functional/cms_controller_test.rb b/test/functional/cms_controller_test.rb index 2d0eaa7..4f84267 100644 --- a/test/functional/cms_controller_test.rb +++ b/test/functional/cms_controller_test.rb @@ -314,6 +314,21 @@ class CmsControllerTest < Test::Unit::TestCase assert_template 'upload_files' end + should 'offer to create new content' do + get :index, :profile => profile.identifier + assert_response :success + assert_template 'view' + assert_tag :tag => 'a', :attributes => { :title => 'New content', :href => "/myprofile/#{profile.identifier}/cms/new?cms=true"} + end + + should 'offer to create new content when viewing an article' do + article = fast_create(Article, :profile_id => profile.id) + get :view, :profile => profile.identifier, :id => article.id + assert_response :success + assert_template 'view' + assert_tag :tag => 'a', :attributes => { :title => 'New content', :href => "/myprofile/#{profile.identifier}/cms/new?cms=true&parent_id=#{article.id}"} + end + should 'offer to create children' do Article.any_instance.stubs(:allow_children?).returns(true) @@ -321,10 +336,8 @@ class CmsControllerTest < Test::Unit::TestCase article.profile = profile article.save! - get :view, :profile => profile.identifier, :id => article.id - assert_response :success - assert_template 'view' - assert_tag :tag => 'a', :attributes => { :href => "/myprofile/#{profile.identifier}/cms/new?parent_id=#{article.id}"} + get :new, :profile => profile.identifier, :parent_id => article.id, :cms => true + assert_tag :tag => 'a', :attributes => { :href => "/myprofile/#{profile.identifier}/cms/new?parent_id=#{article.id}&type=TextileArticle"} end should 'not offer to create children if article does not accept them' do @@ -476,13 +489,13 @@ class CmsControllerTest < Test::Unit::TestCase end should 'offer to create new top-level folder' do - get :index, :profile => profile.identifier + get :new, :profile => profile.identifier, :cms => true assert_tag :tag => 'a', :attributes => { :href => "/myprofile/#{profile.identifier}/cms/new?type=Folder"} end should 'offer to create sub-folder' do f = Folder.new(:name => 'f'); profile.articles << f; f.save! - get :view, :profile => profile.identifier, :id => f.id + get :new, :profile => profile.identifier, :parent_id => f.id, :cms => true assert_tag :tag => 'a', :attributes => { :href => "/myprofile/#{profile.identifier}/cms/new?parent_id=#{f.id}&type=Folder" } end @@ -866,18 +879,18 @@ class CmsControllerTest < Test::Unit::TestCase assert_equal 5, profile.blog.posts_per_page end - should "display 'New article' when create children of folder" do + should "display 'New content' when create children of folder" do a = Folder.new(:name => 'article folder'); profile.articles << a; a.save! Article.stubs(:short_description).returns('bli') get :view, :profile => profile.identifier, :id => a - assert_tag :tag => 'a', :content => 'New article' + assert_tag :tag => 'a', :content => 'New content' end - should "display 'New post' when create children of blog" do + should "display 'New content' when create children of blog" do a = Blog.create!(:name => 'blog_for_test', :profile => profile) Article.stubs(:short_description).returns('bli') get :view, :profile => profile.identifier, :id => a - assert_tag :tag => 'a', :content => 'New post' + assert_tag :tag => 'a', :content => 'New content' end should 'offer confirmation to remove article' do @@ -927,7 +940,7 @@ class CmsControllerTest < Test::Unit::TestCase process_delayed_job_queue file = profile.articles.find_by_name('rails.png') - assert File.exists?(file.icon_name) + assert File.exists?(file.class.icon_name(file)) file.destroy end @@ -938,7 +951,7 @@ class CmsControllerTest < Test::Unit::TestCase process_delayed_job_queue file = profile.articles.find_by_name('rails.png') - assert File.exists?(file.icon_name) + assert File.exists?(file.class.icon_name(file)) file.destroy end @@ -1368,13 +1381,6 @@ class CmsControllerTest < Test::Unit::TestCase assert_equal 5, profile.forum.posts_per_page end - should "display 'New post' when create children of forum" do - a = Forum.create!(:name => 'forum_for_test', :profile => profile) - Article.stubs(:short_description).returns('bli') - get :view, :profile => profile.identifier, :id => a - assert_tag :tag => 'a', :content => 'New discussion topic' - end - should 'go to forum after create it' do assert_difference Forum, :count do post :new, :type => Forum.name, :profile => profile.identifier, :article => { :name => 'my-forum' }, :back_to => 'control_panel' diff --git a/test/unit/article_test.rb b/test/unit/article_test.rb index daebd0b..b83940f 100644 --- a/test/unit/article_test.rb +++ b/test/unit/article_test.rb @@ -94,7 +94,7 @@ class ArticleTest < Test::Unit::TestCase end should 'inform the icon to be used' do - assert_equal 'text-html', Article.new.icon_name + assert_equal 'text-html', Article.icon_name end should 'provide a (translatable) description' do diff --git a/test/unit/blog_test.rb b/test/unit/blog_test.rb index 13e1d63..e451928 100644 --- a/test/unit/blog_test.rb +++ b/test/unit/blog_test.rb @@ -15,7 +15,11 @@ class BlogTest < ActiveSupport::TestCase end should 'provide own icon name' do - assert_not_equal Article.new.icon_name, Blog.new.icon_name + assert_not_equal Article.icon_name, Blog.icon_name + end + + should 'provide blog as icon name' do + assert_equal 'blog', Blog.icon_name end should 'identify as folder' do diff --git a/test/unit/cms_helper_test.rb b/test/unit/cms_helper_test.rb index 58192b7..d6d9191 100644 --- a/test/unit/cms_helper_test.rb +++ b/test/unit/cms_helper_test.rb @@ -21,7 +21,7 @@ class CmsHelperTest < Test::Unit::TestCase should 'display link to folder content if article is folder' do profile = fast_create(Profile) folder = fast_create(Folder, :name => 'My folder', :profile_id => profile.id) - expects(:link_to).with('My folder', :action => 'view', :id => folder.id) + expects(:link_to).with('My folder', {:action => 'view', :id => folder.id}, :class => icon_for_article(folder)) result = link_to_article(folder) end @@ -29,11 +29,21 @@ class CmsHelperTest < Test::Unit::TestCase should 'display link to article if article is not folder' do profile = fast_create(Profile) article = fast_create(TinyMceArticle, :name => 'My article', :profile_id => profile.id) - expects(:link_to).with('My article', article.url) + expects(:link_to).with('My article', article.url, :class => icon_for_article(article)) result = link_to_article(article) end + should 'display image and link if article is an image' do + profile = fast_create(Profile) + file = UploadedFile.create!(:profile => profile, :uploaded_data => fixture_file_upload('/files/rails.png', 'image/png')) + icon = icon_for_article(file) + expects(:image_tag).with(icon).returns('icon') + + expects(:link_to).with('rails.png', file.url).returns('link') + result = link_to_article(file) + end + should 'display spread button when profile is a person' do profile = fast_create(Person) article = fast_create(TinyMceArticle, :name => 'My article', :profile_id => profile.id) diff --git a/test/unit/event_test.rb b/test/unit/event_test.rb index 678e842..bc635c5 100644 --- a/test/unit/event_test.rb +++ b/test/unit/event_test.rb @@ -69,7 +69,7 @@ class EventTest < ActiveSupport::TestCase end should 'use its own icon' do - assert_equal 'event', Event.new.icon_name + assert_equal 'event', Event.icon_name end should 'not allow end date before start date' do diff --git a/test/unit/folder_helper_test.rb b/test/unit/folder_helper_test.rb index 6ff653b..bbc8348 100644 --- a/test/unit/folder_helper_test.rb +++ b/test/unit/folder_helper_test.rb @@ -11,14 +11,29 @@ class FolderHelperTest < Test::Unit::TestCase include FolderHelper should 'display icon for articles' do - art1 = mock; art1.expects(:icon_name).returns('icon1') - art2 = mock; art2.expects(:icon_name).returns('icon2') + art1 = mock; art1_class = mock + art1.expects(:class).returns(art1_class) + art1_class.expects(:icon_name).returns('icon1') - File.expects(:exists?).with(File.join(RAILS_ROOT, 'public', 'images', 'icons-mime', 'icon1.png')).returns(true) - File.expects(:exists?).with(File.join(RAILS_ROOT, 'public', 'images', 'icons-mime', 'icon2.png')).returns(false) + art2 = mock; art2_class = mock + art2.expects(:class).returns(art2_class) + art2_class.expects(:icon_name).returns('icon2') - assert_equal 'icons-mime/icon1.png', icon_for_article(art1) - assert_equal 'icons-mime/unknown.png', icon_for_article(art2) + assert_equal 'icon icon-icon1', icon_for_article(art1) + assert_equal 'icon icon-icon2', icon_for_article(art2) + end + + should 'display icon for images' do + profile = fast_create(Profile) + file = UploadedFile.create!(:uploaded_data => fixture_file_upload('/files/rails.png', 'image/png'), :profile => profile) + process_delayed_job_queue + + assert_match /rails_icon\.png/, icon_for_article(file.reload) + end + + should 'display icon for type of article' do + Article.expects(:icon_name).returns('article') + assert_match /icon-newarticle/, icon_for_new_article('Article') end should 'list all the folder\'s children to the owner' do diff --git a/test/unit/folder_test.rb b/test/unit/folder_test.rb index 07790b3..561636d 100644 --- a/test/unit/folder_test.rb +++ b/test/unit/folder_test.rb @@ -15,7 +15,7 @@ class FolderTest < ActiveSupport::TestCase end should 'provide own icon name' do - assert_not_equal Article.new.icon_name, Folder.new.icon_name + assert_not_equal Article.icon_name, Folder.icon_name end should 'identify as folder' do diff --git a/test/unit/forum_test.rb b/test/unit/forum_test.rb index 507ceb5..9a6f55c 100644 --- a/test/unit/forum_test.rb +++ b/test/unit/forum_test.rb @@ -11,7 +11,11 @@ class ForumTest < ActiveSupport::TestCase end should 'provide own icon name' do - assert_not_equal Article.new.icon_name, Forum.new.icon_name + assert_not_equal Article.icon_name, Forum.icon_name + end + + should 'provide forum as icon name' do + assert_equal 'forum', Forum.icon_name end should 'identify as folder' do diff --git a/test/unit/gallery_test.rb b/test/unit/gallery_test.rb index ae03ea6..0fed6eb 100644 --- a/test/unit/gallery_test.rb +++ b/test/unit/gallery_test.rb @@ -15,7 +15,11 @@ class GalleryTest < ActiveSupport::TestCase end should 'provide own icon name' do - assert_not_equal Article.new.icon_name, Gallery.new.icon_name + assert_not_equal Article.icon_name, Gallery.icon_name + end + + should 'provide gallery as icon name' do + assert_not_equal Article.icon_name, Gallery.icon_name end should 'identify as folder' do diff --git a/test/unit/rss_feed_test.rb b/test/unit/rss_feed_test.rb index 7b94eae..727f0b6 100644 --- a/test/unit/rss_feed_test.rb +++ b/test/unit/rss_feed_test.rb @@ -190,7 +190,7 @@ class RssFeedTest < Test::Unit::TestCase end should 'provide the correct icon name' do - assert_equal 'rss-feed', RssFeed.new.icon_name + assert_equal 'rss-feed', RssFeed.icon_name end should 'advertise is false before create' do diff --git a/test/unit/uploaded_file_test.rb b/test/unit/uploaded_file_test.rb index 9dab049..c501d5f 100644 --- a/test/unit/uploaded_file_test.rb +++ b/test/unit/uploaded_file_test.rb @@ -11,14 +11,11 @@ class UploadedFileTest < Test::Unit::TestCase f = UploadedFile.new f.expects(:image?).returns(true) f.expects(:public_filename).with(:icon).returns('/path/to/file.xyz') - assert_equal '/path/to/file.xyz', f.icon_name + assert_equal '/path/to/file.xyz', UploadedFile.icon_name(f) end - should 'return mime-type icon for non-image files' do - f= UploadedFile.new - f.expects(:image?).returns(false) - f.expects(:content_type).returns('application/pdf') - assert_equal 'application-pdf', f.icon_name + should 'return a default icon for uploaded files' do + assert_equal 'upload-file', UploadedFile.icon_name end should 'use attachment_fu content_type method to return mime_type' do @@ -213,7 +210,7 @@ class UploadedFileTest < Test::Unit::TestCase f = UploadedFile.new f.expects(:image?).returns(true) f.expects(:public_filename).with(:icon).returns('/path/to/file.xyz') - assert_equal '/path/to/file.xyz', f.icon_name + assert_equal '/path/to/file.xyz', UploadedFile.icon_name(f) end should 'store width and height after processing' do -- libgit2 0.21.2