From a93ab6edd799bf4e9e947373ea236ba5dd628afe Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Fri, 7 Feb 2020 08:47:54 +0100 Subject: [PATCH] Add widget `IcingaIcon` --- configuration.php | 1 + library/Icingadb/Widget/IcingaIcon.php | 29 +++++++++++++++++ public/css/icinga-icons.less | 43 +++++++++++++++++++++++++ public/css/module.less | 6 +++- public/font/Icinga-Icons.eot | Bin 0 -> 1788 bytes public/font/Icinga-Icons.svg | 13 ++++++++ public/font/Icinga-Icons.ttf | Bin 0 -> 1604 bytes public/font/Icinga-Icons.woff | Bin 0 -> 1680 bytes 8 files changed, 91 insertions(+), 1 deletion(-) create mode 100644 library/Icingadb/Widget/IcingaIcon.php create mode 100644 public/css/icinga-icons.less create mode 100644 public/font/Icinga-Icons.eot create mode 100644 public/font/Icinga-Icons.svg create mode 100644 public/font/Icinga-Icons.ttf create mode 100644 public/font/Icinga-Icons.woff diff --git a/configuration.php b/configuration.php index 153eec31..7085c651 100644 --- a/configuration.php +++ b/configuration.php @@ -88,6 +88,7 @@ namespace Icinga\Module\Icingadb $this->provideCssFile('lists.less'); $this->provideCssFile('mixins.less'); $this->provideCssFile('widgets.less'); + $this->provideCssFile('icinga-icons.less'); $this->provideJsFile('action-list.js'); $this->provideJsFile('migrate.js'); diff --git a/library/Icingadb/Widget/IcingaIcon.php b/library/Icingadb/Widget/IcingaIcon.php new file mode 100644 index 00000000..fd93e474 --- /dev/null +++ b/library/Icingadb/Widget/IcingaIcon.php @@ -0,0 +1,29 @@ +. The given + * name will be used as automatically added CSS class for the icon element in the format 'iicon-$name'. In addition, + * the CSS class 'icon' will be automatically added too. + * + * @param string $name The name of the icon + * @param Attributes|array $attributes The HTML attributes for the element + */ + public function __construct($name, $attributes = null) + { + $this + ->getAttributes() + ->add('class', ['icon', "iicon-$name"]) + ->add($attributes); + } +} diff --git a/public/css/icinga-icons.less b/public/css/icinga-icons.less new file mode 100644 index 00000000..770f72da --- /dev/null +++ b/public/css/icinga-icons.less @@ -0,0 +1,43 @@ +@font-face { + font-family: 'Icinga-Icons'; + src: url('../icingadb/static?file=font/Icinga-Icons.eot'); + src: url('../icingadb/static?file=font/Icinga-Icons.eot') format('embedded-opentype'), + url('../icingadb/static?file=font/Icinga-Icons.ttf') format('truetype'), + url('../icingadb/static?file=font/Icinga-Icons.woff') format('woff'), + url('../icingadb/static?file=font/Icinga-Icons.svg') format('svg'); + font-weight: normal; + font-style: normal; + font-display: block; +} + +[class^="iicon-"]:before, [class*=" iicon-"]:before { + /* use !important to prevent issues with browser extensions that change fonts */ + font-family: 'Icinga-Icons' !important; + speak: none; + font-style: normal; + font-weight: normal; + font-variant: normal; + text-transform: none; + line-height: 1em; + + /* Better Font Rendering =========== */ + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + + + display: inline-block; + text-decoration: inherit; + width: 1em; + margin-right: .2em; + text-align: center; +} + +.iicon-minimal:before { + content: "\e900"; +} +.iicon-detailed:before { + content: "\e901"; +} +.iicon-default:before { + content: "\e902"; +} diff --git a/public/css/module.less b/public/css/module.less index 39acdcde..556e6345 100644 --- a/public/css/module.less +++ b/public/css/module.less @@ -68,8 +68,12 @@ a { display: block; height: 100%; - padding: 0.5em 1em; + padding: .3em .6em; width: 100%; + + .icon:before { + font-size: 16px; // Pixels, because the glyphs get blurry otherwise + } } } } diff --git a/public/font/Icinga-Icons.eot b/public/font/Icinga-Icons.eot new file mode 100644 index 0000000000000000000000000000000000000000..b492a29cda708da6cd70d4aedf173fac3e990c95 GIT binary patch literal 1788 zcma)7O-Ni<6#nkJGh-Z!CjLY*Ql5=bA&HvAU+Cg4QbDLBCc$ld8DGZ%oj1&kM0bw_ z3SE>+=_1)l*1=s%7o|M9kS@CFq6I@pp^GBjxM?9!XY$?m?lW&}44&cK`E!U%y~bAMJa2 zr&3~nmbUKC|a*u(DR&Xa@oy z)k(W=)yp}kiCx-bw9l?N8zr>kE^S5IE;?)Ow~u%KqP@f%Kb5>nm32}w1KJNMeX)f! zb3e6yA@fz#i@$M0H0!v82$tO_3fQ+~P!FIamCkrUbeyf5Fq_WUM_<&-FsctJOq0*z z3>VxYXYX6}!+Kp0B1VWs{m^}XpDWjmix|cg zF7-Gox{2FBM`z~ZM}rgNlQ*uP?>Yf@^mp}7oMRJf7xB;u!NH{q7cRX^l@%QRPu1~A zsm$mXy6+tv+%vuST&bF`1XL|hzIsJhFI}-48U9bMjZ~cNW^|z+gSgCPiff-p7JM#I z{M1o|P?mq_YgN<3!_!GU@<alYHo5zhH2>o}HC zPoe(F1fQ%*AWrXF>M)4akJ-4FILhw_ejv7uS$kptD0;6@Rr>YA`)wcpgO-$Lu~(YV zXX&U9cL~ob_h=*>6YhCVsTS^h{iUQdMV^S#!)U8mLpF;}e2A~{o3O*tO<3Sb&=O|} z4b!w@$K(+BfLxT%LKD6;Sd#z5;1uyQgVUVv0fRH-3kGM=i(P%LQq5#~=!vk!i}4$S zCHVz|Q^Y$4r+HP58k`}&Zg7_8=a0Eup_q5B&gHyf<)rI((JfaBUeUfbGWPB}_cR|l zP0SrPzrN~}8?XA)44n0fRXgt%-Lg}4m+c3eHviDP=M_gV8$J$I*nB)(J`?)Ma8PBx bOzr_T+3IJ + + +Generated by IcoMoon + + + + + + + + + \ No newline at end of file diff --git a/public/font/Icinga-Icons.ttf b/public/font/Icinga-Icons.ttf new file mode 100644 index 0000000000000000000000000000000000000000..192416e166eee6201fef96faeff6978a1a553bdc GIT binary patch literal 1604 zcma)6J7^S96g_X=?#8TQVm>CsAQSTiHCaE230S;Bg%si^lGaQ%>n4!QEW0Zv-Jl>? zh$0r+iM6CtEJOy2U}0sUpooHn1e-Jp7TNW@**9^FA99yF_uO;ud-uNILIBtf9}<}} z6GMj^nv##mJflu!7o0-d9qnHgsbE2av&0c60(~f##M}_rAX2qa#NS?{57EZtiOB8s5cE zq^-pL|40sc_w4EYn<^_<|3lU0OsUN1_u6*!^}RDzTvw{%D*;srl&?NA)WJ{`MvCj? z*+|9Ru171n(1-mzrl|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