Created
April 8, 2011 22:45
-
-
Save caleb/910881 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
| MerionNavigator.PostItemView = SC.View.extend( | |
| /** @scope MerionNavigator.PostItemView.prototype */ { | |
| useStaticLayout: YES, | |
| classNames: ["post-item-view"], | |
| displayProperties: "isSelected".w(), | |
| content: null, | |
| isSelected: null, | |
| render: function(context, firstTime) { | |
| var post = this.get("content"); | |
| var title = post.get("title") || ""; | |
| var author = post.get("author") || ""; | |
| var summary = post.get("summary") || ""; | |
| var date = post.get("publishedAt") || ""; | |
| var selected = this.get("isSelected"); | |
| if (date != "") { | |
| date = date.toFormattedString(MerionNavigator.dateFormatString); | |
| } | |
| if (firstTime) { | |
| context.begin("div").addClass("sc-outline") | |
| .begin("div").addClass("date").push(date).end() | |
| .begin("h1").addClass("title").push(title).end() | |
| .begin("div").addClass("author").push(author).end() | |
| .begin("div").addClass("summary").push(summary).end() | |
| .end(); | |
| } | |
| if (selected) { | |
| context.addClass("sel"); | |
| } else { | |
| context.removeClass("sel"); | |
| } | |
| this.$(".date").html(date); | |
| this.$(".title").html(title); | |
| this.$(".author").html(author); | |
| this.$(".summary").html(summary); | |
| } | |
| }); |
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
| list: SC.StackedView.design({ | |
| useStaticLayout: YES, | |
| exampleView: MerionNavigator.PostItemView, | |
| contentBinding: "MerionNavigator.postsController.content", | |
| }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment