Skip to content
Snippets Groups Projects
Commit 5dc4165f authored by Carsten  Rose's avatar Carsten Rose
Browse files

Merge branch 'F9052_Report_CodeMirror' of git.math.uzh.ch:typo3/qfq into F9052_Report_CodeMirror

parents 3d3a392f b38b28dc
No related branches found
No related tags found
2 merge requests!430Merge new version 22.05,!423F9052: New feature implemented with js to edit content records in front end....
...@@ -108,6 +108,11 @@ $(document).ready(function(){ ...@@ -108,6 +108,11 @@ $(document).ready(function(){
var urlParams = new URLSearchParams(window.location.search); var urlParams = new URLSearchParams(window.location.search);
var ttContentParam = urlParams.get('tt-content'); var ttContentParam = urlParams.get('tt-content');
var pageId = urlParams.get('id'); var pageId = urlParams.get('id');
if(pageId === null){
pageId = '';
}else{
pageId = 'id='+pageId+'&';
}
if(ttContentParam !== null && $(targetEditReportButton).next("#"+ttContentParam)[0] !== undefined){ if(ttContentParam !== null && $(targetEditReportButton).next("#"+ttContentParam)[0] !== undefined){
var formContent = $($(targetEditReportButton).next("#"+ttContentParam)[0].outerHTML); var formContent = $($(targetEditReportButton).next("#"+ttContentParam)[0].outerHTML);
...@@ -117,18 +122,23 @@ $(document).ready(function(){ ...@@ -117,18 +122,23 @@ $(document).ready(function(){
// execute changes(post) and reload page with id of tt-content as get parameter. Staying in same window with new content. // execute changes(post) and reload page with id of tt-content as get parameter. Staying in same window with new content.
$(externWindow).submit(function() { $(externWindow).submit(function() {
$.post($(externWindow).attr('action'),$(externWindow).serializeArray()); $.post($(externWindow).attr('action'),$(externWindow).serializeArray());
alert("Changes have been saved. Reload your primary window after that."); $('<div style="text-align: right; margin-top: 10px;"><span style="background-color: green;" class="badge badge-success">Saved</span></div>')
if(pageId === null){ .insertAfter('.btn-default')
pageId = ''; .delay(3000)
}else{ .fadeOut(function() {
pageId = 'id='+pageId+'&'; $(this).remove();
} });
if(window.location.search !== '?'+"tt-content="+$('form').attr('id')){ if(window.location.search !== '?'+pageId+"tt-content="+$('form').attr('id')){
window.location.href = '//' + location.host + location.pathname + "?" +pageId+ "tt-content=" + $('form').attr('id'); window.location.href = '//' + location.host + location.pathname + "?" +pageId+ "tt-content=" + $('form').attr('id');
} }
return false; return false;
}); });
// Refresh new window with correct url
if($(externWindow).length !== 0 && window.location.search !== '?'+pageId+"tt-content="+$('form').attr('id')){
window.location.href = '//' + location.host + location.pathname + "?" +pageId+ "tt-content=" + $('form').attr('id');
}
// enable CodeMirror for extern window // enable CodeMirror for extern window
$(externWindow).children("[class=qfq-codemirror]").each( $(externWindow).children("[class=qfq-codemirror]").each(
function () { function () {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment