mirror of
https://github.com/overleaf/overleaf.git
synced 2025-04-20 22:42:40 +00:00
Merge pull request #2592 from overleaf/jel-html-inst-table-script
Add script to generate institution row in list GitOrigin-RevId: 8dfb7396626c229ff2a7e9441a3fa5ae247d06bb
This commit is contained in:
parent
ab80c72565
commit
cae6cf6efa
1 changed files with 38 additions and 0 deletions
38
services/web/scripts/inst_table.js
Normal file
38
services/web/scripts/inst_table.js
Normal file
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
* Creates the HTML for the institution in the institution table on /for/universities
|
||||
*/
|
||||
|
||||
const name = process.argv[2]
|
||||
const href = process.argv[3]
|
||||
const image = process.argv[4]
|
||||
|
||||
function create() {
|
||||
if (!name) {
|
||||
return console.log('Error: Institution name is required')
|
||||
}
|
||||
const eventLabel = name.replace(/ /g, '-').replace(/\(|\)/g, '')
|
||||
if (!href) {
|
||||
return console.log('Error: Institution portal href is required')
|
||||
}
|
||||
let result = ` <div class="row">`
|
||||
result += `\n <div class="col-sm-2 col-xs-3 text-center">`
|
||||
|
||||
if (image) {
|
||||
result += `\n <img alt="${name}" class="uni-logo" src="${image}">`
|
||||
}
|
||||
|
||||
result += `\n </div>`
|
||||
result += `\n <div class="col-sm-8 col-xs-5">
|
||||
<p>
|
||||
<strong>${name}</strong>
|
||||
</p>`
|
||||
result += `\n </div>`
|
||||
result += `\n <div class="col-sm-2 col-xs-4 university-claim-btn">
|
||||
<a class="btn btn-primary" href="${href}" event-tracking-ga="For-Pages" event-tracking="Universities-Click-Edu" event-tracking-label="View-${eventLabel}" event-tracking-trigger="click">VIEW</a>
|
||||
</div>`
|
||||
result += '\n </div>'
|
||||
|
||||
console.log(result)
|
||||
}
|
||||
|
||||
create()
|
Loading…
Add table
Reference in a new issue