Last active
April 9, 2019 19:23
-
-
Save dhindurthy/b246f0d6854132511d245311adbaeecc to your computer and use it in GitHub Desktop.
to-do 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
import Ember from 'ember'; | |
export default Ember.Component.extend({ | |
itemindex: null, | |
inputValue:"qwerty", | |
actions:{ | |
addItem: function(){ | |
if(this.get('todoItem')){ | |
this.addItem(this.get('todoItem'), this.get('itemindex')); | |
this.set('todoItem',''); | |
this.set('itemindex',null); | |
} else { | |
alert("cannot be empty"); | |
} | |
}, | |
deleteItem: function(index){ | |
this.deleteItem(index); | |
}, | |
editItem: function(index, todoItem){ | |
this.set('todoItem',todoItem.name); | |
this.set('itemindex', index); | |
this.editItem(index); | |
document.getElementById("addItem").focus(); | |
} | |
} | |
}); |
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 default Ember.Controller.extend({ | |
appName: 'Ember Twiddle' | |
}); |
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 default Ember.Controller.extend({ | |
todoList : [{"name":"Item qwerty"}, {"name":"Item abcde"}, {"name":"Item 12345"}], | |
actions:{ | |
addItem: function(todoItem,itemindex){ | |
let todoList = this.get('todoList'); | |
if(itemindex) { | |
todoList.insertAt(itemindex, {"name":todoItem}); | |
} else { | |
todoList.addObject({"name":todoItem}); | |
} | |
}, | |
deleteItem: function(index){ | |
let todoList = this.get('todoList'); | |
todoList.removeAt(index); | |
}, | |
editItem: function(index){ | |
let todoList = this.get('todoList'); | |
todoList.removeAt(index); | |
} | |
} | |
}); |
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 default Ember.Route.extend({ | |
model: function(){ | |
let someObject = {}; | |
/**someObject.todoList = [{"name":"Item qwerty"}, {"name":"Item abcde"}, {"name":"Item 12345"}];**/ | |
return someObject; | |
} | |
}); |
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; | |
} | |
.fa:hover, .fas:hover { | |
color: red; | |
cursor: pointer; | |
font-size: 15px; | |
} | |
input:hover, input:focus{ | |
height: 20px; | |
} |
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", | |
"ember-font-awesome": "https://use.fontawesome.com/releases/v5.7.2/css/all.css" | |
}, | |
"addons": { | |
"ember-data": "3.4.2" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment