aspects now have edit pages accessible through the top nav

This commit is contained in:
danielvincent 2011-01-05 13:14:35 -08:00
parent 44d3c4bacd
commit b029475421
10 changed files with 134 additions and 116 deletions

View file

@ -86,6 +86,22 @@ class AspectsController < ApplicationController
end
end
def edit
@aspect = current_user.aspect_by_id params[:id]
@contacts = current_user.contacts.where(:pending => false)
unless @aspect
render :file => "#{Rails.root}/public/404.html", :layout => false, :status => 404
else
@aspect_ids = [@aspect.id]
@aspect_contacts = hashes_for_contacts Contact.all(:user_id => current_user.id, :aspect_ids.in => [@aspect.id], :pending => false)
@aspect_contacts_count = @aspect_contacts.count
@all_contacts = hashes_for_contacts @contacts
respond_with @aspect
end
end
def manage
@aspect = :manage
@contacts = current_user.contacts.where(:pending => false)

View file

@ -7,7 +7,7 @@
#edit_aspect_pane
- if @contacts.count > 0
%h4= t('.add_existing')
%h4= t('aspects.edit.add_existing')
= render 'shared/contact_list', :aspect_id => aspect.id, :contact_hashes => contacts, :manage => defined?(manage)
= render 'shared/add_contact', :aspect_id => aspect.id
@ -15,9 +15,9 @@
%hr
= form_for aspect do |asp|
= asp.text_field :name, :value => aspect.name
= asp.submit t('.rename_aspect')
= asp.submit t('aspects.edit.rename_aspect')
%hr
.big_buttons
= button_to t('.remove_aspect'), aspect, :method => "delete", :confirm => t('.confirm_remove_aspect')
= button_to t('aspects.edit.remove_aspect'), aspect, :method => "delete", :confirm => t('aspects.edit.confirm_remove_aspect')

View file

@ -0,0 +1,27 @@
-# Copyright (c) 2010, Diaspora Inc. This file is
-# licensed under the Affero General Public License version 3 or later. See
-# the COPYRIGHT file.
- content_for :head do
= include_javascripts :aspects
.span-24.last
%h3
= "Editing #{@aspect.name}"
.span-6.append-1
- if @contacts.count > 0
%h4= 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

@ -2,8 +2,7 @@
-# licensed under the Affero General Public License version 3 or later. See
-# the COPYRIGHT file.
.container#head{:style => "position:relative;"}
.container{:style => "position:relative;"}
- if current_user
= link_to image_tag('logo_small.png', :height => "16px", :width => "161px", :class => "diaspora_header_logo"), root_path
- else
@ -41,14 +40,14 @@
%li= link_to t('.logout'), destroy_user_session_path
-unless @landing_page
#aspect_nav
%ul
%ul#aspect_nav
%li{:class => ("selected" if @aspect == :all)}
= link_to t('_home'), root_path, :class => 'home_selector'
- for aspect in @all_aspects
%li{:data=>{:guid=>aspect.id}, :class => ("selected" if current_aspect?(aspect))}
= link_to aspect.name, '#', :class => 'aspect_selector'
= link_to '▼', edit_aspect_path(aspect), :class => 'aspect_selector_edit'
%li
= link_to '+', '#add_aspect_pane', :class => "add_aspect_button", :title => t('aspects.manage.add_a_new_aspect')

View file

@ -31,7 +31,7 @@
:locals => {:person => person,
:contact => contact,
:aspects_with_person => @aspects_with_person,
:aspects_without_person => @aspects.reject{ |aspect| @aspects_with_person.include?(aspect)}}
:aspects_without_person => @all_aspects.reject{ |aspect| @aspects_with_person.include?(aspect)}}
%br
%hr{:style=>"width:300px;"}

View file

@ -26,7 +26,7 @@
%ul#aspect_list
- for aspect in @aspects
- for aspect in @all_aspects
%li.aspect{:data=>{:guid=>aspect.id}}
.aspect_name

View file

@ -8,7 +8,7 @@
.description
= t('.ready_to_share')
%ul.inline_aspect_listing
- for aspect in @aspects
- for aspect in @all_aspects
%li= aspect
%br

View file

@ -127,6 +127,11 @@ en:
all_contacts: "All contacts"
cannot_remove: "Cannot remove person from last aspect. (If you want to disconnect from this person you must remove contact.)"
aspects:
edit:
remove_aspect: "Delete this aspect"
confirm_remove_aspect: "Are you sure you want to delete this aspect?"
add_existing: "Add an existing contact"
rename_aspect: "Rename aspect"
all_aspects_contacts:
all_contacts: "All contacts"
manage_aspects: "manage aspects"
@ -181,11 +186,6 @@ en:
work: "Work"
index:
handle_explanation: "This is your diaspora handle. Like an email address, you can give this to people to reach you."
edit_aspect_pane:
remove_aspect: "Delete this aspect"
confirm_remove_aspect: "Are you sure you want to delete this aspect?"
add_existing: "Add an existing contact"
rename_aspect: "Rename aspect"
notifications:
request_accepted: "accepted your share request."
new_request: "offered to share with you."

View file

@ -42,7 +42,7 @@ Diaspora::Application.routes.draw do
match 'aspects/add_to_aspect', :to => 'aspects#add_to_aspect', :as => 'add_to_aspect'
match 'aspects/remove_from_aspect',:to => 'aspects#remove_from_aspect', :as => 'remove_from_aspect'
match 'aspects/manage', :to => 'aspects#manage'
resources :aspects, :except => [:edit]
resources :aspects
#public routes
match 'webfinger', :to => 'publics#webfinger'

View file

@ -919,14 +919,13 @@ label
:height 100px
:width 100px
#aspect_nav
ul#aspect_nav
:margin
:top 3px
:bottom 2px
:bottom 0
:color #000
ul
:position relative
:padding 0
:bottom 3px
@ -935,29 +934,40 @@ label
> li
:display inline
:padding 1px 8px
:margin 0
:right 2px
:padding 4px 0
a
:-webkit-border-radius 2px
:-moz-border-radius 2px
:border-radius 2px
:text-shadow 0 1px 0 #444
:padding 1px 5px
:color #999
:max-width 120px
:overflow hidden
:text-overflow ellipsis
.aspect_selector_edit
:position absolute
:margin
:left -3px
:display none
:color #555
&:hover
:color #eee
&:hover
:background
:color #000
:color #eee
&.selected a
.aspect_selector_edit
:display inline
&.selected
:text-shadow 0 1px 0 #fff
:font
:weight bold
@ -968,6 +978,14 @@ label
:bottom 1px solid #fff
:color #444
.aspect_selector_edit
:margin
:left -4px
:color #777
&:hover
:color #999
&:hover
:color #888
a
@ -975,6 +993,7 @@ label
.new_requests
:color red
#global_search
:display inline
:position relative
@ -1211,48 +1230,6 @@ ul#settings_nav
:margin 0
:padding 0
#edit_aspect_pane
:background
:color rgb(250,250,250)
:border 1px solid #ddd
:padding 11px
:-webkit-border-radius 4px
:-moz-border-radius 4px
:border-radius 4px
h2,h3
:border
:bottom 1px solid #999
h2,h3,h4
:font
:weight bold
:text
:shadow 0 1px #fff
h4 > span
:font
:weight normal
:size 12px
:color #999
.avatar
:margin-right -1px
:width 30px
:height 30px
#edit_aspect_pane
:margin
:top 12px
:background -webkit-gradient(linear, 0% 0%, 0% 100%, from(#FBFBFB), to(#F5F5F5))
:background -moz-linear-gradient(top, #FBFBFB, #F5F5F5)
:border 1px solid #eee
:top 1px solid #fff
:bottom 1px solid #fff
#left_pane
.aspect_listings
a
@ -1277,7 +1254,6 @@ ul#settings_nav
:border
:bottom 1px solid #ddd
.floating.empty_message
:margin
:bottom 24px