forked from External/greenlight
		
	
		
			
				
	
	
		
			47 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			47 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
<div class="modal fade" id="createRoomModal" tabindex="-1" role="dialog">
 | 
						|
  <div class="modal-dialog modal-dialog-centered" role="document">
 | 
						|
    <div class="modal-content text-center">
 | 
						|
      <div class="modal-body">
 | 
						|
        <div class="card-body p-6">
 | 
						|
          <div class="card-title">
 | 
						|
            <h3>Create New Room</h3>
 | 
						|
          </div>
 | 
						|
 | 
						|
          <%= form_for(:room, url: rooms_path) do |f| %>
 | 
						|
            <div class="input-icon">
 | 
						|
              <span class="input-icon-addon">
 | 
						|
                <i class="fas fa-chalkboard-teacher"></i>
 | 
						|
              </span>
 | 
						|
              <%= f.text_field :name, id: "room-name", class: "form-control", value: "", placeholder: "Enter a room name...", autocomplete: :off %>
 | 
						|
              <div class="invalid-feedback text-left">Room name cannot be blank.</div>
 | 
						|
            </div>
 | 
						|
            <label class="custom-switch mt-5 mb-5 float-left">
 | 
						|
              <%= f.check_box :auto_join, class: "custom-switch-input", checked: false %>
 | 
						|
              <span class="custom-switch-indicator"></span>
 | 
						|
              <span class="custom-switch-description">Automatically join me into the room.</span>
 | 
						|
            </label>
 | 
						|
          <div class="form-footer">
 | 
						|
            <%= f.submit "Create Room", id: "create-room-submit", class: "btn btn-outline-primary btn-block btn-pill" %>
 | 
						|
          </div>
 | 
						|
          <% end %>
 | 
						|
        </div>
 | 
						|
        <div class="card-footer">
 | 
						|
          <p>You will be free to delete this room at any time.</p>
 | 
						|
        </div>
 | 
						|
      </div>
 | 
						|
    </div>
 | 
						|
  </div>
 | 
						|
</div>
 | 
						|
 | 
						|
<script>
 | 
						|
// Handle validation messages client-side because
 | 
						|
// form is served in modal, and they are minimal.
 | 
						|
var roomCreateValidations = function(){
 | 
						|
  if($('#room-name').val().length == 0){
 | 
						|
    $('#room-name').addClass("is-invalid");
 | 
						|
  }
 | 
						|
}
 | 
						|
 | 
						|
$('#create-room-submit').on('click', roomCreateValidations);
 | 
						|
</script>
 |