diff --git a/.gitignore b/.gitignore index db2bee7315121cba7731e6f9953a95adfa481248..849a486378583e96c9a033c6e75872df36b8b916 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ jekyll-help-center-theme.gemspec node_modules _posts Gemfile.lock +_data/price-sources/*.json diff --git a/README.md b/README.md index d3f5250262a4366de0ad607135535e0b8f1908c0..363244a840fec7d1aae13bd5deefaa1723aae54b 100644 --- a/README.md +++ b/README.md @@ -17,14 +17,14 @@ Smart and simple exchange managed by git issue tracking system. | --- | --- | | eat_and_drink | non-vegetarian<br>vegetarian<br>vegan | | home_and_living | appliance<br>construction<br>interior<br>supply<br>storage | -| landscaping | exterior<br>horticulture | -| electronics | home electronics<br>multimedia<br>communication<br>illumination | -| tools_and_materials | tools<br>materials<br>storage | +| landscaping | furnishing<br>horticulture | +| electronics | home-electronics<br>multimedia<br>communication<br>illumination | +| tools-and-materials | tools<br>materials<br>storage | | clothing_and_lifestyle | underwear<br>workwear<br>clothes<br>accessories | | bodycare_and_health | bodycare<br>health | -| art_and_culture | artwork<br>cultural goods | +| art_and_culture | artwork<br>cultural-goods | | services | craft<br>social<br>styling<br>design<br>repair<br>guidance | -| knowlegde_and_information | soft media<br>hard media | +| knowledge_and_information | soft-media<br>hard-media | | learning_and_development | workshops<br>teaching | | mobility_and_transport | cars<br>bicycles<br>ships<br>accessories | | accommodation | rooms<br>houses | diff --git a/_config.yml b/_config.yml index 94de8e7e827b67ccb47730d679c19145119ab50d..9beb2887180e8a5c8766df2ebaf0ce2c92726c1a 100644 --- a/_config.yml +++ b/_config.yml @@ -10,7 +10,7 @@ title: - de: "P2P Marktplatz" en: "P2P marketplace" -url: "https://faircoin.co" +url: "http://127.0.0.1" github_username: "tonyford" color_theme: "rgb(15, 21, 57)" color_text: "#fff" @@ -29,3 +29,7 @@ plugins_dir: exclude: - script + +source: . +destination: _site +permalink: none # /:categories/:title.html diff --git a/_data/categories/accommodation.yml b/_data/categories/accommodation.yml index f7ae7b8787aab02221df95fc64b1862a3e4071b1..fc00800b62471d198dfcec89f62b957b5687796f 100644 --- a/_data/categories/accommodation.yml +++ b/_data/categories/accommodation.yml @@ -6,3 +6,10 @@ title: description: - en: '' - de: '' +Tags: + - rooms: + - en: 'rooms' + - de: 'Räumlichkeiten' + - houses: + - en: 'houses' + - de: 'Ferienhäuser' diff --git a/_data/categories/art_and_culture.yml b/_data/categories/art_and_culture.yml index a83a0e29dd5d1c6ba30a5fd3b70c6fe837405add..40270c570c91394def684cc1a27893cd8f61895e 100644 --- a/_data/categories/art_and_culture.yml +++ b/_data/categories/art_and_culture.yml @@ -6,3 +6,10 @@ title: description: - en: '' - de: '' +Tags: + - artwork: + - en: 'artwork' + - de: 'Kunst' + - cultural-goods: + - en: 'cultural-goods' + - de: 'Kulturgüter' diff --git a/_data/categories/bodycare_and_health.yml b/_data/categories/bodycare_and_health.yml index cd8445b2f7bc7b3003abed9f0ba51122e8a51f17..27acef567b4c1be5f8be06cd3b5dfba7c2f19b20 100644 --- a/_data/categories/bodycare_and_health.yml +++ b/_data/categories/bodycare_and_health.yml @@ -6,3 +6,10 @@ title: description: - en: '' - de: '' +Tags: + - bodycare: + - en: 'bodycare' + - de: 'Körperpflege' + - health: + - en: 'health' + - de: 'Gesundheit' diff --git a/_data/categories/clothing_and_lifestyle.yml b/_data/categories/clothing_and_lifestyle.yml index 07a873539cab0c19931927e540f432b0c4632d8a..b9d3fc2188a6ebf129a2e7909cfa16bbc8724f7c 100644 --- a/_data/categories/clothing_and_lifestyle.yml +++ b/_data/categories/clothing_and_lifestyle.yml @@ -6,3 +6,16 @@ title: description: - en: '' - de: '' +Tags: + - underwear: + - en: 'underwear' + - de: 'Unterwäsche' + - workwear: + - en: 'workwear' + - de: 'Arbeitskleidung' + - clothes: + - en: 'clothes' + - de: 'Kleidung' + - accessories: + - en: 'accessories' + - de: 'Zubehör' diff --git a/_data/categories/digital_goods.yml b/_data/categories/digital_goods.yml new file mode 100644 index 0000000000000000000000000000000000000000..54a01a7241a6cab9d36526fc7f0f47bd288e024b --- /dev/null +++ b/_data/categories/digital_goods.yml @@ -0,0 +1,12 @@ +ID: digital_goods +icon: 'help-circle' +title: +- en: 'digital goods' +- de: 'Digitale Güter' +description: +- en: '' +- de: '' +Tags: + - token: + - en: 'token' + - de: 'Token' diff --git a/_data/categories/eat_and_drink.yml b/_data/categories/eat_and_drink.yml index 59e8a4f23c8e75c39149307940e44aab9959d062..368b7adee11a8fcece15bd18ea6d7839ba73968a 100644 --- a/_data/categories/eat_and_drink.yml +++ b/_data/categories/eat_and_drink.yml @@ -6,3 +6,13 @@ title: description: - en: 'Eat & Drink description' - de: 'Essen & Trinken Beschreibung' +Tags: + - non-vegetarian: + - en: 'non-vegetarian' + - de: 'nicht vegetarisch' + - vegetarian: + - en: 'vegetarian' + - de: 'vegetarisch' + - vegan: + - en: 'vegan' + - de: 'vegan' diff --git a/_data/categories/electronics.yml b/_data/categories/electronics.yml index bb89810c2c6858e0addbf5a8ac46d79de0112651..c1d1189164273e0b36ebd1fc156397c51437d7b5 100644 --- a/_data/categories/electronics.yml +++ b/_data/categories/electronics.yml @@ -6,3 +6,16 @@ title: description: - en: '' - de: '' +Tags: + - home-electronics: + - en: 'home electronics' + - de: 'Heimelektronik' + - multimedia: + - en: 'multimedia' + - de: 'Multimedia' + - communication: + - en: 'communication' + - de: 'Kommunikation' + - illumination: + - en: 'illumination' + - de: 'Beleuchtung' diff --git a/_data/categories/home_and_living.yml b/_data/categories/home_and_living.yml index 5b5bb50d6ec4a0ca10327f7aa6bd248954234b0b..39b65c1f72ea2dccb78b932155a794e0d38d70cd 100644 --- a/_data/categories/home_and_living.yml +++ b/_data/categories/home_and_living.yml @@ -6,3 +6,19 @@ title: description: - en: '' - de: '' +Tags: + - appliance: + - en: 'appliance' + - de: 'Geräte' + - construction: + - en: 'construction' + - de: 'Bau' + - interior: + - en: 'interior' + - de: 'Innenausstattung' + - supply: + - en: 'supply' + - de: 'Versorgung' + - storage: + - en: 'storage' + - de: 'Lagerung' diff --git a/_data/categories/knowledge_and_information.yml b/_data/categories/knowledge_and_information.yml new file mode 100644 index 0000000000000000000000000000000000000000..2af4d431da4d3cac6a663030aedc79ac202f959a --- /dev/null +++ b/_data/categories/knowledge_and_information.yml @@ -0,0 +1,15 @@ +ID: knowledge_and_information +icon: 'help-circle' +title: +- en: 'knowledge & information' +- de: 'Wissen & Information' +description: +- en: '' +- de: '' +Tags: + - soft-media: + - en: 'soft media' + - de: 'elektronische Medien' + - hard-media: + - en: 'hard media' + - de: 'nicht-elektronische Medien' diff --git a/_data/categories/knowlegde_and_information.yml b/_data/categories/knowlegde_and_information.yml deleted file mode 100644 index 2759fca35776e178656fb79b170f0382e0c075d9..0000000000000000000000000000000000000000 --- a/_data/categories/knowlegde_and_information.yml +++ /dev/null @@ -1,8 +0,0 @@ -ID: knowlegde_and_information -icon: 'help-circle' -title: -- en: 'knowlegde & information' -- de: 'Wissen & Information' -description: -- en: '' -- de: '' diff --git a/_data/categories/landscaping.yml b/_data/categories/landscaping.yml index b7ecb61ec3ac733cad6ca60c0ad472faab45591d..e757014cf5ee4ab09dd09419569afe96c4461c01 100644 --- a/_data/categories/landscaping.yml +++ b/_data/categories/landscaping.yml @@ -6,3 +6,10 @@ title: description: - en: '' - de: '' +Tags: + - furnishing: + - en: 'furnishing' + - de: 'Ausstattung' + - horticulture: + - en: 'horticulture' + - de: 'Gartenbau' diff --git a/_data/categories/learning_and_development.yml b/_data/categories/learning_and_development.yml index 92f409735245be97a1a2efa55bb4c4ffc12afc6d..bf46341d6d99afbac3497c9021d6e9f56e262205 100644 --- a/_data/categories/learning_and_development.yml +++ b/_data/categories/learning_and_development.yml @@ -6,3 +6,10 @@ title: description: - en: '' - de: '' +Tags: + - workshops: + - en: 'workshops' + - de: 'Workshops' + - teaching: + - en: 'teaching' + - de: 'Training' diff --git a/_data/categories/mobility_and_transport.yml b/_data/categories/mobility_and_transport.yml index 39071c95c6948557d36767229498df08e8eaff93..6d8e96dff772278b7c2eb8546892d54203134e1f 100644 --- a/_data/categories/mobility_and_transport.yml +++ b/_data/categories/mobility_and_transport.yml @@ -1,8 +1,21 @@ ID: mobility_and_transport icon: 'help-circle' title: -- en: 'mobility and transport' -- de: 'Mobilität und Transport' + - en: 'mobility and transport' + - de: 'Mobilität und Transport' description: -- en: '' -- de: '' + - en: '' + - de: '' +Tags: + - accessories: + - en: 'accessories' + - de: 'Zubehör' + - bicycles: + - en: 'bicycles' + - de: 'Fahrräder' + - cars: + - en: 'cars' + - de: 'Automobile' + - ships: + - en: 'ships' + - de: 'Wasserfahrzeuge' diff --git a/_data/categories/services.yml b/_data/categories/services.yml index c8022c431df067dcc4f10b2588dbaea323838def..bc918fbd2e35ec4de648b9dc4d7f0c82582ec199 100644 --- a/_data/categories/services.yml +++ b/_data/categories/services.yml @@ -6,3 +6,22 @@ title: description: - en: '' - de: '' +Tags: + - craft: + - en: 'craft' + - de: 'Handwerk' + - social: + - en: 'social' + - de: 'Soziales' + - styling: + - en: 'styling' + - de: 'Styling' + - design: + - en: 'design' + - de: 'Design' + - repair: + - en: 'repair' + - de: 'Reparatur' + - guidance: + - en: 'guidance' + - de: 'Anleitung' diff --git a/_data/categories/tools_and_materials.yml b/_data/categories/tools_and_materials.yml index a54232bbcaa5624ef795795a89ea745d849586ac..e1f06667a97ff9ba7b3f708bc7ef733a6047aadc 100644 --- a/_data/categories/tools_and_materials.yml +++ b/_data/categories/tools_and_materials.yml @@ -6,3 +6,13 @@ title: description: - en: '' - de: '' +Tags: + - tools: + - en: 'tools' + - de: 'Werkzeuge' + - materials: + - en: 'materials' + - de: 'Materialien' + - storage: + - en: 'storage' + - de: 'Lagerung' diff --git a/_data/condition/1-new.yml b/_data/condition/1-new.yml new file mode 100644 index 0000000000000000000000000000000000000000..e8e9a38446bd1a8a81a21d7fc0b6cbb66fdb100f --- /dev/null +++ b/_data/condition/1-new.yml @@ -0,0 +1,8 @@ +ID: new +i: '1' +title: +- en: 'new' +- de: 'neu' +description: +- en: 'new - unused' +- de: 'neu - ungebraucht' diff --git a/_data/condition/2-used-mint.yml b/_data/condition/2-used-mint.yml new file mode 100644 index 0000000000000000000000000000000000000000..81ded212884e05705e94e4907332940aa4c78786 --- /dev/null +++ b/_data/condition/2-used-mint.yml @@ -0,0 +1,8 @@ +ID: used-mint +index: '2' +title: +- en: 'used-mint' +- de: 'gebraucht-neuwertig' +description: +- en: 'used - but as new ' +- de: 'gebraucht - neuwertiger Zustand' diff --git a/_data/condition/3-used-good.yml b/_data/condition/3-used-good.yml new file mode 100644 index 0000000000000000000000000000000000000000..0e8722f6b799e6f4e83a7e6841cfc0d77e8ac164 --- /dev/null +++ b/_data/condition/3-used-good.yml @@ -0,0 +1,8 @@ +ID: used-good +i: '3' +title: +- en: 'used-good' +- de: 'gebraucht-gut' +description: +- en: 'used - in good condition' +- de: 'gebraucht - in gutem Zustand' diff --git a/_data/condition/4-used-moderate.yml b/_data/condition/4-used-moderate.yml new file mode 100644 index 0000000000000000000000000000000000000000..ca66876ef626131ab66cb33e9eee60f6143a6735 --- /dev/null +++ b/_data/condition/4-used-moderate.yml @@ -0,0 +1,8 @@ +ID: used-moderate +index: '4' +title: +- en: 'used-moderate' +- de: 'gebraucht-moderat' +description: +- en: 'used - moderate condition' +- de: 'gebraucht -moderater Zustand' diff --git a/_data/condition/5-used.yml b/_data/condition/5-used.yml new file mode 100644 index 0000000000000000000000000000000000000000..2d9bd8e8143d6f79e3962ffbc685ffaceab37891 --- /dev/null +++ b/_data/condition/5-used.yml @@ -0,0 +1,8 @@ +ID: used +index: '5' +title: +- en: 'used' +- de: 'gebraucht' +description: +- en: 'used - with viewable signs of wear but still functional' +- de: 'gebraucht - mit sichtbaren Spuren aber voll funktionsfähig' diff --git a/_data/condition/6-defective-repairable.yml b/_data/condition/6-defective-repairable.yml new file mode 100644 index 0000000000000000000000000000000000000000..2bd5a16737a840fc1ceeec951eb035c46ad3864e --- /dev/null +++ b/_data/condition/6-defective-repairable.yml @@ -0,0 +1,8 @@ +ID: defective-repairable +index: '6' +title: +- en: 'defective-repairable' +- de: 'defekt-reparierbar' +description: +- en: 'defective - but repairable' +- de: 'defekt - aber reparierbar' diff --git a/_data/condition/7-defective-spareparts.yml b/_data/condition/7-defective-spareparts.yml new file mode 100644 index 0000000000000000000000000000000000000000..e15a8bb908ff441cbb5edf3e215d3fdb8ba53578 --- /dev/null +++ b/_data/condition/7-defective-spareparts.yml @@ -0,0 +1,8 @@ +ID: defective-spareparts +index: '7' +title: +- en: 'defective-spareparts' +- de: 'defekt-Ersatzteilspender' +description: +- en: 'defective - spareparts' +- de: 'defekt - aber als Ersatzteilspender brauchbar' diff --git a/_data/currencies/FAIR.yml b/_data/currencies/FAIR.yml index bb6bab3551b4ee795e3d83e4735f930da6dd8f1b..a8f04510c6c0913efa9bb1f6a93937bd77f24432 100644 --- a/_data/currencies/FAIR.yml +++ b/_data/currencies/FAIR.yml @@ -10,6 +10,14 @@ longitude: 0 color: goldenrod type: Point price-sources: + - + www: https://fairo.exchange/fair.json + file: fairo.json + currency: FAIRO + param: + - FAIRO + - last + formula: round($,3) - www: https://exchange.faircoin.co/data/freevision_eur.json file: freevision.json diff --git a/_data/form.yml b/_data/form.yml new file mode 100644 index 0000000000000000000000000000000000000000..653aa57489ab5972b479c3dac19058f0e5ce4e06 --- /dev/null +++ b/_data/form.yml @@ -0,0 +1,168 @@ +fields: + + - language-code: + - type: selection + - translation: + - de: 'Sprachkennung' + - en: 'language code' + - help: + - de: 'ISO 639-1 / https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes' + - en: 'ISO 639-1 / https://de.wikipedia.org/wiki/Liste_der_ISO-639-1-Codes' + - default: en + - values: + - de + - en + + - tags: + - type: selection-tags + - translation: + - de: 'Kategorie' + - en: 'Category' + - help: + - de: 'Auswahl ist erforderlich!' + - en: 'Selection is mandatory!' + - default: eat_and_drink,vegetarian + + - headline: + - type: input-text + - maxlength: 32 + - translation: + - de: 'Überschrift' + - en: 'headline' + - help: + - de: 'maximal 32 Zeichen' + - en: 'maximum 32 charachters' + - default: '' + + - condition: + - type: selection-condition + - translation: + - de: 'Erhaltungszustand' + - en: 'condition' + - help: + - de: 'Auswahl ist erforderlich!' + - en: 'Selection is mandatory!' + - default: 2-used-mint + + - description: + - type: textarea + - maxlength: 256 + - translation: + - de: 'Beschreibung' + - en: 'description' + - help: + - de: 'maximal 256 Zeichen' + - en: 'maximum 256 charachters' + - default: '' + + - image-profile: + - type: selection-img + - translation: + - de: 'Bild' + - en: 'image' + - help: + - de: 'Bild einfügen. Bitte den verwendeten Dienst auswählen!' + - en: 'Insert image. Please select a service!' + - default: imgbb + - values: + - none + - imgbb + + - image-preview: + - type: input-text + - maxlength: 256 + - translation: + - de: 'Vorschaubild' + - en: 'image preview' + - help: + - de: 'empfohlene Größe 200 x 200 px' + - en: 'recommend size 200 x 200 px' + - default: '' + + - image: + - type: input-text + - maxlength: 256 + - translation: + - de: 'Bild in Originalgröße' + - en: 'full size image' + - help: + - de: 'empfohlene Größe 1024 x 768 px' + - en: 'recommend size 1024 x 768 px' + - default: '' + + - unit: + - type: selection + - translation: + - de: 'Mengeneinheit' + - en: 'size unit' + - help: + - de: 'Auswahl ist erforderlich!' + - en: 'Selection is mandatory!' + - default: x + - values: + - x + - kg + - g + - m + + - min-size: + - type: input-text + - class: form-decimals + - maxlength: 32 + - translation: + - de: 'minimale Menge' + - en: 'minimal size' + - help: + - de: 'in Bezug auf die ausgewählte Mengeneinheit' + - en: 'in relation to the selected size unit' + - default: 0 + + - max-size: + - type: input-text + - class: form-decimals + - maxlength: 32 + - translation: + - de: 'Gesamtmenge' + - en: 'maximum size' + - help: + - de: 'in Bezug auf die ausgewählte Mengeneinheit' + - en: 'in relation to the selected size unit' + - default: 1 + + - price-source: + - type: selection + - translation: + - de: 'Preisberechnung' + - en: 'price calculation' + - help: + - de: 'Bitte eine Datenquelle auswählen oder einen Preis selbst definieren!' + - en: 'please select a data source or define a fixed price!' + - default: fairo + - values: + - fairo + - freevision + - faircoin-xyz + + - price-currency: + - type: selection + - translation: + - de: 'Referenzwährung' + - en: 'reference currency' + - help: + - de: 'Bitte Referenzwährung für die Preisberechnung auswählen!' + - en: 'please select a reference currency for price calculation!' + - default: FAIRO + - values: + - FAIRO + - EUR + + - price-per-unit: + - type: input-text + - class: decimals + - translation: + - de: 'Preis je Mengeneinheit' + - en: 'price per size unit' + - help: + - de: 'in Referenzwährung' + - en: 'in reference currency' + - default: 1 diff --git a/_data/sort.yml b/_data/sort.yml index 9f0dc244f96618be23f850cc2a4e0dad6f8e1bd3..f2bc96bad125415eb3fc14f3cb05d59b732a3c9f 100644 --- a/_data/sort.yml +++ b/_data/sort.yml @@ -2,6 +2,7 @@ de: - services - electronics - eat_and_drink + - digital_goods - bodycare_and_health - clothing_and_lifestyle - art_and_culture @@ -10,17 +11,18 @@ de: - mobility_and_transport - accommodation - tools_and_materials - - knowlegde_and_information + - knowledge_and_information - home_and_living en: - accommodation - art_and_culture - bodycare_and_health - clothing_and_lifestyle + - digital_goods - eat_and_drink - electronics - home_and_living - - knowlegde_and_information + - knowledge_and_information - landscaping - learning_and_development - mobility_and_transport diff --git a/_includes/form.html b/_includes/form.html new file mode 100644 index 0000000000000000000000000000000000000000..f3e6fecb453ceccd11b617cf0239627a17da2c74 --- /dev/null +++ b/_includes/form.html @@ -0,0 +1,82 @@ +<form> + {% for fields in site.data.form.fields %} + {% for f in fields %} + {% capture ftype %}{{ f[1] | map: 'type' }}{% endcapture %} + {% capture default %}{{ f[1] | map: 'default' }}{% endcapture %} + {% case ftype %} + {% when 'selection' %} + {% assign fvalues=f[1] | map: 'values' | clean %} + <div class="form-group"> + <label>{{ f[1] | map: 'translation' | map: include.ln }}</label> + <select id="{{ f[0] }}" class="order-form form-control" onchange="createYml()"> + {% for v in fvalues %}<option value="{{ v }}" title="{{ v }}"{% if default == v %} selected{% endif %}>{{ v }}</option>{% endfor %} + </select> + <small class="form-text text-muted">{{ f[1] | map: 'help' | map: include.ln }}</small> + </div> + {% when 'selection-tags' %} + {% assign fvalues=site.data.categories %} + <div class="form-group"> + <label>{{ f[1] | map: 'translation' | map: include.ln }}</label> + <select id="{{ f[0] }}" class="order-form form-control" onchange="createYml()"> + {% for v in fvalues %} + <optgroup label="{{ v[1] | map: 'title' | map: include.ln }}"> + {% assign Tags=v[1] | map: 'Tags' %} + {% for tag in Tags %} + {% for t in tag %} + {% assign tt=t | first %}{% capture val %}{{ v[0]}},{{ tt[0] }}{% endcapture %} + <option value="[{{ v[0]}},{{ tt[0] }}]" title="[ {{ v[0]}},{{ tt[0] }} ]"{% if default == val %} selected{% endif %}>{{ tt[1] | map: include.ln }}</option> + {% endfor %} + {% endfor %} + </optgroup> + {% endfor %} + </select> + <small class="form-text text-muted">{{ f[1] | map: 'help' | map: include.ln }}</small> + </div> + {% when 'selection-condition' %} + {% assign fvalues=site.data.condition | sort %} + <div class="form-group"> + <label>{{ f[1] | map: 'translation' | map: include.ln }}</label> + <select id="{{ f[0] }}" class="order-form form-control" onchange="createYml()"> + {% for v in fvalues %} + <option value="{{ v[0] }}" title="{{ v[0] }}"{% if default == v[0] %} selected{% endif %}>{{ v[1] | map: 'description' | map: include.ln }}</option> + {% endfor %} + </select> + <small class="form-text text-muted">{{ f[1] | map: 'help' | map: include.ln }}</small> + </div> + {% when 'selection-img' %} + {% assign fvalues=f[1] | map: 'values' | clean %} + <div class="form-group"> + <label>{{ f[1] | map: 'translation' | map: include.ln }}</label> + <select id="{{ f[0] }}" class="order-form form-control"> + {% for v in fvalues %} + <option value="{{ v }}" title="{{ v[0] }}"{% if default == v[0] %} selected{% endif %}>{{ v }}</option> + {% endfor %} + </select> + <small class="form-text text-muted">{{ f[1] | map: 'help' | map: include.ln }}</small> + </div> + {% when 'input-text' %} + <div class="form-group"> + <label>{{ f[1] | map: 'translation' | map: include.ln }}</label> + <input id="{{ f[0] }}" type="text" class="order-form form-control {{ f[1] | map: 'class' }}" maxlength="{{ f[1] | map: 'maxlength' }}" onkeyup="formInput(this)" onchange="createYml()" value="{{ default }}"> + <small class="form-text text-muted">{{ f[1] | map: 'help' | map: include.ln }}</small> + </div> + {% when 'textarea' %} + <div class="form-group"> + <label>{{ f[1] | map: 'translation' | map: include.ln }}</label> + <textarea id="{{ f[0] }}" class="order-form form-control" maxlength="{{ f[1] | map: 'maxlength' }}" onchange="createYml()">{{ default }}</textarea> + <small class="form-text text-muted">{{ f[1] | map: 'help' | map: include.ln }}</small> + </div> + {% endcase %} + {% endfor %} + {% endfor %} + <button class="form-control" type="button" onclick="importYml()">import from *.yml</button> +</form> +<div class="order-yml"> + <h4>*.yml</h4> + <textarea id="order-yml"></textarea> +</div> +<script> +$( document ).ready(function() { + createYml(); +}); +</script> diff --git a/_includes/overview.html b/_includes/overview.html index 69c92d833e128521a3ec79e8b9c39a27a50aedb5..5c0b7836fc7bb76bc43e6441596662406213ae53 100644 --- a/_includes/overview.html +++ b/_includes/overview.html @@ -1,40 +1,60 @@ <div class="overview"> {% assign cat = site.data.sort[include.ln] %}{% assign cat_size = cat | size %} + {% capture price_fairo %}{{ site.data.price-sources['fairo'].price['FAIRO'] }}{% endcapture %} {% if cat_size == 0 %} <h2>No Categories found</h2> {% else %} - <div class="categories"> + <div class="tags"> <ul> {% for c in cat %} {% capture ID %}{{ site.data.categories[c].ID }}{% endcapture %} - <li onclick="get_by_cat(this,'{{ID}}')">{{ site.data.categories[c].title | map: include.ln }} [{{ site.categories[ID] | size }}]</li> + <li class="li-tags li-tag-{{ID}}" title="{{ ID }}" onclick="get_by_tag(['{{ID}}'])">{{ site.data.categories[c].title | map: include.ln }} [{{ site.tags[ID] | size }}]</li> + {% for tag in site.data.categories[c].Tags %} + {% for t in tag %} + <tags class="li-subtags li-subtag-of-{{ID}} d-none li-tag-{{t[0]}}" title="{{ t[0] }}" onclick="get_by_tag(['{{ID}}', '{{t[0]}}'])"><span class="feather-icon icon-tag"></span>{{ t[1] | map: include.ln }}</tags> + {% endfor %} + {% endfor %} {% endfor %} </ul> </div> {% endif %} + + {% for o in site.posts %} <div class="orders"> - {% for c in cat %} - {% capture ID %}{{ site.data.categories[c].ID }}{% endcapture %} - {% for o in site.categories[ID] %} - <div class="orderlist-div cat-{{ ID }}"> + <div class="orderlist-div{% for tag in o.tags %} tag-{{ tag }}{% endfor %}"> - <div class="orderlist-date"> - <div class="image">{% if o.image-profile == 'img' %}<img src="{{ o.image }}">{% else if o.image-profile == 'imgbb'%}{{ o.image }}{% endif %}</div> - </div> + <div class="orderlist-date"> + <div class="image">{% if o.image-profile == 'img' %}<img src="{{ o.image }}">{% else if o.image-profile == 'imgbb'%}{{ o.image }}{% endif %}</div> + </div> - <div class="orderlist-title"> - <a href="{{ o.git-repo }}/blob/master/{{ o.order-title }}" target="git-order"><u>{{ o.headline | truncate: 32 }}</u></a> <a href="{{ o.git-profile }}" target="git-profile"><span class="feather-icon icon-user"></span></a> <a href="{{ o.git-repo }}/issues/new?issue[title]={{ o.order-title }}" target="git-contact"><span class="feather-icon icon-mail"></span></a><br> - <small><lang><span class="feather-icon icon-tag"></span>{{ o.language-code }}</lang> <span class="d-none distance-data">{{ o.latitude }},{{ o.longitude }},{{ o.country-code }}</span> <span class="distance"></span> <used><span class="feather-icon icon-tag"></span>{{ o.condition }}</used> <tags><span class="feather-icon icon-tag"></span>{{ o.tags }}</tags></small><br> - <div><small>{{ o.description }}</small></div> - </div> + <div class="orderlist-title"> + <a href="{{ o.git-repo }}/blob/master/{{ o.order-title }}" target="git-order"><u>{{ o.headline | truncate: 32 }}</u></a> <a href="{{ o.git-profile }}" target="git-profile"><span class="feather-icon icon-user"></span></a> <a href="{{ o.git-repo }}/issues/new?issue[title]={{ o.order-title }}" target="git-contact"><span class="feather-icon icon-mail"></span></a><br> + <small><lang><span class="feather-icon icon-tag"></span>{{ o.language-code }}</lang> <a href="https://www.latlong.net/c/?lat={{ o.latitude }}&long={{ o.longitude }}" target="latlong" title="latitude:{{ o.latitude }} | longitude: {{ o.longitude }}"><span class="d-none distance-data">{{ o.latitude }},{{ o.longitude }},{{ o.country-code }}</span> <span class="distance"></span></a> <used><span class="feather-icon icon-tag"></span>{{ o.condition }}</used> + {% for tag in o.tags %} + <tags class="li-tags li-tag-{{ tag }} clickable" title="{{ tag }}" onclick="get_by_tag( ['{{ o.tags[0] }}', '{{ tag }}'] )"><span class="feather-icon icon-tag"></span> + {% if forloop.index == 1 %} + {{ site.data.categories | map: o.tags[0] | map: "title" | map: include.ln }} + {% else %} + {{ site.data.categories | map: o.tags[0] | map: "Tags" | map: tag | map: include.ln }} + {% endif %} + </tags> + {% endfor %}</small><br> + <div><small>{{ o.description }}</small></div> + </div> - <div class="orderlist-price">{% if o.min-size > 0 %}{{ o.min-size }}..{% endif %}{{ o.max-size }} {{ o.unit }}<br>( {{ o.price-per-unit | decimals }} {{ o.price-currency }} / {{ o.unit }} )<br>( {% capture price_ex %}{{ site.data.price-sources[o.price-source].price[o.price-currency] }}{% endcapture %}{% capture price %}{% if price_ex != "" %}{{price_ex}}{% else %}{{ o.price-source }}{% endif %}{% endcapture %}{{ price }} {{ o.price-currency }} / FAIR )<br><i>{% if price_ex != "" %}<a href="{{ site.data.price-sources[o.price-source].www }}">{{ o.price-source }}</a>{% else %}fixed price{% endif %}</i> - <br><br><font class="faircoin-price">{{ o.price-per-unit | divided_by: price | decimals }} FAIR</font> - </div> - </div> - {% endfor %} - {% endfor %} + {% capture price_ex %}{{ site.data.price-sources[o.price-source].price[o.price-currency] | plus: 0.00001 | round: 4 }}{% endcapture %} + {% capture price %}{% if price_ex != "" %}{{price_ex}}{% else %}{{ o.price-source }}{% endif %}{% endcapture %} + <div class="orderlist-price"><font class="faircoin-price">{{ o.price-per-unit | divided_by: price | round:1 | decimals }} FAIR</font><br>{% if o.min-size > 0 %}{{ o.min-size }}..{% endif %}{{ o.max-size }} {{ o.unit }}<br>( {{ o.price-per-unit | decimals }} {{ o.price-currency }} / {{ o.unit }} )<br>( {{ price }} {{ o.price-currency }} / FAIR )<br><i>{% if price_ex != "" %}<a href="{{ site.data.price-sources[o.price-source].www }}">{{ o.price-source }}</a>{% else %}fixed price{% endif %}</i> + + </div> + </div> </div> + {% endfor %} </div> +<script> +$( document ).ready(function() { + get_distances(); +}); +</script> diff --git a/_layouts/default.html b/_layouts/default.html index aba72762848726322482a1e59e5a869b15fe0c4b..3c1c5fdf74b89fef16f24271e8897ceda7df9166 100644 --- a/_layouts/default.html +++ b/_layouts/default.html @@ -1,16 +1,16 @@ {% include head.html %} <body> + <script src="{{ site.baseurl }}/assets/js/jquery.min.js"></script> <div class=""> {% include menu.html ln=page.ln %} {{ content }} - {% include footer.html ln=page.ln %} + {% if page.footer != false %}{% include footer.html ln=page.ln %}{% endif %} </div> <script src="https://cdn.rawgit.com/michalsnik/aos/2.1.1/dist/aos.js"></script> <script src="{{ site.baseurl }}/assets/js/simple-jekyll-search.js"></script> - <script src="{{ site.baseurl }}/assets/js/jquery.min.js"></script> <script src="{{ site.baseurl }}/assets/js/script.js"></script> <script> AOS.init({ diff --git a/_layouts/post.html b/_layouts/post.html new file mode 100644 index 0000000000000000000000000000000000000000..0f6eee6bdfb8d19ec66ff29c76d1912141e4b0e1 --- /dev/null +++ b/_layouts/post.html @@ -0,0 +1 @@ +{{ page | jsonify }} diff --git a/_plugins/array.rb b/_plugins/array.rb new file mode 100644 index 0000000000000000000000000000000000000000..665c4c8e60a48dbe3b48e23b1c295d9e6768a414 --- /dev/null +++ b/_plugins/array.rb @@ -0,0 +1,9 @@ + +module Arrays + def clean(input) + input.delete_if {|value| value == nil} + input[0] + end +end + +Liquid::Template.register_filter(Arrays) # register filter globally diff --git a/assets/js/script.js b/assets/js/script.js index 5bf15e17ed83bd4b1c84df9642f64eb3986546bc..0fedc5e2b000da948599851f22d7f63bd3b813a1 100644 --- a/assets/js/script.js +++ b/assets/js/script.js @@ -1,7 +1,3 @@ -$( document ).ready(function() { - get_distances(); -}); - function getDistanceFromLatLonInKm(lat1,lon1,lat2,lon2) { var R = 6371; // Radius of the earth in km var dLat = deg2rad(lat2-lat1); // deg2rad below @@ -20,11 +16,24 @@ function deg2rad(deg) { return deg * (Math.PI/180) } -function get_by_cat(obj, ID){ +function get_by_tag(tags){ + $('.orderlist-div').toggleClass('d-none',true); - $('.cat-'+ID).toggleClass('d-none',false); - $('.categories li').toggleClass('active', false ); - $(obj).toggleClass('active',true); + $('.li-tags').toggleClass('active', false ); + $('.li-subtags').toggleClass('active', false ).toggleClass('d-none',true); + + + var tag_class=''; + + tags.forEach( + function(v,i){ + tag_class+='.tag-'+v; + $('.li-tag-'+v).toggleClass('active',true); + $('.li-subtag-of-'+v).toggleClass('d-none', false); + } + ); + + $(tag_class).toggleClass('d-none',false); } function get_distances(){ @@ -48,3 +57,49 @@ function get_distances(){ $(v).html('<span class="feather-icon icon-map-pin"></span> ' + lcountry + ' ' + (( calc_distance ) ? '( ' + Math.round( getDistanceFromLatLonInKm (lat, long, llat, llong ) )+'km ) ' : '' ) ); } ); } + + +function formInput(obj){ + if( $(obj).hasClass('form-decimals') ){ + $(obj).toggleClass('is-invalid', ! $.isNumeric( $(obj).val() ) ); + } +} + +function createYml(){ + var yml=''; + $.each( $('.order-form'), + function(i,v){ + yml+=v.id + ': ' + $(v).val().replace(/(?:\r\n|\r|\n)/g, '<br>') + '\n'; + } + ); + $('#order-yml').val(yml); +} + +function importYml(){ + var yml=$('#order-yml').val(); + var error=''; + $('#order-yml').toggleClass('is-invalid',false); + yml.split('\n').forEach( + function(v,i){ + if( v == '' ) return; + var p=v.split(':')[0].trim(); + var v=v.split(':').slice(1).join(':').trim(); + if( $('#'+p).length == 1 ){ + if( $('#'+p)[0].localName == 'select' ){ + if( $('#'+p).val(v).val() != v ){ + error+='#'+p+' value ['+v+'] not exists in the list!'; + } + } + } else { + error+='#'+p+' not found in form!'; + } + if( error != ''){ + alert( 'error: \n'+error ); + error=''; + $('#order-yml').toggleClass('is-invalid',true); + } else { + $('#'+p).val(v.replace(/\<br\>/ig,'\n')); + } + } + ); +} diff --git a/css/main.scss b/css/main.scss index 0e1688ba3f58d0ef96b6ff2059c70bbe756bf734..b1c7952d79b126d1798321431b3d19c92901596e 100644 --- a/css/main.scss +++ b/css/main.scss @@ -104,7 +104,7 @@ $baseurl: '{{ site.baseurl }}'; width:initial; } -.categories { +.tags { @media screen and (max-width: 640px) { display:none; @@ -138,7 +138,7 @@ $baseurl: '{{ site.baseurl }}'; } .active { - color: darkgoldenrod; + color: darkgoldenrod !important; } } @@ -185,6 +185,14 @@ lang { } tags { + color: royalblue; +} + +tags.clickable { + cursor: pointer; +} + +tags.active { color: darkgoldenrod; } @@ -196,3 +204,39 @@ tags { .distance { color:midnightblue; } + +.form-control { + display: block; + width: 100%; +} + +form { + font-size: 0.8rem; + small { + color: grey; + } +} + +select, input, button { + border-radius: 0.1rem; + border: 1px solid gray; + height: 1.5rem; +} + +label { + display: inline-block; +} + +.is-invalid { + color: red; + border-color: red; +} + +.order-yml { + margin-top: 2rem; +} + +#order-yml { + width:100%; + height: 15rem; +} diff --git a/de/form.md b/de/form.md new file mode 100644 index 0000000000000000000000000000000000000000..92cc7486e08b0869f121e2ae8eac406ec8b6ba2e --- /dev/null +++ b/de/form.md @@ -0,0 +1,10 @@ +--- +layout: default +ln: de +footer: false +--- +<div class="content-post"> + <div class="size margin"> + {% include form.html ln='de' %} + </div> +</div> diff --git a/en/form.md b/en/form.md new file mode 100644 index 0000000000000000000000000000000000000000..ac317cc31ad3719416e6e1709cb8a2a6170b5286 --- /dev/null +++ b/en/form.md @@ -0,0 +1,10 @@ +--- +layout: default +ln: en +footer: false +--- +<div class="content-post"> + <div class="size margin"> + {% include form.html ln='en' %} + </div> +</div> diff --git a/pull.php b/pull.php new file mode 100644 index 0000000000000000000000000000000000000000..ce60960c1a19a9c7984eb00cf16792639ed1ec53 --- /dev/null +++ b/pull.php @@ -0,0 +1,10 @@ +<?php +$repo=$_GET['repo']; +if( !empty($repo) ){ + $f='pull.yml'; + echo $rep.' added to the list! Update regulary every 5 minutes'; + $fp=fopen($f,'a+'); + fwrite( $fp, '- '.$repo ); + fclose( $fp ); +} +?> diff --git a/script/_conf.py b/script/_conf.py new file mode 100644 index 0000000000000000000000000000000000000000..9be49313af409bf3acc87d4e9bfbc08a5e71c14c --- /dev/null +++ b/script/_conf.py @@ -0,0 +1 @@ +PULL_PATH='_site' diff --git a/script/get_orders.py b/script/get_orders.py index 96d56bf25e090aaf412d6485ed08fe7c46f68102..d72d0ba5666cd0dde729ee0f013ae0d759f64be1 100644 --- a/script/get_orders.py +++ b/script/get_orders.py @@ -5,6 +5,23 @@ import re import os import shutil +from yaml import load, dump + +try: + from yaml import CLoader as Loader, CDumper as Dumper +except ImportError: + from yaml import Loader, Dumper + +file = open('../_config.yml','r') +s=file.read() +file.close() + +Config=load( s, Loader=Loader ) + +pullfile='../'+Config['destination']+'/pull.yml' + +if not os.path.exists(pullfile): + sys.exit(0) try: shutil.rmtree('../_posts') @@ -15,12 +32,6 @@ os.makedirs('../_posts') Date=datetime.datetime.now().strftime('%Y-%m-%d') -from yaml import load, dump - -try: - from yaml import CLoader as Loader, CDumper as Dumper -except ImportError: - from yaml import Loader, Dumper from urllib.request import urlopen @@ -30,11 +41,25 @@ file.close() Sources=load( s, Loader=Loader )['sources'] -for source in Sources: + +file = open( pullfile ,'r') +s=file.read() +file.close() + +Pulls=load( s, Loader=Loader ) + + +for source in Pulls: + + if not source in Sources: + continue G=source.split('/') gituser=G[-2] gitrepo=G[-1] + git_=G[-3] + git_=git_.replace('.','_') + giturl='/'.join(G[0:-2]) contents = urlopen( source + '/raw/master/index.yml' ).read() @@ -54,7 +79,11 @@ for source in Sources: file.write('longitude: '+str( O['longitude'] )+'\n' ) file.write('country-code: '+ O['country-code'] +'\n' ) file.write(contents.decode("utf-8")) + file.write('categories: \n') + file.write('- '+ git_ +'\n' ) + file.write('- '+ gituser +'\n' ) + file.write('- '+ gitrepo +'\n' ) file.write('\n---') file.close() - print( contents ) +# os.remove(pullfile) diff --git a/script/get_prices.py b/script/get_prices.py index 96466017ed6a5138d8a7174dccaebfcfdd35a59b..3330685d8ec8aad6d8f548165906e07914166ad7 100644 --- a/script/get_prices.py +++ b/script/get_prices.py @@ -4,10 +4,24 @@ import sys from urllib.request import urlopen, Request import datetime +from yaml import load, dump + +try: + from yaml import CLoader as Loader, CDumper as Dumper +except ImportError: + from yaml import Loader, Dumper + + +file = open('../_config.yml','r') +s=file.read() +file.close() + +Config=load( s, Loader=Loader ) + Date=datetime.datetime.now().strftime('%Y-%m-%d') -file = open('../_site/price-sources.json','r') +file = open('../'+Config['destination']+'/price-sources.json','r') j=file.read() file.close()