mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-03-03 19:24:48 +08:00
Move teams datatable js code into separate file [SCI-936]
This commit is contained in:
parent
8b105aa030
commit
62535a01bd
4 changed files with 37 additions and 34 deletions
|
@ -56,38 +56,4 @@ function initLeaveTeams() {
|
|||
);
|
||||
}
|
||||
|
||||
// Initialize teams DataTable
|
||||
function initTeamsTable() {
|
||||
teamsDatatable = $('#teams-table').DataTable({
|
||||
order: [[0, 'asc']],
|
||||
dom: 'RBltpi',
|
||||
stateSave: true,
|
||||
buttons: [],
|
||||
processing: true,
|
||||
serverSide: true,
|
||||
ajax: {
|
||||
url: $('#teams-table').data('source'),
|
||||
type: 'POST'
|
||||
},
|
||||
colReorder: {
|
||||
fixedColumnsLeft: 1000000 // Disable reordering
|
||||
},
|
||||
columnDefs: [{
|
||||
targets: [0, 1],
|
||||
orderable: true,
|
||||
searchable: false
|
||||
}, {
|
||||
targets: [2],
|
||||
searchable: false,
|
||||
orderable: true
|
||||
}, {
|
||||
targets: [3],
|
||||
searchable: false,
|
||||
orderable: false,
|
||||
sWidth: '1%'
|
||||
}]
|
||||
});
|
||||
}
|
||||
|
||||
initTeamsTable();
|
||||
initLeaveTeams();
|
||||
|
|
34
app/assets/javascripts/users/settings/teams_datatable.js
Normal file
34
app/assets/javascripts/users/settings/teams_datatable.js
Normal file
|
@ -0,0 +1,34 @@
|
|||
// Initialize teams DataTable
|
||||
function initTeamsTable() {
|
||||
teamsDatatable = $('#teams-table').DataTable({
|
||||
order: [[0, 'asc']],
|
||||
dom: 'RBltpi',
|
||||
stateSave: true,
|
||||
buttons: [],
|
||||
processing: true,
|
||||
serverSide: true,
|
||||
ajax: {
|
||||
url: $('#teams-table').data('source'),
|
||||
type: 'POST'
|
||||
},
|
||||
colReorder: {
|
||||
fixedColumnsLeft: 1000000 // Disable reordering
|
||||
},
|
||||
columnDefs: [{
|
||||
targets: [0, 1],
|
||||
orderable: true,
|
||||
searchable: false
|
||||
}, {
|
||||
targets: [2],
|
||||
searchable: false,
|
||||
orderable: true
|
||||
}, {
|
||||
targets: [3],
|
||||
searchable: false,
|
||||
orderable: false,
|
||||
sWidth: '1%'
|
||||
}]
|
||||
});
|
||||
}
|
||||
|
||||
initTeamsTable();
|
|
@ -46,3 +46,4 @@
|
|||
<%= render partial: "users/settings/teams/leave_user_team_modal.html.erb" %>
|
||||
<%= stylesheet_link_tag 'datatables' %>
|
||||
<%= javascript_include_tag "users/settings/teams" %>
|
||||
<%= javascript_include_tag "users/settings/teams_datatable" %>
|
||||
|
|
|
@ -15,6 +15,8 @@ Rails.application.config.assets.precompile += %w(jsnetworkx.js)
|
|||
Rails.application.config.assets.precompile += %w(handsontable.full.min.js)
|
||||
Rails.application.config.assets.precompile += %w(users/settings/preferences.js)
|
||||
Rails.application.config.assets.precompile += %w(users/settings/teams.js)
|
||||
Rails.application.config.assets.precompile +=
|
||||
%w(users/settings/teams_datatable.js)
|
||||
Rails.application.config.assets.precompile +=
|
||||
%w(users/settings/teams/add_user_modal.js)
|
||||
Rails.application.config.assets.precompile += %w(users/settings/team.js)
|
||||
|
|
Loading…
Reference in a new issue