Difference between revisions of "Extensions:Admin Notifications"

From Lorekeeper Wiki
Jump to navigation Jump to search
Tag: 2017 source edit
 
(8 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{Extensioninfobox|title=the extension's name|desc=A short description|auth=Author(s)|status=status (such as WIP, testing, stable)|github={{Github|user=username|branch=branch}}|migration=yes/no|package=yes/no}}
+
{{Extensioninfobox|title=Admin Notifications|desc=Display a little bubble on the admin panel button to show the number in the queue.|auth=Preimpression|status=stable|github={{Github|user=preimpression|branch=extension/admin-notification}}|LKVer=2.1.0|migration=no|package=no}}
<!-- Put a short summary of your extension here! -->
+
 
 +
This is a small extension to add a [https://i.imgur.com/FL7p9TQ.png little bubble] atop the admin panel button. It displays the number of items in the queue, as denote by power:
 +
 
 +
'''Manage Masterlist''' (manage_characters)
 +
* Design Update Request queue
 +
* MYO Design Update Request queue
 +
* Transfer request queue (if enabled in site settings)
 +
* Trade request queue (if enabled in site settings)
 +
 
 +
'''Manage Submissions''' (manage_submissions)
 +
* Claims queue
 +
* Prompt submission queue
 +
* Gallery submissions (where "collaborators are approved")
 +
 
 +
'''Manage Reports''' (manage_reports)
 +
* Unassigned Reports
 +
* Reports assigned to me
 +
 
 +
The code creates a function within the User model and edits some code in the _nav.blade.php file. These are the only edits and therefore it shouldn't conflict with any other extensions.
 +
 
 
== Installation ==
 
== Installation ==
<!-- Describe installation. Include any requirements (such as packages), necessary commands, etc. -->
+
Pull the branch and merge it into your own branch. It may yell at you about conflicts, especially if you have edited the navigation bar. All that's important in the _nav blade is this:
 +
 
 +
<syntaxhighlight lang="html" line="1" start="114">
 +
@if(Auth::user()->isStaff)
 +
  <li class="nav-item d-flex">
 +
    <a class="nav-link position-relative display-inline-block" href="{{ url('admin') }}"><i class="fas fa-crown"></i>
 +
      @if (Auth::user()->hasAdminNotification(Auth::user()))
 +
        <span class="position-absolute rounded-circle bg-danger text-light" style="top: -2px; right: -5px; padding: 1px 6px 1px 6px; font-weight:bold; font-size: 0.8em; box-shadow: 1px 1px 1px rgba(0,0,0,.25);">
 +
          {{ Auth::user()->hasAdminNotification(Auth::user()) }}
 +
        </span>
 +
    @endif
 +
    </a>
 +
  </li>
 +
@endif
 +
</syntaxhighlight>
 +
 
 
== Configuration ==
 
== Configuration ==
<!-- Is any configuration necessary? Describe it here! -->
+
 
== Usage ==
+
If you wish you edit the visuals of the bubble, look for the span inside the nested if statement in the chunk of code above. I left most of the style as inline as to not clog up css files. I personally prefer bg-danger as it is most noticeable, but you may prefer to make it something different.
<!-- Is there anything users should know about using your extension? -->
+
 
 +
In order to add additional notifications to the list, you will need to edit the "hasAdminNotification" function within <code>app\Models\User.php</code>. This is important if you have other extensions which add things to the Admin queue, like Gallery Submissions.
 +
 
 +
[[File:Admin notification.png|alt=A screenshot of the default Lorekeeper navigation bar logged into a staff account, with a red circle containing a 1 appearing on the icon to the staff panel.|thumb|An example of the extension with one active admin notification.]]
 +
 
 
== Troubleshooting ==
 
== Troubleshooting ==
<!-- Are there known issues or errors that require user action? Who should they contact, and where, for support? -->
+
If something goes wrong or gets buggy, feel free to find me on the LK discord as Uri!
== See Also ==
 
<!-- Any relevant other pages. You may consider linking to related extensions, for instance. -->
 
 
 

Latest revision as of 09:00, 3 February 2023

Admin Notifications
Description Display a little bubble on the admin panel button to show the number in the queue.
Author(s) Preimpression
Status stable
Github extension/admin-notification
LK Version 2.1.0






This is a small extension to add a little bubble atop the admin panel button. It displays the number of items in the queue, as denote by power:

Manage Masterlist (manage_characters)

  • Design Update Request queue
  • MYO Design Update Request queue
  • Transfer request queue (if enabled in site settings)
  • Trade request queue (if enabled in site settings)

Manage Submissions (manage_submissions)

  • Claims queue
  • Prompt submission queue
  • Gallery submissions (where "collaborators are approved")

Manage Reports (manage_reports)

  • Unassigned Reports
  • Reports assigned to me

The code creates a function within the User model and edits some code in the _nav.blade.php file. These are the only edits and therefore it shouldn't conflict with any other extensions.

Installation

Pull the branch and merge it into your own branch. It may yell at you about conflicts, especially if you have edited the navigation bar. All that's important in the _nav blade is this:

114 @if(Auth::user()->isStaff)
115    <li class="nav-item d-flex">
116      <a class="nav-link position-relative display-inline-block" href="{{ url('admin') }}"><i class="fas fa-crown"></i>
117        @if (Auth::user()->hasAdminNotification(Auth::user()))
118          <span class="position-absolute rounded-circle bg-danger text-light" style="top: -2px; right: -5px; padding: 1px 6px 1px 6px; font-weight:bold; font-size: 0.8em; box-shadow: 1px 1px 1px rgba(0,0,0,.25);">
119            {{ Auth::user()->hasAdminNotification(Auth::user()) }}
120          </span>
121      @endif
122      </a>
123    </li>
124  @endif

Configuration

If you wish you edit the visuals of the bubble, look for the span inside the nested if statement in the chunk of code above. I left most of the style as inline as to not clog up css files. I personally prefer bg-danger as it is most noticeable, but you may prefer to make it something different.

In order to add additional notifications to the list, you will need to edit the "hasAdminNotification" function within app\Models\User.php. This is important if you have other extensions which add things to the Admin queue, like Gallery Submissions.

A screenshot of the default Lorekeeper navigation bar logged into a staff account, with a red circle containing a 1 appearing on the icon to the staff panel.
An example of the extension with one active admin notification.

Troubleshooting

If something goes wrong or gets buggy, feel free to find me on the LK discord as Uri!