Skip to content

Commit 31d0969

Browse files
authored
Merge pull request #22 from drgrice1/default-template
Set a default template (output format) and remove the alert for not having selected one.
2 parents 9bc0c5f + 72e517d commit 31d0969

File tree

3 files changed

+18
-36
lines changed

3 files changed

+18
-36
lines changed

public/css/navbar.css

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,13 @@ body * {
1212
left: 0;
1313
width: 100%;
1414
height: 50px;
15-
/* overflow: hidden; */
15+
display: flex;
16+
justify-content: space-between;
17+
align-items: center;
1618
background-color: #012C4E;
1719
}
1820

1921
.topnav a {
20-
float: left;
2122
display: block;
2223
color: white;
2324
text-align: center;
@@ -37,8 +38,7 @@ body * {
3738
}
3839

3940
.dropdown {
40-
float: left;
41-
/* overflow: hidden; */
41+
height: 100%;
4242
}
4343

4444
.dropdown .dropbtn {
@@ -62,7 +62,6 @@ body * {
6262
}
6363

6464
.dropdown-content a {
65-
float: none;
6665
color: white;
6766
background-color: #012C4E;
6867
padding: 12px 16px;
@@ -80,23 +79,25 @@ body * {
8079
display: block;
8180
}
8281

82+
.search-container {
83+
height: 100%;
84+
}
85+
8386
.topnav .search-container {
84-
float: right;
87+
display: flex;
88+
justify-content: flex-start;
89+
align-items: center;
90+
column-gap: 10px;
91+
padding: 10px;
8592
}
8693

8794
.topnav input[type=text] {
8895
padding: 6px;
89-
margin-top: 7px;
90-
margin-right: 16px;
91-
font-size: 17px;
9296
border: none;
9397
}
9498

9599
.topnav .search-container button {
96-
float: right;
97100
padding: 6px 10px;
98-
margin-top: 7px;
99-
margin-right: 16px;
100101
background: #C0CAD3;
101102
font-size: 17px;
102103
border: none;
@@ -108,11 +109,7 @@ body * {
108109
}
109110

110111
@media screen and (max-width: 600px) {
111-
.topnav .search-container {
112-
float: none;
113-
}
114112
.topnav a, .topnav input[type=text], .topnav .search-container button {
115-
float: none;
116113
display: block;
117114
text-align: left;
118115
width: 100%;

public/js/navbar.js

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -141,14 +141,7 @@ renderbutton.addEventListener("click", (event) => {
141141
const renderurl = "render-api";
142142

143143
const selectedformat = document.querySelector(".dropdown-item.selected");
144-
let outputFormat;
145-
if (selectedformat === null) {
146-
console.log(typeof selectedformat);
147-
alert("No output format selected. Defaulting to 'classic' format.");
148-
outputFormat = "classic";
149-
} else {
150-
outputFormat = selectedformat.id;
151-
}
144+
const outputFormat = selectedformat?.id ?? 'default';
152145
let formData = new FormData();
153146
formData.set("showComments", 1);
154147
formData.set(
@@ -231,13 +224,7 @@ function insertListener() {
231224
const selectedformat = document.querySelector(
232225
".dropdown-item.selected"
233226
);
234-
let outputFormat;
235-
if (selectedformat === null) {
236-
alert("No output format selected. Defaulting to 'classic' format.");
237-
outputFormat = "classic";
238-
} else {
239-
outputFormat = selectedformat.id;
240-
}
227+
const outputFormat = selectedformat?.id ?? 'default';
241228
formData.set("isInstructor", 1);
242229
formData.set("includeTags", 1);
243230
formData.set("showComments", 1);

templates/layouts/navbar.html.ep

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,10 @@
1111
<body>
1212
<div class="topnav" id="myTopnav">
1313
<div class="dropdown" id="template-select-dropdown">
14-
<button class="dropbtn" id="template-select">Template
15-
<i class="fa fa-caret-down"></i>
16-
</button>
14+
<button class="dropbtn" id="template-select">Default <i class="fa fa-caret-down"></i></button>
1715
<div class="dropdown-content">
1816
<a href="#" class="dropdown-item" id="static">Static <i class="fa fa-check" aria-hidden="true"></i></a>
19-
<a href="#" class="dropdown-item" id="default">Default <i class="fa fa-check" aria-hidden="true"></i></a>
17+
<a href="#" class="dropdown-item selected" id="default">Default <i class="fa fa-check" aria-hidden="true"></i></a>
2018
<a href="#" class="dropdown-item" id="debug">Debug <i class="fa fa-check" aria-hidden="true"></i></a>
2119
</div>
2220
</div>
@@ -25,8 +23,8 @@
2523
<span id="hiddenSourceFilePath"></span>
2624
<input type="text" placeholder="file path..." name="sourceFilePath" id="sourceFilePath">
2725
<input type="text" placeholder="random seed..." name="problemSeed" id="problemSeed" style="width:130px;">
28-
<button type="button" id="save-problem">Save</button>
2926
<button type="button" id="load-problem">Load</button>
27+
<button type="button" id="save-problem">Save</button>
3028
<!--/form-->
3129
</div>
3230
</div>

0 commit comments

Comments
 (0)