use _path in views, and scope to engine

This commit is contained in:
Torsten 2022-12-21 00:09:44 +02:00
parent ca029d274c
commit 529fe6d3de
21 changed files with 70 additions and 106 deletions

View File

@ -1,6 +1,5 @@
module Merged module Merged
class MergedController < ApplicationController class MergedController < ::ApplicationController
# layout 'merged_layout' before_action :authenticate_member!
end end
end end

View File

@ -14,7 +14,7 @@ module Merged
@page.add_redirect @page.add_redirect
@page.name = params[:name] @page.name = params[:name]
@page.save @page.save
redirect_to page_path(@page) , notice: "Page renamed" redirect_to page_url(@page) , notice: "Page renamed"
end end
def create def create

View File

@ -5,15 +5,15 @@
%ul.flex.items-center.gap-6.text-lg %ul.flex.items-center.gap-6.text-lg
%li %li
%a.text-gray-500.transition{:class => "hover:text-gray-500/75", :href => pages_path} %a.text-gray-500.transition{:class => "hover:text-gray-500/75", :href => merged.pages_path}
Pages Pages
%li %li
%a.text-gray-500.transition{:class => "hover:text-gray-500/75", :href => images_path} %a.text-gray-500.transition{:class => "hover:text-gray-500/75", :href => merged.images_path}
Images Images
%li %li
%a.text-gray-500.transition{:class => "hover:text-gray-500/75", :href => styles_index_path} %a.text-gray-500.transition{:class => "hover:text-gray-500/75", :href => merged.styles_index_path}
Styles Styles
%li %li
%a.text-gray-500.transition{:class => "hover:text-gray-500/75", :href => changes_index_path} %a.text-gray-500.transition{:class => "hover:text-gray-500/75", :href => merged.changes_index_path}
Changes Changes
= yield :merged_menu = yield :merged_menu

View File

@ -1,29 +0,0 @@
-if flash.alert
#flash
.m-20.rounded.border-l-4.border-red-500.bg-red-50.p-4{:role => "alert"}
%strong.block.font-medium.text-red-700 Oops
%p.mt-2.text-sm.text-red-700
=flash.alert
-if flash.notice
#flash
.m-20.rounded-xl.border.border-gray-100.p-4.shadow-xl{:role => "alert"}
.flex.items-start.gap-4
%span.text-green-600
%svg.h-6.w-6{:fill => "none", :stroke => "currentColor", "stroke-width" => "1.5", :viewbox => "0 0 24 24", :xmlns => "http://www.w3.org/2000/svg"}
%path{:d => "M9 12.75L11.25 15 15 9.75M21 12a9 9 0 11-18 0 9 9 0 0118 0z", "stroke-linecap" => "round", "stroke-linejoin" => "round"}
.flex-1
%strong.block.font-medium.text-gray-900 Ok
%p.mt-1.text-sm.text-gray-700
= flash.notice
:javascript
function hideNotice() {
const notification = document.querySelector('#flash')
if (notification) {
setInterval(function() {
notification.classList.add('hidden');
}, 5000);
}
}
hideNotice();

View File

@ -1,14 +0,0 @@
!!!
%html
%head
%meta{:content => "text/html; charset=UTF-8", "http-equiv" => "Content-Type"}/
%title Merged CMS
%meta{:content => "width=device-width,initial-scale=1", :name => "viewport"}/
= csrf_meta_tags
= csp_meta_tag
= stylesheet_link_tag "merged/merged"
= javascript_importmap_tags
%body
= render "layouts/merged_header"
= render "layouts/merged_messages"
= yield

View File

@ -2,8 +2,8 @@
= render "merged/sections/sections_pagination" , section: @section = render "merged/sections/sections_pagination" , section: @section
.text-xl.text-gray-900 .text-xl.text-gray-900
Cards for Section #{@section.index} - Cards for Section #{@section.index} -
= link_to @section.header , section_url( @section.id) , class: "underline" = link_to @section.header , merged.section_path( @section.id) , class: "underline"
= link_to( "New Card" , new_section_card_url(@section.id) , class: "p-2 border border-gray-200 font-bold rounded-lg hover:bg-sky-100") = link_to( "New Card" , merged.new_section_card_path(@section.id) , class: "p-2 border border-gray-200 font-bold rounded-lg hover:bg-sky-100")
= render "layouts/merged_header" = render "layouts/merged_header"
@ -16,14 +16,14 @@
.p-4 .p-4
%h3.mt-4.text-lg.font-bold Card #{index + 1}:#{card.header} %h3.mt-4.text-lg.font-bold Card #{index + 1}:#{card.header}
.flex.flex-wrap .flex.flex-wrap
= blue_button( "Up" , card_move_url(card.id , dir: :up) ) = blue_button( "Up" , merged.card_move_path(card.id , dir: :up) )
= blue_button( "Down" , card_move_url(card.id , dir: :down) ) = blue_button( "Down" , merged.card_move_path(card.id , dir: :down) )
= form_tag( card_url(card.id) , {method: :delete } ) do = form_tag( merged.card_path(card.id) , {method: :delete } ) do
=submit_button( "Delete" , true) =submit_button( "Delete" , true)
.p-4 .p-4
%h3.mt-4.text-lg.font-bold Image %h3.mt-4.text-lg.font-bold Image
= yellow_button("Change Image" , images_url(card_id: card.id) ) = yellow_button("Change Image" , merged.images_path(card_id: card.id) )
= red_button("Remove image", card_set_image_path( card.id , image: "") ) = red_button("Remove image", merged.card_set_image_path( card.id , image: "") )
.basis-96 .basis-96
%h3.mt-4.text-lg.font-bold Image %h3.mt-4.text-lg.font-bold Image
@ -33,7 +33,7 @@
= image_for( card, "p-3") = image_for( card, "p-3")
.basis-72.grow .basis-72.grow
%h3.mt-4.text-lg.font-bold Fields %h3.mt-4.text-lg.font-bold Fields
= form_tag( card_url(card.id) , {method: :patch , class: "mx-auto mt-8 mb-0 max-w space-y-4" } ) do = form_tag( merged.card_path(card.id) , {method: :patch , class: "mx-auto mt-8 mb-0 max-w space-y-4" } ) do
%label.block %label.block
.text-lg.font-bold Header .text-lg.font-bold Header
= text_field_tag( :header , card.header, class: "block w-full rounded-lg border-gray-200 p-4 pr-12 text-sm shadow-sm") = text_field_tag( :header , card.header, class: "block w-full rounded-lg border-gray-200 p-4 pr-12 text-sm shadow-sm")
@ -44,7 +44,7 @@
.basis-72.grow .basis-72.grow
.mt-4.text-lg.font-bold Options .mt-4.text-lg.font-bold Options
= form_tag( card_url(card.id) , {method: :patch , class: "mx-auto mt-8 mb-0 max-w space-y-4" }) do = form_tag( merged.card_path(card.id) , {method: :patch , class: "mx-auto mt-8 mb-0 max-w space-y-4" }) do
- card.option_definitions.each do |option| - card.option_definitions.each do |option|
=render "merged/sections/option_form_#{option.type}" , section: card , option: option =render "merged/sections/option_form_#{option.type}" , section: card , option: option
-if card.option_definitions.empty? -if card.option_definitions.empty?

View File

@ -2,7 +2,7 @@
.grid.grid-cols-6.gap-2.m-8 .grid.grid-cols-6.gap-2.m-8
- content_for :hidden do - content_for :hidden do
= hidden_field_tag :redirect , card_set_image_url(@card.id,image: "NEW") = hidden_field_tag :redirect , merged.card_set_image_path(@card.id,image: "NEW")
= form_tag(merged.images_path, multipart: true) do = form_tag(merged.images_path, multipart: true) do
= render "merged/images/new_image" = render "merged/images/new_image"
@ -13,5 +13,5 @@
%strong.inline-block.rounded.bg-yellow-50.px-2.py-3.text-md.font-medium %strong.inline-block.rounded.bg-yellow-50.px-2.py-3.text-md.font-medium
= aspect_ratio(image) = aspect_ratio(image)
.p-2.object-contain .p-2.object-contain
= link_to( card_set_image_path( image: image.name)) do = link_to( merged.card_set_image_path( image: image.name)) do
=image_tag( image.asset_name ) =image_tag( image.asset_name )

View File

@ -36,7 +36,7 @@
.flex.flex-col.bg-white .flex.flex-col.bg-white
.flex.items-center.justify-center.flex-1 .flex.items-center.justify-center.flex-1
.max-w-xl.px-4.py-8.mx-auto.text-center .max-w-xl.px-4.py-8.mx-auto.text-center
= form_tag( changes_commit_url() , {method: :post } ) do = form_tag( merged.changes_commit_path() , {method: :post } ) do
%h1.text-2xl.font-bold.tracking-tight.text-gray-900.sm:text-4xl %h1.text-2xl.font-bold.tracking-tight.text-gray-900.sm:text-4xl
Commit changes Commit changes
%p.mt-4.text-gray-500 %p.mt-4.text-gray-500

View File

@ -32,15 +32,15 @@
%div %div
-@sections.each do |section| -@sections.each do |section|
%p %p
= link_to section.header , section_url(section) = link_to section.header , merged.section_path(section)
on Page on Page
= link_to section.page.name , page_sections_url(section.page) = link_to section.page.name , merged.page_sections_path(section.page)
%div %div
-@cards.each do |card| -@cards.each do |card|
%p %p
= link_to card.header , section_cards_url(card.section) = link_to card.header , merged.section_cards_path(card.section)
on Page on Page
= link_to card.section.page.name , page_sections_url(card.section.page) = link_to card.section.page.name , merged.page_sections_path(card.section.page)
-else -else
.grid.grid-cols-2.m-20 .grid.grid-cols-2.m-20
@ -48,7 +48,7 @@
%p Not used, you may delete %p Not used, you may delete
%div %div
%p %p
= form_tag( image_url(@image.id) , {method: :delete } ) do = form_tag( merged.image_path(@image.id) , {method: :delete } ) do
=submit_button( "Delete" , true) =submit_button( "Delete" , true)
.m-20 .m-20

View File

@ -7,6 +7,9 @@
%table.min-w-full.divide-y.divide-gray-200.text-sm %table.min-w-full.divide-y.divide-gray-200.text-sm
%thead.bg-gray-100 %thead.bg-gray-100
%tr %tr
%th.whitespace-nowrap.px-4.py-2.text-left.font-medium.text-gray-900
.flex.items-center.gap-2
Index
%th.whitespace-nowrap.px-4.py-2.text-left.font-medium.text-gray-900 %th.whitespace-nowrap.px-4.py-2.text-left.font-medium.text-gray-900
.flex.items-center.gap-2 .flex.items-center.gap-2
Name Name
@ -26,7 +29,9 @@
- @pages.each do |merged_page| - @pages.each do |merged_page|
%tr{id: merged_page.name} %tr{id: merged_page.name}
%td.whitespace-nowrap.px-4.py-2.text-gray-700 %td.whitespace-nowrap.px-4.py-2.text-gray-700
= link_to merged_page.name , page_sections_path(merged_page.id) = link_to merged_page.id , merged.page_path(merged_page.id)
%td.whitespace-nowrap.px-4.py-2.text-gray-700
= link_to merged_page.name , merged.page_sections_path(merged_page.id)
%td.whitespace-nowrap.px-4.py-2.text-gray-700 %td.whitespace-nowrap.px-4.py-2.text-gray-700
= merged_page.sections.length = merged_page.sections.length
%td.whitespace-nowrap.px-4.py-2.text-gray-700 %td.whitespace-nowrap.px-4.py-2.text-gray-700
@ -35,13 +40,13 @@
ME ME
%td.whitespace-nowrap.px-4.py-2 %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"} %strong.rounded.bg-green-100.px-3.text-xs.font-medium.text-green-700{:class => "py-1.5"}
= link_to 'Sections', page_sections_path(merged_page.id) = link_to 'Sections', merged.page_sections_path(merged_page.id)
%strong.rounded.bg-amber-100.px-3.text-xs.font-medium.text-amber-700{:class => "py-1.5"} %strong.rounded.bg-amber-100.px-3.text-xs.font-medium.text-amber-700{:class => "py-1.5"}
= link_to 'Edit', page_path(merged_page.id) = link_to 'Edit', merged.page_path(merged_page.id)
.grid.grid-cols-3.gap-2.m-8 .grid.grid-cols-3.gap-2.m-8
.relative.block.border.border-gray-100 .relative.block.border.border-gray-100
= form_tag( pages_url , {method: :post } ) do = form_tag( merged.pages_path , {method: :post } ) do
%label.block %label.block
%h4.text-lg.font-bold Name %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") = text_field_tag( :name , params[:name], class: "block w-full rounded-lg border-gray-200 p-4 pr-12 text-sm shadow-sm")

View File

@ -4,7 +4,7 @@
.text-xl.font-bold.text-gray-900 .text-xl.font-bold.text-gray-900
=@page.name =@page.name
%strong.rounded.bg-green-100.px-3.text-xs.font-medium.text-green-700{:class => "py-1.5"} %strong.rounded.bg-green-100.px-3.text-xs.font-medium.text-green-700{:class => "py-1.5"}
= link_to 'Sections', page_sections_path(@page.id) = link_to 'Sections', merged.page_sections_path(@page.id)
.text-xl= distance_of_time_in_words_to_now(@page.updated_at) .text-xl= distance_of_time_in_words_to_now(@page.updated_at)
= render "layouts/merged_header" = render "layouts/merged_header"
@ -13,12 +13,12 @@
.flex.flex-col .flex.flex-col
-@page.sections.each do |section | -@page.sections.each do |section |
.flex.pb-2.px-2{class: (section.index%2)==1 ? 'bg-cyan-50' : 'bg-red-50'} .flex.pb-2.px-2{class: (section.index%2)==1 ? 'bg-cyan-50' : 'bg-red-50'}
=link_to( section_path(section.id)) do =link_to( merged.section_path(section.id)) do
.mt-4.text-lg.font-bold Section #{section.index} : #{section.header} .mt-4.text-lg.font-bold Section #{section.index} : #{section.header}
- if section.has_cards? - if section.has_cards?
%h3.mt-4.text-lg.font-bold #{section.cards.length} Cards %h3.mt-4.text-lg.font-bold #{section.cards.length} Cards
.basis-80 .basis-80
= form_tag( page_url(@page.id) , {method: :patch , class: "mx-auto mt-8 mb-0 max-w space-y-4" } ) do = form_tag( merged.page_path(@page.id) , {method: :patch , class: "mx-auto mt-8 mb-0 max-w space-y-4" } ) do
%label.block %label.block
%h4.text-lg.font-bold Name %h4.text-lg.font-bold Name
= text_field_tag( :name , @page.name, class: "w-full rounded-lg border-gray-200 p-4 pr-12 text-sm shadow-sm") = text_field_tag( :name , @page.name, class: "w-full rounded-lg border-gray-200 p-4 pr-12 text-sm shadow-sm")
@ -30,7 +30,7 @@
.basis-80.grow .basis-80.grow
%h3.mt-4.text-lg.font-bold Options %h3.mt-4.text-lg.font-bold Options
= form_tag( page_url(@page.id) , {method: :patch , class: "mx-auto mt-8 mb-0 max-w space-y-4" } ) do = form_tag( merged.page_path(@page.id) , {method: :patch , class: "mx-auto mt-8 mb-0 max-w space-y-4" } ) do
- @page.option_definitions.each do |option| - @page.option_definitions.each do |option|
=render "/merged/sections/option_form_#{option.type}" , section: @page , option: option =render "/merged/sections/option_form_#{option.type}" , section: @page , option: option
-if @page.option_definitions.empty? -if @page.option_definitions.empty?

View File

@ -1,10 +1,10 @@
.text-xl.font-bold.text-gray-900 .text-xl.font-bold.text-gray-900
Page #{link_to section.page.name, page_sections_url(section.page.id), class: "underline"} Page #{link_to section.page.name, merged.page_sections_path(section.page.id), class: "underline"}
.inline-flex.items-center.justify-center.gap-3 .inline-flex.items-center.justify-center.gap-3
.text-xl.font-bold.text-gray-900 .text-xl.font-bold.text-gray-900
Section #{section.header} Section #{section.header}
- if section.previous_section - if section.previous_section
=link_to section_url(section.previous_section.id) , class: "inline-flex h-8 w-8 items-center justify-center rounded border border-gray-100 hover:bg-sky-100" do =link_to merged.section_path(section.previous_section.id) , class: "inline-flex h-8 w-8 items-center justify-center rounded border border-gray-100 hover:bg-sky-100" do
%span.sr-only Next Section %span.sr-only Next Section
%svg.h-3.w-3{:fill => "currentColor", :viewbox => "0 0 20 20", :xmlns => "http://www.w3.org/2000/svg"} %svg.h-3.w-3{:fill => "currentColor", :viewbox => "0 0 20 20", :xmlns => "http://www.w3.org/2000/svg"}
%path{"clip-rule" => "evenodd", :d => "M12.707 5.293a1 1 0 010 1.414L9.414 10l3.293 3.293a1 1 0 01-1.414 1.414l-4-4a1 1 0 010-1.414l4-4a1 1 0 011.414 0z", "fill-rule" => "evenodd"} %path{"clip-rule" => "evenodd", :d => "M12.707 5.293a1 1 0 010 1.414L9.414 10l3.293 3.293a1 1 0 01-1.414 1.414l-4-4a1 1 0 010-1.414l4-4a1 1 0 011.414 0z", "fill-rule" => "evenodd"}
@ -15,7 +15,7 @@
%span{:class => "mx-0.25"} / %span{:class => "mx-0.25"} /
= section.page.sections.length = section.page.sections.length
- if section.next_section - if section.next_section
=link_to section_url(section.next_section.id), class: "inline-flex h-8 w-8 items-center justify-center rounded border border-gray-100 hover:bg-sky-100" do =link_to merged.section_path(section.next_section.id), class: "inline-flex h-8 w-8 items-center justify-center rounded border border-gray-100 hover:bg-sky-100" do
%span.sr-only Next Section %span.sr-only Next Section
%svg.h-3.w-3{:fill => "currentColor", :viewbox => "0 0 20 20", :xmlns => "http://www.w3.org/2000/svg"} %svg.h-3.w-3{:fill => "currentColor", :viewbox => "0 0 20 20", :xmlns => "http://www.w3.org/2000/svg"}
%path{"clip-rule" => "evenodd", :d => "M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z", "fill-rule" => "evenodd"} %path{"clip-rule" => "evenodd", :d => "M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z", "fill-rule" => "evenodd"}

View File

@ -1,7 +1,7 @@
- content_for( :merged_menu ) do - content_for( :merged_menu ) do
.text-xl.font-bold.text-gray-900 .text-xl.font-bold.text-gray-900
Page Page
= link_to @page.name , page_url(@page) = link_to @page.name , merged.page_path(@page)
.text-xl.text-gray-900 .text-xl.text-gray-900
=link_to "View live" , "/#{@page.name}" , target: @page.name =link_to "View live" , "/#{@page.name}" , target: @page.name
@ -12,22 +12,22 @@
.basis-60 .basis-60
%h3.mt-4.text-lg.font-bold Section #{section.index} : #{section.header} %h3.mt-4.text-lg.font-bold Section #{section.index} : #{section.header}
.flex.flex-wrap .flex.flex-wrap
= yellow_button("Edit" , section_path(section.id) ) = yellow_button("Edit" , merged.section_path(section.id) )
= green_button( "Copy" , new_page_section_url(@page.id, template: section.template) ) = green_button( "Copy" , merged.new_page_section_path(@page.id, template: section.template) )
.p-2 .p-2
=link_to(section_move_url(section.id , dir: :down)) do =link_to(merged.section_move_path(section.id , dir: :down)) do
%svg.w-6.h-6{:fill => "none", :stroke => "currentColor", "stroke-width" => "1.5", :viewbox => "0 0 24 24", :xmlns => "http://www.w3.org/2000/svg"} %svg.w-6.h-6{:fill => "none", :stroke => "currentColor", "stroke-width" => "1.5", :viewbox => "0 0 24 24", :xmlns => "http://www.w3.org/2000/svg"}
%path{:d => "M8.25 6.75L12 3m0 0l3.75 3.75M12 3v18", "stroke-linecap" => "round", "stroke-linejoin" => "round"} %path{:d => "M8.25 6.75L12 3m0 0l3.75 3.75M12 3v18", "stroke-linecap" => "round", "stroke-linejoin" => "round"}
.p-2 .p-2
=link_to(section_move_url(section.id , dir: :up)) do =link_to(merged.section_move_path(section.id , dir: :up)) do
%svg.w-6.h-6{:fill => "none", :stroke => "currentColor", "stroke-width" => "1.5", :viewbox => "0 0 24 24", :xmlns => "http://www.w3.org/2000/svg"} %svg.w-6.h-6{:fill => "none", :stroke => "currentColor", "stroke-width" => "1.5", :viewbox => "0 0 24 24", :xmlns => "http://www.w3.org/2000/svg"}
%path{:d => "M15.75 17.25L12 21m0 0l-3.75-3.75M12 21V3", "stroke-linecap" => "round", "stroke-linejoin" => "round"} %path{:d => "M15.75 17.25L12 21m0 0l-3.75-3.75M12 21V3", "stroke-linecap" => "round", "stroke-linejoin" => "round"}
.basis-full.mb-3 .basis-full.mb-3
= form_tag( section_url(section.id) , {method: :delete } ) do = form_tag( merged.section_path(section.id) , {method: :delete } ) do
=submit_button( "Delete" , true) =submit_button( "Delete" , true)
.basis-72 .basis-72
%h3.mt-4.text-lg.font-bold Template %h3.mt-4.text-lg.font-bold Template
= link_to(section_select_template_url(section.id)) do = link_to(merged.section_select_template_path(section.id)) do
%p= section.template %p= section.template
= section_preview(section , class: "object-contain") = section_preview(section , class: "object-contain")
.basis-52.grow .basis-52.grow
@ -38,10 +38,10 @@
.basis-72 .basis-72
- if section.has_cards? - if section.has_cards?
%h3.mt-4.text-lg.font-bold #{section.cards.length} Cards %h3.mt-4.text-lg.font-bold #{section.cards.length} Cards
=link_to section_cards_url(section.id) do =link_to merged.section_cards_path(section.id) do
=card_preview(section , class: "object-contain") =card_preview(section , class: "object-contain")
- else - else
= link_to(section_select_image_url(section.id)) do = link_to(merged.section_select_image_path(section.id)) do
%h3.mt-4.text-lg.font-bold Image %h3.mt-4.text-lg.font-bold Image
-if section.image -if section.image
= image_for( section , "h-40") = image_for( section , "h-40")
@ -56,8 +56,8 @@
.grid.grid-cols-2.gap-2.m-8 .grid.grid-cols-2.gap-2.m-8
.relative.block .relative.block
%p %p
= green_button( "New Section" , new_page_section_url(@page.id) ) = green_button( "New Section" , merged.new_page_section_path(@page.id) )
.relative.block .relative.block
%p %p
= form_tag( page_url(@page.id) , {method: :delete } ) do = form_tag( merged.page_path(@page.id) , {method: :delete } ) do
=submit_button( "Delete Page" , true) =submit_button( "Delete Page" , true)

View File

@ -11,4 +11,4 @@
= render 'form' = render 'form'
= link_to 'Back', sections_path = link_to 'Back', merged.sections_path

View File

@ -1,6 +1,6 @@
- content_for( :merged_menu ) do - content_for( :merged_menu ) do
.text-xl.font-bold.text-gray-900 .text-xl.font-bold.text-gray-900
Page #{link_to @section.page.name, page_sections_url(@section.page.id), class: "underline"} Page #{link_to @section.page.name, merged.page_sections_path(@section.page.id), class: "underline"}
.text-xl.text-gray-900 .text-xl.text-gray-900
Select Card Template for Section #{@section.index} - #{@section.header} Select Card Template for Section #{@section.index} - #{@section.header}
@ -8,6 +8,6 @@
.grid.grid-cols-4.gap-6.m-8 .grid.grid-cols-4.gap-6.m-8
- @cards.each do |style| - @cards.each do |style|
.border.border-gray-300.rounded-lg.p-2 .border.border-gray-300.rounded-lg.p-2
= link_to( section_set_card_template_path( card_template: style.template )) do = link_to( merged.section_set_card_template_path( card_template: style.template )) do
.font-bold.text-lg.text-center.pb-4= style.header .font-bold.text-lg.text-center.pb-4= style.header
=image_tag(style.card_preview , class: "w-full object-contain") =image_tag(style.card_preview , class: "w-full object-contain")

View File

@ -2,7 +2,7 @@
.grid.grid-cols-6.gap-2.m-8 .grid.grid-cols-6.gap-2.m-8
- content_for :hidden do - content_for :hidden do
= hidden_field_tag :redirect , section_set_image_url(@section.id,image: "NEW") = hidden_field_tag :redirect , merged.section_set_image_path(@section.id,image: "NEW")
= form_tag(merged.images_path, multipart: true) do = form_tag(merged.images_path, multipart: true) do
= render "merged/images/new_image" = render "merged/images/new_image"
@ -13,5 +13,5 @@
%strong.inline-block.rounded.bg-yellow-50.px-2.py-3.text-md.font-medium %strong.inline-block.rounded.bg-yellow-50.px-2.py-3.text-md.font-medium
= aspect_ratio(image) = aspect_ratio(image)
.p-2.object-contain .p-2.object-contain
= link_to( section_set_image_path( image: image.name)) do = link_to( merged.section_set_image_path( image: image.name)) do
=image_tag(image.asset_name ) =image_tag(image.asset_name )

View File

@ -1,6 +1,6 @@
- content_for( :merged_menu ) do - content_for( :merged_menu ) do
.text-xl.font-bold.text-gray-900 .text-xl.font-bold.text-gray-900
Page #{link_to @section.page.name, page_sections_url(@section.page.id), class: "underline"} Page #{link_to @section.page.name, merged.page_sections_path(@section.page.id), class: "underline"}
.text-xl.text-gray-900 .text-xl.text-gray-900
Select Template for Section #{@section.index} - #{@section.header} Select Template for Section #{@section.index} - #{@section.header}
@ -9,6 +9,6 @@
.grid.grid-cols-4.gap-6.m-8 .grid.grid-cols-4.gap-6.m-8
- @sections.each do |style| - @sections.each do |style|
.border.border-gray-300.rounded-lg.p-2 .border.border-gray-300.rounded-lg.p-2
= link_to( section_set_template_path( template: style.template )) do = link_to( merged.section_set_template_path( template: style.template )) do
.font-bold.text-lg.text-center.pb-4= style.header .font-bold.text-lg.text-center.pb-4= style.header
=image_tag(style.section_preview , class: "w-full object-contain") =image_tag(style.section_preview , class: "w-full object-contain")

View File

@ -10,8 +10,8 @@
.basis-96 .basis-96
%h3.mt-4.text-lg.font-bold Template #{@section.template} %h3.mt-4.text-lg.font-bold Template #{@section.template}
= section_preview(@section , class: "w-full object-contain my-4") = section_preview(@section , class: "w-full object-contain my-4")
= yellow_button( "Change Template" , section_select_template_url(@section.id)) = yellow_button( "Change Template" , merged.section_select_template_path(@section.id))
= green_button( "New Section" , new_page_section_url(@section.page.id , template: @section.template) ) = green_button( "New Section" , merged.new_page_section_path(@section.page.id , template: @section.template) )
.basis-96 .basis-96
%h3.mt-4.text-lg.font-bold Image %h3.mt-4.text-lg.font-bold Image
@ -19,8 +19,8 @@
%p No image %p No image
-else -else
= image_for( @section , "my-3") = image_for( @section , "my-3")
= yellow_button("Change Image", images_url(section_id: @section.id)) = yellow_button("Change Image", merged.images_path(section_id: @section.id))
= red_button( "Remove image", section_set_image_path( @section.id , image: "")) = red_button( "Remove image", merged.section_set_image_path( @section.id , image: ""))
.basis-80.grow .basis-80.grow
= section_form( class: "mx-auto mt-8 mb-0 max-w space-y-4") do = section_form( class: "mx-auto mt-8 mb-0 max-w space-y-4") do
@ -38,7 +38,7 @@
.mx-3.text-lg.font-bold Card Template #{@section.card_template} .mx-3.text-lg.font-bold Card Template #{@section.card_template}
=card_preview(@section , class: "my-3") =card_preview(@section , class: "my-3")
%p.py-3 %p.py-3
=yellow_button("Change Card Template", section_select_card_template_url(@section.id)) =yellow_button("Change Card Template", merged.section_select_card_template_path(@section.id))
.basis-96.grow .basis-96.grow
%h3.mt-4.text-lg.font-bold #{@section.cards.length} Cards %h3.mt-4.text-lg.font-bold #{@section.cards.length} Cards
@ -46,8 +46,8 @@
.mt-4.text-md.font-bold= card.header .mt-4.text-md.font-bold= card.header
.text-sm #{card.text[0..70]} ..... .text-sm #{card.text[0..70]} .....
%p.p-3 %p.p-3
= yellow_button( "View and Edit Cards" , section_cards_url(@section.id)) = yellow_button( "View and Edit Cards" , merged.section_cards_path(@section.id))
= green_button( "New Card" , new_section_card_url(@section.id) ) = green_button( "New Card" , merged.new_section_card_path(@section.id) )
.basis-80.grow .basis-80.grow
%h3.mt-4.text-lg.font-bold Options %h3.mt-4.text-lg.font-bold Options

View File

@ -6,7 +6,7 @@
= markdown(section) = markdown(section)
.flex.items-center.justify-start.m-20 .flex.items-center.justify-start.m-20
.mx-auto.w-full.max-w-4xl{class: "max-w-[50%]"} .mx-auto.w-full.max-w-4xl{class: "max-w-[50%]"}
= form_tag( form_sendit_path , {class: "mt-10" }) do = form_tag( merged.form_sendit_path , {class: "mt-10" }) do
- challenge = rand(8) - challenge = rand(8)
= hidden_field_tag :section_id , section.id = hidden_field_tag :section_id , section.id
= hidden_field_tag :bot_fudder , "#{challenge*2}" = hidden_field_tag :bot_fudder , "#{challenge*2}"

View File

@ -8,7 +8,7 @@ module Merged
expect(OptionDefinition.first.class).to be OptionDefinition expect(OptionDefinition.first.class).to be OptionDefinition
end end
it "there are options" do it "there are options" do
expect(OptionDefinition.all.length).to be 17 expect(OptionDefinition.all.length).to be 18
end end
it "has option objects" do it "has option objects" do
expect(first.class).to be OptionDefinition expect(first.class).to be OptionDefinition

View File

@ -1,2 +1,5 @@
class ApplicationController < ActionController::Base class ApplicationController < ActionController::Base
def authenticate_member!
true
end
end end