app/helpers/toolbar_helper.rb in social_stream-base-0.6.0 vs app/helpers/toolbar_helper.rb in social_stream-base-0.6.1
- old
+ new
@@ -36,12 +36,15 @@
#
# Render the profile toolbar for group changing the contacts menu option:
#
# <% toolbar :profile => @group, :option => :contacts %>
#
-
def toolbar(options = {}, &block)
+ old_toolbar(options,&block)
+ end
+
+ def old_toolbar(options = {}, &block)
if options[:option] && block_given?
menu_options[options[:option]] = capture(&block)
end
content = capture do
@@ -54,30 +57,49 @@
case request.format
when Mime::JS
response = <<-EOJ
- $('#toolbar').html("#{ escape_javascript(content) }");
- initMenu();
- expandSubMenu('#{ options[:option] }');
- EOJ
+ $('#toolbar').html("#{ escape_javascript(content) }");
+ initMenu();
+ expandSubMenu('#{ options[:option] }');
+ EOJ
response.html_safe
else
- content_for(:toolbar) do
- content
- end
- content_for(:javascript) do
- <<-EOJ
- expandSubMenu('#{ options[:option] }');
- EOJ
- end
+ content_for(:toolbar) do
+ content
end
+ content_for(:javascript) do
+ <<-EOJ
+ expandSubMenu('#{ options[:option] }');
+ EOJ
+ end
+ end
end
# Cache menu options for toolbar
#
# @api private
def menu_options #:nodoc:
@menu_options ||= {}
+ end
+
+ def default_toolbar_menu
+ items = [{:key => :notifications,
+ :name => image_tag("btn/btn_notification.png", :class => "menu_icon")+t('notification.other')+' ('+ current_subject.mailbox.notifications.not_trashed.unread.count.to_s+')',
+ :url => notifications_path}]
+
+ items << {:key => :dummy1, :name => "Dummy 1", :url => "#", :items => [
+ {:key => :dummy1_1, :name => "Dummy 1.1", :url => "#"},
+ {:key => :dummy1_2, :name => "Dummy 1.2", :url => "#"}
+ ]}
+
+ return render_items items
+ end
+
+ def render_items(items)
+ menu = render_navigation :items => items
+ menu = menu.gsub(/\<ul\>/,'<ul class="menu">')
+ return raw menu
end
end