jeudi 27 octobre 2016

How would you recommend DRYing up these links in handlebars

Here's a component:

import Ember from 'ember';

export default Ember.Component.extend({
  classNames: ['config-menu'],

  newConfig: Ember.computed('config', function() {
    return (this.get('config.configId') === '');
  }),
});

And here's its template:

<ul class="tv-navigation">
  
    
      Setup
    
  
    
      Setup
    
  

  
    
      File Types
    
  
    
      File Types
    
  

  
    
      Applications
    
  
    
      Applications
    
  

  
    
      Directories
    
  
    
      Directories
    
  
</ul>

<div class="config-menu-bottom">
  
</div>

I'd love to DRY this up a bit, specifically the difference between the new-windows and windows config statements.

I tried writing some custom helpers to stringify the routes to the link-to helper, but I couldn't get it to work.

I also repeat this process for other Operating Systems (in a similar / mirror'd component).

Thanks for the advice!




Aucun commentaire:

Enregistrer un commentaire