From 1cf5580bd951f6a056168fc5c60e965262124672 Mon Sep 17 00:00:00 2001 From: AntonioTerceiro Date: Wed, 11 Jun 2008 17:13:39 +0000 Subject: [PATCH] ActionItem44: displaying icon in menu --- app/views/shared/user_menu.rhtml | 6 ++++++ public/designs/icons/default/mail-HC.gif | Bin 0 -> 101 bytes public/designs/icons/default/style.css | 1 + test/functional/application_controller_test.rb | 27 +++++++++++++++++++++++++++ 4 files changed, 34 insertions(+), 0 deletions(-) create mode 100644 public/designs/icons/default/mail-HC.gif diff --git a/app/views/shared/user_menu.rhtml b/app/views/shared/user_menu.rhtml index 65f861d..c912ffe 100644 --- a/app/views/shared/user_menu.rhtml +++ b/app/views/shared/user_menu.rhtml @@ -21,6 +21,12 @@ + <% if MailConf.enabled? && current_user.enable_email %> +
  • + <%= link_to '' + _('Webmail'), MailConf.webmail_url %> +
  • + <% end %> +
  • <%= link_to_myprofile( ''+ _('Control panel'), {}, nil, :id => 'link_edit_profile', :help => _('Control panel: change your picture, edit your personal information, create content or change the way your home page looks.') diff --git a/public/designs/icons/default/mail-HC.gif b/public/designs/icons/default/mail-HC.gif new file mode 100644 index 0000000..df6f9a1 Binary files /dev/null and b/public/designs/icons/default/mail-HC.gif differ diff --git a/public/designs/icons/default/style.css b/public/designs/icons/default/style.css index 248ae49..1bc5bba 100644 --- a/public/designs/icons/default/style.css +++ b/public/designs/icons/default/style.css @@ -42,3 +42,4 @@ .icon-menu-articles { background-image: url(edit-HC.gif) } .icon-menu-comments { background-image: url(blog-HC.gif) } .icon-menu-people { background-image: url(album-HC.gif) } +.icon-menu-mail { background-image: url(mail-HC.gif) } diff --git a/test/functional/application_controller_test.rb b/test/functional/application_controller_test.rb index eac848d..1d14ffb 100644 --- a/test/functional/application_controller_test.rb +++ b/test/functional/application_controller_test.rb @@ -160,4 +160,31 @@ class ApplicationControllerTest < Test::Unit::TestCase assert_tag :tag => 'a', :attributes => { :href => /\?lang=it/ }, :content => 'Italiano' end + should 'display link to webmail if enabled for system and for user' do + login_as('ze') + MailConf.expects(:enabled?).returns(true) + MailConf.expects(:webmail_url).returns('http://web.mail/') + User.any_instance.expects(:enable_email).returns(true) + + get :index + assert_tag :tag => 'div', :attributes => { :id => 'user_box' }, :descendant => { :tag => 'a', :attributes => { :href => 'http://web.mail/' } } + end + + should 'not display link to webmail if not enabled for system' do + login_as('ze') + MailConf.expects(:enabled?).returns(false) + + get :index + assert_no_tag :tag => 'div', :attributes => { :id => 'user_box' }, :descendant => { :tag => 'a', :attributes => { :href => 'http://web.mail/' } } + end + + should 'not display link in menu to webmail if not enabled for user' do + login_as('ze') + MailConf.expects(:enabled?).returns(true) + User.any_instance.expects(:enable_email).returns(false) + + get :index + assert_no_tag :tag => 'div', :attributes => { :id => 'user_box' }, :descendant => { :tag => 'a', :attributes => { :href => 'http://web.mail/' } } + end + end -- libgit2 0.21.2