photos can be posted to multiple aspects. header nav works from pages other than aspect/index.

This commit is contained in:
danielvincent 2011-01-05 15:16:28 -08:00
parent 0a07dd16b5
commit 5358ac32a1
9 changed files with 16 additions and 11 deletions

View file

@ -122,7 +122,7 @@ class PeopleController < ApplicationController
@aspects_with_person = @contact.aspects @aspects_with_person = @contact.aspects
end end
@aspects_without_person = @aspects.reject do |aspect| @aspects_without_person = @all_aspects.reject do |aspect|
@aspects_with_person.include?(aspect) @aspects_with_person.include?(aspect)
end end

View file

@ -42,6 +42,8 @@ class PhotosController < ApplicationController
if params[:photo][:aspect_ids] == "all" if params[:photo][:aspect_ids] == "all"
params[:photo][:aspect_ids] = current_user.aspects.collect{|x| x.id} params[:photo][:aspect_ids] = current_user.aspects.collect{|x| x.id}
elsif params[:photo][:aspect_ids].is_a?(Hash)
params[:photo][:aspect_ids] = params[:photo][:aspect_ids].values
end end
params[:photo][:user_file] = file_handler(params) params[:photo][:user_file] = file_handler(params)

View file

@ -3,8 +3,8 @@
# the COPYRIGHT file. # the COPYRIGHT file.
module AspectsHelper module AspectsHelper
def link_for_aspect( aspect ) def link_for_aspect(aspect, opts={})
link_to aspect.name, aspect link_to aspect.name, aspects_path("a_ids[]" => aspect.id), opts
end end
def remove_link( aspect ) def remove_link( aspect )

View file

@ -10,9 +10,9 @@
#left_pane #left_pane
.section.aspect_listings .section.aspect_listings
%h4 %h4
= t('.aspects') .right{:style=>"font-size:12px;"}
.right{:style=>"font-size:12px;top:5px;"}
= link_to t('.manage_aspects'), aspects_manage_path = link_to t('.manage_aspects'), aspects_manage_path
= t('.aspects')
%ul %ul
- for a_hash in @aspect_hashes - for a_hash in @aspect_hashes

View file

@ -1,4 +1,4 @@
%li %li
%b %b
= link_to aspect, aspect = link_for_aspect(aspect)
= t('contacts', :count => contact_count) = t('contacts', :count => contact_count)

View file

@ -6,7 +6,7 @@
- content_for :head do - content_for :head do
= include_javascripts :home = include_javascripts :home
.span-24.last .span-22.last
%h3{:style => "position:relative;"} %h3{:style => "position:relative;"}
= current_user.name = current_user.name
.right{:style=>"top:0"} .right{:style=>"top:0"}

View file

@ -41,12 +41,12 @@
-unless @landing_page -unless @landing_page
%ul#aspect_nav %ul#aspect_nav
%li{:class => ("selected" if @aspect == :all)} %li{:class => ('selected' if @aspect == :all)}
= link_to t('_home'), root_path, :class => 'home_selector' = link_to t('_home'), root_path, :class => 'home_selector'
- for aspect in @all_aspects - for aspect in @all_aspects
%li{:data=>{:guid=>aspect.id}, :class => ("selected" if current_aspect?(aspect))} %li{:data=>{:guid=>aspect.id}, :class => ("selected" if current_aspect?(aspect))}
= link_to aspect.name, '#', :class => 'aspect_selector' = link_for_aspect(aspect, :class => 'aspect_selector')
= link_to '▼', edit_aspect_path(aspect), :class => 'aspect_selector_edit' = link_to '▼', edit_aspect_path(aspect), :class => 'aspect_selector_edit'
%li %li

View file

@ -4,9 +4,12 @@
:javascript :javascript
function createUploader(){ function createUploader(){
var aspectIds = "#{aspect_ids}".split(',');
var uploader = new qq.FileUploaderBasic({ var uploader = new qq.FileUploaderBasic({
element: document.getElementById('file-upload'), element: document.getElementById('file-upload'),
params: {'photo' : {'pending' : 'true', 'aspect_ids' : "#{aspect_ids}"}, 'set_profile_image' : "#{set_profile_image if defined?(set_profile_image)}"}, params: {'photo' : {'pending' : 'true', 'aspect_ids' : aspectIds}, 'set_profile_image' : "#{set_profile_image if defined?(set_profile_image)}"},
allowedExtensions: ['jpg', 'jpeg', 'png'], allowedExtensions: ['jpg', 'jpeg', 'png'],
action: "#{photos_path}", action: "#{photos_path}",
debug: true, debug: true,

View file

@ -53,5 +53,5 @@
= render 'shared/public_explain' = render 'shared/public_explain'
#publisher_photo_upload #publisher_photo_upload
= render 'photos/new_photo', :aspect_ids => @aspect_ids = render 'photos/new_photo', :aspect_ids => @aspect_ids.join(',')