define styles per page type

This commit is contained in:
Andrew Brown 2023-03-07 20:10:28 -08:00
parent f4c532583f
commit 91db022755
2 changed files with 30 additions and 8 deletions

View File

@ -1,6 +1,26 @@
class BasilService < Service
IGNORED_VALUES = ['none', 'n/a', '.', '-', ' ', '?', '??', '???', 'x', nil]
def self.enabled_styles_for(page_type)
case page_type
when 'Character'
%w(realistic painting sketch digital abstract)
when 'Location'
%w(realistic painting sketch)
else
%w(Default)
end
end
def self.experimental_styles_for(page_type)
case page_type
when 'Character'
%w(anime painting2 horror watercolor)
else
[]
end
end
def self.include_all_fields_in_category(user, page, category_label)
category = AttributeCategory.where(
user_id: user.id,

View File

@ -84,7 +84,7 @@ function commission_basil(style) {
<div class="col s12 m2" style="margin-top: 1rem">
<% if @can_request_another && @relevant_fields.any? %>
<div class="grey-text center"><strong>Available styles</strong></div>
<% %w(realistic painting sketch digital anime abstract).each do |style| %>
<% BasilService.enabled_styles_for(@content.page_type).each do |style| %>
<%= link_to "javascript:commission_basil('#{style}')" do %>
<div class="hoverable card-panel purple white-text">
<%= style.humanize %>
@ -95,13 +95,15 @@ function commission_basil(style) {
<% end %>
<% if @can_request_another && @relevant_fields.any? %>
<div class="grey-text center"><strong>Experimental styles</strong></div>
<% %w(painting2 horror watercolor).each do |style| %>
<%= link_to "javascript:commission_basil('#{style}')" do %>
<div class="hoverable card-panel purple white-text">
<%= style.humanize %>
<i class="material-icons right">chevron_right</i>
</div>
<% if BasilService.experimental_styles_for(@content.page_type).any? %>
<div class="grey-text center"><strong>Experimental styles</strong></div>
<% BasilService.experimental_styles_for(@content.page_type).each do |style| %>
<%= link_to "javascript:commission_basil('#{style}')" do %>
<div class="hoverable card-panel purple white-text">
<%= style.humanize %>
<i class="material-icons right">chevron_right</i>
</div>
<% end %>
<% end %>
<% end %>
<% end %>