From 4d431fb702ddb07fa35255e003857b88e60c2939 Mon Sep 17 00:00:00 2001 From: AntonioTerceiro Date: Wed, 30 Jul 2008 20:51:48 +0000 Subject: [PATCH] ActionItem296: editing header/footer --- app/views/profile_editor/header_footer.rhtml | 14 ++++++++++++++ app/views/profile_editor/index.rhtml | 4 +++- public/images/icons-app/README | 1 + public/images/icons-app/header-and-footer.png | Bin 0 -> 630 bytes public/images/icons-app/header-and-footer.svg | 148 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ public/stylesheets/common.css | 2 +- test/functional/profile_editor_controller_test.rb | 31 +++++++++++++++++++++++++++++++ 7 files changed, 198 insertions(+), 2 deletions(-) create mode 100644 app/views/profile_editor/header_footer.rhtml create mode 100644 public/images/icons-app/header-and-footer.png create mode 100644 public/images/icons-app/header-and-footer.svg diff --git a/app/views/profile_editor/header_footer.rhtml b/app/views/profile_editor/header_footer.rhtml new file mode 100644 index 0000000..3f8eeb6 --- /dev/null +++ b/app/views/profile_editor/header_footer.rhtml @@ -0,0 +1,14 @@ +<%= render :file => 'shared/tiny_mce' %> + +

<%= _('Editing header and footer') %>

+ +<% form_tag do %> +
+ <%= labelled_form_field(_('Content for header '), text_area_tag(:custom_header, @header, :style => 'width: 100%; height: 150px;')) %> + <%= labelled_form_field(_('Content for footer'), text_area_tag(:custom_footer, @footer, :style => 'width: 100%; height: 150px;')) %> + <% button_bar do %> + <%= submit_button(:save, _('Save')) %> + <%= button(:cancel, _('Cancel'), :action => 'index') %> + <% end %> +
+<% end %> diff --git a/app/views/profile_editor/index.rhtml b/app/views/profile_editor/index.rhtml index 94288d7..85487d6 100644 --- a/app/views/profile_editor/index.rhtml +++ b/app/views/profile_editor/index.rhtml @@ -14,7 +14,9 @@ <%= file_manager_button(_('Pending tasks'), 'icons-app/todo.png', :controller => 'tasks', :action => 'index') %> - <%= file_manager_button(_('Edit Visual Design'), 'icons-app/design-editor.png', :controller => 'profile_design', :action => 'index') %> + <%= file_manager_button(_('Edit sideboxes'), 'icons-app/design-editor.png', :controller => 'profile_design', :action => 'index') %> + + <%= file_manager_button(_('Edit Header and Footer'), 'icons-app/header-and-footer.png', :controller => 'profile_editor', :action => 'header_footer') %> <%= file_manager_button(_('Manage Content'), 'icons-app/cms.png', :controller => 'cms') %> diff --git a/public/images/icons-app/README b/public/images/icons-app/README index b780f39..2aa8085 100644 --- a/public/images/icons-app/README +++ b/public/images/icons-app/README @@ -44,6 +44,7 @@ mozilla-mail.png dlg-neu gtk-cancel.png dlg-neu emblem-important.png dlg-neu gnome-globe.png gnome +header-and-footer.svg Noosfero team ### END OF ICONS LISTING ### Icons rasterization diff --git a/public/images/icons-app/header-and-footer.png b/public/images/icons-app/header-and-footer.png new file mode 100644 index 0000000..03d7ee3 Binary files /dev/null and b/public/images/icons-app/header-and-footer.png differ diff --git a/public/images/icons-app/header-and-footer.svg b/public/images/icons-app/header-and-footer.svg new file mode 100644 index 0000000..4673bfb --- /dev/null +++ b/public/images/icons-app/header-and-footer.svg @@ -0,0 +1,148 @@ + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + diff --git a/public/stylesheets/common.css b/public/stylesheets/common.css index d687df7..e35bb25 100644 --- a/public/stylesheets/common.css +++ b/public/stylesheets/common.css @@ -373,6 +373,6 @@ div.sitemap-item a:hover { right: 25px; } -#profile-footer { +#profile-header, #profile-footer { clear: both; } diff --git a/test/functional/profile_editor_controller_test.rb b/test/functional/profile_editor_controller_test.rb index 56103c1..ce746b9 100644 --- a/test/functional/profile_editor_controller_test.rb +++ b/test/functional/profile_editor_controller_test.rb @@ -432,4 +432,35 @@ class ProfileEditorControllerTest < Test::Unit::TestCase assert_tag :tag => 'a', :content => 'Manage my groups' end + should 'display footer edit screen' do + + person = create_user('designtestuser').person + person.custom_header = 'my custom header' + person.custom_footer = 'my custom footer' + person.save! + + get :header_footer, :profile => 'designtestuser' + assert_tag :tag => 'textarea', :content => 'my custom header' + assert_tag :tag => 'textarea', :content => 'my custom footer' + end + + should 'save footer and header' do + person = create_user('designtestuser').person + post :header_footer, :profile => 'designtestuser', :custom_header => 'new header', :custom_footer => 'new footer' + person.reload + assert_equal 'new header', person.custom_header + assert_equal 'new footer', person.custom_footer + end + + should 'go back to editor after saving header/footer' do + person = create_user('designtestuser').person + post :header_footer, :profile => 'designtestuser', :custom_header => 'new header', :custom_footer => 'new footer' + assert_redirected_to :action => 'index' + end + + should 'point to header/footer editing in control panel' do + get :index, :profile => 'ze' + assert_tag :tag => 'a', :attributes => { :href => '/myprofile/ze/profile_editor/header_footer' } + end + end -- libgit2 0.21.2