remove remember aspects feature
This commit is contained in:
parent
8841f62cf0
commit
de55a1cbb3
12 changed files with 17 additions and 110 deletions
|
|
@ -105,6 +105,6 @@ class ApplicationController < ActionController::Base
|
|||
end
|
||||
|
||||
def after_sign_in_path_for(resource)
|
||||
stored_location_for(:user) || aspects_path(:a_ids => current_user.aspects.where(:open => true).select(:id).all.map{|a| a.id})
|
||||
stored_location_for(:user) || aspects_path
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -6,11 +6,7 @@ class HomeController < ApplicationController
|
|||
|
||||
def show
|
||||
if current_user
|
||||
if params[:home]
|
||||
redirect_to :controller => 'aspects', :action => 'index'
|
||||
else
|
||||
redirect_to :controller => 'aspects', :action => 'index', :a_ids => current_user.aspects.where(:open => true).select(:id).all
|
||||
end
|
||||
redirect_to :controller => 'aspects', :action => 'index'
|
||||
elsif is_mobile_device?
|
||||
redirect_to user_session_path
|
||||
else
|
||||
|
|
|
|||
|
|
@ -48,11 +48,6 @@ class UsersController < ApplicationController
|
|||
else
|
||||
flash[:error] = I18n.t 'users.update.language_not_changed'
|
||||
end
|
||||
elsif u[:a_ids]
|
||||
@user.aspects.update_all(:open => false)
|
||||
unless u[:a_ids] == ["home"]
|
||||
@user.aspects.where(:id => u[:a_ids]).update_all(:open => true)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
10
db/migrate/20110603233202_drop_aspects_open.rb
Normal file
10
db/migrate/20110603233202_drop_aspects_open.rb
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
class DropAspectsOpen < ActiveRecord::Migration
|
||||
require 'db/migrate/20110202015222_add_open_to_aspects'
|
||||
def self.up
|
||||
AddOpenToAspects.down
|
||||
end
|
||||
|
||||
def self.down
|
||||
AddOpenToAspects.up
|
||||
end
|
||||
end
|
||||
|
|
@ -10,7 +10,7 @@
|
|||
#
|
||||
# It's strongly recommended to check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(:version => 20110603212633) do
|
||||
ActiveRecord::Schema.define(:version => 20110603233202) do
|
||||
|
||||
create_table "aspect_memberships", :force => true do |t|
|
||||
t.integer "aspect_id", :null => false
|
||||
|
|
@ -35,14 +35,13 @@ ActiveRecord::Schema.define(:version => 20110603212633) do
|
|||
add_index "aspect_visibilities", ["post_id"], :name => "index_aspect_visibilities_on_post_id"
|
||||
|
||||
create_table "aspects", :force => true do |t|
|
||||
t.string "name", :null => false
|
||||
t.integer "user_id", :null => false
|
||||
t.string "name", :null => false
|
||||
t.integer "user_id", :null => false
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.string "mongo_id"
|
||||
t.string "user_mongo_id"
|
||||
t.boolean "contacts_visible", :default => true, :null => false
|
||||
t.boolean "open", :default => false
|
||||
t.boolean "contacts_visible", :default => true, :null => false
|
||||
end
|
||||
|
||||
add_index "aspects", ["mongo_id"], :name => "index_aspects_on_mongo_id"
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@
|
|||
# Background:
|
||||
# Given a user with username "bob"
|
||||
# When I sign in as "bob@bob.bob"
|
||||
# And I have no open aspects saved
|
||||
# And I am on the home page
|
||||
#
|
||||
# Scenario: Youtube is fully embedded
|
||||
|
|
|
|||
|
|
@ -14,7 +14,6 @@ Feature: posting
|
|||
And I have user with username "alice" in an aspect called "PostTo"
|
||||
And I have user with username "alice" in an aspect called "DidntPostTo"
|
||||
|
||||
And I have no open aspects saved
|
||||
And I am on the home page
|
||||
|
||||
Scenario: post to all aspects
|
||||
|
|
|
|||
|
|
@ -1,46 +0,0 @@
|
|||
@javascript
|
||||
Feature: saved state
|
||||
|
||||
Background:
|
||||
Given I sign in
|
||||
And I have an aspect called "Closed 1"
|
||||
And I have an aspect called "Closed 2"
|
||||
|
||||
Scenario: open aspects persist across sessions
|
||||
Given I have an aspect called "Open 1"
|
||||
And I have an aspect called "Open 2"
|
||||
And I go to the aspects page
|
||||
|
||||
When I follow "Open 1"
|
||||
And I follow "Open 2"
|
||||
Then aspect "Open 1" should be selected
|
||||
And aspect "Open 2" should be selected
|
||||
But aspect "Closed 1" should not be selected
|
||||
And aspect "Closed 2" should not be selected
|
||||
|
||||
When I sign out
|
||||
And I sign in
|
||||
Then I should be on the aspects page
|
||||
And aspect "Open 1" should be selected
|
||||
And aspect "Open 2" should be selected
|
||||
But aspect "Closed 1" should not be selected
|
||||
And aspect "Closed 2" should not be selected
|
||||
|
||||
When I follow "All Aspects"
|
||||
Then aspect "All Aspects" should be selected
|
||||
|
||||
Scenario: home persists across sessions
|
||||
Given I am on the aspects page
|
||||
|
||||
When I follow "Closed 1"
|
||||
And I follow "All Aspects"
|
||||
Then aspect "All Aspects" should be selected
|
||||
But aspect "Closed 1" should not be selected
|
||||
And aspect "Closed 2" should not be selected
|
||||
|
||||
When I sign out
|
||||
And I sign in
|
||||
Then I should be on the aspects page
|
||||
And aspect "All Aspects" should be selected
|
||||
But aspect "Closed 1" should not be selected
|
||||
And aspect "Closed 2" should not be selected
|
||||
|
|
@ -109,10 +109,6 @@ When /^I click on the contact request$/ do
|
|||
find(".person.request.ui-draggable a").click
|
||||
end
|
||||
|
||||
Given /^I have no open aspects saved$/ do
|
||||
@me.aspects.update_all(:open => false)
|
||||
end
|
||||
|
||||
Then /^aspect "([^"]*)" should (not )?be selected$/ do |aspect_name, not_selected|
|
||||
link_is_selected = evaluate_script("$('a:contains(\"#{aspect_name}\")').parent('li').hasClass('selected');")
|
||||
expected_value = !not_selected
|
||||
|
|
|
|||
|
|
@ -10,10 +10,6 @@ var AspectFilters = {
|
|||
AspectFilters.initializeSelectedGUIDS();
|
||||
AspectFilters.interceptAspectLinks();
|
||||
AspectFilters.interceptAspectNavLinks();
|
||||
|
||||
if($("a.home_selector").parent().hasClass("selected")){
|
||||
AspectFilters.performAspectUpdate();
|
||||
}
|
||||
},
|
||||
initializeSelectedGUIDS: function(){
|
||||
$("#aspect_nav li").each(function(){
|
||||
|
|
@ -113,23 +109,6 @@ var AspectFilters = {
|
|||
}
|
||||
return baseURL;
|
||||
},
|
||||
performAspectUpdate: function(){
|
||||
// update the open aspects in the user
|
||||
updateURL = "/user";
|
||||
updateURL += '?';
|
||||
if(AspectFilters.selectedGUIDS.length === 0){
|
||||
updateURL += 'user[a_ids][]=home';
|
||||
} else {
|
||||
for(i=0; i < AspectFilters.selectedGUIDS.length; i++){
|
||||
updateURL += 'user[a_ids][]='+ AspectFilters.selectedGUIDS[i] +'&';
|
||||
}
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
url : updateURL,
|
||||
type: "PUT"
|
||||
});
|
||||
},
|
||||
performAjax: function(newURL) {
|
||||
var post = $("#publisher textarea").val(),
|
||||
photos = {};
|
||||
|
|
@ -177,7 +156,6 @@ var AspectFilters = {
|
|||
// fade contents back in
|
||||
if(AspectFilters.requests === 0){
|
||||
AspectFilters.fadeIn();
|
||||
AspectFilters.performAspectUpdate();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -23,10 +23,9 @@ describe HomeController do
|
|||
@aspect0 = alice.aspects.all[0]
|
||||
@aspect1 = alice.aspects.create(:name => "Yeaaaah!")
|
||||
@index_params = {:a_ids => [@aspect0.id.to_s, @aspect1.id.to_s]}
|
||||
alice.aspects.where(:id => @index_params[:a_ids]).update_all(:open => true)
|
||||
alice.save
|
||||
get :show
|
||||
response.should redirect_to( :controller => 'aspects', :action => 'index', :a_ids => @index_params[:a_ids] )
|
||||
response.should redirect_to( :controller => 'aspects', :action => 'index')
|
||||
end
|
||||
|
||||
describe "custom logging on success" do
|
||||
|
|
|
|||
|
|
@ -63,24 +63,6 @@ describe UsersController do
|
|||
response.status.should == 204
|
||||
end
|
||||
|
||||
context "open aspects" do
|
||||
before do
|
||||
@index_params = {:id => @user.id, :user => {:a_ids => [@aspect.id.to_s, @aspect1.id.to_s]} }
|
||||
end
|
||||
|
||||
it "stores the aspect params in the user" do
|
||||
put :update, @index_params
|
||||
@user.reload.aspects.where(:open => true).all.to_set.should == [@aspect, @aspect1].to_set
|
||||
end
|
||||
|
||||
it "correctly resets the home state" do
|
||||
@index_params[:user][:a_ids] = ["home"]
|
||||
|
||||
put :update, @index_params
|
||||
@user.aspects.where(:open => true).should == []
|
||||
end
|
||||
end
|
||||
|
||||
context 'password updates' do
|
||||
before do
|
||||
@password_params = {:current_password => 'bluepin7',
|
||||
|
|
|
|||
Loading…
Reference in a new issue