inst_table.mjs 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. /*
  2. * Creates the HTML for the institution in the institution table on /for/universities
  3. */
  4. const name = process.argv[2]
  5. const href = process.argv[3]
  6. const image = process.argv[4]
  7. function create() {
  8. if (!name) {
  9. return console.log('Error: Institution name is required')
  10. }
  11. const eventLabel = name.replace(/ /g, '-').replace(/\(|\)/g, '')
  12. if (!href) {
  13. return console.log('Error: Institution portal href is required')
  14. }
  15. let result = ` <div class="row">`
  16. result += `\n <div class="col-sm-2 col-xs-3 text-center">`
  17. if (image) {
  18. result += `\n <img alt="${name}" class="uni-logo" src="${image}">`
  19. }
  20. result += `\n </div>`
  21. result += `\n <div class="col-sm-8 col-xs-5">
  22. <p>
  23. <strong>${name}</strong>
  24. </p>`
  25. result += `\n </div>`
  26. result += `\n <div class="col-sm-2 col-xs-4 university-claim-btn">
  27. <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>
  28. </div>`
  29. result += '\n </div>'
  30. console.log(result)
  31. }
  32. create()