Created
May 23, 2012 19:22
-
-
Save artgon/2777218 to your computer and use it in GitHub Desktop.
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
EmailTemplater.templatesController = SC.ObjectController.create({ | |
content: SC.Object.create({ | |
subject: '', | |
body: '' | |
}), | |
convertedSubject: function() { | |
return this._replacePlacholders("subject"); | |
}.property('subject'), | |
convertedBody: function() { | |
return this._replacePlacholders("body"); | |
}.property('body'), | |
_replacePlaceholders: function(field) { | |
return EmailTemplater.parsingController.get(field).replace(regex, function(match, group) { | |
var placeholders = EmailTemplater.store.find(SC.Query.local(EmailTemplater.Placeholder, "name = %@", [group])).objectAt(0); | |
return placeholders.get('text'); | |
}); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment