Skip to content

Commit

Permalink
Page to show model variants
Browse files Browse the repository at this point in the history
  • Loading branch information
ujh committed Apr 25, 2024
1 parent 3c16027 commit 4657729
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 1 deletion.
3 changes: 3 additions & 0 deletions app/controllers/admins/pens/model_variants_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ def index
.serializable_hash
.to_json
end
format.html do
@clusters = Pens::ModelVariant.includes(:micro_clusters).ordered

Check warning on line 17 in app/controllers/admins/pens/model_variants_controller.rb

View check run for this annotation

Codecov / codecov/patch

app/controllers/admins/pens/model_variants_controller.rb#L17

Added line #L17 was not covered by tests
end
end
end

Expand Down
3 changes: 2 additions & 1 deletion app/javascript/stylesheets/admin/macro-clusters.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.admin-micro-cluster-row {
.admin-micro-cluster-row,
.pens-admin-micro-cluster-row {
font-size: x-small;
a {
font-size: x-small;
Expand Down
34 changes: 34 additions & 0 deletions app/views/admins/pens/model_variants/index.html.slim
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
div class="fpc-table fpc-table--full-width fpc-scroll-shadow"
table class="table table-striped"
thead
tr
th
th Brand
th Model
th Color
th Material
th Trim Color
th Filling System
tbody
- @clusters.each do |model_variant|
tr
td= model_variant.micro_clusters.size
td= model_variant.brand
td= model_variant.model
td= model_variant.color
td= model_variant.material
td= model_variant.trim_color
td= model_variant.filling_system
- if model_variant.micro_clusters.size > 1
tr
td
td colspan="7"
table class="table"
- model_variant.micro_clusters.each do |mc|
tr class="pens-admin-micro-cluster-row"
td= mc.simplified_brand
td= mc.simplified_model
td= mc.simplified_color
td= mc.simplified_material
td= mc.simplified_trim_color
td= mc.simplified_filling_system
1 change: 1 addition & 0 deletions app/views/layouts/admin/_header.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ nav class="fpc-header navbar navbar-dark navbar-expand-md" id="header"
ul class="dropdown-menu"
li= link_to "Clustering app", admins_pens_micro_clusters_path, class: "dropdown-item"
li= link_to "Ignored Micro Clusters", ignored_admins_pens_micro_clusters_path, class: "dropdown-item"
li= link_to "Model Variants", admins_pens_model_variants_path, class: "dropdown-item"
li= link_to "Sidekiq", sidekiq_web_path, class: "nav-link"
li= link_to "Blog", admins_blog_posts_path, class: "nav-link"
li class="dropdown"
Expand Down

0 comments on commit 4657729

Please sign in to comment.