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.

106 lines
3.4 KiB

8 years ago
8 years ago
8 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. </div>
  67. <script>
  68. jQuery(function($){
  69. $(".users .user").hover(function(){
  70. $(this).children(".remove-user").removeClass("hidden");
  71. }, function(){
  72. $(this).children(".remove-user").addClass("hidden");
  73. });
  74. $(".remove-user").click(function(){
  75. $.post("/settings/{{ $database->name }}", {
  76. database: "{{ $database->name }}",
  77. remove_user: $(this).data('user')
  78. }, function(data){
  79. window.location = window.location;
  80. });
  81. return false;
  82. });
  83. $(".show-api-endpoint").click(function(){
  84. $(".api-endpoint").removeClass("hidden");
  85. $(".show-api-endpoint").addClass("hidden");
  86. });
  87. });
  88. </script>
  89. @endsection