link.blade.php
98 lines
| 1 | <div class="trackable-link" data-id="{{ esc_attr($link['id']) }}"> |
| 2 | <div class="input-container"> |
| 3 | <div class="inner-container name"> |
| 4 | <input class="link-name" type="text" value="{{ esc_attr($link['name']) }}" /> |
| 5 | </div> |
| 6 | <div class="inner-container type"> |
| 7 | <select class="link-type" value="{{ esc_attr($link['type']) }}"> |
| 8 | @foreach ($types as $type => $title) |
| 9 | <option value="{{ esc_attr($type) }}" {{ selected($type, $link['type'], true )}}>{{ esc_html($title) }}</option> |
| 10 | @endforeach |
| 11 | </select> |
| 12 | </div> |
| 13 | <div class="inner-container value"> |
| 14 | @foreach ($types as $type => $title) |
| 15 | <span class="value-container {{ esc_attr($type) }} {{ $type == $link['type'] ? 'visible' : '' }}"> |
| 16 | @if ($type == 'extension') |
| 17 | <select class="link-value"> |
| 18 | @foreach ($extensions as $extension) |
| 19 | <?php $selected = $link['type'] !== 'extension' ? 'pdf' : $link['value']; ?> |
| 20 | <option value="{{ esc_attr($extension) }}" {{ selected($extension, $selected, true)}}>{{ esc_html($extension) }}</option> |
| 21 | @endforeach |
| 22 | </select> |
| 23 | @elseif ($type == 'protocol') |
| 24 | <select class="link-value"> |
| 25 | @foreach ($protocols as $protocol) |
| 26 | <option value="{{ esc_attr($protocol) }}" {{ selected($protocol, $link['value'], true)}}>{{ esc_html($protocol) }}</option> |
| 27 | @endforeach |
| 28 | </select> |
| 29 | @elseif ($type === 'external') |
| 30 | <input class="link-value external" type="text" disabled/> |
| 31 | @else |
| 32 | @if ($type == 'class') |
| 33 | <span class="value-prefix">.</span> |
| 34 | @endif |
| 35 | @if ($type == 'subdirectory') |
| 36 | <span class="value-prefix">/</span> |
| 37 | @endif |
| 38 | <input class="link-value {{ esc_attr($type) }}" type="text" value="{{ esc_attr($type == $link['type'] ? $link['value'] : '') }}" /> |
| 39 | @if ($type == 'subdirectory') |
| 40 | <span class="value-suffix">/</span> |
| 41 | @endif |
| 42 | @endif |
| 43 | </span> |
| 44 | @endforeach |
| 45 | </div> |
| 46 | </div> |
| 47 | <div class="value-text-container"> |
| 48 | <span class="name"> |
| 49 | @if ($link['is_active']) |
| 50 | <span class="dashicons dashicons-yes-alt"></span> |
| 51 | @else |
| 52 | <span class="dashicons dashicons-dismiss"></span> |
| 53 | @endif |
| 54 | {{ esc_html($link['name']) }} |
| 55 | </span> |
| 56 | <span class="type">{{ esc_html($types[$link['type']]) }}</span> |
| 57 | <span class="value"> |
| 58 | @if ($link['type'] == 'class') |
| 59 | {{ '.' . esc_html($link['value']) }} |
| 60 | <button class="copy-class" data-controller="clipboard" data-action="clipboard#copy" |
| 61 | data-clipboard-text-value="{{ esc_attr($link['value']) }}"> |
| 62 | <span class="dashicons dashicons-clipboard"></span> |
| 63 | </button> |
| 64 | @elseif ($link['type'] == 'extension') |
| 65 | {{ '.' . esc_html($link['value']) }} |
| 66 | @elseif ($link['type'] == 'domain') |
| 67 | {{ esc_html($link['value']) }} |
| 68 | @elseif ($link['type'] == 'subdirectory') |
| 69 | {{ '/' . esc_html($link['value']) . '/' }} |
| 70 | @elseif ($link['type'] == 'protocol') |
| 71 | {{ esc_html($link['value']) . ':' }} |
| 72 | @else |
| 73 | {{ esc_html($link['value']) }} |
| 74 | @endif |
| 75 | </span> |
| 76 | </div> |
| 77 | @if ($link['is_active'] !== false) |
| 78 | <div class="action-buttons"> |
| 79 | <div class="edit-container"> |
| 80 | <button class="edit-button">{{ esc_html__('Edit', 'independent-analytics') }}</button> |
| 81 | </div> |
| 82 | <div class="save-cancel-container"> |
| 83 | <button class="save-button">{{ esc_html__('Save', 'independent-analytics') }}</button> |
| 84 | <button class="cancel-button">{{ esc_html__('Cancel', 'independent-analytics') }}</button> |
| 85 | </div> |
| 86 | </div> |
| 87 | @endif |
| 88 | <button class="archive-button"> |
| 89 | @if($link['is_active']) |
| 90 | {{ esc_html__('Archive', 'independent-analytics' )}} |
| 91 | @else |
| 92 | {{ esc_html__('Resume Tracking', 'independent-analytics' )}} |
| 93 | @endif |
| 94 | </button> |
| 95 | @if ($link['is_active'] === false) |
| 96 | <button class="delete-link-button">{{ esc_html__('Delete', 'independent-analytics' )}}</button> |
| 97 | @endif |
| 98 | </div> |