Convert to Haml

But we cannot use b-collapse and v-b-toggle here.
Because `v-b-toggle="id"` does not reactive.

Signed-off-by: Kenji Okimoto <okimoto@clear-code.com>
This commit is contained in:
Kenji Okimoto 2018-10-04 17:44:10 +09:00
parent b715a0288e
commit 7feeeeb17a
No known key found for this signature in database
GPG Key ID: F9E3E329A5C5E4A1
2 changed files with 20 additions and 25 deletions

View File

@ -1,25 +0,0 @@
<%- add_javascript_pack_tag('codemirror') %>
<script type="text/x-template" id="vue-setting-section">
<div class="card card-primary mb-3">
<div class="card-header" data-toggle="collapse" v-bind:href="'#'+id" v-bind:title="content">
<i class="fa fa-caret-down"></i>
{{ type }}
<span v-if="!_.isEmpty(arg) && (name == 'match' || name == 'filter')">({{ arg }})</span>
</div>
<div class="card-body collapse" v-bind:id="id">
<pre v-if="mode != 'edit'">{{ content }}</pre>
<p v-if="mode == 'edit'">
<textarea v-config-editor class="form-control" v-model.lazy="content" v-bind:disabled="processing"></textarea>
</p>
<p class="float-right">
<button v-if="mode != 'edit'" class="btn btn-secondary" v-on:click="onEdit"><%= t('terms.edit') %></button>
<button v-if="mode != 'edit'" class="btn btn-danger" v-on:click="onDelete"><%= t('terms.destroy') %></button>
<button v-if="mode == 'edit'" class="btn btn-secondary" v-on:click="onCancel"><%= t('terms.cancel') %></button>
<button v-if="mode == 'edit'" class="btn btn-primary" v-on:click="onSubmit"><%= t('terms.save') %></button>
</p>
</div>
</div>
</script>

View File

@ -0,0 +1,20 @@
- add_javascript_pack_tag('codemirror')
%script{"type" => "text/x-template", "id" => "vue-setting-section"}
%b-card.mb-3(no-body){"variant" => "primary"}
%template{"slot" => "header"}
%div{"data-toggle" => "collapse", "v-bind:href" => "`#${id}`", "v-bind:title" => "content"}
= icon("fa-caret-down")
{{ type }}
%span{"v-if" => '!_.isEmpty(arg) && (name == "match" || name == "filter")'}
({{ arg }})
%b-card-body.collapse{"v-bind:id" => "id"}
%pre{"v-if" => 'mode !== "edit"'}
{{ content }}
%p{"v-if" => 'mode === "edit"'}
%textarea.form-control(v-config-editor){"v-model.lazy" => "content", "v-bind:disabled" => "processing"}
%p.float-right
%b-button{"v-if" => 'mode !== "edit"', "variant" => "secondary", "v-on:click" => "onEdit"}=t("terms.edit")
%b-button{"v-if" => 'mode !== "edit"', "variant" => "danger", "v-on:click" => "onDelete"}=t("terms.destroy")
%b-button{"v-if" => 'mode === "edit"', "variant" => "secondary", "v-on:click" => "onCancel"}=t("terms.cancel")
%b-button{"v-if" => 'mode === "edit"', "variant" => "primary", "v-on:click" => "onSubmit"}=t("terms.save")