Permalink
Browse files

Backlog: Edit the story summary

Add a simple mechanism for editing a story's summary.
  • Loading branch information...
1 parent d5b1a8c commit 6a80b7656827168dc9060a541d03d6ba783f1010 @philip-morning committed Feb 19, 2014
Showing with 15 additions and 2 deletions.
  1. +10 −0 app/public/js/controllers/home.js
  2. +5 −2 app/public/partials/home.html
@@ -1,5 +1,6 @@
function HomeCtrl($scope, $timeout) {
+ var selectedStory = undefined;
var stories = [];
for (var i=0; i < 10; i++) {
stories[i] = {
@@ -10,6 +11,15 @@ function HomeCtrl($scope, $timeout) {
$scope.stories = stories;
+ $scope.select = function (story) {
+ if (selectedStory) {
+ selectedStory.isSelected = false;
+ }
+
+ story.isSelected = true;
+ selectedStory = story;
+ };
+
$scope.$on('$viewContentLoaded', function() {
// Even though we're waiting for viewContentLoaded,
// I guess we need to yield to whatever else is happening.
@@ -1,8 +1,11 @@
<p>:-)</p>
<div id="backlog">
- <div class="story" ng-repeat="story in stories">
+ <div class="story" ng-repeat="story in stories" ng-click="select(story)">
<span>{{story.id}}</span>
- <span>{{story.summary}}</span>
+ <span ng-show="story.isSelected">
+ <input type="text" ng-model="story.summary"/>
+ </span>
+ <span ng-show="!story.isSelected">{{story.summary}}</span>
</div>
</div>

0 comments on commit 6a80b76

Please sign in to comment.