Skip to content

Commit 45e1b4d

Browse files
committed
[smarcet] - #13220
* fixed js issue on older browers * refactoring * added ios redirection
1 parent ad9a0b5 commit 45e1b4d

1 file changed

Lines changed: 21 additions & 20 deletions

File tree

summit/javascript/forms/rsvp.form.js

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ $(document).ready(function () {
5050
});
5151

5252
function addRSVP(form, event_id, summit_id, security_id) {
53-
var url = `api/v1/summits/${summit_id}/schedule/${event_id}/rsvp?SecurityID=${security_id}`;
54-
var modal_id = `#rsvpModal_${event_id}`;
53+
var url = 'api/v1/summits/'+summit_id+'/schedule/'+event_id+'/rsvp?SecurityID='+security_id;
54+
var modal_id = '#rsvpModal_'+event_id;
5555

5656
$.ajax({
5757
type: 'POST',
@@ -75,42 +75,43 @@ function addRSVP(form, event_id, summit_id, security_id) {
7575
text:"Your rsvp to this event was sent successfully.",
7676
type: "success"
7777
}).then(function () {
78-
79-
78+
8079
var is_mobile = bowser.mobile || bowser.tablet;
8180
var is_ios = bowser.ios;
8281
var is_android = bowser.android;
8382

8483
if(is_android){
85-
var form = $('.rsvp_form');
86-
var event_id = $('input[name="event_id"]', form).val();
8784
window.location = "org.openstack.android.summit://events/"+event_id;
85+
return;
8886
}
89-
else {
90-
var url = new URI(window.location);
91-
if (url.hasQuery("BackURL")) {
92-
window.location = url.query(true)['BackURL'];
93-
}
87+
if(is_ios){
88+
window.location = "org.openstack.ios.openstack-summit://events/"+event_id;
89+
return;
9490
}
91+
var url = new URI(window.location);
92+
if (url.hasQuery("BackURL")) {
93+
window.location = url.query(true)['BackURL'];
94+
return;
95+
}
96+
9597
});
98+
return;
9699
}
97-
else{
98-
// close modal
99-
var modal = $('#rsvpModal');
100-
if(modal.length > 0)
101-
modal.modal('hide');
102-
}
100+
// close modal
101+
var modal = $('#rsvpModal');
102+
if(modal.length > 0)
103+
modal.modal('hide');
104+
103105
},
104106
error: function (jqXHR, textStatus, errorThrown) {
105107
$(modal_id).modal('hide');
106108
var responseCode = jqXHR.status;
107109
if(responseCode == 412) {
108110
var response = $.parseJSON(jqXHR.responseText);
109111
swal('Validation error', response.messages[0].message, 'warning');
110-
} else {
111-
swal('Error', 'There was a problem sending the rsvp, please contact admin.', 'warning');
112+
return;
112113
}
113-
114+
swal('Error', 'There was a problem sending the rsvp, please contact admin.', 'warning');
114115
}
115116
});
116117
}

0 commit comments

Comments
 (0)