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

98 lines
3.5 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>
<div class="container">
<nav class="breadcrumb has-succeeds-separator is-small is-marginless" aria-label="breadcrumbs">
<ul>
<li><a href="/">{{ i18n("menu.home") }}</a></li>
<li><a href="/stack/">{{ i18n("menu.stack") }}</a></li>
<li class="is-active"><a>{{ i18n("menu.edit") }}</a></li>
</ul>
</nav>
</div>
<section class="hero is-small is-light">
<div class="hero-body">
<div class="container">
<h2 class="title is-2">
{{ .Stack.Name }}
</h2>
</div>
</div>
</section>
<nav class="navbar has-shadow">
<div class="container">
<div class="navbar-brand">
<a class="navbar-item is-tab" href="/stack/{{.Stack.Name}}/detail">{{ i18n("menu.detail") }}</a>
<a class="navbar-item is-tab is-active" href="/stack/{{.Stack.Name}}/edit">{{ i18n("menu.edit") }}</a>
</div>
</div>
</nav>
<section class="section">
<div id="div-form" class="container">
<div class="field">
<label class="label">{{ i18n("field.name") }}</label>
<div class="control">
<input id="name" name="name" class="input" value="{{ .Stack.Name }}" 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>{{ .Stack.Content }}</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" data-url="update">{{ i18n("button.submit") }}</button>
</div>
<div class="control">
<a href="/stack/" class="button is-link">{{ i18n("button.cancel") }}</a>
</div>
</div>
</div>
</section>
{{ end }}