Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"prefer-stable": true,
"require": {
"php": "^8.2",
"craftcms/cms": "^5.0.0-beta.2",
"craftcms/cms": "^5.6.0",
"cakephp/utility": "^5.0.0",
"jakeasmith/http_build_url": "^1.0",
"nesbot/carbon": "^2.10|^3.0.0",
Expand Down
1,064 changes: 684 additions & 380 deletions composer.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/.vitepress/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ function renderInlineCode(tokens, idx, options, env, renderer) {
var token = tokens[idx];

return `<code v-pre ${renderer.renderAttrs(token)}>${escapeHtml(
tokens[idx].content
tokens[idx].content,
)}</code>`;
}

Expand Down
13 changes: 13 additions & 0 deletions src/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@ public static function config(): array
public bool $hasCpSettings = true;
public bool $hasCpSection = true;

/**
* @inheritdoc
*/
public bool $hasReadOnlyCpSettings = true;

/**
* @var Queue|array|string
* @since 4.5.0
Expand Down Expand Up @@ -108,6 +113,14 @@ public function getSettingsResponse(): mixed
return Craft::$app->controller->redirect(UrlHelper::cpUrl('feed-me/settings'));
}

/**
* @inheritdoc
*/
public function getReadOnlySettingsResponse(): mixed
{
return Craft::$app->getResponse()->redirect(UrlHelper::cpUrl('feed-me/settings'));
}

public function getPluginName(): string
{
return Craft::t('feed-me', $this->getSettings()->pluginName);
Expand Down
3 changes: 2 additions & 1 deletion src/controllers/BaseController.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,13 @@ class BaseController extends Controller
*/
public function actionSettings(): Response
{
$this->requireAdmin();
$this->requireAdmin(false);

$settings = Plugin::$plugin->getSettings();

return $this->renderTemplate('feed-me/settings/general', [
'settings' => $settings,
'readOnly' => !Craft::$app->getConfig()->getGeneral()->allowAdminChanges,
]);
}

Expand Down
12 changes: 10 additions & 2 deletions src/templates/settings/general.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
{% requireAdmin %}
{% requireAdmin false %}

{% extends 'feed-me/_layouts/settings' %}

{% import '_includes/forms' as forms %}

{% set fullPageForm = true %}
{% set readOnly = readOnly ?? false %}
{% set fullPageForm = not readOnly %}

{% if readOnly %}
{% set contentNotice = readOnlyNotice() %}
{% endif %}

{% block content %}
<input type="hidden" name="action" value="plugins/save-plugin-settings">
Expand All @@ -20,6 +25,7 @@
first: true,
autofocus: true,
instructions: 'Plugin name for the end user.'|t('feed-me'),
disabled: readOnly,
}) }}

{{ forms.textField({
Expand All @@ -28,6 +34,7 @@
label: 'Cache Duration'|t('feed-me'),
value: settings.cache,
instructions: 'Cache duration (in seconds) to cache requests. Note: this only affects calls using the template tag - requests are never cached when triggering directly via the CP.'|t('feed-me'),
disabled: readOnly,
}) }}

<hr>
Expand All @@ -45,6 +52,7 @@
},
values: settings.enabledTabs,
instructions: 'Choose which tabs you would like to be shown.'|t('feed-me'),
disabled: readOnly,
}) }}

{% endnamespace %}
Expand Down
11 changes: 7 additions & 4 deletions src/web/assets/feedme/src/js/feed-me.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ $(function () {

// Change the import strategy for Users
var $disableLabel = $(
'input[name="duplicateHandle[]"][value="disable"]'
'input[name="duplicateHandle[]"][value="disable"]',
).next('label');
var originalDisableLabel = $disableLabel.text();
var $disableInstructions = $disableLabel.siblings('.instructions');
Expand All @@ -39,7 +39,10 @@ $(function () {
if (value === 'craft-elements-User') {
$disableLabel.text(Craft.t('feed-me', 'Suspend missing users'));
$disableInstructions.text(
Craft.t('feed-me', 'Suspends any users that are missing from the feed.')
Craft.t(
'feed-me',
'Suspends any users that are missing from the feed.',
),
);
} else {
$disableLabel.text(originalDisableLabel);
Expand Down Expand Up @@ -118,7 +121,7 @@ $(function () {
// for categories and entries - only show "create if they do not exist" if matching done by "title"
// for users - only show "create if they do not exist" if matching done by "email"
$(
'.categories-field-match select, .entries-field-match select, .users-field-match select'
'.categories-field-match select, .entries-field-match select, .users-field-match select',
).on('change', function (e) {
var match = 'title';
var $selectParent = $(this).parent();
Expand Down Expand Up @@ -226,7 +229,7 @@ $(function () {
});

$container.find('select').html(newOptions);
}
},
);

$('.field-extra-settings .element-group-section select').trigger('change');
Expand Down
42 changes: 21 additions & 21 deletions src/web/assets/feedme/src/lib/selectize.js
Original file line number Diff line number Diff line change
Expand Up @@ -655,7 +655,7 @@
module.exports = factory(
require('jquery'),
require('sifter'),
require('microplugin')
require('microplugin'),
);
} else {
root.Selectize = factory(root.jQuery, root.Sifter, root.MicroPlugin);
Expand Down Expand Up @@ -722,7 +722,7 @@
for (var i = 0; i < this._events[event].length; i++) {
this._events[event][i].apply(
this,
Array.prototype.slice.call(arguments, 1)
Array.prototype.slice.call(arguments, 1),
);
}
},
Expand Down Expand Up @@ -1288,7 +1288,7 @@
if (!self.settings.splitOn && self.settings.delimiter) {
var delimiterEscaped = self.settings.delimiter.replace(
/[-\/\\^$*+?.()|[\]{}]/g,
'\\$&'
'\\$&',
);
self.settings.splitOn = new RegExp('\\s*' + delimiterEscaped + '+\\s*');
}
Expand Down Expand Up @@ -1392,7 +1392,7 @@
if (self.isOpen) {
self.positionDropdown.apply(self, arguments);
}
}
},
);
$window.on('mousemove' + eventNS, function () {
self.ignoreHover = false;
Expand Down Expand Up @@ -1593,7 +1593,7 @@
if (self.settings.splitOn) {
setTimeout(function () {
var splitInput = $.trim(self.$control_input.val() || '').split(
self.settings.splitOn
self.settings.splitOn,
);
for (var i = 0, n = splitInput.length; i < n; i++) {
self.createItem(splitInput[i]);
Expand Down Expand Up @@ -2089,14 +2089,14 @@
.stop()
.animate(
{scrollTop: scroll_bottom},
animate ? self.settings.scrollDuration : 0
animate ? self.settings.scrollDuration : 0,
);
} else if (y < scroll) {
self.$dropdown_content
.stop()
.animate(
{scrollTop: scroll_top},
animate ? self.settings.scrollDuration : 0
animate ? self.settings.scrollDuration : 0,
);
}
}
Expand All @@ -2110,7 +2110,7 @@
if (self.settings.mode === 'single') return;

self.$activeItems = Array.prototype.slice.apply(
self.$control.children(':not(input)').addClass('active')
self.$control.children(':not(input)').addClass('active'),
);
if (self.$activeItems.length) {
self.hideInput();
Expand Down Expand Up @@ -2227,7 +2227,7 @@
calculateScore = self.settings.score.apply(this, [query]);
if (typeof calculateScore !== 'function') {
throw new Error(
'Selectize "score" setting must be a function that returns a function'
'Selectize "score" setting must be a function that returns a function',
);
}
}
Expand All @@ -2237,7 +2237,7 @@
self.lastQuery = query;
result = self.sifter.search(
query,
$.extend(options, {score: calculateScore})
$.extend(options, {score: calculateScore}),
);
self.currentResults = result;
} else {
Expand Down Expand Up @@ -2345,8 +2345,8 @@
'optgroup',
$.extend({}, self.optgroups[optgroup], {
html: html_children,
})
)
}),
),
);
} else {
html.push(groups[optgroup].join(''));
Expand Down Expand Up @@ -2627,7 +2627,7 @@
getOption: function (value) {
return this.getElementWithValue(
value,
this.$dropdown_content.find('[data-selectable]')
this.$dropdown_content.find('[data-selectable]'),
);
},

Expand Down Expand Up @@ -2947,7 +2947,7 @@
escape_html(self.items[i]) +
'" selected="selected">' +
escape_html(label) +
'</option>'
'</option>',
);
}
if (!options.length && !this.$input.attr('multiple')) {
Expand Down Expand Up @@ -3112,7 +3112,7 @@

if (self.$activeItems.length) {
$tail = self.$control.children(
'.active:' + (direction > 0 ? 'last' : 'first')
'.active:' + (direction > 0 ? 'last' : 'first'),
);
caret = self.$control.children(':not(input)').index($tail);
if (direction > 0) {
Expand Down Expand Up @@ -3393,13 +3393,13 @@
id = data[self.settings.optgroupValueField] || '';
html = html.replace(
regex_tag,
'<$1 data-group="' + escape_replace(escape_html(id)) + '"'
'<$1 data-group="' + escape_replace(escape_html(id)) + '"',
);
}
if (templateName === 'option' || templateName === 'item') {
html = html.replace(
regex_tag,
'<$1 data-value="' + escape_replace(escape_html(value || '')) + '"'
'<$1 data-value="' + escape_replace(escape_html(value || '')) + '"',
);
}

Expand Down Expand Up @@ -3687,7 +3687,7 @@

instance = new Selectize(
$input,
$.extend(true, {}, defaults, settings_element, settings_user)
$.extend(true, {}, defaults, settings_element, settings_user),
);
});
};
Expand Down Expand Up @@ -3781,7 +3781,7 @@
);
},
},
options
options,
);

self.setup = (function () {
Expand All @@ -3802,7 +3802,7 @@
equalizeWidth: true,
equalizeHeight: true,
},
options
options,
);

this.getAdjacentOption = function ($option, direction) {
Expand Down Expand Up @@ -3903,7 +3903,7 @@
className: 'remove',
append: true,
},
options
options,
);

var self = this;
Expand Down
6 changes: 4 additions & 2 deletions src/web/assets/feedme/src/scss/_font-awesome.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4752,7 +4752,8 @@ readers do not read off random characters that represent icons */
font-style: normal;
font-weight: 400;
src: url('../fonts/fa-regular-400.eot');
src: url('../fonts/fa-regular-400.eot?#iefix') format('embedded-opentype'),
src:
url('../fonts/fa-regular-400.eot?#iefix') format('embedded-opentype'),
url('../fonts/fa-regular-400.woff2') format('woff2'),
url('../fonts/fa-regular-400.woff') format('woff'),
url('../fonts/fa-regular-400.ttf') format('truetype'),
Expand All @@ -4773,7 +4774,8 @@ readers do not read off random characters that represent icons */
font-style: normal;
font-weight: 900;
src: url('../fonts/fa-solid-900.eot');
src: url('../fonts/fa-solid-900.eot?#iefix') format('embedded-opentype'),
src:
url('../fonts/fa-solid-900.eot?#iefix') format('embedded-opentype'),
url('../fonts/fa-solid-900.woff2') format('woff2'),
url('../fonts/fa-solid-900.woff') format('woff'),
url('../fonts/fa-solid-900.ttf') format('truetype'),
Expand Down
10 changes: 7 additions & 3 deletions src/web/assets/feedme/src/scss/feed-me.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion src/web/assets/feedme/src/scss/feed-me.scss
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,9 @@ body.ltr .table-feed-me .thin.action {
position: relative;
display: inline-block;
background-image: linear-gradient(#fff, #fafafa);
box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.1), 0 0 0 1px rgba(0, 0, 0, 0.025),
box-shadow:
inset 0 0 0 1px rgba(0, 0, 0, 0.1),
0 0 0 1px rgba(0, 0, 0, 0.025),
0 1px 1px rgba(0, 0, 0, 0.1);

&:after {
Expand Down
2 changes: 1 addition & 1 deletion src/web/twig/variables/FeedMeVariable.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public function getTabs(): array
'utilities' => ['label' => Craft::t('feed-me', 'Utilities'), 'url' => UrlHelper::cpUrl('feed-me/utilities')],
];

if (Craft::$app->getUser()->getIsAdmin() && Craft::$app->getConfig()->getGeneral()->allowAdminChanges) {
if (Craft::$app->getUser()->getIsAdmin()) {
$tabs['settings'] = ['label' => Craft::t('feed-me', 'Settings'), 'url' => UrlHelper::cpUrl('feed-me/settings')];
}

Expand Down
Loading