Skip to content

Commit

Permalink
configure show in settings
Browse files Browse the repository at this point in the history
  • Loading branch information
cloudstudio committed Mar 20, 2019
1 parent 1e55771 commit 1c753d5
Show file tree
Hide file tree
Showing 4 changed files with 235 additions and 81 deletions.
170 changes: 140 additions & 30 deletions dist/js/tool.js
Original file line number Diff line number Diff line change
Expand Up @@ -20695,7 +20695,11 @@ Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
}
},
setColumnShowIn: function setColumnShowIn() {
this.column.show = 'hideFromIndex';
if (this.settings.show.value) {
this.column.show = this.settings.show.value;
} else {
this.column.show = 'all';
}
if (this.column.name == 'updated_at' || this.column.name == 'created_at' || this.column.name == 'deleted_at') {
this.$set(this.column, 'show', 'disabled');
}
Expand Down Expand Up @@ -25696,6 +25700,36 @@ Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//



Expand Down Expand Up @@ -26196,7 +26230,7 @@ var render = function() {
var _c = _vm._self._c || _h
return _c("div", [
_c("h1", { staticClass: "mb-3 text-90 font-normal text-2xl" }, [
_vm._v("\n " + _vm._s(_vm.__("Generator - Settings")) + "\n ")
_vm._v(_vm._s(_vm.__("Generator - Settings")))
]),
_vm._v(" "),
_c("div", { staticClass: "card" }, [
Expand All @@ -26217,13 +26251,7 @@ var render = function() {
staticClass: "block text-80 pt-2 leading-tight",
attrs: { for: "table" }
},
[
_vm._v(
"\n " +
_vm._s(setting.name) +
"\n "
)
]
[_vm._v(_vm._s(setting.name))]
),
_vm._v(" "),
_c("small", [_vm._v(_vm._s(setting.help))])
Expand Down Expand Up @@ -26268,6 +26296,106 @@ var render = function() {
]
: _vm._e(),
_vm._v(" "),
setting.type == "Select"
? [
_c(
"select",
{
directives: [
{
name: "model",
rawName: "v-model",
value: setting.value,
expression: "setting.value"
}
],
staticClass:
"w-full form-control form-input form-input-bordered px-4",
on: {
input: function($event) {
return _vm.fixBars($event, setting)
},
change: function($event) {
var $$selectedVal = Array.prototype.filter
.call($event.target.options, function(o) {
return o.selected
})
.map(function(o) {
var val =
"_value" in o ? o._value : o.value
return val
})
_vm.$set(
setting,
"value",
$event.target.multiple
? $$selectedVal
: $$selectedVal[0]
)
}
}
},
[
_c("option", { attrs: { value: "all" } }, [
_vm._v("All")
]),
_vm._v(" "),
_c(
"option",
{ attrs: { value: "hideFromIndex" } },
[_vm._v("hideFromIndex")]
),
_vm._v(" "),
_c(
"option",
{ attrs: { value: "hideFromDetail" } },
[_vm._v("hideFromDetail")]
),
_vm._v(" "),
_c(
"option",
{ attrs: { value: "hideWhenCreating" } },
[_vm._v("hideWhenCreating")]
),
_vm._v(" "),
_c(
"option",
{ attrs: { value: "hideWhenUpdating" } },
[_vm._v("hideWhenUpdating")]
),
_vm._v(" "),
_c(
"option",
{ attrs: { value: "onlyOnIndex" } },
[_vm._v("onlyOnIndex")]
),
_vm._v(" "),
_c(
"option",
{ attrs: { value: "onlyOnDetail" } },
[_vm._v("onlyOnDetail")]
),
_vm._v(" "),
_c(
"option",
{ attrs: { value: "onlyOnForms" } },
[_vm._v("onlyOnForms")]
),
_vm._v(" "),
_c(
"option",
{ attrs: { value: "exceptOnForms" } },
[_vm._v("exceptOnForms")]
),
_vm._v(" "),
_c("option", { attrs: { value: "disabled" } }, [
_vm._v("Disabled on views")
])
]
)
]
: _vm._e(),
_vm._v(" "),
setting.type == "Boolean"
? [
_c("toggle-button", {
Expand Down Expand Up @@ -26327,13 +26455,7 @@ var render = function() {
attrs: { type: "button" },
on: { click: _vm.resetCheck }
},
[
_vm._v(
"\n " +
_vm._s(_vm.__("Reset to defaults")) +
"\n "
)
]
[_vm._v(_vm._s(_vm.__("Reset to defaults")))]
)
: _vm._e(),
_vm._v(" "),
Expand All @@ -26345,13 +26467,7 @@ var render = function() {
attrs: { type: "button" },
on: { click: _vm.reset }
},
[
_vm._v(
"\n " +
_vm._s(_vm.__("Are you sure?")) +
"\n "
)
]
[_vm._v(_vm._s(_vm.__("Are you sure?")))]
)
: _vm._e(),
_vm._v(" "),
Expand All @@ -26362,13 +26478,7 @@ var render = function() {
attrs: { dusk: "create-and-add-another-button", type: "button" },
on: { click: _vm.saveSettings }
},
[
_vm._v(
"\n " +
_vm._s(_vm.__("Save options")) +
"\n "
)
]
[_vm._v(_vm._s(_vm.__("Save options")))]
)
])
])
Expand Down
6 changes: 5 additions & 1 deletion resources/js/components/Column.vue
Original file line number Diff line number Diff line change
Expand Up @@ -967,7 +967,11 @@ export default {
},
setColumnShowIn() {
this.column.show = 'hideFromIndex';
if (this.settings.show.value) {
this.column.show = this.settings.show.value;
} else {
this.column.show = 'all';
}
if (
this.column.name == 'updated_at' ||
this.column.name == 'created_at' ||
Expand Down
126 changes: 78 additions & 48 deletions resources/js/components/Settings.vue
Original file line number Diff line number Diff line change
@@ -1,56 +1,86 @@
<template>
<div>
<h1 class="mb-3 text-90 font-normal text-2xl">
{{ __('Generator - Settings') }}
</h1>
<div class="card">
<div class="flex flex-wrap border-b border-40">

<template v-for="setting in settings">
<div class="w-full flex flex-wrap" :key="setting.name">
<div class="w-1/3 px-8 py-6">
<label class="block text-80 pt-2 leading-tight" for="table">
{{ setting.name }}
</label>
<small>{{ setting.help }}</small>
</div>
<div class="w-1/2 px-8 py-6">

<template v-if="setting.type == 'String'">
<input class="w-full form-control form-input" id="resource_name" v-model="setting.value" v-on:input="fixBars($event, setting)">
</template>

<template v-if="setting.type == 'Boolean'">
<toggle-button v-model="setting.value" :sync="true" />
</template>

<template v-if="setting.type == 'Multiple'">
<multiselect v-model="setting.value" :taggable="true" :options="[]" :multiple="true" @tag="addOption($event, setting)"></multiselect>
</template>

</div>
</div>
</template>

<div>
<h1 class="mb-3 text-90 font-normal text-2xl">{{ __('Generator - Settings') }}</h1>
<div class="card">
<div class="flex flex-wrap border-b border-40">
<template v-for="setting in settings">
<div class="w-full flex flex-wrap" :key="setting.name">
<div class="w-1/3 px-8 py-6">
<label class="block text-80 pt-2 leading-tight" for="table">{{ setting.name }}</label>
<small>{{ setting.help }}</small>
</div>
<div class="bg-30 flex px-8 py-4">

<div class="ml-auto">
<button class="btn text-80 font-normal h-9 px-3 mr-3 btn-link" type="button" @click="resetCheck" v-if="!reset_button">
{{ __('Reset to defaults') }}
</button>

<button class="btn text-80 font-normal h-9 px-3 mr-3 btn-link" type="button" @click="reset" v-if="reset_button">
{{ __('Are you sure?') }}
</button>

<button class="ml-auto btn btn-default btn-primary mr-3" dusk="create-and-add-another-button" type="button" @click="saveSettings">
{{ __('Save options') }}
</button>
</div>
<div class="w-1/2 px-8 py-6">
<template v-if="setting.type == 'String'">
<input
class="w-full form-control form-input"
id="resource_name"
v-model="setting.value"
v-on:input="fixBars($event, setting)"
>
</template>

<template v-if="setting.type == 'Select'">
<select
class="w-full form-control form-input form-input-bordered px-4"
v-model="setting.value"
v-on:input="fixBars($event, setting)"
>
<option value="all">All</option>
<option value="hideFromIndex">hideFromIndex</option>
<option value="hideFromDetail">hideFromDetail</option>
<option value="hideWhenCreating">hideWhenCreating</option>
<option value="hideWhenUpdating">hideWhenUpdating</option>
<option value="onlyOnIndex">onlyOnIndex</option>
<option value="onlyOnDetail">onlyOnDetail</option>
<option value="onlyOnForms">onlyOnForms</option>
<option value="exceptOnForms">exceptOnForms</option>
<option value="disabled">Disabled on views</option>
</select>
</template>

<template v-if="setting.type == 'Boolean'">
<toggle-button v-model="setting.value" :sync="true"/>
</template>

<template v-if="setting.type == 'Multiple'">
<multiselect
v-model="setting.value"
:taggable="true"
:options="[]"
:multiple="true"
@tag="addOption($event, setting)"
></multiselect>
</template>
</div>
</div>
</template>
</div>
<div class="bg-30 flex px-8 py-4">
<div class="ml-auto">
<button
class="btn text-80 font-normal h-9 px-3 mr-3 btn-link"
type="button"
@click="resetCheck"
v-if="!reset_button"
>{{ __('Reset to defaults') }}</button>

<button
class="btn text-80 font-normal h-9 px-3 mr-3 btn-link"
type="button"
@click="reset"
v-if="reset_button"
>{{ __('Are you sure?') }}</button>

<button
class="ml-auto btn btn-default btn-primary mr-3"
dusk="create-and-add-another-button"
type="button"
@click="saveSettings"
>{{ __('Save options') }}</button>
</div>
</div>
</div>
</div>
</template>

<script>
Expand Down
Loading

0 comments on commit 1c753d5

Please sign in to comment.