From 4a4e911cc0e19d8d777d94d9bb97c78f9ef67ee7 Mon Sep 17 00:00:00 2001 From: dan Date: Sun, 12 Dec 2021 11:11:57 +1300 Subject: [PATCH] (Grav GitSync) Automatic Commit from dan --- .../item.en.md | 1 + plugins/frontend-edit-button/CHANGELOG.md | 127 +++++++ plugins/frontend-edit-button/LICENSE | 21 ++ plugins/frontend-edit-button/README.md | 150 +++++++++ .../assets/css-compiled/style.css | 41 +++ .../assets/css-compiled/style.css.map | 7 + .../frontend-edit-button/assets/css/style.css | 41 +++ .../assets/css/style.css.map | 7 + .../assets/css/style.min.css | 1 + .../assets/fonts/frontend-edit-button.eot | Bin 0 -> 2072 bytes .../assets/fonts/frontend-edit-button.svg | 12 + .../assets/fonts/frontend-edit-button.ttf | Bin 0 -> 1848 bytes .../assets/fonts/frontend-edit-button.woff | Bin 0 -> 1340 bytes .../assets/icons-reference.html | 56 ++++ .../frontend-edit-button/assets/js/script.js | 19 ++ plugins/frontend-edit-button/assets/sass.cmd | 2 + .../assets/scss/style.scss | 55 ++++ .../frontend-edit-button/assets/styles.css | 46 +++ plugins/frontend-edit-button/blueprints.yaml | 80 +++++ .../frontend-edit-button.php | 309 ++++++++++++++++++ .../frontend-edit-button.yaml | 5 + plugins/frontend-edit-button/js/script.js | 19 ++ plugins/frontend-edit-button/languages.yaml | 142 ++++++++ plugins/frontend-edit-button/scss.sh | 2 + plugins/frontend-edit-button/scss/style.scss | 55 ++++ .../templates/partials/edit-button.html.twig | 21 ++ 26 files changed, 1219 insertions(+) create mode 100644 plugins/frontend-edit-button/CHANGELOG.md create mode 100644 plugins/frontend-edit-button/LICENSE create mode 100644 plugins/frontend-edit-button/README.md create mode 100644 plugins/frontend-edit-button/assets/css-compiled/style.css create mode 100644 plugins/frontend-edit-button/assets/css-compiled/style.css.map create mode 100644 plugins/frontend-edit-button/assets/css/style.css create mode 100644 plugins/frontend-edit-button/assets/css/style.css.map create mode 100644 plugins/frontend-edit-button/assets/css/style.min.css create mode 100644 plugins/frontend-edit-button/assets/fonts/frontend-edit-button.eot create mode 100644 plugins/frontend-edit-button/assets/fonts/frontend-edit-button.svg create mode 100644 plugins/frontend-edit-button/assets/fonts/frontend-edit-button.ttf create mode 100644 plugins/frontend-edit-button/assets/fonts/frontend-edit-button.woff create mode 100644 plugins/frontend-edit-button/assets/icons-reference.html create mode 100644 plugins/frontend-edit-button/assets/js/script.js create mode 100644 plugins/frontend-edit-button/assets/sass.cmd create mode 100644 plugins/frontend-edit-button/assets/scss/style.scss create mode 100644 plugins/frontend-edit-button/assets/styles.css create mode 100644 plugins/frontend-edit-button/blueprints.yaml create mode 100644 plugins/frontend-edit-button/frontend-edit-button.php create mode 100644 plugins/frontend-edit-button/frontend-edit-button.yaml create mode 100644 plugins/frontend-edit-button/js/script.js create mode 100644 plugins/frontend-edit-button/languages.yaml create mode 100644 plugins/frontend-edit-button/scss.sh create mode 100644 plugins/frontend-edit-button/scss/style.scss create mode 100644 plugins/frontend-edit-button/templates/partials/edit-button.html.twig diff --git a/pages/01.blog/our-news-blog-is-online-with-grav/item.en.md b/pages/01.blog/our-news-blog-is-online-with-grav/item.en.md index 5659d6e..f5f77a5 100644 --- a/pages/01.blog/our-news-blog-is-online-with-grav/item.en.md +++ b/pages/01.blog/our-news-blog-is-online-with-grav/item.en.md @@ -5,6 +5,7 @@ taxonomy: - news tag: - 'TECH SAVIOURS' + - GRAV media_order: 'ts&grav.png' aura: author: dan diff --git a/plugins/frontend-edit-button/CHANGELOG.md b/plugins/frontend-edit-button/CHANGELOG.md new file mode 100644 index 0000000..e10bf3b --- /dev/null +++ b/plugins/frontend-edit-button/CHANGELOG.md @@ -0,0 +1,127 @@ +# v1.2.3 +## 12-05-2021 + +1. [](#modification) + * [solved] Portugese translation added + +# v1.2.2 +## 14-01-2019 + +1. [](#bug) + * [solved] Problem with assets organization solved, button sometimes didn't show properly + +# v1.2.1 +## 28-10-2018 + +1. [](#bug) + * [solved] Button was not removed, even when admin cookie did not exist (anymore) + +# v1.2 +## 25-10-2018 + +1. [](#modification) + * Restructuring of the assets folder and combined sass/css. + * Corrected bug where button was only shown after doing a page refresh + +# v1.0.12.1 +## 19-10-2018 + +1. [](#bugfix) + * Corrected the check if admin is logged on. In the former version the button was not on shown when not logged in. + * Version 1.12 (former version) is not working with release 1.5 and later of Grav CMS. + +# v1.0.12 +## 22-07-2018 + +1. [](#bugfix) + * Corrected that the button still was showing sometimes, even after the admin was logged out. (Paul Hibbits, thanks for noticing) + +# v1.0.11 +## 16-07-2018 + +1. [](#bugfix) + * Corrected that page kept on refreshing, even after logged out. Now it refreshes 1 time after logging out to remove the button and the JavaScript to reload the page. + +# v1.0.10 +## 13-07-2018 + +1. [](#bugfix) + * Button is not displayed anymore when admin has logged out, button disappears after refresh (when clicking the tab with the page) + + +# v1.0.9 +## 02-06-2018 + +1. [](#feature) + * Automatic update of the contents in other tabs is now optional + +# v1.0.8 +## 23-03-2018 + +1. [](#feature) + * Button icon is now an independent font for this plugin +2. [](#new) + * New language Croatian + + +# v1.0.7 +## 16-03-2018 + +1. [](#feature) + * Optional, if user has to be logged in before showing the button + +# v1.0.6 +## 15-03-2018 + +1. [](#bugfix) + * Fix for incorrect edit button href +2. [](#new) + * New language Spanish and Catalunian + +# v1.0.5 +## 27-01-2018 + +1. [](#bugfix) + * Solved problem of multilanguage URL redirecting to wrong corresponding URL in backend + +2. [](#bugfix) + * Updated README.md content + +# v1.0.4 +## 16-12-2017 + +1. [](#bugfix) + * Solved the hardcoded '/admin' in relocate URL in case the admin route has been modified to something other than '/admin' + +2. [](#bugfix) + * Updated README.md content + +3. [](#bugfix) + * Renamed some files + +# v1.0.3 +## 14-10-2017 + +1. [](#bugfix) + * Solved problem when Grav is installed in sub folder + +# v1.0.2 +## 01-11-2017 + +1. [](#bugfix) + * Solved issue when Grav is installed in sub folder + + +# v1.0.1 +## 04-08-2017 + +1. [](#bugfix) + * Problem solved with `NULL` on the `header()` function + in the `onOutputGenerated` event + + +# v1.0.0 +## 04-03-2017 + +1. [](#new) + * Initial version committed to Github diff --git a/plugins/frontend-edit-button/LICENSE b/plugins/frontend-edit-button/LICENSE new file mode 100644 index 0000000..46d27f7 --- /dev/null +++ b/plugins/frontend-edit-button/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2017 Johan van de Merwe + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/plugins/frontend-edit-button/README.md b/plugins/frontend-edit-button/README.md new file mode 100644 index 0000000..b3ad158 --- /dev/null +++ b/plugins/frontend-edit-button/README.md @@ -0,0 +1,150 @@ +# Frontend Edit Button Plugin + +The **Frontpage Edit Button** Plugin is for [Grav CMS](http://github.com/getgrav/grav). + +This plugin adds an 'edit this page' button on the frontend pages when logged in with a user account with +admin rights. After clicking the button it will open the Admin Dashboard in another tab in your browser where you can start editing the page. + +IMPORTANT (1): If no user is logged in as administrator (superuser), the button will show up only when this is explicitely set this in the plugin settings! By default a user has to be logged in to see the button. + +IMPORTANT (2): You can't login from this plugin itself. You have to login by using the login to enter the Administrator Dashboard. When not logged in, the login dialog will be shown from GRAV CMS. + +It will also work when you have an admin dashboard open in another tab of your browser. The moment you are logged in and are able to edit pages, the button will show up on the frontend pages. The moment you logout you are not able to edit any pages that are at that time displayed. The automatic refresh will prevent this. + +## Requirements + +This plugin requires that you have the following plugins installed and enabled: + +* admin +* login + +## Installation + +Installing the _Frontend Edit Button plugin_ can be done in different ways. The GPM (Grav Package Manager) installation method enables you to quickly and easily install the plugin with a simple terminal command, while the manual method enables you to do so via a zip file. + +### GPM Installation (Preferred) ** + +The simplest way to install this plugin is via the [Grav Package Manager (GPM)](http://learn.getgrav.org/advanced/grav-gpm) through your system's terminal (also called the command line). From the root of your Grav install type: + + bin/gpm install frontend-edit-button + +This will install the Frontpage Edit Button plugin into your `/user/plugins` directory within Grav. Its files can be found under `/your/site/grav/user/plugins/grav-frontend-edit-button`. + +### Git clone ### + +In the user/plugins folder of your site: +``` +git clone https://github.com/enovision/grav-frontend-edit-button +``` + +### Manual Installation + +To install this plugin, download the zip version of this repository and unzip it under `/your/site/grav/user/plugins`. Then, rename the folder to `grav-frontend-edit-button`. You can find these files on [GitHub](https://github.com/johan-van-de-merwe/grav-plugin-frontend-edit-button) or via [GetGrav.org](http://getgrav.org/downloads/plugins#extras). + +You should now have all the plugin files under + + /your/site/grav/user/plugins/grav-frontend-edit-button + +> NOTE: This plugin is a modular component for Grav which requires [Grav](http://github.com/getgrav/grav) and the [Error](https://github.com/getgrav/grav-plugin-error) and [Problems](https://github.com/getgrav/grav-plugin-problems) to operate. + +## Configuration + +Before configuring this plugin, you should copy the `user/plugins/grav-frontend-edit-button/grav-frontend-edit-button.yaml` to `user/config/plugins/grav-frontend-edit-button.yaml` and only edit that copy. + +Here is the default configuration and an explanation of available options: + +```yaml +enabled: true +``` + +Position of the button +The following options are available: +* (tr) Top right (default) +* (tl) Top left +* (br) Bottom right +* (bl) Bottom left + +```yaml +position: tr +``` + +Show the label on the button +```yaml +showLabel: true +``` + +Show icon (requires Fontawesome to be loaded, it works when you install the plugin `Markdown Font Awesome`) +```yaml +showIcon: true +``` + +IMPORTANT: +_When both_ `showLabel` _and_ `showIcon` _are disabled, it will use internally_ `showLabel = true` _automatically_. + +Only visible after login +```yaml +requiresAuth: true +``` + +## Usage + +When the plugin is enabled there is nothing else to do, it will show the button on the frontend pages. + +It is possible however to switch the frontend editing off per page by adding the following to the header of a page (frontmatter): + +```yaml +protectEdit: true +``` + +### Refreshing +This plugin has a simple mechanism build in that will react on a `blur` and `focus` of the browser tab involved. +The moment you click the button it will open the Dashboard in another tab in the browser. The moment you click back +on the page you have just left by clicking on the button, this page will automatically refresh. + +This refresh will always execute when you leave (blur) the tab and click back (focus) on the tab with the presented page. + +### CSS and JavaScript + +The required CSS and JavaScript will only be loaded if the plugin meets the requirements for executing. + +#### CSS + +You can change the styling of the button by modifying the `style.scss` file in the `scss` folder. +It is required that the following CSS tags stay intact: + +```css +#frontend-edit-button { + position: fixed; + z-index: 10000; + padding: 5px; +} + +#frontend-edit-button.top { + top: 0; +} + +#frontend-edit-button.bottom { + bottom: 0; +} + +#frontend-edit-button.left { + left: 0; +} + +#frontend-edit-button.right { + right: 0; +} +``` + +You can compile the SASS by entering in the root of /assets folder of this plugin +`./sass.cmd`. It is required that you have the compiler installed. + +## i18n + +There is a languages file available for multilanguage support + +## Credits + +* The amazing GRAV CMS Team for building such an amazing CMS. +* [Nick Bell]() for correcting some path mistakes +* [Christian Bewernitz](https://github.com/newmedicine) for adding the login requirement option (version 1.0.7) diff --git a/plugins/frontend-edit-button/assets/css-compiled/style.css b/plugins/frontend-edit-button/assets/css-compiled/style.css new file mode 100644 index 0000000..2c80525 --- /dev/null +++ b/plugins/frontend-edit-button/assets/css-compiled/style.css @@ -0,0 +1,41 @@ +#frontend-edit-button { + position: fixed; + z-index: 10000; + padding: 5px; } + +#frontend-edit-button .label { + font-size: 16px; } + +#frontend-edit-button.top { + top: 0; } + +#frontend-edit-button.bottom { + bottom: 0; } + +#frontend-edit-button.left { + left: 0; } + +#frontend-edit-button.right { + right: 0; } + +.frontend-edit-button { + background-color: #0090D9; + border: 1px solid #0090D9; + border-radius: 5px; + color: rgba(255, 255, 255, 0.85); + padding: 5px 5px; + text-align: center; + text-decoration: none; + display: inline-block; + font-size: 16px; + margin: 4px 2px; + cursor: pointer; } + +.frontend-edit-button:hover { + background: #26a1df; + color: #fff; } + +.icon-feb-editor:before { + padding-right: 5px; } + +/*# sourceMappingURL=style.css.map */ diff --git a/plugins/frontend-edit-button/assets/css-compiled/style.css.map b/plugins/frontend-edit-button/assets/css-compiled/style.css.map new file mode 100644 index 0000000..c7988c0 --- /dev/null +++ b/plugins/frontend-edit-button/assets/css-compiled/style.css.map @@ -0,0 +1,7 @@ +{ +"version": 3, +"mappings": "AAOA,qBAAsB;EACpB,QAAQ,EAAE,KAAK;EACf,OAAO,EAAE,KAAK;EACd,OAAO,EAAE,GAAG;;AAGd,4BAA6B;EACzB,SAAS,EAAE,IAAI;;AAGnB,yBAA0B;EACxB,GAAG,EAAE,CAAC;;AAGR,4BAA6B;EAC3B,MAAM,EAAE,CAAC;;AAGX,0BAA2B;EACzB,IAAI,EAAE,CAAC;;AAGT,2BAA4B;EAC1B,KAAK,EAAE,CAAC;;AAGV,qBAAsB;EACpB,gBAAgB,EA9BI,OAAgB;EA+BpC,MAAM,EAAE,iBAA8B;EACtC,aAAa,EAAE,GAAG;EAClB,KAAK,EAhCc,yBAAa;EAiChC,OAAO,EAAE,OAAO;EAChB,UAAU,EAAE,MAAM;EAClB,eAAe,EAAE,IAAI;EACrB,OAAO,EAAE,YAAY;EACrB,SAAS,EAAE,IAAI;EACf,MAAM,EAAE,OAAO;EACf,MAAM,EAAE,OAAO;;AAGjB,2BAA4B;EACxB,UAAU,EA7CU,OAAO;EA8C3B,KAAK,EAhDY,IAAI;;AAmDzB,uBAAwB;EACnB,aAAa,EAAE,GAAG", +"sources": ["../../scss/style.scss"], +"names": [], +"file": "style.css" +} \ No newline at end of file diff --git a/plugins/frontend-edit-button/assets/css/style.css b/plugins/frontend-edit-button/assets/css/style.css new file mode 100644 index 0000000..2c80525 --- /dev/null +++ b/plugins/frontend-edit-button/assets/css/style.css @@ -0,0 +1,41 @@ +#frontend-edit-button { + position: fixed; + z-index: 10000; + padding: 5px; } + +#frontend-edit-button .label { + font-size: 16px; } + +#frontend-edit-button.top { + top: 0; } + +#frontend-edit-button.bottom { + bottom: 0; } + +#frontend-edit-button.left { + left: 0; } + +#frontend-edit-button.right { + right: 0; } + +.frontend-edit-button { + background-color: #0090D9; + border: 1px solid #0090D9; + border-radius: 5px; + color: rgba(255, 255, 255, 0.85); + padding: 5px 5px; + text-align: center; + text-decoration: none; + display: inline-block; + font-size: 16px; + margin: 4px 2px; + cursor: pointer; } + +.frontend-edit-button:hover { + background: #26a1df; + color: #fff; } + +.icon-feb-editor:before { + padding-right: 5px; } + +/*# sourceMappingURL=style.css.map */ diff --git a/plugins/frontend-edit-button/assets/css/style.css.map b/plugins/frontend-edit-button/assets/css/style.css.map new file mode 100644 index 0000000..b570a54 --- /dev/null +++ b/plugins/frontend-edit-button/assets/css/style.css.map @@ -0,0 +1,7 @@ +{ +"version": 3, +"mappings": "AAOA,qBAAsB;EACpB,QAAQ,EAAE,KAAK;EACf,OAAO,EAAE,KAAK;EACd,OAAO,EAAE,GAAG;;AAGd,4BAA6B;EACzB,SAAS,EAAE,IAAI;;AAGnB,yBAA0B;EACxB,GAAG,EAAE,CAAC;;AAGR,4BAA6B;EAC3B,MAAM,EAAE,CAAC;;AAGX,0BAA2B;EACzB,IAAI,EAAE,CAAC;;AAGT,2BAA4B;EAC1B,KAAK,EAAE,CAAC;;AAGV,qBAAsB;EACpB,gBAAgB,EA9BI,OAAgB;EA+BpC,MAAM,EAAE,iBAA8B;EACtC,aAAa,EAAE,GAAG;EAClB,KAAK,EAhCc,yBAAa;EAiChC,OAAO,EAAE,OAAO;EAChB,UAAU,EAAE,MAAM;EAClB,eAAe,EAAE,IAAI;EACrB,OAAO,EAAE,YAAY;EACrB,SAAS,EAAE,IAAI;EACf,MAAM,EAAE,OAAO;EACf,MAAM,EAAE,OAAO;;AAGjB,2BAA4B;EACxB,UAAU,EA7CU,OAAO;EA8C3B,KAAK,EAhDY,IAAI;;AAmDzB,uBAAwB;EACnB,aAAa,EAAE,GAAG", +"sources": ["../scss/style.scss"], +"names": [], +"file": "style.css" +} \ No newline at end of file diff --git a/plugins/frontend-edit-button/assets/css/style.min.css b/plugins/frontend-edit-button/assets/css/style.min.css new file mode 100644 index 0000000..fb65805 --- /dev/null +++ b/plugins/frontend-edit-button/assets/css/style.min.css @@ -0,0 +1 @@ +#frontend-edit-button{position:fixed;z-index:10000;padding:5px}#frontend-edit-button .label{font-size:16px}#frontend-edit-button.top{top:0}#frontend-edit-button.bottom{bottom:0}#frontend-edit-button.left{left:0}#frontend-edit-button.right{right:0}.frontend-edit-button{background-color:#0090d9;border:1px solid #0090d9;border-radius:5px;color:rgba(255,255,255,0.85);padding:5px 5px;text-align:center;text-decoration:none;display:inline-block;font-size:16px;margin:4px 2px;cursor:pointer}.frontend-edit-button:hover{background:#26a1df;color:#fff}.icon-feb-editor:before{padding-right:5px} \ No newline at end of file diff --git a/plugins/frontend-edit-button/assets/fonts/frontend-edit-button.eot b/plugins/frontend-edit-button/assets/fonts/frontend-edit-button.eot new file mode 100644 index 0000000000000000000000000000000000000000..e332f75333531f24caa8304b6580cc5666982ab7 GIT binary patch literal 2072 zcmd5-O>7%Q6n=02yjjPaC|=vaF|cvtBqFur*sT+lRxX4(DoSW@P#RDraAG@&NNme- z(pKV7i5xkU9yqiTLU6Bo=m~M?0VFCANTBu-4!r=U<^tt}V!m0gQ78cgxG?g}eD8PO z_`QA8s}oIlh?pc2Ln5`q0pMI^fu?7jt;KZKHoa{v+}+1^;V_k{PF1Q~*O%8W zm(TwY`kqK0fc(NrsZcb(dF>0xzQfF{fT8G;3Yi6ZU}e2=Ns9py-@?+fR$VGkjc&re z7j)-(;ZlvJ>1D_#K--nVdTFZ9_?Sq!g3Kgp)s4o(w|sBnd}05*b2r@Y?t-=bde_NE zTZhR9zVfJwDft;@gz*zLvc7Ny+nu}LnyMtJ1s~ImWZ!H zs`E6LK~K5+BYJ|i_t%lo6$b4wTRu~y(^Q~3KWILn1n)FOEUr!~qSk>9cK$E%pF1<+ z>P>?Z779+M_LO)Bk2y9ybyf_+JiD zeL1+yFqSlS3j2T$>_%(I*d1w$4DLxbRXv?tjL zf;panG|QP#a46(Cay;f48qcItPjfI}?e!n+k6bg9qN1zCP%^q3O=9tzD$Ay-81in9 z=?nXJ{XSFj%O15ae<#n`zI@m)y!ui7X8%Zkci-oRT2ytV_`$ei98G#8MNv(eCDRAf zu+Qunkd+=)mcN?2Gj~0l59|5}9H2&G6ytk*58t|l`b15+xAPx662&zFRyu{aTT$a) z?YQ3wPljW+J(6@o(iFZSbzj`w;#)>?Yt-oO@=h9OA%7~y9Udsinsi;6xcG4E+iqiY zD`^;$-d4gp={>jL7^gquVu`$T-o-L%_%jzPWU=jHmApLTVnohwi>g;Tz!`??7M9RN zvo4nD4O()s0-ax6tWuDVyI7-Pe)aGzx?HbT8l_4xUMj9O;)|P&MzunJ)wTbilXKqy zvDaxCHa42A=;1bwoG{_tx%T?>kB|DW!+9<LIpdOj;G_P z nmR8rCqGR+xG-zNGv)ADXTE@4)nC){M|6iW^@N1#5|K0cv;2Iq4 literal 0 HcmV?d00001 diff --git a/plugins/frontend-edit-button/assets/fonts/frontend-edit-button.svg b/plugins/frontend-edit-button/assets/fonts/frontend-edit-button.svg new file mode 100644 index 0000000..85127d4 --- /dev/null +++ b/plugins/frontend-edit-button/assets/fonts/frontend-edit-button.svg @@ -0,0 +1,12 @@ + + + +Generated by Fontastic.me + + + + + + + + diff --git a/plugins/frontend-edit-button/assets/fonts/frontend-edit-button.ttf b/plugins/frontend-edit-button/assets/fonts/frontend-edit-button.ttf new file mode 100644 index 0000000000000000000000000000000000000000..2e4c134db0af41c89022906abe402ddc32441b7e GIT binary patch literal 1848 zcmd5-J#1T56#mZp^UHJWM2TY;CxDa2NkwYMv0JAqty~CoRFu$?ptPV$;KX(kk=T~w zq^-nIiH;1=fuWTUg1zd%gcv%21OkBsYL_r{0j6ewGNG97K0lXGQK^E3E1i44^Lx*^ z_q_Wc00OuS9cS|SS7tB$`q>A7Z-CN)=@(Ask%k3We~^!zo*z%2zH|O6Am_+0EUg!6 z`lj(B`Oisn%Y}_vv&l%Xexu%AUb|F2`*Y+cKp&?5{7R`%41WLG*VO$;%C1mg*qTXQ zi2U%%dgG!MCxYDM)U#GyDxiiN^xsFmbG>k}h8es}{Sor9N@2Y;-S2z~7?%MpS*va| z?!6Uwllv?G=b>sNeRVE$<@K&(_u95V0O56uI&RvaHf2+h!ZHFE_a)E zk(BMG%1+h7(N0mVE_TmLow-W`p4|*NKK=Iq=tu@A2;7?M^|FueS4d! zBL3P^Db;8zTim~!jfdS-0sqUP`cK{QDYr{31aS<{VHU{AsIM>6mmTR6E1Z)^U&tDh zp^@WqDEq9WBjHGhiqR3ueAbf^3R5_lr8XzoNO&~j+kZIj8=cH%(oajcFSI*&aB$$N zV-yYBEJjj8J3}c>y+Kp-plLYzPERlp?cM1O1hrn>XZFwCnv-1rT-0&=_Cfo`;Miby z|Cf$gG;O2!;iT(4l=5kYVFq>4f&scl1HqnQ-RLoO{oDCl^VgztQQID40QN{6ak(wG z`K^c8pX@2Gy52+khge2mD3fO1t*lvBJMVX*Q_=V*K25u>S%zHKx-aZ($xSD(e;(f2Dgu6fEVGVwq^{~z!{=&ls zLK5?^3BSyGn3>Dls_TsoN)9k|3u_1?=V2XhV9CPx{`G(T6+G3l4wW=@FLf^w< zSMYwgvTMIpgh`3`3+?@v0~h0x&-GhLVwCB8$;xuy_zwunr0n?1n_b~L&gIeJil<|# zPj|l8FK#^_u#Wdgl5#7eqS!IFPW6lG$+UOt-pajaFL>D=w;kH;^H!Wh8?&*c?4pOH z*bk)^wi4gO=b7h~Q?HGzald_$BXQ5ZJ=Cp?bD8tV4TwtwBWtfDBPce65Qv(4S;`Z<+*;9C1-MaF|MvLl7Ax!YsD7cIdEnUoa+MS#Jys3&a;{BeVI&m6x+kVYKHoKixOEuHY|1_RvQJTiH zZHpPq=bbrLk+JoV9nQK+$3(OZ^H+7IP7kxJ_g#Oqu38wt>OZyI$)+yRsiAvtx8EMh z-K%L+-)U~8DRERcwoC^=Q5uC|m>8tHHss#Vn22pmDeI5`ew%UUKYL;f8%85dNS0V6 zM)bD4M|i=2&kF-rh7>MLC^F%PFuZ1@NnFy9djABFG{0RA-q zUTv+Q+M=Gls zVa%Nu=&hn(o!nS2S$GZQq361 literal 0 HcmV?d00001 diff --git a/plugins/frontend-edit-button/assets/icons-reference.html b/plugins/frontend-edit-button/assets/icons-reference.html new file mode 100644 index 0000000..1b9d260 --- /dev/null +++ b/plugins/frontend-edit-button/assets/icons-reference.html @@ -0,0 +1,56 @@ + + + + + + + Font Reference - frontend-edit-button + + + + + +
+

frontend-edit-button

+

This font was created withFontastic

+

CSS mapping

+
    +
  • +
    + +
  • +
  • +
    + +
  • +
+

Character mapping

+
    +
  • +
    + +
  • +
  • +
    + +
  • +
+
+ + + \ No newline at end of file diff --git a/plugins/frontend-edit-button/assets/js/script.js b/plugins/frontend-edit-button/assets/js/script.js new file mode 100644 index 0000000..790d0cd --- /dev/null +++ b/plugins/frontend-edit-button/assets/js/script.js @@ -0,0 +1,19 @@ +var frontEditButton_refreshMe = false; + +function onBlur () { + frontEditButton_refreshMe = true; +} +function onFocus () { + if (frontEditButton_refreshMe) { + window.location.reload(true); + } +} + +// check for Internet Explorer +if (/*@cc_on!@*/false) { + document.onfocusin = onFocus; + document.onfocusout = onBlur; +} else { + window.onfocus = onFocus; + window.onblur = onBlur; +} diff --git a/plugins/frontend-edit-button/assets/sass.cmd b/plugins/frontend-edit-button/assets/sass.cmd new file mode 100644 index 0000000..821f8d7 --- /dev/null +++ b/plugins/frontend-edit-button/assets/sass.cmd @@ -0,0 +1,2 @@ +#!/bin/sh +scss --watch --sourcemap=auto scss:css \ No newline at end of file diff --git a/plugins/frontend-edit-button/assets/scss/style.scss b/plugins/frontend-edit-button/assets/scss/style.scss new file mode 100644 index 0000000..f8fc36e --- /dev/null +++ b/plugins/frontend-edit-button/assets/scss/style.scss @@ -0,0 +1,55 @@ +$button-color: rgba(255,255,255,0.85); +$button-color-hover: #fff; +$button-bg-color: #0090D9; +$button-bg-color-hover: #26a1df; +$button-border-color: $button-bg-color; +$button-label-color: $button-color; + +#frontend-edit-button { + position: fixed; + z-index: 10000; + padding: 5px; +} + +#frontend-edit-button .label { + font-size: 16px; +} + +#frontend-edit-button.top { + top: 0; +} + +#frontend-edit-button.bottom { + bottom: 0; +} + +#frontend-edit-button.left { + left: 0; +} + +#frontend-edit-button.right { + right: 0; +} + +.frontend-edit-button { + background-color: $button-bg-color; + border: 1px solid $button-border-color; + border-radius: 5px; + color: $button-color; + padding: 5px 5px; + text-align: center; + text-decoration: none; + display: inline-block; + font-size: 16px; + margin: 4px 2px; + cursor: pointer; +} + +.frontend-edit-button:hover { + background: $button-bg-color-hover; + color: $button-color-hover; +} + +.icon-feb-editor:before { + padding-right: 5px; +} \ No newline at end of file diff --git a/plugins/frontend-edit-button/assets/styles.css b/plugins/frontend-edit-button/assets/styles.css new file mode 100644 index 0000000..d7c508d --- /dev/null +++ b/plugins/frontend-edit-button/assets/styles.css @@ -0,0 +1,46 @@ +@charset "UTF-8"; + +@font-face { + font-family: "frontend-edit-button"; + src:url("fonts/frontend-edit-button.eot"); + src:url("fonts/frontend-edit-button.eot?#iefix") format("embedded-opentype"), + url("fonts/frontend-edit-button.woff") format("woff"), + url("fonts/frontend-edit-button.ttf") format("truetype"), + url("fonts/frontend-edit-button.svg#frontend-edit-button") format("svg"); + font-weight: normal; + font-style: normal; + +} + +[data-icon]:before { + font-family: "frontend-edit-button" !important; + content: attr(data-icon); + font-style: normal !important; + font-weight: normal !important; + font-variant: normal !important; + text-transform: none !important; + speak: none; + line-height: 1; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; +} + +[class^="icon-"]:before, +[class*=" icon-"]:before { + font-family: "frontend-edit-button" !important; + font-style: normal !important; + font-weight: normal !important; + font-variant: normal !important; + text-transform: none !important; + speak: none; + line-height: 1; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; +} + +.icon-feb-editor:before { + content: "\72"; +} +.icon-feb-pencil:before { + content: "\61"; +} diff --git a/plugins/frontend-edit-button/blueprints.yaml b/plugins/frontend-edit-button/blueprints.yaml new file mode 100644 index 0000000..6374a2f --- /dev/null +++ b/plugins/frontend-edit-button/blueprints.yaml @@ -0,0 +1,80 @@ +name: Frontend Edit Button +version: 1.2.2 +description: Adds an 'edit this page' on the frontend when logged in as administrator +icon: newspaper-o +author: + name: Johan van de Merwe + email: j.vd.merwe@enovision.net + url: https://github.com/enovision +homepage: https://github.com/enovision/grav-frontend-edit-button +keywords: grav, plugin, frontend +bugs: https://github.com/enovision/grav-frontend-edit-button/issues +docs: https://github.com/enovision/grav-frontend-edit-button/blob/master/README.md +license: MIT + +form: + validation: strict + fields: + enabled: + type: toggle + label: Plugin status + highlight: 1 + default: 0 + options: + 1: PLUGIN_FRONTEND_EDIT_BUTTON.ENABLED + 0: PLUGIN_FRONTEND_EDIT_BUTTON.DISABLED + validate: + type: bool + position: + type: select + label: PLUGIN_FRONTEND_EDIT_BUTTON.POSITION_LABEL + help: PLUGIN_FRONTEND_EDIT_BUTTON.POSITION_LABEL_HELP + size: medium + highlight: tr + options: + tl: PLUGIN_FRONTEND_EDIT_BUTTON.TOP_LEFT + tr: PLUGIN_FRONTEND_EDIT_BUTTON.TOP_RIGHT + bl: PLUGIN_FRONTEND_EDIT_BUTTON.BOTTOM_LEFT + br: PLUGIN_FRONTEND_EDIT_BUTTON.BOTTOM_RIGHT + showLabel: + type: toggle + label: PLUGIN_FRONTEND_EDIT_BUTTON.SHOW_LABEL + highlight: 1 + default: 0 + options: + 1: PLUGIN_FRONTEND_EDIT_BUTTON.ENABLED + 0: PLUGIN_FRONTEND_EDIT_BUTTON.DISABLED + validate: + type: bool + showIcon: + type: toggle + label: PLUGIN_FRONTEND_EDIT_BUTTON.SHOW_ICON + highlight: 1 + default: 0 + options: + 1: PLUGIN_FRONTEND_EDIT_BUTTON.ENABLED + 0: PLUGIN_FRONTEND_EDIT_BUTTON.DISABLED + validate: + type: bool + requiresAuth: + type: toggle + label: PLUGIN_FRONTEND_EDIT_BUTTON.REQUIRES_AUTH_LABEL + help: PLUGIN_FRONTEND_EDIT_BUTTON.REQUIRES_AUTH_LABEL_HELP + highlight: 1 + default: 1 + options: + 1: PLUGIN_FRONTEND_EDIT_BUTTON.ENABLED + 0: PLUGIN_FRONTEND_EDIT_BUTTON.DISABLED + validate: + type: bool + autoRefresh: + type: toggle + label: PLUGIN_FRONTEND_EDIT_BUTTON.AUTO_REFRESH_LABEL + help: PLUGIN_FRONTEND_EDIT_BUTTON.AUTO_REFRESH_LABEL_HELP + highlight: 1 + default: 1 + options: + 1: PLUGIN_FRONTEND_EDIT_BUTTON.ENABLED + 0: PLUGIN_FRONTEND_EDIT_BUTTON.DISABLED + validate: + type: bool diff --git a/plugins/frontend-edit-button/frontend-edit-button.php b/plugins/frontend-edit-button/frontend-edit-button.php new file mode 100644 index 0000000..1a8c0ba --- /dev/null +++ b/plugins/frontend-edit-button/frontend-edit-button.php @@ -0,0 +1,309 @@ + ['onPluginsInitialized', 0] + ]; + } + + /** + * @event onPluginsInitialized + * + * It is only allowed to process when: + * - we are not on an admin page already + * - Admin is logged in in any of the other tabs + * - Login plugin is enabled + * - Admin plugin is enabled + * - This plugin is enabled (but that it is) + * - Page has no frontmatter: protectEdit: true + * + */ + public function onPluginsInitialized() + { + $this->adminCookie = session_name(); + + $this->enable([ + 'onUserLogin' => ['onUserLogin', 0], + 'onUserLogout' => ['onUserLogout', 0] + ]); + + if ($this->isAdmin()) { + return; + } + + $config = $this->grav['config']; + + if ($config->get('plugins.frontend-edit-button.requiresAuth')) { + if (isset($_COOKIE[$this->adminCookie]) === false) { + return; + } + $this->adminCookieSet = true; + } + + /* Stop if no users exist */ + if ($this->doAnyUsersExist() === false) { + return; + } + + $plugins = $config->get('plugins'); + + $adminPlugin = isset($plugins['admin']) ? $this->config->get('plugins.admin') : false; + $loginPlugin = isset($plugins['login']) ? $this->config->get('plugins.login') : false; + + $this->adminRoute = $adminPlugin !== false ? $adminPlugin['route'] : $this->adminRoute; + + // Works only with the login and admin plugin installed and enabled + if ($adminPlugin === false || $loginPlugin === false) { + return; + } else { + if ($adminPlugin['enabled'] === false || $loginPlugin['enabled'] === false) { + return; + } + } + + $this->enable([ + 'onPageContentProcessed' => ['onPageContentProcessed', 0], + 'onTwigSiteVariables' => ['onTwigSiteVariables', 0], + 'onOutputGenerated' => ['onOutputGenerated', 0], + 'onTwigTemplatePaths' => ['onTwigTemplatePaths', 0] + ]); + } + + /** + * check for any users, see admin.php + */ + private function doAnyUsersExist() + { + $account_dir = $file_path = $this->grav['locator']->findResource('account://'); + $user_check = glob($account_dir . '/*.yaml'); + + // If no users found, stop here !!! + return $user_check == false || count((array)$user_check) == 0 ? false : true; + } + + /** + * @event onPageContentProcessed + * + * @param Event $event + */ + public function onPageContentProcessed(Event $event) + { + $page = $event['page']; + $this->_config = $this->mergeConfig($page); + } + + /** + * @event onOutputGenerated + */ + public function onOutputGenerated() + { + if ($this->isAdmin()) { + return; + } + + // frontend !!! + // $this->adminCookie = session_name() . '-admin-authenticated'; // till version 1.12 + $this->adminCookie = session_name() . $this->adminCookieSuffix; // since version 1.12.1 + + $page = $this->grav['page']; + + $header = $page->header(); + + $adminCookie = $this->getAdminCookie(); + + if ((isset($header->protectEdit) && $header->protectEdit == true) || $adminCookie === false) { + return; + } + + $content = $this->grav->output; + + $twig = $this->grav['twig']; + + $position = $this->config->get('plugins.frontend-edit-button.position'); + + $vertical = substr($position, 0, 1) === 't' ? 'top' : 'bottom'; + $horizontal = substr($position, 1, 1) === 'l' ? 'left' : 'right'; + + //$pageUrl = $page->url( false, false, true, false ); + $uri = $this->grav['uri']; + //$pageUrl = $uri->url(false, false); + $pageUrl = $uri->path(); + + /* otherwise the home page can't be edited */ + if ($pageUrl == '/') { + $pageUrl .= $page->slug(); + } + + if (isset($header->editUrl)) { + $editUrl = $header->editUrl; + } else { + $editUrl = $uri->rootUrl(true) . $this->adminRoute . '/pages' . $pageUrl; + } + + $this->editUrl = $editUrl; + + $icon = $uri->base() . '/' . $this->config->get('plugins.frontend-edit-button.iconSrc'); + + $params = array( + 'config' => $this->_config, + 'header' => $header, + 'horizontal' => $horizontal, + 'vertical' => $vertical, + 'pageUrl' => $pageUrl, + 'editUrl' => $editUrl, + 'icon' => $icon, + 'adminCookieSet' => $adminCookie + ); + + $insertThis = $twig->processTemplate('partials/edit-button.html.twig', $params); + + $pos = strpos($content, ' 0) { + + $pos = strpos($content, '>', $pos); + + if ($pos > 0) { + + $str1 = substr($content, 0, $pos + 1); + $str2 = substr($content, $pos + 1); + + $content = $str1 . $insertThis . $str2; + + $this->grav->output = $content; + } + } + } + + private function getAdminCookie() + { + $this->adminCookieSet = false; + + if ($this->config->get('plugins.frontend-edit-button.requiresAuth')) { + if (isset($_COOKIE[$this->adminCookie]) === true) { + $this->adminCookieSet = true; + } + } else { + $this->adminCookieSet = true; + } + + return $this->adminCookieSet; + } + + /** + * @event onTwigSiteVariables + */ + public function onTwigSiteVariables() + { + $page = $this->grav['page']; + $header = $page->header(); + + if (isset($header->protectEdit) && $header->protectEdit == true) { + return; + } + + $this->adminCookie = session_name() . $this->adminCookieSuffix; + $adminCookie = $this->getAdminCookie(); + + $this->grav['assets'] + ->addCss('plugin://frontend-edit-button/assets/css/style.css'); + + if ($this->config->get('plugins.frontend-edit-button.autoRefresh') === true && $adminCookie === true) { + $this->grav['assets'] + ->addJs('plugin://frontend-edit-button/assets/js/script.js'); + } + } + + /** + * @event onTwigTemplatePaths + */ + public function onTwigTemplatePaths() + { + $this->grav['twig']->twig_paths[] = __DIR__ . '/templates'; + } + + /** + * @event onUserLogout + * + * Hook on onUserLogout of the Login plugin + * It should remove the cookie + */ + public function onUserLogout(UserLoginEvent $event) + { + $user = $event->getUser(); + + $params = session_get_cookie_params(); + // $cookieName = session_name() . '-authenticated'; // till version 1.12 + $cookieName = session_name(); // since version 1.12.1 + + setcookie( + $cookieName, + session_id(), + time() - 42000, + $params['path'], + $params['domain'], + $params['secure'], + $params['httponly'] + ); + } + + public function onUserLogin(UserLoginEvent $event) + { + $user = $event->getUser(); + + if ($user->authenticated) { + + $params = session_get_cookie_params(); + // $cookieName = session_name() . '-authenticated'; // till version 1.12 + $cookieName = session_name(); // since version 1.12.1 + + setcookie( + $cookieName, + session_id(), + time() + $params['lifetime'], + $params['path'], + $params['domain'], + $params['secure'], + $params['httponly'] + ); + + } + } + +} diff --git a/plugins/frontend-edit-button/frontend-edit-button.yaml b/plugins/frontend-edit-button/frontend-edit-button.yaml new file mode 100644 index 0000000..a773a00 --- /dev/null +++ b/plugins/frontend-edit-button/frontend-edit-button.yaml @@ -0,0 +1,5 @@ +enabled: true +position: tr +showLabel: true +showIcon: true +iconSrc: user/plugins/frontend-edit-button/images/icons/edit.png \ No newline at end of file diff --git a/plugins/frontend-edit-button/js/script.js b/plugins/frontend-edit-button/js/script.js new file mode 100644 index 0000000..790d0cd --- /dev/null +++ b/plugins/frontend-edit-button/js/script.js @@ -0,0 +1,19 @@ +var frontEditButton_refreshMe = false; + +function onBlur () { + frontEditButton_refreshMe = true; +} +function onFocus () { + if (frontEditButton_refreshMe) { + window.location.reload(true); + } +} + +// check for Internet Explorer +if (/*@cc_on!@*/false) { + document.onfocusin = onFocus; + document.onfocusout = onBlur; +} else { + window.onfocus = onFocus; + window.onblur = onBlur; +} diff --git a/plugins/frontend-edit-button/languages.yaml b/plugins/frontend-edit-button/languages.yaml new file mode 100644 index 0000000..d5431ba --- /dev/null +++ b/plugins/frontend-edit-button/languages.yaml @@ -0,0 +1,142 @@ +en: + PLUGIN_FRONTEND_EDIT_BUTTON: + ENABLED: Enabled + DISABLED: Disabled + POSITION_LABEL: Label Position + POSITION_LABEL_HELP: Where to put the button on the frontend + SHOW_LABEL: Show text on button + SHOW_ICON: Show icon on button + BUTTON_TEXT: Edit this Page + TOP_LEFT: Top Left + TOP_RIGHT: Top Right + BOTTOM_LEFT: Bottom Left + BOTTOM_RIGHT: Bottom Right + REQUIRES_AUTH_LABEL: Only visible after login + REQUIRES_AUTH_LABEL_HELP: If deactivated, the button will always be shown if the required plugins are active. + AUTO_REFRESH_LABEL: Automatic refresh of content + AUTO_REFRESH_LABEL_HELP: If activated, content within pages will automatically refreshed when the tab in the browser is clicked. +de: + PLUGIN_FRONTEND_EDIT_BUTTON: + ENABLED: Aktiviert + DISABLED: Deaktiviert + POSITION_LABEL: Position + POSITION_LABEL_HELP: Wo soll der Button angezeigt werden + SHOW_LABEL: Text auf dem Button anzeigen + SHOW_ICON: Symbol auf dem Button anzeigen + BUTTON_TEXT: Bearbeiten + TOP_LEFT: Linksoben + TOP_RIGHT: Rechtsoben + BOTTOM_LEFT: Linksuntern + BOTTOM_RIGHT: Rechtsuntern + REQUIRES_AUTH_LABEL: Nur anzeigen wen eingeloggt + REQUIRES_AUTH_LABEL_HELP: Wenn deaktiviert, wird der Button immer angezeigt wenn die benötigten Plugins aktiviert sind. + AUTO_REFRESH_LABEL: Automatisch erfrischen von Inhalte + AUTO_REFRESH_LABEL_HELP: Wenn aktiviert, Inhalte auf Seiten werden automatisch erfrischt wenn der Reiter im Browser geklickt wird. + +hr: + PLUGIN_FRONTEND_EDIT_BUTTON: + ENABLED: Omogućen + DISABLED: Onemogućen + POSITION_LABEL: Položaj gumba + POSITION_LABEL_HELP: Gdje da postavim gumb na stranici + SHOW_LABEL: Prikaži text na gumbu + SHOW_ICON: Prikaži ikonu na gumbu + BUTTON_TEXT: Uredi ovu stranicu + TOP_LEFT: Gore Lijevo + TOP_RIGHT: Gore Desno + BOTTOM_LEFT: Dolje Lijevo + BOTTOM_RIGHT: Dolje Desno + REQUIRES_AUTH_LABEL: Vidljiv samo nakon prijave. + REQUIRES_AUTH_LABEL_HELP: Ako je deaktiviran, gumb će uvijek biti prikazan ako su potrebni plugini aktivni. + AUTO_REFRESH_LABEL: Automatic refresh of pages + AUTO_REFRESH_LABEL_HELP: If activated, pages will automatically refreshed when the tab in the browser is clicked. + +nl: + PLUGIN_FRONTEND_EDIT_BUTTON: + ENABLED: Ingeschakeld + DISABLED: Uitgeschakeld + POSITION_LABEL: Positie van de button + POSITION_LABEL_HELP: Waar moet de button worden getoond + SHOW_LABEL: Tonen tekst op de button + SHOW_ICON: Tonen icon op de button + BUTTON_TEXT: Pagina wijzigen + TOP_LEFT: Linksboven + TOP_RIGHT: Rechtsboven + BOTTOM_LEFT: Linksonder + BOTTOM_RIGHT: Rechtsonder + REQUIRES_AUTH_LABEL: Alleen zichtbaar indien ingelogt + REQUIRES_AUTH_LABEL_HELP: Indien inaktief, wordt de button altijd getoond als de plugin aktief is. + AUTO_REFRESH_LABEL: Automatisch updaten van de inhoud + AUTO_REFRESH_LABEL_HELP: Indien aktief, inhoud van pagina's wordt automatisch bijgewerkt indien op de tab in de browser wordt geklikt. + +es: + PLUGIN_FRONTEND_EDIT_BUTTON: + ENABLED: Habilitado + DISABLED: Deshabilitado + POSITION_LABEL: Posición de etiqueta + POSITION_LABEL_HELP: Donde poner el botón en la portada + SHOW_LABEL: Muestra la etiqueta + SHOW_ICON: Muestra el icono en el botón + BUTTON_TEXT: Editar + TOP_LEFT: Arriba a la izquierda + TOP_RIGHT: Arriba a la derecha + BOTTOM_LEFT: Debajo a la izquierda + BOTTOM_RIGHT: Debajo a la derecha + REQUIRES_AUTH_LABEL: Solo visible después del inicio de sesión + REQUIRES_AUTH_LABEL_HELP: Si se desactiva, el botón siempre se mostrará si los complementos necesarios están activos. + AUTO_REFRESH_LABEL: Automatic refresh of content + AUTO_REFRESH_LABEL_HELP: If activated, content within pages will automatically refreshed when the tab in the browser is clicked. + +ca: + PLUGIN_FRONTEND_EDIT_BUTTON: + ENABLED: Habilitat + DISABLED: Deshabilitat + POSITION_LABEL: Posició d'etiqueta + POSITION_LABEL_HELP: On posar el botó a la portada + SHOW_LABEL: Mostra l'etiqueta + SHOW_ICON: Mostra la icona al botó + BUTTON_TEXT: Edita + TOP_LEFT: A dalt a l'esquerra + TOP_RIGHT: A dalt a la dreta + BOTTOM_LEFT: A sota a l'esquerra + BOTTOM_RIGHT: A sota a la dreta + REQUIRES_AUTH_LABEL: Només visible després d'iniciar sessió + REQUIRES_AUTH_LABEL_HELP: Si està desactivat, el botó sempre es mostrarà si els connectors requerits estan actius. + AUTO_REFRESH_LABEL: Automatic refresh of content + AUTO_REFRESH_LABEL_HELP: If activated, content within pages will automatically refreshed when the tab in the browser is clicked. + +fr: + PLUGIN_FRONTEND_EDIT_BUTTON: + ENABLED: Activé + DISABLED: Désactivé + POSITION_LABEL: Position du tag + POSITION_LABEL_HELP: Où mettre le bouton sur la couverture + SHOW_LABEL: Afficher le tag + SHOW_ICON: Afficher l'icône sur le bouton + BUTTON_TEXT: Modifier + TOP_LEFT: En haut à gauche + TOP_RIGHT: En haut à droite + BOTTOM_LEFT: Ci-dessous à gauche + BOTTOM_RIGHT: Ci-dessous à droite + REQUIRES_AUTH_LABEL: Seulement visible après la connexion + REQUIRES_AUTH_LABEL_HELP: Si désactivé, le bouton sera toujours affiché si les plugins requis sont actifs. + AUTO_REFRESH_LABEL: Automatic refresh of content + AUTO_REFRESH_LABEL_HELP: If activated, content within pages will automatically refreshed when the tab in the browser is clicked. + +pt: + PLUGIN_FRONTEND_EDIT_BUTTON: + ENABLED: Habilitado + DISABLED: Desabilitado + POSITION_LABEL: Posição do texto + POSITION_LABEL_HELP: Onde posicionar o botão no frontend + SHOW_LABEL: Mostrar texto do botão + SHOW_ICON: Mostrar ícone do botão + BUTTON_TEXT: Editar esta página + TOP_LEFT: No topo à esquerda + TOP_RIGHT: No topo à direita + BOTTOM_LEFT: Embaixo à esquerda + BOTTOM_RIGHT: Embaixo à direita + REQUIRES_AUTH_LABEL: Apenas visível após login + REQUIRES_AUTH_LABEL_HELP: Se desativado, o botão sempre será mostrado se os plugins necessários estiverem ativos. + AUTO_REFRESH_LABEL: Atualização automática de conteúdo + AUTO_REFRESH_LABEL_HELP: Se ativado, o conteúdo das páginas será atualizado automaticamente quando a aba do navegador for clicada. \ No newline at end of file diff --git a/plugins/frontend-edit-button/scss.sh b/plugins/frontend-edit-button/scss.sh new file mode 100644 index 0000000..ed389c7 --- /dev/null +++ b/plugins/frontend-edit-button/scss.sh @@ -0,0 +1,2 @@ +#!/bin/sh +scss --watch scss:assets/css-compiled diff --git a/plugins/frontend-edit-button/scss/style.scss b/plugins/frontend-edit-button/scss/style.scss new file mode 100644 index 0000000..f8fc36e --- /dev/null +++ b/plugins/frontend-edit-button/scss/style.scss @@ -0,0 +1,55 @@ +$button-color: rgba(255,255,255,0.85); +$button-color-hover: #fff; +$button-bg-color: #0090D9; +$button-bg-color-hover: #26a1df; +$button-border-color: $button-bg-color; +$button-label-color: $button-color; + +#frontend-edit-button { + position: fixed; + z-index: 10000; + padding: 5px; +} + +#frontend-edit-button .label { + font-size: 16px; +} + +#frontend-edit-button.top { + top: 0; +} + +#frontend-edit-button.bottom { + bottom: 0; +} + +#frontend-edit-button.left { + left: 0; +} + +#frontend-edit-button.right { + right: 0; +} + +.frontend-edit-button { + background-color: $button-bg-color; + border: 1px solid $button-border-color; + border-radius: 5px; + color: $button-color; + padding: 5px 5px; + text-align: center; + text-decoration: none; + display: inline-block; + font-size: 16px; + margin: 4px 2px; + cursor: pointer; +} + +.frontend-edit-button:hover { + background: $button-bg-color-hover; + color: $button-color-hover; +} + +.icon-feb-editor:before { + padding-right: 5px; +} \ No newline at end of file diff --git a/plugins/frontend-edit-button/templates/partials/edit-button.html.twig b/plugins/frontend-edit-button/templates/partials/edit-button.html.twig new file mode 100644 index 0000000..bf525d6 --- /dev/null +++ b/plugins/frontend-edit-button/templates/partials/edit-button.html.twig @@ -0,0 +1,21 @@ +{% set _showIcon = config.showIcon|defined(true) %} +{% set _showLabel = config.showLabel|defined(true) %} + +{% if _showLabel == false and _showIcon == false %} + {% set _showLabel = true %} +{% endif %} + + \ No newline at end of file