Skip to content

Commit

Permalink
Publishing module assets
Browse files Browse the repository at this point in the history
  • Loading branch information
nWidart committed Nov 20, 2017
1 parent 6bbcd52 commit 7de4857
Show file tree
Hide file tree
Showing 29 changed files with 1,639 additions and 309 deletions.
29 changes: 15 additions & 14 deletions public/modules/core/js/components/DeleteComponent.vue
Original file line number Diff line number Diff line change
@@ -1,55 +1,56 @@
<template>
<button class="btn btn-danger btn-flat" @click="deleteRow"><i class="fa fa-trash"></i></button>
<el-button type="danger" @click="deleteRow" size="mini"><i class="fa fa-trash"></i></el-button>
</template>

<script>
export default {
props: {
rows: {default: null},
scope: {default: null},
rows: { default: null },
scope: { default: null },
},
data() {
return {
deleteMessage: '',
deleteTitle: '',
}
};
},
methods: {
deleteRow(event) {
this.$confirm(this.deleteMessage, this.deleteTitle, {
confirmButtonText: this.trans('core.button.delete'),
cancelButtonText: this.trans('core.button.cancel'),
type: 'warning'
type: 'warning',
confirmButtonClass: 'el-button--danger',
}).then(() => {
let vm = this;
const vm = this;
axios.delete(this.scope.row.urls.delete_url)
.then(response => {
.then((response) => {
if (response.data.errors === false) {
vm.$message({
type: 'success',
message: response.data.message
message: response.data.message,
});
vm.rows.splice(vm.scope.$index, 1);
}
})
.catch(error => {
.catch((error) => {
vm.$message({
type: 'error',
message: error.data.message
message: error.data.message,
});
});
}).catch(() => {
this.$message({
type: 'info',
message: this.trans('core.delete cancelled')
message: this.trans('core.delete cancelled'),
});
});
}
},
},
mounted() {
this.deleteMessage = this.trans('core.modal.confirmation-message');
this.deleteTitle = this.trans('core.modal.title');
}
}
},
};
</script>
20 changes: 20 additions & 0 deletions public/modules/core/js/components/EditButtonComponent.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<template>
<el-button
size="mini"
@click.prevent="goToEditPage()">
<i class="fa fa-pencil"></i>
</el-button>
</template>

<script>
export default {
props: {
to: { type: Object, required: true },
},
methods: {
goToEditPage() {
this.$router.push(this.to);
},
},
};
</script>
6 changes: 3 additions & 3 deletions public/modules/core/js/mixins/ActiveEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default {
if (configuredEditor === 'ckeditor') {
return 'ckeditor';
}
return 'ckeditor'
return 'ckeditor';
},
}
}
},
};
6 changes: 3 additions & 3 deletions public/modules/core/js/mixins/ShortcutHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ export default {
methods: {
pushRoute(route) {
this.$router.push(route);
}
}
}
},
},
};
12 changes: 6 additions & 6 deletions public/modules/core/js/mixins/Slugify.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ export default {
value = value.toLowerCase();

// remove accents, swap ñ for n, etc
var from = "ãàáäâẽèéëêìíïîõòóöôùúüûñç·/_,:;";
var to = "aaaaaeeeeeiiiiooooouuuunc------";
for (var i = 0, l = from.length; i < l; i++) {
const from = 'ãàáäâẽèéëêìíïîõòóöôùúüûñç·/_,:;';
const to = 'aaaaaeeeeeiiiiooooouuuunc------';
for (let i = 0, l = from.length; i < l; i++) {
value = value.replace(new RegExp(from.charAt(i), 'g'), to.charAt(i));
}

Expand All @@ -17,6 +17,6 @@ export default {
.replace(/-+/g, '-'); // collapse dashes

return value;
}
}
}
},
},
};
7 changes: 4 additions & 3 deletions public/modules/core/js/mixins/StringHelpers.vue
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<template>
<div></div>
</template>

<script>
Expand All @@ -8,8 +9,8 @@
return string[0].toUpperCase() + string.substr(1);
},
ucwords(string) {
return string.replace(/\w\S*/g, function(txt){return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();});
}
return string.replace(/\w\S*/g, txt => txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase());
},
},
}
};
</script>
12 changes: 6 additions & 6 deletions public/modules/core/js/mixins/TranslationHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ export default {
trans(string) {
// Makes a string: core.button.cancel | core.button.created at
// to: core["button.cancel"] | core["button.created at"]
let array = string.split('.');
const array = string.split('.');

if (array.length < 2) { return this.$t(string) }
if (array.length < 2) { return this.$t(string); }

let first = array.splice(0,1);
let key = array.join('.');
const first = array.splice(0, 1);
const key = array.join('.');

return this.$t(`${first}['${key}']`);
},
}
}
},
};
8 changes: 4 additions & 4 deletions public/modules/media/js/MediaRoutes.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@ export default [
{
path: '',
component: MediaList,
name: 'admin.media.media.index'
name: 'admin.media.media.index',
},
{
path: ':mediaId/edit',
component: MediaForm,
name: 'admin.media.media.edit',
props: {
locales,
}
},
},
]
}
],
},
];
46 changes: 22 additions & 24 deletions public/modules/media/js/components/MediaForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<div class="col-md-8">
<div class="box box-primary">
<div class="box-body">
<el-tabs type="card" v-model="activeTab">
<el-tabs v-model="activeTab">
<el-tab-pane :label="localeArray.name" v-for="(localeArray, locale) in locales"
:key="localeArray.name" :name="locale">

Expand All @@ -48,7 +48,7 @@

<hr>

<tags-input namespace="asgardcms/media" v-model="tags" :value="tags" :current-tags="tags"></tags-input>
<tags-input namespace="asgardcms/media" v-model="tags" :current-tags="tags"></tags-input>

<el-form-item>
<el-button type="primary" @click="onSubmit()" :loading="loading">
Expand All @@ -64,7 +64,7 @@
</div>
<div class="col-md-4">
<img :src="media.path" alt="" v-if="media.is_image" style="width: 100%;"/>
<i class="fa fa-file" style="font-size: 50px;" v-else=""></i>
<i class="fa fa-file" style="font-size: 50px;" v-else></i>
</div>
</div>
</el-form>
Expand All @@ -84,12 +84,12 @@
</template>

<script>
import Form from 'form-backend-validation'
import axios from 'axios'
import Form from 'form-backend-validation';
import axios from 'axios';
export default {
props: {
locales: {default: null},
locales: { default: null },
},
data() {
return {
Expand All @@ -101,62 +101,60 @@
keywords: '',
}])
.fromPairs()
//.merge({template: 'default', is_home: 0, medias_single: []})
// .merge({template: 'default', is_home: 0, medias_single: []})
.value(),
form: new Form(),
loading: false,
tags: {},
activeTab: window.AsgardCMS.currentLocale || 'en',
}
};
},
methods: {
fetchMedia() {
this.loading = true;
axios.get(route('api.media.media.find', {media: this.$route.params.mediaId}))
.then(response => {
axios.get(route('api.media.media.find', { media: this.$route.params.mediaId }))
.then((response) => {
this.loading = false;
this.media = response.data.data;
this.tags = response.data.data.tags;
})
.catch(error => {
})
});
},
onSubmit() {
this.form = new Form(_.merge(this.media, {tags: this.tags}));
this.form = new Form(_.merge(this.media, { tags: this.tags }));
this.loading = true;
this.form.put(route('api.media.media.update', {file: this.media.id}))
.then(response => {
this.form.put(route('api.media.media.update', { file: this.media.id }))
.then((response) => {
this.loading = false;
this.$message({
type: 'success',
message: response.message
message: response.message,
});
this.$router.push({name: 'admin.media.media.index', query: {folder_id: this.media.folder_id}})
this.$router.push({ name: 'admin.media.media.index', query: { folder_id: this.media.folder_id } });
})
.catch(error => {
.catch((error) => {
console.log(error);
this.loading = false;
this.$notify.error({
title: 'Error',
message: 'There are some errors in the form.'
message: 'There are some errors in the form.',
});
});
},
onCancel() {
if (this.media.folder_id == 0) {
this.$router.push({name: 'admin.media.media.index', query: {}});
this.$router.push({ name: 'admin.media.media.index', query: {} });
return;
}
this.$router.push({name: 'admin.media.media.index', query: {folder_id: this.media.folder_id}})
this.$router.push({ name: 'admin.media.media.index', query: { folder_id: this.media.folder_id } });
},
},
mounted() {
if (this.$route.params.mediaId !== undefined) {
this.fetchMedia();
}
}
}
},
};
</script>
<style>
.el-select{
Expand Down
Loading

0 comments on commit 7de4857

Please sign in to comment.