Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pico CMS for Nextcloud v1.1 (WIP) #99

Merged
merged 39 commits into from
Feb 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
aab8a34
Allow sharing websites with groups without sharing source files
PhrozenByte Dec 14, 2019
365b97d
Merge branch 'master' into cms_pico-1.1
PhrozenByte Apr 13, 2020
2b58210
Update to PHP 7.1+
PhrozenByte Jan 17, 2020
80941b7
Split WebsiteCore::getOptions() to WebsiteCore::getOptionsJSON()
PhrozenByte Jan 17, 2020
0932f9f
Add DummyPlugin example plugin
PhrozenByte Apr 11, 2020
8ff7029
Various small improvements
PhrozenByte Apr 13, 2020
124ac7c
Require Nextcloud 18+ and PHP 7.2+
PhrozenByte Jun 14, 2020
d2776ed
Remove pre-NC18 workarounds
PhrozenByte Jun 14, 2020
9e82c90
Replace various substr() calls by more efficient counterparts
PhrozenByte Jun 14, 2020
845bae7
Merge branch 'master' into cms_pico-1.1
PhrozenByte Oct 10, 2020
e6357de
Merge branch 'master' into cms_pico-1.1
PhrozenByte Nov 28, 2020
60102da
Fix code formatting
PhrozenByte Nov 28, 2020
80d242f
Merge branch 'master' into cms_pico-1.1
PhrozenByte Nov 28, 2020
e36b3c1
Merge branch 'master' into cms_pico-1.1
PhrozenByte Feb 28, 2021
0c61cef
Allow editing website names by double clicking them
PhrozenByte Feb 28, 2021
850f58a
Add OCA.CMSPico.Editable for editable website names
PhrozenByte Mar 3, 2021
7a23e59
Merge branch 'master' into cms_pico-1.1
PhrozenByte Mar 6, 2021
bb6b826
Code cleanup
PhrozenByte Mar 6, 2021
2530df8
Merge WebsitesRequestBuilder into WebsitesRequest
PhrozenByte Mar 31, 2021
cd064c3
Merge branch 'master' into cms_pico-1.1
PhrozenByte Apr 8, 2021
a00542b
Fix DummyPluginFile
PhrozenByte Apr 8, 2021
4d066be
Code cleanup
PhrozenByte Apr 8, 2021
7a37365
Include website timezone in getPersonalWebsites() response
PhrozenByte Apr 8, 2021
3e6f40e
Merge branch 'master' into cms_pico-1.1
PhrozenByte Jun 30, 2021
984eb55
l10n: Spelling unification
Valdnet Nov 23, 2021
651084f
l10n: Spelling unification
Valdnet Nov 23, 2021
a4fdb37
l10n: Spelling unification
Valdnet Nov 23, 2021
f6c0bfc
l10n: Separate words
Valdnet Nov 23, 2021
0c7698d
l10n: Separate words
Valdnet Nov 23, 2021
3340541
l10n: Spelling unification
Valdnet Nov 23, 2021
a29b174
l10n: Separate words
Valdnet Nov 23, 2021
284c93f
Merge branch 'master' into cms_pico-1.1
PhrozenByte Jan 17, 2022
d3c3c30
Fix removal of WebsitesRequestBuilder
PhrozenByte Jan 17, 2022
4c03518
Remove direct usage of WebsiteCore::TYPE_*
PhrozenByte Jan 17, 2022
e70d705
Composer: Whitelist picocms/composer-installer plugin
PhrozenByte Jan 17, 2022
e275728
Code cleanup
PhrozenByte Jan 17, 2022
5faacb0
Bump version
PhrozenByte Jan 17, 2022
001b7d2
l10n: Combine words
Valdnet Jan 17, 2022
30cc82c
Merge pull request #185 from nextcloud/Valdnet-patch-1
Valdnet Jan 20, 2022
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: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@ build: lazy-check clean-build composer
--exclude="/*.phar" \
--exclude=".git" \
./ "$(build_dir)/$(app_name)/"
cp "./vendor/picocms/pico/plugins/DummyPlugin.php" \
"$(build_dir)/$(app_name)/appdata/plugins/DummyPlugin.php"
tar cfz "$(build_dir)/$(archive)" \
-C "$(build_dir)" "$(app_name)"

Expand Down
1 change: 1 addition & 0 deletions appdata/plugins/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# You should add plugins installed by Composer here
/PicoDeprecated
/DummyPlugin.php
2 changes: 1 addition & 1 deletion appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ You want to learn more about Pico CMS for Nextcloud? Easy! Just download and ena

]]>
</description>
<version>1.0.17</version>
<version>1.1.0-beta.1</version>
<licence>agpl</licence>
<author homepage="https://github.com/daita">Maxence Lange</author>
<author homepage="https://github.com/PhrozenByte">Daniel Rudolf</author>
Expand Down
1 change: 1 addition & 0 deletions appinfo/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@
[ 'name' => 'Plugins#addCustomPlugin', 'url' => '/admin/plugins', 'verb' => 'POST' ],
[ 'name' => 'Plugins#updateCustomPlugin', 'url' => '/admin/plugins/{item}', 'verb' => 'POST' ],
[ 'name' => 'Plugins#removeCustomPlugin', 'url' => '/admin/plugins/{item}', 'verb' => 'DELETE' ],
[ 'name' => 'Plugins#copyDummyPlugin', 'url' => '/admin/plugins/DummyPlugin', 'verb' => 'CLONE' ],

[ 'name' => 'Settings#setLimitGroups', 'url' => '/admin/limit_groups', 'verb' => 'POST' ],
[ 'name' => 'Settings#setLinkMode', 'url' => '/admin/link_mode', 'verb' => 'POST' ],
Expand Down
7 changes: 6 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,10 @@
"pico-plugin-dir": "appdata/plugins/"
},
"minimum-stability": "beta",
"prefer-stable": true
"prefer-stable": true,
"config": {
"allow-plugins": {
"picocms/*": true
}
}
}
30 changes: 30 additions & 0 deletions css/pico.scss
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,12 @@
}
}

.dialog-hint {
margin-top: -2px;
margin-bottom: calc(var(--margin));
opacity: 0.7;
}

table.table {
width: 100%;
border: 1px solid var(--color-border);
Expand Down Expand Up @@ -181,6 +187,10 @@
flex: 1 1 auto;
}

> .name-edit {
display: none;
}

> .actions,
> .more {
flex: 0 0 auto;
Expand Down Expand Up @@ -367,6 +377,17 @@
max-width: 37.5em;
}

.has-input-icon {
display: inline-block;
padding-right: 32px;
}

.input-icon {
margin: 4px 4px 4px -36px;
padding: 16px;
cursor: pointer;
}

p {
margin-bottom: calc(var(--margin) * 0.5);
text-align: justify;
Expand Down Expand Up @@ -534,6 +555,8 @@
* @license https://fontawesome.com/license/free
*/
:root {
--icon-edit-000: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA1NzYgNTEyIiB3aWR0aD0iMTUuNzUiIGhlaWdodD0iMTQiPjxwYXRoIGQ9Ik00MDIuNiA4My4ybDkwLjIgOTAuMmMzLjggMy44IDMuOCAxMCAwIDEzLjhMMjc0LjQgNDA1LjZsLTkyLjggMTAuM2MtMTIuNCAxLjQtMjIuOS05LjEtMjEuNS0yMS41bDEwLjMtOTIuOEwzODguOCA4My4yYzMuOC0zLjggMTAtMy44IDEzLjggMHptMTYyLTIyLjlsLTQ4LjgtNDguOGMtMTUuMi0xNS4yLTM5LjktMTUuMi01NS4yIDBsLTM1LjQgMzUuNGMtMy44IDMuOC0zLjggMTAgMCAxMy44bDkwLjIgOTAuMmMzLjggMy44IDEwIDMuOCAxMy44IDBsMzUuNC0zNS40YzE1LjItMTUuMyAxNS4yLTQwIDAtNTUuMnpNMzg0IDM0Ni4yVjQ0OEg2NFYxMjhoMjI5LjhjMy4yIDAgNi4yLTEuMyA4LjUtMy41bDQwLTQwYzcuNi03LjYgMi4yLTIwLjUtOC41LTIwLjVINDhDMjEuNSA2NCAwIDg1LjUgMCAxMTJ2MzUyYzAgMjYuNSAyMS41IDQ4IDQ4IDQ4aDM1MmMyNi41IDAgNDgtMjEuNSA0OC00OFYzMDYuMmMwLTEwLjctMTIuOS0xNi0yMC41LTguNWwtNDAgNDBjLTIuMiAyLjMtMy41IDUuMy0zLjUgOC41eiIvPjwvc3ZnPgoK);
--icon-edit-fff: url(data:image/svg+xml;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gtNDhoLTQ4di03MS4xYzAtMzkuNiAzMS43LTcyLjUgNzEuMy03Mi45IDQwLS40IDcyLjcgMzIuMSA3Mi43IDcydjgwYzAgMTMuMyAxMC43IDI0IDI0IDI0aDMyYzEzLjMgMCAyNC0xMC43IDI0LTI0di04MEM1NzYgNjggNTA3LjUtLjMgNDIzLjUgMHoiLz48L3N2Zz4=);
Expand All @@ -548,6 +571,13 @@
--icon-copy-fff: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA0NDggNTEyIiB3aWR0aD0iMTIuMjUiIGhlaWdodD0iMTQiPjxwYXRoIGZpbGw9ImN1cnJlbnRDb2xvciIgZD0iTTMyMCA0NDh2NDBjMCAxMy4yNTUtMTAuNzQ1IDI0LTI0IDI0SDI0Yy0xMy4yNTUgMC0yNC0xMC43NDUtMjQtMjRWMTIwYzAtMTMuMjU1IDEwLjc0NS0yNCAyNC0yNGg3MnYyOTZjMCAzMC44NzkgMjUuMTIxIDU2IDU2IDU2aDE2OHptMC0zNDRWMEgxNTJjLTEzLjI1NSAwLTI0IDEwLjc0NS0yNCAyNHYzNjhjMCAxMy4yNTUgMTAuNzQ1IDI0IDI0IDI0aDI3MmMxMy4yNTUgMCAyNC0xMC43NDUgMjQtMjRWMTI4SDM0NGMtMTMuMiAwLTI0LTEwLjgtMjQtMjR6bTEyMC45NzEtMzEuMDI5TDM3NS4wMjkgNy4wMjlBMjQgMjQgMCAwIDAgMzU4LjA1OSAwSDM1MnY5Nmg5NnYtNi4wNTlhMjQgMjQgMCAwIDAtNy4wMjktMTYuOTd6IiBmaWxsPSIjZmZmIj48L3BhdGg+PC9zdmc+);
}

.icon-edit {
background-image: var(--icon-edit-000);
}
.icon-edit-white, .icon-edit.icon-white {
background-image: var(--icon-edit-fff);
}

.icon-lock {
background-image: var(--icon-lock-000);
}
Expand Down
61 changes: 53 additions & 8 deletions js/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@
* @lends OCA.CMSPico.AdminList.prototype
*/
OCA.CMSPico.AdminList.prototype = $.extend({}, OCA.CMSPico.List.prototype, {
/** @member {Object[]|string[]} */
staticItems: [],

/** @member {Object[]|string[]} */
systemItems: [],

Expand All @@ -59,6 +62,9 @@
/** @member {Object[]|string[]} */
newItems: [],

/** @member {jQuery} */
$staticTemplate: $(),

/** @member {jQuery} */
$systemTemplate: $(),

Expand All @@ -78,6 +84,7 @@
* @param {Object} [options]
* @param {string} [options.route]
* @param {jQuery|string} [options.template]
* @param {jQuery|string} [options.staticTemplate]
* @param {jQuery|string} [options.systemTemplate]
* @param {jQuery|string} [options.customTemplate]
* @param {jQuery|string} [options.newTemplate]
Expand All @@ -89,12 +96,14 @@
OCA.CMSPico.List.prototype.initialize.apply(this, arguments);

options = $.extend({
staticTemplate: $element.data('staticTemplate'),
systemTemplate: $element.data('systemTemplate'),
customTemplate: $element.data('customTemplate'),
newTemplate: $element.data('newTemplate'),
copyTemplate: $element.data('copyTemplate')
}, options);

this.$staticTemplate = $(options.staticTemplate);
this.$systemTemplate = $(options.systemTemplate);
this.$customTemplate = $(options.customTemplate);
this.$newTemplate = $(options.newTemplate);
Expand All @@ -107,6 +116,42 @@
if (!this.$customTemplate.length) {
throw signature + ': No valid custom item template given';
}

this._initStaticItems();
},

/**
* @protected
*/
_initStaticItems: function () {
var $content = this.$staticTemplate.octemplate() || $(),
filter = this.$staticTemplate.data('filter') || '*',
that = this;

this.staticItems = [];
$content.filter(filter).each(function () {
var $itemTemplate = $(this),
itemData = {};

if (that.$staticTemplate.data('replaces')) {
$itemTemplate.data('replaces', that.$staticTemplate.data('replaces'));
}
if (that.$staticTemplate.data('appendTo')) {
$itemTemplate.data('appendTo', that.$staticTemplate.data('appendTo'));
}

$.each($itemTemplate.data(), function (key, value) {
if (key.substr(0, 4) === 'item') {
key = key[4].toLowerCase() + key.substr(5);
itemData[key] = value;
}
});

that.staticItems.push({
'$itemTemplate': $itemTemplate,
'itemData': itemData
});
});
},

/**
Expand All @@ -126,19 +171,24 @@

this._content(this.$template);

$.each(data.systemItems, function (_, value) {
$.each(this.staticItems, function (_, data) {
var $item = that._content(data.$itemTemplate, data.itemData);
that._setupItem($item, data.itemData);
});

$.each(this.systemItems, function (_, value) {
var itemData = (typeof value === 'object') ? value : { name: value },
$item = that._content(that.$systemTemplate, itemData);
that._setupItem($item, itemData);
});

$.each(data.customItems, function (_, value) {
$.each(this.customItems, function (_, value) {
var itemData = (typeof value === 'object') ? value : { name: value },
$item = that._content(that.$customTemplate, itemData);
that._setupItem($item, itemData);
});

$.each(data.newItems, function (_, value) {
$.each(this.newItems, function (_, value) {
var itemData = (typeof value === 'object') ? value : { name: value },
$item = that._content(that.$newTemplate, itemData);
that._setupItem($item, itemData);
Expand All @@ -157,15 +207,13 @@

if ($newItem.val()) {
$newItemButton.on('click.CMSPicoAdminList', function (event) {
event.preventDefault();
that._api('POST', '', { item: $newItem.val() });
});
} else {
$newItemButton.add($newItem).prop('disabled', true);
}

this.$element.find('.action-reload').on('click.CMSPicoAdminList', function (event) {
event.preventDefault();
that.reload();
});
},
Expand Down Expand Up @@ -209,7 +257,6 @@
});

$item.find('.action-sync').on('click.CMSPicoAdminList', function (event) {
event.preventDefault();
that._api('POST', itemData.name);
});

Expand Down Expand Up @@ -238,13 +285,11 @@
});

$this.on('click.CMSPicoAdminList', function (event) {
event.preventDefault();
dialog.open();
});
});

$item.find('.action-delete').on('click.CMSPicoAdminList', function (event) {
event.preventDefault();
that._api('DELETE', itemData.name);
});
}
Expand Down
Loading