Commit 60c3a8e0f53b1aa99ecaa50676452a2e452da26c

Authored by AntonioTerceiro
1 parent 51672339

ActionItem74: improving help system



git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@608 3f533792-8f58-4932-b0fe-aaf55b0a4547
app/helpers/application_helper.rb
@@ -42,6 +42,9 @@ module ApplicationHelper @@ -42,6 +42,9 @@ module ApplicationHelper
42 # TODO: implement correcly the 'Help' button click 42 # TODO: implement correcly the 'Help' button click
43 def help(content = nil, type = :html, &block) 43 def help(content = nil, type = :html, &block)
44 44
  45 + @help_message_id ||= 1
  46 + help_id = "help_message_#{@help_message_id}"
  47 +
45 if content.nil? 48 if content.nil?
46 return '' if block.nil? 49 return '' if block.nil?
47 content = capture(&block) 50 content = capture(&block)
@@ -53,10 +56,10 @@ module ApplicationHelper @@ -53,10 +56,10 @@ module ApplicationHelper
53 56
54 # TODO: implement this button, and add style='display: none' to the help 57 # TODO: implement this button, and add style='display: none' to the help
55 # message DIV 58 # message DIV
56 - button = link_to_function(_('Help'), "Element.show('help_message')", :class => 'help_button' )  
57 - close_button = content_tag("div", link_to_function(_("Close"), "Element.hide('help_message')", :class => 'close_help_button')) 59 + button = link_to_function(content_tag('span', _('Help')), "Element.show('#{help_id}')", :class => 'help_button' )
  60 + close_button = content_tag("div", link_to_function(_("Close"), "Element.hide('#{help_id}')", :class => 'close_help_button'))
58 61
59 - text = content_tag('div', button + content_tag('div', content_tag('div', content) + close_button, :class => 'help_message', :style => 'display: none;'), :class => 'help_box') 62 + text = content_tag('div', button + content_tag('div', content_tag('div', content) + close_button, :class => 'help_message', :id => help_id, :style => 'display: none;'), :class => 'help_box')
60 63
61 unless block.nil? 64 unless block.nil?
62 concat(text, block.binding) 65 concat(text, block.binding)
public/images/help.png 0 → 100644

916 Bytes

public/stylesheets/help.css
@@ -7,3 +7,11 @@ div.help_message { @@ -7,3 +7,11 @@ div.help_message {
7 margin-left: -300px; 7 margin-left: -300px;
8 background: yellow; 8 background: yellow;
9 } 9 }
  10 +
  11 +a.help_button:before {
  12 + content: url(../images/help.png)
  13 +}
  14 +
  15 +a.help_button:hover {
  16 + background: #ffa;
  17 +}