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
|
||||
template = params[:template]
|
||||
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.edit_save(current_member.email)
|
||||
redirect_to section_url(@section.id)
|
||||
|
@ -1,8 +1,8 @@
|
||||
.mx-20.flex.h-16.items-center.gap-16
|
||||
= render "merged/sections/sections_pagination" , section: @section
|
||||
.text-xl.text-gray-900
|
||||
Cards for Section #{@section.index} -
|
||||
= link_to @section.header , merged.section_path( @section.id) , class: "underline"
|
||||
.text-3xl.font-bold.text-gray-900
|
||||
= @section.cards.length
|
||||
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")
|
||||
|
||||
= render_section( @section )
|
||||
|
@ -7,7 +7,7 @@
|
||||
Section
|
||||
\:
|
||||
= link_to section.header, section_path(section), class: "underline text-3xl ml-3"
|
||||
.link
|
||||
|
||||
.inline-flex.items-center.justify-center.gap-3
|
||||
- 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
|
||||
|
Loading…
x
Reference in New Issue
Block a user