Skip to content

Commit 809b964

Browse files
authored
Link some pages from footer (#281)
* Link some pages from footer - adds Website#footer_categories string array field populated with help of selectized js tags - adds Page#footer_category to indicate that a page should be linked in a footer category - wires up the footer category/links and other dynamic content and elements as well - wires up the header navigation to more closely match the design - fixes image resizing for svgs with resize_image_tag helper method - ensures pages don't blow up with images are not attached - adds link to register page when matching page slug exists [Link some pages from footer](https://miro.com/app/board/uXjVO6C1LxA=/?moveToWidget=3458764523893158753&cot=14)
1 parent bdf9b10 commit 809b964

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+428
-167
lines changed
Lines changed: 1 addition & 1 deletion
Loading

app/assets/javascripts/base.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,17 @@ $(document).ready(function() {
55
setTimeout(function() {
66
$(".alert").not('.alert-confirm, .scheduling-error').alert('close');
77
}, 5000);
8+
9+
$(".selectize-tags").selectize({
10+
delimiter: ",",
11+
persist: false,
12+
create: function (input) {
13+
return {
14+
value: input,
15+
text: input,
16+
};
17+
},
18+
});
819
});
920

1021
// Datatable extension for reseting sort order

app/assets/stylesheets/themes/default/application.scss

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88

99
:root {
1010
--body_background_color: white;
11-
--nav_background_color: white;
12-
--nav_text_color: black;
11+
--nav_background_color: black;
12+
--nav_text_color: white;
1313
--nav_link_hover: black;
1414
--main_content_background: white;
1515
--sans-serif-font: 'Rubik';
@@ -39,7 +39,7 @@ body {
3939

4040
header + #content {
4141
background-color: var(--main_content_background);
42-
margin-top: 50px;
42+
margin-top: 110px;
4343
}
4444

4545
p {
@@ -83,4 +83,7 @@ h3.section-title {
8383

8484
@media screen and (max-width: 900px) and (orientation: portrait),
8585
(max-width: 823px) and (orientation: landscape) {
86+
header + #content {
87+
margin-top: 90px;
88+
}
8689
}
Lines changed: 114 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,132 @@
11
footer {
2-
display: grid;
3-
width: 100%;
4-
border-top: 1px solid $divider-light;
5-
grid-template-columns: 1fr 1fr;
6-
padding: 20px 30px 35px;
7-
8-
.footer-event-details {
9-
border-bottom: 1px solid $divider-light;
10-
padding-bottom: 20px;
2+
color: white;
3+
.overlay {
4+
background-color: black !important;
5+
opacity: 0.9 !important;
6+
padding: 20px 30px 35px;
7+
}
8+
.footer-header {
119
.logo-container {
10+
display: flex;
11+
align-items: center;
1212
margin-bottom: 20px;
13-
14-
.website-event-logo {
15-
height: 36px;
16-
width: 36px;
17-
background-color: $grey-logo;
18-
border-radius: 3px;
19-
margin-bottom: 0;
20-
}
21-
a {
22-
text-decoration: none;
23-
font-weight: 700;
13+
.website-info {
14+
margin-left: 10px;
15+
a {
16+
text-decoration: none;
17+
font-weight: 700;
18+
font-size: 18px;
19+
}
2420
}
2521
}
22+
}
2623

27-
.footer-social-links {
28-
display: flex;
29-
flex-direction: row;
30-
align-items: center;
31-
a {
32-
width: 30px;
33-
height: 30px;
34-
display: inline-block;
35-
margin: 0 6px 0 0;
36-
&:hover {
37-
transform: translateX(2px);
24+
.footer-content {
25+
display: grid;
26+
width: 100%;
27+
grid-template-columns: 1fr 1fr;
28+
gap: 40px;
29+
border-bottom: 1px solid white;
30+
@media screen and (max-width: 900px) and (orientation: portrait),
31+
(max-width: 823px) and (orientation: landscape) {
32+
grid-template-columns: 1fr;
33+
}
34+
35+
.footer-event-details {
36+
max-width: 470px;
37+
padding-bottom: 20px;
38+
.location-section {
39+
display: flex;
40+
div {
41+
flex-grow: 1
42+
}
43+
.location-details {
44+
padding-bottom: 20px;
45+
.date {
46+
font-weight: 700;
47+
font-size: 16px;
48+
padding-bottom: 5px;
49+
}
50+
.location {
51+
p {
52+
line-height: 10px;
53+
}
54+
}
55+
}
56+
.register-button {
57+
color: #E14943;
58+
background-color: white;
59+
padding: 10px 20px;
60+
border-radius: 4px;
61+
&:hover {
62+
transform: translateX(2px) translateY(-2px);
63+
}
3864
}
3965
}
40-
.twitter-link {
41-
background: asset-url('themes/default/twitter-icon.svg') center center no-repeat;
42-
}
43-
.facebook-link {
44-
background: asset-url('themes/default/fb-icon.svg') center center no-repeat;
66+
67+
.footer-about {
68+
padding-bottom: 20px;
69+
p {
70+
font-weight: 400;
71+
}
72+
p:first-child {
73+
font-weight: 700;
74+
}
4575
}
46-
.instagram-link {
47-
background: asset-url('themes/default/instagram-icon.svg') center center no-repeat;
76+
77+
.footer-social-links {
78+
display: flex;
79+
flex-direction: row;
80+
align-items: center;
81+
a {
82+
width: 30px;
83+
height: 30px;
84+
display: inline-block;
85+
margin: 0 6px 0 0;
86+
&:hover {
87+
transform: translateX(2px);
88+
}
89+
}
90+
.twitter-link {
91+
background: asset-url('themes/default/twitter-icon.svg') center center no-repeat;
92+
}
93+
.facebook-link {
94+
background: asset-url('themes/default/fb-icon.svg') center center no-repeat;
95+
}
96+
.instagram-link {
97+
background: asset-url('themes/default/instagram-icon.svg') center center no-repeat;
98+
}
4899
}
49100
}
50-
}
51101

52-
.footer-event-links {
53-
align-self: end;
54-
border-bottom: 1px solid $divider-light;
55-
padding-bottom: 20px;
102+
.footer-event-links {
103+
display: flex;
104+
flex-wrap: wrap;
105+
.footer-category-links {
106+
flex-grow: 1;
107+
margin-right: 40px;
108+
margin-bottom: 40px;
56109

57-
a {
58-
display: inline-block;
59-
margin-right: 10px;
60-
text-decoration: none;
110+
.footer-category-name {
111+
font-weight: 700;
112+
}
61113

62-
&:hover {
63-
transform: translateX(2px) translateY(-2px);
114+
a {
115+
display: inline-block;
116+
margin-right: 10px;
117+
text-decoration: none;
118+
padding-top: 20px;
119+
&:hover {
120+
transform: translateX(2px) translateY(-2px);
121+
}
122+
}
64123
}
65124
}
125+
}
66126

127+
.footer-copyright {
128+
text-align: center;
129+
font-size: 14px;
130+
margin-top: 20px;
67131
}
68-
}
132+
}

app/assets/stylesheets/themes/default/nav.scss

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,31 @@
11
#main-header {
22
position: fixed;
33
top: 0;
4-
padding: 10px;
5-
display: flex;
6-
flex-direction: row;
7-
justify-content: space-between;
8-
align-items: center;
94
width: 100%;
10-
background: var(--nav_background_color);
115
color: var(--nav_text_color);
126
z-index: 11;
137

8+
.overlay {
9+
padding: 30px;
10+
background: var(--nav_background_color);
11+
opacity: 0.9;
12+
display: flex;
13+
justify-content: space-between;
14+
align-items: center;
15+
}
16+
1417
#header-logo-container {
1518
display: flex;
1619
align-items: center;
1720
margin-left: 10px;
1821

19-
.website-event-logo {
20-
display: block;
21-
height: 36px;
22-
width: 36px;
23-
margin-right: 5px;
24-
background: $grey-logo;
25-
border-radius: 3px;
22+
.website-info {
23+
margin-left: 10px;
24+
a {
25+
text-decoration: none;
26+
font-weight: 700;
27+
font-size: 18px;
28+
}
2629
}
2730
}
2831

@@ -52,7 +55,8 @@
5255

5356
@media screen and (max-width: 900px) and (orientation: portrait),
5457
(max-width: 823px) and (orientation: landscape) {
55-
#main-header{
58+
#main-header .overlay{
59+
padding: 20px;
5660
z-index: 20;
5761
flex-direction: column;
5862
align-items: start;

app/controllers/staff/pages_controller.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ def page_params
9595
:hide_page,
9696
:hide_header,
9797
:hide_footer,
98+
:footer_category,
9899
:unpublished_body
99100
)
100101
end

app/controllers/staff/websites_controller.rb

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ def create
99
@website.update(website_params)
1010

1111
flash[:success] = "Website was successfully created."
12-
redirect_to event_staff_path(current_event)
12+
redirect_to edit_event_staff_website_path(current_event)
1313
end
1414

1515
def edit; end
@@ -18,7 +18,7 @@ def update
1818
@website.update(website_params)
1919

2020
flash[:success] = "Website was successfully updated."
21-
redirect_to event_staff_path(current_event)
21+
redirect_to edit_event_staff_website_path(current_event)
2222
end
2323

2424
private
@@ -40,9 +40,14 @@ def website_params
4040
:city,
4141
:location,
4242
:directions,
43-
:twitter_handle,
4443
:prospectus_link,
4544
:domains,
45+
:footer_about_content,
46+
:footer_copyright,
47+
:twitter_handle,
48+
:facebook_url,
49+
:instagram_url,
50+
:footer_categories,
4651
)
4752
end
4853
end

app/decorators/website_decorator.rb

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,25 @@ def sponsors_in_footer
3636
def navigation_page_names_and_slugs
3737
pages.navigatable.pluck(:name, :slug)
3838
end
39+
40+
def categorized_footer_pages
41+
pages.in_footer
42+
.select(:footer_category, :name, :slug)
43+
.group_by(&:footer_category)
44+
.sort_by { |category, _| footer_categories.index(category) }
45+
end
46+
47+
def twitter_url
48+
"https://twitter.com/#{object.twitter_handle}"
49+
end
50+
51+
def register_page
52+
pages.published.find_by(slug: 'register')
53+
end
54+
55+
def background_style
56+
return {} unless background.attached?
57+
58+
{ style: "background-image: url('#{h.url_for(background)}');" }
59+
end
3960
end

app/helpers/image_helper.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
module ImageHelper
2+
def resize_image_tag(image, width:, height: width)
3+
return unless image.attached?
4+
if image.content_type.match('svg')
5+
image_tag(image, width: width)
6+
else
7+
image_tag(image.variant(resize_to_fit: [width, height]))
8+
end
9+
end
10+
end

app/models/comment.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ def public?
1616
#
1717
# Table name: comments
1818
#
19-
# id :bigint(8) not null, primary key
20-
# proposal_id :bigint(8)
21-
# user_id :bigint(8)
19+
# id :integer not null, primary key
20+
# proposal_id :integer
21+
# user_id :integer
2222
# parent_id :integer
2323
# body :text
2424
# type :string

0 commit comments

Comments
 (0)