diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index 019c19b19..ed8dc8e3e 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -15,8 +15,8 @@ class ApplicationController < ActionController::Base
def set_contacts_notifications_and_status
if user_signed_in?
@aspect = nil
- @aspects = current_user.aspects.fields(:name)
- @aspects_dropdown_array = @aspects.collect{|x| [x.to_s, x.id]}
+ @all_aspects = current_user.aspects.fields(:name)
+ @aspects_dropdown_array = @all_aspects.collect{|x| [x.to_s, x.id]}
@notification_count = Notification.for(current_user, :unread =>true).all.count
end
end
diff --git a/app/controllers/aspects_controller.rb b/app/controllers/aspects_controller.rb
index 0d318526a..24a59a2d0 100644
--- a/app/controllers/aspects_controller.rb
+++ b/app/controllers/aspects_controller.rb
@@ -11,22 +11,22 @@ class AspectsController < ApplicationController
def index
if params[:a_ids]
- aspects = current_user.aspects_from_ids(params[:a_ids])
+ @aspects = current_user.aspects_from_ids(params[:a_ids])
else
- aspects = current_user.aspects
+ @aspects = current_user.aspects
end
- post_ids = aspects.map!{|a| a.post_ids}.flatten!
+ @aspect_ids = @aspects.map{|a| a.id}
+ post_ids = @aspects.map{|a| a.post_ids}.flatten!
@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.all, @contacts, :limit => 8
- @aspect = :all
-
+ @aspect_hashes = hashes_for_aspects @aspects, @contacts, :limit => 8
@contact_hashes = hashes_for_contacts @contacts
+ #@aspect = @aspects.first
+
if current_user.getting_started == true
redirect_to getting_started_path
end
diff --git a/app/controllers/status_messages_controller.rb b/app/controllers/status_messages_controller.rb
index 923b73575..0c05b1008 100644
--- a/app/controllers/status_messages_controller.rb
+++ b/app/controllers/status_messages_controller.rb
@@ -9,10 +9,7 @@ class StatusMessagesController < ApplicationController
respond_to :json, :only => :show
def create
-
- if params[:status_message][:aspect_ids] == "all"
- params[:status_message][:aspect_ids] = current_user.aspects.collect{|x| x.id}
- end
+ params[:status_message][:aspect_ids] = params[:aspect_ids]
photos = Photo.all(:id.in => [*params[:photos]], :diaspora_handle => current_user.person.diaspora_handle)
@@ -65,7 +62,7 @@ class StatusMessagesController < ApplicationController
@status_message = current_user.my_posts.where(:_id => params[:id]).first
if @status_message
@status_message.destroy
- render :nothing => true, :status => 200
+ render :nothing => true, :status => 200
else
Rails.logger.info "event=post_destroy status=failure user=#{current_user.diaspora_handle} reason='User does not own post'"
render :nothing => true, :status => 404
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 51c456364..30f672d78 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -33,11 +33,8 @@ module ApplicationHelper
def aspect_badge aspects
str = ''
- if aspects.count > 1
- str = "#{I18n.t('application.helper.aspect_badge.all_aspects')}"
- elsif aspects.count == 1
- aspect = aspects.first
- str = "#{aspect.name}"
+ aspects.each do |aspect|
+ str << "#{aspect.name}"
end
str.html_safe
end
diff --git a/app/views/aspects/_all_aspects_contacts.haml b/app/views/aspects/_all_aspects_contacts.haml
index d0c37608e..22fe355b1 100644
--- a/app/views/aspects/_all_aspects_contacts.haml
+++ b/app/views/aspects/_all_aspects_contacts.haml
@@ -7,10 +7,9 @@
%h1.new_request{:style => 'text-align:center'}
= new_request_link(@request_count)
-#left_pane.everyone
-
+#left_pane
.section.aspect_listings
- %h3
+ %h4
= t('.aspects')
.right{:style=>"font-size:12px;top:5px;"}
= link_to t('.manage_aspects'), aspects_manage_path
@@ -20,7 +19,7 @@
= render :partial => 'aspects/aspect', :locals => a_hash
.section.contact_pictures
- %h3
+ %h4
.right.description{:style => "top:-4px"}
= @contact_hashes.count
= t('.all_contacts')
diff --git a/app/views/aspects/_aspect.haml b/app/views/aspects/_aspect.haml
index a6008f309..fb319c2d7 100644
--- a/app/views/aspects/_aspect.haml
+++ b/app/views/aspects/_aspect.haml
@@ -1,9 +1,4 @@
%li
- %h4
+ %b
= link_to aspect, aspect
- %span
- = t('contacts', :count => contact_count)
-
- - if contact_count > 0
- - for hash in contacts
- = person_image_link(hash[:person])
+ = t('contacts', :count => contact_count)
diff --git a/app/views/aspects/index.html.haml b/app/views/aspects/index.html.haml
index a22f04eed..13906acb3 100644
--- a/app/views/aspects/index.html.haml
+++ b/app/views/aspects/index.html.haml
@@ -2,8 +2,12 @@
-# licensed under the Affero General Public License version 3 or later. See
-# the COPYRIGHT file.
+
+- content_for :head do
+ = include_javascripts :home
+
.span-24.last
- %h2{:style => "position:relative;"}
+ %h3{:style => "position:relative;"}
= current_user.name
.right{:style=>"top:0"}
%span.description
@@ -11,14 +15,14 @@
= info_text(t('.handle_explanation'))
.span-15.append-1
- = render 'shared/publisher', :aspect => @aspect
- = 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
+ = render 'shared/publisher', :aspect => @aspect, :aspect_ids => @aspect_ids
+ /= 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
#main_stream.stream
= render 'shared/stream', :posts => @post_hashes
= will_paginate @posts
-.span-8.last
+.span-6.last
= render 'aspects/all_aspects_contacts'
diff --git a/app/views/layouts/_header.html.haml b/app/views/layouts/_header.html.haml
index 620ba3f20..a47ff351d 100644
--- a/app/views/layouts/_header.html.haml
+++ b/app/views/layouts/_header.html.haml
@@ -46,9 +46,10 @@
%li{:class => ("selected" if @aspect == :all)}
= link_to t('_home'), root_path
- - for aspect in @aspects
- %li{:class => ("selected" if current_aspect?(aspect))}
- = link_for_aspect aspect
+ - for aspect in @all_aspects
+ %li{:data=>{:guid=>aspect.id}, :class => ("selected" if current_aspect?(aspect))}
+ = link_to aspect.name, '#'
+
%li
= link_to '+', '#add_aspect_pane', :class => "add_aspect_button", :title => t('aspects.manage.add_a_new_aspect')
diff --git a/app/views/photos/_new_photo.haml b/app/views/photos/_new_photo.haml
index fcdf09e35..1958f2589 100644
--- a/app/views/photos/_new_photo.haml
+++ b/app/views/photos/_new_photo.haml
@@ -6,7 +6,7 @@
function createUploader(){
var uploader = new qq.FileUploaderBasic({
element: document.getElementById('file-upload'),
- params: {'photo' : {'pending' : 'true', 'aspect_ids' : "#{aspect_id}"}, 'set_profile_image' : "#{set_profile_image if defined?(set_profile_image)}"},
+ params: {'photo' : {'pending' : 'true', 'aspect_ids' : "#{aspect_ids}"}, 'set_profile_image' : "#{set_profile_image if defined?(set_profile_image)}"},
allowedExtensions: ['jpg', 'jpeg', 'png'],
action: "#{photos_path}",
debug: true,
diff --git a/app/views/shared/_publisher.haml b/app/views/shared/_publisher.haml
index cfb52f116..90f5bb6fa 100644
--- a/app/views/shared/_publisher.haml
+++ b/app/views/shared/_publisher.haml
@@ -12,7 +12,7 @@
$(".question_mark").click();
};
});
-
+
if($("textarea#status_message_message").val() != ""){
$("#publisher").removeClass("closed");
$("#publisher").find("textarea").focus();
@@ -52,7 +52,8 @@
%ul#photodropzone
= status.text_area :message, :rows => 2, :value => params[:prefill]
- = status.hidden_field :aspect_ids, :value => (aspect == :all ? aspect : aspect.id)
+ - for aspect_id in @aspect_ids
+ = hidden_field_tag 'aspect_ids[]', aspect_id.to_s
.options_and_submit
@@ -82,5 +83,5 @@
= render 'shared/public_explain'
#publisher_photo_upload
- = render 'photos/new_photo', :aspect_id => (aspect == :all ? aspect : aspect.id)
+ = render 'photos/new_photo', :aspect_ids => @aspect_ids
diff --git a/config/assets.yml b/config/assets.yml
index 3157383a5..c13dce455 100644
--- a/config/assets.yml
+++ b/config/assets.yml
@@ -30,6 +30,8 @@ javascripts:
- public/javascripts/vendor/jquery-ui-1.8.6.custom.min.js
- public/javascripts/aspect-edit.js
- public/javascripts/contact-list.js
+ home:
+ - public/javascripts/aspect-filters.js
people:
- public/javascripts/contact-list.js
photos:
diff --git a/public/javascripts/aspect-filters.js b/public/javascripts/aspect-filters.js
new file mode 100644
index 000000000..dfc140e4a
--- /dev/null
+++ b/public/javascripts/aspect-filters.js
@@ -0,0 +1,51 @@
+/* Copyright (c) 2010, Diaspora Inc. This file is
+ * licensed under the Affero General Public License version 3 or later. See
+ * the COPYRIGHT file.
+ */
+
+$(function(){
+ var selectedGUIDS = [];
+
+ $("#aspect_nav li").each(function(){
+ var button = $(this),
+ guid = button.attr('data-guid');
+
+ if(guid && location.href.match(guid)){
+ button.addClass('selected');
+ selectedGUIDS.push(guid);
+ }
+ });
+
+ $("#aspect_nav a").click(function(e){
+
+ e.preventDefault();
+
+ var $this = $(this),
+ listElement = $this.parent(),
+ guid = listElement.attr('data-guid'),
+ baseURL = location.href.split("?")[0];
+
+ if( listElement.hasClass('selected') ){
+ // remove filter
+ var idx = selectedGUIDS.indexOf( guid );
+ if( idx != -1 ){
+ selectedGUIDS.splice(idx,1);
+ }
+
+ } else {
+ // append filter
+ if(selectedGUIDS.indexOf( guid == 1)){
+ selectedGUIDS.push( guid );
+ }
+ }
+
+ // generate new url
+ baseURL += '?';
+ for(i=0; i < selectedGUIDS.length; i++){
+ baseURL += 'a_ids[]='+ selectedGUIDS[i] +'&';
+ }
+ baseURL = baseURL.slice(0,baseURL.length-1);
+
+ window.location = baseURL;
+ });
+});
diff --git a/public/stylesheets/sass/application.sass b/public/stylesheets/sass/application.sass
index 536aa6a87..5620ee404 100644
--- a/public/stylesheets/sass/application.sass
+++ b/public/stylesheets/sass/application.sass
@@ -6,6 +6,7 @@
body
:padding 2em
:margin 0
+ :top 60px
:background-color rgb(252,252,252)
a
:color #107FC9
@@ -114,19 +115,27 @@ header
:z-index 4
:position relative
:min-height 40px
- :margin -2em
- :bottom 2em
- :color #000
:background
- :color #333
- :background -webkit-gradient(linear, 0% 0%, 0% 100%, from(#080808), to(#191919), color-stop(.9,#262626),color-stop(.1,#333333),color-stop(.75,#343434))
- :background -moz-linear-gradient( center bottom, rgb(21,21,21) 1%, rgb(51,51,51) 12%)
+ :color #222
+ :color rgba(30,30,30,0.98)
+
+ :-webkit-box-shadow 0 0px 3px #000
+ :-moz-box-shadow 0 0px 3px #000
+ :box-shadow 0 0px 3px #000
+
+ :border
+ :bottom 1px solid #999
:padding 0
:top 5px
:color #CCC
+ :position fixed
+ :width 100%
+ :top 0
+ :left 0
+
a
:color #CCC
@@ -911,8 +920,8 @@ label
#aspect_nav
:margin
- :top 8px
- :bottom 0
+ :top 7px
+ :bottom 2px
:bottom 0
:color #000
@@ -928,13 +937,13 @@ label
:margin 0
:padding 4px 0
a
- :-webkit-border-radius 3px 3px 0 0
- :-moz-border-radius 3px 3px 0 0
- :border-radius 3px 3px 0 0
+ :-webkit-border-radius 2px
+ :-moz-border-radius 2px
+ :border-radius 2px
:text-shadow 0 1px 0 #444
- :padding 4px 10px
+ :padding 2px 7px
:margin
:left -1px
:color #CCC
@@ -951,8 +960,6 @@ label
:text-shadow 0 1px 0 #eee
:font
:weight bold
- :padding
- :bottom 6px
:background
:color rgb(252,252,252)
@@ -1201,7 +1208,6 @@ ul#settings_nav
:padding 0
-#left_pane.everyone,
#edit_aspect_pane
:background
:color rgb(250,250,250)
@@ -1243,7 +1249,7 @@ ul#settings_nav
:top 1px solid #fff
:bottom 1px solid #fff
-#left_pane.everyone
+#left_pane
.aspect_listings
a
:font
@@ -1253,6 +1259,11 @@ ul#settings_nav
:margin
:bottom 24px
+ ul
+ :padding 0
+ :margin 0
+
+
.aspect_listings
ul
:padding 0
@@ -1982,6 +1993,8 @@ h3,h4
:color #fff
:line-height auto
:padding 0 4px
+ :margin
+ :right 4px
:-webkit-border-radius 3px
:-moz-border-radius 3px