mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-09-06 21:24:23 +08:00
removes visibility toggle from Name column [fixes SCI-2435]
This commit is contained in:
parent
1bc869d4ca
commit
66cac0b676
3 changed files with 48 additions and 28 deletions
|
@ -87,6 +87,7 @@ var RepositoryDatatable = (function(global) {
|
||||||
}, {
|
}, {
|
||||||
// Name column is clickable
|
// Name column is clickable
|
||||||
targets: 3,
|
targets: 3,
|
||||||
|
visible: true,
|
||||||
render: function(data, type, row) {
|
render: function(data, type, row) {
|
||||||
return "<a href='" + row.recordInfoUrl + "'" +
|
return "<a href='" + row.recordInfoUrl + "'" +
|
||||||
"class='record-info-link'>" + data + '</a>';
|
"class='record-info-link'>" + data + '</a>';
|
||||||
|
@ -1120,6 +1121,8 @@ var RepositoryDatatable = (function(global) {
|
||||||
thederName = el.innerText;
|
thederName = el.innerText;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var listItem = dropdownList
|
var listItem = dropdownList
|
||||||
.find('.repository-columns-list-template')
|
.find('.repository-columns-list-template')
|
||||||
.clone();
|
.clone();
|
||||||
|
@ -1129,10 +1132,11 @@ var RepositoryDatatable = (function(global) {
|
||||||
listItem.addClass(visLi);
|
listItem.addClass(visLi);
|
||||||
listItem.removeClass('repository-columns-list-template hide');
|
listItem.removeClass('repository-columns-list-template hide');
|
||||||
listItem.find('.text').html(generateColumnNameTooltip(thederName));
|
listItem.find('.text').html(generateColumnNameTooltip(thederName));
|
||||||
|
if(thederName !== 'Name') {
|
||||||
listItem.find('.vis').addClass(visClass);
|
listItem.find('.vis').addClass(visClass);
|
||||||
listItem.find('.vis')
|
listItem.find('.vis')
|
||||||
.attr('title', $(TABLE_ID).data('columns-visibility-text'));
|
.attr('title', $(TABLE_ID).data('columns-visibility-text'));
|
||||||
|
}
|
||||||
dropdownList.append(listItem);
|
dropdownList.append(listItem);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -1164,6 +1168,7 @@ var RepositoryDatatable = (function(global) {
|
||||||
var li = self.closest('li');
|
var li = self.closest('li');
|
||||||
var column = TABLE.column(li.attr('data-position'));
|
var column = TABLE.column(li.attr('data-position'));
|
||||||
|
|
||||||
|
if(column.header.id !== 'row-name') {
|
||||||
if (column.visible()) {
|
if (column.visible()) {
|
||||||
self.addClass('fa-eye-slash');
|
self.addClass('fa-eye-slash');
|
||||||
self.removeClass('fa-eye');
|
self.removeClass('fa-eye');
|
||||||
|
@ -1177,7 +1182,7 @@ var RepositoryDatatable = (function(global) {
|
||||||
column.visible(true);
|
column.visible(true);
|
||||||
TABLE.setColumnSearchable(column.index(), true);
|
TABLE.setColumnSearchable(column.index(), true);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// Re-filter/search if neccesary
|
// Re-filter/search if neccesary
|
||||||
var searchText = $('div.dataTables_filter input').val();
|
var searchText = $('div.dataTables_filter input').val();
|
||||||
if (!_.isEmpty(searchText)) {
|
if (!_.isEmpty(searchText)) {
|
||||||
|
|
|
@ -1,11 +0,0 @@
|
||||||
namespace :clear_repository_rows_and_columns_without_repository do
|
|
||||||
desc 'Removes all repository rows/columns and ' \
|
|
||||||
'referenced entities with dependent: destroy'
|
|
||||||
task run: :environment do
|
|
||||||
repository_ids = Repository.select(:id)
|
|
||||||
RepositoryColumn.skip_callback(:destroy, :around, :update_repository_table_states_with_removed_column)
|
|
||||||
RepositoryRow.where.not(repository_id: repository_ids).destroy_all
|
|
||||||
RepositoryColumn.where.not(repository_id: repository_ids).destroy_all
|
|
||||||
RepositoryColumn.set_callback(:destroy, :around, :update_repository_table_states_with_removed_column)
|
|
||||||
end
|
|
||||||
end
|
|
26
lib/tasks/repositories.rake
Normal file
26
lib/tasks/repositories.rake
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
namespace :repositories do
|
||||||
|
desc 'Removes all repository rows/columns and ' \
|
||||||
|
'referenced entities with dependent: destroy'
|
||||||
|
task remove_rows_and_columns_without_repository: :environment do
|
||||||
|
repository_ids = Repository.select(:id)
|
||||||
|
RepositoryColumn.skip_callback(
|
||||||
|
:destroy, :around, :update_repository_table_states_with_removed_column
|
||||||
|
)
|
||||||
|
RepositoryRow.where.not(repository_id: repository_ids).destroy_all
|
||||||
|
RepositoryColumn.where.not(repository_id: repository_ids).destroy_all
|
||||||
|
RepositoryColumn.set_callback(
|
||||||
|
:destroy, :around, :update_repository_table_states_with_removed_column
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
desc 'Set\'s the Name column visibility value to true. Needed if ' \
|
||||||
|
'the user has the Name column hidden when [SCI-2435] is merged. ' \
|
||||||
|
'Check: https://github.com/biosistemika/scinote-web/commits/master'
|
||||||
|
task set_name_column_visibility: :environment do
|
||||||
|
RepositoryTableState.find_each do |repository_table_state|
|
||||||
|
next unless repository_table_state.state['columns']['3']
|
||||||
|
repository_table_state.state['columns']['3']['visible'] = 'true'
|
||||||
|
repository_table_state.save
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
Loading…
Add table
Reference in a new issue