card template selection process
This commit is contained in:
parent
d1ecda07c4
commit
5ade5c6c19
@ -9,6 +9,9 @@ module Merged
|
|||||||
def select_template
|
def select_template
|
||||||
@sections = Style.sections
|
@sections = Style.sections
|
||||||
end
|
end
|
||||||
|
def select_card_template
|
||||||
|
@cards = Style.cards
|
||||||
|
end
|
||||||
|
|
||||||
def set_image
|
def set_image
|
||||||
@section.content["image"] = params[:image]
|
@section.content["image"] = params[:image]
|
||||||
@ -17,7 +20,17 @@ module Merged
|
|||||||
end
|
end
|
||||||
|
|
||||||
def set_template
|
def set_template
|
||||||
@section.content["template"] = params[:template]
|
template = params[:template]
|
||||||
|
raise "no template given" if template.blank?
|
||||||
|
@section.content["template"] = template
|
||||||
|
@page.save
|
||||||
|
redirect_to page_section_url(@page.id,@section.id)
|
||||||
|
end
|
||||||
|
|
||||||
|
def set_card_template
|
||||||
|
card_template = params[:card_template]
|
||||||
|
raise "no card template given" if card_template.blank?
|
||||||
|
@section.content["card_template"] = card_template
|
||||||
@page.save
|
@page.save
|
||||||
redirect_to page_section_url(@page.id,@section.id)
|
redirect_to page_section_url(@page.id,@section.id)
|
||||||
end
|
end
|
||||||
|
@ -31,6 +31,9 @@ module Merged
|
|||||||
def template
|
def template
|
||||||
@content["template"]
|
@content["template"]
|
||||||
end
|
end
|
||||||
|
def card_template
|
||||||
|
@content["card_template"]
|
||||||
|
end
|
||||||
|
|
||||||
def id
|
def id
|
||||||
@content["id"]
|
@content["id"]
|
||||||
|
@ -11,7 +11,6 @@ module Merged
|
|||||||
def initialize content
|
def initialize content
|
||||||
@content = content
|
@content = content
|
||||||
end
|
end
|
||||||
|
|
||||||
def template
|
def template
|
||||||
@content["template"]
|
@content["template"]
|
||||||
end
|
end
|
||||||
|
@ -1,7 +0,0 @@
|
|||||||
%h1 Editing merged_section
|
|
||||||
|
|
||||||
= render 'form'
|
|
||||||
|
|
||||||
= link_to 'Show', @merged_section
|
|
||||||
\|
|
|
||||||
= link_to 'Back', merged_sections_path
|
|
@ -3,5 +3,7 @@
|
|||||||
%p= value
|
%p= value
|
||||||
%p #{section.content['cards'].length} cards
|
%p #{section.content['cards'].length} cards
|
||||||
%p view cards (index)
|
%p view cards (index)
|
||||||
|
%button.ml-3.inline-block.rounded-lg.bg-blue-500.px-5.py-3.text-md.font-medium.text-white
|
||||||
|
=link_to "Change Card Template" , page_section_select_card_template_url(@page.name,@section.id)
|
||||||
.relative.block.border.border-gray-100
|
.relative.block.border.border-gray-100
|
||||||
=image_tag("merged/card_preview/#{value}" , class: "w-full object-contain")
|
=image_tag("merged/card_preview/#{value}" , class: "w-full object-contain")
|
||||||
|
6
app/views/merged/sections/select_card_template.haml
Normal file
6
app/views/merged/sections/select_card_template.haml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
.grid.grid-cols-4.gap-2.m-8
|
||||||
|
- @cards.each do |style|
|
||||||
|
.relative.block.border.border-gray-100
|
||||||
|
= link_to( page_section_set_card_template_path( card_template: style.template )) do
|
||||||
|
=image_tag(style.card_preview , class: "h-56 w-full object-contain lg:h-72")
|
||||||
|
= style.header
|
@ -12,7 +12,3 @@
|
|||||||
.grid.grid-cols-2.gap-2.m-8
|
.grid.grid-cols-2.gap-2.m-8
|
||||||
- @section.content.each do |key , value|
|
- @section.content.each do |key , value|
|
||||||
= render "merged/sections/editors/#{key}", section: @section , key: key , value: value
|
= render "merged/sections/editors/#{key}", section: @section , key: key , value: value
|
||||||
|
|
||||||
= #link_to 'Edit', edit_section_path(@merged_section)
|
|
||||||
\|
|
|
||||||
= #link_to 'Back', sections_path
|
|
||||||
|
@ -7,6 +7,8 @@ Merged::Engine.routes.draw do
|
|||||||
get :set_image
|
get :set_image
|
||||||
get :select_template
|
get :select_template
|
||||||
get :set_template
|
get :set_template
|
||||||
|
get :select_card_template
|
||||||
|
get :set_card_template
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
resources :images
|
resources :images
|
||||||
|
Loading…
Reference in New Issue
Block a user