Merge branch 'features/task-flows' into develop_to_task_flows

This commit is contained in:
Urban Rotnik 2020-08-04 16:43:05 +02:00 committed by GitHub
commit 073979534c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 22 additions and 42 deletions

View file

@ -3,7 +3,7 @@
var DasboardCurrentTasksWidget = (function() {
var sortFilter = '.curent-tasks-filters .sort-filter';
var statusFilter = '.curent-tasks-filters .view-filter';
var viewFilter = '.curent-tasks-filters .view-filter';
var projectFilter = '.curent-tasks-filters .project-filter';
var experimentFilter = '.curent-tasks-filters .experiment-filter';
@ -36,7 +36,7 @@ var DasboardCurrentTasksWidget = (function() {
params.project_id = dropdownSelector.getValues(projectFilter);
params.experiment_id = dropdownSelector.getValues(experimentFilter);
params.sort = dropdownSelector.getValues(sortFilter);
params.statuses = dropdownSelector.getValues(statusFilter);
params.view = dropdownSelector.getValues(viewFilter);
params.query = $('.current-tasks-widget .task-search-field').val();
params.mode = $('.current-tasks-navbar .active').data('mode');
return params;
@ -48,7 +48,7 @@ var DasboardCurrentTasksWidget = (function() {
return dropdownSelector.getValues(experimentFilter)
|| dropdownSelector.getValues(projectFilter)
|| $('.current-tasks-widget .task-search-field').val().length > 0
|| dropdownSelector.getValues(statusFilter) !== 'uncompleted';
|| dropdownSelector.getValues(viewFilter) !== 'uncompleted';
}
function loadCurrentTasksList(newList) {
@ -57,7 +57,7 @@ var DasboardCurrentTasksWidget = (function() {
project_id: dropdownSelector.getValues(projectFilter),
experiment_id: dropdownSelector.getValues(experimentFilter),
sort: dropdownSelector.getValues(sortFilter),
statuses: dropdownSelector.getValues(statusFilter),
view: dropdownSelector.getValues(viewFilter),
query: $('.current-tasks-widget .task-search-field').val(),
mode: $('.current-tasks-navbar .active').data('mode')
};
@ -84,7 +84,8 @@ var DasboardCurrentTasksWidget = (function() {
$('.curent-tasks-filters .clear-button').click((e) => {
e.stopPropagation();
e.preventDefault();
dropdownSelector.selectValue(sortFilter, 'due_date');
dropdownSelector.selectValue(sortFilter, 'date_asc');
dropdownSelector.selectValue(viewFilter, 'uncompleted');
dropdownSelector.clearData(projectFilter);
dropdownSelector.clearData(experimentFilter);
});
@ -97,9 +98,12 @@ var DasboardCurrentTasksWidget = (function() {
disableSearch: true
});
dropdownSelector.init(statusFilter, {
dropdownSelector.init(viewFilter, {
noEmptyOption: true,
singleSelect: true,
closeOnSelect: true,
selectAppearance: 'simple',
optionClass: 'checkbox-icon'
disableSearch: true
});
dropdownSelector.init(projectFilter, {
@ -139,7 +143,7 @@ var DasboardCurrentTasksWidget = (function() {
e.stopPropagation();
e.preventDefault();
dropdownSelector.closeDropdown(sortFilter);
dropdownSelector.closeDropdown(statusFilter);
dropdownSelector.closeDropdown(viewFilter);
dropdownSelector.closeDropdown(projectFilter);
dropdownSelector.closeDropdown(experimentFilter);
});

View file

@ -179,20 +179,9 @@ var dropdownSelector = (function() {
}
// Add selected option to value
function addSelectedOptions(selector, container) {
var selectedOptions = [];
$.each($(selector).find('option:selected'), function(i, option) {
selectedOptions.push(convertOptionToJson(option));
if (selector.data('config').singleSelect) return false;
return true;
});
if (!selectedOptions.length) return false;
setData(selector, selectedOptions, true);
return true;
function addSelectedOption(selector, container) {
setData(selector, [convertOptionToJson($(selector).find('option:selected')[0])], true);
}
//
// Prepare custom dropdown icon
function prepareCustomDropdownIcon(config) {
@ -433,8 +422,8 @@ var dropdownSelector = (function() {
}
// Select default value
if (!selectElement.data('ajax-url')) {
addSelectedOptions(selectElement, dropdownContainer);
if (config.noEmptyOption && config.singleSelect) {
addSelectedOption(selectElement, dropdownContainer);
}
// Enable simple mode for dropdown selector

View file

@ -25,7 +25,7 @@ module Dashboard
tasks = tasks.left_outer_joins(:user_my_modules).where(user_my_modules: { user_id: current_user.id })
end
#tasks = filter_by_state(tasks)
tasks = filter_by_state(tasks)
case task_filters[:sort]
when 'start_date'

View file

@ -20,18 +20,9 @@
</div>
<div class="select-block">
<label><%= t("dashboard.current_tasks.filter.display") %></label>
<select class="view-filter"
data-combine-tags="true"
data-placeholder="<%= t("dashboard.current_tasks.filter.statuses.placeholder") %>"
data-select-multiple-all-selected="<%= t("dashboard.current_tasks.filter.statuses.all_selected") %>"
data-select-multiple-name="<%= t("dashboard.current_tasks.filter.statuses.selected") %>"
multiple
>
<% MyModuleStatusFlow.find_each do |status_flow| %>
<% status_flow.my_module_statuses.each do |status| %>
<option value="<%= status.id %>" selected><%= status.name %></option>
<% end %>
<% end %>
<select class="view-filter">
<option value="uncompleted" ><%= t("dashboard.current_tasks.filter.uncompleted_tasks") %></option>
<option value="completed" ><%= t("dashboard.current_tasks.filter.completed_tasks") %></option>
</select>
</div>
<div class="select-block">
@ -89,4 +80,4 @@
<div class="widget-placeholder">
<p class="widget-placeholder-title"><%= I18n.t('dashboard.current_tasks.no_tasks.search_result.title') %></p>
</div>
</template>
</template>

View file

@ -14,11 +14,7 @@ en:
due_date: "Due date"
atoz: "From A to Z"
ztoa: "From Z to A"
display: "Display statuses"
statuses:
placeholder: "Select statuses"
all_selected: "All selected"
selected: "selected"
display: "Display"
uncompleted_tasks: "Tasks in progress"
completed_tasks: "Tasks completed"
project: "Project"