Skip to content

Commit

Permalink
Small changes
Browse files Browse the repository at this point in the history
  • Loading branch information
gryphon committed Feb 21, 2024
1 parent d5bb81c commit b907c9a
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 76 deletions.
124 changes: 52 additions & 72 deletions app/assets/stylesheets/custom_table/table.scss
Original file line number Diff line number Diff line change
@@ -1,28 +1,5 @@
.search-fields-filter {
// .form-group {
// margin-bottom: 0;
// }

// .dates .form-group {
// width: 50%;
// margin-left: 0;
// margin-right: 0;
// float:left;
// }
// input.boolean {
// margin-top: -5px;
// margin-bottom: 0;
// margin-left: -15px;
// margin-right: 5px;
// }
// label.boolean {
// margin-top: 5px;
// margin-bottom: 0;
// white-space: nowrap;
// }
}

table {
table.custom-table {

td.actions {
white-space: nowrap;
Expand All @@ -35,49 +12,32 @@ table {
td.selected {
border: 2px solid rgb(26, 179, 26) !important;
}
}

.table-sum {
position: fixed;
right: 0;
bottom: 0;
width: 150px;
background: white;
border: 2px solid black;
padding: 2px;
text-align: right;
margin-right: 5px;
z-index: 1000;
}
tr {
.action {
visibility: hidden;
&.btn-sm {
padding: 2px 4px !important;
}
}
.d-action-none {
display: none;
}

.widget table.search-fields td {
max-width: 120px;
overflow: hidden;
}

table tr, li.list-group-item {
.action {
visibility: hidden;
}
.d-action-none {
display: none;
}
}
table tr, li.list-group-item {
// .btn-sm {
// padding: 0rem 0.25rem;
// }
}
table tr:hover, li.list-group-item:hover {
.action {
visibility: visible;
}
.d-action-none {
display: inherit;
&:hover {
.action {
visibility: visible;
}
.d-action-none {
display: inherit;
}
}

}
}

table {


tr.sticky, thead.sticky {
position: sticky;
background: white;
Expand All @@ -91,19 +51,39 @@ table {
.text-sm {
font-size: 11px;
}
}

.tree-opener {
cursor: pointer;
.opened {
display: none;
}
&.opened {
.tree-opener {
cursor: pointer;
.opened {
display: inline;
}
.closed {
display: none;
}
&.opened {
.opened {
display: inline;
}
.closed {
display: none;
}
}
}

.table-sum {
position: fixed;
right: 0;
bottom: 0;
width: 150px;
background: white;
border: 2px solid black;
padding: 2px;
text-align: right;
margin-right: 5px;
z-index: 1000;
}

}


.widget table.custom-table td {
max-width: 120px;
overflow: hidden;
}
2 changes: 1 addition & 1 deletion app/helpers/custom_table/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def custom_table_form_for(record, options = {}, &block)
options[:method] = :get

options[:html] ||= {}
options[:html][:class] = "row row-cols-md-auto g-3 align-items-center search-fields-filter"
options[:html][:class] = "row row-cols-md-auto g-3 align-items-center custom-table-filter"
options[:wrapper] = options[:wrapper] || :inline_form

options[:wrapper_mappings] = {
Expand Down
5 changes: 5 additions & 0 deletions app/helpers/custom_table/fieldset_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ def field column, **params, &block
params[:column] = column
params[:object] = @object

hint_key = "simple_form.hints.#{@object.model_name.singular}.#{column}"
if I18n.exists?(hint_key)
params[:hint] = I18n.t(hint_key)
end

@template.render "custom_table/#{params[:template]}", **params do
if params[:editable] && has_editable?
params[:editable_params] = {} if params[:editable_params].nil?
Expand Down
6 changes: 5 additions & 1 deletion app/views/custom_table/_field.haml
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
%div.d-flex.justify-content-between.custom-table-field
%b= label
%b
- if local_assigns[:hint]
%abbr{title: hint}= label
- else
= label
%span.text-end.d-inline{id: "#{column}_#{object.model_name.singular}_#{object.id}"}= yield
-# %dt{class: adaptive ? "col-lg-2 col-md-5" : "col-5"}= label
4 changes: 2 additions & 2 deletions app/views/custom_table/_table.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
- if local_assigns[:batch_actions]
= self.send(local_assigns[:batch_actions])
%table{class: ["search-fields", "table", "table-hover", "table-sm", model_class.model_name.plural], data: {controller: "table toggle"}}
%table{class: ["search-fields", "custom-table", "table", "table-hover", "table-sm", model_class.model_name.plural], data: {controller: "table toggle"}}
%thead.sticky
- if local_assigns[:quick_filter]
%tr
Expand Down Expand Up @@ -111,7 +111,7 @@
- group_fields_totals = {}

- items.each do |item|
- custom_table_fields_totals(fields: fields, item: item, totals: totals, variant: variant, fields_totals: group_fields_totals)
- custom_table_fields_totals(fields: fields, item: item, totals: local_assigns[:totals], variant: variant, fields_totals: group_fields_totals)
%tr
- shown = false
- fields.each do |field, defs|
Expand Down

0 comments on commit b907c9a

Please sign in to comment.