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.

104 lines
3.3 KiB

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