Skip to content

Commit

Permalink
Merge branch 'master' into feature/24749-netlify-plugin-migration
Browse files Browse the repository at this point in the history
  • Loading branch information
rgembalik authored Jun 19, 2024
2 parents 1164b9b + 7dc0f2c commit e1c3c9c
Show file tree
Hide file tree
Showing 42 changed files with 331 additions and 30 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ jobs:
run: |
npm install -g wrangler
# wrangler init --site cms-docs
sed -i '1i name = "cms-docs"' wrangler.toml
sed -i 's+account_id = '\'\''+account_id = '"'"$ACCOUNT_ID"'"'+g' wrangler.toml
sed -i 's+bucket = ""+bucket = "./public"+g' wrangler.toml
sed -i 's+workers_dev = true++g' wrangler.toml
Expand Down
28 changes: 28 additions & 0 deletions .github/workflows/mr-cleanup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Cleanup

on:
pull_request:
types: [ closed ]

jobs:
cleanup:
runs-on: ubuntu-latest
steps: # Steps represent a sequence of tasks that will be executed as part of the job
- uses: actions/checkout@v2
- name: Cloudflare
run: |
npm install -g wrangler
sed -i '1i name = "cms-docs-mr-${{ github.event.pull_request.number }}"' wrangler.toml
sed -i 's+account_id = '\'\''+account_id = '"'"$ACCOUNT_ID"'"'+g' wrangler.toml
sed -i 's+bucket = ""+bucket = "./public"+g' wrangler.toml
sed -i 's+workers_dev = true++g' wrangler.toml
echo "[env.production]" >> wrangler.toml
mkdir -p /home/runner/.wrangler/config/
echo api_token = '"'"$API_TOKEN"'"' > /home/runner/.wrangler/config/default.toml
cat wrangler.toml
wrangler delete --env=production --force
shell: bash
env:
API_TOKEN: ${{ secrets.API_TOKEN }}
ACCOUNT_ID: ${{ secrets.ACCOUNT_ID }}
CLOUDFLARE_API_TOKEN: ${{ secrets.API_TOKEN }}
44 changes: 44 additions & 0 deletions .github/workflows/mr-deployment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: CI
# Controls when the action will run. Triggers the workflow on push
# events but only for the master branch
on:
pull_request:
types: [ opened, synchronize ]


jobs:
build:
runs-on: ubuntu-latest # The type of runner that the job will run on
env:
SOURCE_EDITOR_URL: ${{ secrets.SOURCE_EDITOR_URL }}
steps: # Steps represent a sequence of tasks that will be executed as part of the job
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.x
- run: bash ./.github/scripts/get-plugins-docs.sh
- run: pip install -r requirements.txt
- run: mkdocs build
- run: mkdir public
- run: mv ./site ./public/docs
- name: Cloudflare
run: |
npm install -g wrangler
# wrangler init --site cms-docs
sed -i '1i name = "cms-docs-mr-${{ github.event.pull_request.number }}"' wrangler.toml
sed -i 's+account_id = '\'\''+account_id = '"'"$ACCOUNT_ID"'"'+g' wrangler.toml
sed -i 's+bucket = ""+bucket = "./public"+g' wrangler.toml
sed -i 's+workers_dev = true++g' wrangler.toml
echo "[env.production]" >> wrangler.toml
mkdir -p /home/runner/.wrangler/config/
echo api_token = '"'"$API_TOKEN"'"' > /home/runner/.wrangler/config/default.toml
cat wrangler.toml
cd workers-site
npm install
cd ../
wrangler deploy --env=production
shell: bash
env:
API_TOKEN: ${{ secrets.API_TOKEN }}
ACCOUNT_ID: ${{ secrets.ACCOUNT_ID }}
CLOUDFLARE_API_TOKEN: ${{ secrets.API_TOKEN }}
12 changes: 12 additions & 0 deletions docs/css/flotiq.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
html {
scroll-behavior: smooth;
}

.md-grid {
max-width: 70rem;
}
Expand Down Expand Up @@ -695,3 +699,11 @@ li.md-nav__item.md-nav__item--active:not(.md-nav__item--nested) {
.md-typeset h1:target, .md-typeset h2:target, .md-typeset h3:target {
--md-scroll-offset: -1rem;
}

/*
!* Scroll to top button visibility improvements *!
body:not(.md--top) .md-icon--top {
opacity: 1 !important;
}
*/
15 changes: 15 additions & 0 deletions docs/js/flotiq.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,3 +127,18 @@ document.addEventListener("DOMContentLoaded", function (event) {
});

addHelpfulForm();

// Scroll to top Button always visible
document.querySelector(".md-top").addEventListener("click", function(event) {
event.preventDefault();
window.scrollTo({top: 0, behavior: 'smooth'});
});

document.addEventListener('scroll', function() {
var topButton = document.querySelector(".md-top");
if(window.scrollY === 0){
topButton.setAttribute("hidden", true);
} else {
topButton.removeAttribute('hidden');
}
});
44 changes: 29 additions & 15 deletions docs/panel/Plugins/Custom-links.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,35 @@ Thanks to this link, you will be able to get easy access to the preview of where

## Installing the Custom Links plugin

Open up your profile menu and select `Plugins`.
Find in the right sidebar panel `Plugins` and select.

![Flotiq plugins](images/profile-plugins.png){: .center .width25 .border}
![Flotiq plugins](images/sidebar-plugins.png){: .center .width25 .border}

On the next screen, click on the `Add to your plugins` button next to `Custom Links`.
On the next screen, click the plus icon next to `Custom Links` to install and enable the plugin.

![Adding Custom Links plugin to Flotiq](images/plugins-custom-links-1.png){: .center .width75 .border}
![Install Custom Links plugin](images/custom-links/install.png){: .center .width75 .border}

Next - fill in the details and click `Save changes` to finish your plugin setup.
Once the plugin is enabled, click `Manage` to open the modal with the form.

![Setting up Custom Links in Flotiq](images/plugins-custom-links-2.png){: .center .width75 .border}
![Manage Custom Links](images/custom-links/manage.png){: .center .width75 .border}

* URL Template - It's a place to enter the link template, e.g. `https://my-blog/post/{slug}`, where `slug` is the name of the content field of the type selected below. Instead of `{slug}`, you can use any field of a given content type, it is also possible to use nesting, e.g. `{internal.createdAt}`. However, the use of list type fields is not supported.
After the modal is opened, click `Add item`.

* Displayed Name Template - Any name that will be displayed on the link button.
![Add Custom Link](images/custom-links/add.png){: .center .width75 .border}

* Content Type Definition - Select the content type to display the button only for the specified content type. If the content type is not selected, the button will be shown when editing each content object.
Next, fill in the details and click `Save changes` to complete your plugin setup.

You're done. Now you will see `Link to current post` in Content Objects forms, the button `https://my-blog/post/first-post`.
![Setting up Custom Links in Flotiq](images/custom-links/simple-link.png){: .center .width75 .border}

![Custom links button in Flotiq editor](images/plugins-custom-links-3.png){: .center .width50 .border}
* URL template - It's a place to enter the link template, e.g. `https://my-blog/post/{slug}`, where `slug` is the name of the content field of the type selected below. Instead of `{slug}`, you can use any field of a given content type, it is also possible to use nesting, e.g. `{internal.createdAt}`. You can also use list fields: `{addresses[0].city}`.

* Link name template - Any name that will be displayed on the link button.

* Content types - Select the content types to display the button only for the specified content types. If the content types are not selected, the button will be shown when editing each content object.

You're done. Now you will see `Example page` in Content Objects forms with `http://example.com/` link.

![Custom links button in Flotiq editor](images/custom-links/simple-link-co-form.png){: .center .width100 .border}


## Examples
Expand All @@ -35,16 +43,22 @@ You're done. Now you will see `Link to current post` in Content Objects forms, t

One of the most common use cases for using this plugin is to add a direct link to a preview/staging environment directly from the editor. Here's how you could set that up:

![Custom links plugin configuration for linking to a preview environment](images/plugins-custom-links-4.png){: .center .width50 .border}
![Custom links plugin configuration for linking to a preview environment](images/custom-links/simple-routing.png){: .center .width75 .border}

if you use this configuration with an object similar to this

![Content object with category and slug](images/custom-links/simple-routing-co-form.png){: .center .width100 .border}

you will see the `first-page` link that will lead you to `https://my-blog/post/first-page`.

### Creating links to pages using complex routing

Here's a bit more complex example, where the page routing requires to provide a URL with the name of a category *and* a slug of the current page:

![Custom links plugin with a more complex routing](images/plugins-custom-links-5.png){: .center .width50 .border}
![Custom links plugin with a more complex routing](images/custom-links/complex-routing.png){: .center .width75 .border}

if you use this configuration with an object similar to this

![Content object with category and slug](images/plugins-custom-links-6.png){: .center .width50 .border}
![Content object with category and slug](images/custom-links/complex-routing-co-form.png){: .center .width100 .border}

you will see a preview link that will lead you to `https://staging.site.com/office/best-office-chair`.
you will see a preview link that will lead you to `https://my-site.com/office/best-office-chair`.
38 changes: 38 additions & 0 deletions docs/panel/Plugins/Slug.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
title: Slug | Flotiq documentation
description: This plugin simplifies the process of creating slugs for your Content Object.

# Slug generation plugin

This plugin simplifies the process of creating slugs for your Content Object. It’s particularly useful when you want to generate slugs automatically based on existing data within a Content Object (e.g. the title of a blog post).

## Installing the Slug plugin

Find in the right sidebar panel `Plugins` and select.

![Flotiq plugins](images/sidebar-plugins.png){: .center .width25 .border}

On the next screen, click the plus icon next to `Slug` to install and enable the plugin.

![Install Slug plugin](images/slug/install.png){: .center .width75 .border}

Once the plugin is enabled, click `Manage` to open the modal with the form.

![Manage Slug](images/slug/manage.png){: .center .width75 .border}

After the modal is opened, click `Add`.

![Add Slug](images/slug/add.png){: .center .width75 .border}

Next, fill in the details and click `Save changes` to complete your plugin setup.

![Setting up Slug in Flotiq](images/slug/settings.png){: .center .width75 .border}

* Content Type - Defines the type of objects for which the slug will be generated.

* Slug source field - Determines the field on which the slug will be based.

* Target field - Specifies the field to which the slug will be entered.

You're done. Now you will see the refresh icon next to the slug field in the Content Object form. If you’re creating a new object and the field is currently empty, it will be auto-filled. If you’re editing an existing object or the field contains data, click the refresh icon to regenerate the slug.

![Slug outcome](images/slug/outcome.png){: .center .width75 .border}
Binary file added docs/panel/Plugins/images/custom-links/add.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed docs/panel/Plugins/images/plugins-custom-links-1.png
Binary file not shown.
Binary file removed docs/panel/Plugins/images/plugins-custom-links-2.png
Binary file not shown.
Binary file removed docs/panel/Plugins/images/plugins-custom-links-3.png
Binary file not shown.
Binary file removed docs/panel/Plugins/images/plugins-custom-links-4.png
Binary file not shown.
Binary file removed docs/panel/Plugins/images/plugins-custom-links-5.png
Binary file not shown.
Binary file removed docs/panel/Plugins/images/plugins-custom-links-6.png
Binary file not shown.
Binary file added docs/panel/Plugins/images/slug/add.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/panel/Plugins/images/slug/install.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/panel/Plugins/images/slug/manage.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/panel/Plugins/images/slug/outcome.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/panel/Plugins/images/slug/settings.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
65 changes: 52 additions & 13 deletions docs/panel/PluginsDevelopment/plugin-examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,21 +186,19 @@ FlotiqPlugins.add(
handler.on(
`flotiq.grid.cell::render`,
({ data, contentType, accessor }) => {
if (contentType.name !== 'blogpost') return;
if (accessor === 'title') {
const titleSpan = document.createElement('span');
titleSpan.textContent = data;
if (contentType.name !== 'blogpost' || accessor !== 'title') return;

titleSpan.addEventListener('flotiq.attached', () => {
const parentWidth = Math.round(
titleSpan.parentElement.getBoundingClientRect().width,
);
const titleSpan = document.createElement('span');
titleSpan.textContent = data;

titleSpan.innerHTML = `${data} <span style="font-size: 0.9em; color: gray;">(${parentWidth} px)</span>`;
});
return titleSpan;
}
return null;
titleSpan.addEventListener('flotiq.attached', () => {
const parentWidth = Math.round(
titleSpan.parentElement.getBoundingClientRect().width,
);

titleSpan.innerHTML = `${data} <span style="font-size: 0.9em; color: gray;">(${parentWidth} px)</span>`;
});
return titleSpan;
},
);
},
Expand All @@ -212,6 +210,47 @@ Result:
![Title width added to the object data table](img/title-width-plugin.png)
## Clear global counter after element is detached
In some cases, you may need to know when element is detached from the DOM tree. To be able to act immediately after the element is detached, you can use `flotiq.detached` html event.
Here we clear the global counter after element is detached:
```javascript
let counter = 0;

FlotiqPlugins.add(
{
id: 'mycompany.click-counter',
name: `Count clicks on the blog post titles`,
version: `1.0.0`,
},
function (handler) {
handler.on(
`flotiq.grid.cell::render`,
({ data, contentType, accessor }) => {
if (contentType.name !== 'blogpost' || accessor !== 'title') return;

const button = document.createElement('button');
button.textContent = `${data} (${counter})`;

button.addEventListener('click', () => {
counter++;
button.textContent = `${data} (${counter})`;
});

button.addEventListener('flotiq.detached', () => {
counter = 0;
});

return button;
},
);
},
);
```
{ data-search-exclude }
## Open custom modal
Open the modal by clicking on the grid ID cell.
Expand Down
18 changes: 18 additions & 0 deletions docs/panel/PluginsDevelopment/plugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,24 @@ return element;
```
{ data-search-exclude }
### Acting when an element is detached from the DOM tree
If you want to do something after detaching an element from the DOM tree (e.g. clear the element cache), you can use `flotiq.detached` DOM event.
**Important**: This event is only fired on the root element returned by the plugin. Elements inside will not receive this event.
```javascript
const element = document.createElement('span');
element.addEventListener('flotiq.detached', () => {
console.log('element removed'); // will be fired after element is detached
});
return element;
```
{ data-search-exclude }
!!! note "Multiple attaches/detaches"
Your HTML element may be attached and detached multiple times, depending on the view and place being rendered. Be prepared to handle those situations accordingly. E.g. if you keep your elements in a cache across multiple renders, consider waiting at least 50ms before the element is removed from the cache.
## Plugin Installation
Once you have your plugin written, you have several options to install it into Flotiq UI. Multiple instances of the plugin with the same `id` will override each other, so you can easily update your plugin as needed.
Expand Down
Binary file added docs/panel/images/user-roles/assign_role.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/panel/images/user-roles/blogposts_role.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/panel/images/user-roles/ctds_role.png
Binary file added docs/panel/images/user-roles/empty-role-form.png
Binary file added docs/panel/images/user-roles/roles_list.png
4 changes: 3 additions & 1 deletion docs/panel/spaces.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,9 @@ When the administrator changes the plan:
Administrators can manage users outside the Space context.
This allows Administrators to have an overview of all users within the Organization.

Users can be added independently of Spaces, without being assigned to a specific Space.
Users can be added independently of Spaces, without being assigned to a specific Space.

If a user is assigned to a Space, there are ways to manage their access to space content. If you wish to restrict user actions, consider adding a [Space Role](./user-roles.md) for the user. Users without any assigned role will have unrestricted access to all resources.

To display the user list, navigate to the `Users` tab in the Organization management view.

Expand Down
Loading

0 comments on commit e1c3c9c

Please sign in to comment.