hubzilla issue #979 - alter image selection widget to accept/submit on choose (jot, wiki, cover_photo, profile_photo)

This commit is contained in:
zotlabs 2018-02-25 19:25:00 -08:00
parent d406e2aae2
commit 04ec35d9cc
7 changed files with 45 additions and 76 deletions

View File

@ -27,13 +27,7 @@
if (typeof($(image).parent()[0]) !== 'undefined') {
var imageparent = document.getElementById($(image).parent()[0].id);
$(imageparent).toggleClass('embed-photo-selected-photo');
}
});
$('#embedPhotoModalBodyAlbumListDialog').addClass('d-none');
$('#embedPhotoModalBodyAlbumDialog').removeClass('d-none');
$('#embed-photo-OKButton').click(function () {
$('.embed-photo-selected-photo').each(function (index) {
var href = $(this).attr('href');
var href = $(imageparent).attr('href');
$.post("embedphotos/photolink", {href: href},
function(ddata) {
if (ddata['status']) {
@ -42,13 +36,16 @@
window.console.log("{{$modalerrorlink}}" + ':' + ddata['errormsg']);
}
return false;
},
'json');
});
$('#embedPhotoModalBodyAlbumDialog').html('');
$('#embedPhotoModalBodyAlbumDialog').off('click');
$('#embedPhotoModal').modal('hide');
},
'json');
$('#embedPhotoModalBodyAlbumDialog').html('');
$('#embedPhotoModalBodyAlbumDialog').off('click');
$('#embedPhotoModal').modal('hide');
}
});
$('#embedPhotoModalBodyAlbumListDialog').addClass('d-none');
$('#embedPhotoModalBodyAlbumDialog').removeClass('d-none');
} else {
window.console.log("{{$modalerroralbum}} " + JSON.stringify(album) + ':' + data['errormsg']);
}

View File

@ -27,13 +27,7 @@
if (typeof($(image).parent()[0]) !== 'undefined') {
var imageparent = document.getElementById($(image).parent()[0].id);
$(imageparent).toggleClass('embed-photo-selected-photo');
}
});
$('#embedPhotoModalBodyAlbumListDialog').addClass('d-none');
$('#embedPhotoModalBodyAlbumDialog').removeClass('d-none');
$('#embed-photo-OKButton').click(function () {
$('.embed-photo-selected-photo').each(function (index) {
var href = $(this).attr('href');
var href = $(imageparent).attr('href');
$.post("embedphotos/photolink", {href: href},
function(ddata) {
if (ddata['status']) {
@ -44,13 +38,16 @@
window.console.log("{{$modalerrorlink}}" + ':' + ddata['errormsg']);
}
return false;
},
'json');
});
$('#embedPhotoModalBodyAlbumDialog').html('');
$('#embedPhotoModalBodyAlbumDialog').off('click');
$('#embedPhotoModal').modal('hide');
},
'json');
$('#embedPhotoModalBodyAlbumDialog').html('');
$('#embedPhotoModalBodyAlbumDialog').off('click');
$('#embedPhotoModal').modal('hide');
}
});
$('#embedPhotoModalBodyAlbumListDialog').addClass('d-none');
$('#embedPhotoModalBodyAlbumDialog').removeClass('d-none');
} else {
window.console.log("{{$modalerroralbum}} " + JSON.stringify(album) + ':' + data['errormsg']);
}

View File

@ -41,10 +41,6 @@
</div>
<div id="embedPhotoModalBodyAlbumDialog" class="d-none"></div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-outline-secondary" data-dismiss="modal">{{$embedPhotosModalCancel}}</button>
<button id="embed-photo-OKButton" type="button" class="btn btn-primary">{{$embedPhotosModalOK}}</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->

View File

@ -459,13 +459,7 @@ var activeCommentText = '';
if (typeof($(image).parent()[0]) !== 'undefined') {
var imageparent = document.getElementById($(image).parent()[0].id);
$(imageparent).toggleClass('embed-photo-selected-photo');
}
});
$('#embedPhotoModalBodyAlbumListDialog').addClass('d-none');
$('#embedPhotoModalBodyAlbumDialog').removeClass('d-none');
$('#embed-photo-OKButton').click(function () {
$('.embed-photo-selected-photo').each(function (index) {
var href = $(this).attr('href');
var href = $(imageparent).attr('href');
$.post("embedphotos/photolink", {href: href},
function(ddata) {
if (ddata['status']) {
@ -476,12 +470,14 @@ var activeCommentText = '';
}
return false;
},
'json');
});
$('#embedPhotoModalBodyAlbumDialog').html('');
$('#embedPhotoModalBodyAlbumDialog').off('click');
$('#embedPhotoModal').modal('hide');
'json');
$('#embedPhotoModalBodyAlbumDialog').html('');
$('#embedPhotoModalBodyAlbumDialog').off('click');
$('#embedPhotoModal').modal('hide');
}
});
$('#embedPhotoModalBodyAlbumListDialog').addClass('d-none');
$('#embedPhotoModalBodyAlbumDialog').removeClass('d-none');
} else {
window.console.log("{{$modalerroralbum}} " + JSON.stringify(album) + ':' + data['errormsg']);
}

View File

@ -293,10 +293,6 @@
</div>
<div id="embedPhotoModalBodyAlbumDialog" class="d-none"></div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-outline-secondary" data-dismiss="modal">{{$embedPhotosModalCancel}}</button>
<button id="embed-photo-OKButton" type="button" class="btn btn-primary">{{$embedPhotosModalOK}}</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->

View File

@ -35,8 +35,6 @@
<br />
{{/if}}
<div id="profile-photo-submit-wrapper">
<input type="submit" name="submit" id="profile-photo-submit" value="{{$submit}}">
</div>
@ -65,10 +63,6 @@
</div>
<div id="embedPhotoModalBodyAlbumDialog" class="d-none"></div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-outline-secondary" data-dismiss="modal">{{$embedPhotosModalCancel}}</button>
<button id="embed-photo-OKButton" type="button" class="btn btn-primary">{{$embedPhotosModalOK}}</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->

View File

@ -91,10 +91,6 @@
</div>
<div id="embedPhotoModalBodyAlbumDialog" class="d-none"></div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-outline-secondary" data-dismiss="modal">{{$embedPhotosModalCancel}}</button>
<button id="embed-photo-OKButton" type="button" class="btn btn-primary">{{$embedPhotosModalOK}}</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
@ -391,16 +387,10 @@
if (typeof($(image).parent()[0]) !== 'undefined') {
var imageparent = document.getElementById($(image).parent()[0].id);
$(imageparent).toggleClass('embed-photo-selected-photo');
}
});
$('#embedPhotoModalBodyAlbumListDialog').addClass('d-none');
$('#embedPhotoModalBodyAlbumDialog').removeClass('d-none');
$('#embed-photo-OKButton').click(function () {
$('.embed-photo-selected-photo').each(function (index) {
var href = $(this).attr('href');
$.post("embedphotos/photolink", {href: href},
function(ddata) {
if (ddata['status']) {
var href = $(imageparent).attr('href');
$.post("embedphotos/photolink", {href: href},
function(ddata) {
if (ddata['status']) {
{{if !$mimeType || $mimeType == 'text/markdown'}}
var imgURL = ddata['photolink'].replace( /\[.*\]\[.*\](.*)\[.*\]\[.*\]/, '\n![image]($1)' )
editor.getSession().insert(editor.getCursorPosition(), imgURL)
@ -408,17 +398,20 @@
var currentContent = $('#editor').val();
$('#editor').val(currentContent + ddata['photolink']);
{{/if}}
} else {
window.console.log("{{$modalerrorlink}}" + ':' + ddata['errormsg']);
}
return false;
} else {
window.console.log("{{$modalerrorlink}}" + ':' + ddata['errormsg']);
}
return false;
},
'json');
});
$('#embedPhotoModalBodyAlbumDialog').html('');
$('#embedPhotoModalBodyAlbumDialog').off('click');
$('#embedPhotoModal').modal('hide');
});
'json');
$('#embedPhotoModalBodyAlbumDialog').html('');
$('#embedPhotoModalBodyAlbumDialog').off('click');
$('#embedPhotoModal').modal('hide');
}
});
$('#embedPhotoModalBodyAlbumListDialog').addClass('d-none');
$('#embedPhotoModalBodyAlbumDialog').removeClass('d-none');
} else {
window.console.log("{{$modalerroralbum}} " + JSON.stringify(album) + ':' + data['errormsg']);
}