diff --git a/app/assets/images/remove.svg b/app/assets/images/remove.svg new file mode 100644 index 000000000..9e874f845 --- /dev/null +++ b/app/assets/images/remove.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/app/assets/stylesheets/splats.css b/app/assets/stylesheets/splats.css index 69df04e2f..1d1b2fb40 100644 --- a/app/assets/stylesheets/splats.css +++ b/app/assets/stylesheets/splats.css @@ -34,10 +34,31 @@ } } +.splat__category { + aspect-ratio: 1; + background-color: var(--color-bg); + border: 0.5em solid var(--splat-color); + border-radius: 50%; + color: var(--splat-color); + display: flex; + font-size: 5cqi; + font-weight: 800; + inset: auto auto 3cqi 3cqi; + padding: 0.5em 1em; + place-items: center; + position: absolute; + + + & { + inset: auto auto 0 24cqi; + } +} + .splat__date { aspect-ratio: 1; - background-color: var(--splat-color); + background-color: var(--color-bg); + border: 0.5em solid var(--splat-color); border-radius: 50%; + color: var(--splat-color); display: flex; font-size: 5cqi; font-weight: 800; @@ -59,23 +80,6 @@ z-index: -1; } -.splat__tag { - aspect-ratio: 1; - background-color: var(--splat-color); - border-radius: 50%; - display: flex; - font-size: 5cqi; - font-weight: 800; - inset: auto auto 3cqi 3cqi; - padding: 0.5em 1em; - place-items: center; - position: absolute; - - + & { - inset: auto auto 0 24cqi; - } -} - .splat__title { font-size: 10cqi; line-height: 1.2; diff --git a/app/controllers/splats_controller.rb b/app/controllers/splats_controller.rb index 787e98952..ae5408174 100644 --- a/app/controllers/splats_controller.rb +++ b/app/controllers/splats_controller.rb @@ -2,7 +2,12 @@ class SplatsController < ApplicationController before_action :set_splat, only: [ :show, :edit, :update ] def index - @splats = Splat.all + if params[:category_id] + @category = Category.find(params[:category_id]) + @splats = @category.splats + else + @splats = Splat.all + end end def new diff --git a/app/views/splats/_splat.html.erb b/app/views/splats/_splat.html.erb index 9a1f0c6eb..50a8587ba 100644 --- a/app/views/splats/_splat.html.erb +++ b/app/views/splats/_splat.html.erb @@ -5,7 +5,7 @@ <% end %> - <% if splat.categories.any? %> - <%= splat.categories.first.title %> + <% splat.categories.each do | category | %> + <%= link_to category.title, splats_path(category_id: category.id), class: "splat__category" %> <% end %> diff --git a/app/views/splats/index.html.erb b/app/views/splats/index.html.erb index a4737cbee..035630b3b 100644 --- a/app/views/splats/index.html.erb +++ b/app/views/splats/index.html.erb @@ -5,6 +5,19 @@ Settings +