Allow user to creates named auth keys with token
This commit is contained in:
19
app/views/keys/_form.haml
Normal file
19
app/views/keys/_form.haml
Normal file
@@ -0,0 +1,19 @@
|
||||
= form_for @key do |f|
|
||||
%fieldset
|
||||
%p
|
||||
= f.label :name
|
||||
%br
|
||||
= f.text_field :name
|
||||
|
||||
- if @key.errors.any?
|
||||
.errors
|
||||
%p
|
||||
= pluralize @key.errors.count, 'error'
|
||||
prohibited this post from being saved:
|
||||
%ul
|
||||
- @key.errors.full_messages.each do |error|
|
||||
%li= error
|
||||
|
||||
%ul
|
||||
%li
|
||||
= f.button
|
6
app/views/keys/edit.haml
Normal file
6
app/views/keys/edit.haml
Normal file
@@ -0,0 +1,6 @@
|
||||
%h1
|
||||
Edit
|
||||
key
|
||||
|
||||
|
||||
= render 'form'
|
42
app/views/keys/index.haml
Normal file
42
app/views/keys/index.haml
Normal file
@@ -0,0 +1,42 @@
|
||||
%h1
|
||||
Listing
|
||||
keys
|
||||
|
||||
|
||||
- if @keys.empty?
|
||||
%p No record found.
|
||||
|
||||
- else
|
||||
%table
|
||||
%thead
|
||||
%tr
|
||||
%th
|
||||
Name
|
||||
%th
|
||||
Created at
|
||||
%th
|
||||
Updated at
|
||||
%th
|
||||
Actions
|
||||
|
||||
%tbody
|
||||
- @keys.each do |e|
|
||||
%tr
|
||||
%td
|
||||
= link_to e.name, e
|
||||
%td
|
||||
= e.created_at
|
||||
%td
|
||||
= e.updated_at
|
||||
%td
|
||||
%ul
|
||||
%li
|
||||
= link_to 'Edit', edit_key_path(e)
|
||||
%li
|
||||
= link_to 'Destroy', e, method: :delete,
|
||||
data: { confirm: 'Are you sure?' }
|
||||
|
||||
|
||||
%ul
|
||||
%li
|
||||
= link_to 'New key', new_key_path
|
6
app/views/keys/new.haml
Normal file
6
app/views/keys/new.haml
Normal file
@@ -0,0 +1,6 @@
|
||||
%h1
|
||||
New
|
||||
key
|
||||
|
||||
|
||||
= render 'form'
|
13
app/views/keys/show.haml
Normal file
13
app/views/keys/show.haml
Normal file
@@ -0,0 +1,13 @@
|
||||
%h1
|
||||
Showing
|
||||
key
|
||||
|
||||
|
||||
%pre= @key.attributes.to_yaml
|
||||
|
||||
|
||||
%ul.actions
|
||||
%li
|
||||
= link_to 'Edit', edit_key_path(@key)
|
||||
%li
|
||||
= link_to 'Destroy', e, method: :delete, data: { confirm: 'Are you sure?' }
|
@@ -12,6 +12,8 @@
|
||||
- if current_user?
|
||||
%nav
|
||||
%ul
|
||||
%li
|
||||
= link_to 'Keys', keys_path
|
||||
%li
|
||||
= link_to 'Playlists', playlists_path
|
||||
%li
|
||||
|
Reference in New Issue
Block a user