diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2016-03-14 17:41:13 +0100 |
---|---|---|
committer | Eugen Rochko <eugen@zeonfederated.com> | 2016-03-14 17:41:13 +0100 |
commit | 25d7c1b6eaf03ddaec892c82f7d93a128b79a872 (patch) | |
tree | c9991b70e8cfd584c09b502bc39dc0763d017731 /app/views/doorkeeper | |
parent | 34413615683677e26213263fb98f63b5aab64872 (diff) |
Customizing the last of doorkeeper views, adding CSS for dashboard forms
Diffstat (limited to 'app/views/doorkeeper')
12 files changed, 60 insertions, 112 deletions
diff --git a/app/views/doorkeeper/applications/_delete_form.html.erb b/app/views/doorkeeper/applications/_delete_form.html.erb deleted file mode 100644 index 8d8c93f87..000000000 --- a/app/views/doorkeeper/applications/_delete_form.html.erb +++ /dev/null @@ -1,5 +0,0 @@ -<%- submit_btn_css ||= 'btn btn-link' %> -<%= form_tag oauth_application_path(application) do %> - <input type="hidden" name="_method" value="delete"> - <%= submit_tag t('doorkeeper.applications.buttons.destroy'), onclick: "return confirm('#{ t('doorkeeper.applications.confirmations.destroy') }')", class: submit_btn_css %> -<% end %> diff --git a/app/views/doorkeeper/applications/_form.html.erb b/app/views/doorkeeper/applications/_form.html.erb deleted file mode 100644 index f42cfdc10..000000000 --- a/app/views/doorkeeper/applications/_form.html.erb +++ /dev/null @@ -1,47 +0,0 @@ -<%= form_for application, url: doorkeeper_submit_path(application), html: {class: 'form-horizontal', role: 'form'} do |f| %> - <% if application.errors.any? %> - <div class="alert alert-danger" data-alert><p><%= t('doorkeeper.applications.form.error') %></p></div> - <% end %> - - <%= content_tag :div, class: "form-group#{' has-error' if application.errors[:name].present?}" do %> - <%= f.label :name, class: 'col-sm-2 control-label' %> - <div class="col-sm-10"> - <%= f.text_field :name, class: 'form-control' %> - <%= doorkeeper_errors_for application, :name %> - </div> - <% end %> - - <%= content_tag :div, class: "form-group#{' has-error' if application.errors[:redirect_uri].present?}" do %> - <%= f.label :redirect_uri, class: 'col-sm-2 control-label' %> - <div class="col-sm-10"> - <%= f.text_area :redirect_uri, class: 'form-control' %> - <%= doorkeeper_errors_for application, :redirect_uri %> - <span class="help-block"> - <%= t('doorkeeper.applications.help.redirect_uri') %> - </span> - <% if Doorkeeper.configuration.native_redirect_uri %> - <span class="help-block"> - <%= raw t('doorkeeper.applications.help.native_redirect_uri', native_redirect_uri: "<code>#{ Doorkeeper.configuration.native_redirect_uri }</code>") %> - </span> - <% end %> - </div> - <% end %> - - <%= content_tag :div, class: "form-group#{' has-error' if application.errors[:scopes].present?}" do %> - <%= f.label :scopes, class: 'col-sm-2 control-label' %> - <div class="col-sm-10"> - <%= f.text_field :scopes, class: 'form-control' %> - <%= doorkeeper_errors_for application, :scopes %> - <span class="help-block"> - <%= t('doorkeeper.applications.help.scopes') %> - </span> - </div> - <% end %> - - <div class="form-group"> - <div class="col-sm-offset-2 col-sm-10"> - <%= f.submit t('doorkeeper.applications.buttons.submit'), class: "btn btn-primary" %> - <%= link_to t('doorkeeper.applications.buttons.cancel'), oauth_applications_path, :class => "btn btn-default" %> - </div> - </div> -<% end %> diff --git a/app/views/doorkeeper/applications/_form.html.haml b/app/views/doorkeeper/applications/_form.html.haml new file mode 100644 index 000000000..94ba441a8 --- /dev/null +++ b/app/views/doorkeeper/applications/_form.html.haml @@ -0,0 +1,9 @@ += simple_form_for application, url: doorkeeper_submit_path(application) do |f| + = f.error_notification + + .form-inputs + = f.input :name + = f.input :redirect_uri, hint: t('doorkeeper.applications.help.redirect_uri') + = f.input :scopes, hint: t('doorkeeper.applications.help.scopes') + .form-actions + = f.button :submit, 'Save' diff --git a/app/views/doorkeeper/applications/edit.html.erb b/app/views/doorkeeper/applications/edit.html.erb deleted file mode 100644 index 05bddd2e4..000000000 --- a/app/views/doorkeeper/applications/edit.html.erb +++ /dev/null @@ -1,5 +0,0 @@ -<div class="page-header"> - <h1><%= t('.title') %></h1> -</div> - -<%= render 'form', application: @application %> diff --git a/app/views/doorkeeper/applications/edit.html.haml b/app/views/doorkeeper/applications/edit.html.haml new file mode 100644 index 000000000..55bbfbab0 --- /dev/null +++ b/app/views/doorkeeper/applications/edit.html.haml @@ -0,0 +1,4 @@ +- content_for :page_title do + Edit app + += render 'form', application: @application diff --git a/app/views/doorkeeper/applications/index.html.haml b/app/views/doorkeeper/applications/index.html.haml index 908f664f2..2c88cbd89 100644 --- a/app/views/doorkeeper/applications/index.html.haml +++ b/app/views/doorkeeper/applications/index.html.haml @@ -1,13 +1,13 @@ - content_for :page_title do - Applications + Apps -%p= link_to t('.new'), new_oauth_application_path, class: 'btn btn-success' +%p= link_to 'Add new', new_oauth_application_path, class: 'btn btn-success' %table.table %thead %tr - %th= t('.name') - %th= t('.callback_url') + %th App + %th Callback URL %th %th %tbody @@ -15,5 +15,5 @@ %tr %td= link_to application.name, oauth_application_path(application) %td= application.redirect_uri - %td= link_to t('doorkeeper.applications.buttons.edit'), edit_oauth_application_path(application), class: 'btn btn-link' - %td= render 'delete_form', application: application + %td= link_to 'Edit', edit_oauth_application_path(application) + %td= link_to 'Delete', oauth_application_path(application), method: :delete, data: { confirm: 'Are you sure?' } diff --git a/app/views/doorkeeper/applications/new.html.erb b/app/views/doorkeeper/applications/new.html.erb deleted file mode 100644 index 05bddd2e4..000000000 --- a/app/views/doorkeeper/applications/new.html.erb +++ /dev/null @@ -1,5 +0,0 @@ -<div class="page-header"> - <h1><%= t('.title') %></h1> -</div> - -<%= render 'form', application: @application %> diff --git a/app/views/doorkeeper/applications/new.html.haml b/app/views/doorkeeper/applications/new.html.haml new file mode 100644 index 000000000..ad5a66e3a --- /dev/null +++ b/app/views/doorkeeper/applications/new.html.haml @@ -0,0 +1,4 @@ +- content_for :page_title do + New app + += render 'form', application: @application diff --git a/app/views/doorkeeper/applications/show.html.erb b/app/views/doorkeeper/applications/show.html.erb deleted file mode 100644 index ac89f32b1..000000000 --- a/app/views/doorkeeper/applications/show.html.erb +++ /dev/null @@ -1,39 +0,0 @@ -<div class="page-header"> - <h1><%= t('.title', name: @application.name) %></h1> -</div> - -<div class="row"> - <div class="col-md-8"> - <h4><%= t('.application_id') %>:</h4> - <p><code id="application_id"><%= @application.uid %></code></p> - - <h4><%= t('.secret') %>:</h4> - <p><code id="secret"><%= @application.secret %></code></p> - - <h4><%= t('.scopes') %>:</h4> - <p><code id="scopes"><%= @application.scopes %></code></p> - - <h4><%= t('.callback_urls') %>:</h4> - - <table> - <% @application.redirect_uri.split.each do |uri| %> - <tr> - <td> - <code><%= uri %></code> - </td> - <td> - <%= link_to t('doorkeeper.applications.buttons.authorize'), oauth_authorization_path(client_id: @application.uid, redirect_uri: uri, response_type: 'code'), class: 'btn btn-success', target: '_blank' %> - </td> - </tr> - <% end %> - </table> - </div> - - <div class="col-md-4"> - <h3><%= t('.actions') %></h3> - - <p><%= link_to t('doorkeeper.applications.buttons.edit'), edit_oauth_application_path(@application), class: 'btn btn-primary' %></p> - - <p><%= render 'delete_form', application: @application, submit_btn_css: 'btn btn-danger' %></p> - </div> -</div> diff --git a/app/views/doorkeeper/applications/show.html.haml b/app/views/doorkeeper/applications/show.html.haml new file mode 100644 index 000000000..cc7f4be88 --- /dev/null +++ b/app/views/doorkeeper/applications/show.html.haml @@ -0,0 +1,35 @@ +- content_for :page_title do + = @application.name + +.row + .panel + .panel-heading General + .panel-row + %dt Name + %dd= @application.name + .panel-row + %dt Scopes: + %dd= @application.scopes + +.panel.panel-full + .panel-heading Details + .panel-row + %dt Client ID: + %dd + %samp= @application.uid + .panel-row + %dt Secret: + %dd + %samp= @application.secret + +.panel.panel-full + .panel-heading Callback URLs + - @application.redirect_uri.split.each do |uri| + .panel-row.panel-row-wider + %dt + %samp= uri + %dd= link_to 'Authorize', oauth_authorization_path(client_id: @application.uid, redirect_uri: uri, response_type: 'code') + +.page-actions + = link_to fa_icon('edit'), edit_oauth_application_path(@application), class: 'btn btn-iconized' + = link_to fa_icon('trash'), oauth_application_path(@application), method: :delete, class: 'btn btn-iconized', data: { confirm: 'Are you sure?' } diff --git a/app/views/doorkeeper/authorized_applications/_delete_form.html.haml b/app/views/doorkeeper/authorized_applications/_delete_form.html.haml deleted file mode 100644 index 8400efcfe..000000000 --- a/app/views/doorkeeper/authorized_applications/_delete_form.html.haml +++ /dev/null @@ -1,3 +0,0 @@ -= form_tag oauth_authorized_application_path(application) do - %input{type: "hidden", name: "_method", value: "delete"} - = submit_tag 'Revoke', class: 'btn' diff --git a/app/views/doorkeeper/authorized_applications/index.html.haml b/app/views/doorkeeper/authorized_applications/index.html.haml index f2f238e87..a75c43129 100644 --- a/app/views/doorkeeper/authorized_applications/index.html.haml +++ b/app/views/doorkeeper/authorized_applications/index.html.haml @@ -8,9 +8,9 @@ %table.table %thead %tr - %th= t('doorkeeper.authorized_applications.index.application') + %th App %th - @applications.each do |application| %tr %td= application.name - %td= render 'delete_form', application: application + %td= link_to 'Revoke', oauth_authorized_application_path(application), method: :delete |