Skip to content

Commit

Permalink
Merge pull request #81 from avored/dev
Browse files Browse the repository at this point in the history
dev to master
  • Loading branch information
indpurvesh authored Aug 9, 2019
2 parents d16f0a4 + 90624f6 commit f3a06a0
Show file tree
Hide file tree
Showing 31 changed files with 1,051 additions and 328 deletions.
4 changes: 4 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ jobs:
- image: circleci/php:7-fpm-browsers-legacy
steps:
- checkout

- run:
name: "Install Json Extension"
command: sudo apt-get update && sudo docker-php-ext-install -j$(nproc) json
- run:
name: "install composer dependency"
command: composer install
Expand Down
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# Core package for avored shopping cart
AvoRed Framework contains the core features for the AvoRed E commerce for Laravel. It is the base behind the AvoRed an Laravel Ecommerce.

[![Coverage Status](https://coveralls.io/repos/github/avored/framework/badge.svg?branch=master)](https://coveralls.io/github/avored/framework?branch=master)

#### Installation
AvoRed E commerce framework provided as a composer package so it make installation of the avored is much easier as

Expand Down
14 changes: 14 additions & 0 deletions database/factories/PageFactory.php
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))
];
});
Original file line number Diff line number Diff line change
Expand Up @@ -242,8 +242,7 @@ public function up()
$table->unsignedBigInteger('menu_group_id');
$table->integer('parent_id')->nullable()->default(null);
$table->string('name')->nullable()->default(null);
$table->string('route')->nullable()->default(null);
$table->string('params')->nullable()->default(null);
$table->string('url')->nullable()->default(null);
$table->integer('sort_order')->default(0);
$table->timestamps();
$table->foreign('menu_group_id')->references('id')->on('menu_groups')->onDelete('cascade');
Expand Down
70 changes: 57 additions & 13 deletions resources/components/cms/menu/MenuSave.vue
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>
94 changes: 94 additions & 0 deletions resources/components/cms/menu/MenuTable.vue
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>
52 changes: 0 additions & 52 deletions resources/components/cms/menu/MenuTree.vue

This file was deleted.

5 changes: 4 additions & 1 deletion resources/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ window.Vue = require('vue');
// files.keys().map(key => Vue.component(key.split('/').pop().split('.')[0], files(key).default));
import Antd from 'ant-design-vue'
import VueQuillEditor from 'vue-quill-editor'
import Vddl from 'vddl'

Vue.use(Antd);
Vue.use(Vddl)
Vue.use(Antd)
Vue.use(VueQuillEditor);

Vue.component('order-table', require('../components/order/order/OrderTable.vue').default);
Expand Down Expand Up @@ -63,6 +65,7 @@ Vue.component('category-save', require('../components/catalog/category/CategoryS
Vue.component('configuration-save', require('../components/system/configuration/ConfigurationSave.vue').default);

Vue.component('menu-save', require('../components/cms/menu/MenuSave.vue').default);
Vue.component('menu-table', require('../components/cms/menu/MenuTable.vue').default);

Vue.component('page-table', require('../components/cms/page/PageTable.vue').default);
Vue.component('page-save', require('../components/cms/page/PageSave.vue').default);
Expand Down
14 changes: 12 additions & 2 deletions resources/lang/en/cms.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,19 @@
],
],
'menu' => [
'title' => 'Frontend Menus',
'index' => [
'title' => 'Menus'
],
'create' => [
'title' => 'Menu Builder'
],
'name' => 'Menu Group Name',
'identifier' => 'Menu Group Identifier',
'builder' => 'Menu Builder',
'category_list' => 'Categories',
'frontmenu_list' => 'Front Menus',
'create' => [
'title' => 'Frontend Menus'
'title' => 'Menu Builder'
]
],

Expand Down
16 changes: 16 additions & 0 deletions resources/less/app.less
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,23 @@
top: 5px;
right: 0px;
}
.menu-save-page{

.vddl-placeholder {
background: @primary-color;
margin: 10px 0;
padding: 5px 0;
}
.menu-builder-list {
padding: 10px;
.menu-item {
padding: 10px 5px;
border: 1px solid #cecece;
margin-bottom: 10px;
cursor: move;
}
}
}
.header-avtar .anticon {
margin-right: 0px;
}
Expand Down
Loading

0 comments on commit f3a06a0

Please sign in to comment.