<commit_before>function Resource(attributes) {
  this.id = attributes.id
  this.title = attributes.title
  this.url = attributes.url
  this.description = attributes.description
  this.user_id = attributes.user_id
  this.tags = attributes.tags
}

Resource.ready = function () {
  Resource.assignListeners()
}

Resource.assignListeners = function () {
  Resource.yourResourcesListener()
}

Resource.yourResourcesListener = function () {
  $("a#js_resources").one("click", Resource.getResourcesAPI)
}

Resource.getResourcesAPI = function (e) {
  var $id = $(this).data("id")
  e.preventDefault()
  $.get(`/users/${$id}/resources`, Resource.success, "json").error(Resource.error)
}

Resource.success = function (json) {
  var resources = json.map(function (resource) {
    return new Resource(resource)
  })
  var $ul = $("#resource_list").empty()

  resources.forEach(Resource.renderLI)
}

Resource.renderLI = function (resource) {
  var li = resource.formatListItems()
  $("#resource_list").append(li)
}

Resource.prototype.formatListItems = function () {
  return `
  <li><a href="/resources/${this.id}">${this.title}</a> - <a href="${this.url}">Link</a>
    <ul>
      ${this.tags.map(Tag.renderLI).join("")}
    <ul>
  </li>`
};

Resource.error = function (response) {
  console.log("You broke it!", response)
}

$(function () {
  Resource.ready()
})
<commit_msg>Render resource template with style js.<commit_after>function Resource(attributes) {
  this.id = attributes.id
  this.title = attributes.title
  this.url = attributes.url
  this.description = attributes.description
  this.user_id = attributes.user_id
  this.tags = attributes.tags
  this.languages = attributes.languages
}

Resource.ready = function () {
  Resource.assignListeners()
}

Resource.assignListeners = function () {
  Resource.yourResourcesListener()
}

Resource.yourResourcesListener = function () {
  $("a#js_resources").one("click", Resource.getResourcesAPI)
}

Resource.getResourcesAPI = function (e) {
  var $id = $(this).data("id")
  e.preventDefault()
  $.get(`/users/${$id}/resources`, Resource.success, "json").error(Resource.error)
}

Resource.success = function (json) {
  var resources = json.map(function (resource) {
    return new Resource(resource)
  })
  var $ul = $("#resource_list").empty()

  resources.forEach(Resource.renderLI)
}

Resource.renderLI = function (resource) {
  var li = resource.formatListItems()
  $("#resource_list").append(li)
}

Resource.prototype.formatListItems = function () {
  return `
  <li>
    <a class="resource resource-links" href="/resources/${this.id}" >${this.title}</a>
    <a class="glyphicon glyphicon-link" href="${this.url}"></a> -
    ${this.tags.map(Tag.renderLink).join(" / ")}<br>
    (${this.languages.map(Language.renderLink).join(", ")})
    <hr>
  </li>`
};

Resource.error = function (response) {
  console.log("You broke it!", response)
}

$(function () {
  Resource.ready()
})

{'fraction_non_alphanumeric': 0.17345193294560382, 'fraction_numerical': 0.0, 'mean_word_length': 4.434944237918216, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3499925', 'n_tokens_mistral': 925, 'n_tokens_neox': 931, 'n_words': 164}