starting on page types, style and buttons

This commit is contained in:
Torsten 2022-12-27 00:50:40 +02:00
parent 527eddb35a
commit 57fdada4fa
8 changed files with 68 additions and 23 deletions

View File

@ -5,6 +5,7 @@ module Merged
def index
@pages = Page.all
@page_styles = PageStyle.all
end
def show
@ -28,7 +29,7 @@ module Merged
flash.now.alert = "Must enter name"
render :index
else
@page = Page.new_page(name)
@page = Page.new_page(name , params[:type])
@page.add_save(current_member.email)
redirect_to new_page_section_url(@page.id) , notice: "Page was successfully created."
end

View File

@ -2,6 +2,7 @@ module Merged
class StylesController < MergedController
def index
@page_styles = PageStyle.all
@section_styles = SectionStyle.all
@cards_styles = CardStyle.all
end

View File

@ -1,6 +1,10 @@
module Merged
class PageStyle < Style
fields :type , :description
fields :type , :description , :section_template
def section_preview
"merged/section_preview/" + section_template
end
end
end

View File

@ -42,4 +42,5 @@
%label.block
%h4.text-lg.font-bold Name
= text_field_tag( :name , params[:name], class: "block w-full rounded-lg border-gray-200 p-4 pr-12 text-sm shadow-sm")
=submit_button( "New Page")
- @page_styles.each do |page|
%button.mt-3.bg-cyan-200{class: button_classes , name: :type , value: page.type}= "New #{page.type.capitalize}"

View File

@ -0,0 +1,9 @@
.overflow-hidden.rounded-lg.border.border-gray-100.shadow-sm
.p-6
%h3.text-lg.font-medium
Options
%p.mt-2.text-sm.leading-relaxed.line-clamp-3
-style.options_definitions.each do | style |
%label.block
.text-lg.font-bold=style.name
=style.description

View File

@ -1,9 +1,43 @@
- content_for( :merged_menu ) do
.text-xl.font-bold
Section styles
Page styles
.text-xl.font-bold
=link_to "Section styles" , "#section_styles"
.text-xl.font-bold
=link_to "Card styles" , "#cards_styles"
= render "layouts/merged_header"
.flex.bg-cyan-100
.px-4.py-8.mx-auto.text-center
%h1.text-4xl.font-bold
Page styles
.grid.grid-cols-3.gap-4.m-8
-@page_styles.each do |style|
%article.overflow-hidden.rounded-lg.border.border-gray-100.shadow-sm
.p-6
%h3.text-lg.font-medium
=style.type
%p.mt-2.text-sm
Shorthand:
=style.section_template
.overflow-hidden.rounded-lg.border.border-gray-100.shadow-sm
.p-6
-if style.section_template
= style.section_template
.w-full.object-contain
=image_tag(style.section_preview )
-else style.section_template
.w-full
Any Section allowed
=render "options" , style: style
#section_styles.flex.bg-cyan-100
.px-4.py-8.mx-auto.text-center
%h1.text-4xl.font-bold
Section styles
.grid.grid-cols-3.gap-4.m-8
-@section_styles.each do | style|
.overflow-hidden.rounded-lg.border.border-gray-100.shadow-sm
@ -27,17 +61,9 @@
.w-full.object-contain.h-72
=image_tag(style.section_preview )
.overflow-hidden.rounded-lg.border.border-gray-100.shadow-sm
.p-6
%h3.text-lg.font-medium
Options
%p.mt-2.text-sm.leading-relaxed.line-clamp-3
-style.options_definitions.each do | style |
%label.block
.text-lg.font-bold=style.name
=style.description
=render "options" , style: style
.flex.bg-cyan-100
#cards_styles.flex.bg-cyan-100
.px-4.py-8.mx-auto.text-center
%h1.text-4xl.font-bold
Card styles
@ -56,12 +82,5 @@
.p-6
.w-full.object-contain.h-72
=image_tag(style.card_preview )
.overflow-hidden.rounded-lg.border.border-gray-100.shadow-sm
.p-6
%h3.text-lg.font-medium
Options
%p.mt-2.text-sm.leading-relaxed.line-clamp-3
-style.options_definitions.each do | style |
%label.block
.text-lg.font-bold=style.name
=style.description
=render "options" , style: style

View File

@ -98,3 +98,8 @@
:values:
:default:
:id: 18
- :name: published
:description: Date when the blog is published
:values:
:default:
:id: 19

View File

@ -4,3 +4,8 @@
No restrictions of any kind. No options either.
options:
- meta
- type: blog
description: An news or similar article.
section_template: section_half_image
options:
- published