mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-16 21:24:05 +00:00
Implement simplified commercials workflow
It's now possible to simply enter the url of the third party provider to enter a commercial.
This commit is contained in:
parent
fb7ebab5a0
commit
23664119bd
25 changed files with 220 additions and 194 deletions
|
|
@ -37,6 +37,7 @@
|
|||
//= require bootstrap-switch
|
||||
//= require osem-switch
|
||||
//= require osem-bootstrap
|
||||
//= require osem-commercials
|
||||
|
||||
$(document).ready(function() {
|
||||
$('a[disabled=disabled]').click(function(event){
|
||||
|
|
|
|||
33
app/assets/javascripts/osem-commercials.js
Normal file
33
app/assets/javascripts/osem-commercials.js
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
$(function () {
|
||||
$(document).ready(function() {
|
||||
$("#commercial_url").bind('paste keyup', function() {
|
||||
clearTimeout($(this).data('timeout'));
|
||||
|
||||
$(this).data('timeout', setTimeout(function () {
|
||||
var url = $('#new_commercial').attr('action');
|
||||
url = url + '/render_commercial'
|
||||
$.ajax({
|
||||
method: 'GET',
|
||||
url: url,
|
||||
data: { url: $('#commercial_url').val() },
|
||||
error: function(xhr, status, error) {
|
||||
$('#commercial_submit_action').prop('disabled', true);
|
||||
$('#resource-content').hide();
|
||||
$('#resource-placeholder').show();
|
||||
$('#commercial_error').hide();
|
||||
$('#commercial_url_input').addClass('has-error error');
|
||||
$('<span id="commercial_error" class="help-block">' + xhr.responseText + '</span>').insertAfter('#commercial_url');
|
||||
},
|
||||
success: function(msg) {
|
||||
$('#commercial_submit_action').prop('disabled', false);
|
||||
$('#commercial_url_input').removeClass('has-error error');
|
||||
$('#commercial_error').hide();
|
||||
$('#resource-placeholder').hide();
|
||||
$('#resource-content').html(msg).show();
|
||||
}
|
||||
})
|
||||
}, 200)
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue