Commit 43e7acab6d46d8b39316272de68deb0556526479

Authored by AntonioTerceiro
1 parent e6d52bfc

ActionItem357: better article edition



git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@1864 3f533792-8f58-4932-b0fe-aaf55b0a4547
app/controllers/my_profile/cms_controller.rb
@@ -104,6 +104,10 @@ class CmsController < MyProfileController @@ -104,6 +104,10 @@ class CmsController < MyProfileController
104 redirect_to :action => (@article.parent ? 'view' : 'index'), :id => @article.parent 104 redirect_to :action => (@article.parent ? 'view' : 'index'), :id => @article.parent
105 end 105 end
106 106
  107 + def why_categorize
  108 + render :action => params[:action], :layout => false
  109 + end
  110 +
107 protected 111 protected
108 112
109 def redirect_back 113 def redirect_back
app/views/cms/edit.rhtml
@@ -8,7 +8,15 @@ @@ -8,7 +8,15 @@
8 8
9 <%= render :partial => partial_for_class(@article.class), :locals => { :f => f } %> 9 <%= render :partial => partial_for_class(@article.class), :locals => { :f => f } %>
10 10
11 - <%= select_categories(:article) %> 11 + <% button_bar do %>
  12 + <%= submit_button :save, _('Save') %>
  13 + <% end %>
  14 +
  15 + <div style='float: right'>
  16 + <%= lightbox_button :help, _('Why categorize?'), :action => 'why_categorize' %>
  17 + </div>
  18 +
  19 + <%= select_categories(:article, _('Categorize your article')) %>
12 20
13 <%# TODO display the tooltip (title below) in a directly visible way %> 21 <%# TODO display the tooltip (title below) in a directly visible way %>
14 <%= f.text_field('tag_list', :size => 64) + 22 <%= f.text_field('tag_list', :size => 64) +
app/views/cms/why_categorize.rhtml 0 → 100644
@@ -0,0 +1,9 @@ @@ -0,0 +1,9 @@
  1 +<strong><%= _('Why categorize?') %></strong>
  2 +
  3 +<p>
  4 +<%= _('By categorizing your content, you increase the possibility that other people access it. When they are looking for, say, articles about Bahia and you categorize your article in "Regions/Bahia", then there is a good change that your article is going to be found.') %>
  5 +</p>
  6 +
  7 +<% button_bar do %>
  8 + <%= lightbox_close_button _('OK') %>
  9 +<% end %>
test/functional/cms_controller_test.rb
@@ -400,4 +400,20 @@ class CmsControllerTest &lt; Test::Unit::TestCase @@ -400,4 +400,20 @@ class CmsControllerTest &lt; Test::Unit::TestCase
400 assert_tag :tag => 'a', :attributes => { :href => "/myprofile/#{profile.identifier}/cms/view/#{f.id}" }, :descendant => { :content => /Cancel/ } 400 assert_tag :tag => 'a', :attributes => { :href => "/myprofile/#{profile.identifier}/cms/view/#{f.id}" }, :descendant => { :content => /Cancel/ }
401 end 401 end
402 402
  403 + should 'link to page explaining about categorization' do
  404 + get :edit, :profile => profile.identifier, :id => profile.home_page.id
  405 + assert_tag :tag => 'a', :attributes => { :href => "/myprofile/#{profile.identifier}/cms/why_categorize" }
  406 + end
  407 +
  408 + should 'present popup' do
  409 + get :why_categorize, :profile => profile.identifier
  410 + assert_template 'why_categorize'
  411 + assert_no_tag :tag => 'body'
  412 + end
  413 +
  414 + should 'display OK button on why_categorize popup' do
  415 + get :why_categorize, :profile => profile.identifier
  416 + assert_tag :tag => 'a', :attributes => { :rel => 'deactivate'} # lightbox close button
  417 + end
  418 +
403 end 419 end