forked from External/greenlight
		
	master #1
@@ -59,6 +59,7 @@ $(document).on('turbolinks:load', function(){
 | 
				
			|||||||
    $(".share-room").click(function() {
 | 
					    $(".share-room").click(function() {
 | 
				
			||||||
      // Update the path of save button
 | 
					      // Update the path of save button
 | 
				
			||||||
      $("#save-access").attr("data-path", $(this).data("path"))
 | 
					      $("#save-access").attr("data-path", $(this).data("path"))
 | 
				
			||||||
 | 
					      $("#room-owner-uid").val($(this).data("owner"))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      // Get list of users shared with and display them
 | 
					      // Get list of users shared with and display them
 | 
				
			||||||
      displaySharedUsers($(this).data("users-path"))
 | 
					      displaySharedUsers($(this).data("users-path"))
 | 
				
			||||||
@@ -82,7 +83,7 @@ $(document).on('turbolinks:load', function(){
 | 
				
			|||||||
        $(".bs-searchbox").siblings().hide()
 | 
					        $(".bs-searchbox").siblings().hide()
 | 
				
			||||||
      } else {
 | 
					      } else {
 | 
				
			||||||
        // Manually populate the dropdown
 | 
					        // Manually populate the dropdown
 | 
				
			||||||
        $.get($("#share-room-select").data("path"), { search: $(".bs-searchbox input").val() }, function(users) {
 | 
					        $.get($("#share-room-select").data("path"), { search: $(".bs-searchbox input").val(), owner_uid: $("#room-owner-uid").val() }, function(users) {
 | 
				
			||||||
          $(".select-options").remove()
 | 
					          $(".select-options").remove()
 | 
				
			||||||
          if (users.length > 0) {
 | 
					          if (users.length > 0) {
 | 
				
			||||||
            users.forEach(function(user) {
 | 
					            users.forEach(function(user) {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -209,7 +209,7 @@ class UsersController < ApplicationController
 | 
				
			|||||||
      roles_can_appear << role.name if role.get_permission("can_appear_in_share_list") && role.priority >= 0
 | 
					      roles_can_appear << role.name if role.get_permission("can_appear_in_share_list") && role.priority >= 0
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    initial_list = User.where.not(uid: current_user.uid)
 | 
					    initial_list = User.where.not(uid: params[:owner_uid])
 | 
				
			||||||
                       .with_role(roles_can_appear)
 | 
					                       .with_role(roles_can_appear)
 | 
				
			||||||
                       .shared_list_search(params[:search])
 | 
					                       .shared_list_search(params[:search])
 | 
				
			||||||
                       .pluck_to_hash(:uid, :name)
 | 
					                       .pluck_to_hash(:uid, :name)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -74,7 +74,7 @@
 | 
				
			|||||||
          </a>
 | 
					          </a>
 | 
				
			||||||
        <% end %>
 | 
					        <% end %>
 | 
				
			||||||
        <% if shared_access_allowed %>
 | 
					        <% if shared_access_allowed %>
 | 
				
			||||||
          <a href="" data-toggle="modal" data-target="#shareRoomModal" class="share-room dropdown-item" data-path="<%= room_shared_access_path(room) %>" data-users-path="<%= room_shared_users_path(room) %>">
 | 
					          <a href="" data-toggle="modal" data-target="#shareRoomModal" class="share-room dropdown-item" data-path="<%= room_shared_access_path(room) %>" data-users-path="<%= room_shared_users_path(room) %>" data-owner="<%= room.owner.uid %>">
 | 
				
			||||||
            <i class="dropdown-icon fas fa-users"></i> <%= t("room.share") %>
 | 
					            <i class="dropdown-icon fas fa-users"></i> <%= t("room.share") %>
 | 
				
			||||||
          </a>
 | 
					          </a>
 | 
				
			||||||
        <% end %>
 | 
					        <% end %>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -56,7 +56,7 @@
 | 
				
			|||||||
                </a>
 | 
					                </a>
 | 
				
			||||||
              <% end %>
 | 
					              <% end %>
 | 
				
			||||||
              <% if shared_access_allowed %>
 | 
					              <% if shared_access_allowed %>
 | 
				
			||||||
                <a href="" data-toggle="modal" data-target="#shareRoomModal" class="share-room dropdown-item" data-path="<%= room_shared_access_path(room) %>" data-users-path="<%= room_shared_users_path(room) %>">
 | 
					                <a href="" data-toggle="modal" data-target="#shareRoomModal" class="share-room dropdown-item" data-path="<%= room_shared_access_path(room) %>" data-users-path="<%= room_shared_users_path(room) %>" data-owner="<%= room.owner.uid %>">
 | 
				
			||||||
                  <i class="dropdown-icon fas fa-users"></i> <%= t("room.share") %>
 | 
					                  <i class="dropdown-icon fas fa-users"></i> <%= t("room.share") %>
 | 
				
			||||||
                </a>
 | 
					                </a>
 | 
				
			||||||
              <% end %>
 | 
					              <% end %>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -28,6 +28,7 @@
 | 
				
			|||||||
            <ul id="user-list" class="list-group">
 | 
					            <ul id="user-list" class="list-group">
 | 
				
			||||||
            </ul>
 | 
					            </ul>
 | 
				
			||||||
          </div>
 | 
					          </div>
 | 
				
			||||||
 | 
					          <input id="room-owner-uid" type="hidden">
 | 
				
			||||||
          <div class="mt-6">
 | 
					          <div class="mt-6">
 | 
				
			||||||
            <button id="save-access" class="btn btn-primary btn-block" onclick="saveAccessChanges()" ><%= t("modal.share_access.save") %></button>
 | 
					            <button id="save-access" class="btn btn-primary btn-block" onclick="saveAccessChanges()" ><%= t("modal.share_access.save") %></button>
 | 
				
			||||||
            <button class="btn btn-secondary text-primary btn-block" onclick="$('#shareRoomModal').modal('hide')"><%= t("modal.share_access.cancel_changes") %></button>
 | 
					            <button class="btn btn-secondary text-primary btn-block" onclick="$('#shareRoomModal').modal('hide')"><%= t("modal.share_access.cancel_changes") %></button>
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user