diff --git a/app/controllers/groups_controller.rb b/app/controllers/groups_controller.rb index 0d1cecf6b..1e47b7a8b 100644 --- a/app/controllers/groups_controller.rb +++ b/app/controllers/groups_controller.rb @@ -34,6 +34,7 @@ class GroupsController < ApplicationController def edit @groups = current_user.groups + @remote_requests = Request.for_user current_user end def update diff --git a/app/views/albums/index.html.haml b/app/views/albums/index.html.haml index 87902a523..2be4bace9 100644 --- a/app/views/albums/index.html.haml +++ b/app/views/albums/index.html.haml @@ -7,6 +7,9 @@ = content_for :page_title do = link_to "Albums", albums_path +- content_for :left_pane do + = render "shared/group_friends" + %h1.big_text Albums .right diff --git a/app/views/albums/show.html.haml b/app/views/albums/show.html.haml index 5e6e64817..3d24b1c09 100644 --- a/app/views/albums/show.html.haml +++ b/app/views/albums/show.html.haml @@ -8,6 +8,9 @@ = content_for :page_title do = link_to @album.name, @album +- content_for :left_pane do + = render "shared/group_friends" + .album_id{:id => @album.id, :style => "display:hidden;"} diff --git a/app/views/groups/edit.html.haml b/app/views/groups/edit.html.haml index 3b69a93fa..b8fe6e904 100644 --- a/app/views/groups/edit.html.haml +++ b/app/views/groups/edit.html.haml @@ -2,15 +2,27 @@ = javascript_include_tag 'jquery-ui-1.8.4.custom.min.js' = javascript_include_tag 'group-edit.js' -%h1{:class => 'big_text', :id => 'group_title'} - = "Editing Groups" +- content_for :left_pane do + %h1{:id => 'group_title'} + Requests + + %li.requests + %ul + - for request in @remote_requests + %li.person{:id => request.person.id, :request_id => request.id} + = image_tag(request.person.profile.image_url(:thumb_small)) unless request.person.profile.image_url.nil? + .name + = request.person.real_name + +%h1{:id => 'group_title'} + Relations %ul#group_list - for group in @groups %li.group - %h3= group.name + %h3{:contenteditable => true}= group.name %ul{:id => group.id} -if group.people.size < 1 @@ -20,8 +32,9 @@ -for person in group.people %li.person{:id => person.id, :from_group_id => group.id} - = image_tag(person.profile.image_url(:thumb_small),:size => "30x30") unless person.profile.image_url.nil? - = person.real_name + = image_tag(person.profile.image_url(:thumb_small)) unless person.profile.image_url.nil? + .name + = person.real_name %p %br = link_to 'Update Groups', '#', :class => 'button', :id => "move_friends_link" diff --git a/app/views/groups/index.html.haml b/app/views/groups/index.html.haml index e4e18829e..d41f596e1 100644 --- a/app/views/groups/index.html.haml +++ b/app/views/groups/index.html.haml @@ -1,6 +1,9 @@ - content_for :page_title do Home +- content_for :left_pane do + = render "shared/group_friends" + %ul#stream - for post in @posts = render type_partial(post), :post => post unless post.class == Album diff --git a/app/views/groups/show.html.haml b/app/views/groups/show.html.haml index 822a33ef4..4163d118d 100644 --- a/app/views/groups/show.html.haml +++ b/app/views/groups/show.html.haml @@ -1,6 +1,9 @@ - content_for :page_title do Home +- content_for :left_pane do + = render "shared/group_friends" + %ul#stream - for post in @posts = render type_partial(post), :post => post diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index 3c70d3a8a..d3c7e06fa 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -60,7 +60,7 @@ .span-5.last - if @group == :all %h1 - = link_to "All Groups", root_path + = link_to "All Relations", root_path - else %h1 = link_to @group.name, @group @@ -73,7 +73,7 @@ .container .span-5.last - = render "shared/group_friends" + = yield :left_pane .span-19.last = yield diff --git a/app/views/people/show.html.haml b/app/views/people/show.html.haml index 4d75df57e..acd52eef3 100644 --- a/app/views/people/show.html.haml +++ b/app/views/people/show.html.haml @@ -1,14 +1,10 @@ -.span-20.last - #profile.span-19.last +- content_for :page_title do + = @person.real_name + +- content_for :left_pane do + #profile .profile_photo = person_image_link(@person) - - %h1 - = @person.real_name - - if @person != current_user.person && current_user.friends.include?(@person) - .right - = link_to 'remove friend', @person, :confirm => 'Are you sure?', :method => :delete, :class => "button" - %ul -unless @posts.first.nil? %li @@ -22,19 +18,14 @@ = hidden_field_tag :from, :from, :value => @groups_with_person.first.id = hidden_field_tag :friend_id, :friend_id, :value => @person.id = submit_tag "save" - %li - url: - = @person.url - - - unless @latest_status_message.nil? - %h1.pinched - %span - = "\"#{@latest_status_message.message}\"" - %span="posted: #{how_long_ago(@latest_status_message)}" + + - if @person != current_user.person && current_user.friends.include?(@person) + = link_to 'remove friend', @person, :confirm => 'Are you sure?', :method => :delete, :class => "button" + +.span-20.last - .span-20.last + .span-19.last - if @posts - %h3= "stream - #{@post_count} item(s)" %ul#stream - for post in @posts = render type_partial(post), :post => post unless post.class == Album diff --git a/app/views/photos/show.html.haml b/app/views/photos/show.html.haml index 51c7234f5..d582bc095 100644 --- a/app/views/photos/show.html.haml +++ b/app/views/photos/show.html.haml @@ -13,6 +13,9 @@ = content_for :page_title do = link_to "Photo", @photo +- content_for :left_pane do + = render "shared/group_friends" + %h1.big_text = @photo.image diff --git a/app/views/shared/_group_nav.haml b/app/views/shared/_group_nav.haml index 730672333..5c07b6e83 100644 --- a/app/views/shared/_group_nav.haml +++ b/app/views/shared/_group_nav.haml @@ -7,12 +7,12 @@ %li.new_group= link_to("+", "#add_group_pane", :id => "add_group_button") - #group_edit_button - = link_to "edit", edit_group_path(Group.first), :class => "edit_group_button", :title => "Manage your facets." + #group_manage_button + = link_to "manage", edit_group_path(Group.first), :class => "edit_group_button", :title => "Manage your facets." %ul{ :style => "position:absolute;right:0;bottom:0;"} %li{:class => ("selected" if @group == :all)} - = link_to "All Groups", root_url + = link_to "All Relations", root_url .yo{ :style => "display:none;"} #add_group_pane diff --git a/public/javascripts/group-edit.js b/public/javascripts/group-edit.js index 28ab236de..5c136ebff 100644 --- a/public/javascripts/group-edit.js +++ b/public/javascripts/group-edit.js @@ -9,12 +9,18 @@ $('#move_friends_link').live( 'click', }); $(function() { - $("li .person").draggable({ + $("li .person").draggable({ revert: true }); - $(".group ul").droppable({ + + $("li .person").draggable({ + revert: true + }); + + $(".group ul").droppable({ drop: function(event, ui) { + var move = {}; move[ 'friend_id' ] = ui.draggable[0].id move[ 'to' ] = $(this)[0].id; diff --git a/public/javascripts/view.js b/public/javascripts/view.js index 7d096e52b..8b4c44134 100644 --- a/public/javascripts/view.js +++ b/public/javascripts/view.js @@ -25,51 +25,32 @@ $(document).ready(function(){ $(this).fadeIn("slow"); }); - - $(".edit_group_button").click(function() { - - var element = $(this).closest("li").children(".group_name").children("a"); - var oldHTML = element.html(); - - var link = element.attr("href"); - - element.toggleClass("editing"); - - if( element.hasClass("editing") ) { - element.attr("contentEditable", true); - element.focus(); - - //remove newline action - $(element).keypress(function(e) { - if (e.which == 13) { - e.preventDefault(); - element.attr("contentEditable", false); - element.toggleClass("editing"); - element.blur(); - - //save changes - $.ajax({ - type: "PUT", - url: link, - data: {"group" : {"name" : element.text() }} - }); - } - }); - - //update all other group links - $(element).keyup(function(e) { - $("a[href='"+link+"']").not(element).text(element.text()); - }); - - } else { - element.attr("contentEditable", false); - } - - }); - - });//end document ready +$(".group h3").live( 'click', function() { + + var $this = $(this); + var id = $this.closest("li").children("ul").attr("id"); + var link = "/groups/"+ id; + + $this.keypress(function(e) { + if (e.which == 13) { + e.preventDefault(); + $this.blur(); + + //save changes + $.ajax({ + type: "PUT", + url: link, + data: {"group" : {"name" : $this.text() }} + }); + } + //update all other group links + $this.keyup(function(e) { + $("a[href='"+link+"']").text($this.text()); + }); + }); +}); function pane_toggler_button( name ) { diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css index 1bc9132e6..029ccad0d 100644 --- a/public/stylesheets/application.css +++ b/public/stylesheets/application.css @@ -453,11 +453,11 @@ h1.big_text { #group_nav { position: relative; color: black; } - #group_nav #group_edit_button { + #group_nav #group_manage_button { display: inline; margin-top: 1px; font-size: 12px; } - #group_nav #group_edit_button a { + #group_nav #group_manage_button a { color: #999999; } #group_nav ul { margin-bottom: 0; @@ -582,13 +582,19 @@ h1.big_text { font-size: 12px; margin-top: -3px; } -.editing, .editing:hover { +.editing, +.editing:hover { background-color: yellow; border: 1px #666666 solid; } -.group { +.group, +.requests { list-style: none; } - .group ul { + .group h3, + .requests h3 { + display: inline-block; } + .group ul, + .requests ul { min-height: 20px; margin: 0; margin-left: 1em; @@ -598,12 +604,26 @@ h1.big_text { border-radius: 3px; list-style: none; padding: 15px; } - .group ul li { - margin-left: 0; - padding: 5px; - cursor: move; } - .group ul li img { - display: inline-block; } - .group ul .grey { + .group .person, + .requests .person { + display: inline-block; + margin-left: 0; + padding: 5px; + cursor: move; + margin: 5px; + background-color: #cccccc; + -webkit-border-radius: 3px; + text-align: center; + width: 75px; + height: 75px; + padding: 5px; + border: 1px solid #999999; } + .group .person img, + .requests .person img { + height: 50px; + width: 50px; + display: inline-block; } + .group .person .grey, + .requests .person .grey { font-style: italic; color: #666666; } diff --git a/public/stylesheets/sass/application.sass b/public/stylesheets/sass/application.sass index 4b23cecfc..887af39ae 100644 --- a/public/stylesheets/sass/application.sass +++ b/public/stylesheets/sass/application.sass @@ -579,7 +579,7 @@ h1.big_text :color #000 - #group_edit_button + #group_manage_button :display inline :margin :top 1px @@ -761,15 +761,21 @@ h1.big_text :margin :top -3px -.editing, .editing:hover +.editing, +.editing:hover :background :color yellow :border 1px #666 solid -.group +.group, +.requests :list :style none + + h3 + :display inline-block + ul :min-height 20px :margin 0 @@ -784,14 +790,32 @@ h1.big_text :style none :padding 15px - li - :margin - :left 0 - :padding 5px - :cursor move + .person + :display inline-block + :margin + :left 0 + :padding 5px + :cursor move + :margin 5px + + :background + :color #ccc + :-webkit-border-radius 3px + + :text + :align center + + :width 75px + :height 75px + :padding 5px + + :border 1px solid #999 + + img + :height 50px + :width 50px + :display inline-block - img - :display inline-block .grey :font