diff --git a/app/controllers/org_admin/templates_controller.rb b/app/controllers/org_admin/templates_controller.rb index 56ff633..a62f70b 100644 --- a/app/controllers/org_admin/templates_controller.rb +++ b/app/controllers/org_admin/templates_controller.rb @@ -319,7 +319,7 @@ end templates = (templates.count > 0 ? templates.sort{|x,y| x.title <=> y.title} : []) - render json: {"templates": templates.collect{|t| {id: t.id, title: t.title} }}.to_json + render json: {"templates": templates.collect{|t| { id: t.id, title: t.title, default: t.is_default } }}.to_json end diff --git a/app/views/plans/_form_v2.html.erb b/app/views/plans/_form_v2.html.erb index 3c8db57..a44fd00 100644 --- a/app/views/plans/_form_v2.html.erb +++ b/app/views/plans/_form_v2.html.erb @@ -98,6 +98,15 @@

+ + +
<%= f.button(_('Yes'), class: "btn btn-primary", type: "submit") %> diff --git a/lib/assets/javascripts/views/plans/new.js b/lib/assets/javascripts/views/plans/new.js index c891441..adce7d2 100644 --- a/lib/assets/javascripts/views/plans/new.js +++ b/lib/assets/javascripts/views/plans/new.js @@ -41,12 +41,19 @@ $('#multiple-templates').hide(); if ($('#plan_org_id').val() !== '-1') { $('#single-template-name').html(data.templates[0].title); - $('#single-template').show(); + if (data.templates[0].default) { + $('#default-template').show(); + $('#single-template').hide(); + } else { + $('#single-template').show(); + $('#default-template').hide(); + } } } else { $('#multiple-templates').show(); $('#available-templates').fadeIn(); $('#single-template').hide(); + $('#default-template').hide(); } toggleSubmit(); } else {