auto-expand worldbuilding sidebar pages

This commit is contained in:
Andrew Brown 2023-04-18 19:55:08 -07:00
parent 4c52702ebc
commit 1577eccc7b
2 changed files with 8 additions and 5 deletions

View File

@ -1,16 +1,14 @@
class CustomizationController < ApplicationController
layout 'tailwind'
# todo require login for all actions :O
before_action :authenticate_user!
before_action :verify_content_type_can_be_toggled, only: [:toggle_content_type]
def content_types
return redirect_to(root_path) unless user_signed_in?
@all_content_types = Rails.application.config.content_types[:all]
@premium_content_types = Rails.application.config.content_types[:premium]
@my_activators = current_user.user_content_type_activators.pluck(:content_type)
@sidenav_expansion = 'worldbuilding'
@page_title = "Customize your notebook pages"
end

View File

@ -38,7 +38,7 @@
<% end %>
-->
<div x-data="{ expandedWorldbuildingSidebar: false }">
<div x-data="{ expandedWorldbuildingSidebar: <%= @sidenav_expansion == 'worldbuilding' %> }">
<div class="flex items-center justify-between px-2 py-3 transition cursor-pointer group hover:bg-gray-100 hover:text-gray-900" role="button" @click="expandedWorldbuildingSidebar = !expandedWorldbuildingSidebar" >
<div class="flex items-center">
<i class="material-icons text-notebook-blue shrink-0 w-6 h-6 mr-2">book</i>
@ -59,6 +59,11 @@
</span>
<% end %>
<% end %>
<%= link_to main_app.customization_content_types_path, class: 'flex items-center px-4 py-2 cursor-pointer group hover:bg-notebook-blue hover:text-white rounded-l-full' do %>
<i class="material-icons text-notebook-blue shrink-0 w-6 h-6 lg:w-8 lg:h-8 lg:p-1 mr-2 bg-white rounded-full">add</i>
<span class="flex-grow text-sm">Add more...</span>
<% end %>
</div>
</div>