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