Skip to content

Commit 026e741

Browse files
committed
Merge remote-tracking branch 'origin/master' into todos
2 parents 9e792c7 + f33bb2f commit 026e741

27 files changed

+732
-520
lines changed

README.md

+64-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,69 @@
11
# epochtalk-vue
22

3-
## Project setup
3+
## Project setup from scratch
4+
5+
### Install system dependencies
6+
7+
* homebrew
8+
* install postgresql
9+
* install redis
10+
* install asdf
11+
* setup postgresql
12+
* `
13+
CREATE USER postgres SUPERUSER;
14+
CREATE DATABASE postgres WITH OWNER postgres;
15+
`
16+
* setup asdf
17+
* edit `~./zshrc` and add line to EOF `. $HOME/.asdf/asdf.sh`
18+
* setup node, elixir
19+
* `asdf plugin add nodejs`
20+
* `asdf plugin add erlang`
21+
* `asdf plugin add elixir`
22+
* install project specific versions of node and elixir
23+
* change directories into `epochtalk-vue` project
24+
* run `asdf install`
25+
26+
### Setup epoch database
27+
28+
* checkout epoch `git clone git@github.com:epochtalk/epoch.git`
29+
* change directories to epoch project `cd epoch`
30+
* make sure correct version of elixir is installed `asdf install`
31+
* install deps `mix deps.get`
32+
* run epochtalk database migration `mix ecto.setup`
33+
34+
### Setup old epochtalk project to run as server
35+
36+
* checkout epochtalk `git clone git@github.com:epochtalk/epochtalk.git`
37+
* change directories to epochtalk project `cd epochtalk`
38+
* install deps `yarn install`
39+
* install project specific versions of system deps `asdf install`
40+
* create admin user
41+
* `create-user <username> <email> --password <password> --admin`
42+
* if this fails, attempt to start epochtalk server with and try again
43+
* copy `example.env` to `.env`
44+
* edit `.env`
45+
* comment out `line 40` `# WEBSOCKET_SERVER_KEY_NAME=server.key`
46+
* comment out `line 41` `# WEBSOCKET_SERVER_CERT_NAME=server.crt`
47+
* comment out first section of emailer options `lines 52-62`
48+
* fill out section section your email information (need to check email provider for info on how to setup smtp)
49+
* change `line 34` `WEBSOCKET_SECURE=true` to `WEBSOCKET_SECURE=false`
50+
* enable cors so vue project can access server, edit `/server/server-options.js`
51+
* inside of the `route` object, add the following code
52+
```
53+
cors: {
54+
origin: ['*'],
55+
additionalHeaders: ['cache-control', 'x-requested-with']
56+
},
57+
```
58+
* start the server `yarn serve`
59+
60+
### Start vue project
61+
* change directories into `epochtalk-vue`
62+
* run the server `yarn serve`
63+
* to access new site visit `localhost:8000`
64+
* to access old site/admin panel visit `localhost:8080`
65+
66+
## Standard setup
467
```
568
yarn install
669
```

public/config.js

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ window.images_local_root = 'http://localhost:8080'
99
window.websocket_host = 'localhost'
1010
window.websocket_port = '23958'
1111
window.post_max_length = 10000
12+
window.mobile_break_width = 767
1213
window.max_image_size = 10485760
1314
window.max_avatar_size = 102400
1415
window.portal = { enabled: false }

src/App.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ main {
102102
.main { grid-area: main; }
103103
104104
@include break-mobile-sm {
105-
padding: 2rem 1rem 0;
105+
padding: 0 1rem 0;
106106
107107
#public-content,
108108
.posts #public-content {

src/api/index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ export const usersApi = {
167167
}
168168

169169
export const messagesApi = {
170-
create: data => $http('/api/messages', { method: 'POST', data }),
170+
create: data => $http('/api/messages', { method: 'POST', data }, true),
171171
page: params => $http('/api/messages', { params }),
172172
pageIgnored: params => $http('/api/messages/ignored', { params }),
173173
ignore: data => $http('/api/messages/ignore', { method: 'POST', data }),
@@ -180,7 +180,7 @@ export const messagesApi = {
180180
updateMessageDraft: draft => $http('/api/messages/draft', { method: 'PUT', data: { draft } }),
181181
convos: {
182182
page: (id, params) => $http(`/api/conversations/${id}`, { params }),
183-
create: data => $http('/api/conversations', { method: 'POST', data }),
183+
create: data => $http('/api/conversations', { method: 'POST', data }, true),
184184
delete: id => $http(`/api/conversations/${id}`, { method: 'DELETE' })
185185
}
186186
}

src/assets/scss/_global-components.scss

+53
Original file line numberDiff line numberDiff line change
@@ -708,6 +708,58 @@ input[disabled].toggle-switch:checked + label:after { background-color: lighten(
708708
@include break-mobile-sm { grid-template-columns: 1fr; }
709709
}
710710

711+
// Bottom actions and pagination
712+
.actions-bottom {
713+
border-top: 1px solid $border-color;
714+
position: fixed;
715+
bottom: 0;
716+
right: 0;
717+
left: 0;
718+
background: $base-background-color;
719+
padding: 0.75rem;
720+
z-index: 1000;
721+
&-grid {
722+
display: grid;
723+
grid-template-columns: minmax(0, 3fr) minmax(240px, 1fr);
724+
align-items: center;
725+
column-gap: 2rem;
726+
max-width: $view-maxWidth;
727+
margin: 0 auto;
728+
}
729+
.button {
730+
display: block;
731+
margin-bottom: 0;
732+
width: 100%;
733+
}
734+
}
735+
.pagination-bottom {
736+
justify-self: end;
737+
ul { &.pagination { li { a { font-size: $font-size-sm; } } } }
738+
}
739+
.pagination-wrap {
740+
float: right;
741+
@include break-mobile-sm {
742+
float: unset;
743+
text-align: center;
744+
}
745+
}
746+
747+
@include break-mobile-sm {
748+
.posts {
749+
.actions-bottom {
750+
.actions-bottom-grid {
751+
grid-template-columns: 1fr auto;
752+
align-items: center;
753+
justify-items: center;
754+
column-gap: 1rem;
755+
}
756+
.pagination-bottom {
757+
justify-self: end;
758+
}
759+
}
760+
}
761+
}
762+
711763
.pagination-slide {
712764
grid-template-columns: minmax(0, 3fr) minmax($sidebarWidth, 1fr);
713765
max-width: $view-maxWidth;
@@ -719,6 +771,7 @@ input[disabled].toggle-switch:checked + label:after { background-color: lighten(
719771
.pagination-controls {
720772
display: flex;
721773
justify-self: end;
774+
flex: 1;
722775

723776
button {
724777
background: transparent;

src/components/layout/Editor.vue

+5-5
Original file line numberDiff line numberDiff line change
@@ -192,10 +192,10 @@
192192
<button class="inverted-button cancel" @click="cancel()">
193193
Cancel
194194
</button>
195-
<button class="no-animate send" v-if="editorConvoMode" @click.prevent="createAction(newMessage).then(closeEditor)" :disabled="!canCreate() || !newMessage?.content?.body?.length || !newMessage?.content?.subject?.length || !newMessage?.receiver_ids?.length">
195+
<button class="no-animate send" v-if="editorConvoMode" @click.prevent="createAction(newMessage).then(() => true).catch(() => false).then(c => c ? closeEditor() : null)" :disabled="!canCreate() || !newMessage?.content?.body?.length || !newMessage?.content?.subject?.length || !newMessage?.receiver_ids?.length">
196196
<i class="fa fa-paper-plane" aria-hidden="true"></i>&nbsp;&nbsp;&nbsp;Send
197197
</button>
198-
<button class="no-animate send" v-if="!editorConvoMode" @click.prevent="updateAction(newMessage).then(closeEditor)" :disabled="!canUpdate() || !newMessage?.content?.body?.length">
198+
<button class="no-animate send" v-if="!editorConvoMode" @click.prevent="updateAction(newMessage).then(() => true).catch(() => false).then(c => c ? closeEditor() : null)" :disabled="!canUpdate() || !newMessage?.content?.body?.length">
199199
<i class="fa fa-paper-plane" aria-hidden="true"></i>&nbsp;&nbsp;&nbsp;Send Reply
200200
</button>
201201

@@ -207,7 +207,7 @@
207207
<button class="inverted-button cancel" @click="cancel()">
208208
Cancel
209209
</button>
210-
<button class="send" @click.prevent="post?.id ? updateAction(posting.post).then(closeEditor) : createAction(posting.post).then(closeEditor)" :disabled="post?.id ? !canUpdate(post) : !canCreate()">
210+
<button class="send" @click.prevent="post?.id ? updateAction(posting.post).then(() => true).catch(() => false).then(c => c ? closeEditor() : null) : createAction(posting.post).then(() => true).catch(() => false).then(c => c ? closeEditor() : null)" :disabled="post?.id ? !canUpdate(post) : !canCreate()">
211211
<i class="fa fa-paper-plane" aria-hidden="true"></i>&nbsp;&nbsp;&nbsp;{{ posting?.post?.id ? 'Edit Post' : 'Create Reply' }}
212212
</button>
213213

@@ -219,7 +219,7 @@
219219
<button class="inverted-button cancel" @click="cancel()">
220220
Cancel
221221
</button>
222-
<button class="send" @click.prevent="createAction(threadCopy).then(closeEditor);" :disabled="!threadCopy?.title.length || !canCreate() || (threadCopy?.addPoll && !threadCopy.pollValid)">
222+
<button class="send" @click.prevent="createAction(threadCopy).then(() => true).catch(() => false).then(c => c ? closeEditor() : null);" :disabled="!threadCopy?.title.length || !canCreate() || (threadCopy?.addPoll && !threadCopy.pollValid)">
223223
<i class="fa fa-paper-plane" aria-hidden="true"></i>&nbsp;&nbsp;&nbsp;Start Thread
224224
</button>
225225

@@ -272,7 +272,7 @@ export default {
272272
if (v.editMode || v.quoteMode) return
273273
let rawText = v.posting.post.body || v.threadCopy.body || v.newMessage.content.body
274274
v.draftTimeout = setTimeout(() => saveDraft(), 10000)
275-
if (clear || rawText.length && v.oldDraft !== rawText) {
275+
if (clear || rawText?.length && v.oldDraft !== rawText) {
276276
let draftPromise
277277
if (props.postEditorMode || props.threadEditorMode) {
278278
draftPromise = postsApi.updatePostDraft

src/components/layout/Header.vue

+31-3
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
</a>
6262
</li>
6363
<li @click="showMobileMenu = false" >
64-
<a @click="logout()"><i class="fa fa-sign-out" aria-hidden="true"></i>Logout</a>
64+
<a @click="logout()"><i class="fas fa-sign-out-alt" aria-hidden="true"></i>Logout</a>
6565
</li>
6666
</ul>
6767
</div>
@@ -247,7 +247,9 @@
247247
<register-modal :show="showRegister" @close="showRegister = false" />
248248
</div>
249249
</header>
250-
<div v-if="motdData && motdData.motd_html.length && !hideAnnnouncement" id="motd-spacer"></div>
250+
<div v-if="motdData && motdData.motd_html.length && !hideAnnnouncement" id="motd-spacer-wrap">
251+
<div id="motd-spacer" v-html="motdData?.motd_html"></div>
252+
</div>
251253
</template>
252254

253255
<script>
@@ -1020,6 +1022,7 @@ header {
10201022
@include break-mobile-sm {
10211023
font-size: $font-size-sm;
10221024
line-height: 1.2;
1025+
border-top: 1px solid $breadcrumbs-border-color;
10231026
max-height: 3.7rem;
10241027
padding: 0 1rem;
10251028
}
@@ -1033,5 +1036,30 @@ header {
10331036
}
10341037
}
10351038
1036-
#motd-spacer { height: 1rem; }
1039+
#motd-spacer-wrap {
1040+
@include clearfix();
1041+
@include pad(0 $base-grid-padding);
1042+
margin-bottom: $breadcrumbs-bottom-margin;
1043+
max-height: 3.2rem;
1044+
overflow-y: auto;
1045+
width: 100%;
1046+
position: relative;
1047+
margin-top: -1rem;
1048+
opacity: 0;
1049+
1050+
@include break-mobile-sm {
1051+
font-size: $font-size-sm;
1052+
line-height: 1.2;
1053+
max-height: 3.7rem;
1054+
padding: 0 1rem;
1055+
margin-top: 0;
1056+
}
1057+
1058+
#motd-spacer {
1059+
@include base-layout-width;
1060+
clear: both;
1061+
padding: 0.5rem 0;
1062+
color: #666;
1063+
}
1064+
}
10371065
</style>

src/components/layout/SimplePagination.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -119,11 +119,11 @@ export default {
119119
.pagination {
120120
display: flex;
121121
flex-flow: row;
122-
flex-wrap: wrap;
123122
align-items: center;
124123
margin: 0;
125124
padding: 0;
126125
list-style-type: none;
126+
li { flex: 1; }
127127
}
128128
129129
.pagination-control {
@@ -136,7 +136,7 @@ export default {
136136
display: block;
137137
width: 18px;
138138
height: 18px;
139-
margin: 0 2px;
139+
margin: 0 auto;
140140
fill: $border-color;
141141
&:hover { fill: $border-color; }
142142
&-active {

src/components/modals/auth/Register.vue

+14-7
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
<template>
22
<modal :name="$options.name" :show="show" @close="close()" :focusInput="focusInput">
3-
<template v-slot:header>Register a new account</template>
3+
<template v-slot:header>
4+
<span v-if="showRegisterHideConfirm">Register a new account</span>
5+
<span v-if="!showRegisterHideConfirm">Confirm Account</span>
6+
</template>
47

58
<template v-slot:body>
6-
<form action="." class="css-form">
9+
<form action="." class="css-form" v-if="showRegisterHideConfirm">
710
<div class='input-section'>
811
<label for="email">
912
Email
@@ -104,7 +107,7 @@
104107
</div>
105108

106109
<div class="modal-actions">
107-
<button class="" @click.prevent="register()" :disabled="!form.valid">
110+
<button @click.prevent="register()" :disabled="!form.valid">
108111
Register
109112
</button>
110113

@@ -117,6 +120,11 @@
117120
</div>
118121
</div>
119122
</form>
123+
124+
<div v-if="!showRegisterHideConfirm">
125+
<p>Thank you for registering. Please check your email and confirm your account.</p>
126+
<button @click.prevent="close()">Close</button>
127+
</div>
120128
</template>
121129
</modal>
122130
</template>
@@ -141,10 +149,8 @@ export default {
141149
}
142150
143151
/* Template Methods */
144-
const register = () => {
145-
$auth.register(v.form.email.val, v.form.username.val, v.form.password.val)
146-
close()
147-
}
152+
const register = () => $auth.register(v.form.email.val, v.form.username.val, v.form.password.val)
153+
.then(confirm => confirm ? v.showRegisterHideConfirm = false : close())
148154
149155
const signInWithGoogle = () => {
150156
console.log('Sign in with Google!')
@@ -171,6 +177,7 @@ export default {
171177
const v = reactive({
172178
form: cloneDeep(initForm),
173179
focusInput: null,
180+
showRegisterHideConfirm: true,
174181
hasGoogleCredentials: true
175182
})
176183

0 commit comments

Comments
 (0)