forked from diaspora/diaspora
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Widgets now subscribe to a widget/ready event. Apply change to all wi…
…dgets, added some tests & lots of cleanup.
- Loading branch information
Dan Hansen
committed
Jul 14, 2011
1 parent
abe10b3
commit ca2413f
Showing
20 changed files
with
555 additions
and
398 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,37 @@ | ||
Diaspora.widgets.add("alert", function() { | ||
this.start = function() { | ||
$(document).bind("close.facebox", function() { | ||
if ($("#diaspora_alert").length) { | ||
$("#diaspora_alert").detach(); | ||
} | ||
}); | ||
}; | ||
(function() { | ||
var Alert = function() { | ||
var self = this; | ||
|
||
this.faceboxTemplate = '<div id="diaspora_alert" class="facebox_content">' + | ||
'<div class="span-12 last">' + | ||
'<div id="facebox_header">' + | ||
'<h4>' + | ||
'{{title}}' + | ||
'</h4>' + | ||
this.faceboxTemplate = '<div id="diaspora_alert" class="facebox_content">' + | ||
'<div class="span-12 last">' + | ||
'<div id="facebox_header">' + | ||
'<h4>' + | ||
'{{title}}' + | ||
'</h4>' + | ||
'</div>' + | ||
'{{content}}' + | ||
'</div>' + | ||
'{{content}}' + | ||
'</div>' + | ||
'</div>'; | ||
'</div>'; | ||
|
||
|
||
this.subscribe("widget/ready", function() { | ||
$(document).bind("close.facebox", function() { | ||
$("#facebox, #diaspora_alert").remove(); | ||
}); | ||
}); | ||
|
||
this.alert = function(title, content) { | ||
var template = $.mustache(this.faceboxTemplate, { | ||
title: title, | ||
content: content | ||
}); | ||
|
||
$(template).appendTo(document.body); | ||
this.alert = function(title, content) { | ||
$($.mustache(self.faceboxTemplate, { | ||
title: title, | ||
content: content | ||
})).appendTo(document.body); | ||
|
||
$.facebox({ | ||
div: "#diaspora_alert" | ||
}, "diaspora_alert"); | ||
} | ||
}; | ||
|
||
$.facebox({ | ||
div: "#diaspora_alert" | ||
}, 'diaspora_alert'); | ||
} | ||
}); | ||
Diaspora.widgets.add("alert", Alert); | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.