fix set template with/without cards mismatch
This commit is contained in:
parent
321f1909c5
commit
1036d11e98
@ -41,6 +41,15 @@ module Merged
|
|||||||
def set_template
|
def set_template
|
||||||
template = params[:template]
|
template = params[:template]
|
||||||
raise "no template given" if template.blank?
|
raise "no template given" if template.blank?
|
||||||
|
style = SectionStyle.where(template: template).first
|
||||||
|
raise "no such template #{template}" unless style
|
||||||
|
if(! style.has_cards?)
|
||||||
|
if( @section.cards.length > 0 )
|
||||||
|
redirect_to section_url(@section.id) , alert: "Must delete cards first"
|
||||||
|
return
|
||||||
|
end
|
||||||
|
@section.card_style = ""
|
||||||
|
end
|
||||||
@section.set_template( template )
|
@section.set_template( template )
|
||||||
@section.edit_save(current_member.email)
|
@section.edit_save(current_member.email)
|
||||||
redirect_to section_url(@section.id)
|
redirect_to section_url(@section.id)
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
.mx-20.flex.h-16.items-center.gap-16
|
.mx-20.flex.h-16.items-center.gap-16
|
||||||
= render "merged/sections/sections_pagination" , section: @section
|
= render "merged/sections/sections_pagination" , section: @section
|
||||||
.text-xl.text-gray-900
|
.text-3xl.font-bold.text-gray-900
|
||||||
Cards for Section #{@section.index} -
|
= @section.cards.length
|
||||||
= link_to @section.header , merged.section_path( @section.id) , class: "underline"
|
Cards
|
||||||
= link_to( "New Card" , merged.new_section_card_path(@section.id) , class: "p-2 border border-gray-200 bg-cyan-100 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 bg-cyan-100 font-bold rounded-lg hover:bg-sky-100")
|
||||||
|
|
||||||
= render_section( @section )
|
= render_section( @section )
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
Section
|
Section
|
||||||
\:
|
\:
|
||||||
= link_to section.header, section_path(section), class: "underline text-3xl ml-3"
|
= link_to section.header, section_path(section), class: "underline text-3xl ml-3"
|
||||||
.link
|
|
||||||
.inline-flex.items-center.justify-center.gap-3
|
.inline-flex.items-center.justify-center.gap-3
|
||||||
- if section.previous_section
|
- if section.previous_section
|
||||||
=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
|
=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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user