Skip to content
Extraits de code Groupes Projets
Valider b120faa4 rédigé par danielgrippi's avatar danielgrippi Validation de Dennis Collinson
Parcourir les fichiers

took some functions out of stream-element widget; refactored Header view;...

took some functions out of stream-element widget; refactored Header view; refactored tooltip logic in Post view
parent 1a5e493b
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
<% if(photos_count > 0) { %>
<div class="photo_attachments">
<img src="<%= photos[0].sizes.large %>" class="stream-photo big_stream_photo">
<img src="<%= photos[0].sizes.large %>" class="stream-photo big_stream_photo" data-small-photo="<%= photos[0].sizes.small %>">
<% for(photo in photos) {
if(photo == 0){ continue; }
if(photo == 8){ break; } %>
......
......@@ -2,9 +2,10 @@
<div class="right controls">
<% if(author.id != current_user.id) { %>
<img src="/images/icons/ignoreuser.png" alt="Ignoreuser" class="block_user control_icon" title= "Ignore" data-person_id="<%= author.id %>" />
<% } else { %>
<img src="/images/deletelabel.png" class="delete control_icon remove_post" title="Delete" />
<% } %>
<img src="/images/deletelabel.png" class="delete control_icon remove_post" title="Delete" />
<img src="/images/ajax-loader.gif" class="hide_loader hidden"/>
</div>
<div class="sm_body">
......
......@@ -9,9 +9,9 @@ app.views.Feedback = app.views.StreamObject.extend({
var user_like = this.model.get("user_like")
this.like = user_like && this.model.likes.get(user_like.id);
this.model.likes.bind("change", this.render, this);
this.model.likes.bind("remove", this.render, this);
this.model.likes.bind("add", this.render, this);
_.each(["change", "remove", "add"], function(listener) {
this.model.likes.bind(listener, this.render, this);
}, this)
},
presenter : function(){
......
app.views.Header = Backbone.View.extend({
app.views.Header = app.views.Base.extend({
template_name : "#header-template",
events : {
"click ul.dropdown li:first-child" : "toggleDropdown"
},
initialize : function(options) {
this.menuElement = this.$("ul.dropdown");
_.bindAll(this, "toggleDropdown", "hideDropdown");
this.menuElement.find("li a").slice(1).click(function(evt) { evt.stopPropagation(); });
$(document.body).click(this.hideDropdown);
$(document.body).click($.proxy(this.hideDropdown, this));
return this;
},
render : function(){
this.template = _.template($("#header-template").html());
$(this.el).html(this.template(app.user()));
return this;
menuElement : function() {
return this.$("ul.dropdown");
},
toggleDropdown : function(evt) {
evt.preventDefault();
evt.stopPropagation();
if(evt){ evt.preventDefault(); }
this.$("ul.dropdown").toggleClass("active");
this.menuElement().toggleClass("active");
if ( $.browser.msie ) {
this.$('header').toggleClass('ie-user-menu-active');
if($.browser.msie) {
this.$("header").toggleClass('ie-user-menu-active');
}
},
hideDropdown : function(evt) {
if(this.$("ul.dropdown").hasClass("active") && !$(evt.target).parents("#user_menu").length) {
this.$("ul.dropdown").removeClass("active");
if(this.menuElement().hasClass("active") && !$(evt.target).parents("#user_menu").length) {
this.menuElement().removeClass("active");
}
}
});
......@@ -15,6 +15,12 @@ app.views.Post = app.views.StreamObject.extend({
".comments" : "commentStreamView"
},
tooltips : [
".delete",
".block_user",
".post_scope"
],
initialize : function() {
this.feedbackView = new app.views.Feedback({model : this.model});
this.commentStreamView = new app.views.CommentStream({ model : this.model});
......@@ -50,16 +56,13 @@ app.views.Post = app.views.StreamObject.extend({
},
initializeTooltips: function(){
$([
this.$(".delete"),
this.$(".block_user"),
this.$(".post_scope")
]).map(function() { this.twipsy(); });
_.each(this.tooltips, function(selector){
this.$(selector).twipsy();
}, this);
return this;
},
expandLikes: function(evt){
if(evt) { evt.preventDefault(); }
......
......@@ -3,5 +3,6 @@ Diaspora.Pages.MultisIndex = function() {
this.subscribe("page/ready", function(evt, document) {
self.aspectNavigation = self.instantiate("AspectNavigation", document.find("ul#aspect_nav"));
self.stream = self.instantiate("Stream", document.find("#aspect_stream_container"));
});
};
......@@ -3,5 +3,7 @@ Diaspora.Pages.TagFollowingsIndex = function() {
this.subscribe("page/ready", function(evt, document) {
self.aspectNavigation = self.instantiate("AspectNavigation", document.find("ul#aspect_nav"));
self.stream = self.instantiate("Stream", document.find("#aspect_stream_container"));
});
};
......@@ -5,11 +5,9 @@
var Stream = {
selector: "#main_stream",
nsfw_links: ".shield a",
initialize: function() {
Diaspora.page.directionDetector.updateBinds();
Stream.setUpAudioLinks();
},
......@@ -27,14 +25,6 @@ var Stream = {
box.toggle();
}
});
},
setUpNsfwLinks:function(){
$(this.nsfw_links).click(function(e){
e.preventDefault();
$(this).parent().fadeOut();
});
},
setUpAudioLinks: function() {
......
......@@ -15,22 +15,11 @@
timeAgo: self.instantiate("TimeAgo", element.find(".timeago a abbr.timeago")),
content: element.find(".content .collapsible"),
blockUserLink: element.find(".block_user"),
deletePostLink: element.find(".remove_post"),
focusCommentLink: element.find("a.focus_comment_textarea"),
hidePostLoader: element.find("img.hide_loader"),
hidePostUndo: element.find("a.stream_element_hide_undo"),
post: element,
postScope: element.find("span.post_scope")
post: element
});
// twipsy tooltips
$([
self.blockUserLink,
self.deletePostLink,
self.postScope
]).map(function() { this.twipsy(); });
// collapse long posts
self.content.expander({
slicePoint: 400,
......@@ -52,12 +41,6 @@
} );
});
self.focusCommentLink.click(function(evt) {
evt.preventDefault();
self.commentForm.commentInput.focus();
});
self.hidePostUndo.click(function(evt) {
evt.preventDefault();
......
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