Skip to content

Commit

Permalink
Closes #24 again
Browse files Browse the repository at this point in the history
  • Loading branch information
lentschi committed Mar 1, 2024
1 parent d0f321c commit 6cb809e
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 8 deletions.
19 changes: 14 additions & 5 deletions app/assets/stylesheets/bootstrap_and_overrides.css.less
Original file line number Diff line number Diff line change
Expand Up @@ -603,28 +603,37 @@ span.negative_amout {
align-items: center;
}

.m-0 {
margin:0 !important;
}

.ml-1 {
margin-left: 3px;
margin-left: 3px !important;
}

.ml-2 {
margin-left: 6px !important;
}

td.ml-1 > *:first-child {
margin-left: 3px;
margin-left: 3px !important;
}


.mr-1 {
margin-right: 3px;
margin-right: 3px !important;
}

td.mr-1 > *:last-child {
margin-right: 3px;
}

.mt-1 {
margin-top: 3px;
margin-top: 3px !important;
}

.mb-1 {
margin-bottom: 3px;
margin-bottom: 3px !important;
}

.text-decoration-none:hover {
Expand Down
3 changes: 2 additions & 1 deletion app/controllers/article_units_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ def search

unless @query.nil?
@article_units = @article_units.select do |_key, value|
value[:name].downcase.include?(@query) || value[:symbol]&.downcase&.include?(@query)
(value[:name].downcase.include?(@query) || value[:symbol]&.downcase&.include?(@query)) &&
(params[:only_recommended] == "0" || !value[:untranslated])
end
end

Expand Down
7 changes: 5 additions & 2 deletions app/views/article_units/index.html.haml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
=form_with url: search_article_units_path, method: :get, id: :article_unit_search_form, html: {'data-remote': true} do |form|
= form.text_field :q, id: :article_unit_search, placeholder: t('.search')
.d-flex.align-items-center
= form.text_field :q, id: :article_unit_search, placeholder: t('.search'), class: 'm-0'
= form.check_box :only_recommended, id: :only_recommended, class: 'm-0 ml-2', checked: true
= form.label :only_recommended, t('.only_recommended'), class: 'm-0 ml-1', for: :only_recommended

%table.table.table-striped
%thead
Expand Down Expand Up @@ -31,7 +34,7 @@
}

$(document).ready(function () {
$('#article_unit_search').on('input', debounce(250, () => {
$('#article_unit_search, #only_recommended').on('input', debounce(250, () => {
$('#article_unit_search_form').submit();
}));
});
Expand Down

0 comments on commit 6cb809e

Please sign in to comment.