<commit_before>{% extends "/base.html" %}
{% set active_page = "applications" %}
{% import "applications/_helpers.html" as helper %}

{% block content %}
{% from "_formhelpers.html" import render_field %}
<script src="{{url_for('static', filename='vendor/codemirror/codemirror.js')}}"></script>
<link rel="stylesheet" href="{{url_for('static', filename='vendor/codemirror/codemirror.css')}}"/>
<script src="{{url_for('static', filename='vendor/codemirror/mode/xml/xml.js')}}"></script>
<script src="{{url_for('static', filename='vendor/codemirror/mode/javascript/javascript.js')}}"></script>
<script src="{{url_for('static', filename='vendor/codemirror/mode/css/css.js')}}"></script>
<script src="{{url_for('static', filename='vendor/codemirror/mode/htmlmixed/htmlmixed.js')}}"></script>
<style>
    iframe {
        width: 100%;
        height: 320px;
    }
    .CodeMirror {
        width: 700px;
      }
</style>
<div class="row">
    <div class="col-md-3">
        {{ helper.render_app_local_nav(app, 'tasks', current_user) }}
    </div>
    <div class="col-md-9">
        <!-- Task Presenter Editor -->
        <h1><strong>{{app.name}}</strong>: {{ _('Task Presenter Editor') }} <a class="btn btn-lg pull-right" href="http://docs.pybossa.com/en/latest/overview.html#task-presenter"><i class="icon-book"></i> {{ _('Help') }}</a></h1>
        <form role="form" class="form-inline" method="post" action="{{ url_for('app.task_presenter_editor', short_name=app.short_name) }}">
            {{ form.hidden_tag() }}
            <fieldset>
                {{ render_field(form.editor)}}
                <div>
                    <input type="submit" value={{ _('Update the application task presenter') }} class="btn btn-primary" />
                    <a href="#" class="btn btn-info" value="preview"
                        data-toggle="modal" data-target="#modal-preview">{{ _('Preview the task presenter') }}</a>
                    <a href="{{url_for('app.settings', short_name=app.short_name)}}" class="btn btn-info">{{ _('Cancel') }}</a>
                </div>
            </fieldset>
        </form>
    </div>
</div>


<div id="modal-preview" class="modal fade" role="dialog">
  <div class="modal-dialog modal-lg">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title">Modal title</h4>
      </div>
      <div class="modal-body">
          <iframe id="preview" frameborder="0"></iframe>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
      </div>
    </div><!-- /.modal-content -->
  </div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<script>
    var delay;
    var editor = CodeMirror.fromTextArea(document.getElementById('editor'), {
        mode:'text/html',
        lineNumbers: true,
        autofocus: true,
    });

    function updatePreview() {
        var previewFrame = document.getElementById('preview');
        var preview =  previewFrame.contentDocument ||  previewFrame.contentWindow.document;
        preview.open();
        preview.write(editor.getValue());
        preview.close();
    }
</script>
{% endblock %}<commit_msg>Fix for modal.<commit_after>{% extends "/base.html" %}
{% set active_page = "applications" %}
{% import "applications/_helpers.html" as helper %}

{% block content %}
{% from "_formhelpers.html" import render_field %}
<script src="{{url_for('static', filename='vendor/codemirror/codemirror.js')}}"></script>
<link rel="stylesheet" href="{{url_for('static', filename='vendor/codemirror/codemirror.css')}}"/>
<script src="{{url_for('static', filename='vendor/codemirror/mode/xml/xml.js')}}"></script>
<script src="{{url_for('static', filename='vendor/codemirror/mode/javascript/javascript.js')}}"></script>
<script src="{{url_for('static', filename='vendor/codemirror/mode/css/css.js')}}"></script>
<script src="{{url_for('static', filename='vendor/codemirror/mode/htmlmixed/htmlmixed.js')}}"></script>
<style>
    iframe {
        width: 100%;
        height: 320px;
    }
    .CodeMirror {
        width: 700px;
      }
</style>
<div class="row">
    <div class="col-md-3">
        {{ helper.render_app_local_nav(app, 'tasks', current_user) }}
    </div>
    <div class="col-md-9">
        <!-- Task Presenter Editor -->
        <h1><strong>{{app.name}}</strong>: {{ _('Task Presenter Editor') }} <a class="btn btn-lg pull-right" href="http://docs.pybossa.com/en/latest/overview.html#task-presenter"><i class="icon-book"></i> {{ _('Help') }}</a></h1>
        <form role="form" class="form-horizontal" method="post" action="{{ url_for('app.task_presenter_editor', short_name=app.short_name) }}">
            {{ form.hidden_tag() }}
            <fieldset>
                {{ form.editor() }}
                <div>
                    <input type="submit" value={{ _('Update the application task presenter') }} class="btn btn-primary" />
                    <a href="#" class="btn btn-info btn-preview" value="preview">{{ _('Preview the task presenter') }}</a>
                    <a href="{{url_for('app.settings', short_name=app.short_name)}}" class="btn btn-info">{{ _('Cancel') }}</a>
                </div>
            </fieldset>
        </form>
    </div>
</div>


<div id="modal-preview" class="modal fade" role="dialog">
  <div class="modal-dialog modal-lg">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title">Modal title</h4>
      </div>
      <div class="modal-body">
          <iframe id="preview" frameborder="0"></iframe>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
      </div>
    </div><!-- /.modal-content -->
  </div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<script>
    var delay;
    var editor = CodeMirror.fromTextArea(document.getElementById('editor'), {
        mode:'text/html',
        lineNumbers: true,
        autofocus: true,
    });

    function updatePreview() {
        var previewFrame = document.getElementById('preview');
        var preview =  previewFrame.contentDocument ||  previewFrame.contentWindow.document;
        preview.open();
        preview.write(editor.getValue());
        preview.close();
    }
     $(".btn-preview").off('click').on('click', function(){
        updatePreview();
        $("#modal-preview").modal('toggle');
    });
</script>
{% endblock %}
{'fraction_non_alphanumeric': 0.20513203043413397, 'fraction_numerical': 0.00477398179919439, 'mean_word_length': 3.1433868974042025, 'pattern_counts': {'":': 0, '<': 135, '<?xml version=': 0, '>': 135, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '523375', 'n_tokens_mistral': 2127, 'n_tokens_neox': 2046, 'n_words': 369}