Skip to content

Instantly share code, notes, and snippets.

@somaria
Created June 2, 2022 01:47
Show Gist options
  • Save somaria/7d2bd484b8a45fa0623337ec397dfd3e to your computer and use it in GitHub Desktop.
Save somaria/7d2bd484b8a45fa0623337ec397dfd3e to your computer and use it in GitHub Desktop.
collection check box
<div class="staff-page form-staff-new-page">
<%= render 'layouts/staff_top_bar' %>
<div class="content">
<a href="<%= staff_forms_path %>" class="back-button">&lt; Back</a>
<div class="top-group">
<div class="page-title my-7">New Session</div>
</div>
<% if @staff.role == "staff" %>
<div class="form">
<%= form_with url: staff_forms_path, method: :post do |f| %>
<div>
<%= f.label :clazz, 'Select a class' %>
<%= f.select :clazz, @staff.clazzes.map {|c| [c.name, c.id]}, required: true %>
</div>
<%= f.submit 'Start new session' %>
<% end %>
</div>
<% else %>
<div class="form mx-auto">
<%= form_with url: staff_forms_path, method: :post do |f| %>
<div>
<div class='flex items-center mb-10'>
<div class="text-md mr-4">
<div>Select Classes:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div>
</div>
<div class="mr-6 text-xs">
<%= f.collection_check_boxes(:clazz, @staff.clazzes.map { |c|
[ ' ' + c.name + ' ', c.id]
}, :last, :first) %>
</div>
</div>
<% flash.each do |type, msg| %>
<div class='text-xs text-red-400 -mt-5'>
<%= msg %>
</div>
<% end %>
<div class="flex mt-5">
<div class="text-md">Session Type:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div>
<div class="text-xs"><%= f.select :form_type, ['FTGP', 'CCE lesson', 'School-based Activity', 'Others']%></div>
</div>
<div class="flex my-10 items-center">
<div class="text-md whitespace-nowrap">Session Title:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div>
<div class="text-md">
<%= f.text_field :session_title, placeholder: "Session Title", :maxlength=>"160", :size=>"30", :height=>"0", :required=>true %>
</div>
</div>
<div class="flex">
<div class="text-md mr-3">End Date:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div>
<div class="text-sm mb-12">
<%= f.date_field :expire_date, value: Date.tomorrow + 7 %>
</div>
</div>
</div>
<%= f.submit 'Start new session' %>
<% end %>
</div>
<% end %>
</div>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment