From dc421b5005cf62f99c7f6c56a5c3dce94ab91b3b Mon Sep 17 00:00:00 2001 From: Jaden Diefenbaugh <blakcap@users.noreply.github.com> Date: Wed, 8 Feb 2017 17:31:38 +0100 Subject: [PATCH] add basic controller & html for groups panel --- .../app/controllers/groupsController.js | 27 ++++ .../templates/reports/panels/viewer.html | 152 ++++++++++-------- .../web/reports/templates/reports/report.html | 7 + 3 files changed, 123 insertions(+), 63 deletions(-) create mode 100644 beat/web/reports/static/reports/app/controllers/groupsController.js diff --git a/beat/web/reports/static/reports/app/controllers/groupsController.js b/beat/web/reports/static/reports/app/controllers/groupsController.js new file mode 100644 index 000000000..e86abf8a5 --- /dev/null +++ b/beat/web/reports/static/reports/app/controllers/groupsController.js @@ -0,0 +1,27 @@ +/* + * 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/. + */ +// this controller handles the 'groups' partial, where groups of experiments are managed +angular.module('reportApp').controller('GroupsController', ['$scope', 'ReportService', function ($scope, ReportService){ + let vm = this; + + vm.test = 'test'; +}]); diff --git a/beat/web/reports/templates/reports/panels/viewer.html b/beat/web/reports/templates/reports/panels/viewer.html index 9031b7d79..eb2f33919 100644 --- a/beat/web/reports/templates/reports/panels/viewer.html +++ b/beat/web/reports/templates/reports/panels/viewer.html @@ -1,77 +1,103 @@ {% 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/. +* 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 %} {% load ui_tags %} {% with object.get_status_display as status %} <div class="row"> - <div class="col-sm-12"> - <div class="panel-group" id="information-accordion" role="tablist" aria-multiselectable="true"> + <div class="col-sm-12"> + <div class="panel-group" id="information-accordion" role="tablist" aria-multiselectable="true"> - {# DOCUMENTATION DISPLAY/EDITOR #} - <div class="panel panel-default"> - <div class="panel-heading" role="tab" id="docs-heading"> - <h4 class="panel-title"> - <a {% if owner %}class="collapsed" {%endif%}role="button" data-toggle="collapse" data-parent="#docs-heading" href="#collapse-docs" aria-expanded="{% if owner %}false{% else %}true{% endif %}" aria-controls="collapse-docs">Documentation{% if not object.description %} <i class="fa fa-warning"></i>{% endif %}</a> - </h4> - </div>{# panel-heading #} - <div id="collapse-docs" class="panel-collapse collapse{% if not owner %} in{% endif %}" role="tabpanel" aria-labelledby="docs-heading"> - <div class="panel-body"> - {% if status == 'Editable' and owner %} - {% doc_editor object 'api_reports:object' %} - {% else %} - {% doc_editor object 'api_reports:object' False %} - {% endif %} - </div>{# panel-body #} - </div>{# collapse #} - </div>{# panel #} + {# DOCUMENTATION DISPLAY/EDITOR #} + <div class="panel panel-default"> + <div class="panel-heading" role="tab" id="docs-heading"> + <h4 class="panel-title"> + <a {% if owner %}class="collapsed" {%endif%}role="button" data-toggle="collapse" data-parent="#docs-heading" href="#collapse-docs" aria-expanded="{% if owner %}false{% else %}true{% endif %}" aria-controls="collapse-docs">Documentation{% if not object.description %} <i class="fa fa-warning"></i>{% endif %}</a> + </h4> + </div>{# panel-heading #} + <div id="collapse-docs" class="panel-collapse collapse{% if not owner %} in{% endif %}" role="tabpanel" aria-labelledby="docs-heading"> + <div class="panel-body"> + {% if status == 'Editable' and owner %} + {% doc_editor object 'api_reports:object' %} + {% else %} + {% doc_editor object 'api_reports:object' False %} + {% endif %} + </div>{# panel-body #} + </div>{# collapse #} + </div>{# panel #} - {% if status != 'Locked' %} - <div class="panel panel-default" ng-if="report.experiments.length != 0" > - <div class="panel-heading" role="tab" id="info-heading"> - <h4 class="panel-title"> - <a role="button" data-toggle="collapse" data-parent="#info-heading" href="#collapse-info" aria-expanded="true" aria-controls="collapse-info">Configuration</a> - </h4> - </div>{# panel-heading #} - <div id="collapse-info" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="info-heading"> - <div class="panel-body"> - <myreportinfo urlprefix={{URL_PREFIX}}></myreportinfo> - </div>{# panel-body #} - </div>{# collapse #} - </div>{# panel #} - {% endif %} + {# GROUPS DISPLAY/EDITOR #} + <div id='groups' class='panel panel-default' ng-controller='GroupsController as groups'> + <div id="groups-heading" class="panel-heading" role="tab"> + <h4 class="panel-title"> + <a + {% if owner %}class="collapsed" {%endif%} + role="button" + data-toggle="collapse" + data-parent="#groups-heading" + href="#collapse-groups" + aria-expanded="{% if owner %}false{% else %}true{% endif %}" + aria-controls="collapse-groups"> + Groups + </a> + </h4> + </div> + <div id="collapse-groups" + class="panel-collapse collapse{% if not owner %} in{% endif %}" + role="tabpanel" + aria-labelledby="groups-heading"> + <div class="panel-body"> + {$ groups.test $} + </div> + </div> + </div> - </div>{# panel-group #} - <div ng-if="report.experiments.length != 0" class="alert alert-success"{% if not owner or status != 'Editable' %}style="display:none;"{% endif %}> - <a class="btn btn-success btn-sm add_item" data-toggle="tooltip" data-placement="bottom" title="Add item" addreportitem><i class="fa fa-plus fa-lg"></i> Add a report item</a> - </div> - <div ng-if="report.experiments.length == 0" class="alert alert-warning"{% if not owner or status != 'Editable' %}style="display:none;"{% endif %}> - <i class="fa fa-warning fa-lg"></i> You have <strong>not added any experiments</strong> in this report yet. You may add experiments from <a href="{{ URL_PREFIX }}/experiments/{{ object.author.username }}/">any experiment list page</a> to unlock editing features for this report. - </div> + {% if status != 'Locked' %} + <div class="panel panel-default" ng-if="report.experiments.length != 0" > + <div class="panel-heading" role="tab" id="info-heading"> + <h4 class="panel-title"> + <a role="button" data-toggle="collapse" data-parent="#info-heading" href="#collapse-info" aria-expanded="true" aria-controls="collapse-info">Configuration</a> + </h4> + </div>{# panel-heading #} + <div id="collapse-info" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="info-heading"> + <div class="panel-body"> + <myreportinfo urlprefix={{URL_PREFIX}}></myreportinfo> + </div>{# panel-body #} + </div>{# collapse #} + </div>{# panel #} + {% endif %} - {# DISPLAYED TABLES AND FIGURES #} - <div class="panel-group" id="space-for-report-items" role="tablist" aria-multiselectable="true"> - </div> + </div>{# panel-group #} + <div ng-if="report.experiments.length != 0" class="alert alert-success"{% if not owner or status != 'Editable' %}style="display:none;"{% endif %}> + <a class="btn btn-success btn-sm add_item" data-toggle="tooltip" data-placement="bottom" title="Add item" addreportitem><i class="fa fa-plus fa-lg"></i> Add a report item</a> + </div> + <div ng-if="report.experiments.length == 0" class="alert alert-warning"{% if not owner or status != 'Editable' %}style="display:none;"{% endif %}> + <i class="fa fa-warning fa-lg"></i> You have <strong>not added any experiments</strong> in this report yet. You may add experiments from <a href="{{ URL_PREFIX }}/experiments/{{ object.author.username }}/">any experiment list page</a> to unlock editing features for this report. + </div> - </div>{# col-sm-12 #} + {# DISPLAYED TABLES AND FIGURES #} + <div class="panel-group" id="space-for-report-items" role="tablist" aria-multiselectable="true"> + </div> + + </div>{# col-sm-12 #} </div>{# row #} {% endwith %} {% csrf_token %} diff --git a/beat/web/reports/templates/reports/report.html b/beat/web/reports/templates/reports/report.html index 5e816dff5..1fad65da6 100644 --- a/beat/web/reports/templates/reports/report.html +++ b/beat/web/reports/templates/reports/report.html @@ -70,11 +70,18 @@ <script src="{% fingerprint "reports/js/download.js" %}" type="text/javascript" charset="utf-8"></script> <script src="{% fingerprint "reports/app/app.js" %}" type="text/javascript" charset="utf-8"></script> <script src="{% fingerprint "reports/app/app.config.js" %}" type="text/javascript" charset="utf-8"></script> + + <!-- controllers --> <script src="{% fingerprint "reports/app/controllers/reportController.js" %}" type="text/javascript" charset="utf-8"></script> + <script src="{% fingerprint "reports/app/controllers/groupsController.js" %}" type="text/javascript" charset="utf-8"></script> + + <!-- factories --> <script src="{% fingerprint "reports/app/factories/reportFactory.js" %}" type="text/javascript" charset="utf-8"></script> <script src="{% fingerprint "reports/app/factories/experimentFactory.js" %}" type="text/javascript" charset="utf-8"></script> <script src="{% fingerprint "reports/app/factories/plotterFactory.js" %}" type="text/javascript" charset="utf-8"></script> <script src="{% fingerprint "reports/app/factories/dataFactory.js" %}" type="text/javascript" charset="utf-8"></script> + + <!-- services --> <script src="{% fingerprint "reports/app/services/reportService.js" %}" type="text/javascript" charset="utf-8"></script> <!-- directives -- GitLab