-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #81 from avored/dev
dev to master
- Loading branch information
Showing
31 changed files
with
1,051 additions
and
328 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?php | ||
use Faker\Generator as Faker; | ||
use AvoRed\Framework\Database\Models\Page; | ||
use Illuminate\Support\Str; | ||
|
||
$factory->define(Page::class, function (Faker $faker) { | ||
$name = $faker->word; | ||
$slug = Str::slug($name); | ||
return [ | ||
'name' => $name, | ||
'slug' => $slug, | ||
'content' => $faker->text(rand(50, 60)) | ||
]; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,80 @@ | ||
<script> | ||
import Draggable from "vuedraggable"; | ||
import isNil from 'lodash/isNil'; | ||
export default { | ||
props: ['categories', 'baseUrl'], | ||
components: { | ||
'draggable': Draggable, | ||
}, | ||
props: ['propCategories', 'baseUrl', 'propMenus', 'menuGroup', 'propFrontMenus'], | ||
data () { | ||
return { | ||
list2: [] | ||
categories: [], | ||
frontMenus: [], | ||
selected: null, | ||
menus: [], | ||
form: this.$form.createForm(this), | ||
menu_json: '', | ||
fields: ['name', 'identifier'] | ||
}; | ||
}, | ||
methods: { | ||
handleSubmit() { | ||
this.pageForm.validateFields((err, values) => { | ||
handleSubmit(e) { | ||
this.form.validateFields((err, values) => { | ||
if (err) { | ||
e.preventDefault(); | ||
} | ||
}); | ||
}); | ||
}, | ||
cancelMenu() { | ||
window.location = this.baseUrl + '/menu'; | ||
handleDrop(data) { | ||
const { index, list, item } = data; | ||
item.id = new Date().getTime(); | ||
list.splice(index, 0, item) | ||
this.menu_json = JSON.stringify(this.menus); | ||
return true | ||
}, | ||
updateMenu(item) { | ||
console.log(item); | ||
handleSubMenuDrop(data) { | ||
const { index, list, item } = data; | ||
item.id = new Date().getTime(); | ||
list.splice(index, 0, item) | ||
this.menu_json = JSON.stringify(this.menus); | ||
return true | ||
}, | ||
cancelMenu() { | ||
location = this.baseUrl + '/menu-group/'; | ||
} | ||
}, | ||
mounted() { | ||
if (!isNil(this.page)) { | ||
this.content = this.page.content; | ||
} | ||
if (!isNil(this.propCategories)) { | ||
this.propCategories.forEach(ele => this.categories.push(ele)); | ||
} | ||
if (!isNil(this.propFrontMenus)) { | ||
Object.keys(this.propFrontMenus).forEach(key => { | ||
this.frontMenus.push(this.propFrontMenus[key]) | ||
}); | ||
} | ||
if (!isNil(this.propMenus)) { | ||
this.propMenus.forEach(ele => this.menus.push(ele)); | ||
} | ||
if (!isNil(this.menus)) { | ||
this.menu_json = JSON.stringify(this.menus); | ||
} | ||
if (!isNil(this.menuGroup)) { | ||
this.fields.forEach(field => { | ||
this.form.getFieldDecorator(field, {initialValue: this.menuGroup[field]}) | ||
}); | ||
} | ||
} | ||
}; | ||
</script> | ||
<style> | ||
.vddl-list, .vddl-draggable { | ||
position: relative; | ||
} | ||
.vddl-list { | ||
min-height: 44px; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
<script> | ||
import isNil from 'lodash/isNil' | ||
const columns = [ | ||
{ | ||
title: 'Name', | ||
dataIndex: 'name', | ||
key: 'name', | ||
sorter: true, | ||
}, | ||
{ | ||
title: 'Identifier', | ||
dataIndex: 'identifier', | ||
key: 'identifier', | ||
sorter: true, | ||
}, | ||
{ | ||
title: 'Action', | ||
key: 'action', | ||
scopedSlots: { customRender: 'action' }, | ||
sorter: false, | ||
width: "10%" | ||
} | ||
]; | ||
export default { | ||
props: ['baseUrl', 'menuGroups'], | ||
data () { | ||
return { | ||
columns | ||
}; | ||
}, | ||
methods: { | ||
handleTableChange(pagination, filters, sorter) { | ||
this.menuGroups.sort(function(a, b){ | ||
let columnKey = sorter.columnKey | ||
let order = sorter.order | ||
if (isNil(a[columnKey])) { | ||
a[columnKey] = '' | ||
} | ||
if (isNil(b[columnKey])) { | ||
b[columnKey] = '' | ||
} | ||
if (order === 'ascend'){ | ||
if(a[columnKey] < b[columnKey]) return -1; | ||
if(a[columnKey] > b[columnKey]) return 1; | ||
} | ||
if (order === 'descend') { | ||
if(a[columnKey] > b[columnKey]) return -1; | ||
if(a[columnKey] < b[columnKey]) return 1; | ||
} | ||
return 0; | ||
}); | ||
}, | ||
getEditUrl(record) { | ||
return this.baseUrl + '/menu-group/' + record.id + '/edit'; | ||
}, | ||
getDeleteUrl(record) { | ||
return this.baseUrl + '/menu-group/' + record.id; | ||
}, | ||
deleteMenuGroup(record) { | ||
var url = this.baseUrl + '/menu-group/' + record.id; | ||
var app = this; | ||
this.$confirm({ | ||
title: 'Do you Want to delete ' + record.name + ' menu-group?', | ||
okType: 'danger', | ||
onOk() { | ||
axios.delete(url) | ||
.then(response => { | ||
if (response.data.success === true) { | ||
app.$notification.error({ | ||
key: 'menu-group.delete.success', | ||
message: response.data.message, | ||
}); | ||
} | ||
window.location.reload(); | ||
}) | ||
.catch(errors => { | ||
app.$notification.error({ | ||
key: 'menu-group.delete.error', | ||
message: errors.message | ||
}); | ||
}); | ||
}, | ||
onCancel() { | ||
// Do nothing | ||
}, | ||
}); | ||
}, | ||
} | ||
}; | ||
</script> |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.