finish beta striping
A lot of cleanup is still needed, refactoring the CSS to be consistent, removing all sorts of unused stuff etc
This commit is contained in:
parent
ab0ad630df
commit
7ec2f8f419
12 changed files with 14 additions and 416 deletions
|
|
@ -1,59 +0,0 @@
|
|||
app.pages.Composer = app.views.Base.extend({
|
||||
templateName : "flow",
|
||||
|
||||
subviews : {
|
||||
".flow-content" : "postForm",
|
||||
".flow-controls .controls" : "composerControls"
|
||||
},
|
||||
|
||||
events : {
|
||||
"click .next" : "navigateNext"
|
||||
},
|
||||
|
||||
formAttrs : {
|
||||
"textarea#text_with_markup" : "text"
|
||||
},
|
||||
|
||||
initialize : function(){
|
||||
app.frame = this.model = this.model || new app.models.StatusMessage();
|
||||
|
||||
/* add class to make this smaller than the default framer */
|
||||
this.postForm = new app.forms.Post({model : this.model, className : "span4 offset1"});
|
||||
this.composerControls = new app.views.ComposerControls({model : this.model});
|
||||
},
|
||||
|
||||
unbind : function(){
|
||||
this.model.off()
|
||||
if(this.model.photos) {
|
||||
this.model.photos.off()
|
||||
}
|
||||
},
|
||||
|
||||
navigateNext : function(){
|
||||
var self = this,
|
||||
textArea = this.$("form textarea.text")
|
||||
|
||||
textArea.mentionsInput('val', function(markup){
|
||||
textArea.mentionsInput('getMentions', function(mentions){
|
||||
var overrides = {
|
||||
text : markup,
|
||||
mentioned_people : mentions
|
||||
}
|
||||
|
||||
self.setModelAttributes(overrides);
|
||||
app.router.navigate("framer", true);
|
||||
})
|
||||
});
|
||||
},
|
||||
|
||||
setModelAttributes : function(overrides){
|
||||
this.setFormAttrs()
|
||||
this.model.photos = this.postForm.pictureForm.photos
|
||||
this.model.set({"photos": this.model.photos.toJSON() })
|
||||
this.model.set(overrides)
|
||||
}
|
||||
});
|
||||
|
||||
app.views.ComposerControls = app.views.Base.extend({
|
||||
templateName : 'composer-controls'
|
||||
})
|
||||
|
|
@ -1,15 +1,11 @@
|
|||
app.Router = Backbone.Router.extend({
|
||||
routes: {
|
||||
//new hotness
|
||||
"stream?ex=true:params": 'newStream',
|
||||
"stream?ex=true": 'newStream',
|
||||
"people/:id?ex=true": "newProfile",
|
||||
"posts/new" : "composer",
|
||||
"posts/:id": "singlePost",
|
||||
"posts/:id/next": "siblingPost",
|
||||
"posts/:id/previous": "siblingPost",
|
||||
"p/:id": "singlePost",
|
||||
"framer": "framer",
|
||||
|
||||
//oldness
|
||||
"activity": "stream",
|
||||
|
|
@ -25,26 +21,14 @@ app.Router = Backbone.Router.extend({
|
|||
"tags/:name": "stream",
|
||||
"people/:id/photos": "photos",
|
||||
|
||||
"people/:id": "profile",
|
||||
"u/:name": "profile"
|
||||
},
|
||||
|
||||
newStream : function() {
|
||||
this.renderPage(function(){ return new app.pages.Stream()});
|
||||
},
|
||||
|
||||
newProfile : function(personId) {
|
||||
this.renderPage(function(){ return new app.pages.Profile({ personId : personId })});
|
||||
"people/:id": "stream",
|
||||
"u/:name": "stream"
|
||||
},
|
||||
|
||||
composer : function(){
|
||||
this.renderPage(function(){ return new app.pages.Composer()});
|
||||
},
|
||||
|
||||
framer : function(){
|
||||
this.renderPage(function(){ return new app.pages.Framer()});
|
||||
},
|
||||
|
||||
singlePost : function(id) {
|
||||
this.renderPage(function(){ return new app.pages.PostViewer({ id: id })});
|
||||
},
|
||||
|
|
@ -80,10 +64,6 @@ app.Router = Backbone.Router.extend({
|
|||
$('#selected_aspect_contacts .content').html(streamFacesView.render().el);
|
||||
},
|
||||
|
||||
profile : function(page) {
|
||||
this.stream()
|
||||
},
|
||||
|
||||
photos : function() {
|
||||
app.photos = new app.models.Stream([], {collection: app.collections.Photos});
|
||||
app.page = new app.views.Photos({model : app.photos});
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
/* Mixin file for sass. Here is where we define our variables and
|
||||
browser compatability functions used in all scss/sass files */
|
||||
@import 'new_styles/new_mixins';
|
||||
|
||||
/* Diapora's default color palate */
|
||||
$blue: #3f8fba;
|
||||
|
|
|
|||
|
|
@ -115,16 +115,8 @@ class PeopleController < ApplicationController
|
|||
|
||||
respond_to do |format|
|
||||
format.all do
|
||||
if params[:ex]
|
||||
@page = :experimental
|
||||
gon.person = PersonPresenter.new(@person, current_user)
|
||||
gon.stream = PostPresenter.collection_json(@stream.stream_posts, current_user)
|
||||
|
||||
render :nothing => true, :layout => 'post'
|
||||
else
|
||||
respond_with @person, :locals => {:post_type => :all}
|
||||
end
|
||||
end
|
||||
|
||||
format.json { render :json => @stream.stream_posts.map { |p| LastThreeCommentsDecorator.new(PostPresenter.new(p, current_user)) }}
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,7 +1,9 @@
|
|||
class RemoveWallpaperFromProfile < ActiveRecord::Migration
|
||||
def up
|
||||
remove_column :profiles, :wallpaper
|
||||
end
|
||||
|
||||
def down
|
||||
add_column :profiles, :wallpaper, :string
|
||||
end
|
||||
def down
|
||||
remove_column: profiles, :wallpaper
|
||||
end
|
||||
|
|
|
|||
|
|
@ -55,5 +55,6 @@ Scenario: Resharing an nsfw post
|
|||
And I wait for the ajax to finish
|
||||
And I go to the home page
|
||||
#if this is failing on travis throw a random wait in here :/
|
||||
And I wait for the ajax to finish
|
||||
Then I should not see "Sexy Senators Gone Wild!"
|
||||
And I should have 2 nsfw posts
|
||||
|
|
|
|||
|
|
@ -60,3 +60,7 @@ end
|
|||
When /^I post an extremely long status message$/ do
|
||||
click_and_post("I am a very interesting message " * 64)
|
||||
end
|
||||
|
||||
When /^I open the show page of the "([^"]*)" post$/ do |post_text|
|
||||
visit post_path_by_content(post_text)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,41 +0,0 @@
|
|||
describe("app.pages.Composer", function(){
|
||||
beforeEach(function(){
|
||||
this.page = new app.pages.Composer()
|
||||
})
|
||||
|
||||
describe("rendering", function(){
|
||||
beforeEach(function(){
|
||||
this.page.render();
|
||||
})
|
||||
|
||||
describe("clicking next", function(){
|
||||
beforeEach(function(){
|
||||
this.navigateSpy = spyOn(app.router, "navigate")
|
||||
})
|
||||
|
||||
it("navigates to the framer", function(){
|
||||
this.page.$("input.next").click()
|
||||
expect(this.navigateSpy).toHaveBeenCalledWith("framer", true)
|
||||
});
|
||||
|
||||
describe(" setting the model's attributes from the various form fields", function(){
|
||||
beforeEach(function(){
|
||||
this.page.$("form .text").val("Oh My")
|
||||
})
|
||||
|
||||
it("instantiates a post on form submit", function(){
|
||||
this.page.$("input.next").click()
|
||||
waitsFor(function(){ return this.navigateSpy.wasCalled })
|
||||
runs(function(){
|
||||
expect(this.page.model.get("text")).toBe("Oh My")
|
||||
})
|
||||
})
|
||||
});
|
||||
})
|
||||
})
|
||||
|
||||
it("stores a reference to the form as app.composer" , function(){
|
||||
expect(this.page.model).toBeDefined()
|
||||
expect(app.frame).toBe(this.page.model)
|
||||
});
|
||||
});
|
||||
|
|
@ -1,68 +0,0 @@
|
|||
describe("app.pages.Framer", function(){
|
||||
beforeEach(function(){
|
||||
loginAs(factory.user())
|
||||
app.frame = new factory.statusMessage({frame_name: undefined});
|
||||
|
||||
this.page = new app.pages.Framer();
|
||||
this.model = this.page.model
|
||||
expect(this.model).toBe(app.frame) //uses global state of app.frame :/
|
||||
});
|
||||
|
||||
describe("navigation on save", function(){
|
||||
it("navigates to the current user's profile page", function(){
|
||||
spyOn(app.router, "navigate")
|
||||
this.page.model.trigger("sync")
|
||||
expect(app.router.navigate).toHaveBeenCalled()
|
||||
})
|
||||
// want a spec here for the bookmarklet case
|
||||
})
|
||||
|
||||
describe("initialization", function(){
|
||||
it("calls setFrameName on the model when there is no frame_name", function(){
|
||||
spyOn(this.model, 'setFrameName')
|
||||
this.model.unset("frame_name")
|
||||
new app.pages.Framer()
|
||||
expect(this.model.setFrameName).toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it("sets the frame_name of the model to 'Vanilla' by default", function(){ //jasmine integration test, arguably unnecessary
|
||||
expect(this.model.get("frame_name")).toBe("Vanilla")
|
||||
})
|
||||
})
|
||||
|
||||
describe("rendering", function(){
|
||||
beforeEach(function(){
|
||||
this.page.render();
|
||||
});
|
||||
|
||||
it("saves the model when you click done", function(){
|
||||
spyOn(app.frame, "save");
|
||||
this.page.$("input.done").click();
|
||||
expect(app.frame.save).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
describe("setting the model's attributes from the various form fields", function(){
|
||||
beforeEach(function(){
|
||||
this.page.$("input.mood").attr("checked", false) //radio button hax
|
||||
expect(app.frame.get("frame_name")).not.toBe("Typist")
|
||||
this.page.$("input.aspect_ids").val("public")
|
||||
this.page.$("input[value='Typist']").attr("checked", "checked")
|
||||
this.page.$("input.services[value=facebook]").attr("checked", "checked")
|
||||
this.page.$("input.services[value=twitter]").attr("checked", "checked")
|
||||
})
|
||||
|
||||
it("instantiates a post on form submit", function(){
|
||||
this.page.$("input").trigger("change") //runs setFormAttrs
|
||||
waitsFor(function(){
|
||||
return this.page.model.get("frame_name") == "Typist"
|
||||
})
|
||||
|
||||
runs(function(){
|
||||
expect(this.page.model.get("aspect_ids")).toEqual(["public"])
|
||||
expect(this.page.model.get("services")).toEqual(["facebook", "twitter"])
|
||||
expect(this.page.model.get("frame_name")).toBe("Typist")
|
||||
})
|
||||
})
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
@ -1,167 +0,0 @@
|
|||
describe("app.pages.Profile", function(){
|
||||
beforeEach(function(){
|
||||
this.guid = 'abcdefg123'
|
||||
this.profile = factory.profile({personId: this.guid})
|
||||
this.profile.deferred = new $.Deferred()
|
||||
spyOn(app.collections.Posts.prototype, "fetch").andReturn(new $.Deferred)
|
||||
app.page = this.page = new app.pages.Profile({model : this.profile });
|
||||
this.stream = this.page.stream
|
||||
this.profile.deferred.resolve()
|
||||
});
|
||||
|
||||
it("fetches the profile of the user with the params from the router and assigns it as the model", function(){
|
||||
var profile = new factory.profile()
|
||||
profile.deferred = $.Deferred()
|
||||
spyOn(app.models.Profile, 'findByGuid').andReturn(profile)
|
||||
var page = new app.pages.Profile({personId : 'jarjabinkisthebest' })
|
||||
expect(app.models.Profile.findByGuid).toHaveBeenCalledWith('jarjabinkisthebest')
|
||||
expect(page.model).toBe(profile)
|
||||
})
|
||||
|
||||
it("passes the stream down to the canvas view", function(){
|
||||
expect(this.page.canvasView.model).toBeDefined()
|
||||
expect(this.page.canvasView.model).toBe(this.stream)
|
||||
});
|
||||
|
||||
it("preloads the stream for the user", function(){
|
||||
spyOn(this.stream, "preload")
|
||||
|
||||
window.preloads = {stream : JSON.stringify(["unicorns"]) }
|
||||
|
||||
new app.pages.Profile({stream : this.stream})
|
||||
expect(this.stream.preload).toHaveBeenCalled()
|
||||
|
||||
delete window.preloads //cleanup
|
||||
})
|
||||
|
||||
describe("rendering", function(){
|
||||
context("with no posts", function(){
|
||||
beforeEach(function(){
|
||||
this.profile.set({"name" : "Alice Waters", person_id : "889"})
|
||||
this.stream.deferred.resolve()
|
||||
})
|
||||
|
||||
it("has a message that there are no posts", function(){
|
||||
this.page.render()
|
||||
expect(this.page.$("#canvas").text()).toBe("Alice Waters hasn't posted anything yet.")
|
||||
})
|
||||
|
||||
it("tells you to post something if it's your profile", function(){
|
||||
this.profile.set({is_own_profile : true})
|
||||
this.page.render()
|
||||
expect(this.page.$("#canvas").text()).toBe("Make something to start the magic.")
|
||||
})
|
||||
})
|
||||
|
||||
context("with a post", function(){
|
||||
beforeEach(function(){
|
||||
this.post = factory.post()
|
||||
this.stream.add(this.post)
|
||||
this.stream.deferred.resolve()
|
||||
this.page.toggleEdit()
|
||||
expect(this.page.editMode).toBeTruthy()
|
||||
this.page.render()
|
||||
});
|
||||
|
||||
context("profile control pane", function(){
|
||||
it("shows the edit and create buttons if it's your profile", function() {
|
||||
this.page.model.set({is_own_profile : true})
|
||||
this.page.render()
|
||||
expect(this.page.$("#profile-controls .control").length).toBe(2)
|
||||
})
|
||||
})
|
||||
|
||||
context("clicking fav", function(){
|
||||
beforeEach(function(){
|
||||
spyOn(this.post, 'toggleFavorite')
|
||||
spyOn($.fn, "isotope")
|
||||
this.page.$(".content").click()
|
||||
})
|
||||
|
||||
it("relayouts the page", function(){
|
||||
expect($.fn.isotope).toHaveBeenCalledWith("reLayout")
|
||||
})
|
||||
|
||||
it("toggles the favorite status on the model", function(){
|
||||
expect(this.post.toggleFavorite).toHaveBeenCalled()
|
||||
})
|
||||
})
|
||||
|
||||
context("clicking delete", function(){
|
||||
beforeEach(function () {
|
||||
spyOn(window, "confirm").andReturn(true);
|
||||
this.page.render()
|
||||
})
|
||||
|
||||
it("kills the model", function(){
|
||||
spyOn(this.post, "destroy")
|
||||
this.page.$(".canvas-frame:first a.delete").click()
|
||||
expect(this.post.destroy).toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it("removes the frame", function(){
|
||||
spyOn($.fn, "remove").andCallThrough()
|
||||
expect(this.page.$(".canvas-frame").length).toBe(1)
|
||||
this.page.$(".canvas-frame:first a.delete").click()
|
||||
waitsFor(function(){ return $.fn.remove.wasCalled })
|
||||
runs(function(){ expect(this.page.$(".canvas-frame").length).toBe(0) })
|
||||
})
|
||||
})
|
||||
})
|
||||
});
|
||||
|
||||
describe("edit mode", function(){
|
||||
describe("toggle edit", function(){
|
||||
it("changes the page's global edit state", function(){
|
||||
expect(this.page.editMode).toBeFalsy()
|
||||
this.page.toggleEdit()
|
||||
expect(this.page.editMode).toBeTruthy()
|
||||
})
|
||||
|
||||
it("changes the page's class to 'edit-mode'", function(){
|
||||
expect(this.page.$el).not.toHaveClass('edit-mode')
|
||||
this.page.toggleEdit()
|
||||
expect(this.page.$el).toHaveClass('edit-mode')
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe("composing", function(){
|
||||
beforeEach(function(){
|
||||
this.page.model.set({is_own_profile : true})
|
||||
this.page.render()
|
||||
|
||||
/* stub navigation changes */
|
||||
spyOn(app.router, "navigate")
|
||||
})
|
||||
|
||||
describe("invoking the interaction", function(){
|
||||
it("shows the publisher and disables the body from scrolling", function(){
|
||||
expect(this.page.$("#composer")).toHaveClass('hidden')
|
||||
this.page.$("#composer-button").click()
|
||||
expect(this.page.$("#composer")).not.toHaveClass('hidden')
|
||||
expect($("body")).toHaveClass('lock')
|
||||
})
|
||||
|
||||
it("changes the URL", function(){
|
||||
this.page.$("#composer-button").click()
|
||||
expect(app.router.navigate).toHaveBeenCalled()
|
||||
})
|
||||
})
|
||||
|
||||
describe("revoking the interaction", function(){
|
||||
beforeEach(function(){
|
||||
/* invoke the composer */
|
||||
this.page.$("#composer-button").click()
|
||||
|
||||
this.evt = Event
|
||||
this.evt.keyCode = 28
|
||||
})
|
||||
|
||||
it("changes the URL", function(){
|
||||
$(window).trigger("keydown", this.evt)
|
||||
expect(app.router.navigate).toHaveBeenCalled()
|
||||
})
|
||||
})
|
||||
});
|
||||
});
|
||||
|
|
@ -6,13 +6,6 @@ describe("app.Pages.Stream", function(){
|
|||
expect(this.post).toBeTruthy()
|
||||
})
|
||||
|
||||
describe('postRenderTemplate', function(){
|
||||
it("sets the background-image of #header", function(){
|
||||
this.page.render()
|
||||
expect(this.page.$('#header').css('background-image')).toBeTruthy()
|
||||
})
|
||||
})
|
||||
|
||||
describe("rendering", function(){
|
||||
beforeEach(function(){
|
||||
this.page.render()
|
||||
|
|
@ -30,7 +23,7 @@ describe("app.Pages.Stream", function(){
|
|||
context("when more posts are loaded", function(){
|
||||
it("navigates to the last post in the stream's max_time", function(){
|
||||
spyOn(app.router, 'navigate')
|
||||
var url = location.pathname + "?ex=true&max_time=" + this.post.createdAt()
|
||||
var url = location.pathname + "?max_time=" + this.post.createdAt()
|
||||
, options = {replace: true}
|
||||
|
||||
this.page.streamView.trigger('loadMore')
|
||||
|
|
|
|||
|
|
@ -1,38 +0,0 @@
|
|||
describe("app.views.framerControls", function(){
|
||||
beforeEach(function(){
|
||||
loginAs(factory.user())
|
||||
this.post = new factory.statusMessage({frame_name: undefined});
|
||||
this.view = new app.views.framerControls({model : this.post})
|
||||
})
|
||||
|
||||
describe("rendering", function(){
|
||||
beforeEach(function(){
|
||||
this.view.render();
|
||||
});
|
||||
|
||||
it("disables the buttons when you click the X", function(){
|
||||
this.view.$("input.done").click();
|
||||
expect(this.view.$('input').prop('disabled')).toBeTruthy();
|
||||
});
|
||||
|
||||
it("does not disable the frame if it is invaild", function(){
|
||||
spyOn(this.view, 'inValidFrame').andReturn(true)
|
||||
this.view.$("input.done").click();
|
||||
expect(this.view.$('input').prop('disabled')).toBeFalsy();
|
||||
});
|
||||
|
||||
it("does not disable the frame if it is invaild", function(){
|
||||
spyOn(this.view.model, 'save')
|
||||
spyOn(this.view, 'inValidFrame').andReturn(true)
|
||||
this.view.$("input.done").click();
|
||||
expect(this.view.model.save).not.toHaveBeenCalled()
|
||||
});
|
||||
})
|
||||
|
||||
describe("inValidFrame", function(){
|
||||
it("is invalid if the frame has no text or photos", function(){
|
||||
this.view.model = new factory.statusMessage({text: '', photos : []})
|
||||
expect(this.view.inValidFrame).toBeTruthy();
|
||||
})
|
||||
});
|
||||
});
|
||||
Loading…
Reference in a new issue