Commit 4d431fb702ddb07fa35255e003857b88e60c2939

Authored by AntonioTerceiro
1 parent 929235dd

ActionItem296: editing header/footer

git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@2346 3f533792-8f58-4932-b0fe-aaf55b0a4547
app/views/profile_editor/header_footer.rhtml 0 → 100644
... ... @@ -0,0 +1,14 @@
  1 +<%= render :file => 'shared/tiny_mce' %>
  2 +
  3 +<h1><%= _('Editing header and footer') %></h1>
  4 +
  5 +<% form_tag do %>
  6 + <div style='width: 90%; margin: auto;'>
  7 + <%= labelled_form_field(_('Content for header '), text_area_tag(:custom_header, @header, :style => 'width: 100%; height: 150px;')) %>
  8 + <%= labelled_form_field(_('Content for footer'), text_area_tag(:custom_footer, @footer, :style => 'width: 100%; height: 150px;')) %>
  9 + <% button_bar do %>
  10 + <%= submit_button(:save, _('Save')) %>
  11 + <%= button(:cancel, _('Cancel'), :action => 'index') %>
  12 + <% end %>
  13 + </div>
  14 +<% end %>
... ...
app/views/profile_editor/index.rhtml
... ... @@ -14,7 +14,9 @@
14 14  
15 15 <%= file_manager_button(_('Pending tasks'), 'icons-app/todo.png', :controller => 'tasks', :action => 'index') %>
16 16  
17   - <%= file_manager_button(_('Edit Visual Design'), 'icons-app/design-editor.png', :controller => 'profile_design', :action => 'index') %>
  17 + <%= file_manager_button(_('Edit sideboxes'), 'icons-app/design-editor.png', :controller => 'profile_design', :action => 'index') %>
  18 +
  19 + <%= file_manager_button(_('Edit Header and Footer'), 'icons-app/header-and-footer.png', :controller => 'profile_editor', :action => 'header_footer') %>
18 20  
19 21 <%= file_manager_button(_('Manage Content'), 'icons-app/cms.png', :controller => 'cms') %>
20 22  
... ...
public/images/icons-app/README
... ... @@ -44,6 +44,7 @@ mozilla-mail.png dlg-neu
44 44 gtk-cancel.png dlg-neu
45 45 emblem-important.png dlg-neu
46 46 gnome-globe.png gnome
  47 +header-and-footer.svg Noosfero team
47 48 ### END OF ICONS LISTING ###
48 49  
49 50 Icons rasterization
... ...
public/images/icons-app/header-and-footer.png 0 → 100644

630 Bytes

public/images/icons-app/header-and-footer.svg 0 → 100644
... ... @@ -0,0 +1,148 @@
  1 +<?xml version="1.0" encoding="UTF-8" standalone="no"?>
  2 +<!-- Created with Inkscape (http://www.inkscape.org/) -->
  3 +<svg
  4 + xmlns:dc="http://purl.org/dc/elements/1.1/"
  5 + xmlns:cc="http://creativecommons.org/ns#"
  6 + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
  7 + xmlns:svg="http://www.w3.org/2000/svg"
  8 + xmlns="http://www.w3.org/2000/svg"
  9 + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
  10 + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
  11 + width="64"
  12 + height="64"
  13 + id="svg2"
  14 + sodipodi:version="0.32"
  15 + inkscape:version="0.46"
  16 + version="1.0"
  17 + sodipodi:docname="header-and-footer.svg"
  18 + inkscape:output_extension="org.inkscape.output.svg.inkscape"
  19 + inkscape:export-filename="/home/terceiro/src/noosfero/public/images/icons-app/header-and-footer.png"
  20 + inkscape:export-xdpi="90"
  21 + inkscape:export-ydpi="90">
  22 + <defs
  23 + id="defs4">
  24 + <inkscape:perspective
  25 + sodipodi:type="inkscape:persp3d"
  26 + inkscape:vp_x="0 : 526.18109 : 1"
  27 + inkscape:vp_y="6.1230318e-14 : 1000 : 0"
  28 + inkscape:vp_z="744.09448 : 526.18109 : 1"
  29 + inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
  30 + id="perspective10" />
  31 + <inkscape:perspective
  32 + id="perspective2410"
  33 + inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
  34 + inkscape:vp_z="744.09448 : 526.18109 : 1"
  35 + inkscape:vp_y="0 : 1000 : 0"
  36 + inkscape:vp_x="0 : 526.18109 : 1"
  37 + sodipodi:type="inkscape:persp3d" />
  38 + <filter
  39 + inkscape:collect="always"
  40 + id="filter3416">
  41 + <feGaussianBlur
  42 + inkscape:collect="always"
  43 + stdDeviation="1.1295304"
  44 + id="feGaussianBlur3418" />
  45 + </filter>
  46 + </defs>
  47 + <sodipodi:namedview
  48 + id="base"
  49 + pagecolor="#ffffff"
  50 + bordercolor="#666666"
  51 + borderopacity="1.0"
  52 + inkscape:pageopacity="0.0"
  53 + inkscape:pageshadow="2"
  54 + inkscape:zoom="7.703125"
  55 + inkscape:cx="31.870183"
  56 + inkscape:cy="33.872569"
  57 + inkscape:document-units="px"
  58 + inkscape:current-layer="layer1"
  59 + showgrid="true"
  60 + guidetolerance="21"
  61 + gridtolerance="25"
  62 + inkscape:window-width="1278"
  63 + inkscape:window-height="718"
  64 + inkscape:window-x="0"
  65 + inkscape:window-y="24">
  66 + <inkscape:grid
  67 + type="xygrid"
  68 + id="grid3192"
  69 + visible="true"
  70 + enabled="true"
  71 + spacingx="2px"
  72 + spacingy="2px"
  73 + originx="1px"
  74 + originy="1px" />
  75 + </sodipodi:namedview>
  76 + <metadata
  77 + id="metadata7">
  78 + <rdf:RDF>
  79 + <cc:Work
  80 + rdf:about="">
  81 + <dc:format>image/svg+xml</dc:format>
  82 + <dc:type
  83 + rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
  84 + </cc:Work>
  85 + </rdf:RDF>
  86 + </metadata>
  87 + <g
  88 + inkscape:label="Camada 1"
  89 + inkscape:groupmode="layer"
  90 + id="layer1">
  91 + <rect
  92 + y="3"
  93 + x="7"
  94 + height="58.66328"
  95 + width="50.289757"
  96 + id="rect3286"
  97 + style="fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:2.00000023999999987;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;opacity:0.50000000000000000;filter:url(#filter3416)" />
  98 + <rect
  99 + style="fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:2.00000023999999987;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
  100 + id="rect2420"
  101 + width="50.289757"
  102 + height="58.66328"
  103 + x="5"
  104 + y="1" />
  105 + <rect
  106 + style="fill:#ffa358;fill-opacity:1;stroke:#000000;stroke-width:2;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
  107 + id="rect3196"
  108 + width="42"
  109 + height="10"
  110 + x="9.1030931"
  111 + y="5" />
  112 + <rect
  113 + style="fill:#ffa358;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
  114 + id="rect3206"
  115 + width="42"
  116 + height="10"
  117 + x="9.1030931"
  118 + y="45" />
  119 + <rect
  120 + style="fill:#b0b0af;fill-opacity:1;stroke:none;stroke-width:2;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
  121 + id="rect3236"
  122 + width="42"
  123 + height="2"
  124 + x="9.1030931"
  125 + y="19" />
  126 + <rect
  127 + style="fill:#b0b0af;fill-opacity:1;stroke:none;stroke-width:2;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
  128 + id="rect3238"
  129 + width="42"
  130 + height="2"
  131 + x="9.1030931"
  132 + y="31" />
  133 + <rect
  134 + style="fill:#b0b0af;fill-opacity:1;stroke:none;stroke-width:2;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
  135 + id="rect3240"
  136 + width="42"
  137 + height="2"
  138 + x="9.1030931"
  139 + y="25" />
  140 + <rect
  141 + style="fill:#b0b0af;fill-opacity:1;stroke:none;stroke-width:2;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
  142 + id="rect3242"
  143 + width="32.666668"
  144 + height="2"
  145 + x="9.1030931"
  146 + y="37" />
  147 + </g>
  148 +</svg>
... ...
public/stylesheets/common.css
... ... @@ -373,6 +373,6 @@ div.sitemap-item a:hover {
373 373 right: 25px;
374 374 }
375 375  
376   -#profile-footer {
  376 +#profile-header, #profile-footer {
377 377 clear: both;
378 378 }
... ...
test/functional/profile_editor_controller_test.rb
... ... @@ -432,4 +432,35 @@ class ProfileEditorControllerTest &lt; Test::Unit::TestCase
432 432 assert_tag :tag => 'a', :content => 'Manage my groups'
433 433 end
434 434  
  435 + should 'display footer edit screen' do
  436 +
  437 + person = create_user('designtestuser').person
  438 + person.custom_header = 'my custom header'
  439 + person.custom_footer = 'my custom footer'
  440 + person.save!
  441 +
  442 + get :header_footer, :profile => 'designtestuser'
  443 + assert_tag :tag => 'textarea', :content => 'my custom header'
  444 + assert_tag :tag => 'textarea', :content => 'my custom footer'
  445 + end
  446 +
  447 + should 'save footer and header' do
  448 + person = create_user('designtestuser').person
  449 + post :header_footer, :profile => 'designtestuser', :custom_header => 'new header', :custom_footer => 'new footer'
  450 + person.reload
  451 + assert_equal 'new header', person.custom_header
  452 + assert_equal 'new footer', person.custom_footer
  453 + end
  454 +
  455 + should 'go back to editor after saving header/footer' do
  456 + person = create_user('designtestuser').person
  457 + post :header_footer, :profile => 'designtestuser', :custom_header => 'new header', :custom_footer => 'new footer'
  458 + assert_redirected_to :action => 'index'
  459 + end
  460 +
  461 + should 'point to header/footer editing in control panel' do
  462 + get :index, :profile => 'ze'
  463 + assert_tag :tag => 'a', :attributes => { :href => '/myprofile/ze/profile_editor/header_footer' }
  464 + end
  465 +
435 466 end
... ...