Skip to content

Commit

Permalink
revisi yg benar
Browse files Browse the repository at this point in the history
  • Loading branch information
fadhilsurya committed Sep 11, 2019
1 parent d169e43 commit 371213b
Show file tree
Hide file tree
Showing 1,845 changed files with 978 additions and 176,790 deletions.
17 changes: 0 additions & 17 deletions client/db.json

This file was deleted.

85 changes: 54 additions & 31 deletions client/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,11 @@
<link href="https://fonts.googleapis.com/css?family=Manjari&display=swap" rel="stylesheet">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"
integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"
integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous">
</script>
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"
integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous">
</script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"
integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous">
</script>


<!-- CSS -->
<link rel="stylesheet" href="./css/main.css">
<link rel="stylesheet" href="./vue-wysiwyg-example//vueWysiwyg.css">
<link rel="stylesheet" href="./vueWysiwyg.css">

<title>Easy Press</title>
</head>
Expand Down Expand Up @@ -91,10 +84,35 @@ <h1>Welcome to Simple Post</h1>
<button type="button" class="btn btn-outline-success mt-3 ml-3">Write Article</button>
<button type="button" class="btn btn-outline-info mt-3 ml-3">View all Threads</button>

<form action="" @submit.prevent="searchArt">
<input type="text" id="myInput" placeholder="Search For Articles"
title="Type in a name" style="width: 100%" class="searchBar mt-3"
v-model="searchArticle">
<button href="" type="submit" class="btn btn-primary mt-2">SEARCH</button>
</form>

<br>

<!-- INI BAGIAN UNTUK MENAMPILKAN HASIL SEARCH -->
<div class="row mt-3" style="height: 100vh;width: 100vh;"
v-if="showSearchResult === true">
<div class="addArticle col-11 p-0 container-fluid">
<!-- ISI 1 -->
<div class=" info col m-0 p-0"
style="background-color: whitesmoke; height: 100%; width: 100%">
<p> {{title}} </p>
<p> {{content}}</p>



</div>
</div>
<div class="container" id="sec2bot"></div>
</div>




<!-- <input type="text" id="myInput" onkeyup="myFunction()" placeholder="Search For Articles"
title="Type in a name" style="width: 100%" class="searchBar mt-3"
v-model="searchbar"> -->

</div>
</center>
Expand All @@ -117,7 +135,7 @@ <h1>Welcome to Simple Post</h1>
placeholder="Insert your Title Here" required v-model="title">
</td>
<div id="editor" style="height: 80px; width: 100% ;">
<wysiwyg v-model="input"></wysiwyg>
<wysiwyg v-model="content"></wysiwyg>

</div>

Expand All @@ -138,41 +156,46 @@ <h1>Welcome to Simple Post</h1>
</div>

<br>

<!-- <div class="card bg-light text-dark" v-for="key in articles" v-show="">
<div class="card-body">
<p>{{ key.title}}</p>
<p>{{ key.content}}</p>
<div class="btn-edit-delete"></div>
<button type="button" class="btn btn-outline-primary">Edit</button>
<button type="button" class="btn btn-outline-primary"
@click.prevent="deleteData(key._id)">Delete</button>
<div class="articles" v-if="showLoginHome === true">
<div class="card bg-light text-dark" v-for="key in articles">
<div class="card-body">
<p>{{ key.title}}</p>
<p>{{ key.content}}</p>
<button type="button" class="btn btn-outline-primary"
@click.prevent="editArticle(key._id, key.title, key.content) ">Edit</button>
<button type="button" class="btn btn-outline-primary"
@click.prevent="deleteData(key._id)">Delete</button>
</div>
</div>
</div> -->

</div>

<!-- INI BAGIAN LOGIN EDITNYA -->

<div class="card bg-light text-dark" style="height: 250px">
<div class="card bg-light text-dark" style="height: 250px" v-if="showLoginHome === false">
<div class="container mt-4">
<form action="">
<table class="table-edit">
<tr>
<td>Title</td>
<td><input type="text" name="title" id="title" placeholder="Edit your title"
style="width: 250px; margin-left: 10px" required>
style="width: 250px; margin-left: 10px" v-model="title" required>
</td>
</tr>
<tr>
<td>Content</td>
<td><input type="text" name="email" id="email" placeholder="Edit your title"
style="width: 250px; height:100px; margin-left: 10px" required>
<td><input type="text" name="content" id="content"
placeholder="Edit your content"
style="width: 250px; height:100px; margin-left: 10px" v-model="content"
required>
</td>
</tr>
</table>


</form>
<a href="" class="btn btn-primary mt-2" @click="">SUBMIT</a>
<a href="" class="btn btn-primary mt-2" @click.prevent="updateArticle(idArticle)">SUBMIT</a>
<a href="" class="btn btn-primary mt-2" @click.prevent="backtoHome">HOME</a>

</div>

Expand Down Expand Up @@ -208,8 +231,8 @@ <h1>Welcome to Simple Post</h1>
<link href="https://cdn.quilljs.com/1.3.6/quill.snow.css" rel="stylesheet">
<!-- script vuejs -->
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<script src="./vue-wysiwyg-example/vueWysiwyg.js"></script>
<script src="./style.js"></script>
<script src="./vueWysiwyg.js"></script>
<script src="./main.js"></script>



Expand Down
158 changes: 158 additions & 0 deletions client/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
const baseUrl = 'http://localhost:3000/article'
var app = new Vue({
el: '#app',
data: {
// content: '',
idArticle: '',
articles: [],
title: '',
content: '',
searchArticle: '',
showLoginHome: true,
showSearchResult: false
},
components: {
wysiwyg: vueWysiwyg.default.component,
},

methods: {
fetchdata() {
console.log('halooo')
axios({
method: 'GET',
url: baseUrl
})
.then(({
data
}) => {
this.articles = data.data
console.log(data.data)
})
.catch(err => {
console.log(err)
})
},
postData() {
axios({
method: 'POST',
url: baseUrl,
data: {
title: this.title,
content: this.content
}
})
.then(({
data
}) => {
console.log(data)
})
.catch(err => {
console.log(err)
})

},
deleteData(id) {
console.log(' ke bagian delete ')
console.log(id)
axios({
method: 'DELETE',
url: `${baseUrl}/${id}`,

})
.then(data => {
// console.log(url)
console.log(data)
console.log('berhasil delete')
console.log(id, '<<<< INI IDNYA')
this.fetchdata()
})
.catch(err => {
console.log(id, '<<< INI IDNYA ')
console.log(err, '<<<<< INI ERRNYA')
console.log('gagal delete')

})
},
updateArticle(idArticle) {
console.log(idArticle)

axios({
method: 'PUT',
url: `${baseUrl}/${idArticle}`,
data: {
title: this.title,
content: this.content
}
})
.then(({
data
}) => {
console.log(data, '<<<<< BERHASIL MASUK UPDATE')
this.fetchdata()
this.showLoginHome = true
})
.catch(err => {
console.log(err, '<<<< DATANYA ERROR')
})
},
editArticle(id, title, content) {
console.log('masuk ke edit Article')
this.idArticle = id,
this.title = title,
this.content = content
this.showLoginHome = false
console.log(this.idArticle, '<<< INI ID ARTICLE')
console.log(this.title, '<<< INI TITTLE')
console.log(this.content, '<<< INI CONTENT')
},
backtoHome() {
this.showLoginHome = true
},
searchArt() {
console.log('berhasil masuk ke search art')
console.log(this.searchArticle, '<<<< INI DATA SEARCH ARTICLENYA')
axios({
method: 'GET',
url: `${baseUrl}/${this.searchArticle}`,
})
.then(({
data
}) => {
console.log(data, '<<<<< DATANYA BERHASIL BRO')
this.title = data.data.title
this.content = data.data.content
console.log(data.data.content)
console.log(data.data.title)
this.showSearchResult = true
})
.catch(err => {
console.log(err, '<<<<< INI ERRORNYA DARI SEARCH ARTICLE')
})

}

},
created() {
// apa yang mau diisi statenya? state = data
// pada dasarnya mengisi data yang ada diatas
this.fetchdata()
},
mounted() {
//
},
watch: {
searchArticle: function () {
axios({

})
}
}

})

// var app = new Vue({
// el: '#app',
// data: {
// message: 'Hello Vue!'
// }
// })
1 change: 0 additions & 1 deletion client/node_modules/.bin/is-ci

This file was deleted.

1 change: 0 additions & 1 deletion client/node_modules/.bin/json-server

This file was deleted.

1 change: 0 additions & 1 deletion client/node_modules/.bin/mime

This file was deleted.

1 change: 0 additions & 1 deletion client/node_modules/.bin/rc

This file was deleted.

1 change: 0 additions & 1 deletion client/node_modules/.bin/semver

This file was deleted.

1 change: 0 additions & 1 deletion client/node_modules/.bin/sshpk-conv

This file was deleted.

1 change: 0 additions & 1 deletion client/node_modules/.bin/sshpk-sign

This file was deleted.

1 change: 0 additions & 1 deletion client/node_modules/.bin/sshpk-verify

This file was deleted.

1 change: 0 additions & 1 deletion client/node_modules/.bin/uuid

This file was deleted.

1 change: 0 additions & 1 deletion client/node_modules/.bin/which

This file was deleted.

9 changes: 0 additions & 9 deletions client/node_modules/@sindresorhus/is/license

This file was deleted.

Loading

0 comments on commit 371213b

Please sign in to comment.