You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

90 lines
2.8 KiB

  1. @extends('layouts.master')
  2. @section('content')
  3. @include('partials/logged-in')
  4. <div class="dashboard">
  5. <h2>Database</h2>
  6. <div class="panel">
  7. <h3>Read Token</h3>
  8. <div class="token"><code>{{ $database->read_token }}</code></div>
  9. </div>
  10. @if ($database->created_by == session('user_id'))
  11. <div class="panel">
  12. <h3>Write Token</h3>
  13. <div class="token"><code>{{ $database->write_token }}</code></div>
  14. </div>
  15. @endif
  16. <div class="panel">
  17. <h3>Users with Access</h3>
  18. <ul class="users">
  19. @foreach($users as $user)
  20. <li class="user">
  21. @if($user->id != session('user_id'))
  22. <a href="#" data-user="{{ $user->url }}" class="remove-user hidden">&times;</a>
  23. @endif
  24. {{ $user->url }}
  25. </li>
  26. @endforeach
  27. <li>
  28. <a href="javascript:$('.users .create').removeClass('hidden');$('.create-link').addClass('hidden');" class="pure-button create-link {{ session('create-error') ? 'hidden' : '' }}">New User</a>
  29. @if(session('create-error'))
  30. <div class="error">{{ session('create-error') }}</div>
  31. @endif
  32. <span class="create {{ session('create-error') ? '' : 'hidden' }}">
  33. <form action="/settings/{{ $database->name }}" method="post" class="pure-form">
  34. <input type="url" name="add_user" value="{{ session('add-user-url') }}" placeholder="github or indieauth url">
  35. <button type="submit" class="pure-button pure-button-primary">Add User</button>
  36. </form>
  37. </span>
  38. </li>
  39. </ul>
  40. </div>
  41. <br><br>
  42. <h2>Micropub Export</h2>
  43. <p>Enter a Micropub endpoint and token below and any trips that are written to this database will be sent to the endpoint as well.</p>
  44. <div class="panel">
  45. <form action="/settings/{{ $database->name }}" method="post" class="pure-form pure-form-stacked">
  46. <fieldset>
  47. <label for="micropub_endpoint">Micropub Endpoint</label>
  48. <input name="micropub_endpoint" type="url" placeholder="http://example.com/micropub" class="pure-input-1" value="{{ $database->micropub_endpoint }}">
  49. <label for="micropub_token">Access Token</label>
  50. <input name="micropub_token" type="text" placeholder="" class="pure-input-1" value="{{ $database->micropub_token }}">
  51. <button type="submit" class="pure-button pure-button-primary">Save</button>
  52. </fieldset>
  53. </form>
  54. </div>
  55. </div>
  56. <script>
  57. jQuery(function($){
  58. $(".users .user").hover(function(){
  59. $(this).children(".remove-user").removeClass("hidden");
  60. }, function(){
  61. $(this).children(".remove-user").addClass("hidden");
  62. });
  63. $(".remove-user").click(function(){
  64. $.post("/settings/{{ $database->name }}", {
  65. database: "{{ $database->name }}",
  66. remove_user: $(this).data('user')
  67. }, function(data){
  68. window.location = window.location;
  69. });
  70. return false;
  71. });
  72. });
  73. </script>
  74. @endsection