Skip to content
Extraits de code Groupes Projets
Valider b71f380f rédigé par Helge Rausch's avatar Helge Rausch
Parcourir les fichiers

Merge branch 'master' into debugger

Conflicts:
	Gemfile.lock
parents 7b3d921a 93afe6d6
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
Affichage de
avec 218 ajouts et 121 suppressions
...@@ -29,6 +29,7 @@ gem 'rails_admin' ...@@ -29,6 +29,7 @@ gem 'rails_admin'
# mail # mail
gem 'markerb', '~> 1.0.0'
gem 'messagebus_ruby_api', '1.0.3' gem 'messagebus_ruby_api', '1.0.3'
gem 'airbrake' gem 'airbrake'
gem 'newrelic_rpm' gem 'newrelic_rpm'
...@@ -44,7 +45,7 @@ end ...@@ -44,7 +45,7 @@ end
group :heroku do group :heroku do
gem 'pg' gem 'pg'
gem 'unicorn', '~> 4.2.0', :require => false gem 'unicorn', '~> 4.3.0', :require => false
end end
gem 'settingslogic', :git => 'git://github.com/binarylogic/settingslogic.git' gem 'settingslogic', :git => 'git://github.com/binarylogic/settingslogic.git'
...@@ -116,12 +117,12 @@ group :assets do ...@@ -116,12 +117,12 @@ group :assets do
# install Node.js or use 'therubyracer'. # install Node.js or use 'therubyracer'.
# #
# See https://github.com/sstephenson/execjs#readme for more supported runtimes # See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', :platform => :ruby # gem 'therubyracer', :platform => :ruby
gem 'handlebars_assets' gem 'handlebars_assets'
gem 'uglifier' gem 'uglifier'
# asset_sync is required as needed by application.rb # asset_sync is required as needed by application.rb
gem "asset_sync", :require => nil gem "asset_sync", :require => nil
end end
...@@ -156,7 +157,7 @@ group :test do ...@@ -156,7 +157,7 @@ group :test do
gem 'rspec-core', '~> 2.9.0' gem 'rspec-core', '~> 2.9.0'
gem 'rspec-instafail', '>= 0.1.7', :require => false gem 'rspec-instafail', '>= 0.1.7', :require => false
gem "rspec-rails", "~> 2.9.0" gem "rspec-rails", "~> 2.9.0"
gem 'selenium-webdriver' gem 'selenium-webdriver', '2.22.0.rc1'
gem 'webmock', :require => false gem 'webmock', :require => false
gem 'sqlite3' gem 'sqlite3'
......
...@@ -110,7 +110,7 @@ GEM ...@@ -110,7 +110,7 @@ GEM
carrierwave (0.5.8) carrierwave (0.5.8)
activesupport (~> 3.0) activesupport (~> 3.0)
cgi_multipart_eof_fix (2.5.0) cgi_multipart_eof_fix (2.5.0)
childprocess (0.3.1) childprocess (0.3.2)
ffi (~> 1.0.6) ffi (~> 1.0.6)
chronic (0.6.7) chronic (0.6.7)
client_side_validations (3.1.4) client_side_validations (3.1.4)
...@@ -259,12 +259,16 @@ GEM ...@@ -259,12 +259,16 @@ GEM
railties (>= 3.0.0) railties (>= 3.0.0)
kgio (2.7.4) kgio (2.7.4)
launchy (2.0.3) launchy (2.0.3)
libwebsocket (0.1.3)
addressable
linecache (0.46) linecache (0.46)
rbx-require-relative (> 0.0.4) rbx-require-relative (> 0.0.4)
mail (2.3.3) mail (2.3.3)
i18n (>= 0.4.0) i18n (>= 0.4.0)
mime-types (~> 1.16) mime-types (~> 1.16)
treetop (~> 1.4.8) treetop (~> 1.4.8)
markerb (1.0.0)
redcarpet (>= 2.0)
messagebus_ruby_api (1.0.3) messagebus_ruby_api (1.0.3)
mime-types (1.18) mime-types (1.18)
mini_magick (3.4) mini_magick (3.4)
...@@ -414,7 +418,9 @@ GEM ...@@ -414,7 +418,9 @@ GEM
ruby-hmac (0.4.0) ruby-hmac (0.4.0)
ruby-oembed (0.8.7) ruby-oembed (0.8.7)
ruby-progressbar (0.0.10) ruby-progressbar (0.0.10)
rubyzip (0.9.7) ruby_core_source (0.1.5)
archive-tar-minitar (>= 0.5.2)
rubyzip (0.9.8)
sass (3.1.15) sass (3.1.15)
sass-rails (3.1.4) sass-rails (3.1.4)
actionpack (~> 3.1.0) actionpack (~> 3.1.0)
...@@ -422,10 +428,11 @@ GEM ...@@ -422,10 +428,11 @@ GEM
sass (>= 3.1.4) sass (>= 3.1.4)
sprockets (~> 2.0.0) sprockets (~> 2.0.0)
tilt (~> 1.3.2) tilt (~> 1.3.2)
selenium-webdriver (2.19.0) selenium-webdriver (2.22.0.rc1)
childprocess (>= 0.2.5) childprocess (>= 0.2.5)
ffi (~> 1.0.9) ffi (~> 1.0)
multi_json (~> 1.0.4) libwebsocket (~> 0.1.3)
multi_json (~> 1.0)
rubyzip rubyzip
simple_oauth (0.1.5) simple_oauth (0.1.5)
sinatra (1.3.2) sinatra (1.3.2)
...@@ -461,7 +468,7 @@ GEM ...@@ -461,7 +468,7 @@ GEM
uglifier (1.2.4) uglifier (1.2.4)
execjs (>= 0.3.0) execjs (>= 0.3.0)
multi_json (>= 1.0.2) multi_json (>= 1.0.2)
unicorn (4.2.1) unicorn (4.3.1)
kgio (~> 2.6) kgio (~> 2.6)
rack rack
raindrops (~> 0.7) raindrops (~> 0.7)
...@@ -530,6 +537,7 @@ DEPENDENCIES ...@@ -530,6 +537,7 @@ DEPENDENCIES
json json
jwt jwt
linecache (= 0.46) linecache (= 0.46)
markerb (~> 1.0.0)
messagebus_ruby_api (= 1.0.3) messagebus_ruby_api (= 1.0.3)
mini_magick (= 3.4) mini_magick (= 3.4)
mobile-fu mobile-fu
...@@ -567,7 +575,7 @@ DEPENDENCIES ...@@ -567,7 +575,7 @@ DEPENDENCIES
rspec-rails (~> 2.9.0) rspec-rails (~> 2.9.0)
ruby-oembed (~> 0.8.7) ruby-oembed (~> 0.8.7)
sass-rails (= 3.1.4) sass-rails (= 3.1.4)
selenium-webdriver selenium-webdriver (= 2.22.0.rc1)
settingslogic! settingslogic!
spork (~> 1.0rc2) spork (~> 1.0rc2)
sqlite3 sqlite3
...@@ -576,7 +584,7 @@ DEPENDENCIES ...@@ -576,7 +584,7 @@ DEPENDENCIES
twitter (= 2.0.2) twitter (= 2.0.2)
typhoeus typhoeus
uglifier uglifier
unicorn (~> 4.2.0) unicorn (~> 4.3.0)
webmock webmock
whenever whenever
will_paginate will_paginate
......
## Welcome to the Diaspora Project! Diaspora*
Diaspora is a privacy-aware, personally-controlled, do-it-all open source social network. Check out our [project site](http://diasporaproject.org). Diaspora is a privacy-aware, personally-controlled, do-it-all open source social network. Check out our [project site](http://diasporaproject.org).
...@@ -12,41 +12,47 @@ If you want to do something big, reach out on IRC or the mailing list first, so ...@@ -12,41 +12,47 @@ If you want to do something big, reach out on IRC or the mailing list first, so
With Diaspora you can: With Diaspora you can:
- Run and host your own pod and have control over your own social experience. - Make cool stuff
- Own your own data. - Share it across the web
- Make friends across other pods seamlessly. - Own your own data
Documentation is available on our [wiki](https://github.com/diaspora/diaspora/wiki)
[Pull Request Guidelines](https://github.com/diaspora/diaspora/wiki/Pull-Request-Guidelines)
Before submitting code, feel free to sign our [Contributor License Agreement](https://github.com/diaspora/diaspora/wiki/New-CLA--12-13-10) [Sign Here](https://spreadsheets.google.com/a/joindiaspora.com/spreadsheet/viewform?formkey=dFdRTnY0TGtfaklKQXZNUndsMlJ2eGc6MQ)
## Quick Start: ## Quick Start:
Here's how you can get a development environment up and running. You can check out system-specific guides [here](https://github.com/diaspora/diaspora/wiki/Installation-Guides). Here's how you can get a **[development](http://guides.rubyonrails.org/getting_started.html)** environment up and running. This is where any new pod runner should start, as well as people
looking to contribute to D*. This script assumes you have [a basic Rails setup installed](http://railsapps.github.com/installing-rails-3-1.html).
### Step 1: Download the script ### Step 1: Run the script and follow the on screen instructions.
``` ```
curl https://raw.github.com/diaspora/diaspora/master/script/install.sh | /bin/sh curl https://raw.github.com/diaspora/diaspora/master/script/install.sh | /bin/sh
``` ```
### Step 2: Follow the instructions
### Step 2: Run the the development server
### Step 3: Run the the development server
``` ```
rails s rails s
``` ```
then visit 'http://localhost:3000' in your browser. then visit 'http://localhost:3000' in your browser.
### Step 4: Run tests ### Step 3 (for developers): Run tests
``` ```
rake rake
``` ```
## Resources: ### Want a production setup? Having trouble with install script? Want to install D* the slow way?
Look to more specific install guides [here](https://github.com/diaspora/diaspora/wiki/Installation-Guides).
## Contributing
We love community contributions, and we work extra hard to make sure every code contribution is looked at and given feedback.
To help everyone involved, please review our [Pull Request Guidelines](https://github.com/diaspora/diaspora/wiki/Pull-Request-Guidelines)
to make sure all contributions are submitted smoothly.
Documentation is available on our [wiki](https://github.com/diaspora/diaspora/wiki)
Before submitting code, please sign our [Contributor License Agreement](https://github.com/diaspora/diaspora/wiki/New-CLA--12-13-10) [Sign Here](https://spreadsheets.google.com/a/joindiaspora.com/spreadsheet/viewform?formkey=dFdRTnY0TGtfaklKQXZNUndsMlJ2eGc6MQ)
## More Resources:
- [Wiki](https://github.com/diaspora/diaspora/wiki) - [Wiki](https://github.com/diaspora/diaspora/wiki)
- [Podmin Resources](https://github.com/diaspora/diaspora/wiki/Podmin-Resources) - [Podmin Resources](https://github.com/diaspora/diaspora/wiki/Podmin-Resources)
......
app/assets/images/buttons/bday@2x-white.png

1,21 ko

app/assets/images/buttons/service-icons/fb@2x-white.png

1,08 ko

app/assets/images/buttons/service-icons/tumblr@2x-white.png

1,16 ko

app/assets/images/buttons/service-icons/twitter@2x-white.png

1,2 ko

...@@ -42,7 +42,7 @@ var app = { ...@@ -42,7 +42,7 @@ var app = {
Backbone.history.start({pushState: true}); Backbone.history.start({pushState: true});
// there's probably a better way to do this... // there's probably a better way to do this...
$("a[rel=backbone]").bind("click", function(evt){ $("a[rel=backbone]").live("click", function(evt){
evt.preventDefault(); evt.preventDefault();
var link = $(this); var link = $(this);
......
app.forms.Picture = app.views.Base.extend({ app.forms.PictureBase = app.views.Base.extend({
templateName : "picture-form",
events : { events : {
'ajax:complete .new_photo' : "photoUploaded", 'ajax:complete .new_photo' : "photoUploaded",
"change input[name='photo[user_file]']" : "submitForm" "change input[name='photo[user_file]']" : "submitForm"
}, },
initialize : function() { onSubmit : $.noop,
this.photos = new Backbone.Collection() uploadSuccess : $.noop,
this.photos.bind("add", this.render, this)
},
postRenderTemplate : function(){ postRenderTemplate : function(){
this.$("input[name=authenticity_token]").val($("meta[name=csrf-token]").attr("content")) this.$("input[name=authenticity_token]").val($("meta[name=csrf-token]").attr("content"))
this.$("input[name=photo_ids]").val(this.photos.pluck("id"))
this.renderPhotos();
}, },
submitForm : function (){ submitForm : function (){
this.$("form").submit(); this.$("form").submit();
this.$(".photos").append($('<span class="loader" style="margin-left: 80px;"></span>')) this.onSubmit();
}, },
photoUploaded : function(evt, xhr) { photoUploaded : function(evt, xhr) {
resp = JSON.parse(xhr.responseText) resp = JSON.parse(xhr.responseText)
if(resp.success) { if(resp.success) {
this.photos.add(new Backbone.Model(resp.data)) this.uploadSuccess(resp)
} else { } else {
alert("Upload failed! Please try again. " + resp.error); alert("Upload failed! Please try again. " + resp.error);
} }
}
});
/* multi photo uploader */
app.forms.Picture = app.forms.PictureBase.extend({
templateName : "picture-form",
initialize : function() {
this.photos = new Backbone.Collection()
this.photos.bind("add", this.render, this)
},
postRenderTemplate : function(){
this.$("input[name=authenticity_token]").val($("meta[name=csrf-token]").attr("content"))
this.$("input[name=photo_ids]").val(this.photos.pluck("id"))
this.renderPhotos();
},
onSubmit : function (){
this.$(".photos").append($('<span class="loader" style="margin-left: 80px;"></span>'))
},
uploadSuccess : function(resp) {
this.photos.add(new Backbone.Model(resp.data))
}, },
renderPhotos : function(){ renderPhotos : function(){
...@@ -38,4 +56,13 @@ app.forms.Picture = app.views.Base.extend({ ...@@ -38,4 +56,13 @@ app.forms.Picture = app.views.Base.extend({
photoContainer.append(photoView) photoContainer.append(photoView)
}) })
} }
});
/* wallpaper uploader */
app.forms.Wallpaper = app.forms.PictureBase.extend({
templateName : "wallpaper-form",
uploadSuccess : function(resp) {
$("#profile").css("background-image", "url(" + resp.data.wallpaper + ")")
}
}); });
\ No newline at end of file
...@@ -2,6 +2,14 @@ app.models.Profile = Backbone.Model.extend({ ...@@ -2,6 +2,14 @@ app.models.Profile = Backbone.Model.extend({
urlRoot : "/profiles" urlRoot : "/profiles"
}, { }, {
preloadOrFetch : function(id){
if(app.hasPreload("person")) {
return new app.models.Profile(app.parsePreload("person"))
} else {
return this.findByGuid(id)
}
},
findByGuid : function(personId){ findByGuid : function(personId){
var person = new app.models.Profile({ id : personId}) var person = new app.models.Profile({ id : personId})
person.fetch() person.fetch()
......
...@@ -11,5 +11,9 @@ app.models.User = Backbone.Model.extend({ ...@@ -11,5 +11,9 @@ app.models.User = Backbone.Model.extend({
expProfileUrl : function(){ expProfileUrl : function(){
return "/people/" + app.currentUser.get("guid") + "?ex=true" return "/people/" + app.currentUser.get("guid") + "?ex=true"
},
isServiceConfigured : function(providerName) {
return _.include(this.get("configured_services"), providerName)
} }
}); });
...@@ -59,5 +59,5 @@ app.views.framerControls = app.views.Base.extend({ ...@@ -59,5 +59,5 @@ app.views.framerControls = app.views.Base.extend({
//crazy hack for model publisher. //crazy hack for model publisher.
function closeIFrame(){ function closeIFrame(){
location.reload() location = "/people/" + app.currentUser.get("guid")
}; };
\ No newline at end of file
...@@ -5,18 +5,13 @@ app.pages.PostViewer = app.views.Base.extend({ ...@@ -5,18 +5,13 @@ app.pages.PostViewer = app.views.Base.extend({
"#post-content" : "postView", "#post-content" : "postView",
"#post-nav" : "navView", "#post-nav" : "navView",
"#post-interactions" : "interactionsView", "#post-interactions" : "interactionsView",
"#header-container" : "authorView" "#author-info" : "authorView"
}, },
initialize : function(options) { initialize : function(options) {
this.model = new app.models.Post({ id : options.id }); this.model = new app.models.Post({ id : options.id });
this.model.preloadOrFetch().done(_.bind(this.initViews, this)); this.model.preloadOrFetch().done(_.bind(this.initViews, this));
this.bindEvents()
this.prepIdleHooks();
$(document).bind("keypress", _.bind(this.commentAnywhere, this))
$(document).bind("keypress", _.bind(this.invokePane, this))
$(document).bind("keyup", _.bind(this.closePane, this))
}, },
initViews : function() { initViews : function() {
...@@ -29,6 +24,23 @@ app.pages.PostViewer = app.views.Base.extend({ ...@@ -29,6 +24,23 @@ app.pages.PostViewer = app.views.Base.extend({
this.render(); this.render();
}, },
bindEvents : function(){
this.prepIdleHooks();
this.bindNavHooks();
$(document).bind("keypress", _.bind(this.commentAnywhere, this))
$(document).bind("keypress", _.bind(this.invokePane, this))
$(document).bind("keyup", _.bind(this.closePane, this))
},
unbind : function(){
$(document).unbind("idle.idleTimer")
$(document).unbind("active.idleTimer")
$(document).unbind('keydown')
$(document).unbind('keypress')
$(document).unbind('keyup')
},
prepIdleHooks : function () { prepIdleHooks : function () {
$.idleTimer(3000); $.idleTimer(3000);
...@@ -41,38 +53,25 @@ app.pages.PostViewer = app.views.Base.extend({ ...@@ -41,38 +53,25 @@ app.pages.PostViewer = app.views.Base.extend({
}); });
}, },
postRenderTemplate : function() {
/* set the document title, if it has one */
if(this.model.get("title")){
document.title = this.model.get("title");
}
this.bindNavHooks();
},
bindNavHooks : function() { bindNavHooks : function() {
/* navagation hooks */ var model = this.model;
var nextPostLocation = this.model.get("next_post");
var previousPostLocation = this.model.get("previous_post");
$(document).keydown(function(evt){ $(document).keydown(function(evt){
/* prevent nav from happening if the user is using the arrow // prevent nav from happening if the user is using the arrow keys to navigate through their comment text
* keys to navigate through their comment text */
if($(evt.target).is("textarea")) { return } if($(evt.target).is("textarea")) { return }
switch(evt.keyCode) { switch(evt.keyCode) {
case 37: case 37:
navigate(nextPostLocation); break; app.router.navigate(model.get("next_post"), true); break;
case 39: case 39:
navigate(previousPostLocation); break; app.router.navigate(model.get("previous_post"), true); break;
default: default:
break; break;
} }
}) })
},
function navigate(loc) { postRenderTemplate : function() {
loc ? window.location = loc : null if(this.model.get("title")){ document.title = this.model.get("title"); }
}
}, },
commentAnywhere : function(evt) { commentAnywhere : function(evt) {
......
...@@ -2,13 +2,13 @@ ...@@ -2,13 +2,13 @@
//= require ../views/profile_info_view //= require ../views/profile_info_view
app.pages.Profile = app.views.Base.extend({ app.pages.Profile = app.views.Base.extend({
className : "container",
templateName : "profile", templateName : "profile",
id : "profile",
subviews : { subviews : {
"#profile-info" : "profileInfo", "#profile-info" : "profileInfo",
"#canvas" : "canvasView" "#canvas" : "canvasView",
"#wallpaper-upload" : "wallpaperForm"
}, },
events : { events : {
...@@ -21,23 +21,13 @@ app.pages.Profile = app.views.Base.extend({ ...@@ -21,23 +21,13 @@ app.pages.Profile = app.views.Base.extend({
personGUID : null, personGUID : null,
editMode : false, editMode : false,
presenter : function(){
var bio = this.model.get("bio") || ''
return _.extend(this.defaultPresenter(),
{text : this.model && app.helpers.textFormatter(bio, this.model),
isOwnProfile : this.isOwnProfile(),
showFollowButton : this.showFollowButton()
})
},
initialize : function(options) { initialize : function(options) {
this.personGUID = options.personId this.personGUID = options.personId
this.model = new app.models.Profile.findByGuid(options.personId) this.model = this.model || app.models.Profile.preloadOrFetch(this.personGUID)
this.stream = options && options.stream || new app.models.Stream() this.stream = options && options.stream || new app.models.Stream()
this.model.bind("change", this.setPageTitle, this) this.model.bind("change", this.setPageTitleAndBackground, this)
/* binds for getting started pulsation */ /* binds for getting started pulsation */
this.stream.bind("fetched", this.pulsateNewPostControl, this) this.stream.bind("fetched", this.pulsateNewPostControl, this)
...@@ -46,9 +36,17 @@ app.pages.Profile = app.views.Base.extend({ ...@@ -46,9 +36,17 @@ app.pages.Profile = app.views.Base.extend({
this.stream.preloadOrFetch(); this.stream.preloadOrFetch();
this.canvasView = new app.views.Canvas({ model : this.stream }) this.canvasView = new app.views.Canvas({ model : this.stream })
this.wallpaperForm = new app.forms.Wallpaper()
this.profileInfo = new app.views.ProfileInfo({ model : this.model })
},
// send in isOwnProfile data presenter : function(){
this.profileInfo = new app.views.ProfileInfo({ model : this.model.set({isOwnProfile : this.isOwnProfile()}) }) var bio = this.model.get("bio") || ''
return _.extend(this.defaultPresenter(),
{text : this.model && app.helpers.textFormatter(bio, this.model),
showFollowButton : this.showFollowButton()
})
}, },
pulsateNewPostControl : function() { pulsateNewPostControl : function() {
...@@ -59,9 +57,11 @@ app.pages.Profile = app.views.Base.extend({ ...@@ -59,9 +57,11 @@ app.pages.Profile = app.views.Base.extend({
]("pulse") ]("pulse")
}, },
setPageTitle : function() { setPageTitleAndBackground : function() {
if(this.model.get("name")) if(this.model.get("name")) {
document.title = this.model.get("name") document.title = this.model.get("name")
this.$el.css("background-image", "url(" + this.model.get("wallpaper") + ")")
}
}, },
toggleEdit : function(evt) { toggleEdit : function(evt) {
...@@ -81,10 +81,6 @@ app.pages.Profile = app.views.Base.extend({ ...@@ -81,10 +81,6 @@ app.pages.Profile = app.views.Base.extend({
}, },
showFollowButton : function() { showFollowButton : function() {
return this.followingEnabled() && !this.isOwnProfile() return this.followingEnabled() && !this.model.get("is_own_profile")
},
isOwnProfile : function() {
return(app.currentUser.get("guid") == this.personGUID)
} }
}); });
\ No newline at end of file
...@@ -23,25 +23,38 @@ app.Router = Backbone.Router.extend({ ...@@ -23,25 +23,38 @@ app.Router = Backbone.Router.extend({
"posts/new" : "composer", "posts/new" : "composer",
"posts/:id": "singlePost", "posts/:id": "singlePost",
"posts/:id/next": "siblingPost",
"posts/:id/previous": "siblingPost",
"p/:id": "singlePost", "p/:id": "singlePost",
"framer": "framer" "framer": "framer"
}, },
siblingPost : function(){ //next or previous
var post = new app.models.Post();
post.bind("change", setPreloadAttributesAndNavigate)
post.fetch({url : window.location})
function setPreloadAttributesAndNavigate(){
window.preloads.post = post.attributes
app.router.navigate(post.url(), true)
}
},
newProfile : function(personId) { newProfile : function(personId) {
this.renderPage(new app.pages.Profile({ personId : personId })); this.renderPage(function(){ return new app.pages.Profile({ personId : personId })});
}, },
composer : function(){ composer : function(){
this.renderPage(new app.pages.Composer()); this.renderPage(function(){ return new app.pages.Composer()});
}, },
framer : function(){ framer : function(){
this.renderPage(new app.pages.Framer()); this.renderPage(function(){ return new app.pages.Framer()});
}, },
singlePost : function(id) { singlePost : function(id) {
this.renderPage(new app.pages.PostViewer({ id: id })); this.renderPage(function(){ return new app.pages.PostViewer({ id: id })});
}, },
profile : function(page) { profile : function(page) {
...@@ -72,8 +85,9 @@ app.Router = Backbone.Router.extend({ ...@@ -72,8 +85,9 @@ app.Router = Backbone.Router.extend({
return query.search("ex=true") != -1 return query.search("ex=true") != -1
}, },
renderPage : function(page){ renderPage : function(pageConstructor){
app.page = page app.page && app.page.unbind && app.page.unbind() //old page might mutate global events $(document).keypress, so unbind before creating
app.page = pageConstructor() //create new page after the world is clean (like that will ever happen)
$("#container").html(app.page.render().el) $("#container").html(app.page.render().el)
} }
}); });
......
...@@ -10,9 +10,23 @@ app.views.Canvas = app.views.Base.extend(_.extend({}, app.views.infiniteScrollMi ...@@ -10,9 +10,23 @@ app.views.Canvas = app.views.Base.extend(_.extend({}, app.views.infiniteScrollMi
renderTemplate : function() { renderTemplate : function() {
this.$el.empty() this.$el.empty()
this.stream.items.each(_.bind(function(post){
this.$el.append(this.createPostView(post).render().el); if(this.stream.items.isEmpty()){
}, this)) var message
, person = app.page.model
if(person.get("is_own_profile")){
message = "Make something to start the magic."
} else {
var name = person.get("name") || ""
message = name + " hasn't posted anything yet."
}
this.$el.html("<p class='no-post-message'>" + message + "</p>")
} else {
this.stream.items.each(_.bind(function(post){
this.$el.append(this.createPostView(post).render().el);
}, this))
}
//needs to be deferred so it happens after html rendering finishes //needs to be deferred so it happens after html rendering finishes
_.defer(_.bind(this.mason, this)) _.defer(_.bind(this.mason, this))
...@@ -29,6 +43,7 @@ app.views.Canvas = app.views.Base.extend(_.extend({}, app.views.infiniteScrollMi ...@@ -29,6 +43,7 @@ app.views.Canvas = app.views.Base.extend(_.extend({}, app.views.infiniteScrollMi
itemSelector : '.canvas-frame', itemSelector : '.canvas-frame',
visibleStyle : {scale : 1}, visibleStyle : {scale : 1},
hiddenStyle : {scale : 0.001}, hiddenStyle : {scale : 0.001},
containerStyle : {position : "relative"},
masonry : { masonry : {
columnWidth : 292.5 columnWidth : 292.5
} }
......
...@@ -3,6 +3,13 @@ app.views.PostViewerAuthor = app.views.Base.extend({ ...@@ -3,6 +3,13 @@ app.views.PostViewerAuthor = app.views.Base.extend({
id : "post-author", id : "post-author",
className : "media", className : "media",
templateName: "post-viewer/author" tooltipSelector : ".profile-image-container",
templateName: "post-viewer/author",
initialize : function() {
/* add a class so we know how to color the text for the author name */
this.$el.addClass(this.model.get("frame_name"))
}
}); });
\ No newline at end of file
app.views.PostViewerNav = app.views.Base.extend({ app.views.PostViewerNav = app.views.Base.extend({
templateName: "post-viewer/nav", templateName: "post-viewer/nav"
postRenderTemplate : function() {
var mappings = {"#forward" : "next_post",
"#back" : "previous_post"};
_.each(mappings, function(attribute, selector){
this.setArrow(this.$(selector), this.model.get(attribute))
}, this);
},
setArrow : function(arrow, loc) {
loc ? arrow.attr('href', loc) : arrow.remove()
}
}); });
\ No newline at end of file
app.views.ServicesSelector = app.views.Base.extend({ app.views.ServicesSelector = app.views.Base.extend({
templateName : "services-selector" templateName : "services-selector",
}); events : {
\ No newline at end of file "click label" : "askForAuth"
},
tooltipSelector : "img",
services : [
'facebook',
'twitter',
'tumblr'
],
presenter : function() {
return _.extend(this.defaultPresenter(), {services : this.services})
},
askForAuth : function(evt){
var $target = $(evt.target);
if(app.currentUser.isServiceConfigured($target.data('provider'))) { return }
var serviceUrl = $target.data('url')
window.open(serviceUrl, 'popup', 'height=400,width=500')
}
});
...@@ -71,7 +71,7 @@ app.views.SmallFrame = app.views.Post.extend({ ...@@ -71,7 +71,7 @@ app.views.SmallFrame = app.views.Post.extend({
}, },
adjustedImageHeight : function() { adjustedImageHeight : function() {
if(!this.model.get("photos")[0]) { return } if(!(this.model.get("photos") || [])[0]) { return }
var modifiers = [this.dimensionsClass(), this.colorClass()].join(' ') var modifiers = [this.dimensionsClass(), this.colorClass()].join(' ')
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter