Skip to content

Commit

Permalink
Merge pull request #1357 from concord-consortium/188117054-search-sty…
Browse files Browse the repository at this point in the history
…ling-part-2

feat: Update search styling, part 2 [PT-188117054]
  • Loading branch information
dougmartin committed Sep 5, 2024
2 parents fccd73c + a287a63 commit f9e1d2a
Show file tree
Hide file tree
Showing 9 changed files with 219 additions and 176 deletions.
153 changes: 82 additions & 71 deletions rails/app/assets/stylesheets/web/search_materials.scss
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,10 @@
line-height: normal;
text-align: center;
vertical-align: middle;
display: none;

@media screen and (max-width: 950px) {
br { display: none;} // remove line break on smaller screens
@media screen and (min-width: 1170px) {
& { display: block;} // show only on larger screens
}

a {
Expand All @@ -65,7 +66,6 @@
font-size: 12px;
margin-top: 10px;
min-height: 20px;
padding: 5px;
position: relative;

#showhidefilters {
Expand All @@ -80,78 +80,89 @@
flex-flow: row wrap;
height: auto;
min-height: 400px;

.filter-group {
flex: 23.25%;
max-width: 23.25%;
padding: .875%;

.filter-group__options {
background: #fff;
border: solid 1px #999;
height: 146px;
max-height: 146px;
overflow-x: hidden;
overflow-y: scroll;
padding: 5px;
text-overflow: ellipsis;
white-space: nowrap;

label {
text-transform: none;
vertical-align: middle;
}

input[type="checkbox"] {
vertical-align: middle;
}

&.select-menu {
background: transparent;
border: none;
height: auto;
margin-top: -2.5px;
padding: 0;

select {
background: #fff;
border: solid 1px #999;
}
}
align-content: flex-start;
gap: 10px;
padding: 10px;

.filter-row {
display: flex;
width: 100%;
flex-grow: 1;
gap: 10px;

&.flex-col {
flex-direction: column;
}
&.two-col {
flex: 48.25%;
max-width: 48.25%;
&.flex-row {
flex-direction: row;
}
}
.filter-stack-wrap {
flex: 23.25%;
max-width: 23.25%;
padding: .875%;

.filter-group {
flex: 100%;
margin-bottom: 1.75%;
max-width: 100%;
padding: 0;

.filter-group__options {
height: auto;
}
&.full-height {
height: 100%;
}
}
.full-col {
flex: 98.25%;
height: 25px;
max-height: 25px;
max-width: 98.25%;
padding: .875%;

.filterheader {
float: left;
margin-right: 5px;

&.flex-shrink {
flex-grow: 0;
}
}

.filter-group {
flex: 1;

&.sort-by {
display: flex;
gap: 10px;
align-items: center;
margin-top: 10px;

select {
padding: 5px;
}
}

.filter-group__options {
background: #fff;
border: solid 1px #999;
overflow-x: hidden;
overflow-y: scroll;
padding: 5px;
text-overflow: ellipsis;
white-space: nowrap;
max-height: 125px;

&.auto-overflow {
overflow: auto;
}

&.projects {
max-height: 150px;
}
&.sensors {
max-height: 300px;
}

label {
text-transform: none;
vertical-align: middle;
}

input[type="checkbox"] {
vertical-align: middle;
}

&.select-menu {
background: transparent;
border: none;
height: auto;
margin-top: -2.5px;
padding: 0;

select {
background: #fff;
border: solid 1px #999;
}
}
}
}
}
}
}
.filters {
Expand Down
38 changes: 23 additions & 15 deletions rails/app/models/search.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ class Search
attr_accessor :investigation_page
attr_accessor :interactive_page
attr_accessor :collection_page
attr_accessor :activity_per_page
attr_accessor :investigation_per_page
attr_accessor :interactive_per_page
attr_accessor :collection_per_page
attr_accessor :per_page
attr_accessor :user_id
attr_accessor :user
Expand Down Expand Up @@ -134,17 +138,21 @@ def initialize(opts={})
self.sort_order = opts[:sort_order] || Newest
self.per_page = opts[:per_page] || 10

self.activity_page = opts[:activity_page] || 1
self.investigation_page = opts[:investigation_page] || 1
self.interactive_page = opts[:interactive_page] || 1
self.collection_page = opts[:collection_page] || 1
self.without_teacher_only = opts[:without_teacher_only]|| true
self.material_properties = opts[:material_properties] || []
self.include_contributed = opts[:include_contributed] || false
self.include_mine = opts[:include_mine] || false
self.include_official = opts[:include_official] || false
self.include_templates = opts[:include_templates] || false
self.show_archived = opts[:show_archived] || false
self.activity_page = opts[:activity_page] || 1
self.investigation_page = opts[:investigation_page] || 1
self.interactive_page = opts[:interactive_page] || 1
self.collection_page = opts[:collection_page] || 1
self.activity_per_page = opts[:activity_per_page] || self.per_page
self.investigation_per_page = opts[:investigation_per_page] || self.per_page
self.interactive_per_page = opts[:interactive_per_page] || self.per_page
self.collection_per_page = opts[:collection_per_page] || self.per_page
self.without_teacher_only = opts[:without_teacher_only] || true
self.material_properties = opts[:material_properties] || []
self.include_contributed = opts[:include_contributed] || false
self.include_mine = opts[:include_mine] || false
self.include_official = opts[:include_official] || false
self.include_templates = opts[:include_templates] || false
self.show_archived = opts[:show_archived] || false

self.fetch_available_filter_options()

Expand Down Expand Up @@ -250,13 +258,13 @@ def search
add_custom_search_filters(s)

if (type == ActivityMaterial)
s.paginate(:page => self.activity_page, :per_page => self.per_page)
s.paginate(:page => self.activity_page, :per_page => self.activity_per_page)
elsif (type == InvestigationMaterial)
s.paginate(:page => self.investigation_page, :per_page => self.per_page)
s.paginate(:page => self.investigation_page, :per_page => self.investigation_per_page)
elsif (type == InteractiveMaterial)
s.paginate(:page => self.interactive_page, :per_page => self.per_page)
s.paginate(:page => self.interactive_page, :per_page => self.interactive_per_page)
elsif (type == CollectionMaterial)
s.paginate(:page => self.collection_page, :per_page => self.per_page)
s.paginate(:page => self.collection_page, :per_page => self.collection_per_page)
end

end
Expand Down
Loading

0 comments on commit f9e1d2a

Please sign in to comment.