pulled new aspect into modal window

This commit is contained in:
danielgrippi 2011-05-13 11:58:18 -07:00
parent a9a1280e17
commit c200c386fb
8 changed files with 19 additions and 18 deletions

View file

@ -7,9 +7,8 @@ class AspectsController < ApplicationController
before_filter :save_sort_order, :only => :index before_filter :save_sort_order, :only => :index
before_filter :ensure_page, :only => :index before_filter :ensure_page, :only => :index
respond_to :html respond_to :html, :js
respond_to :json, :only => [:show, :create] respond_to :json, :only => [:show, :create]
respond_to :js
def index def index
if params[:a_ids] if params[:a_ids]
@ -84,6 +83,8 @@ class AspectsController < ApplicationController
def new def new
@aspect = Aspect.new @aspect = Aspect.new
@person_id = params[:person_id]
render :layout => false
end end
def destroy def destroy

View file

@ -7,8 +7,10 @@
%h4 %h4
= t('aspects.manage.add_a_new_aspect') = t('aspects.manage.add_a_new_aspect')
= form_for Aspect.new do |aspect| = form_for(Aspect.new, :remote => (defined?(remote) && remote) ) do |aspect|
= aspect.error_messages = aspect.error_messages
- if defined?(person_id)
= aspect.hidden_field :person_id, :value => person_id
%p %p
= aspect.label :name , t('.name') = aspect.label :name , t('.name')
= aspect.text_field :name, :maxlength => 20 = aspect.text_field :name, :maxlength => 20

View file

@ -1,2 +1,4 @@
$('ul.dropdown_list[data-person_id=<%= @person.id %>] .newItem').before("<%= escape_javascript( render('contacts/aspect_dropdown_list_item', :aspect => @aspect, :person => @person, :contact => @contact)) %>"); $('ul.dropdown_list[data-person_id=<%= @person.id %>] .newItem').before("<%= escape_javascript( render('contacts/aspect_dropdown_list_item', :aspect => @aspect, :person => @person, :contact => @contact)) %>");
$.facebox.close();
$('#profile .dropdown').toggleClass("active");

View file

@ -0,0 +1,5 @@
-# Copyright (c) 2010, Diaspora Inc. This file is
-# licensed under the Affero General Public License version 3 or later. See
-# the COPYRIGHT file.
= render 'new', :remote => true, :person_id => @person_id

View file

@ -14,15 +14,4 @@
%li.newItem %li.newItem
.add_aspect .add_aspect
= form_for(Aspect.new, :remote => true) do |aspect| = link_to "Add a new aspect", new_aspect_path(:person_id => person.id), :rel => 'facebox'
= aspect.error_messages
= aspect.hidden_field :person_id, :value => person.id if person
= aspect.hidden_field :share_with, :value => true
%p
= aspect.text_field :name, :style => "display:inline;"
%p.checkbox_select
= aspect.label :contacts_visible, t('aspects.edit.make_aspect_list_visible')
= aspect.check_box :contacts_visible, :checked => true, :default => true
.right
= aspect.submit t('contacts.share_with_pane.add_new_aspect'), :class => 'button'

View file

@ -58,4 +58,4 @@
.facebox_content .facebox_content
#add_aspect_pane #add_aspect_pane
= render "aspects/new_aspect" = render "aspects/new"

View file

@ -111,7 +111,7 @@ en:
no_requests: "No new requests" no_requests: "No new requests"
manage_aspects: "Manage aspects" manage_aspects: "Manage aspects"
drag_to_add: "Drag to add people" drag_to_add: "Drag to add people"
new_aspect: new:
name: "Name" name: "Name"
create: "Create" create: "Create"
create: create:

View file

@ -70,7 +70,9 @@ Feature: sending and receiving requests
When I sign in as "alice@alice.alice" When I sign in as "alice@alice.alice"
And I am on "bob@bob.bob"'s page And I am on "bob@bob.bob"'s page
And I press the first ".share_with.button" within "#author_info" And I press the first ".toggle.button"
And I press the first "a" within ".add_aspect"
And I wait for the ajax to finish
And I fill in "Name" with "Super People" in the modal window And I fill in "Name" with "Super People" in the modal window
And I press "aspect_submit" in the modal window And I press "aspect_submit" in the modal window