diff --git a/app/controllers/code_harbor_links_controller.rb b/app/controllers/code_harbor_links_controller.rb index 71e19d43..3b71a050 100644 --- a/app/controllers/code_harbor_links_controller.rb +++ b/app/controllers/code_harbor_links_controller.rb @@ -10,7 +10,7 @@ class CodeHarborLinksController < ApplicationController # GET /code_harbor_links # GET /code_harbor_links.json def index - @code_harbor_links = CodeHarborLink.all + @code_harbor_links = CodeHarborLink.paginate(page: params[:page]) authorize! end diff --git a/app/models/code_harbor_link.rb b/app/models/code_harbor_link.rb index d5012e11..ea91ab71 100644 --- a/app/models/code_harbor_link.rb +++ b/app/models/code_harbor_link.rb @@ -1,2 +1,8 @@ class CodeHarborLink < ActiveRecord::Base + validates :oauth2token, presence: true + + def to_s + oauth2token + end + end diff --git a/app/views/code_harbor_links/_form.html.erb b/app/views/code_harbor_links/_form.html.erb deleted file mode 100644 index b4c5b2ab..00000000 --- a/app/views/code_harbor_links/_form.html.erb +++ /dev/null @@ -1,21 +0,0 @@ -<%= form_for(@code_harbor_link) do |f| %> - <% if @code_harbor_link.errors.any? %> -
-

<%= pluralize(@code_harbor_link.errors.count, "error") %> prohibited this code_harbor_link from being saved:

- - -
- <% end %> - -
- <%= f.label :oauth2token %>
- <%= f.text_field :oauth2token %> -
-
- <%= f.submit %> -
-<% end %> diff --git a/app/views/code_harbor_links/_form.html.slim b/app/views/code_harbor_links/_form.html.slim new file mode 100644 index 00000000..f7b449ee --- /dev/null +++ b/app/views/code_harbor_links/_form.html.slim @@ -0,0 +1,6 @@ += form_for(@code_harbor_link) do |f| + = render('shared/form_errors', object: @code_harbor_link) + .form-group + = f.label(:oauth2token) + = f.text_field(:oauth2token, class: 'form-control', required: true) + .actions = render('shared/submit_button', f: f, object: @code_harbor_link) diff --git a/app/views/code_harbor_links/edit.html.erb b/app/views/code_harbor_links/edit.html.erb deleted file mode 100644 index f75f360d..00000000 --- a/app/views/code_harbor_links/edit.html.erb +++ /dev/null @@ -1,6 +0,0 @@ -

Editing code_harbor_link

- -<%= render 'form' %> - -<%= link_to 'Show', @code_harbor_link %> | -<%= link_to 'Back', code_harbor_links_path %> diff --git a/app/views/code_harbor_links/edit.html.slim b/app/views/code_harbor_links/edit.html.slim new file mode 100644 index 00000000..d1c7ea8f --- /dev/null +++ b/app/views/code_harbor_links/edit.html.slim @@ -0,0 +1,3 @@ +h1 = @code_harbor_link + += render('form') diff --git a/app/views/code_harbor_links/index.html.erb b/app/views/code_harbor_links/index.html.erb deleted file mode 100644 index 0069df36..00000000 --- a/app/views/code_harbor_links/index.html.erb +++ /dev/null @@ -1,25 +0,0 @@ -

Listing code_harbor_links

- - - - - - - - - - - <% @code_harbor_links.each do |code_harbor_link| %> - - - - - - - <% end %> - -
Oauth2token
<%= code_harbor_link.oauth2token %><%= link_to 'Show', code_harbor_link %><%= link_to 'Edit', edit_code_harbor_link_path(code_harbor_link) %><%= link_to 'Destroy', code_harbor_link, method: :delete, data: { confirm: 'Are you sure?' } %>
- -
- -<%= link_to 'New Code harbor link', new_code_harbor_link_path %> diff --git a/app/views/code_harbor_links/index.html.slim b/app/views/code_harbor_links/index.html.slim new file mode 100644 index 00000000..953985c4 --- /dev/null +++ b/app/views/code_harbor_links/index.html.slim @@ -0,0 +1,18 @@ +h1 = CodeHarborLink.model_name.human(count: 2) + +.table-responsive + table.table + thead + tr + th = t('activerecord.attributes.code_harbor_link.oauth2token') + th colspan=3 = t('shared.actions') + tbody + - @code_harbor_links.each do |code_harbor_link| + tr + td = code_harbor_link.oauth2token + td = link_to(t('shared.show'), code_harbor_link) + td = link_to(t('shared.edit'), edit_code_harbor_link_path(code_harbor_link)) + td = link_to(t('shared.destroy'), code_harbor_link, data: {confirm: t('shared.confirm_destroy')}, method: :delete) + += render('shared/pagination', collection: @code_harbor_links) +p = render('shared/new_button', model: CodeHarborLink) diff --git a/app/views/code_harbor_links/index.json.jbuilder b/app/views/code_harbor_links/index.json.jbuilder deleted file mode 100644 index defff8f3..00000000 --- a/app/views/code_harbor_links/index.json.jbuilder +++ /dev/null @@ -1,4 +0,0 @@ -json.array!(@code_harbor_links) do |code_harbor_link| - json.extract! code_harbor_link, :id, :oauth2token - json.url code_harbor_link_url(code_harbor_link, format: :json) -end diff --git a/app/views/code_harbor_links/new.html.erb b/app/views/code_harbor_links/new.html.erb deleted file mode 100644 index 0ba6ae61..00000000 --- a/app/views/code_harbor_links/new.html.erb +++ /dev/null @@ -1,5 +0,0 @@ -

New code_harbor_link

- -<%= render 'form' %> - -<%= link_to 'Back', code_harbor_links_path %> diff --git a/app/views/code_harbor_links/new.html.slim b/app/views/code_harbor_links/new.html.slim new file mode 100644 index 00000000..ef19a3e6 --- /dev/null +++ b/app/views/code_harbor_links/new.html.slim @@ -0,0 +1,3 @@ +h1 = t('shared.new_model', model: CodeHarborLink.model_name.human) + += render('form') diff --git a/app/views/code_harbor_links/show.html.erb b/app/views/code_harbor_links/show.html.erb deleted file mode 100644 index 4bad1a5e..00000000 --- a/app/views/code_harbor_links/show.html.erb +++ /dev/null @@ -1,9 +0,0 @@ -

<%= notice %>

- -

- Oauth2token: - <%= @code_harbor_link.oauth2token %> -

- -<%= link_to 'Edit', edit_code_harbor_link_path(@code_harbor_link) %> | -<%= link_to 'Back', code_harbor_links_path %> diff --git a/app/views/code_harbor_links/show.html.slim b/app/views/code_harbor_links/show.html.slim new file mode 100644 index 00000000..b2d95342 --- /dev/null +++ b/app/views/code_harbor_links/show.html.slim @@ -0,0 +1,7 @@ +h1 + = @code_harbor_link + = render('shared/edit_button', object: @code_harbor_link) if policy(@code_harbor_link).edit? + +- %w[oauth2token].each do |attribute| + = row(label: "code_harbor_link.#{attribute}") do + = content_tag(:input, nil, class: 'form-control', readonly: true, value: @code_harbor_link.send(attribute)) diff --git a/app/views/code_harbor_links/show.json.jbuilder b/app/views/code_harbor_links/show.json.jbuilder deleted file mode 100644 index b8a1e789..00000000 --- a/app/views/code_harbor_links/show.json.jbuilder +++ /dev/null @@ -1 +0,0 @@ -json.extract! @code_harbor_link, :id, :oauth2token, :created_at, :updated_at