docbrown/app/views/admin/users/show.html.erb
ludwiczakpawel 50a4f0422b
Admin's Member view (#16174)
* init

* .

* partials

* few extras

* revert indicators in favor of separate PR

* stuff

* .

* stuff

* whoops

* .

* .

* .

* .

* opacity

* partial

* cosmetics

* move actions to a partial

* whoopsy

* Added an @admin alias for the frontend and removed the @admin-controllers alias.

* Added modal support for admin user actions.

* Added modal support for more parts of the user admin.

* pills

* pills

* pills

* Added optional chaining for when the overview panel isn't loaded.

* styling updates

* fix

* modals

* pass size

* tags

* .

* balance modal

* comment

* fixes

* Improved modal trigger implementation.

* Removed default value for dataset.

* Moved prevent default to after modal trigger check so forms still submit.

* Update app/views/admin/users/widgets/_credits.html.erb

Co-authored-by: Julianna Tetreault <32834804+juliannatetreault@users.noreply.github.com>

* Update app/views/admin/users/reports/_index.html.erb

* Apply suggestions from code review

* Apply suggestions from code review

* Update app/views/admin/users/actions/_export.html.erb

* Update app/views/admin/users/widgets/_tag_moderation.html.erb

* Update app/views/admin/users/actions/_merge.html.erb

* Removed <AdminUserActionsModal /> component as it wasn't necessary.

* Fixed duplicate ID errors detected by Axe.

* Redirects to the Show page rather than the Edit page

* Adjusts quotations within _social_accounts.html.erb

* Ensures that Learn More links open in new tab

* updates with latests and greatest

* .

* fixes

* wip. Fixed some issues in the credits form.

* Changed Subtract to Remove for credits dropdown.

* Cleaned up the edits form.

* Wraps functionality in feature flag and calls #set_user_details

* Wraps /admin/users/show.html.erb in feature flag

* wip: Got credit params form working.

* empty select

* responsiveness

* empty commiit

* Updates redirects in spec and controller to show rather than edit

* Updates tag moderation copy in Admin Member Detail View

* Now the note is saved when changing credits.

* Fixed label for attributes as it was affecting writing tests and a11y.

* Removes unused index.js component

* Refactored credit params.

* chore: move method under private and update comment

* verified email responsiveness

* better opacity variables

* better org logo

* indicators

* refactor the credits method

Co-authored-by: Nick Taylor <nick@dev.to>
Co-authored-by: Nick Taylor <nick@iamdeveloper.com>
Co-authored-by: Julianna Tetreault <32834804+juliannatetreault@users.noreply.github.com>
Co-authored-by: Nick Taylor <nick@forem.com>
Co-authored-by: Ridhwana <ridhwana.khan16@gmail.com>
2022-02-09 14:33:01 +01:00

112 lines
3.6 KiB
Text

<%# TODO: incorporate a tab component. For now you have to manually change the value %>
<% current_tab = "overview" # overview|emails|notes|reports|flags %>
<% if FeatureFlag.enabled?(:admin_member_view) %>
<%= render "header" %>
<%= render "navigation" %>
<% if current_tab == 'overview' %>
<div class="crayons-card p-3 s:p-4 m:p-7">
<%= render "stats" if @user.registered %>
<div class="l:grid gap-8 grid-cols-2">
<div>
<section class="mb-7">
<%= render "admin/users/widgets/roles" %>
</section>
<section class="mb-7">
<%= render "admin/users/widgets/tag_moderation" %>
</section>
</div>
<div>
<section class="mb-7">
<%= render "admin/users/widgets/organizations" %>
</section>
<section class="mb-7">
<%= render "admin/users/widgets/credits" %>
</section>
</div>
</div>
</div>
<% elsif current_tab == 'notes' %>
<section class="flex flex-col m:flex-row gap-4">
<div class="crayons-card p-3 s:p-4 m:p-7 flex-1">
<%= render "admin/users/notes/form" %>
</div>
<div class="crayons-card p-3 s:p-4 m:p-7 flex-1">
<%= render "admin/users/notes/index" %>
</div>
</section>
<% elsif current_tab == 'emails' %>
<%= render "admin/users/emails/verification" %>
<section class="flex flex-col m:flex-row gap-4">
<div class="crayons-card p-3 s:p-4 m:p-7 flex-1">
<%= render "admin/users/emails/form" %>
</div>
<div class="crayons-card p-3 s:p-4 m:p-7 flex-1">
<%= render "admin/users/emails/index" %>
</div>
</section>
<% elsif current_tab == 'reports' %>
<section class="crayons-card p-3 s:p-4 m:p-7">
<%= render "admin/users/reports/index" %>
</section>
<% elsif current_tab == 'flags' %>
<section class="crayons-card p-3 s:p-4 m:p-7">
<%= render "admin/users/flags/index" %>
</section>
<% end %>
<% else %>
<div class="grid gap-6">
<div class="crayons-card p-6">
<h2 class="d-inline">
<% if @user.registered? %>
<%= @user.name %><%= link_to "@#{@user.username}", @user.path, class: "ml-2", target: "_blank", rel: "noopener" %>
<% else %>
@<%= @user.username %> has not accepted their invitation yet.
<% end %>
</h2>
<% if @user.registered? %>
<a href="<%= edit_admin_user_path(@user) %>" class="btn btn-primary float-right">Manage User</a>
<p class="font-italic">Member since <%= @user.created_at.strftime("%b %e '%y") %></p>
<% end %>
<hr>
<h2>General Info</h2>
<dl>
<dt>ID:</dt>
<dd><%= @user.id %></dd>
<dt>Username:</dt>
<dd><%= @user.username %></dd>
<dt>Name:</dt>
<dd><%= @user.name %></dd>
<dt>Email:</dt>
<dd><%= @user.email %></dd>
<dt>Access Locked:</dt>
<dd><%= @user.access_locked? %></dd>
<dt>Twitter:</dt>
<% if @user.twitter_username %>
<dd><%= link_to @user.twitter_username, "https://twitter.com/#{@user.twitter_username}" %></dd>
<% else %>
<dd>N/A</dd>
<% end %>
<dt>GitHub:</dt>
<% if @user.github_username %>
<dd><%= link_to @user.github_username, "https://github.com/#{@user.github_username}" %></dd>
<% else %>
<dd>N/A</dd>
<% end %>
</dl>
</div>
<% if @user.registered? %>
<%= render "activity" %>
<%= render "credits" %>
<%= render "notes" %>
<%= render "user_organizations" %>
<%= render "email_tools" %>
<% end %>
<% end %>