add app parameters to add form

This commit is contained in:
Frédéric Péters 2013-03-14 17:03:48 +01:00
parent 6a20b33445
commit a641202ffa
3 changed files with 30 additions and 2 deletions

View File

@ -182,3 +182,12 @@ li:hover .close {
.welcome {
padding: 1ex;
}
#dialog-confirm form {
margin-left: 24px;
}
#dialog-confirm form label {
display: inline-block;
width: 6em;
}

View File

@ -13,6 +13,23 @@ Nouvelle application :
<div id="dialog-confirm" title="Ajouter une application" style="display: none">
<p><span class="ui-icon ui-icon-alert" style="float: left; margin: 0 7px 20px 0;"></span>
Cela ajoutera une application <span class="appname"></span> à votre portail.</p>
<form id="form-feed">
<label>URL</label>
<input name="feed_url"/>
</form>
<form id="form-launcher">
<label>Libellé</label>
<input name="label"/><br/>
<label>URL</label>
<input name="url"/>
</form>
<form id="form-weather">
<label>Lieu</label>
<select name="location"><option>Paris</option></select>
</form>
</div>
<script>
@ -20,6 +37,8 @@ $(function(){ //DOM Ready
$('#{{app_id}} select').change(
function() {
var appid = $(this).val();
$('#dialog-confirm form').hide();
$('#dialog-confirm form#form-' + appid).show();
$('#dialog-confirm span.appname').text($(this).find(':selected').text());
$("#dialog-confirm").dialog({
resizable: false,
@ -27,7 +46,7 @@ $(function(){ //DOM Ready
width: '30em',
buttons: {
"Ajouter": function() {
window.location = window.location + 'add/' + appid;
window.location = window.location + 'add/' + appid + '?' + $('#dialog-confirm form#form-' + appid).serialize();
$( this ).dialog( "close" );
},
"Annuler": function() {

View File

@ -48,7 +48,7 @@ class Add(RedirectView):
def get_redirect_url(self, appid):
profile = self.request.user.get_profile()
layout = profile.get_layout()
layout['app%s' % random.randint(0, 10000)] = (appid, {})
layout['app%s' % random.randint(0, 10000)] = (appid, self.request.GET)
profile.set_layout(layout)
return reverse('homepage')