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.

125 lines
4.1 KiB

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