diff --git a/beat/web/reports/static/reports/app/directives/reportItemView.js b/beat/web/reports/static/reports/app/directives/reportItemView.js index 92d9a994e57f99c1de4616fc5f9f3c0283006acd..b4f0c3a315f96265ea49b5d39cafdfa859c16221 100644 --- a/beat/web/reports/static/reports/app/directives/reportItemView.js +++ b/beat/web/reports/static/reports/app/directives/reportItemView.js @@ -117,7 +117,9 @@ app.directive("savereportitems", function($compile) scope.reportFactory.updateReport(scope.user, scope.report_id, data, scope.url_prefix) .success(function (reportData) { - alert("The report "+ scope.report_id +" has been saved."); + //alert("The report "+ scope.report_id +" has been saved."); + + beat.ui.report.report_saved('report_saved', scope); }) .error(function (error) { diff --git a/beat/web/reports/templates/reports/dialogs/report_saved.html b/beat/web/reports/templates/reports/dialogs/report_saved.html new file mode 100644 index 0000000000000000000000000000000000000000..ec97e677216732586740f73eb9822f3b9024185e --- /dev/null +++ b/beat/web/reports/templates/reports/dialogs/report_saved.html @@ -0,0 +1,29 @@ +{% comment %} + * Copyright (c) 2016 Idiap Research Institute, http://www.idiap.ch/ + * Contact: beat.support@idiap.ch + * + * This file is part of the beat.web module of the BEAT platform. + * + * Commercial License Usage + * Licensees holding valid commercial BEAT licenses may use this file in + * accordance with the terms contained in a written agreement between you + * and Idiap. For further information contact tto@idiap.ch + * + * Alternatively, this file may be used under the terms of the GNU Affero + * Public License version 3 as published by the Free Software and appearing + * in the file LICENSE.AGPL included in the packaging of this file. + * The BEAT platform is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. + * + * You should have received a copy of the GNU Affero Public License along + * with the BEAT platform. If not, see http://www.gnu.org/licenses/. +{% endcomment %} +<div id="{{ dialog_id }}" class="report_remove_experiment" title="Report" style="display:none"> + <p class="explanation">Report status</p> + + + <div class="explanation_text"> + <p>Your report has been successfully saved</p> + </div> +</div> diff --git a/beat/web/reports/templates/reports/report.html b/beat/web/reports/templates/reports/report.html index 0d4e922cc09abfcc7df7908598aa3df4fef80b88..44463c09faff8ce3d138e2279df140815593377a 100644 --- a/beat/web/reports/templates/reports/report.html +++ b/beat/web/reports/templates/reports/report.html @@ -165,6 +165,7 @@ {% report_publish "report_publish" %} {% report_remove_experiment "report_remove_experiment" %} {% report_remove_item "report_remove_item" %} +{% report_saved "report_saved" %} <script type="text/javascript"> var smart_selector = new beat.ui.SmartSelector('smart_selector'); diff --git a/beat/web/reports/templatetags/report_tags.py b/beat/web/reports/templatetags/report_tags.py index 381194bdc574d3fd27bd5b3cd632d32b765d97d3..d6a3f1b8140b4726e164026e842a5b4a92a3d0f4 100644 --- a/beat/web/reports/templatetags/report_tags.py +++ b/beat/web/reports/templatetags/report_tags.py @@ -232,3 +232,15 @@ def report_remove_item(id): register.inclusion_tag('reports/dialogs/report_remove_item.html')(report_remove_item) + + +#-------------------------------------------------- + + +def report_saved(id): + return { 'dialog_id': id, + 'URL_PREFIX': settings.URL_PREFIX + } + + +register.inclusion_tag('reports/dialogs/report_saved.html')(report_saved) diff --git a/beat/web/ui/static/ui/js/reportdialog.js b/beat/web/ui/static/ui/js/reportdialog.js index 230d5526119b26d372614f5a5582652d46b2ac8b..4a206950d72f4b9d89ca0eb230ac749c36535fc3 100644 --- a/beat/web/ui/static/ui/js/reportdialog.js +++ b/beat/web/ui/static/ui/js/reportdialog.js @@ -514,3 +514,46 @@ beat.ui.report.remove_item = function(dialog_id, elementToRemove, scope) // Display the dialog $('#' + dialog_id).dialog("open"); } + +beat.ui.report.report_saved = function(dialog_id, scope) +{ + console.log("ici"); + var num_click = 0; + // Create the dialog + $('#' + dialog_id).dialog({ + autoOpen: false, + resizable: false, + width: Math.min($(window).width() * 0.6, 700), + position: { my: "center", at: "center", of: window }, + modal: true, + closeOnEscape: true, + buttons: [ + { + id: 'button-' + dialog_id + '-ok', + text: 'Ok', + click: function() { + var data = {}; + $.ajaxSetup({ + beforeSend: function(xhr, settings) { + xhr.setRequestHeader('X-CSRFToken', $.cookie('csrftoken')); + } + }); + + //$('#' + dialog_id).dialog("close"); + if(num_click == 0) + { + num_click++; + $(".explanation_text").hide(); + $('#' + dialog_id).dialog("close"); + $(".explanation_text").show(); + num_click = 0; + location.reload(); + } + } + }, + ] + }); + + // Display the dialog + $('#' + dialog_id).dialog("open"); +}