{% extends "base.html" %} {% 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 %} {% comment %} This template can be called in 4 different ways, depending on what the user wants to achieve. It always receives the "texts" variable, the "op" variable, and the "visible_libraries" variable, plus a number of other objects depending on the callee: 1. If called to create a new contribution, it does not receive anything else. "op == new" 2. If called to create a new version of a contribution, it receives the previous version at `library`. "op == new_version" 3. If called to fork a contribution, it receives the forked version on `library`. "op == fork" 4. Finally, if called to edit an existing contribution, it receives the contribution itself in `library`. "op == edit" You'll see switches on the code below, accomodating each of these 4 use cases. {% endcomment %} {% load ui_tags %} {% load fingerprint %} {% block title %} {{ block.super }} - {% if not library %}New library{% else %}{% if op == "new-version" %}Create{% elif op == "fork" %}Fork{% else %}Edit{% endif %} {{ library.fullname }}{% endif %} {% endblock %} {% block stylesheets %} {{ block.super }} {% code_editor_css %} {% endblock %} {% block scripts %} {{ block.super }} {% csrf_token %} {% code_editor_scripts "python" %} {% endblock %} {% block content %}

{# Setup hidden fields with presets of fields that change with "op" #} {% if op == "fork" or op == "new" %}

{{ texts.name }}

{% endif %} {# uses libraries #}

Libraries may use functions and classes declared in other libraries. You should choose here the libraries to use (if any) and what will be the import name we shall use for that piece of code. You don't need to import the library manually on your code, the platform will do it for you. Just use the object as it has been imported with the selected named. For example, if you choose to import a library using the name lib, then access function f within your code like lib.f().

{# occupies most of the space #}
{# existing table #} {% if visible_libraries %} {% if library %} {% for k,v in library.uses.items %} {% endfor %} {% endif %}
LibraryImport as
{% else %} No other libraries available to you at this moment. {% endif %}

{{ texts.uses|safe }}

{{ texts.library_code|safe }}

{% endblock %}