Merge branch 'develop' into ai-sci-4128-change-datatable-headers-colors

This commit is contained in:
Urban Rotnik 2020-01-15 09:10:43 +01:00 committed by GitHub
commit 6d55b07fdc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 46 additions and 29 deletions

View file

@ -65,6 +65,10 @@
background-color: $color-alto;
}
}
.circle-icon {
margin-left: 30px;
}
}
// Checklists
@ -104,7 +108,8 @@
display: inline-block;
}
.assign-counter-container {
.assign-counter-container,
.circle-icon {
margin-left: 0;
}
}
@ -123,7 +128,8 @@
display: none;
}
.assign-counter-container {
.assign-counter-container,
.circle-icon {
margin-left: 30px;
}
}

View file

@ -42,9 +42,16 @@ module RepositoryDatatableHelper
end
def assigned_row(record)
if record.assigned_my_modules_count.positive?
if @my_module
if record.assigned_my_modules_count.positive?
"<span class='circle-icon'>&nbsp;</span>"
else
"<span class='circle-icon disabled'>&nbsp;</span>"
end
elsif record.assigned_my_modules_count.positive?
tooltip = "#{record.assigned_my_modules_count} tasks,&#10;#{record.assigned_experiments_count} " \
"experiments,&#10;#{record.assigned_projects_count} projects"
"<div class='assign-counter-container' title='#{tooltip}'>"\
"<span class='assign-counter has-assigned'>#{record.assigned_my_modules_count}</span></div>"
else

View file

@ -28,33 +28,37 @@ class RepositoryTableStateColumnUpdateService
raise ArgumentError, 'repository is empty' if repository.blank?
raise ArgumentError, 'old_column_index is empty' if old_column_index.blank?
RepositoryTableState.where(
repository: repository
).find_each do |table_state|
RepositoryTableState.where(repository: repository).find_each do |table_state|
state = table_state.state
user = table_state.user
# Remove column from ColReorder, columns, length entries
state['columns'].delete_at(old_column_index)
state['ColReorder'].delete(old_column_index)
state['ColReorder'].map! do |index|
if index > old_column_index
index - 1
else
index
begin
# Remove column from ColReorder, columns, length entries
state['columns'].delete_at(old_column_index)
state['ColReorder'].delete(old_column_index)
state['ColReorder'].map! do |index|
if index > old_column_index
index - 1
else
index
end
end
end
if state.dig('order', 0, 0) == old_column_index
# Fallback to default order if user had table ordered by
# the deleted column
state['order'] = Constants::REPOSITORY_TABLE_DEFAULT_STATE['order']
elsif state.dig('order', 0, 0) > old_column_index
state['order'][0][0] -= 1
end
if state.dig('order', 0, 0) == old_column_index
# Fallback to default order if user had table ordered by
# the deleted column
state['order'] = Constants::REPOSITORY_TABLE_DEFAULT_STATE['order']
elsif state.dig('order', 0, 0) > old_column_index
state['order'][0][0] -= 1
end
state['length'] = (state['length'] - 1)
state['time'] = (Time.now.to_f * 1_000).to_i
table_state.save
state['length'] = (state['length'] - 1)
state['time'] = (Time.now.to_f * 1_000).to_i
table_state.save
rescue NoMethodError => e
Rails.logger.error e.message
RepositoryTableStateService.new(user, repository).create_default_state
end
end
end
end

View file

@ -4,7 +4,7 @@
selected_delimiter_char = Constants::REPOSITORY_LIST_ITEMS_DELIMITERS_MAP[selected_delimiter.to_sym]
%>
<%= hidden_field_tag 'dropdown-options', '', class: 'dropdown-options' %>
<%= hidden_field_tag 'dropdown-options', '[]', class: 'dropdown-options' %>
<div class="form-group">
<label class="control-label col-sm-3" for="repository-column-data-type">
<%= t('libraries.manange_modal_column.list_type.delimiter_label') %>
@ -32,7 +32,7 @@
>
</select>
<div class="limit-counter-container">
<span class="items-count"></span>
<span class="items-count" data-count="0">0</span>
<span class="items-limit">/<%= Constants::REPOSITORY_CHECKLIST_ITEMS_PER_COLUMN %> </span>
<span class="items-label"></span></div>
</div>

View file

@ -4,7 +4,7 @@
selected_delimiter_char = Constants::REPOSITORY_LIST_ITEMS_DELIMITERS_MAP[selected_delimiter.to_sym]
%>
<%= hidden_field_tag 'dropdown-options', '', class: 'dropdown-options' %>
<%= hidden_field_tag 'dropdown-options', '[]', class: 'dropdown-options' %>
<div class="form-group">
<label class="control-label col-sm-3" for="repository-column-data-type">
<%= t('libraries.manange_modal_column.list_type.delimiter_label') %>
@ -28,7 +28,7 @@
<select class="form-control preview-select">
</select>
<div class="limit-counter-container">
<span class="items-count"></span>
<span class="items-count" data-count="0">0</span>
<span class="items-limit">/<%= Constants::REPOSITORY_LIST_ITEMS_PER_COLUMN %> </span>
<span class="items-label"></span></div>
</div>