media gallery display - small bugs
This commit is contained in:
parent
5317e8243e
commit
7c471208da
|
@ -45,6 +45,7 @@ $(function() {
|
|||
return false;
|
||||
}
|
||||
var $this = $(e.target);
|
||||
//console.log($this.closest('li'));
|
||||
var id = $this.closest('li').attr("data-id");
|
||||
var url = "/mediagallery/delete_link/" + id;
|
||||
$.get(url, {}, function(response) {
|
||||
|
@ -85,6 +86,7 @@ $(function() {
|
|||
$this.text("Adding...");
|
||||
var url = "/mediagallery/add_youtube/" + GALLERY_ID;
|
||||
$.get(url, {'url': yt_url}, function(data) {
|
||||
$('#youtubeURL').val('');
|
||||
$this.removeAttr("disabled");
|
||||
$this.text("Add");
|
||||
var $ul = $('#youtubeVideos');
|
||||
|
@ -102,8 +104,8 @@ $(function() {
|
|||
|
||||
$('#addLink').click(function(e) {
|
||||
e.preventDefault();
|
||||
var url = $.trim($('#linkURL').val());
|
||||
if (url === '') {
|
||||
var linkURL = $.trim($('#linkURL').val());
|
||||
if (linkURL === '') {
|
||||
alert("please enter a link");
|
||||
return;
|
||||
}
|
||||
|
@ -111,7 +113,9 @@ $(function() {
|
|||
$this.attr("disabled", "disabled");
|
||||
var title = prompt("Please enter a title for the link");
|
||||
var url = "/mediagallery/add_link/" + GALLERY_ID;
|
||||
$.get(url, {'url': url, 'title': title}, function(data) {
|
||||
$.get(url, {'url': linkURL, 'title': title}, function(data) {
|
||||
$('#linkURL').val('');
|
||||
console.log(data);
|
||||
$this.removeAttr("disabled");
|
||||
var $ul = $('#links');
|
||||
var $li = $('<li />')
|
||||
|
@ -208,7 +212,7 @@ $(function() {
|
|||
|
||||
<ul id="links">
|
||||
{% for link in links %}
|
||||
<li>
|
||||
<li data-id="{{ link.id }}">
|
||||
<div class="linkTitle">{{ link.title }}</div>
|
||||
<a target="_blank" href="{{ link.url }}">{{ link.url }}</a>
|
||||
<span class="deleteLink">X</span>
|
||||
|
|
Loading…
Reference in New Issue
Block a user