diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index b737c23..f86704b 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -42,6 +42,9 @@ module ApplicationHelper # TODO: implement correcly the 'Help' button click def help(content = nil, type = :html, &block) + @help_message_id ||= 1 + help_id = "help_message_#{@help_message_id}" + if content.nil? return '' if block.nil? content = capture(&block) @@ -53,10 +56,10 @@ module ApplicationHelper # TODO: implement this button, and add style='display: none' to the help # message DIV - button = link_to_function(_('Help'), "Element.show('help_message')", :class => 'help_button' ) - close_button = content_tag("div", link_to_function(_("Close"), "Element.hide('help_message')", :class => 'close_help_button')) + button = link_to_function(content_tag('span', _('Help')), "Element.show('#{help_id}')", :class => 'help_button' ) + close_button = content_tag("div", link_to_function(_("Close"), "Element.hide('#{help_id}')", :class => 'close_help_button')) - text = content_tag('div', button + content_tag('div', content_tag('div', content) + close_button, :class => 'help_message', :style => 'display: none;'), :class => 'help_box') + 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') unless block.nil? concat(text, block.binding) diff --git a/public/images/help.png b/public/images/help.png new file mode 100644 index 0000000..8542495 Binary files /dev/null and b/public/images/help.png differ diff --git a/public/stylesheets/help.css b/public/stylesheets/help.css index a238a30..4e05d9d 100644 --- a/public/stylesheets/help.css +++ b/public/stylesheets/help.css @@ -7,3 +7,11 @@ div.help_message { margin-left: -300px; background: yellow; } + +a.help_button:before { + content: url(../images/help.png) +} + +a.help_button:hover { + background: #ffa; +} -- libgit2 0.21.2