- 
      
 - 
        
Save euglv/2d300989f25644c76b5658562946bcd3 to your computer and use it in GitHub Desktop.  
    bcx-aurelia-reorderable-repeat example: basics
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset="utf-8"> | |
| <title>Dumber Gist</title> | |
| <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0, user-scalable=no"> | |
| <base href="/"> | |
| </head> | |
| <!-- | |
| Dumber gist uses dumber bundler, the default bundle file | |
| is /dist/entry-bundle.js. | |
| The starting module is pointed to aurelia-bootstrapper | |
| (data-main attribute on script) for Aurelia, | |
| The aurelia bootstrapper then loads up user module "main" | |
| (aurelia-app attribute on <body>) which is your src/main.js. | |
| --> | |
| <body aurelia-app="main"> | |
| <script src="/dist/entry-bundle.js" data-main="aurelia-bootstrapper"></script> | |
| </body> | |
| </html> | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | { | |
| "dependencies": { | |
| "aurelia-bootstrapper": "^2.3.3" | |
| } | |
| } | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | <template> | |
| <require from="./list-container"></require> | |
| <require from="./list-container2"></require> | |
| <div style="display:flex"> | |
| <list-container></list-container> | |
| <list-container2></list-container2> | |
| </div> | |
| </template> | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | export class App { | |
| } | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | .container { | |
| width: 200px; | |
| margin: 5px; | |
| } | |
| .item { | |
| display: block; | |
| box-sizing: border-box; | |
| border: 1px solid #333; | |
| width: 100%; | |
| height: 50px; | |
| text-align: center; | |
| line-height: 50px; | |
| overflow: hidden; | |
| background: white; | |
| } | |
| .item:not(:first-child) { | |
| margin-top: -1px; | |
| } | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | <template> | |
| <require from="./list-container.css"></require> | |
| <p>Array of strings</p> | |
| <div class="container"> | |
| <div class="item" reorderable-repeat.for="item of items"> | |
| ${item} | |
| </div> | |
| </div> | |
| </template> | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | export class ListContainer { | |
| items = ['first', 'second', 'third', 'fourth']; | |
| } | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | <template> | |
| <require from="./list-container.css"></require> | |
| <p>Array of objects</p> | |
| <div class="container"> | |
| <div class="item" reorderable-repeat.for="item of items"> | |
| #${item.id} <input type="text" value.bind="item.value"> | |
| </div> | |
| </div> | |
| </template> | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | export class ListContainer2 { | |
| items = [ | |
| {id: '0', value: 'first'}, | |
| {id: '1', value: 'second'}, | |
| {id: '2', value: 'third'}, | |
| {id: '3', value: 'fourth'} | |
| ]; | |
| } | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | export function configure(aurelia) { | |
| aurelia.use | |
| .standardConfiguration() | |
| .developmentLogging('info') | |
| .plugin('bcx-aurelia-reorderable-repeat'); | |
| aurelia.start().then(() => aurelia.setRoot()); | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment