Commit 8073f361 authored by Mehul Sharma's avatar Mehul Sharma Committed by Stan Hu

New partial for SSH Key Deletion

parent e7e638b5
......@@ -27,6 +27,4 @@
= s_('Profiles|Created%{time_ago}'.html_safe) % { time_ago: time_ago_with_tooltip(key.created_at, html_class: 'gl-ml-2')}
- if key.can_delete?
.gl-ml-3
= button_to '#', class: "btn btn-default gl-button btn-default-tertiary js-confirm-modal-button", data: ssh_key_delete_modal_data(key, path_to_key(key, is_admin)) do
%span.sr-only= _('Delete')
= sprite_icon('remove')
= render 'shared/ssh_keys/key_delete', html_class: "btn btn-default gl-button btn-default-tertiary js-confirm-modal-button", button_data: ssh_key_delete_modal_data(key, path_to_key(key, is_admin))
......@@ -38,4 +38,4 @@
.col-md-12
.float-right
- if @key.can_delete?
= button_to _('Delete'), '#', class: "btn btn-danger gl-button delete-key js-confirm-modal-button", data: ssh_key_delete_modal_data(@key, path_to_key(@key, is_admin))
= render 'shared/ssh_keys/key_delete', text: _('Delete'), html_class: "btn btn-danger gl-button delete-key js-confirm-modal-button", button_data: ssh_key_delete_modal_data(@key, path_to_key(@key, is_admin))
- if defined?(text)
= button_to text, '#', class: html_class, data: button_data
- else
= button_to '#', class: html_class, data: button_data do
%span.sr-only= _('Delete')
= sprite_icon('remove')
---
title: New Shared Partial for SSH Key Deletion
merge_request: 50825
author: Mehul Sharma
type: other
......@@ -22,4 +22,4 @@
.table-section.section-5
.table-mobile-header{ role: 'rowheader' }
.table-mobile-content
= button_to _('Delete'), '#', class: "btn btn-danger btn-danger-secondary btn-md btn-secondary gl-button js-confirm-modal-button", data: ssh_key_delete_modal_data(ssh_key, ssh_key_delete_path(ssh_key))
= render 'shared/ssh_keys/key_delete', text: _('Delete'), html_class: "btn btn-danger btn-danger-secondary btn-md btn-secondary gl-button js-confirm-modal-button", button_data: ssh_key_delete_modal_data(ssh_key, ssh_key_delete_path(ssh_key))
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'shared/ssh_keys/_key_delete.html.haml' do
context 'when the text parameter is used' do
it 'has text' do
render 'shared/ssh_keys/key_delete.html.haml', text: 'Button', html_class: '', button_data: ''
expect(rendered).to have_button('Button')
end
end
context 'when the text parameter is not used' do
it 'does not have text' do
render 'shared/ssh_keys/key_delete.html.haml', html_class: '', button_data: ''
expect(rendered).to have_button('Delete')
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment