From 426e27d196a87f8eeac3e2c363647c005213722c Mon Sep 17 00:00:00 2001 From: Samuel Gaist <samuel.gaist@idiap.ch> Date: Thu, 10 Sep 2020 17:44:07 +0200 Subject: [PATCH] [libraries][templates] Use file field property to read content Libraries have properties related to their file fields that does the proper handling for reading their content use that. --- beat/web/libraries/templates/libraries/edition.html | 2 +- beat/web/libraries/templates/libraries/panels/editor.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/beat/web/libraries/templates/libraries/edition.html b/beat/web/libraries/templates/libraries/edition.html index 3f5106471..63f198c96 100644 --- a/beat/web/libraries/templates/libraries/edition.html +++ b/beat/web/libraries/templates/libraries/edition.html @@ -192,7 +192,7 @@ <div class="row"> <div class="col-sm-10 col-sm-offset-1"> <label for="source-code">Source code:</label> - <textarea id="source-code">{% if library %}{{ library.source_code_file.read }}{% endif %}</textarea> + <textarea id="source-code">{% if library %}{{ library.source_code }}{% endif %}</textarea> <p class="help">{{ texts.library_code|safe }}</p> </div> </div> diff --git a/beat/web/libraries/templates/libraries/panels/editor.html b/beat/web/libraries/templates/libraries/panels/editor.html index 00c7579f7..ad403976b 100644 --- a/beat/web/libraries/templates/libraries/panels/editor.html +++ b/beat/web/libraries/templates/libraries/panels/editor.html @@ -74,7 +74,7 @@ {% endwith %} {% if open_source %} - <textarea class="form-control" id="code-display">{{ object.source_code_file.read }}</textarea> + <textarea class="form-control" id="code-display">{{ object.source_code }}</textarea> <p class="help-block">{{ texts.code|safe }}</p> {% else %} <div class="alert alert-warning"> -- GitLab