Last active
April 14, 2016 11:59
-
-
Save jphager2/947422588f494104f89fdaf8e569ea84 to your computer and use it in GitHub Desktop.
Component Example
This file contains 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({ | |
activityAction: Ember.computed('m.state', function() { | |
const states = ["a", "b", "c", "d", "e", "f"]; | |
let activity = this.get('m'); | |
let state = activity.get('state'); | |
let index = states.indexOf(state); | |
var path = null; | |
var text = null; | |
if (index === 0) { // To Approve | |
path = "index"; | |
text = "Schválit případ"; | |
} else if (index === 1) { // More Info | |
path = "index"; | |
text = "Poskytovat více informací"; | |
} else if (index === 2) { // To Submit | |
path = "index"; | |
text = "Dokončit případ"; | |
} else if (index === 5) { // To Confirm | |
path = "index"; | |
text = "Potvrdí aktivitu"; | |
} | |
return { path: path, text: text }; | |
}), | |
shouldDisplay: Ember.computed('m.state', function() { | |
return this.get("path"); | |
}), | |
path: Ember.computed('m.state', function() { | |
return this.get("activityAction.path"); | |
}), | |
text: Ember.computed('m.state', function() { | |
return this.get("activityAction.text"); | |
}), | |
}); |
This file contains 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: 'Component Example', | |
activities: [ | |
Ember.Object.create({ name: "A", state: "a" }), | |
Ember.Object.create({ name: "B", state: "b" }), | |
Ember.Object.create({ name: "C", state: "c" }), | |
Ember.Object.create({ name: "D", state: "d" }), | |
Ember.Object.create({ name: "E", state: "e" }), | |
Ember.Object.create({ name: "F", state: "f" }), | |
], | |
}); |
This file contains 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.7.2", | |
"EmberENV": { | |
"FEATURES": {} | |
}, | |
"options": { | |
"use_pods": false, | |
"enable-testing": false | |
}, | |
"dependencies": { | |
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js", | |
"ember": "https://cdnjs.cloudflare.com/ajax/libs/ember.js/2.4.4/ember.debug.js", | |
"ember-data": "https://cdnjs.cloudflare.com/ajax/libs/ember-data.js/2.4.3/ember-data.js", | |
"ember-template-compiler": "https://cdnjs.cloudflare.com/ajax/libs/ember.js/2.4.4/ember-template-compiler.js" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment