Trigger install (bug 690574 or so)

This commit is contained in:
Gregory Koberger 2011-09-30 16:22:00 -04:00
Родитель cb91a15626
Коммит 853c5e8f62
3 изменённых файлов: 24 добавлений и 9 удалений

Просмотреть файл

@ -41,7 +41,9 @@ $(document).ready(function() {
var thanks_url = $('#paypal-thanks').attr('href'); var thanks_url = $('#paypal-thanks').attr('href');
if(thanks_url) { if(thanks_url) {
// TODO: play around with top.opener // TODO: play around with top.opener
top.modalFromURL(thanks_url); top.modalFromURL(thanks_url, {'callback': function() {
z.installAddon("Title View", $(".trigger_download", this).attr('href'));
}});
} }
top_dgFlow.closeFlow(); top_dgFlow.closeFlow();

Просмотреть файл

@ -260,8 +260,8 @@ $.fn.popup = function(click_target, o) {
// click_target defines the element/elements that trigger the modal. // click_target defines the element/elements that trigger the modal.
// currently presumes the given element uses the '.modal' style // currently presumes the given element uses the '.modal' style
// o takes the following optional fields: // o takes the following optional fields:
// callback: a function to run before displaying the modal. You must // callback: a function to run before displaying the modal. Returning
// return true, or it cancels the modal. // false will cancel the modal.
// container: if set the modal will be appended to the container before // container: if set the modal will be appended to the container before
// being displayed. // being displayed.
// width: the width of the modal. // width: the width of the modal.
@ -336,7 +336,7 @@ $.fn.modal = function(click_target, o) {
var resp = o.callback ? (o.callback.call($modal, { var resp = o.callback ? (o.callback.call($modal, {
click_target: this, click_target: this,
evt: e evt: e
})) : true; })) !== false : true;
$modal.o = $.extend({click_target: this}, $modal.o, resp); $modal.o = $.extend({click_target: this}, $modal.o, resp);
if (resp) { if (resp) {
$('.modal').trigger('close'); // We don't want two! $('.modal').trigger('close'); // We don't want two!
@ -400,12 +400,25 @@ $.fn.modal = function(click_target, o) {
}; };
// Modal from URL. Pass in a URL, and load it in a modal. // Modal from URL. Pass in a URL, and load it in a modal.
function modalFromURL(url) { function modalFromURL(url, settings) {
var a = $('<a>'),
defaults = {'deleteme': true, 'close': true},
callback = settings['callback'];
delete settings['callback'];
settings = $.extend(defaults, settings);
var modal = $("<div>", {'text': gettext('Loading...'), 'class': 'modal'}).modal(a, settings);
a.trigger('click');
$.get(url, function(html){ $.get(url, function(html){
var a = $('<a>'); modal.appendTo('body')
$(html).modal(a, {'deleteme': true, 'close': true}); modal.html("").append(html);
a.trigger('click'); if(callback) {
callback.call(modal);
}
}); });
return modal;
} }
// Slugify // Slugify

Просмотреть файл

@ -1,3 +1,3 @@
<div class="{% block classes %}{% endblock %} modal"> <div class="{% block classes %}{% endblock %}">
{% block content %}{% endblock %} {% block content %}{% endblock %}
</div> </div>