codeharbor_links editable through own profile

This commit is contained in:
Karol
2019-08-27 18:33:21 +02:00
parent ec48d1f447
commit 8c306669af
11 changed files with 116 additions and 56 deletions

View File

@ -1,6 +1,28 @@
= form_for(@codeharbor_link) do |f|
= render('shared/form_errors', object: @codeharbor_link)
.form-group
= f.label(:push_url)
= f.text_field :push_url, data: {toggle: 'tooltip', placement: 'bottom'}, title: t('codeharbor_link.info.push_url'), class: 'form-control'
.form-group
= f.label(:oauth2token)
= f.text_field(:oauth2token, class: 'form-control', required: true)
.actions = render('shared/submit_button', f: f, object: @codeharbor_link)
.input-group
= f.text_field(:oauth2token, data: {toggle: 'tooltip', placement: 'bottom'}, title: t('codeharbor_link.info.token'), class: 'form-control oauth2-token')
.input-group-btn
= button_tag t('codeharbor_link.generate'), type: 'button', class: 'generate-oauth2-token btn btn-default'
.field-element.form-group
= f.label(:client_id)
.input-group
= f.text_field(:client_id, data: {toggle: 'tooltip', placement: 'bottom'}, title: t('codeharbor_link.info.client_id'), class: 'form-control client-id')
.input-group-btn
= button_tag t('codeharbor_link.generate'), type: 'button', class: 'generate-client-id btn btn-default'
.field-element.form-group
= f.label(:client_secret)
.input-group
= f.text_field(:client_secret, data: {toggle: 'tooltip', placement: 'bottom'}, title: t('codeharbor_link.info.client_secret'), class: 'form-control client-secret')
.input-group-btn
= button_tag t('codeharbor_link.generate'), type: 'button', class: 'generate-client-secret btn btn-default'
.actions
= render('shared/submit_button', f: f, object: @codeharbor_link)
- if @codeharbor_link.persisted?
= link_to(t('codeharbor_link.delete'), codeharbor_link_path(@codeharbor_link), data: {confirm: t('shared.confirm_destroy')}, method: :delete, class: 'btn btn-danger pull-right')

View File

@ -1,3 +1,3 @@
h1 = @codeharbor_link
h1 = 'Codeharbor link'
= render('form')

View File

@ -1,18 +0,0 @@
h1 = CodeharborLink.model_name.human(count: 2)
.table-responsive
table.table
thead
tr
th = t('activerecord.attributes.codeharbor_link.oauth2token')
th colspan=3 = t('shared.actions')
tbody
- @codeharbor_links.each do |codeharbor_link|
tr
td = link_to_if(policy(codeharbor_link).show?, codeharbor_link.oauth2token, codeharbor_link)
td = link_to(t('shared.show'), codeharbor_link) if policy(codeharbor_link).show?
td = link_to(t('shared.edit'), edit_codeharbor_link_path(codeharbor_link)) if policy(codeharbor_link).edit?
td = link_to(t('shared.destroy'), codeharbor_link, data: {confirm: t('shared.confirm_destroy')}, method: :delete) if policy(codeharbor_link).destroy?
= render('shared/pagination', collection: @codeharbor_links)
p = render('shared/new_button', model: CodeharborLink)

View File

@ -1,7 +0,0 @@
h1
= @codeharbor_link
= render('shared/edit_button', object: @codeharbor_link)
- %w[oauth2token].each do |attribute|
= row(label: "codeharbor_link.#{attribute}") do
= content_tag(:input, nil, class: 'form-control', readonly: true, value: @codeharbor_link.send(attribute))