Skip to content

Instantly share code, notes, and snippets.

@mohamedali-s-4725
Last active November 7, 2023 07:43
Show Gist options
  • Select an option

  • Save mohamedali-s-4725/040b421a4182a909778a65282bc72151 to your computer and use it in GitHub Desktop.

Select an option

Save mohamedali-s-4725/040b421a4182a909778a65282bc72151 to your computer and use it in GitHub Desktop.

Revisions

  1. mohamedali-s-4725 revised this gist Nov 7, 2023. 1 changed file with 4 additions and 5 deletions.
    9 changes: 4 additions & 5 deletions controllers.application\.js
    Original file line number Diff line number Diff line change
    @@ -2,12 +2,11 @@ import Controller from '@ember/controller';
    import { set } from '@ember/object';

    export default Controller.extend({

    init(){
    this._super(...arguments);
    alert();
    set(this, 'iconList', Object.keys(this.svg_icons));
    },
    this._super(...arguments);
    set(this, 'iconList', Object.keys(this.svg_icons));
    },

    iconList: '',

  2. mohamedali-s-4725 revised this gist Apr 24, 2023. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion controllers.application\.js
    Original file line number Diff line number Diff line change
    @@ -5,7 +5,7 @@ export default Controller.extend({

    init(){
    this._super(...arguments);

    alert();
    set(this, 'iconList', Object.keys(this.svg_icons));
    },

  3. mohamedali-s-4725 revised this gist Sep 29, 2022. No changes.
  4. mohamedali-s-4725 revised this gist Sep 29, 2022. 1 changed file with 5 additions and 8 deletions.
    13 changes: 5 additions & 8 deletions templates.application\.hbs
    Original file line number Diff line number Diff line change
    @@ -5,21 +5,18 @@

    <style>
    .zwd-icon-18 {
    width: 18px!important;
    height: 18px!important;
    width: 20px!important;
    height: 20px!important;
    flex: 0 0 14px!important;
    margin-top: 20px!important;
    }
    .zwd-pt--3 {
    position: relative;
    top: -3px!important;
    }
    </style>

    {{#each iconList as |icon index|}}

    <SvgIcon @name={{icon}} @svgicons={{svg_icons}} @class="zwd-icon-18"/>

    &nbsp;&nbsp;&nbsp;
    {{/each}}

    {{outlet}}
  5. mohamedali-s-4725 revised this gist Sep 29, 2022. 1 changed file with 0 additions and 1 deletion.
    1 change: 0 additions & 1 deletion controllers.application\.js
    Original file line number Diff line number Diff line change
    @@ -7,7 +7,6 @@ export default Controller.extend({
    this._super(...arguments);

    set(this, 'iconList', Object.keys(this.svg_icons));
    console.log(this.iconList);
    },

    iconList: '',
  6. mohamedali-s-4725 revised this gist Sep 29, 2022. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions templates.application\.hbs
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,6 @@
    <h1>WorkDrive SVG Icons</h1>
    <br>
    <hr>
    <br>

    <style>
    @@ -16,7 +17,9 @@
    </style>

    {{#each iconList as |icon index|}}

    <SvgIcon @name={{icon}} @svgicons={{svg_icons}} @class="zwd-icon-18"/>

    {{/each}}

    {{outlet}}
  7. mohamedali-s-4725 revised this gist Sep 29, 2022. No changes.
  8. mohamedali-s-4725 revised this gist Sep 29, 2022. 1 changed file with 4 additions and 4 deletions.
    8 changes: 4 additions & 4 deletions templates.application\.hbs
    Original file line number Diff line number Diff line change
    @@ -4,8 +4,8 @@

    <style>
    .zwd-icon-18 {
    width: 14px!important;
    height: 14px!important;
    width: 18px!important;
    height: 18px!important;
    flex: 0 0 14px!important;
    }
    @@ -15,8 +15,8 @@
    }
    </style>

    {{#each iconList as |icon|}}
    <SvgIcon @name={{icon}} @svgicons={{svg_icons}} @class="zwd-icon-18 left floa"/>
    {{#each iconList as |icon index|}}
    <SvgIcon @name={{icon}} @svgicons={{svg_icons}} @class="zwd-icon-18"/>
    {{/each}}

    {{outlet}}
  9. mohamedali-s-4725 revised this gist Sep 29, 2022. No changes.
  10. mohamedali-s-4725 revised this gist Sep 29, 2022. 1 changed file with 14 additions and 1 deletion.
    15 changes: 14 additions & 1 deletion templates.application\.hbs
    Original file line number Diff line number Diff line change
    @@ -2,8 +2,21 @@
    <br>
    <br>

    <style>
    .zwd-icon-18 {
    width: 14px!important;
    height: 14px!important;
    flex: 0 0 14px!important;
    }
    .zwd-pt--3 {
    position: relative;
    top: -3px!important;
    }
    </style>

    {{#each iconList as |icon|}}
    <SvgIcon @name={{icon}} @svgicons={{svg_icons}}/>
    <SvgIcon @name={{icon}} @svgicons={{svg_icons}} @class="zwd-icon-18 left floa"/>
    {{/each}}

    {{outlet}}
  11. mohamedali-s-4725 revised this gist Sep 29, 2022. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion templates.application\.hbs
    Original file line number Diff line number Diff line change
    @@ -3,7 +3,7 @@
    <br>

    {{#each iconList as |icon|}}
    <SvgIcon @name={{icon}} @svgicons={{svg_icons}} @class="zdicon-18 left floated pt--1"/>
    <SvgIcon @name={{icon}} @svgicons={{svg_icons}}/>
    {{/each}}

    {{outlet}}
  12. mohamedali-s-4725 revised this gist Sep 29, 2022. 2 changed files with 2 additions and 1 deletion.
    1 change: 1 addition & 0 deletions components.svg-icon\.js
    Original file line number Diff line number Diff line change
    @@ -23,6 +23,7 @@ export default Component.extend({
    this._super(...arguments);
    let self = this,
    iconKey = 'svgicons.' + self.name; // No I18N
    console.log('svgicons.' , self.name);
    set(self, 'svgJson', get(self, iconKey));
    if (self.svgJson && self.svgJson.viewBox) {
    set(self, 'viewBox', self.svgJson.viewBox);
    2 changes: 1 addition & 1 deletion templates.application\.hbs
    Original file line number Diff line number Diff line change
    @@ -3,7 +3,7 @@
    <br>

    {{#each iconList as |icon|}}
    <SvgIcon @name={{icon.icon_name}} @svgicons={{svg_icons}} @class="zdicon-18 left floated pt--1"/>
    <SvgIcon @name={{icon}} @svgicons={{svg_icons}} @class="zdicon-18 left floated pt--1"/>
    {{/each}}

    {{outlet}}
  13. mohamedali-s-4725 revised this gist Sep 29, 2022. No changes.
  14. mohamedali-s-4725 revised this gist Sep 29, 2022. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion templates.application\.hbs
    Original file line number Diff line number Diff line change
    @@ -3,7 +3,7 @@
    <br>

    {{#each iconList as |icon|}}
    <SvgIcon @name={{icon.icon_name}} @class="zdicon-18 left floated pt--1"/>
    <SvgIcon @name={{icon.icon_name}} @svgicons={{svg_icons}} @class="zdicon-18 left floated pt--1"/>
    {{/each}}

    {{outlet}}
  15. mohamedali-s-4725 revised this gist Sep 29, 2022. 2 changed files with 5 additions and 1 deletion.
    2 changes: 2 additions & 0 deletions components.svg-icon\.js
    Original file line number Diff line number Diff line change
    @@ -5,6 +5,8 @@ import { get, set } from '@ember/object';
    export default Component.extend({
    layout,

    svgicons : '',

    tagName: 'svg', // No I18N

    name: '', // No I18N
    4 changes: 3 additions & 1 deletion controllers.application\.js
    Original file line number Diff line number Diff line change
    @@ -1,11 +1,13 @@
    import Controller from '@ember/controller';
    import { set } from '@ember/object';

    export default Controller.extend({

    init(){
    this._super(...arguments);

    console.log(svg_icons);
    set(this, 'iconList', Object.keys(this.svg_icons));
    console.log(this.iconList);
    },

    iconList: '',
  16. mohamedali-s-4725 revised this gist Sep 29, 2022. 1 changed file with 7 additions and 0 deletions.
    7 changes: 7 additions & 0 deletions controllers.application\.js
    Original file line number Diff line number Diff line change
    @@ -2,7 +2,14 @@ import Controller from '@ember/controller';

    export default Controller.extend({

    init(){
    this._super(...arguments);

    console.log(svg_icons);
    },

    iconList: '',

    svg_icons : {
    wd_labels: {
    path: [
  17. mohamedali-s-4725 revised this gist Sep 29, 2022. 1 changed file with 5 additions and 5 deletions.
    10 changes: 5 additions & 5 deletions controllers.application\.js
    Original file line number Diff line number Diff line change
    @@ -2319,10 +2319,10 @@ wd_desktop: {
    wd_theme: {
    rect: [
    {
    fill='#f9f9f9', // No I18N
    width='150',
    height='100',
    rx='8'
    fill:'#f9f9f9', // No I18N
    width:'150',
    height:'100',
    rx:'8'
    }
    ],
    path: [
    @@ -2895,7 +2895,7 @@ wd_desktop: {
    d: 'M10,0C4.5,0,0,4.5,0,10c0,5.5,4.5,10,10,10s10-4.5,10-10S15.5,0,10,0z M11.5,15.2c-0.3,0.1-0.6-0.1-0.6-0.5v-1c0-0.2,0.1-0.4,0.3-0.4c1.4-0.5,2.5-1.9,2.5-3.4c0-2-1.6-3.6-3.6-3.6S6.4,8,6.4,10c0,0.6,0.2,1.3,0.5,1.8c0,0.1,0.2,0.1,0.3,0.1c0.1,0,0.1-0.1,0.1-0.2v-0.4c0-0.3,0.2-0.5,0.5-0.5h0.9c0.3,0,0.5,0.2,0.5,0.5V15c0,0.3-0.2,0.5-0.5,0.5H5c-0.3,0-0.5-0.2-0.5-0.5v-0.9c0-0.3,0.2-0.5,0.5-0.5h0.5c0.1,0,0.2-0.1,0.2-0.2c0,0,0-0.1,0-0.1c-0.7-0.9-1.1-2-1.1-3.3C4.5,7,7,4.5,10,4.5S15.5,7,15.5,10C15.5,12.5,13.8,14.6,11.5,15.2z' // No I18N
    }
    ],
    viewBox='0 0 20 20'
    viewBox:'0 0 20 20'
    }

    }
  18. mohamedali-s-4725 revised this gist Sep 29, 2022. 1 changed file with 2897 additions and 1 deletion.
    2,898 changes: 2,897 additions & 1 deletion controllers.application\.js
    2,897 additions, 1 deletion not shown because the diff is too large. Please use a local Git client to view these changes.
  19. mohamedali-s-4725 revised this gist Sep 29, 2022. 2 changed files with 6 additions and 4 deletions.
    8 changes: 5 additions & 3 deletions controllers.application\.js
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,7 @@
    import Controller from '@ember/controller';

    export default class ApplicationController extends Controller {
    appName = 'Ember Twiddle';
    }
    export default Controller.extend({

    iconList :

    });
    2 changes: 1 addition & 1 deletion templates.application\.hbs
    Original file line number Diff line number Diff line change
    @@ -2,7 +2,7 @@
    <br>
    <br>

    {{#each icon_list as |icon|}}
    {{#each iconList as |icon|}}
    <SvgIcon @name={{icon.icon_name}} @class="zdicon-18 left floated pt--1"/>
    {{/each}}

  20. mohamedali-s-4725 revised this gist Sep 29, 2022. 1 changed file with 6 additions and 1 deletion.
    7 changes: 6 additions & 1 deletion templates.application\.hbs
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,11 @@
    <h1>Welcome to {{this.appName}}</h1>
    <h1>WorkDrive SVG Icons</h1>
    <br>
    <br>

    {{#each icon_list as |icon|}}
    <SvgIcon @name={{icon.icon_name}} @class="zdicon-18 left floated pt--1"/>
    {{/each}}

    {{outlet}}
    <br>
    <br>
  21. mohamedali-s-4725 revised this gist Sep 29, 2022. 1 changed file with 23 additions and 1 deletion.
    24 changes: 23 additions & 1 deletion templates.components.svg-icon\.hbs
    Original file line number Diff line number Diff line change
    @@ -1 +1,23 @@
    {{yield}}
    {{#each svgJson.rect as |rectObj|}}
    <rect fill="{{if rectObj.fill rectObj.fill ''}}" opacity="{{if rectObj.opacity rectObj.opacity ''}}" width="{{if rectObj.width rectObj.width ''}}" height="{{if rectObj.height rectObj.height ''}}" stroke="{{if rectObj.stroke rectObj.stroke ''}}" x="{{if rectObj.x rectObj.x ''}}" y="{{if rectObj.y rectObj.y ''}}" rx="{{if rectObj.rx rectObj.rx ''}}" fill-rule="{{if rectObj.fill-rule rectObj.fill-rule ''}}"></rect>
    {{/each}}

    {{#each svgJson.line as |lineObj|}}
    <line x1="{{if lineObj.x1 lineObj.x1 ''}}" y1="{{if lineObj.y1 lineObj.y1 ''}}" x2="{{if lineObj.x2 lineObj.x2 ''}}" y2="{{if lineObj.y2 lineObj.y2 ''}}" stroke="{{if lineObj.stroke lineObj.stroke ''}}" stroke-linecap="{{if lineObj.stroke-linecap lineObj.stroke-linecap ''}}" stroke-linejoin="{{if lineObj.stroke-linejoin lineObj.stroke-linejoin ''}}"></line> {{!-- No I18N --}}
    {{/each}}

    {{#each svgJson.path as |pathObj|}}

    <path d="{{pathObj.d}}" fill="{{if pathObj.fill pathObj.fill ''}}" opacity="{{if pathObj.opacity pathObj.opacity ''}}" stroke="{{if pathObj.stroke pathObj.stroke ''}}" transform="{{if pathObj.transform pathObj.transform ''}}" fill-rule="{{if pathObj.fill-rule pathObj.fill-rule ''}}"></path>

    {{/each}}

    {{#each svgJson.ellipse as |ellipseObj|}}

    <ellipse cx="{{if ellipseObj.cx ellipseObj.cx ''}}" cy="{{if ellipseObj.cy ellipseObj.cy ''}}" rx="{{if ellipseObj.rx ellipseObj.rx ''}}" ry="{{if ellipseObj.ry ellipseObj.ry ''}}" stroke="{{if ellipseObj.stroke ellipseObj.stroke ''}}" fill-rule="{{if ellipseObj.fill-rule ellipseObj.fill-rule ''}}" opacity="{{if ellipseObj.opacity ellipseObj.opacity ''}}"></ellipse>

    {{/each}}

    {{#each svgJson.polygon as |polygonObj|}}
    <polygon points="{{if polygonObj.points polygonObj.points ''}}" transform="{{if polygonObj.transform polygonObj.transform ''}}" fill="{{if polygonObj.fill polygonObj.fill}}" fill-rule="{{if polygonObj.fill-rule polygonObj.fill-rule}}"></polygon>
    {{/each}}
  22. mohamedali-s-4725 created this gist Sep 29, 2022.
    30 changes: 30 additions & 0 deletions components.svg-icon\.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,30 @@
    import Component from '@ember/component';
    import layout from '../templates/components/svg-icon';
    import { get, set } from '@ember/object';

    export default Component.extend({
    layout,

    tagName: 'svg', // No I18N

    name: '', // No I18N

    attributeBindings: ['viewBox', 'DataSvgName'], // No I18N

    DataSvgName: '',

    viewBox: '0 0 20 20', // No I18N

    svgJson: '', // No I18N

    didReceiveAttrs() {
    this._super(...arguments);
    let self = this,
    iconKey = 'svgicons.' + self.name; // No I18N
    set(self, 'svgJson', get(self, iconKey));
    if (self.svgJson && self.svgJson.viewBox) {
    set(self, 'viewBox', self.svgJson.viewBox);
    }
    set(self, 'DataSvgName', self.name);
    }
    });
    5 changes: 5 additions & 0 deletions controllers.application\.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,5 @@
    import Controller from '@ember/controller';

    export default class ApplicationController extends Controller {
    appName = 'Ember Twiddle';
    }
    6 changes: 6 additions & 0 deletions templates.application\.hbs
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,6 @@
    <h1>Welcome to {{this.appName}}</h1>
    <br>
    <br>
    {{outlet}}
    <br>
    <br>
    1 change: 1 addition & 0 deletions templates.components.svg-icon\.hbs
    Original file line number Diff line number Diff line change
    @@ -0,0 +1 @@
    {{yield}}
    22 changes: 22 additions & 0 deletions twiddle\.json
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,22 @@
    {
    "version": "0.17.1",
    "EmberENV": {
    "FEATURES": {},
    "_TEMPLATE_ONLY_GLIMMER_COMPONENTS": false,
    "_APPLICATION_TEMPLATE_WRAPPER": true,
    "_JQUERY_INTEGRATION": true
    },
    "options": {
    "use_pods": false,
    "enable-testing": false
    },
    "dependencies": {
    "jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.js",
    "ember": "3.18.1",
    "ember-template-compiler": "3.18.1",
    "ember-testing": "3.18.1"
    },
    "addons": {
    "@glimmer/component": "1.0.0"
    }
    }