Sha256: edd114b6d11f466338f77cd1c8548423ff3c70b294341cfb01259d47bb004377

Contents?: true

Size: 1.22 KB

Versions: 7

Compression:

Stored size: 1.22 KB

Contents

// the users table has width set to auto, but the pagination tries to stretch to full width - this
// forces the pagination to match the table
var resizePagination = function () {
  //var paginationDiv = $('.dataTables_info').parents('.row').first()
  //paginationDiv.width($('.dataTable').width())
}

var addDatatablesToSearchResults = function () {
  $('.add-user-search-results-table').dataTable({
    searching: true,
    order: [[ 2, "asc" ]],
    columnDefs: [ {
      targets: 3,
      orderable: false
    }]
  })
  resizePagination()
}

var addDatatablesToUsersTable = function () {
  $('.ucb-rails-users-table').dataTable({
    searching: true,
    order: [[ 3, "asc" ]],
    columnDefs: [ {
      targets: [8, 9],
      orderable: false
    }],
  })
  var addNewHtml = '&nbsp;&nbsp;<a href="/admin/users/new" class="btn btn-primary">Add New</a>'
  $('#DataTables_Table_0_filter').append(addNewHtml)
}

$( window ).on("load", function() {
  // the datatable calling was failing intermittently, but adding the timeout
  // seemed to fix it, so ¯\_(ツ)_/¯
  window.setTimeout(addDatatablesToUsersTable, 100)

  $('.user-search-form').on('submit', function() {
    $('.search-results').hide()
    $('.ucb-rails-user-loader').show()
  })
})

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
ucb_rails_user-2.0.1 app/assets/javascripts/ucb_rails_user/ucb_rails_user.js
ucb_rails_user-2.0.0 app/assets/javascripts/ucb_rails_user/ucb_rails_user.js
ucb_rails_user-1.1.3 app/assets/javascripts/ucb_rails_user/ucb_rails_user.js
ucb_rails_user-1.1.2 app/assets/javascripts/ucb_rails_user/ucb_rails_user.js
ucb_rails_user-1.1.1 app/assets/javascripts/ucb_rails_user/ucb_rails_user.js
ucb_rails_user-1.1.0 app/assets/javascripts/ucb_rails_user/ucb_rails_user.js
ucb_rails_user-1.0.0 app/assets/javascripts/ucb_rails_user/ucb_rails_user.js