Skip to content

Commit

Permalink
adding detail and field as well as css for future use
Browse files Browse the repository at this point in the history
  • Loading branch information
Monaye Win committed Aug 31, 2020
1 parent c2f33e5 commit e35cf3c
Show file tree
Hide file tree
Showing 6 changed files with 127 additions and 74 deletions.
137 changes: 65 additions & 72 deletions dist/js/field.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,74 @@
/******/ __webpack_require__.p = "";
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 1);
/******/ return __webpack_require__(__webpack_require__.s = 0);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, exports, __webpack_require__) {

__webpack_require__(1);
module.exports = __webpack_require__(6);


/***/ }),
/* 1 */
/***/ (function(module, exports, __webpack_require__) {

Nova.booting(function (Vue, router, store) {
Vue.component("index-simple-link-button", __webpack_require__(2));
});

/***/ }),
/* 2 */
/***/ (function(module, exports, __webpack_require__) {

var disposed = false
var normalizeComponent = __webpack_require__(3)
/* script */
var __vue_script__ = __webpack_require__(4)
/* template */
var __vue_template__ = __webpack_require__(5)
/* template functional */
var __vue_template_functional__ = false
/* styles */
var __vue_styles__ = null
/* scopeId */
var __vue_scopeId__ = null
/* moduleIdentifier (server only) */
var __vue_module_identifier__ = null
var Component = normalizeComponent(
__vue_script__,
__vue_template__,
__vue_template_functional__,
__vue_styles__,
__vue_scopeId__,
__vue_module_identifier__
)
Component.options.__file = "resources/js/components/IndexField.vue"

/* hot reload */
if (false) {(function () {
var hotAPI = require("vue-hot-reload-api")
hotAPI.install(require("vue"), false)
if (!hotAPI.compatible) return
module.hot.accept()
if (!module.hot.data) {
hotAPI.createRecord("data-v-9e63f81a", Component.options)
} else {
hotAPI.reload("data-v-9e63f81a", Component.options)
}
module.hot.dispose(function (data) {
disposed = true
})
})()}

module.exports = Component.exports


/***/ }),
/* 3 */
/***/ (function(module, exports) {

/* globals __VUE_SSR_CONTEXT__ */
Expand Down Expand Up @@ -172,69 +235,6 @@ module.exports = function normalizeComponent (
}


/***/ }),
/* 1 */
/***/ (function(module, exports, __webpack_require__) {

__webpack_require__(2);
module.exports = __webpack_require__(13);


/***/ }),
/* 2 */
/***/ (function(module, exports, __webpack_require__) {

Nova.booting(function (Vue, router, store) {
Vue.component("index-simple-link-button", __webpack_require__(3).default);
});

/***/ }),
/* 3 */
/***/ (function(module, exports, __webpack_require__) {

var disposed = false
var normalizeComponent = __webpack_require__(0)
/* script */
var __vue_script__ = __webpack_require__(4)
/* template */
var __vue_template__ = __webpack_require__(5)
/* template functional */
var __vue_template_functional__ = false
/* styles */
var __vue_styles__ = null
/* scopeId */
var __vue_scopeId__ = null
/* moduleIdentifier (server only) */
var __vue_module_identifier__ = null
var Component = normalizeComponent(
__vue_script__,
__vue_template__,
__vue_template_functional__,
__vue_styles__,
__vue_scopeId__,
__vue_module_identifier__
)
Component.options.__file = "resources/js/components/IndexField.vue"

/* hot reload */
if (false) {(function () {
var hotAPI = require("vue-hot-reload-api")
hotAPI.install(require("vue"), false)
if (!hotAPI.compatible) return
module.hot.accept()
if (!module.hot.data) {
hotAPI.createRecord("data-v-9e63f81a", Component.options)
} else {
hotAPI.reload("data-v-9e63f81a", Component.options)
}
module.hot.dispose(function (data) {
disposed = true
})
})()}

module.exports = Component.exports


/***/ }),
/* 4 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
Expand Down Expand Up @@ -288,14 +288,7 @@ if (false) {
}

/***/ }),
/* 6 */,
/* 7 */,
/* 8 */,
/* 9 */,
/* 10 */,
/* 11 */,
/* 12 */,
/* 13 */
/* 6 */
/***/ (function(module, exports) {

// removed by extract-text-webpack-plugin
Expand Down
9 changes: 9 additions & 0 deletions resources/js/components/DetailField.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<template>
<panel-item :field="field" />
</template>

<script>
export default {
props: ['resource', 'resourceName', 'resourceId', 'field'],
}
</script>
47 changes: 47 additions & 0 deletions resources/js/components/FormField.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<template>
<default-field :field="field" :errors="errors">
<template slot="field">
<input
:id="field.name"
type="text"
class="w-full form-control form-input form-input-bordered"
:class="errorClasses"
:placeholder="field.name"
v-model="value"
/>
</template>
</default-field>
</template>

<script>
import { FormField, HandlesValidationErrors } from 'laravel-nova'
export default {
mixins: [FormField, HandlesValidationErrors],
props: ['resourceName', 'resourceId', 'field'],
methods: {
/*
* Set the initial, internal value for the field.
*/
setInitialValue() {
this.value = this.field.value || ''
},
/**
* Fill the given FormData object with the field's internal value.
*/
fill(formData) {
formData.append(this.field.attribute, this.value || '')
},
/**
* Update the field's internal value.
*/
handleChange(value) {
this.value = value
},
},
}
</script>
6 changes: 4 additions & 2 deletions resources/js/field.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
Nova.booting((Vue, router, store) => {
Vue.component("index-simple-link-button", require("./components/IndexField").default);
});
Vue.component('index-simple-link-button', require('./components/IndexField'))
Vue.component('detail-simple-link-button', require('./components/DetailField'))
Vue.component('form-simple-link-button', require('./components/FormField'))
})
1 change: 1 addition & 0 deletions resources/sass/field.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// Nova Tool CSS
1 change: 1 addition & 0 deletions src/FieldServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public function boot()

Nova::serving(function (ServingNova $event) {
Nova::script('simple-link-button', __DIR__.'/../dist/js/field.js');
Nova::style('simple-link-button', __DIR__.'/../dist/css/field.css');
});
}

Expand Down

0 comments on commit e35cf3c

Please sign in to comment.