aspect badge links work across all pages, ajax stream on index. aspect info lightbox placeholder

This commit is contained in:
danielvincent 2011-01-05 18:18:04 -08:00
parent 14ca5e1cc1
commit 8c82a5974a
12 changed files with 123 additions and 54 deletions

View file

@ -22,7 +22,7 @@ class AspectsController < ApplicationController
@posts = Post.where(:id.in => post_ids, :_type => "StatusMessage").paginate :page => params[:page], :per_page => 15, :order => 'created_at DESC'
@post_hashes = hashes_for_posts @posts
@contacts = Contact.all(:user_id => current_user.id, :pending => false)
@aspect_hashes = hashes_for_aspects @aspects, @contacts, :limit => 8
@aspect_hashes = hashes_for_aspects @all_aspects, @contacts, :limit => 8
@contact_hashes = hashes_for_contacts @contacts
@aspect = :all unless params[:a_ids]
@ -98,7 +98,7 @@ class AspectsController < ApplicationController
@all_contacts = hashes_for_contacts @contacts
respond_with @aspect
render :layout => false
end
end

View file

@ -34,7 +34,9 @@ module ApplicationHelper
def aspect_badge aspects
str = ''
aspects.each do |aspect|
str << "<span class='aspect_badge single'><a href=#{aspect_path(aspect)}>#{aspect.name}</a></span>"
str << "<span class='aspect_badge single'>"
str << link_for_aspect(aspect, 'data-guid' => aspect.id, :class => 'hard_aspect_link').html_safe
str << "</span>"
end
str.html_safe
end

View file

@ -7,7 +7,7 @@ module AspectsHelper
link_to aspect.name, aspects_path("a_ids[]" => aspect.id), opts
end
def remove_link( aspect )
def remove_link(aspect)
if aspect.contacts.size == 0
link_to I18n.t('aspects.helper.remove'), aspect, :method => :delete, :confirm => I18n.t('aspects.helper.are_you_sure')
else

View file

@ -10,9 +10,8 @@
#left_pane
.section.aspect_listings
%h4
.right{:style=>"font-size:12px;"}
= link_to t('.manage_aspects'), aspects_manage_path
= t('.aspects')
= link_to @all_aspects.count, aspects_manage_path
%ul
- for a_hash in @aspect_hashes
@ -20,9 +19,8 @@
.section.contact_pictures
%h4
.right.description{:style => "top:-4px"}
= @contact_hashes.count
= t('.all_contacts')
= t('.contacts')
= link_to @contact_hashes.count, '#'
- for contact in @contact_hashes
= person_image_link(contact[:person])
@ -34,6 +32,6 @@
= text_field_tag 'q', nil, :placeholder => t('search'), :type => 'search', :results => 5
.section
%h3= t('shared.invitations.invites')
%h4= t('shared.invitations.invites')
= render "shared/invitations", :invites => @invites

View file

@ -1,4 +1,4 @@
%li
%b
= link_for_aspect(aspect)
= t('contacts', :count => contact_count)
.right
= t('contacts', :count => contact_count)
= link_to aspect.name, edit_aspect_path(aspect), :class => 'aspect_detail_button'

View file

@ -6,22 +6,31 @@
= include_javascripts :aspects
.span-24.last
%h3
= "Editing #{@aspect.name}"
#aspect_edit_pane
#aspect_edit_pane_header
%h4
.aspect_search_field
/= text_field_tag 'q', nil, :placeholder => t('search'), :type => 'search', :results => 5
= @aspect
.description
= "#{@contacts.count} contacts"
.person_tiles{:style => "display:none;"}
- for contact in @aspect.contacts
.tile
= person_image_link contact.person
= link_to contact.person.name, contact.person
%hr
= form_for @aspect do |asp|
= asp.text_field :name, :value => @aspect.name
= asp.submit t('.rename_aspect'), :class => 'button'
= button_to t('.remove_aspect'), @aspect, :method => "delete", :confirm => t('.confirm_remove_aspect'), :class => 'button'
.span-6.append-1
- if @contacts.count > 0
%h4= t('.add_existing')
%h5= t('.add_existing')
= render 'shared/contact_list', :aspect_id => @aspect.id, :contact_hashes => @all_contacts
= render 'shared/add_contact', :aspect_id => @aspect.id
.span-4.last
= form_for @aspect do |asp|
= asp.text_field :name, :value => @aspect.name
= asp.submit t('.rename_aspect')
.big_buttons
= button_to t('.remove_aspect'), @aspect, :method => "delete", :confirm => t('.confirm_remove_aspect')

View file

@ -6,15 +6,7 @@
- content_for :head do
= include_javascripts :home
.span-22.last
%h3{:style => "position:relative;"}
= current_user.name
.right{:style=>"top:0"}
%span.description
= link_to current_user.diaspora_handle, person_path(current_user.person)
= info_text(t('.handle_explanation'))
.span-15.append-1
.span-15.append-2
/= render 'aspects/no_contacts_message', :aspect => @aspect, :contact_count => @contacts.count
/= render 'aspects/no_posts_message', :post_count => @post_hashes.length, :contact_count => @contacts.count
@ -24,6 +16,15 @@
:aspect_ids => @aspect_ids,
:post_hashes => @post_hashes
.span-6.last
.span-7.last
= owner_image_tag
%h3{:style => "position:relative;display:inline-block;margin-left:12px;top:-8px;"}
= current_user.name
.description
= link_to current_user.diaspora_handle, person_path(current_user.person)
/= info_text(t('.handle_explanation'))
%hr
= render 'aspects/all_aspects_contacts'

View file

@ -3,7 +3,7 @@
-# the COPYRIGHT file.
%h4
%h5
= t('aspects.manage.add_a_new_contact')
= info_text(t('.enter_a_diaspora_username'))

View file

@ -133,7 +133,7 @@ en:
add_existing: "Add an existing contact"
rename_aspect: "Rename aspect"
all_aspects_contacts:
all_contacts: "All contacts"
contacts: "Contacts"
manage_aspects: "manage aspects"
aspects: "Aspects"
no_contacts: "You currently have no contacts. Find your contacts here."

View file

@ -17,6 +17,28 @@ $(document).ready(function(){
}
});
$("a.hard_aspect_link").live("click", function(e){
e.preventDefault();
requests++;
var guid = $(this).attr('data-guid');
// select correct aspect in filter list & deselect others
$("#aspect_nav li").each(function(){
var $this = $(this);
if( $this.attr('data-guid') == guid){
$this.addClass('selected');
} else {
$this.removeClass('selected');
}
});
// loading animation
$("#aspect_stream_container").fadeTo(100, 0.4);
performAjax( $(this).attr('href'), $("#publisher textarea").val());
});
$("#aspect_nav a.aspect_selector").click(function(e){
e.preventDefault();
@ -25,14 +47,11 @@ $(document).ready(function(){
// loading animation
$("#aspect_stream_container").fadeTo(100, 0.4);
// get text from box
var post = $("#publisher textarea").val();
// filtering //////////////////////
var $this = $(this),
listElement = $this.parent(),
guid = listElement.attr('data-guid'),
baseURL = location.href.split("?")[0],
post = $("#publisher textarea").val(),
homeListElement = $("#aspect_nav a.home_selector").parent();
if( listElement.hasClass('selected') ){
@ -57,6 +76,13 @@ $(document).ready(function(){
homeListElement.removeClass('selected');
}
performAjax(generateURL(), post);
});
function generateURL(){
var baseURL = location.href.split("?")[0];
// generate new url
baseURL = baseURL.replace('#','');
baseURL += '?';
@ -71,10 +97,12 @@ $(document).ready(function(){
// slice last '&'
baseURL = baseURL.slice(0,baseURL.length-1);
}
///////////////////////////////////
return baseURL;
}
function performAjax(newURL, post){
$.ajax({
url : baseURL,
url : newURL,
dataType : 'script',
success : function(data){
requests--;
@ -94,6 +122,5 @@ $(document).ready(function(){
}
}
});
});
}
});

View file

@ -79,7 +79,9 @@ var View = {
".add_photo_button",
".remove_person_button",
".question_mark",
".share_with_button"
".share_with_button",
".aspect_detail_button",
".aspect_selector_edit"
]
},

View file

@ -337,10 +337,6 @@ header
:top 7px
img
:-webkit-box-shadow 0 1px 2px #333
:-moz-box-shadow 0 1px 2px #333
:box-shadow 0 1px 2px #333
:margin
:right 0.5em
@ -753,6 +749,9 @@ label
:top 1px
:top 0
:background
:color rgb(248,248,248)
:border
:bottom 2px #777 solid
:top 1px #777 solid
@ -1215,9 +1214,11 @@ ul#settings_nav
:top 12px
:line-height 1em
img
:margin-right -1px
:width 30px
:height 30px
:margin
:right 1px
:bottom 2px
:width 35px
:height 35px
.contact_pictures.horizontal
img
@ -1243,6 +1244,8 @@ ul#settings_nav
ul
:padding 0
:margin 0
> li
:position relative
.aspect_listings
@ -2113,3 +2116,30 @@ ul.show_comments
:margin
:left 0.5em
:right 0.5em
#aspect_edit_pane
.aspect_search_field
:position absolute
:right 5px
input
:width 200px
.person_tiles
.tile
:padding 6px
:left 65px
:margin 3px
:left 0
:display inline-block
:width 126px
:height 50px
:border 1px solid #eee
:border-radius 2px
:position relative
img
:position absolute
:left 6px