Skip to content

Commit

Permalink
Disable all the things, for new fields. Bump to 2.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
mmikkel committed May 27, 2022
1 parent cec49b6 commit 14d3e8f
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 30 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.MD
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Release Notes for LinkMate

## 2.2.0 - 2022-05-27
### Changed
- Changed default link type to "Entry"
- All link types are now disabled by default, for new fields
- Moved the "Enable all" toggle to the bottom of the link type settings list
- Tightened up the styles for the field settings a little bit

## 2.1.0 - 2022-05-27
### Added
- Added the "Show site menu" setting to the element link type, making it possible to link across sites to non-propagated elements (excepting users).
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "vaersaagod/linkmate",
"description": "Let's hook you up, mate!",
"type": "craft-plugin",
"version": "2.1.0",
"version": "2.2.0",
"keywords": [
"craft",
"cms",
Expand Down
2 changes: 1 addition & 1 deletion src/fields/LinkField.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class LinkField extends Field
/**
* @var string|array
*/
public string|array $allowedLinkNames = '*';
public string|array $allowedLinkNames = [];

/**
* @var bool
Expand Down
14 changes: 12 additions & 2 deletions src/resources/LinkFieldAdmin.css
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

.linkFieldAdmin--tabsGroup {
margin-right: -1px;
padding: 20px 10px 0 10px;
padding: 10px 10px 0 10px;

background: #f1f5f8;
border-right: 1px solid #e3e5e8;
Expand All @@ -32,6 +32,10 @@
font-weight: bold;
}

.linkFieldAdmin--tabsGroup:first-child {
padding-top: 5px;
}

.linkFieldAdmin--tabsRow {
position: relative;
margin-right: -1px;
Expand All @@ -44,8 +48,14 @@
line-height: 40px;
}

.linkFieldAdmin--tabsRow.all {
border-bottom: none;
margin-top: 20px;
padding-bottom: 2px;
}

.linkFieldAdmin--tabsRow:last-child {
margin-bottom: 20px;

}

.linkFieldAdmin--tabsRow.selected {
Expand Down
1 change: 1 addition & 0 deletions src/templates/_settings-element.twig
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
}) }}

{% if elementName|lower != 'user' %}

{{ forms.checkboxField({
fieldset: true,
label: 'Show the site menu'|t('app'),
Expand Down
4 changes: 2 additions & 2 deletions src/templates/_settings-general.twig
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
checked: settings.allowCustomText
}) }}

 
<hr/>

{{ forms.checkboxField({
label: 'Allow links to open in new window'|t('linkmate'),
Expand All @@ -36,7 +36,7 @@
checked: settings.autoNoReferrer
}) }}

&nbsp;
<hr/>

{{ forms.checkboxField({
label: 'Enable aria label support'|t('linkmate'),
Expand Down
54 changes: 30 additions & 24 deletions src/templates/_settings.twig
Original file line number Diff line number Diff line change
Expand Up @@ -5,41 +5,47 @@

<div class="linkFieldAdmin" id="{{ name }}">
<div class="linkFieldAdmin--tabs">

<div class="linkFieldAdmin--tabsRow selected" data-name="_general">
<button class="linkFieldAdmin--tabsTab">{{ 'General settings'|t('linkmate') }}</button>
</div>

<div class="linkFieldAdmin--tabsRow all">
<div class="linkFieldAdmin--tabsLightswitch">
{{- forms.lightswitch({
name: 'allowedLinkNames[]',
on: allTypesAllowed,
value: '*',
}) -}}
</div>
{{ 'Enable all'|t('linkmate') }}
</div>
<div>

{%- for linkType in linkTypes -%}
{%- if linkType.group != group -%}
{%- set group = linkType.group -%}
<div class="linkFieldAdmin--tabsGroup">{{ group }}</div>
{%- endif -%}
{%- for linkType in linkTypes -%}
{%- if linkType.group != group -%}
{%- set group = linkType.group -%}
<div class="linkFieldAdmin--tabsGroup">{{ group }}</div>
{%- endif -%}

<div class="linkFieldAdmin--tabsRow" data-name="{{ linkType.name }}">
<div class="linkFieldAdmin--tabsLightswitch{% if allTypesAllowed %} hidden{% endif %}">
{{- forms.lightswitch({
name: 'allowedLinkNames[]',
on: linkType.enabled,
value: linkType.name,
}) -}}
</div>

<button class="linkFieldAdmin--tabsTab">
{{- linkType.displayName -}}
</button>
</div>
{%- endfor -%}

<div class="linkFieldAdmin--tabsRow" data-name="{{ linkType.name }}">
<div class="linkFieldAdmin--tabsLightswitch{% if allTypesAllowed %} hidden{% endif %}">
<div class="linkFieldAdmin--tabsRow all">
<div class="linkFieldAdmin--tabsLightswitch">
{{- forms.lightswitch({
name: 'allowedLinkNames[]',
on: linkType.enabled,
value: linkType.name,
on: allTypesAllowed,
value: '*',
}) -}}
</div>

<button class="linkFieldAdmin--tabsTab">
{{- linkType.displayName -}}
</button>
{{ 'Enable all'|t('linkmate') }}
</div>
{%- endfor -%}

</div>

</div>
<div class="linkFieldAdmin--body">
<div class="linkFieldAdmin--bodyContent selected" data-name="_general">
Expand Down

0 comments on commit 14d3e8f

Please sign in to comment.