2
0
mirror of https://github.com/inventree/inventree-website.git synced 2025-05-10 11:18:50 +00:00

migrate plugins repo

This commit is contained in:
Matthias Mair 2022-02-07 00:24:10 +01:00
parent cd504fad25
commit b046190388
14 changed files with 288 additions and 0 deletions

View File

@ -12,6 +12,35 @@ description: >-
baseurl: "/home.invenhost.com" baseurl: "/home.invenhost.com"
url: "" url: ""
collections:
publishers:
output: true
permalink: "/:title"
plugins:
output: true
custom_permalink_placeholders: ["publisher"]
#permalink: "/:publisher/:title"
defaults:
- scope:
path: ""
type: "publishers"
values:
layout: "publisher"
- scope:
path: ""
type: "plugins"
values:
layout: "plugin"
- scope:
path: ""
type: "posts"
values:
layout: "post"
- scope:
path: ""
values:
layout: "default"
plugins: plugins:
- jekyll-seo-tag - jekyll-seo-tag

View File

@ -49,3 +49,5 @@
internal: education internal: education
- name: About - name: About
internal: about internal: about
- name: Blog
internal: blog

View File

@ -0,0 +1,20 @@
<div class="row g-0 border rounded overflow-hidden flex-md-row mb-4 shadow-sm h-md-250 position-relative">
<div class="col p-4 d-flex flex-column position-static">
<div class="d-inline-block">
{% for cat in plugin.categories %}
<span class="badge rounded-pill bg-warning">{{ cat }}</span>
{% endfor %}
{% for tag in plugin.tags %}
<span class="badge rounded-pill bg-info">{{ tag }}</span>
{% endfor %}
</div>
<h3 class="mb-0">{{ plugin.name }}</h3>
<div class="mb-1 text-muted">
{% if plugin.published_on %}{{ plugin.published_on | date_to_string }} - {% endif %}
{% include publisher_ref.html pub=plugin.publisher %}
</div>
<p class="mb-auto">{{ plugin.excerpt | mardownify | remove: '<p>' | remove: '</p>' }}</p>
<a href="{{ plugin.url }}" class="stretched-link" aria-label="open plugin details"></a>
</div>
</div>

View File

@ -0,0 +1,4 @@
{% assign publisher_ref = site.publishers | where: 'short_name', include.pub | first %}
<a href="{{ publisher_ref.url }}" class="link-secondary">
<p class="text-muted">by <img src="https://github.com/{{ include.pub }}.png?size=40" alt="mdo" class="rounded-circle" width="20" height="20"> {{ include.pub }}</p>
</a>

47
_layouts/plugin.html Normal file
View File

@ -0,0 +1,47 @@
---
layout: default
---
<h1>{{ page.name }}</h1>
{% include publisher_ref.html pub=page.publisher %}
<div class="row g-5">
<div class="col-md-8">
{{ content }}
</div>
<div class="col-md-4">
<div class="position-sticky" style="top: 2rem;">
<div class="p-4 mb-3 bg-light rounded position-relative">
<h4 class="fst-italic">Github</h4>
<p class="mb-0">{{ page.github | remove: "https://github.com/" }}</p>
<a href="{{ page.github }}" class="stretched-link" aria-label="open github repo"></a>
</div>
<div>
<h4 class="fst-italic">Categories</h4>
<ol class="list-unstyled">
{% for categorie in page.categories %}
<li><a href="/categories/#{{ categorie | slugify }}"><span class="badge rounded-pill bg-warning">{{ categorie }}</span></a></li>
{% endfor %}
</ol>
</div>
<div>
<h4 class="fst-italic">Tags</h4>
<ol class="list-unstyled">
{% for tag in page.tags %}
<li><a href="/tags/#{{ tag | slugify }}"><span class="badge rounded-pill bg-info">{{ tag }}</span></a></li>
{% endfor %}
</ol>
</div>
<div class="mb-3 position-relative">
<h4 class="fst-italic">Website</h4>
<p class="mb-0">{{ page.website }}</p>
<a href="{{ page.website }}" class="stretched-link" aria-label="open website"></a>
</div>
</div>
</div>
</div>

View File

@ -16,5 +16,13 @@ layout: default
</header> </header>
<article class="prose prose-sm sm:prose lg:prose-lg xl:prose-xl mx-auto min-h-screen"> <article class="prose prose-sm sm:prose lg:prose-lg xl:prose-xl mx-auto min-h-screen">
<h1>{{ page.title }}</h1>
<p>
{{ page.date | date_to_string }}
{% assign publisher = site.publishers | where: 'short_name', page.publisher | first %}
{% if publisher %}
- <a href="{{ publisher.url }}">{{ publisher.name }}</a>
{% endif %}
</p>
{{ content }} {{ content }}
</article> </article>

42
_layouts/publisher.html Normal file
View File

@ -0,0 +1,42 @@
---
layout: default
---
<h1>
<img src="https://github.com/{{ page.github }}.png?size=40" alt="mdo" class="rounded-circle" width="40" height="40">
{{ page.name }}
</h1>
<div>
{% if page.github %}
<a href="https://github.com/{{page.github}}"><span class="badge bg-secondary">GitHub</span></a>
{% endif %}
{% if page.website %}
<a href="{{page.website}}"><span class="badge bg-secondary">Official Website</span></a>
{% endif %}
</div>
<blockquote class="blockquote">
<p class="mb-0">{{ content }}</p>
</blockquote>
{% assign filtered_posts = site.posts | where: 'publisher', page.short_name %}
{% if filtered_posts and filtered_posts.size != 0 %}
<h3>Posts</h3>
<ul class="list-unstyled">
{% for post in filtered_posts %}
<li>{{ post.date | date_to_string }} <a href="{{ post.url }}" class="lead">{{ post.title }}</a></li>
{% endfor %}
</ul>
{% endif %}
{% assign filtered_plugins = site.plugins | where: 'publisher', page.short_name %}
{% if filtered_plugins and filtered_plugins.size != 0 %}
<h3>Plugins</h3>
<ul class="list-unstyled">
{% for plugin in filtered_plugins %}
<a href="{{ plugin.title }}"></a>
<li>{{ plugin.title }}</li>
{% endfor %}
</ul>
{% endif %}

41
_plugins/shopify.md Normal file
View File

@ -0,0 +1,41 @@
---
name: ShopifyIntegrationPlugin org
publisher: matmair
website: https://mjmair.com
github: https://github.com/matmair/ShopifyIntegrationPlugin
categories:
- Integration
- Webhook
tags:
- Shopify
- Orders
---
A simple Integration into Shopify.
Let your orders from Shopify be created in autopilot, update your Inventory-Levels from InvenTree and vice-versa.
## Installation
1. Navigate to your InvenTree directory and cd into `src/InvenTree/plugins` and execute `git submodule add https://github.com/matmair/ShopifyIntegrationPlugin` there. Enable plugins in the general plugin settings and reload InvenTree.
2. Add a private app to your Shopify store (please register as a dev and use a development store. This is a PoC)
3. Go to the InvenTree settings and fill in the settings for the ShopifyIntegrationPlugin from your new private app.
4. Check out the new navigation tab.
## Caveat
Your instance must be reachable for webhooks from Shopify so use ngrok or something like that to expose your instance with HTTPS.
## State of the code
This code is bad. It is neither optimized nor is it CI/Cd ready or covered in any way.
I use this Plugin as a PoC to show what will be possible with the new system.
## Contribute
The whole plugin system is currently not even in the dev branch.
Feel free to submit issues or just send me a mail to dev AT mjmair.com
## No open source?
Currently I have defined no license so forking is a bad idea copyright-wise. This code should not be used as basis for anything - I will define a license once the plugin system gets released.

View File

@ -0,0 +1,8 @@
---
layout: post
publisher: matmair
title: Starting with templates
---
A good starting-point for developing your own plugin is taking a look at the [documentation](https://inventree.readthedocs.io/en/latest/extend/plugins/).
You could also use one of the current plugins as a sample.

7
_publishers/matmair.md Normal file
View File

@ -0,0 +1,7 @@
---
short_name: matmair
name: Matthias Mair
github: matmair
website: https:\\mjmair.com
---
I try to build an ecosystem of reusable plugins and integrations for InvenTree. Code once and KISS!

View File

@ -0,0 +1,7 @@
---
short_name: schrodingersgat
name: Oliver
github: SchrodingersGat
website: https:\\inventree.readthedocs.com
---
Maintainer of InvenTree.

14
blog.html Normal file
View File

@ -0,0 +1,14 @@
---
layout: default
title: Blog
---
<h1>Latest Posts</h1>
<ul>
{% for post in site.posts %}
<li>
<h2><a href="{{ post.url }}">{{ post.title }}</a></h2>
<p>{{ post.excerpt }}</p>
</li>
{% endfor %}
</ul>

44
plugins.html Normal file
View File

@ -0,0 +1,44 @@
---
layout: default
title: Plugins
---
{% for post in site.posts limit:1 %}
<div class="p-4 mb-4 text-white rounded bg-grad-primary">
<div class="px-0">
<h1 class="display-4 fst-italic">{{post.title}}</h1>
<p class="lead my-3">{{post.excerpt}}</p>
<p class="lead mb-0"><a href="{{post.url}}" class="text-white fw-bold">Continue reading...</a></p>
</div>
</div>
{% endfor %}
<div class="row g-5">
<div class="col-md-8">
{% for plugin in site.plugins %}
{% include plugin_card.html plugin=plugin %}
{% endfor %}
</div>
<div class="col-md-4">
<div class="position-sticky" style="top: 2rem;">
<div class="p-4 mb-3 bg-light rounded position-relative">
<h4 class="fst-italic">About</h4>
<p class="mb-0">This repo is a sample plugin repo for @InvenTree created by @matmair</p>
<a href="/about.html" class="stretched-link" aria-label="read more about this"></a>
</div>
<div class="p-4">
<h4 class="fst-italic">More InvenTree</h4>
<ol class="list-unstyled">
<li><a href="https://github.com/inventree/InvenTree">GitHub</a></li>
<li><a href="https://inventree.readthedocs.io/en/latest/">Docs</a></li>
<li><a href="https://github.com/inventree/inventree-python">Python interface</a></li>
<li><a href="https://main.invenhost.com/">Demo instance</a> feel free to register and play around!</li>
</ol>
</div>
</div>
</div>
</div>

15
publishers.html Normal file
View File

@ -0,0 +1,15 @@
---
layout: default
title: Publishers
---
<h1>Publishers</h1>
<ul>
{% for publisher in site.publishers %}
<li>
<h2><a href="{{ publisher.url }}">{{ publisher.name }}</a></h2>
<h3>{{ publisher.position }}</h3>
<p>{{ publisher.content | mardownify }}</p>
</li>
{% endfor %}
</ul>