Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
musonza committed Dec 9, 2018
1 parent eb9251c commit 0f069c7
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 13 deletions.
Binary file modified chat-screen.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
57 changes: 44 additions & 13 deletions public/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -47578,6 +47578,15 @@ Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
//
//
//
//
//
//
//
//
//
//
//
//

/* harmony default export */ __webpack_exports__["default"] = ({
data: function data() {
Expand Down Expand Up @@ -47605,10 +47614,18 @@ Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
showConversation: function showConversation(id) {
window.location.href = "home?conversation_id=" + id;
},
isParticipant: function isParticipant(id) {
return window.conversations.indexOf(id) !== -1;
},
leaveConversation: function leaveConversation(id) {
axios.delete("/conversations/" + id + "/users").then(function (response) {
window.location.href = "home?conversation_id=" + id;
});
},
joinConversation: function joinConversation(id) {
axios.post("/conversations/" + id + "/users").then(function (response) {
window.location.href = "home?conversation_id=" + id;
});
}
},

Expand Down Expand Up @@ -47671,19 +47688,33 @@ var render = function() {
]
),
_vm._v(" |\n "),
_c(
"a",
{
staticClass: "text-danger",
attrs: { href: "#", title: "leave conversation" },
on: {
click: function($event) {
_vm.leaveConversation(convo.id)
}
}
},
[_c("strong", [_vm._v("Leave")])]
)
!_vm.isParticipant(convo.id)
? _c(
"a",
{
staticClass: "text-success",
attrs: { href: "#" },
on: {
click: function($event) {
_vm.joinConversation(convo.id)
}
}
},
[_c("strong", [_vm._v("Join")])]
)
: _c(
"a",
{
staticClass: "text-danger",
attrs: { href: "#", title: "leave conversation" },
on: {
click: function($event) {
_vm.leaveConversation(convo.id)
}
}
},
[_c("strong", [_vm._v("Leave")])]
)
]),
_vm._v(" "),
_c("p")
Expand Down
19 changes: 19 additions & 0 deletions resources/js/components/ChatConversations.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@
<strong class="primary-font">Conversation {{ convo.id }}</strong>
</a> |
<a
v-if="!isParticipant(convo.id)"
href="#"
class="text-success"
@click="joinConversation(convo.id)"
>
<strong>Join</strong>
</a>
<a
v-else
href="#"
class="text-danger"
title="leave conversation"
Expand Down Expand Up @@ -54,10 +63,20 @@ export default {
window.location.href = "home?conversation_id=" + id;
},
isParticipant(id) {
return window.conversations.indexOf(id) !== -1;
},
leaveConversation(id) {
axios.delete(`/conversations/${id}/users`).then(response => {
window.location.href = "home?conversation_id=" + id;
});
},
joinConversation(id) {
axios.post(`/conversations/${id}/users`).then(response => {
window.location.href = "home?conversation_id=" + id;
});
}
},
Expand Down

0 comments on commit 0f069c7

Please sign in to comment.