forked from External/greenlight
		
	GRN-69: Fixed javascript bug related to room validation (#388)
* Fixed javascript bug related to room validation * More javascript bugs * Removed room name length error * Fixed issue with room post url
This commit is contained in:
		
				
					committed by
					
						
						Jesus Federico
					
				
			
			
				
	
			
			
			
						parent
						
							37af17fae1
						
					
				
				
					commit
					ef8fc2c0e4
				
			@@ -13,3 +13,27 @@
 | 
				
			|||||||
//
 | 
					//
 | 
				
			||||||
// You should have received a copy of the GNU Lesser General Public License along
 | 
					// You should have received a copy of the GNU Lesser General Public License along
 | 
				
			||||||
// with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
 | 
					// with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// Handle changing of settings tabs.
 | 
				
			||||||
 | 
					$(document).on('turbolinks:load', function(){
 | 
				
			||||||
 | 
					  var controller = $("body").data('controller');
 | 
				
			||||||
 | 
					  var action = $("body").data('action');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  // Only run on the main page.
 | 
				
			||||||
 | 
					  if (controller == "main" && action == "index"){
 | 
				
			||||||
 | 
					    var cycleImages = function(){
 | 
				
			||||||
 | 
					      var images = $('.img-cycle img');
 | 
				
			||||||
 | 
					      var now = images.filter(':visible');
 | 
				
			||||||
 | 
					      var next = now.next().length ? now.next() : images.first();
 | 
				
			||||||
 | 
					      var speed = 1500;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      now.fadeOut(speed);
 | 
				
			||||||
 | 
					      next.fadeIn(speed);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    $(function() {
 | 
				
			||||||
 | 
					      setInterval(cycleImages, 5000);
 | 
				
			||||||
 | 
					    });
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					});
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -55,7 +55,10 @@ $(document).on('turbolinks:load', function(){
 | 
				
			|||||||
  // Display and update all fields related to creating a room in the createRoomModal
 | 
					  // Display and update all fields related to creating a room in the createRoomModal
 | 
				
			||||||
  $("#create-room").click(function(){
 | 
					  $("#create-room").click(function(){
 | 
				
			||||||
    $("#create-room-name").val("")
 | 
					    $("#create-room-name").val("")
 | 
				
			||||||
    $("#createRoomModal form").attr("action", "/")
 | 
					
 | 
				
			||||||
 | 
					    var relative_url_root = window.location.pathname.split("/")[1];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    $("#createRoomModal form").attr("action", "/" + relative_url_root)
 | 
				
			||||||
    updateDropdown($(".dropdown-item[value='default']"))
 | 
					    updateDropdown($(".dropdown-item[value='default']"))
 | 
				
			||||||
    $("#room_mute_on_join").prop("checked", false)
 | 
					    $("#room_mute_on_join").prop("checked", false)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -31,20 +31,3 @@
 | 
				
			|||||||
</div>
 | 
					</div>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<%= render "shared/features" %>
 | 
					<%= render "shared/features" %>
 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
<script>
 | 
					 | 
				
			||||||
var cycleImages = function(){
 | 
					 | 
				
			||||||
  var images = $('.img-cycle img');
 | 
					 | 
				
			||||||
  var now = images.filter(':visible');
 | 
					 | 
				
			||||||
  var next = now.next().length ? now.next() : images.first();
 | 
					 | 
				
			||||||
  var speed = 1500;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  now.fadeOut(speed);
 | 
					 | 
				
			||||||
  next.fadeIn(speed);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
$(function() {
 | 
					 | 
				
			||||||
  setInterval(cycleImages, 5000);
 | 
					 | 
				
			||||||
});
 | 
					 | 
				
			||||||
</script>
 | 
					 | 
				
			||||||
 
 | 
				
			|||||||
@@ -57,7 +57,7 @@
 | 
				
			|||||||
              </label>
 | 
					              </label>
 | 
				
			||||||
            <% end %>
 | 
					            <% end %>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            <label id="auto-join-label" class="create-only custom-switch mt-3 mb-3 w-100 text-left d-inline-block">
 | 
					            <label id="auto-join-label" class="create-only custom-switch pl-0 mt-3 mb-3 w-100 text-left d-inline-block">
 | 
				
			||||||
              <span class="custom-switch-description"><%= t("modal.create_room.auto_join") %></span>
 | 
					              <span class="custom-switch-description"><%= t("modal.create_room.auto_join") %></span>
 | 
				
			||||||
              <%= f.check_box :auto_join, class: "custom-switch-input", checked: false %>
 | 
					              <%= f.check_box :auto_join, class: "custom-switch-input", checked: false %>
 | 
				
			||||||
              <span class="custom-switch-indicator float-right"></span>
 | 
					              <span class="custom-switch-indicator float-right"></span>
 | 
				
			||||||
@@ -76,15 +76,3 @@
 | 
				
			|||||||
    </div>
 | 
					    </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>
 | 
					 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user