swirl/views/stack/new.jet
2018-04-16 17:21:20 +08:00

70 lines
2.6 KiB
Go

{{ extends "../_layouts/default" }}
{{ import "../_modules/form" }}
{{ block style() }}
<link rel="stylesheet" href="/assets/codemirror/codemirror.css?v=5.30">
{{ end }}
{{ block script() }}
<script src="/assets/codemirror/codemirror.js?v=5.30"></script>
<script src="/assets/codemirror/mode/yaml.js?v=5.30"></script>
<script>$(() => new Swirl.Stack.EditPage())</script>
{{ end }}
{{ block body() }}
<section class="hero is-info">
<div class="hero-body">
<div class="container has-text-centered">
<h1 class="title is-2 is-uppercase">{{ i18n("stack.title") }}</h1>
<h2 class="subtitle is-5">{{ i18n("stack.description") }}</h2>
</div>
</div>
</section>
<section class="section">
<div id="div-form" class="container">
<h2 class="title">Create stack archive</h2>
<hr>
<div class="field">
<label class="label">{{ i18n("field.name") }}</label>
<div class="control">
<input id="name" name="name" class="input" type="text" placeholder="" data-v-rule="native;regex" data-v-arg-regex="^[a-z0-9_-]+$" data-v-msg-regex="Name can contain only letters, digits, '_' and '-'." required>
</div>
</div>
<div class="field">
<div class="control">
{{ yield radio(name="type", value="input", label="Input", checked="input") }}
{{ yield radio(name="type", value="upload", label="Upload") }}
</div>
</div>
<div id="div-input" class="field">
<label class="label">Content</label>
<div class="control">
<textarea id="txt-content" name="content" class="textarea" rows="20" placeholder="Compose file content" data-v-rule="content" data-v-arg-content="input" required></textarea>
</div>
</div>
<div id="div-upload" class="field" style="display: none">
<label class="label">Content</label>
<div class="file has-name is-fullwidth">
<label class="file-label">
<input id="file-content" name="content" class="file-input" type="file" data-v-rule="content" data-v-arg-content="upload" required>
<span class="file-cta">
<span class="file-icon">
<i class="fas fa-upload"></i>
</span>
<span class="file-label">Choose a file</span>
</span>
<span id="filename" class="file-name"></span>
</label>
</div>
</div>
<div class="field is-grouped">
<div class="control">
<button id="btn-submit" type="submit" class="button is-primary">{{ i18n("button.submit") }}</button>
</div>
<div class="control">
<a href="/stack/" class="button is-link">{{ i18n("button.cancel") }}</a>
</div>
</div>
</div>
</section>
{{ end }}