<form action="{{ url_for('jsondash.update') if view else url_for('jsondash.create') }}" class="well" id="save-view-form" method="POST" role="form">
    <button class="pull-right btn btn-lg btn-primary"><span class="fa fa-check"></span> {% if view %}update{% else %}save{% endif %} layout</button>
    {% if view %}
        <input type="hidden" name="id" value="{{ view.id }}">
    {% endif %}
    <label>
        View Name <input class="form-control" type="text" name="name" value="{% if view %}{{ view.name }}{% endif %}" placeholder="name">
    </label>
    <div class="modules hidden">
        {% if view %}
        {% for module in view.modules %}
        <input type="text" id="{{ module.guid }}" class="form-control" name="module_{{ module.name }}" value="{{ module|jsonstring }}">
        {% endfor %}
        {% endif %}
    </div>
    {% if view %}
    <a href="#chart-options" id="add-module" class="btn btn-md btn-success" data-toggle="modal">
        <span class="fa fa-plus"></span> Add module
    </a>
    {% endif %}
</form>
