Forked from alexdiliberto/components.user-portrait.js
          
        
    
          Last active
          August 28, 2019 18:57 
        
      - 
      
 - 
        
Save sarus/7a83c302bb2fcac320e7c17c6f2a01b8 to your computer and use it in GitHub Desktop.  
    Polarity Sample Application
  
        
  
    
      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
    
  
  
    
  | import Ember from 'ember'; | |
| import Component from '@ember/component'; | |
| export default Component.extend({ | |
| numberOfSaves: 0, | |
| message: '', | |
| helloMessage: Ember.computed('username', function() { | |
| return `Hello, ${this.get('username')}. Welcome!`; | |
| }), | |
| actions: { | |
| clear: function() { | |
| this.set('numberOfSaves', 0); | |
| this.set('message', ''); | |
| }, | |
| saveUser: function() { | |
| let self = this; | |
| this.incrementProperty('numberOfSaves'); | |
| return this.get('save')() | |
| .then(function(result) { | |
| self.set('message', result); | |
| }, function(err) { | |
| self.set('message', 'Save Failed!'); | |
| }); | |
| } | |
| } | |
| }); | 
  
    
      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
    
  
  
    
  | import Controller from '@ember/controller'; | |
| import { later } from '@ember/runloop'; | |
| export default Controller.extend({ | |
| appName: 'Polarity', | |
| username: "admin", | |
| actions: { | |
| test: function() { | |
| console.info("You pressed 'test'"); | |
| }, | |
| save: function() { | |
| console.info("You pressed 'Save User'"); | |
| return new Promise(function(resolve, reject) { | |
| return later(this, function() { | |
| resolve("Save Succeeded"); | |
| }, 1000); | |
| }); | |
| } | |
| } | |
| }); | 
  
    
      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
    
  
  
    
  | import Ember from 'ember'; | |
| export function equal(params/*, hash*/) { | |
| return params[0] === params[1]; | |
| } | |
| export default Ember.Helper.helper(equal); | 
  
    
      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
    
  
  
    
  | import Ember from 'ember'; | |
| import { later } from '@ember/runloop'; | |
| export default Ember.Route.extend({ | |
| model() { | |
| return new Promise((resolve) => { | |
| return later(this, function() { | |
| resolve("Polarity!"); | |
| }, 2000); | |
| }); | |
| } | |
| }); | 
  
    
      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
    
  
  
    
  | body { | |
| margin: 12px 16px; | |
| font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; | |
| font-size: 12pt; | |
| } | |
| .user-portrait-card { | |
| background-color: #ccc; | |
| padding: 20px; | |
| } | |
| .button-container{ | |
| margin-top: 10px | |
| } | |
| .warning{ | |
| background-color: red; | |
| color: white; | |
| } | 
  
    
      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
    
  
  
    
  | { | |
| "version": "0.15.1", | |
| "EmberENV": { | |
| "FEATURES": {} | |
| }, | |
| "options": { | |
| "use_pods": false, | |
| "enable-testing": false | |
| }, | |
| "dependencies": { | |
| "jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.js", | |
| "ember": "3.4.3", | |
| "ember-template-compiler": "3.4.3", | |
| "ember-testing": "3.4.3" | |
| }, | |
| "addons": { | |
| } | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment