moved gateway code here

This commit is contained in:
2022-11-28 23:58:17 +02:00
parent 596d3eb476
commit d063f58636
66 changed files with 944 additions and 0 deletions

View File

@ -0,0 +1,7 @@
.group.m-4.overflow-hidden.relative.flex.h-96.items-end.bg-black
= image_for( element , "absolute inset-0 h-full w-full object-cover hover:scale-110 ease-in duration-700")
.relative.w-full.bg-cyan-600.m-2.p-4.text-center.tracking-widest.text-white.transition-colors.group-hover:bg-cyan-700{:class => "sm:w-1/2"}
%h3.text-lg.uppercase
= element["header"]
%p.mt-1.text-xs.font-medium
= element["text"]

View File

@ -0,0 +1,2 @@
%a.inline-block.rounded.bg-emerald-600.px-12.py-3.text-sm.font-medium.text-white.transition.hover:bg-emerald-700.focus:outline-none.focus:ring.focus:ring-yellow-400{:href => button["link"]}
=button['text']

View File

@ -0,0 +1,24 @@
.grid.grid-cols-6.gap-4.m-8
.relative.block.border.border-gray-100
%h3.mt-4.text-lg.font-bold Add new image
= form_tag({action: :create}, multipart: true) do
= text_field_tag 'filename'
%h5.mt-4.text-lg.font-bold Name is optional
%p will be taken from uploaded file
= file_field_tag 'image_file'
.inline-block.rounded.border.border-indigo-600.bg-indigo-600.px-12.py-3.text-sm.font-medium.text-white.hover:bg-transparent.hover:text-indigo-600.focus:outline-none.focus:ring.active:text-indigo-500{:href => new_merge_image_path}
= submit_tag 'Submit'
-@images.each do |name , image|
.relative.block.border.border-gray-100
=image_tag("merge/#{name}" , class: "h-56 w-full object-contain lg:h-72")
.p-3
%strong.inline-block.bg-yellow-400.px-3.py-1.text-md.font-medium
= "#{image.size}k"
%strong.inline-block.bg-yellow-400.px-3.py-1.text-md.font-medium
= image.created_at.to_date
%h3.mt-4.text-lg.font-bold
= image.name
%strong.inline-block.bg-yellow-400.px-3.py-1.text-xs.font-medium
=image.type
%p.mt-2.text-sm.text-gray-700

View File

@ -0,0 +1,10 @@
= form_for @merge_page do |f|
- if @merge_page.errors.any?
#error_explanation
%h2= "#{pluralize(@merge_page.errors.count, "error")} prohibited this merge_page from being saved:"
%ul
- @merge_page.errors.full_messages.each do |message|
%li= message
.actions
= f.submit 'Save'

View File

@ -0,0 +1,7 @@
%h1 Editing #{@merge_page.name}
= render 'form'
= link_to 'Show', merge_page_url(@merge_page.name)
\|
= link_to 'Back', merge_pages_path

View File

@ -0,0 +1,33 @@
.overflow-hidden.overflow-x-auto.rounded-lg.border.border-gray-200.m-20
%table.min-w-full.divide-y.divide-gray-200.text-sm
%thead.bg-gray-100
%tr
%th.whitespace-nowrap.px-4.py-2.text-left.font-medium.text-gray-900
.flex.items-center.gap-2
Name
%th.whitespace-nowrap.px-4.py-2.text-left.font-medium.text-gray-900
.flex.items-center.gap-2
First Template
%th.whitespace-nowrap.px-4.py-2.text-left.font-medium.text-gray-900
.flex.items-center.gap-2
Size (Sections)
%th.whitespace-nowrap.px-4.py-2.text-left.font-medium.text-gray-900
Status
%tbody.divide-y.divide-gray-200
- @pages.each do |merge_page|
%tr
%td.whitespace-nowrap.px-4.py-2.text-gray-700
= link_to merge_page.name , merge_page_path(merge_page.name)
%td.whitespace-nowrap.px-4.py-2.text-gray-700
= merge_page.first_template
%td.whitespace-nowrap.px-4.py-2.text-gray-700
= merge_page.content.length
%td.whitespace-nowrap.px-4.py-2
%strong.rounded.bg-green-100.px-3.text-xs.font-medium.text-green-700{:class => "py-1.5"}
= link_to 'Show', merge_page_path(merge_page.name)
%strong.rounded.bg-amber-100.px-3.text-xs.font-medium.text-amber-700{:class => "py-1.5"}
= link_to 'Edit', edit_merge_page_path(merge_page.name)
%section
%a.inline-block.rounded.border.border-indigo-600.bg-indigo-600.px-12.py-3.text-sm.font-medium.text-white.hover:bg-transparent.hover:text-indigo-600.focus:outline-none.focus:ring.active:text-indigo-500{:href => new_merge_page_path}
New Page

View File

@ -0,0 +1,5 @@
%h1 New merge_page
= render 'form'
= link_to 'Back', merge_pages_path

View File

@ -0,0 +1,24 @@
%p#notice= notice
.flex.flex-col.bg-white
.flex.items-center.justify-center.flex-1
.max-w-xl.px-4.py-8.mx-auto.text-center
%h1.text-2xl.font-bold.tracking-tight.text-gray-900.sm:text-4xl
Page #{@page.name}
-@page.sections.each_with_index do |section , index|
.grid.grid-cols-6.gap-2.m-8{class: (index%2)==1 ? 'bg-cyan-50' : 'bg-red-50' }
.relative.block.border.border-gray-100
.p-4
%h3.mt-4.text-lg.font-bold Section #{index + 1}
%button.mt-4.rounded-lg.bg-yellow-500.p-4
=link_to "Up" , "/index"
%button.mt-4.rounded-lg.bg-yellow-500.p-4
=link_to "Down" , "/index"
%button.mt-4.rounded-lg.bg-blue-400.p-4
=link_to "Edit" , merge_page_section_path(@page.name , section.id)
%button.mt-4.rounded-lg.bg-cyan-400.p-4
=link_to "New" , "/index"
%button.mt-4.rounded-lg.bg-red-400.p-4
=link_to "Delete" , "/index"
-section.content.each do |key , value|
= render "merge/sections/overview/#{key}", section: section , key: key , value: value

View File

@ -0,0 +1,10 @@
= form_for @merge_section do |f|
- if @merge_section.errors.any?
#error_explanation
%h2= "#{pluralize(@merge_section.errors.count, "error")} prohibited this merge_section from being saved:"
%ul
- @merge_section.errors.full_messages.each do |message|
%li= message
.actions
= f.submit 'Save'

View File

@ -0,0 +1,7 @@
%h1 Editing merge_section
= render 'form'
= link_to 'Show', @merge_section
\|
= link_to 'Back', merge_sections_path

View File

@ -0,0 +1,9 @@
.relative.block.border.border-gray-100
%h3.mt-4.text-lg.font-bold= key.upcase
%p
.font-bold Text
= value["text"]
.relative.block.border.border-gray-100
%p
.font-bold Link
= value["link"]

View File

@ -0,0 +1,7 @@
.relative.block.border.border-gray-100
%h3.mt-4.text-lg.font-bold= key.upcase
%p= value
%p #{section.content['cards'].length} cards
%p view cards (index)
.relative.block.border.border-gray-100
=image_tag("merge/card_preview/#{value}" , class: "w-full object-contain")

View File

@ -0,0 +1,6 @@
.relative.block.border.border-gray-100
%h3.mt-4.text-lg.font-bold= key.upcase
= section_form( class: "mx-auto mt-8 mb-0 max-w space-y-4") do
= text_field_tag( :header , @section.content["header"], class: "w-full.rounded-lg.border-gray-200.p-4.pr-12.text-sm.shadow-sm")
%button.ml-3.inline-block.rounded-lg.bg-blue-500.px-5.py-3.text-sm.font-medium.text-white{:type => "submit"}
Update

View File

@ -0,0 +1,13 @@
.relative.block.border.border-gray-100
%h3.mt-4.text-lg.font-bold= key.upcase
%button.ml-3.inline-block.rounded-lg.bg-blue-500.px-5.py-3.text-md.font-medium.text-white
=link_to "Change Image" , merge_page_section_select_image_url(@page.name,@section.id)
%button.ml-3.inline-block.rounded-lg.bg-red-500.px-5.py-3.text-md.font-medium.text-white
= link_to( "Remove image" , merge_page_section_set_image_path( @page.name, @section.id , image: ""))
.relative.block.border.border-gray-100
-if( value.blank? )
No image
-else
= image_tag( "merge/" + value)

View File

@ -0,0 +1,5 @@
.relative.block.border.border-gray-100
%h3.mt-4.text-lg.font-bold= key.upcase
%p= value
.relative.block.border.border-gray-100
=image_tag("merge/section_preview/#{section.template}" , class: "w-full object-contain")

View File

@ -0,0 +1,7 @@
.relative.block.border.border-gray-100
%h3.mt-4.text-lg.font-bold= key.upcase
.relative.block.border.border-gray-100
= section_form( class: "mx-auto mt-8 mb-0 max-w space-y-4") do
= text_area_tag( :text , @section.content["text"], class: "w-full rounded-lg border-gray-200 p-4 pr-12 text-sm shadow-sm")
%button.ml-3.inline-block.rounded-lg.bg-blue-500.px-5.py-3.text-sm.font-medium.text-white{:type => "submit"}
Update

View File

@ -0,0 +1,19 @@
%h1 Listing merge_sections
%table
%thead
%tr
%th
%th
%th
%tbody
- @merge_sections.each do |merge_section|
%tr
%td= link_to 'Show', merge_section
%td= link_to 'Edit', edit_merge_section_path(merge_section)
%td= link_to 'Destroy', merge_section, method: :delete, data: { confirm: 'Are you sure?' }
%br
= link_to 'New Section', new_merge_section_path

View File

@ -0,0 +1,5 @@
%h1 New merge_section
= render 'form'
= link_to 'Back', merge_sections_path

View File

@ -0,0 +1,8 @@
.p-6
%h3.mt-4.text-lg.font-bold= key.upcase
%p
.font-bold Text
= value["text"]
%p
.font-bold Link
= value["link"]

View File

View File

@ -0,0 +1,5 @@
.p-6
%h3.mt-4.text-lg.font-bold= key.upcase
%p= value
=image_tag("merge/card_preview/#{value}" , class: "w-full object-contain")
%p #{section.content['cards'].length} cards

View File

@ -0,0 +1,3 @@
.p-6
%h3.mt-4.text-lg.font-bold= key.upcase
%p= value

View File

@ -0,0 +1,6 @@
.p-6
%h3.mt-4.text-lg.font-bold= key.upcase
-if value
= image_tag "merge/" + value
-else
No image

View File

@ -0,0 +1,4 @@
.p-6
%h3.mt-4.text-lg.font-bold= key.upcase
%p= value
=image_tag("merge/section_preview/#{section.template}" , class: "w-full object-contain")

View File

@ -0,0 +1,3 @@
.p-6
%h3.mt-4.text-lg.font-bold= key.upcase
%p= value

View File

@ -0,0 +1,15 @@
.grid.grid-cols-6.gap-2.m-8
.relative.block.border.border-gray-100
%h3.mt-4.text-lg.font-bold Add new image or select (click)
= form_tag(merge_images_path, multipart: true) do
= text_field_tag 'filename'
%h5.mt-4.text-lg.font-bold Name is optional
%p will be taken from uploaded file
= hidden_field_tag :redirect , merge_page_section_set_image_url(@page.name,@section.id,image: "NEW")
= file_field_tag 'image_file'
.inline-block.rounded.border.border-indigo-600.bg-indigo-600.px-12.py-3.text-sm.font-medium.text-white.hover:bg-transparent.hover:text-indigo-600.focus:outline-none.focus:ring.active:text-indigo-500{:href => new_merge_image_path}
= submit_tag 'Submit'
-@images.each do |name , image|
.relative.block.border.border-gray-100
= link_to( merge_page_section_set_image_path( image: name)) do
=image_tag("merge/#{name}" , class: "h-56 w-full object-contain lg:h-72")

View File

@ -0,0 +1,18 @@
%p#notice= notice
.flex.flex-col.bg-white
.flex.items-center.justify-center.flex-1
.max-w-xl.px-4.py-8.mx-auto.text-center
%h1.text-2xl.font-bold.tracking-tight.text-gray-900
Page #{@page.name}
.flex.items-center.justify-center.flex-1
%h3.text-xl.font-bold.tracking-tight.text-gray-900
Section #{@section.id}
.grid.grid-cols-2.gap-2.m-8
- @section.content.each do |key , value|
= render "merge/sections/editors/#{key}", section: @section , key: key , value: value
= #link_to 'Edit', edit_merge_section_path(@merge_section)
\|
= #link_to 'Back', merge_sections_path

View File

@ -0,0 +1,11 @@
.flex.flex-col.bg-cyan-100.mx-5
.flex.items-center.justify-center.flex-1
.max-w-prose.px-4.py-8.mx-auto.text-center
%h1.text-2xl.font-bold.tracking-tight.text-gray-900.sm:text-4xl
= section["header"]
%p.mt-4.text-gray-500
= section["text"]
- template = "cards/" + section["card_template"]
.grid.grid-cols-1.md:grid-cols-2
- section["cards"].each do |element|
= render( template , element: element)

View File

@ -0,0 +1,13 @@
%section.overflow-hidden.bg-cover.bg-center.bg-no-repeat{style: bg(section)}
.p-8.md:p-12.lg:px-16.lg:py-24
.max-w-lg.text-center.sm:text-left{:class => "bg-black/25"}
%h2.text-2xl.font-bold.text-white.sm:text-3xl.md:text-5xl
= section["header"]
%p.hidden.max-w-md.md:mt-6.md:block.md:text-lg.md:leading-relaxed{:class => "text-white/90"}
= section["text"]
-if section["button_text"]
.mt-4.sm:mt-8
%a.inline-flex.items-center.rounded-full.bg-indigo-700.px-8.py-3.text-white.shadow-lg.transition.hover:bg-indigo-600.focus:outline-none.focus:ring{:href => section["button_link"]}
%span.text-sm.font-medium section["button_text"]
%svg.ml-3.h-5.w-5{:fill => "none", :stroke => "currentColor", :viewbox => "0 0 24 24", :xmlns => "http://www.w3.org/2000/svg"}
%path{:d => "M17 8l4 4m0 0l-4 4m4-4H3", "stroke-linecap" => "round", "stroke-linejoin" => "round", "stroke-width" => "2"}

View File

@ -0,0 +1,14 @@
%section.overflow-hidden.bg-cover.bg-center.bg-no-repeat{style: bg(section)}
.mx-auto.max-w-screen-2xl.px-4.py-8.sm:px-6.lg:px-8
.grid.grid-cols-1.gap-4.md:grid-cols-2
.p-8.md:p-12.lg:px-16.lg:py-24{class: 'bg-black/25'}
.mx-auto.max-w-xl.text-center
%h2.text-2xl.font-bold.text-white.md:text-5xl
= section["header"]
%p.hidden.sm:mt-4.sm:block.text-2xl.text-white
= section["text"]
.mt-4.md:mt-8
-if section["button_text"]
%a.inline-block.rounded.border.border-white.bg-white.px-12.py-3.text-sm.font-medium.text-blue-500.transition.hover:bg-transparent.hover:text-white.focus:outline-none.focus:ring.focus:ring-yellow-400{:href => section["button_link"]}
=section["button_text"]
.grid.grid-cols-2.gap-4.md:grid-cols-1.lg:grid-cols-2

View File

@ -0,0 +1,7 @@
.flex.flex-col.bg-white
.flex.items-center.justify-center.flex-1
.max-w-xl.px-4.py-8.mx-auto.text-center
%h1.text-2xl.font-bold.tracking-tight.text-gray-900.sm:text-4xl
= section["header"]
%p.mt-4.text-gray-500
= section["text"]

View File

@ -0,0 +1,14 @@
%section
.mx-auto.max-w-screen-xl.px-4.py-16.sm:px-6.sm:py-24.lg:px-8
.max-w-3xl
%h2.text-3xl.font-bold.sm:text-4xl
= section["header"]
.mt-8.grid.grid-cols-1.gap-8.lg:grid-cols-2.lg:gap-16
.relative.h-64.overflow-hidden.sm:h-80.lg:h-full
%img.absolute.inset-0.h-full.w-full.object-cover{:alt => "Party", :src => "https://images.unsplash.com/photo-1496843916299-590492c751f4?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1771&q=80"}/
.lg:py-16
%article.space-y-4.text-gray-600
%p
= section["text"]
%p
= section["text"]

View File

@ -0,0 +1,11 @@
%section.overflow-hidden.sm:grid.sm:grid-cols-2
= image_for( section , "p-5 h-56 w-full object-cover sm:h-full")
.p-8.m-5.bg-cyan-100.md:p-12.lg:px-16.lg:py-24
.mx-auto.max-w-xl.text-center.sm:text-left
%h2.text-2xl.font-bold.text-gray-900.md:text-3xl
= section["header"]
%p.hidden.text-gray-500.md:mt-4.md:block
= section["text"]
.mt-4.md:mt-8
-if section["button"]
= render 'elements/button' , button: section["button"]

View File

@ -0,0 +1,11 @@
%section.overflow-hidden.sm:grid.sm:grid-cols-2
.p-8.m-5.bg-cyan-100.md:p-12.lg:px-16.lg:py-24
.mx-auto.max-w-xl.text-center.sm:text-left
%h2.text-2xl.font-bold.text-gray-900.md:text-3xl
= section["header"]
%p.hidden.text-gray-500.md:mt-4.md:block
= section["text"]
.mt-4.md:mt-8
-if section["button"]
= render 'elements/button' , button: section["button"]
= image_for( section , "p-5 h-56 w-full object-cover sm:h-full")

View File

@ -0,0 +1 @@
.h-24

View File

@ -0,0 +1,3 @@
- @data.each do |section|
- template = find_template(section)
= render( template , section: section)