Skip to content

Commit

Permalink
Convert some coffeescript files into JS
Browse files Browse the repository at this point in the history
  • Loading branch information
isc committed Oct 30, 2023
1 parent 5f63746 commit 90f32ef
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 35 deletions.
18 changes: 18 additions & 0 deletions app/assets/javascripts/autolinks.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
const autolinkQueryResults = () => {
$('.table td, dl dd').each(function(){
const text = $(this).text()
if (text.match(/^\S+@\S+\.\S+$/)) {
$(this).append(` <a target="_blank" title='send an email to this address' href="mailto:${text}"><i class='fa fa-envelope subtle'></i></a>`)
} else {
if (text.match(/\d+\.\d+/)) {
return // Skip processing for numeric patterns with a dot
}
if (text.match(/^((http|ftp|https):\/\/)?[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&amp;:\/~\+#]*[\w\-\@?^=%&amp;\/~\+#])?$/)) {
const link = text.match('://') ? text : `http://${text}`
$(this).append(` <a target="_blank" href="${link}" title='open a new page to this URL'><i class='fa fa-external-link subtle'></i></a>`)
}
}
})
}

$(autolinkQueryResults)
12 changes: 0 additions & 12 deletions app/assets/javascripts/autolinks.js.coffee

This file was deleted.

12 changes: 12 additions & 0 deletions app/assets/javascripts/collaborators.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
$("input[name=all_actions]").click(function(){
const scope = $(this).closest("tr").find("input:not(:first)")
scope.prop('checked', this.checked)
})
const column_check = (index) => {
return () => {
const checked = $("table").find(`tr:first-child th:nth-child(${index+2}) input[type=checkbox]`).get(0).checked
const scope = $("table").find(`td:nth-child(${index+3}) input[type=checkbox]`)
scope.prop('checked', checked)
}
}
["create", "read", "update", "delete"].forEach((action, index) => $(`input[name=${action}_all]`).click(column_check(index)))
13 changes: 0 additions & 13 deletions app/assets/javascripts/collaborators.js.coffee

This file was deleted.

5 changes: 5 additions & 0 deletions app/assets/javascripts/docs.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
$('#cancel_tip').on('ajax:complete', (et, e) => {
if (!JSON.parse(e.responseText)) return
$("#welcome-modal .modal-footer").html("<p class='alert alert-info'>Okay, tips will not appear anymore</p>")
setTimeout(() => $("#welcome-modal").modal('hide'), 1500)
})
7 changes: 0 additions & 7 deletions app/assets/javascripts/docs.js.coffee

This file was deleted.

4 changes: 4 additions & 0 deletions app/assets/javascripts/timezone_select2.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
$(() => {
const format = (state) => $('<span>').html(state.text.replace(')', '</b>)').replace('(GMT', '(GMT<b>'))
$('.timezone_select2').select2({ templateResult: format, placeholder: '(GMT+00:00) UTC' })
})
3 changes: 0 additions & 3 deletions app/assets/javascripts/timezone_select2.js.coffee

This file was deleted.

0 comments on commit 90f32ef

Please sign in to comment.