forked from External/greenlight
		
	GRN2-6: Added the ability for admins to specify registration method (#520)
* Added the ability to invite users * Small bug fix * Added the ability to approve/decline users * Small bug fixes * More bug fixes * More minor changes * Final changes
This commit is contained in:
		
				
					committed by
					
						
						Jesus Federico
					
				
			
			
				
	
			
			
			
						parent
						
							adf4b68008
						
					
				
				
					commit
					720dac6012
				
			@@ -26,8 +26,11 @@
 | 
			
		||||
          </span>
 | 
			
		||||
        </div>
 | 
			
		||||
      </div>
 | 
			
		||||
 | 
			
		||||
      <div class="form-group">
 | 
			
		||||
    </div>
 | 
			
		||||
  </div>
 | 
			
		||||
  <div class="row">
 | 
			
		||||
    <div class="col-12">
 | 
			
		||||
      <div class="mb-7 form-group">
 | 
			
		||||
        <label class="form-label"><%= t("administrator.site_settings.color.title") %></label>
 | 
			
		||||
        <label class="form-label text-muted"><%= t("administrator.site_settings.color.info") %></label>
 | 
			
		||||
        <div class="row gutters-xs">
 | 
			
		||||
@@ -44,4 +47,28 @@
 | 
			
		||||
      </div>
 | 
			
		||||
    </div>
 | 
			
		||||
  </div>
 | 
			
		||||
  <div class="row">
 | 
			
		||||
    <div class="col-12">
 | 
			
		||||
      <div class="form-group">
 | 
			
		||||
        <label class="form-label"><%= t("administrator.site_settings.registration.title") %></label>
 | 
			
		||||
        <label class="form-label text-muted"><%= t("administrator.site_settings.registration.info") %></label>
 | 
			
		||||
        <div class="dropdown">
 | 
			
		||||
          <button class="btn btn-primary dropdown-toggle" type="button" id="registrationMethods" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
 | 
			
		||||
            <%= registration_method_string %>
 | 
			
		||||
          </button>
 | 
			
		||||
          <div class="dropdown-menu" aria-labelledby="registrationMethods">
 | 
			
		||||
            <%= button_to admin_change_registration_path("open"), class: "dropdown-item" do %>
 | 
			
		||||
              <%= t("administrator.site_settings.registration.methods.open") %>
 | 
			
		||||
            <% end %>
 | 
			
		||||
            <%= button_to admin_change_registration_path("invite"), class: "dropdown-item" do %>
 | 
			
		||||
              <%= t("administrator.site_settings.registration.methods.invite") %>
 | 
			
		||||
            <% end %>
 | 
			
		||||
            <%= button_to admin_change_registration_path("approval"), class: "dropdown-item" do %>
 | 
			
		||||
              <%= t("administrator.site_settings.registration.methods.approval") %>
 | 
			
		||||
            <% end %>
 | 
			
		||||
          </div>
 | 
			
		||||
        </div>
 | 
			
		||||
      </div>
 | 
			
		||||
    </div>
 | 
			
		||||
  </div>
 | 
			
		||||
</div>
 | 
			
		||||
 
 | 
			
		||||
@@ -68,11 +68,15 @@
 | 
			
		||||
                    <td><%= user.email && user.email != "" ? user.email : user.username%></td>
 | 
			
		||||
                    <td><%= user.provider %></td>
 | 
			
		||||
                    <td class="text-center">
 | 
			
		||||
                    <% roles = user.roles().pluck(:name) %>
 | 
			
		||||
                      <% roles = user.roles().pluck(:name) %>
 | 
			
		||||
                      <% if roles.include?("denied")%>
 | 
			
		||||
                        <div class="user-role btn btn-sm btn-gray-dark">
 | 
			
		||||
                          <%= t("roles.banned") %>
 | 
			
		||||
                        </div>
 | 
			
		||||
                      <% elsif roles.include?("pending") %>
 | 
			
		||||
                        <div class="user-role btn btn-sm btn-cyan">
 | 
			
		||||
                          <%= t("roles.pending") %>
 | 
			
		||||
                        </div>
 | 
			
		||||
                      <% elsif roles.include?("super_admin") %>
 | 
			
		||||
                        <div class="user-role btn btn-sm btn-red">
 | 
			
		||||
                          <%= t("roles.super_admin") %>
 | 
			
		||||
@@ -88,7 +92,21 @@
 | 
			
		||||
                      <% end %>
 | 
			
		||||
                    </td>
 | 
			
		||||
                    <td>
 | 
			
		||||
                      <% unless roles.include?("super_admin") %>
 | 
			
		||||
                      <% if roles.include?("pending") %>
 | 
			
		||||
                        <div class="item-action dropdown">
 | 
			
		||||
                          <a href="javascript:void(0)" data-toggle="dropdown" class="icon">
 | 
			
		||||
                            <i class="fas fa-ellipsis-v px-4"></i>
 | 
			
		||||
                          </a>
 | 
			
		||||
                          <div class="dropdown-menu dropdown-menu">
 | 
			
		||||
                            <%= button_to admin_approve_path(user_uid: user.uid), class: "dropdown-item" do %>
 | 
			
		||||
                              <i class="dropdown-icon far fa-check-circle"></i> <%= t("administrator.users.settings.approve") %>
 | 
			
		||||
                            <% end %>
 | 
			
		||||
                            <%= button_to admin_ban_path(user_uid: user.uid), class: "dropdown-item" do %>
 | 
			
		||||
                              <i class="dropdown-icon far fa-times-circle"></i> <%= t("administrator.users.settings.decline") %>
 | 
			
		||||
                            <% end %>
 | 
			
		||||
                          </div>
 | 
			
		||||
                        </div>
 | 
			
		||||
                      <% elsif !roles.include?("super_admin") %>
 | 
			
		||||
                        <div class="item-action dropdown">
 | 
			
		||||
                          <a href="javascript:void(0)" data-toggle="dropdown" class="icon">
 | 
			
		||||
                            <i class="fas fa-ellipsis-v px-4"></i>
 | 
			
		||||
@@ -142,3 +160,5 @@
 | 
			
		||||
    </div>
 | 
			
		||||
  </div>
 | 
			
		||||
</div>
 | 
			
		||||
 | 
			
		||||
<%= render "shared/modals/invite_user_modal" %>
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user