Commit 756b39319ee234b76571d12771f246a978c1eda2

Authored by Victor Costa
1 parent 58188d54

oauth_provider: add default dookeeper views

plugins/oauth_provider/views/doorkeeper/applications/_delete_form.html.erb 0 → 100644
... ... @@ -0,0 +1,5 @@
  1 +<%- submit_btn_css ||= 'btn btn-link' %>
  2 +<%= form_tag [:oauth, application] do %>
  3 + <input type="hidden" name="_method" value="delete">
  4 + <%= submit_tag 'Destroy', onclick: "return confirm('Are you sure?')", class: submit_btn_css %>
  5 +<% end %>
... ...
plugins/oauth_provider/views/doorkeeper/applications/_form.html.erb 0 → 100644
... ... @@ -0,0 +1,37 @@
  1 +<%= form_for [:oauth, application], html: {class: 'form-horizontal', role: 'form'} do |f| %>
  2 + <% if application.errors.any? %>
  3 + <div class="alert alert-danger" data-alert><p>Whoops! Check your form for possible errors</p></div>
  4 + <% end %>
  5 +
  6 + <%= content_tag :div, class: "form-group#{' has-error' if application.errors[:name].present?}" do %>
  7 + <%= f.label :name, class: 'col-sm-2 control-label', for: 'application_name' %>
  8 + <div class="col-sm-10">
  9 + <%= f.text_field :name, class: 'form-control' %>
  10 + <%= doorkeeper_errors_for application, :name %>
  11 + </div>
  12 + <% end %>
  13 +
  14 + <%= content_tag :div, class: "form-group#{' has-error' if application.errors[:redirect_uri].present?}" do %>
  15 + <%= f.label :redirect_uri, class: 'col-sm-2 control-label', for: 'application_redirect_uri' %>
  16 + <div class="col-sm-10">
  17 + <%= f.text_area :redirect_uri, class: 'form-control' %>
  18 + <%= doorkeeper_errors_for application, :redirect_uri %>
  19 + <span class="help-block">
  20 + Use one line per URI
  21 + </span>
  22 + <% if Doorkeeper.configuration.native_redirect_uri %>
  23 + <span class="help-block">
  24 + Use <code><%= Doorkeeper.configuration.native_redirect_uri %></code> for local tests
  25 + </span>
  26 + <% end %>
  27 + </div>
  28 + <% end %>
  29 +
  30 + <div class="form-group">
  31 + <div class="col-sm-offset-2 col-sm-10">
  32 + <%= f.submit 'Submit', class: "btn btn-primary" %>
  33 + <%= link_to "Cancel", oauth_applications_path, :class => "btn btn-default" %>
  34 + </div>
  35 + </div>
  36 +<% end %>
  37 +
... ...
plugins/oauth_provider/views/doorkeeper/applications/edit.html.erb 0 → 100644
... ... @@ -0,0 +1,5 @@
  1 +<div class="page-header">
  2 + <h1>Edit application</h1>
  3 +</div>
  4 +
  5 +<%= render 'form', application: @application %>
... ...
plugins/oauth_provider/views/doorkeeper/applications/index.html.erb 0 → 100644
... ... @@ -0,0 +1,26 @@
  1 +<div class="page-header">
  2 + <h1>Your applications</h1>
  3 +</div>
  4 +
  5 +<p><%= link_to 'New Application', new_oauth_application_path, class: 'btn btn-success' %></p>
  6 +
  7 +<table class="table table-striped">
  8 + <thead>
  9 + <tr>
  10 + <th>Name</th>
  11 + <th>Callback URL</th>
  12 + <th></th>
  13 + <th></th>
  14 + </tr>
  15 + </thead>
  16 + <tbody>
  17 + <% @applications.each do |application| %>
  18 + <tr id="application_<%= application.id %>">
  19 + <td><%= link_to application.name, [:oauth, application] %></td>
  20 + <td><%= application.redirect_uri %></td>
  21 + <td><%= link_to 'Edit', edit_oauth_application_path(application), class: 'btn btn-link' %></td>
  22 + <td><%= render 'delete_form', application: application %></td>
  23 + </tr>
  24 + <% end %>
  25 + </tbody>
  26 +</table>
... ...
plugins/oauth_provider/views/doorkeeper/applications/new.html.erb 0 → 100644
... ... @@ -0,0 +1,5 @@
  1 +<div class="page-header">
  2 + <h1>New application</h1>
  3 +</div>
  4 +
  5 +<%= render 'form', application: @application %>
... ...
plugins/oauth_provider/views/doorkeeper/applications/show.html.erb 0 → 100644
... ... @@ -0,0 +1,38 @@
  1 +<div class="page-header">
  2 + <h1>Application: <%= @application.name %></h1>
  3 +</div>
  4 +
  5 +<div class="row">
  6 + <div class="col-md-8">
  7 + <h4>Application Id:</h4>
  8 +
  9 + <p><code id="application_id"><%= @application.uid %></code></p>
  10 +
  11 + <h4>Secret:</h4>
  12 +
  13 + <p><code id="secret"><%= @application.secret %></code></p>
  14 +
  15 + <h4>Callback urls:</h4>
  16 +
  17 + <table>
  18 + <% @application.redirect_uri.split.each do |uri| %>
  19 + <tr>
  20 + <td>
  21 + <code><%= uri %></code>
  22 + </td>
  23 + <td>
  24 + <%= link_to 'Authorize', oauth_authorization_path(client_id: @application.uid, redirect_uri: uri, response_type: 'code'), class: 'btn btn-success', target: '_blank' %>
  25 + </td>
  26 + </tr>
  27 + <% end %>
  28 + </table>
  29 + </div>
  30 +
  31 + <div class="col-md-4">
  32 + <h3>Actions</h3>
  33 +
  34 + <p><%= link_to 'Edit', edit_oauth_application_path(@application), class: 'btn btn-primary' %></p>
  35 +
  36 + <p><%= render 'delete_form', application: @application, submit_btn_css: 'btn btn-danger' %></p>
  37 + </div>
  38 +</div>
... ...
plugins/oauth_provider/views/doorkeeper/authorizations/error.html.erb 0 → 100644
... ... @@ -0,0 +1,7 @@
  1 +<div class="page-header">
  2 + <h1>An error has occurred</h1>
  3 +</div>
  4 +
  5 +<main role="main">
  6 + <pre><%= @pre_auth.error_response.body[:error_description] %></pre>
  7 +</main>
... ...
plugins/oauth_provider/views/doorkeeper/authorizations/new.html.erb 0 → 100644
... ... @@ -0,0 +1,40 @@
  1 +<header class="page-header" role="banner">
  2 + <h1>Authorize required</h1>
  3 +</header>
  4 +
  5 +<main role="main">
  6 + <p class="h4">
  7 + Authorize <strong class="text-info"><%= @pre_auth.client.name %></strong> to use your account?
  8 + </p>
  9 +
  10 + <% if @pre_auth.scopes %>
  11 + <div id="oauth-permissions">
  12 + <p>This application will be able to:</p>
  13 +
  14 + <ul class="text-info">
  15 + <% @pre_auth.scopes.each do |scope| %>
  16 + <li><%= t scope, scope: [:doorkeeper, :scopes] %></li>
  17 + <% end %>
  18 + </ul>
  19 + </div>
  20 + <% end %>
  21 +
  22 + <div class="actions">
  23 + <%= form_tag oauth_authorization_path, method: :post do %>
  24 + <%= hidden_field_tag :client_id, @pre_auth.client.uid %>
  25 + <%= hidden_field_tag :redirect_uri, @pre_auth.redirect_uri %>
  26 + <%= hidden_field_tag :state, @pre_auth.state %>
  27 + <%= hidden_field_tag :response_type, @pre_auth.response_type %>
  28 + <%= hidden_field_tag :scope, @pre_auth.scope %>
  29 + <%= submit_tag "Authorize", class: "btn btn-success btn-lg btn-block" %>
  30 + <% end %>
  31 + <%= form_tag oauth_authorization_path, method: :delete do %>
  32 + <%= hidden_field_tag :client_id, @pre_auth.client.uid %>
  33 + <%= hidden_field_tag :redirect_uri, @pre_auth.redirect_uri %>
  34 + <%= hidden_field_tag :state, @pre_auth.state %>
  35 + <%= hidden_field_tag :response_type, @pre_auth.response_type %>
  36 + <%= hidden_field_tag :scope, @pre_auth.scope %>
  37 + <%= submit_tag "Deny", class: "btn btn-danger btn-lg btn-block" %>
  38 + <% end %>
  39 + </div>
  40 +</main>
... ...
plugins/oauth_provider/views/doorkeeper/authorizations/show.html.erb 0 → 100644
... ... @@ -0,0 +1,7 @@
  1 +<header class="page-header">
  2 + <h1>Authorization code:</h1>
  3 +</header>
  4 +
  5 +<main role="main">
  6 + <code id="authorization_code"><%= params[:code] %></code>
  7 +</main>
... ...
plugins/oauth_provider/views/doorkeeper/authorized_applications/_delete_form.html.erb 0 → 100644
... ... @@ -0,0 +1,5 @@
  1 +<%- submit_btn_css ||= 'btn btn-link' %>
  2 +<%= form_tag oauth_authorized_application_path(application) do %>
  3 + <input type="hidden" name="_method" value="delete">
  4 + <%= submit_tag 'Revoke', onclick: "return confirm('Are you sure?')", class: submit_btn_css %>
  5 +<% end %>
... ...
plugins/oauth_provider/views/doorkeeper/authorized_applications/index.html.erb 0 → 100644
... ... @@ -0,0 +1,25 @@
  1 +<header class="page-header">
  2 + <h1>Your authorized applications</h1>
  3 +</header>
  4 +
  5 +<main role="main">
  6 + <table class="table table-striped">
  7 + <thead>
  8 + <tr>
  9 + <th>Application</th>
  10 + <th>Created At</th>
  11 + <th></th>
  12 + <th></th>
  13 + </tr>
  14 + </thead>
  15 + <tbody>
  16 + <% @applications.each do |application| %>
  17 + <tr>
  18 + <td><%= application.name %></td>
  19 + <td><%= application.created_at.strftime('%Y-%m-%d %H:%M:%S') %></td>
  20 + <td><%= render 'delete_form', application: application %></td>
  21 + </tr>
  22 + <% end %>
  23 + </tbody>
  24 + </table>
  25 +</main>
... ...