restyle onboarding universe field type

This commit is contained in:
Andrew Brown 2023-02-16 13:33:52 -08:00
parent 0470cb8521
commit eebbfe11ef
3 changed files with 32 additions and 14 deletions

View File

@ -155,7 +155,7 @@ class ContentController < ApplicationController
# If the user doesn't have this content type enabled, go ahead and automatically enable it for them
current_user.user_content_type_activators.find_or_create_by(content_type: @content.class.name)
return redirect_to edit_polymorphic_path(@content)
return redirect_to polymorphic_path(@content, editing: true)
else
return redirect_to(subscription_path, notice: "#{@content.class.name.pluralize} require a Premium subscription to create.")
end

View File

@ -51,7 +51,7 @@
</template>
</div>
<div
class="bg-blue-100 px-4 py-2 mt-4 rounded-lg"
class="bg-blue-100 px-4 py-2 mt-4 rounded-lg hover:shadow"
x-data="{ showClickableTags: false }"
>
<div

View File

@ -1,12 +1,30 @@
<div>
<%= hidden_field_tag "field[name]", field[:id] %>
<%=
select_tag "field[value]",
options_for_select(
@linkables_raw['Universe'].compact.sort_by(&:name).map { |u| [u.name, u.id] },
raw_model.try(:universe_id) || @universe_scope.try(:id)
),
include_blank: true,
class: 'autosave-closest-form-on-change block w-full px-3 py-2 text-base border-gray-300 focus:outline-none focus:ring-purple-800 focus:border-purple-800 sm:text-sm rounded-md'
%>
</div>
<% if @linkables_raw.fetch('Universe', []).any? %>
<div>
<%= hidden_field_tag "field[name]", field[:id] %>
<%=
select_tag "field[value]",
options_for_select(
@linkables_raw['Universe'].compact.sort_by(&:name).map { |u| [u.name, u.id] },
raw_model.try(:universe_id) || @universe_scope.try(:id)
),
include_blank: true,
class: 'autosave-closest-form-on-change block w-full px-3 py-2 text-base border-gray-300 focus:outline-none focus:ring-purple-800 focus:border-purple-800 sm:text-sm rounded-md'
%>
</div>
<% else %>
<%= link_to new_universe_path do %>
<div class="bg-purple-200 p-4 rounded-lg flex hover:shadow-md">
<i class="material-icons text-4xl mr-3"><%= Universe.icon %></i>
<div class="flex-1">
<p>
You haven't created any universes yet!
</p>
<p class="text-xs">
Universes allow you to organize your separate worlds and focus on just one universe's pages at a time. Your changes here are automatically saved. Click this box to go
create your first universe.
</p>
</div>
</div>
<% end %>
<% end %>