From 665517abfc2835879a376ca141a69fa457226c84 Mon Sep 17 00:00:00 2001 From: danielgrippi Date: Sun, 8 Jan 2012 14:41:43 -0800 Subject: [PATCH] use app.router.navagate for nav elements that don't expand (i.e. aspects, tags) --- app/views/aspects/_aspect_listings.haml | 3 +-- app/views/aspects/_aspect_stream.haml | 5 ++--- app/views/aspects/_selected_contacts.html.haml | 14 -------------- app/views/aspects/index.html.haml | 10 +++++----- public/javascripts/app/app.js | 11 ++++++++++- 5 files changed, 18 insertions(+), 25 deletions(-) delete mode 100644 app/views/aspects/_selected_contacts.html.haml diff --git a/app/views/aspects/_aspect_listings.haml b/app/views/aspects/_aspect_listings.haml index a2e7d0867..403a43346 100644 --- a/app/views/aspects/_aspect_listings.haml +++ b/app/views/aspects/_aspect_listings.haml @@ -4,8 +4,7 @@ %ul#aspect_nav.left_nav %li.all_aspects - .root_element - = link_to t('aspects.index.your_aspects'), aspects_path + = link_to t('aspects.index.your_aspects'), aspects_path, :class => 'home_selector' - if @stream.is_a?(Stream::Aspect) %ul.sub_nav diff --git a/app/views/aspects/_aspect_stream.haml b/app/views/aspects/_aspect_stream.haml index 5ac91a4ff..f332c9e9d 100644 --- a/app/views/aspects/_aspect_stream.haml +++ b/app/views/aspects/_aspect_stream.haml @@ -2,9 +2,8 @@ -# licensed under the Affero General Public License version 3 or later. See -# the COPYRIGHT file. -#aspect_stream_header - %h3 - = stream.title +%h3#aspect_stream_header.stream_title + = stream.title = render 'shared/publisher', :selected_aspects => stream.aspects, :aspect_ids => stream.aspect_ids, :for_all_aspects => stream.for_all_aspects?, :aspect => stream.aspect = render 'aspects/no_posts_message' diff --git a/app/views/aspects/_selected_contacts.html.haml b/app/views/aspects/_selected_contacts.html.haml deleted file mode 100644 index f844d8c44..000000000 --- a/app/views/aspects/_selected_contacts.html.haml +++ /dev/null @@ -1,14 +0,0 @@ -#selected_aspect_contacts.section - .title.no_icon - %h5 - = @stream.contacts_title - - .content - - if @stream.people.size > 0 - - for person in @stream.people.sample(15) - = person_image_link(person) - = link_to @stream.contacts_link_title, @stream.contacts_link, :id => "view_all_contacts_link" - - else - = t('.no_contacts') - = link_to t('.manage_your_aspects'), contacts_link - diff --git a/app/views/aspects/index.html.haml b/app/views/aspects/index.html.haml index 278899a73..daa14c9a2 100644 --- a/app/views/aspects/index.html.haml +++ b/app/views/aspects/index.html.haml @@ -31,21 +31,21 @@ .section %ul.left_nav %li - = link_to t("streams.multi.title"), multi_path, :class => 'home_selector' + = link_to t("streams.multi.title"), multi_path, :class => 'home_selector', :rel => 'backbone' = render 'aspects/aspect_listings', :stream => @stream %ul.left_nav %li - = link_to t('streams.mentions.title'), mentions_path, :class => 'home_selector' + = link_to t('streams.mentions.title'), mentions_path, :class => 'home_selector', :rel => 'backbone' %ul.left_nav %li - = link_to t('streams.comment_stream.title'), comment_stream_path, :class => 'home_selector' + = link_to t('streams.comment_stream.title'), comment_stream_path, :class => 'home_selector', :rel => 'backbone' %ul.left_nav %li - = link_to t('streams.like_stream.title'), like_stream_path, :class => 'home_selector' + = link_to t('streams.like_stream.title'), like_stream_path, :class => 'home_selector', :rel => 'backbone' #followed_tags_listing = render 'tags/followed_tags_listings' @@ -58,7 +58,7 @@ /= render 'aspects/selected_contacts', :stream => @stream #selected_aspect_contacts.section .title.no_icon - %h5 + %h5.stream_title = @stream.title .content diff --git a/public/javascripts/app/app.js b/public/javascripts/app/app.js index c8d4cc73f..2609be1c9 100644 --- a/public/javascripts/app/app.js +++ b/public/javascripts/app/app.js @@ -10,7 +10,7 @@ var app = { }, initialize: function() { - app.router = new app.Router; + app.router = new app.Router(); if(this._user){ app.header = new app.views.Header; @@ -19,6 +19,15 @@ var app = { } Backbone.history.start({pushState: true}); + + // there's probably a better way to do this... + $("a[rel=backbone]").bind("click", function(evt){ + evt.preventDefault(); + var link = $(this); + + $(".stream_title").text(link.text()) + app.router.navigate(link.attr("href").substring(1) ,true) + }) } };