瀏覽代碼

add update entry page

pull/342/head
Guillaume Vincent 8 年之前
父節點
當前提交
09064f0f4a
共有 3 個文件被更改,包括 61 次插入7 次删除
  1. +51
    -0
      src/app/Entries/UpdateEntry.vue
  2. +3
    -5
      src/app/Index.vue
  3. +7
    -2
      src/router.js

+ 51
- 0
src/app/Entries/UpdateEntry.vue 查看文件

@@ -0,0 +1,51 @@
<template>
<div class="container p-t-2">
<div class="row">
<div class="col-lg-12 bg-card-white">
<div class="row">
<div class="col-sm-12 col-md-10 col-lg-8">
<h4 class="modal-title" id="newEntry">{{{ $t('entry.Update_new_entry') }}}</h4>
<hr>
<entry-form :entry="entry" v-bind:prop.sync></entry-form>
<button type="button" class="btn btn-primary" @click="update()">
{{{ $t('entry.Update') }}}
</button>
</div>
</div>
</div>
</div>
</div>
</template>
<script type="text/ecmascript-6">
import EntryForm from './EntryForm';
import logging from '../../services/logging';
import http from '../../services/http';

export default {
data() {
return {
entry: {}
};
},
components: {
EntryForm,
},
ready(){
http.entries.get(this.$route.params.uuid).then((entry) => {
this.entry = entry
});
},
methods: {
update() {
http.entries.update(this.entry)
.then(() => {

logging.success(this.$t('entries.entry_update'));
})
.catch((err) => {
logging.error(this.$t('entries.error_update'));
});
},
},
};
</script>

+ 3
- 5
src/app/Index.vue 查看文件

@@ -52,9 +52,8 @@
<div class="col-lg-12">
<div class="card-columns">
<div class="card card-block" v-for="entry in entries"
v-on:dblclick="copyPassword(entry)">
<i class="fa fa-pencil-square-o fa-lg edit-icon text-muted"
v-on:click="openEntry(entry)"></i>
@click="openEntry(entry)">
<i class="fa fa-pencil-square-o fa-lg edit-icon text-muted"></i>
<blockquote class="card-blockquote">
<p>{{ entry.site }}</p>
<footer>
@@ -134,8 +133,7 @@
alert('password copied !');
},
openEntry(entry){
alert(`redirect to /app/entries/${entry.id}/`);
// this.$router.go(`/app/entries/${entry.id}/`);
this.$router.go(`/app/entries/${entry.id}/`);
},
filterEntry(query){
this.getEntries(this.limit, this.offset, query);


+ 7
- 2
src/router.js 查看文件

@@ -6,7 +6,8 @@ import App from './App';
import LandingPage from './landing-page/LandingPage';
import LoginPage from './app/Login';
import RegisterPage from './app/Register';
import LessPassConnected from './app/Index';
import LessPassIndex from './app/Index';
import UpdateEntry from './app/Entries/UpdateEntry';
import http from './services/http';

const router = new Router({
@@ -26,7 +27,11 @@ router.map({
},
'/app/': {
auth_required: true,
component: LessPassConnected,
component: LessPassIndex,
},
'/app/entries/:uuid/': {
auth_required: true,
component: UpdateEntry,
},
});



Loading…
取消
儲存