Skip to content

Commit db532b2

Browse files
Merge pull request #39 from hacksu/ibm-fall-fest
IBM Fall Fest!
2 parents 7e6d0e4 + d47990b commit db532b2

File tree

10 files changed

+437
-4
lines changed

10 files changed

+437
-4
lines changed

db/entities.js

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,3 +158,47 @@ describeClass(
158158
notesHTML: Fields.string()
159159
}
160160
);
161+
162+
export class Information {
163+
/** @type {string} */
164+
id;
165+
/** @type {string} */
166+
title;
167+
/** @type {string} */
168+
link;
169+
/** @type {string} */
170+
descriptionMD;
171+
/** @type {string} */
172+
descriptionHTML;
173+
/** @type {string | undefined} */
174+
photo;
175+
};
176+
177+
let md_information;
178+
179+
describeClass(
180+
Information,
181+
Entity(
182+
"informations",
183+
{
184+
allowApiRead: true,
185+
allowApiCrud: r=> r.user && r.user.isLeader,
186+
saving: async information => {
187+
if (isBackend()){
188+
if (!md_information) {
189+
md_information = (await import("markdown-it")).default();
190+
}
191+
information.descriptionHTML = md_information.render(information.descriptionMD || "");
192+
}
193+
}
194+
},
195+
),
196+
{
197+
id: Fields.uuid(),
198+
title: Fields.string(),
199+
link: Fields.string(),
200+
descriptionMD: Fields.string(),
201+
descriptionHTML: Fields.string(),
202+
photo: Fields.string()
203+
}
204+
);

public/information-photos/..gitkeep

Whitespace-only changes.

server/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { remultExpress } from "remult/remult-express"
1212
import setUpAuth from "./auth.js";
1313
import setUpUpload from "./upload.js";
1414
import setUpLogging from "./log.js";
15-
import { Redirect, StaffMember, Event, Note } from '../db/entities.js';
15+
import { Redirect, StaffMember, Event, Note, Information } from '../db/entities.js';
1616

1717
let app = express();
1818

@@ -21,7 +21,7 @@ setUpUpload(app);
2121
setUpLogging(app);
2222

2323
// set up db:
24-
const db = remultExpress({ entities: [Redirect, StaffMember, Event, Note] });
24+
const db = remultExpress({ entities: [Redirect, StaffMember, Event, Note, Information] });
2525
app.use(db);
2626

2727
// set up redirects:

server/upload.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,17 @@ export default function setUpUpload(app){
3535
res.send(`/${staffFolderName}/`+req.file.filename);
3636
});
3737

38+
const infoFolderName = "information-photos";
39+
app.use("/information-photo-upload", makePhotoReceiver(infoFolderName), async (req, res) =>{
40+
const buffer = await sharp(req.file.path)
41+
.resize(800, 800, {
42+
fit: sharp.fit.inside,
43+
withoutEnlargement: true,
44+
}).toBuffer();
45+
await sharp(buffer).toFile(req.file.path);
46+
res.send(`/${infoFolderName}/`+req.file.filename);
47+
});
48+
3849
const eventFolderName = "event-photos";
3950
const maxEventPhotoWidth = 1000;
4051
const eventPhotoAR = 2.5;

src/components/InformationCard.vue

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
<template>
2+
<div class="information-container">
3+
<div class="information-photo" v-if="information.photo">
4+
<img class="information-image" :src="information.photo" alt="">
5+
</div>
6+
<div class="information">
7+
<component class="information-title" :is="information.link ? 'a' : 'span'" :href="information.link" target="_blank" style="color:white">
8+
<img class="external-link" v-if="information.link.startsWith('https://github.com')"
9+
style="height: 30px" src="@/assets/images/github-white.svg" />
10+
<img v-else-if="information.link" style="height: 26px;margin-right:10px" src="@/assets/external-link.svg" />
11+
<h2>{{ information.title }}</h2>
12+
</component>
13+
<div class="event-text" v-if="information.descriptionHTML" v-html="information.descriptionHTML"></div>
14+
</div>
15+
</div>
16+
</template>
17+
18+
<script setup>
19+
defineProps(["information"]);
20+
</script>
21+
22+
<style scoped lang="scss">
23+
.information-container {
24+
background: linear-gradient(90deg, rgb(155, 76, 187) 0%, rgb(157, 77, 185) 24%, rgb(161, 78, 194) 32%, rgb(171, 82, 203) 100%);
25+
opacity: 0.975;
26+
border-radius: 15px;
27+
display: flex;
28+
flex-direction: row-reverse;
29+
justify-content: left;
30+
margin: 0 auto 40px auto;
31+
&:first-of-type {
32+
margin-top: 50px;
33+
}
34+
max-width: 1000px;
35+
box-shadow: 4px 6px 4px rgba(0, 0, 0, 0.15);
36+
padding-bottom: 0px;
37+
overflow: hidden;
38+
text-align: left;
39+
40+
// allow this item to shrink to less than its natural height when necessary;
41+
// the .event-text element inside the .event element will then shrink and
42+
// become scrollable due to tose elements' css
43+
min-height: 0;
44+
flex-shrink: 1;
45+
}
46+
.information {
47+
&>* {
48+
padding: 0 24px;
49+
}
50+
display: flex;
51+
flex-direction: column;
52+
53+
// allow this item to shrink to less than its natural height when necessary;
54+
// the .event-text element will shrink and become scrollable due to its css
55+
min-height: 0;
56+
flex-shrink: 1;
57+
58+
min-width: 60%;
59+
font-size: 1rem;
60+
&:deep(a:visited), &:deep(a) {
61+
color: white;
62+
}
63+
h2 {
64+
display: inline;
65+
font-size: 1.5rem;
66+
margin: 0;
67+
}
68+
}
69+
.information-photo {
70+
max-width: 40%;
71+
height: auto;
72+
background-repeat: no-repeat;
73+
background-position: center;
74+
}
75+
76+
.information-image{
77+
width: 100%; /* Set the width to 35% of the container */
78+
height: 100%;
79+
background-repeat: no-repeat;
80+
background-position: center;
81+
object-fit: cover;
82+
}
83+
84+
.information-title {
85+
margin: 12px 0 8px;
86+
// text-decoration: none;
87+
display: flex;
88+
align-items: center;
89+
}
90+
.information-text {
91+
scrollbar-width: thin;
92+
&::-webkit-scrollbar {
93+
width: 6px;
94+
}
95+
// allow this element to shrink when necessary, causing the text inside it
96+
// to scroll
97+
min-height: 0;
98+
flex-shrink: 1;
99+
}
100+
.external-link {
101+
margin-right: 10px;
102+
}
103+
strong {
104+
font-weight: 600;
105+
}
106+
</style>

src/components/Navigation.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ export default {
3131
['Meetings', '/meetings'],
3232
['Leadership', '/leadership'],
3333
['Contact', '/contact'],
34+
['IBM Fall Fest!','/ibm']
3435
];
3536
if (loggedIn.value){
3637
buttons.push(

src/router/index.js

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ import Admin from "../views/Admin.vue";
99
import EditStaff from "../views/EditStaff.vue";
1010
import EditEvents from "../views/EditEvents.vue";
1111
import EditNotes from "../views/EditNotes.vue";
12-
import AdminMeetings from "../views/AdminMeetings.vue"
12+
import AdminMeetings from "../views/AdminMeetings.vue";
13+
import FallFest from "../views/FallFest.vue";
14+
import AdminInformation from "../views/AdminInformation.vue";
1315

1416
export const routes = [
1517
{
@@ -66,6 +68,15 @@ export const routes = [
6668
},
6769
component: Meetings,
6870
},
71+
{
72+
path: '/ibm',
73+
name: "IBM Fall Fest",
74+
meta: {
75+
title: "IBM Fall Fest!",
76+
description: "Infomration about our collaboration with IBM, Case Western Reserve University, and Cleveland State University."
77+
},
78+
component: FallFest,
79+
},
6980
{
7081
path: "/admin",
7182
name: "Admin Stuff",
@@ -113,5 +124,13 @@ export const routes = [
113124
meta: {
114125
admin: true
115126
}
116-
}
127+
},
128+
{
129+
path: "/admin/informations",
130+
name: "Information Editor",
131+
component: AdminInformation,
132+
meta: {
133+
admin: true
134+
}
135+
},
117136
];

src/views/Admin.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
<li><router-link to="/admin/redirects">Redirect Links</router-link></li>
66
<li><router-link to="/admin/staff">Staff Page Editor</router-link></li>
77
<li><router-link to="/admin/events">Events Editor</router-link></li>
8+
<li><router-link to="/admin/informations">Information Cards Editor</router-link></li>
89
<li><router-link to="/admin/notes">Meeting Notes (edit)</router-link></li>
910
<li><router-link to="/admin/meetings">Meeting Notes (view)</router-link></li>
1011
<li><a href="/audit-log">DB Edit Log</a></li>

0 commit comments

Comments
 (0)