DG DC; GREEEEEEEEEN

This commit is contained in:
danielgrippi 2012-05-17 17:01:22 -07:00
parent 973d6d9e8b
commit 27aff7fb1e
9 changed files with 94 additions and 68 deletions

View file

@ -55,6 +55,11 @@ var app = {
return !!(window.preloads && window.preloads[prop]) //returning boolean variable so that parsePreloads, which cleans up properly is used instead
},
setPreload : function(prop, val) {
window.preloads = window.preloads || {}
window.preloads[prop] = val
},
parsePreload : function(prop){
if(!app.hasPreload(prop)) { return }

View file

@ -46,7 +46,8 @@ app.models.Post.Interactions = Backbone.Model.extend({
},
userReshare : function(){
return this.reshares.select(function(reshare){ return reshare.get("author").guid == app.currentUser.get("guid")})[0]
return this.reshares.select(function(reshare){
return reshare.get("author") && reshare.get("author").guid == app.currentUser.get("guid")})[0]
},
toggleLike : function() {

View file

@ -41,7 +41,6 @@ app.pages.Framer = app.views.Base.extend({
defaultNavigation : function() {
var url = app.currentUser.expProfileUrl()
app.router.navigate(url, {trigger: true, replace: true})
//window.location = app.currentUser.expProfileUrl()
}
});

View file

@ -101,7 +101,7 @@ app.views.SmallFrame = app.views.Post.extend({
goToPost : function(evt) {
if(evt) { evt.stopImmediatePropagation(); }
window.preloads.post = this.model.attributes
app.setPreload('post',this.model.attributes)
app.router.navigate(this.model.url(), true)
}
});

View file

@ -28,7 +28,7 @@
<div class="background-color"></div>
{{/if}}
<div class="info">
<div class="info permalink">
{{#if root}}
{{#linkToPerson root.author}}
{{{personImage this}}

View file

@ -21,8 +21,8 @@ ActiveRecord::Schema.define(:version => 20120517014034) do
create_table "aspect_memberships", :force => true do |t|
t.integer "aspect_id", :null => false
t.integer "contact_id", :null => false
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "aspect_memberships", ["aspect_id", "contact_id"], :name => "index_aspect_memberships_on_aspect_id_and_contact_id", :unique => true
@ -32,8 +32,8 @@ ActiveRecord::Schema.define(:version => 20120517014034) do
create_table "aspect_visibilities", :force => true do |t|
t.integer "shareable_id", :null => false
t.integer "aspect_id", :null => false
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.datetime "created_at"
t.datetime "updated_at"
t.string "shareable_type", :default => "Post", :null => false
end
@ -44,8 +44,8 @@ ActiveRecord::Schema.define(:version => 20120517014034) do
create_table "aspects", :force => true do |t|
t.string "name", :null => false
t.integer "user_id", :null => false
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.datetime "created_at"
t.datetime "updated_at"
t.boolean "contacts_visible", :default => true, :null => false
t.integer "order_id"
end
@ -65,8 +65,8 @@ ActiveRecord::Schema.define(:version => 20120517014034) do
t.string "guid", :null => false
t.text "author_signature"
t.text "parent_author_signature"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.datetime "created_at"
t.datetime "updated_at"
t.integer "likes_count", :default => 0, :null => false
t.string "commentable_type", :limit => 60, :default => "Post", :null => false
end
@ -78,8 +78,8 @@ ActiveRecord::Schema.define(:version => 20120517014034) do
create_table "contacts", :force => true do |t|
t.integer "user_id", :null => false
t.integer "person_id", :null => false
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.datetime "created_at"
t.datetime "updated_at"
t.boolean "sharing", :default => false, :null => false
t.boolean "receiving", :default => false, :null => false
end
@ -91,8 +91,8 @@ ActiveRecord::Schema.define(:version => 20120517014034) do
t.integer "conversation_id", :null => false
t.integer "person_id", :null => false
t.integer "unread", :default => 0, :null => false
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "conversation_visibilities", ["conversation_id", "person_id"], :name => "index_conversation_visibilities_usefully", :unique => true
@ -103,16 +103,18 @@ ActiveRecord::Schema.define(:version => 20120517014034) do
t.string "subject"
t.string "guid", :null => false
t.integer "author_id", :null => false
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "conversations", ["author_id"], :name => "conversations_author_id_fk"
create_table "invitation_codes", :force => true do |t|
t.string "token"
t.integer "user_id"
t.integer "count"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "invitations", :force => true do |t|
@ -120,8 +122,8 @@ ActiveRecord::Schema.define(:version => 20120517014034) do
t.integer "sender_id"
t.integer "recipient_id"
t.integer "aspect_id"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.datetime "created_at"
t.datetime "updated_at"
t.string "service"
t.string "identifier"
t.boolean "admin", :default => false
@ -139,11 +141,12 @@ ActiveRecord::Schema.define(:version => 20120517014034) do
t.string "guid"
t.text "author_signature"
t.text "parent_author_signature"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.datetime "created_at"
t.datetime "updated_at"
t.string "target_type", :limit => 60, :null => false
end
add_index "likes", ["author_id"], :name => "likes_author_id_fk"
add_index "likes", ["guid"], :name => "index_likes_on_guid", :unique => true
add_index "likes", ["target_id", "author_id", "target_type"], :name => "index_likes_on_target_id_and_author_id_and_target_type", :unique => true
add_index "likes", ["target_id"], :name => "index_likes_on_post_id"
@ -162,19 +165,20 @@ ActiveRecord::Schema.define(:version => 20120517014034) do
t.integer "author_id", :null => false
t.string "guid", :null => false
t.text "text", :null => false
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.datetime "created_at"
t.datetime "updated_at"
t.text "author_signature"
t.text "parent_author_signature"
end
add_index "messages", ["author_id"], :name => "index_messages_on_author_id"
add_index "messages", ["conversation_id"], :name => "messages_conversation_id_fk"
create_table "notification_actors", :force => true do |t|
t.integer "notification_id"
t.integer "person_id"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "notification_actors", ["notification_id", "person_id"], :name => "index_notification_actors_on_notification_id_and_person_id", :unique => true
@ -186,8 +190,8 @@ ActiveRecord::Schema.define(:version => 20120517014034) do
t.integer "target_id"
t.integer "recipient_id", :null => false
t.boolean "unread", :default => true, :null => false
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.datetime "created_at"
t.datetime "updated_at"
t.string "type"
end
@ -200,7 +204,7 @@ ActiveRecord::Schema.define(:version => 20120517014034) do
t.text "data", :null => false
end
add_index "o_embed_caches", ["url"], :name => "index_o_embed_caches_on_url"
add_index "o_embed_caches", ["url"], :name => "index_o_embed_caches_on_url", :length => {"url"=>255}
create_table "participations", :force => true do |t|
t.string "guid"
@ -209,8 +213,8 @@ ActiveRecord::Schema.define(:version => 20120517014034) do
t.integer "author_id"
t.text "author_signature"
t.text "parent_author_signature"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "participations", ["guid"], :name => "index_participations_on_guid"
@ -222,8 +226,8 @@ ActiveRecord::Schema.define(:version => 20120517014034) do
t.string "diaspora_handle", :null => false
t.text "serialized_public_key", :null => false
t.integer "owner_id"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.datetime "created_at"
t.datetime "updated_at"
t.boolean "closed_account", :default => false
end
@ -257,8 +261,8 @@ ActiveRecord::Schema.define(:version => 20120517014034) do
create_table "pods", :force => true do |t|
t.string "host"
t.boolean "ssl"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "posts", :force => true do |t|
@ -273,8 +277,8 @@ ActiveRecord::Schema.define(:version => 20120517014034) do
t.string "remote_photo_name"
t.string "random_string"
t.string "processed_image"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.datetime "created_at"
t.datetime "updated_at"
t.string "unprocessed_image"
t.string "object_url"
t.string "image_url"
@ -315,8 +319,8 @@ ActiveRecord::Schema.define(:version => 20120517014034) do
t.text "bio"
t.boolean "searchable", :default => true, :null => false
t.integer "person_id", :null => false
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.datetime "created_at"
t.datetime "updated_at"
t.string "location"
t.string "full_name", :limit => 70
t.boolean "nsfw", :default => false
@ -334,8 +338,8 @@ ActiveRecord::Schema.define(:version => 20120517014034) do
t.string "table"
t.integer "month", :limit => 2
t.integer "year", :limit => 8
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "rails_admin_histories", ["item", "table", "month", "year"], :name => "index_rails_admin_histories"
@ -343,8 +347,8 @@ ActiveRecord::Schema.define(:version => 20120517014034) do
create_table "roles", :force => true do |t|
t.integer "person_id"
t.string "name"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "services", :force => true do |t|
@ -354,8 +358,8 @@ ActiveRecord::Schema.define(:version => 20120517014034) do
t.string "access_token"
t.string "access_secret"
t.string "nickname"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "services", ["type", "uid"], :name => "index_services_on_type_and_uid"
@ -363,8 +367,8 @@ ActiveRecord::Schema.define(:version => 20120517014034) do
create_table "share_visibilities", :force => true do |t|
t.integer "shareable_id", :null => false
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.datetime "created_at"
t.datetime "updated_at"
t.boolean "hidden", :default => false, :null => false
t.integer "contact_id", :null => false
t.string "shareable_type", :limit => 60, :default => "Post", :null => false
@ -378,8 +382,8 @@ ActiveRecord::Schema.define(:version => 20120517014034) do
create_table "tag_followings", :force => true do |t|
t.integer "tag_id", :null => false
t.integer "user_id", :null => false
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "tag_followings", ["tag_id", "user_id"], :name => "index_tag_followings_on_tag_id_and_user_id", :unique => true
@ -410,8 +414,8 @@ ActiveRecord::Schema.define(:version => 20120517014034) do
create_table "user_preferences", :force => true do |t|
t.string "email_type"
t.integer "user_id"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "users", :force => true do |t|
@ -432,8 +436,8 @@ ActiveRecord::Schema.define(:version => 20120517014034) do
t.datetime "last_sign_in_at"
t.string "current_sign_in_ip"
t.string "last_sign_in_ip"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.datetime "created_at"
t.datetime "updated_at"
t.string "invitation_service", :limit => 127
t.string "invitation_identifier", :limit => 127
t.integer "invitation_limit"

View file

@ -51,7 +51,8 @@ Scenario: Resharing an nsfw post
And I toggle nsfw posts
And I preemptively confirm the alert
And I follow "Reshare"
And I wait for 2 seconds
And I wait for the ajax to finish
And I go to the home page
Then I should have 2 nsfw posts
Then I should not see "Sexy Senators Gone Wild!"
And I should have 2 nsfw posts

View file

@ -22,11 +22,10 @@ end
def select_from_dropdown(option_text, dropdown)
dropdown.click
within ".dropdown-menu" do
link = find("input[value=['#{option_text}']")
link.should be_visible
link.click
label = find("label:contains('#{option_text}')")
label.should be_visible
label.click
end
#assert dropdown text is link
end
def go_to_framer
@ -115,7 +114,7 @@ Then /^"([^"]*)" should have (\d+) pictures$/ do |post_text, number_of_pictures|
end
Then /^I should see "([^"]*)" in the framer preview$/ do |post_text|
within(find(".post")) { page.should have_content(post_text) }
within(find(".canvas-frame")) { page.should have_content(post_text) }
end
When /^I select the mood "([^"]*)"$/ do |mood|
@ -132,11 +131,22 @@ When /^"([^"]*)" should be in the post's picture viewer$/ do |file_name|
end
end
When /^"([^"]*)" should be in the post's small frame$/ do |file_name|
within(".canvas-frame") do
find_image_by_filename(file_name).should be_present
end
end
Then /^it should be a wallpaper frame with the background "([^"]*)"$/ do |file_name|
assert_post_renders_with("Wallpaper")
find("div.photo-fill")["data-img-src"].should == get_image_filename(file_name)
end
Then /^it should be a wallpaper small frame with the background "([^"]*)"$/ do |file_name|
assert_post_renders_with("Wallpaper")
find("div.image-container img")["src"].should == get_image_filename(file_name)
end
When /^the frame's headline should be "([^"]*)"$/ do |header_text|
find("header").text.should == header_text
end
@ -149,8 +159,8 @@ Then /^the post should mention "([^"]*)"$/ do |user_name|
within('#post-content') { find("a:contains('#{user_name}')").should be_present }
end
When /^I click the "([^"]*)" post$/ do |post_text|
find(".content:contains('#{post_text}') .permalink").click
When /^I click into the "([^"]*)" post$/ do |post_text|
find("#canvas .content:contains('#{post_text}') .permalink").click
end
Then /^"([^"]*)" should be the first canvas frame$/ do |post_text|
@ -159,4 +169,4 @@ end
When /^I go back to the composer$/ do
click_button "Back"
end
end

View file

@ -49,12 +49,13 @@ Feature: Creating a new post
And I start the framing process
#defaults to the prettiest mood
Then the post's default mood should be "Wallpaper"
Then it should be a wallpaper frame with the background "button.gif"
Then it should be a wallpaper small frame with the background "button.gif"
Then I should see "This is hella customized" in the framer preview
When I select the mood "Newspaper"
Then the post's mood should be "Newspaper"
And "button.gif" should be in the post's picture viewer
And "button.gif" should be in the post's small frame
And I should see "This is hella customized" in the framer preview
And I go back to the composer
@ -66,7 +67,8 @@ Feature: Creating a new post
When I finalize my frame
#on stream
Then "It sure is a beautiful Day" should be the first canvas frame
When I click the "It sure is a beautiful Day" post
When I click into the "It sure is a beautiful Day" post
#on show page
And the post's mood should still be "Newspaper"
@ -75,6 +77,10 @@ Feature: Creating a new post
And I upload a fixture picture with filename "button.gif"
And I start the framing process
When I select the mood "Wallpaper"
Then it should be a wallpaper frame with the background "button.gif"
Then it should be a wallpaper small frame with the background "button.gif"
When I finalize my frame
And I click into the "This is a pithy status" post
And the frame's headline should be "This is a pithy status"
And the frame's body should be "And this is a long body"
Then it should be a wallpaper frame with the background "button.gif"