Simplify UX of work package highlighting settings

pull/6715/head
Wieland Lindenthal 6 years ago
parent 8d00c58343
commit 0ad4ae22bb
  1. 25
      app/assets/javascripts/settings.js.erb
  2. 8
      app/views/settings/_work_packages.html.erb
  3. 6
      config/locales/en.yml

@ -100,5 +100,30 @@ See docs/COPYRIGHT.rdoc for more details.
.removeAttr('required') // Rails 4.0 still seems to use attribute
.prop('required', wasChecked);
})
/** Toggle highlighted attributes visibility depending on if the highlighting mode 'inline' was selected*/
$('.settings--highlighting-mode select').change(function() {
var highlightingMode = $(this).val();
if (highlightingMode === "inline") {
$(".settings--highlighted-attributes").show();
} else {
$(".settings--highlighted-attributes").hide();
}
})
/** Initialize hightlighted attributes checkboxes. If none is selected, it means we want them all. So let's
* show them all as selected.
* On submitting the form, we remove all checkboxes before sending to communicate, we actually want all and not
* only the selected.*/
if ($(".settings--highlighted-attributes input[type='checkbox']:checked").length == 0) {
$(".settings--highlighted-attributes input[type='checkbox']").prop("checked", true);
}
$('#tab-content-work_packages form').submit(function() {
var availableAttributes = $(".settings--highlighted-attributes input[type='checkbox']");
var selectedAttributes = $(".settings--highlighted-attributes input[type='checkbox']:checked");
if (selectedAttributes.length == availableAttributes.length) {
availableAttributes.prop("checked", false);
}
})
});
}(jQuery));

@ -34,7 +34,7 @@ See docs/COPYRIGHT.rdoc for more details.
<div class="form--field"><%= setting_check_box :work_package_startdate_is_adddate %></div>
<div class="form--field"><%= setting_select :work_package_done_ratio, WorkPackage::DONE_RATIO_OPTIONS.collect {|i| [t("setting_work_package_done_ratio_#{i}"), i]}, container_class: '-middle' %></div>
<div class="form--field"><%= setting_text_field :work_packages_export_limit, size: 6, container_class: '-xslim' %></div>
<div class="form--field">
<div class="form--field settings--highlighting-mode">
<%= setting_select :work_package_list_default_highlighting_mode,
Query::Highlighting::QUERY_HIGHLIGHTING_MODES.map { |mode|
[t("settings.highlighting.mode_long.#{mode}"), mode]
@ -42,16 +42,12 @@ See docs/COPYRIGHT.rdoc for more details.
container_class: '-middle'
%>
</div>
<div class="form--field settings--highlighted-attributes">
<div class="form--field settings--highlighted-attributes" style="<%= 'display: none' unless Setting[:work_package_list_default_highlighting_mode] == 'inline' %>">
<%= setting_multiselect :work_package_list_default_highlighted_attributes,
Query.available_columns(nil).select(&:highlightable).map { |column|
[column.caption, column.name.to_s]
}
%>
<span class="form--field-instructions">
<%= t('settings.highlighting.instructions.inline.choose_inline') %><br/>
<%= t('settings.highlighting.instructions.inline.unselect_all') %>
</span>
</div>
</section>
<fieldset class="form--fieldset"><legend class="form--fieldset-legend"><%= t(:setting_column_options) %></legend>

@ -2123,12 +2123,6 @@ en:
status: "Entire row by Status"
type: "Entire row by Type"
priority: "Entire row by Priority"
instructions:
inline:
choose_inline: |-
To make this setting have an effect, please choose "Highlighted attribute(s) inline" as default
highlighting mode.
unselect_all: "Unselecting all will highlight all highlightable columns"
text_formatting:
markdown: 'Markdown'

Loading…
Cancel
Save