|
20 | 20 | </div> |
21 | 21 | {% else %} |
22 | 22 | <div class="modal-body"> |
23 | | - <ul class="nav nav-tabs container text-center" id="submissionTabs" role="tablist" style="width: 100%"> |
24 | | - <li class="nav-item" role="presentation" > |
25 | | - <a class="nav-link {% if active_tab == 'upload' %}active{% endif %}" id="upload-tab" data-bs-toggle="tab" href="#upload" role="tab" aria-controls="upload" aria-selected="{% if active_tab == 'upload' %}true{% else %}false{% endif %}" onclick="setCookie('active_tab', 'upload')" >Upload File</a> |
26 | | - </li> |
27 | | - <li class="nav-item text-center" role="presentation"> |
28 | | - <a class="nav-link {% if active_tab == 'paste' %}active{% endif %}" id="paste-tab" data-bs-toggle="tab" href="#paste" role="tab" aria-controls="paste" aria-selected="{% if active_tab == 'paste' %}true{% else %}false{% endif %}" onclick="setCookie('active_tab', 'paste')">Paste Code</a> |
29 | | - </li> |
30 | | - </ul> |
31 | | - <div class="tab-content" id="submissionTabsContent" style="margin-top: 20px;"> |
32 | | - <div class="tab-pane fade {% if active_tab == 'upload' %}show active{% endif %}" id="upload" role="tabpanel" aria-labelledby="upload-tab"> |
33 | | - {{ form_start(formupload) }} |
34 | | - {{ form_row(formupload.code) }} |
35 | | - <div class="alert d-none" id="files_selected"></div> |
36 | | - {{ form_row(formupload.problem) }} |
37 | | - {{ form_row(formupload.language) }} |
38 | | - {{ form_row(formupload.entry_point) }} |
39 | | - <div class="modal-footer"> |
40 | | - <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Cancel</button> |
41 | | - <button type="submit" class="btn btn-success"> |
42 | | - <i class="fas fa-cloud-upload-alt"></i> Submit |
43 | | - </button> |
44 | | - </div> |
45 | | - {{ form_end(formupload) }} |
46 | | - </div> |
| 23 | + {% if active_tab_array | length > 1 %} |
| 24 | + <ul class="nav nav-tabs container text-center" id="submissionTabs" role="tablist" style="width: 100%"> |
| 25 | + {% if 'upload' in active_tab_array %} |
| 26 | + <li class="nav-item" role="presentation"> |
| 27 | + <a class="nav-link {% if active_tab == 'upload' %}active{% endif %}" id="upload-tab" data-bs-toggle="tab" href="#upload" role="tab" aria-controls="upload" aria-selected="{% if active_tab == 'upload' %}true{% else %}false{% endif %}" onclick="setCookie('active_tab', 'upload')">Upload File</a> |
| 28 | + </li> |
| 29 | + {% endif %} |
| 30 | + {% if 'paste' in active_tab_array %} |
| 31 | + <li class="nav-item text-center" role="presentation"> |
| 32 | + <a class="nav-link {% if active_tab == 'paste' %}active{% endif %}" id="paste-tab" data-bs-toggle="tab" href="#paste" role="tab" aria-controls="paste" aria-selected="{% if active_tab == 'paste' %}true{% else %}false{% endif %}" onclick="setCookie('active_tab', 'paste')">Paste Code</a> |
| 33 | + </li> |
| 34 | + {% endif %} |
| 35 | + </ul> |
| 36 | + {% endif %} |
47 | 37 |
|
48 | | - <div class="tab-pane fade {% if active_tab == 'paste' %}show active{% endif %}" id="paste" role="tabpanel" aria-labelledby="paste-tab"> |
49 | | - {{ form_start(formpaste) }} |
50 | | - {{ form_widget(formpaste.code_content) }} |
51 | | - <label for="codeInput">Paste your code here:</label> |
52 | | - <div class="editor-container"> |
53 | | - {{ "" | codeEditor( |
54 | | - "_team_submission_code", |
55 | | - "c_cpp", |
56 | | - true, |
57 | | - formpaste.code_content.vars.id, |
58 | | - null, |
59 | | - formpaste.language.vars.value |
60 | | - ) }} |
| 38 | + |
| 39 | + <div class="tab-content" id="submissionTabsContent" style="margin-top: 20px;"> |
| 40 | + {% if 'upload' in active_tab_array %} |
| 41 | + <div class="tab-pane fade {% if active_tab == 'upload' %}show active{% endif %}" id="upload" role="tabpanel" aria-labelledby="upload-tab"> |
| 42 | + {{ form_start(formupload) }} |
| 43 | + {{ form_row(formupload.code) }} |
| 44 | + <div class="alert d-none" id="files_selected"></div> |
| 45 | + {{ form_row(formupload.problem) }} |
| 46 | + {{ form_row(formupload.language) }} |
| 47 | + {{ form_row(formupload.entry_point) }} |
| 48 | + <div class="modal-footer"> |
| 49 | + <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Cancel</button> |
| 50 | + <button type="submit" class="btn btn-success"> |
| 51 | + <i class="fas fa-cloud-upload-alt"></i> Submit |
| 52 | + </button> |
| 53 | + </div> |
| 54 | + {{ form_end(formupload) }} |
61 | 55 | </div> |
| 56 | + {% endif %} |
| 57 | + |
| 58 | + {% if 'paste' in active_tab_array %} |
| 59 | + <div class="tab-pane fade {% if active_tab == 'paste' %}show active{% endif %}" id="paste" role="tabpanel" aria-labelledby="paste-tab"> |
| 60 | + {{ form_start(formpaste) }} |
| 61 | + {{ form_widget(formpaste.code_content) }} |
| 62 | + <label for="codeInput">Paste your code here:</label> |
| 63 | + <div class="editor-container"> |
| 64 | + {{ "" | codeEditor( |
| 65 | + "_team_submission_code", |
| 66 | + "c_cpp", |
| 67 | + true, |
| 68 | + formpaste.code_content.vars.id, |
| 69 | + null, |
| 70 | + formpaste.language.vars.value |
| 71 | + ) }} |
| 72 | + </div> |
62 | 73 | {{ form_row(formpaste.problem) }} |
63 | 74 | {{ form_row(formpaste.language) }} |
64 | 75 | {{ form_row(formpaste.entry_point) }} |
65 | | - <div class="modal-footer"> |
66 | | - <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Cancel</button> |
67 | | - <button type="submit" class="btn btn-primary"> |
68 | | - <i class="fas fa-paste"></i> Submit |
69 | | - </button> |
| 76 | + <div class="modal-footer"> |
| 77 | + <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Cancel</button> |
| 78 | + <button type="submit" class="btn btn-primary"> |
| 79 | + <i class="fas fa-paste"></i> Submit |
| 80 | + </button> |
| 81 | + </div> |
| 82 | + {{ form_end(formpaste) }} |
70 | 83 | </div> |
71 | | - {{ form_end(formpaste) }} |
72 | | - </div> |
| 84 | + {% endif %} |
73 | 85 | </div> |
74 | 86 | </div> |
75 | 87 | {% endif %} |
76 | 88 | </div> |
77 | 89 | </div> |
78 | 90 |
|
| 91 | + <style> |
| 92 | + .single-tab { |
| 93 | + width: 100%; |
| 94 | + display: inline-block; |
| 95 | + } |
| 96 | + </style> |
| 97 | + |
79 | 98 | <script> |
80 | 99 | const fileInput = document.getElementById('submit_problem_code'); |
81 | 100 | fileInput.addEventListener('change', (event) => { |
|
0 commit comments