Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
zedflow
fgdi
Commits
cda21911
Commit
cda21911
authored
Dec 20, 2023
by
Traboulsi
Browse files
Update public/js/add_content.js
parent
1c535abc
Pipeline
#8968
passed with stage
in 12 seconds
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
public/js/add_content.js
View file @
cda21911
...
@@ -72,6 +72,40 @@ function addcontent(item) {
...
@@ -72,6 +72,40 @@ function addcontent(item) {
}
}
// Salam: Add this line at the beginning of your JavaScript code to define a variable for the modal
var
sdgProjectModal
=
''
;
// ...
var
sdgProjectHTML
=
''
;
if
(
'
sdgProjectLink
'
in
item
.
links
)
{
var
sdgProjectLink
=
item
.
links
.
sdgProjectLink
;
sdgProjectHTML
=
`<button class="btn btn-sm btn-outline-info mt-1" data-toggle="modal" data-target="#sdgProjectModal"> <i class="fas fa-sdg"></i> SDG x Project</button> `
;
// Add this line to create the modal content dynamically
sdgProjectModal
=
`<div class="modal fade" id="sdgProjectModal" tabindex="-1" role="dialog" aria-labelledby="sdgProjectModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="sdgProjectModalLabel">SDG x Project Image</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<img src="
${
item
.
item
.
sdgImage
}
" alt="SDG x Project Image" style="width: 100%; height: auto;">
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<a class="btn btn-info" href="
${
sdgProjectLink
}
" target="_blank">View SDG x Project Details</a>
</div>
</div>
</div>
</div>`
;
}
// ...
new_row
.
innerHTML
=
new_row
.
innerHTML
+
'
<div class="col-lg-4">
'
+
new_row
.
innerHTML
=
new_row
.
innerHTML
+
'
<div class="col-lg-4">
'
+
'
<div class="card mb-4 shadow-sm extension overflow-auto">
'
+
'
<div class="card mb-4 shadow-sm extension overflow-auto">
'
+
'
<h5>
'
+
item
.
item
.
title
+
'
<span class="content-subtitle text-muted">
'
+
item
.
item
.
project
+
'
</span></h5>
'
+
'
<h5>
'
+
item
.
item
.
title
+
'
<span class="content-subtitle text-muted">
'
+
item
.
item
.
project
+
'
</span></h5>
'
+
...
@@ -91,7 +125,8 @@ function addcontent(item) {
...
@@ -91,7 +125,8 @@ function addcontent(item) {
projectHTML
+
projectHTML
+
presentationHTML
+
presentationHTML
+
repoHTML
+
repoHTML
+
'
<img class="thumbimg" src="
'
+
item
.
item
.
sdgImage
+
'
" alt="" style="max-width: 30px; max-height:30px; ">
'
+
'
<img class="thumbimg" src="
'
+
item
.
item
.
imageLink
+
'
" alt="">
'
+
sdgProjectHTML
+
// Include the SDG x Project button here
'
</p>
'
+
'
</p>
'
+
'
</div>
'
+
'
</div>
'
+
'
</div>
'
+
'
</div>
'
+
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment