branston 0.3.6 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (141) hide show
  1. data/lib/branston/app/controllers/scenarios_controller.rb +6 -5
  2. data/lib/branston/app/controllers/stories_controller.rb +101 -89
  3. data/lib/branston/app/models/story.rb +30 -1
  4. data/lib/branston/app/models/user.rb +4 -0
  5. data/lib/branston/app/views/iterations/index.html.erb +1 -1
  6. data/lib/branston/app/views/layouts/_header.html.erb +1 -2
  7. data/lib/branston/app/views/scenarios/_scenario.html.erb +6 -3
  8. data/lib/branston/app/views/scenarios/_scenarios.html.erb +4 -2
  9. data/lib/branston/app/views/stories/_form.html.erb +15 -4
  10. data/lib/branston/app/views/stories/_story.html.erb +26 -6
  11. data/lib/branston/app/views/stories/edit.html.erb +3 -3
  12. data/lib/branston/app/views/stories/index.html.erb +22 -3
  13. data/lib/branston/app/views/stories/new.html.erb +2 -2
  14. data/lib/branston/app/views/stories/show.html.erb +3 -3
  15. data/lib/branston/config/routes.rb +7 -4
  16. data/lib/branston/coverage/app-controllers-application_controller_rb.html +1 -1
  17. data/lib/branston/coverage/app-controllers-iterations_controller_rb.html +1 -1
  18. data/lib/branston/coverage/app-controllers-outcomes_controller_rb.html +1 -1
  19. data/lib/branston/coverage/app-controllers-preconditions_controller_rb.html +1 -1
  20. data/lib/branston/coverage/app-controllers-releases_controller_rb.html +1 -1
  21. data/lib/branston/coverage/app-controllers-scenarios_controller_rb.html +18 -12
  22. data/lib/branston/coverage/app-controllers-sessions_controller_rb.html +1 -1
  23. data/lib/branston/coverage/app-controllers-stories_controller_rb.html +193 -121
  24. data/lib/branston/coverage/app-controllers-user_roles_controller_rb.html +1 -1
  25. data/lib/branston/coverage/app-controllers-users_controller_rb.html +1 -1
  26. data/lib/branston/coverage/app-helpers-application_helper_rb.html +1 -1
  27. data/lib/branston/coverage/app-helpers-iterations_helper_rb.html +1 -1
  28. data/lib/branston/coverage/app-helpers-outcomes_helper_rb.html +1 -1
  29. data/lib/branston/coverage/app-helpers-preconditions_helper_rb.html +1 -1
  30. data/lib/branston/coverage/app-helpers-releases_helper_rb.html +1 -1
  31. data/lib/branston/coverage/app-helpers-sessions_helper_rb.html +1 -1
  32. data/lib/branston/coverage/app-helpers-stories_helper_rb.html +1 -1
  33. data/lib/branston/coverage/app-helpers-user_roles_helper_rb.html +1 -1
  34. data/lib/branston/coverage/app-models-iteration_rb.html +1 -1
  35. data/lib/branston/coverage/app-models-outcome_rb.html +1 -1
  36. data/lib/branston/coverage/app-models-participation_rb.html +1 -1
  37. data/lib/branston/coverage/app-models-precondition_rb.html +1 -1
  38. data/lib/branston/coverage/app-models-release_rb.html +1 -1
  39. data/lib/branston/coverage/app-models-scenario_rb.html +1 -1
  40. data/lib/branston/coverage/app-models-story_rb.html +192 -18
  41. data/lib/branston/coverage/app-models-user_rb.html +33 -9
  42. data/lib/branston/coverage/app-models-user_role_rb.html +1 -1
  43. data/lib/branston/coverage/index.html +13 -13
  44. data/lib/branston/coverage/lib-client_rb.html +1 -1
  45. data/lib/branston/coverage/lib-faker_extras_rb.html +1 -1
  46. data/lib/branston/coverage/lib-story_generator_rb.html +1 -1
  47. data/lib/branston/db/development.sqlite3 +0 -0
  48. data/lib/branston/db/migrate/20091223100903_add_status_to_story.rb +11 -0
  49. data/lib/branston/db/pristine.sqlite3 +0 -0
  50. data/lib/branston/db/schema.rb +5 -3
  51. data/lib/branston/db/test.sqlite3 +0 -0
  52. data/lib/branston/lib/branston.rb +4 -2
  53. data/lib/branston/log/development.log +4970 -0
  54. data/lib/branston/log/test.log +88225 -0
  55. data/lib/branston/test/blueprints.rb +10 -7
  56. data/lib/branston/test/functional/scenarios_controller_test.rb +22 -15
  57. data/lib/branston/test/functional/stories_controller_test.rb +51 -30
  58. data/lib/branston/test/unit/story_test.rb +47 -7
  59. data/lib/branston/test/unit/user_test.rb +4 -0
  60. data/lib/branston/tmp/performance/BrowsingTest#test_homepage_process_time_flat.txt +3 -2
  61. data/lib/branston/tmp/performance/BrowsingTest#test_homepage_process_time_graph.html +2041 -1307
  62. data/lib/branston/tmp/performance/BrowsingTest#test_homepage_process_time_tree.txt +7922 -7922
  63. data/lib/branston/vendor/plugins/state_machine/CHANGELOG.rdoc +298 -0
  64. data/lib/branston/vendor/plugins/state_machine/LICENSE +20 -0
  65. data/lib/branston/vendor/plugins/state_machine/README.rdoc +466 -0
  66. data/lib/branston/vendor/plugins/state_machine/Rakefile +98 -0
  67. data/lib/branston/vendor/plugins/state_machine/examples/AutoShop_state.png +0 -0
  68. data/lib/branston/vendor/plugins/state_machine/examples/Car_state.png +0 -0
  69. data/lib/branston/vendor/plugins/state_machine/examples/TrafficLight_state.png +0 -0
  70. data/lib/branston/vendor/plugins/state_machine/examples/Vehicle_state.png +0 -0
  71. data/lib/branston/vendor/plugins/state_machine/examples/auto_shop.rb +11 -0
  72. data/lib/branston/vendor/plugins/state_machine/examples/car.rb +19 -0
  73. data/lib/branston/vendor/plugins/state_machine/examples/merb-rest/controller.rb +51 -0
  74. data/lib/branston/vendor/plugins/state_machine/examples/merb-rest/model.rb +28 -0
  75. data/lib/branston/vendor/plugins/state_machine/examples/merb-rest/view_edit.html.erb +24 -0
  76. data/lib/branston/vendor/plugins/state_machine/examples/merb-rest/view_index.html.erb +23 -0
  77. data/lib/branston/vendor/plugins/state_machine/examples/merb-rest/view_new.html.erb +13 -0
  78. data/lib/branston/vendor/plugins/state_machine/examples/merb-rest/view_show.html.erb +17 -0
  79. data/lib/branston/vendor/plugins/state_machine/examples/rails-rest/controller.rb +43 -0
  80. data/lib/branston/vendor/plugins/state_machine/examples/rails-rest/migration.rb +11 -0
  81. data/lib/branston/vendor/plugins/state_machine/examples/rails-rest/model.rb +23 -0
  82. data/lib/branston/vendor/plugins/state_machine/examples/rails-rest/view_edit.html.erb +25 -0
  83. data/lib/branston/vendor/plugins/state_machine/examples/rails-rest/view_index.html.erb +23 -0
  84. data/lib/branston/vendor/plugins/state_machine/examples/rails-rest/view_new.html.erb +14 -0
  85. data/lib/branston/vendor/plugins/state_machine/examples/rails-rest/view_show.html.erb +17 -0
  86. data/lib/branston/vendor/plugins/state_machine/examples/traffic_light.rb +7 -0
  87. data/lib/branston/vendor/plugins/state_machine/examples/vehicle.rb +31 -0
  88. data/lib/branston/vendor/plugins/state_machine/init.rb +1 -0
  89. data/lib/branston/vendor/plugins/state_machine/lib/state_machine/assertions.rb +36 -0
  90. data/lib/branston/vendor/plugins/state_machine/lib/state_machine/callback.rb +189 -0
  91. data/lib/branston/vendor/plugins/state_machine/lib/state_machine/condition_proxy.rb +94 -0
  92. data/lib/branston/vendor/plugins/state_machine/lib/state_machine/eval_helpers.rb +67 -0
  93. data/lib/branston/vendor/plugins/state_machine/lib/state_machine/event.rb +252 -0
  94. data/lib/branston/vendor/plugins/state_machine/lib/state_machine/event_collection.rb +122 -0
  95. data/lib/branston/vendor/plugins/state_machine/lib/state_machine/extensions.rb +149 -0
  96. data/lib/branston/vendor/plugins/state_machine/lib/state_machine/guard.rb +230 -0
  97. data/lib/branston/vendor/plugins/state_machine/lib/state_machine/integrations/active_record/locale.rb +11 -0
  98. data/lib/branston/vendor/plugins/state_machine/lib/state_machine/integrations/active_record/observer.rb +41 -0
  99. data/lib/branston/vendor/plugins/state_machine/lib/state_machine/integrations/active_record.rb +492 -0
  100. data/lib/branston/vendor/plugins/state_machine/lib/state_machine/integrations/data_mapper/observer.rb +139 -0
  101. data/lib/branston/vendor/plugins/state_machine/lib/state_machine/integrations/data_mapper.rb +351 -0
  102. data/lib/branston/vendor/plugins/state_machine/lib/state_machine/integrations/sequel.rb +322 -0
  103. data/lib/branston/vendor/plugins/state_machine/lib/state_machine/integrations.rb +68 -0
  104. data/lib/branston/vendor/plugins/state_machine/lib/state_machine/machine.rb +1467 -0
  105. data/lib/branston/vendor/plugins/state_machine/lib/state_machine/machine_collection.rb +155 -0
  106. data/lib/branston/vendor/plugins/state_machine/lib/state_machine/matcher.rb +123 -0
  107. data/lib/branston/vendor/plugins/state_machine/lib/state_machine/matcher_helpers.rb +54 -0
  108. data/lib/branston/vendor/plugins/state_machine/lib/state_machine/node_collection.rb +152 -0
  109. data/lib/branston/vendor/plugins/state_machine/lib/state_machine/state.rb +249 -0
  110. data/lib/branston/vendor/plugins/state_machine/lib/state_machine/state_collection.rb +112 -0
  111. data/lib/branston/vendor/plugins/state_machine/lib/state_machine/transition.rb +394 -0
  112. data/lib/branston/vendor/plugins/state_machine/lib/state_machine.rb +388 -0
  113. data/lib/branston/vendor/plugins/state_machine/state_machine.gemspec +30 -0
  114. data/lib/branston/vendor/plugins/state_machine/tasks/state_machine.rake +1 -0
  115. data/lib/branston/vendor/plugins/state_machine/tasks/state_machine.rb +30 -0
  116. data/lib/branston/vendor/plugins/state_machine/test/classes/switch.rb +11 -0
  117. data/lib/branston/vendor/plugins/state_machine/test/functional/state_machine_test.rb +941 -0
  118. data/lib/branston/vendor/plugins/state_machine/test/test_helper.rb +4 -0
  119. data/lib/branston/vendor/plugins/state_machine/test/unit/assertions_test.rb +40 -0
  120. data/lib/branston/vendor/plugins/state_machine/test/unit/callback_test.rb +455 -0
  121. data/lib/branston/vendor/plugins/state_machine/test/unit/condition_proxy_test.rb +328 -0
  122. data/lib/branston/vendor/plugins/state_machine/test/unit/eval_helpers_test.rb +120 -0
  123. data/lib/branston/vendor/plugins/state_machine/test/unit/event_collection_test.rb +326 -0
  124. data/lib/branston/vendor/plugins/state_machine/test/unit/event_test.rb +743 -0
  125. data/lib/branston/vendor/plugins/state_machine/test/unit/guard_test.rb +908 -0
  126. data/lib/branston/vendor/plugins/state_machine/test/unit/integrations/active_record_test.rb +1367 -0
  127. data/lib/branston/vendor/plugins/state_machine/test/unit/integrations/data_mapper_test.rb +962 -0
  128. data/lib/branston/vendor/plugins/state_machine/test/unit/integrations/sequel_test.rb +859 -0
  129. data/lib/branston/vendor/plugins/state_machine/test/unit/integrations_test.rb +42 -0
  130. data/lib/branston/vendor/plugins/state_machine/test/unit/invalid_event_test.rb +7 -0
  131. data/lib/branston/vendor/plugins/state_machine/test/unit/invalid_transition_test.rb +7 -0
  132. data/lib/branston/vendor/plugins/state_machine/test/unit/machine_collection_test.rb +938 -0
  133. data/lib/branston/vendor/plugins/state_machine/test/unit/machine_test.rb +2004 -0
  134. data/lib/branston/vendor/plugins/state_machine/test/unit/matcher_helpers_test.rb +37 -0
  135. data/lib/branston/vendor/plugins/state_machine/test/unit/matcher_test.rb +155 -0
  136. data/lib/branston/vendor/plugins/state_machine/test/unit/node_collection_test.rb +207 -0
  137. data/lib/branston/vendor/plugins/state_machine/test/unit/state_collection_test.rb +280 -0
  138. data/lib/branston/vendor/plugins/state_machine/test/unit/state_machine_test.rb +31 -0
  139. data/lib/branston/vendor/plugins/state_machine/test/unit/state_test.rb +795 -0
  140. data/lib/branston/vendor/plugins/state_machine/test/unit/transition_test.rb +1212 -0
  141. metadata +81 -2
@@ -2,7 +2,7 @@ class ScenariosController < ApplicationController
2
2
 
3
3
  layout 'main'
4
4
  before_filter :login_required
5
- before_filter :find_story, :except => [:destroy, :set_scenario_title]
5
+ before_filter :load_iteration_and_story, :except => [:set_scenario_title]
6
6
 
7
7
  in_place_edit_for :scenario, :title
8
8
 
@@ -53,7 +53,7 @@ class ScenariosController < ApplicationController
53
53
  if @scenario.save
54
54
  @scenarios = @story.scenarios
55
55
  flash[:notice] = 'Scenario was successfully created.'
56
- format.html { redirect_to story_scenario_path(@story, @scenario) }
56
+ format.html { redirect_to iteration_story_scenario_path(@iteration, @story, @scenario) }
57
57
  format.xml { render :xml => @scenario, :status => :created, :location => @scenario }
58
58
  format.js
59
59
  else
@@ -70,7 +70,7 @@ class ScenariosController < ApplicationController
70
70
  respond_to do |format|
71
71
  if @scenario.update_attributes(params[:scenario])
72
72
  flash[:notice] = 'Scenario was successfully updated.'
73
- format.html { redirect_to story_scenario_path(@story, @scenario) }
73
+ format.html { redirect_to iteration_story_scenario_path(@iteration, @story, @scenario) }
74
74
  format.xml { head :ok }
75
75
  else
76
76
  format.html { render :action => "edit" }
@@ -87,7 +87,7 @@ class ScenariosController < ApplicationController
87
87
  @scenario.destroy
88
88
 
89
89
  respond_to do |format|
90
- format.html { redirect_to(story_scenarios_path(@story)) }
90
+ format.html { redirect_to(iteration_story_scenarios_path(@iteration, @story)) }
91
91
  format.xml { head :ok }
92
92
  format.js
93
93
  end
@@ -96,8 +96,9 @@ class ScenariosController < ApplicationController
96
96
 
97
97
  private
98
98
 
99
- def find_story
99
+ def load_iteration_and_story
100
100
  @story = Story.find_by_slug(params[:story_id]) if @story.nil?
101
+ @iteration = Iteration.find(params[:iteration_id])
101
102
  end
102
103
 
103
104
  end
@@ -2,7 +2,8 @@ class StoriesController < ApplicationController
2
2
 
3
3
  layout 'main'
4
4
  before_filter :login_required, :except => [:show, :generate_feature]
5
- before_filter :retrieve_iterations, :only => [:new, :edit, :create, :update, :index, :show] # so everything?
5
+ before_filter :retrieve_iterations, :except => [:generate_feature, :show]
6
+ before_filter :load_iteration, :except => [:generate_feature, :show]
6
7
 
7
8
  in_place_edit_for :story, :title
8
9
  in_place_edit_for :story, :description
@@ -13,110 +14,121 @@ class StoriesController < ApplicationController
13
14
  if @story.nil?
14
15
  @story = Story.find(:first, :include => :scenarios,
15
16
  :conditions => ['slug LIKE ?', "%#{id}%"] )
17
+ end
18
+ @story.generate(@story)
19
+ render :text => 'done'
20
+ end
21
+
22
+ # GET /stories
23
+ # GET /stories.xml
24
+ def index
25
+ @current_stories = Story.for_iteration(@iteration.id).in_progress
26
+ @backlog_stories = Story.for_iteration(@iteration.id).unassigned
27
+ @completed_stories = Story.for_iteration(@iteration.id).completed
28
+
29
+ respond_to do |format|
30
+ format.html # index.html.erb
31
+ format.xml { render :xml => @stories }
32
+ end
33
+ end
34
+
35
+ # GET /stories/1
36
+ # GET /stories/1.xml
37
+ def show
38
+ @story = Story.find_by_slug(params[:id])
39
+
40
+ respond_to do |format|
41
+ if @story
42
+ format.html {
43
+ @iteration = load_iteration
44
+ }
45
+ format.xml {
46
+ render :xml => (@story.to_xml :include => { :scenarios => {
47
+ :include => [:preconditions, :outcomes] } } ) }
48
+ format.js { @active = true }
49
+ else
50
+ format.html {
51
+ @iteration = load_iteration
52
+ render_optional_error_file 404
53
+ }
54
+ format.all { render :nothing => true, :status => 404 }
55
+ end
16
56
  end
17
- @story.generate(@story)
18
- render :text => 'done'
19
57
  end
20
58
 
21
- # GET /stories
22
- # GET /stories.xml
23
- def index
24
- @current_stories = Story.in_progress
25
- @backlog_stories = Story.find :all, :conditions => "iteration_id IS NULL"
59
+ # GET /stories/new
60
+ # GET /stories/new.xml
61
+ def new
62
+ @story = Story.new(:iteration => @iteration)
26
63
 
27
64
  respond_to do |format|
28
- format.html # index.html.erb
29
- format.xml { render :xml => @stories }
65
+ format.html # new.html.erb
66
+ format.xml { render :xml => @story }
30
67
  end
31
68
  end
32
69
 
33
- # GET /stories/1
34
- # GET /stories/1.xml
35
- def show
70
+ # GET /stories/1/edit
71
+ def edit
36
72
  @story = Story.find_by_slug(params[:id])
37
-
38
- respond_to do |format|
39
- if @story
40
- format.html # show.html.erb
41
- format.xml {
42
- render :xml => (@story.to_xml :include => { :scenarios => {
43
- :include => [:preconditions, :outcomes] } } ) }
44
- format.js { @active = true }
45
- else
46
- format.html { render_optional_error_file 404 }
47
- format.all { render :nothing => true, :status => 404 }
48
- end
49
- end
50
- end
51
-
52
- # GET /stories/new
53
- # GET /stories/new.xml
54
- def new
55
- @story = Story.new
56
-
57
- respond_to do |format|
58
- format.html # new.html.erb
59
- format.xml { render :xml => @story }
60
- end
61
- end
62
-
63
- # GET /stories/1/edit
64
- def edit
65
- @story = Story.find_by_slug(params[:id])
66
- end
67
-
68
- # POST /stories
69
- # POST /stories.xml
70
- def create
71
- @story = Story.new(params[:story])
72
-
73
- respond_to do |format|
74
- if @story.save
75
- flash[:notice] = 'Story was successfully created.'
76
- format.html { redirect_to stories_url }
77
- format.xml { render :xml => @story, :status => :created, :location => @story }
78
- else
79
- format.html { render :action => "new" }
80
- format.xml { render :xml => @story.errors, :status => :unprocessable_entity }
81
- end
82
- end
83
- end
73
+ end
74
+
75
+ # POST /stories
76
+ # POST /stories.xml
77
+ def create
78
+ @story = Story.new(params[:story])
79
+ @story.author = current_user
84
80
 
85
- # PUT /stories/1
86
- # PUT /stories/1.xml
87
- def update
88
- @story = Story.find_by_slug(params[:id])
89
- respond_to do |format|
90
- if @story.update_attributes(params[:story])
91
- flash[:notice] = 'Story was successfully updated.'
92
- format.html { redirect_to(@story) }
93
- format.xml { head :ok }
94
- format.js { redirect_to stories_path }
95
- else
96
- format.html { render :action => "edit" }
97
- format.xml { render :xml => @story.errors, :status => :unprocessable_entity }
98
- end
81
+ respond_to do |format|
82
+ if @story.save
83
+ flash[:notice] = 'Story was successfully created.'
84
+ format.html { redirect_to iteration_stories_url(@iteration) }
85
+ format.xml { render :xml => @story, :status => :created, :location => @story }
86
+ else
87
+ format.html { render :action => "new" }
88
+ format.xml { render :xml => @story.errors, :status => :unprocessable_entity }
99
89
  end
100
90
  end
101
-
102
- # DELETE /stories/1
103
- # DELETE /stories/1.xml
104
- def destroy
105
- @story = Story.find_by_slug(params[:id])
106
- @story.destroy
107
-
108
- respond_to do |format|
109
- format.html { redirect_to(stories_url) }
91
+ end
92
+
93
+ # PUT /stories/1
94
+ # PUT /stories/1.xml
95
+ def update
96
+ @story = Story.find_by_slug(params[:id])
97
+ respond_to do |format|
98
+ if @story.update_attributes(params[:story])
99
+ flash[:notice] = 'Story was successfully updated.'
100
+ format.html { redirect_to iteration_story_path(@iteration, @story) }
110
101
  format.xml { head :ok }
102
+ format.js { redirect_to iteration_stories_path(@iteration) }
103
+ else
104
+ format.html { render :action => "edit" }
105
+ format.xml { render :xml => @story.errors, :status => :unprocessable_entity }
111
106
  end
112
107
  end
108
+ end
109
+
110
+ # DELETE /stories/1
111
+ # DELETE /stories/1.xml
112
+ def destroy
113
+ @story = Story.find_by_slug(params[:id])
114
+ @story.destroy
113
115
 
114
-
115
- private
116
-
117
- def retrieve_iterations
118
- @iterations = Iteration.all
116
+ respond_to do |format|
117
+ format.html { redirect_to iteration_stories_path(@iteration) }
118
+ format.xml { head :ok }
119
119
  end
120
-
121
120
  end
121
+
122
+
123
+ private
124
+
125
+ def retrieve_iterations
126
+ @iterations = Iteration.all
127
+ end
128
+
129
+ def load_iteration
130
+ @iteration = Iteration.find(params[:iteration_id])
131
+ end
132
+ end
133
+
122
134
 
@@ -16,10 +16,39 @@ class Story < ActiveRecord::Base
16
16
 
17
17
  # Named scopes
18
18
  #
19
- named_scope :in_progress, :conditions => ['iteration_id IS NOT ?', nil]
19
+ named_scope :unassigned, :conditions => 'status = "new"'
20
+ named_scope :in_progress, :conditions => 'status = "in_progress"'
21
+ named_scope :completed, :conditions => 'status = "completed"'
22
+ named_scope :for_iteration, lambda { |id| { :conditions => ['iteration_id = ?',
23
+ id] } }
20
24
 
21
25
  before_save :set_slug
22
26
 
27
+ # Story states
28
+ # New - A story that has been drafted, but is not being worked on
29
+ # In Progress - A story that is being actioned by a member of the development
30
+ # team
31
+ # Completed - A story that has been implemented and tested by the development
32
+ # team
33
+ #
34
+ state_machine :status, :initial => :new do
35
+ state :new
36
+ state :in_progress
37
+ state :completed
38
+
39
+ event :assign do
40
+ transition :new => :in_progress
41
+ end
42
+
43
+ event :finish do
44
+ transition :in_progress => :completed
45
+ end
46
+
47
+ after_transition any => :completed do |story, transition|
48
+ story.completed_date = Date.today
49
+ end
50
+ end
51
+
23
52
  def to_param
24
53
  title.parameterize
25
54
  end
@@ -48,6 +48,10 @@ class User < ActiveRecord::Base
48
48
  def email=(value)
49
49
  write_attribute :email, (value ? value.downcase : nil)
50
50
  end
51
+
52
+ def to_s
53
+ login
54
+ end
51
55
 
52
56
  protected
53
57
 
@@ -19,7 +19,7 @@
19
19
  <td><%=h iteration.start_date.strftime('%d/%m/%Y') unless iteration.start_date.nil? %></td>
20
20
  <td><%=h iteration.end_date.strftime('%d/%m/%Y') unless iteration.end_date.nil? %></td>
21
21
  <td>
22
- <%= link_to 'Show', iteration %>&nbsp;&nbsp;&bull;
22
+ <%=link_to 'Stories', iteration_stories_path(iteration) %>&nbsp;&nbsp;&bull;
23
23
  <%= link_to 'Edit', edit_iteration_path(iteration) %>&nbsp;&nbsp;&bull;
24
24
  <%= link_to 'Destroy', iteration, :confirm => 'Are you sure you want to delete this iteration?', :method => :delete %>
25
25
  </td>
@@ -1,6 +1,6 @@
1
1
  <!-- layouts/_header.html.erb -->
2
2
  <div id="logo">
3
- <h1><a href="#">Branston </a></h1>
3
+ <h1><a href="#">Branston</a></h1>
4
4
  <p><em> Small chunk pickle</em></p>
5
5
  </div>
6
6
  <hr />
@@ -11,7 +11,6 @@
11
11
  <li <%= tab_on("overview") %>><a href="/" class="first">Overview</a></li>
12
12
  <li <%= tab_on("releases") %>><a href="/releases">Releases</a></li>
13
13
  <li <%= tab_on("iterations") %>><a href="/iterations">Iterations</a></li>
14
- <li <%= tab_on("stories") %>><a href="/stories">Stories</a></li>
15
14
  </ul>
16
15
  </div>
17
16
  <!-- end #menu -->
@@ -1,16 +1,19 @@
1
1
  <!-- scenarios/_scenario.html.erb -->
2
2
  <div id="<%= element_id(@scenario) %>" class="scenario">
3
3
  <% if @scenario.created_at.nil? -%>
4
- <% remote_form_for :scenario, @scenario, :url => story_scenarios_path(@story) do |f| -%>
4
+ <% remote_form_for :scenario, @scenario, :url => iteration_story_scenarios_path(@iteration, @story) do |f| -%>
5
5
  <div class="scenario-form">
6
- <%= f.text_area :title, :value => "Add a scenario description here.", :size => '58x2' %>
6
+ <%= f.text_area :title, :value => "Add a scenario description here.",
7
+ :size => '58x2' %>
7
8
  <%= f.submit 'Save' %>
8
9
  </div>
9
10
  <% end -%>
10
11
  <% else -%>
11
12
  <div class="scenario-title">
12
13
  <%= in_place_editor_field 'scenario', 'title' %>
13
- <%= link_to_remote image_tag("/images/icons/delete_icon_20x19.png", :alt => "Delete"), {:url => story_scenario_path(@story,@scenario), :confirm => 'Delete this scenario?', :method => :delete}, :class => "delete-small" %>
14
+ <%= link_to_remote image_tag("/images/icons/delete_icon_20x19.png", :alt => "Delete"),
15
+ {:url => iteration_story_scenario_path(@iteration, @story,@scenario),
16
+ :confirm => 'Delete this scenario?', :method => :delete}, :class => "delete-small" %>
14
17
  </div>
15
18
  <div id="<%= element_id(@scenario,'preconditions') %>" class="preconditions">
16
19
  <%= link_to_remote "Preconditions",
@@ -1,7 +1,8 @@
1
1
  <!-- scenarios/_scenario.html.erb -->
2
2
  <div class="scenarios-head">
3
3
  <h4>Story scenarios</h4>
4
- <%= link_to_remote 'Add scenario', {:url => new_story_scenario_path(@story), :method => 'GET'}, :class => 'add-small' %>
4
+ <%= link_to_remote 'Add scenario', { :url => new_iteration_story_scenario_path(@iteration, @story),
5
+ :method => 'GET'}, :class => 'add-small' %>
5
6
  </div>
6
7
  <div class="scenarios">
7
8
  <% @scenarios.each do |scenario| %>
@@ -10,7 +11,8 @@
10
11
  <% end %>
11
12
  </div>
12
13
  <div class="scenarios-foot">
13
- <%= link_to_remote '&laquo; Back to story overview', {:url => story_path(@story), :method => 'GET'},
14
+ <%= link_to_remote '&laquo; Back to story overview', {
15
+ :url => iteration_story_path(@iteration, @story), :method => 'GET'},
14
16
  :class => 'back-small' %>
15
17
  </div>
16
18
 
@@ -6,12 +6,23 @@
6
6
  <%= f.label :description %>
7
7
  <%= f.text_area :description, :size => "60x8" %>
8
8
  </p>
9
+ <% unless params[:action] = "new" %>
9
10
  <p class="form-fields">
10
- <%= f.label :points %>
11
- <%= f.select :points, (1..10).to_a %>
11
+ <%= f.label :status %>
12
+ <%= f.select :status, ['new', 'in_progress', 'completed'] %>
12
13
  </p>
14
+ <% end %>
13
15
  <p class="form-fields">
14
- <%= f.label :iteration %>
15
- <%= f.select :iteration_id, @iterations.map {|iteration| [iteration.name, iteration.id]}.insert(0,["Not Assigned",'']) %>
16
+ <%= f.label :points %>
17
+ <%= f.select :points, (1..10).to_a %>
16
18
  </p>
19
+ <% unless params[:action] = "new" %>
20
+ <p class="form-fields">
21
+ <%= f.label :iteration %>
22
+ <%= f.select :iteration_id, @iterations.map {|iteration| [iteration.name, iteration.id]}.insert(0,["Not Assigned",'']) %>
23
+ </p>
24
+ <% else %>
25
+ <%=f.hidden_field :iteration_id %>
26
+ <% end %>
27
+
17
28
 
@@ -2,28 +2,45 @@
2
2
  <% @story = story -%>
3
3
  <div id="<%= element_id(story) %>" class="story">
4
4
  <div class="accordion-toggle<%= ' accordion-toggle-active' if @active %>">
5
- <%= in_place_editor_field 'story', 'title' %>
6
- <%= link_to image_tag("/images/icons/delete_icon_20x19.png", :alt => "Delete"), story, :confirm => 'Delete this story?', :method => :delete, :class => "delete-small" %>
5
+ <%= in_place_editor_field 'story', 'title', {}, :url => {
6
+ :action => "set_story_title", :id => @story.id,
7
+ :iteration_id => @iteration.to_param } %>
8
+ <%= link_to image_tag("/images/icons/delete_icon_20x19.png", :alt => "Delete"),
9
+ iteration_story_path(@iteration, @story), :confirm => 'Delete this story?',
10
+ :method => :delete, :class => "delete-small" %>
11
+ <div style="clear:left">By <%=@story.author%></div>
7
12
  </div>
13
+
8
14
  <div id="<%= element_id(story,'scenarios') %>" class="accordion-content">
9
15
  <div class="story-props">
10
- <% remote_form_for :story, @story, :url => "#{story_path(@story)}.js" do |f| -%>
16
+ <% remote_form_for :story, @story, :url => "#{iteration_story_path(@iteration, @story)}.js" do |f| -%>
11
17
  <%= hidden_field_tag '_method', 'PUT' %>
12
18
  <%= hidden_field_tag 'id', @story.id %>
13
19
  <div>
14
20
  <%= f.select :points, (1..10).to_a, {}, :id => element_id(@story,'points') %> Points
15
21
  </div>
16
- <% unless @iterations.nil? or @iterations.size == 0 -%>
17
22
  <div>
18
- <%= f.select :iteration_id, @iterations.map{|i|[i.name,i.id]}, {:prompt => "Assign Iteration"}, :id => element_id(@story,'iterations') %>
23
+ <%= f.label :status %>
24
+ <%= f.select :status, ['new', 'in_progress', 'completed'], {},
25
+ :id => element_id(@story, 'status') %>
26
+ </div>
27
+ <% unless @iterations.empty? -%>
28
+ <div>
29
+ <%= f.label :iteration_id, "Iteration" %>
30
+ <%= f.select :iteration_id, @iterations.map{|i|[i.name,i.id]},
31
+ {:prompt => "Assign Iteration"}, :id => element_id(@story,'iterations') %>
19
32
  </div>
20
33
  <% end -%>
21
34
  <% end -%>
22
- <div><%= link_to_remote "Scenarios &raquo;", :url => story_scenarios_path(@story), :method => 'GET' %></div>
23
35
  </div>
24
36
  <p>
25
37
  <%= in_place_editor_field 'story', 'description' %>
26
38
  </p>
39
+
40
+ <div>
41
+ <%= link_to_remote "Scenarios &raquo;", :method => 'GET',
42
+ :url => iteration_story_scenarios_path(@iteration, @story) %>
43
+ </div>
27
44
  </div>
28
45
  </div>
29
46
 
@@ -31,7 +48,10 @@
31
48
  <script type="text/javascript">
32
49
  document.observe("dom:loaded", function() {
33
50
  $("<%= element_id(@story, 'points') %>").observe("change", Util.Form.selectChange);
51
+ <% unless @iterations.empty? %>
34
52
  $("<%= element_id(@story, 'iterations') %>").observe("change", Util.Form.selectChange);
53
+ <% end %>
54
+ $("<%= element_id(@story, 'status') %>").observe("change", Util.Form.selectChange);
35
55
  });
36
56
  </script>
37
57
  <% end -%>
@@ -1,13 +1,13 @@
1
1
  <h1>Editing story</h1>
2
2
 
3
- <% form_for(@story) do |f| %>
3
+ <% form_for @story, :url => iteration_story_path(@iteration, @story) do |f| %>
4
4
  <%= f.error_messages %>
5
5
 
6
6
  <%= render :partial => 'form', :locals => {:f => f} %>
7
7
 
8
8
  <p class="form-navigation">
9
- <%= link_to 'Show', @story %>
10
- <%= link_to 'Back', stories_path, :class => "back" %>
9
+ <%= link_to 'Show', iteration_story_path(@iteration, @story) %>
10
+ <%= link_to 'Back', iteration_stories_path(@iteration), :class => "back" %>
11
11
  <%= f.submit 'Update' %>
12
12
  </p>
13
13
  <% end %>
@@ -1,6 +1,6 @@
1
1
  <div class="index-head">
2
- <h2>User Stories</h2>
3
- <%= link_to 'New story', new_story_path, :class => "add" %>
2
+ <h2>Iteration #<%=@iteration.name%> Stories</h2>
3
+ <%= link_to 'New story', new_iteration_story_path(@iteration), :class => "add" %>
4
4
  </div>
5
5
 
6
6
  <% content_for :page_end do %>
@@ -44,9 +44,28 @@ document.observe("dom:loaded", function() {
44
44
  <div id="backlog-wrapper">
45
45
  <h3>Story Backlog</h3>
46
46
  <div id="backlog_stories" class="accordion">
47
- <% @backlog_stories.each do |story| %>
47
+ <% if @backlog_stories.empty? %>
48
+ <%=link_to "Write some more!", new_iteration_story_path(@iteration) %>
49
+ <% else %>
50
+ <% @backlog_stories.each do |story| %>
51
+ <%= render :partial => "story", :locals => { :story => story } %>
52
+ <% end %>
53
+ <% end %>
54
+ </div>
55
+ </div>
56
+
57
+ <% unless @completed_stories.empty? %>
58
+
59
+ <div style="clear:both">
60
+ </div>
61
+
62
+ <div id="current-wrapper">
63
+ <h3>Completed Stories</h3>
64
+ <div id="completed_stories" class="accordion">
65
+ <% @completed_stories.each do |story| %>
48
66
  <%= render :partial => "story", :locals => { :story => story } %>
49
67
  <% end %>
50
68
  </div>
51
69
  </div>
52
70
 
71
+ <% end %>
@@ -1,12 +1,12 @@
1
1
  <h2>New story</h2>
2
2
 
3
- <% form_for(@story) do |f| %>
3
+ <% form_for @story, :url => iteration_stories_path(@iteration) do |f| %>
4
4
  <%= f.error_messages %>
5
5
 
6
6
  <%= render :partial => 'form', :locals => {:f => f} %>
7
7
 
8
8
  <p class="form-navigation">
9
- <%= link_to 'Back', stories_path, :class => "back" %>
9
+ <%= link_to 'Back', iteration_stories_path(@iteration), :class => "back" %>
10
10
  <%= f.submit 'Create' %>
11
11
  </p>
12
12
  <% end %>
@@ -14,10 +14,10 @@
14
14
  </p>
15
15
 
16
16
  <%= link_to_remote 'Generate Story', :update => "output",
17
- :url => generate_feature_story_path, :method => 'get' %>
17
+ :url => generate_feature_iteration_story_path(@iteration, @story), :method => 'get' %>
18
18
 
19
19
  <span id="output"></span> |
20
20
 
21
- <%= link_to 'Edit', edit_story_path(@story) %> |
22
- <%= link_to 'Back', stories_path %>
21
+ <%= link_to 'Edit', edit_iteration_story_path(@iteration, @story) %> |
22
+ <%= link_to 'Back', iteration_stories_path(@iteration) %>
23
23
 
@@ -4,12 +4,15 @@ ActionController::Routing::Routes.draw do |map|
4
4
  map.resources :preconditions
5
5
 
6
6
  map.resources :releases
7
- map.resources :iterations
7
+ map.resources :iterations, :except => 'show' do |i|
8
+ i.resources :stories, :member => { :generate_feature => :get } do |r|
9
+ r.resources :scenarios
10
+ end
11
+ end
12
+
13
+ map.client_generate '/stories/:id.:format', :controller => 'stories', :action => 'show'
8
14
 
9
15
  map.resources :user_roles
10
- map.resources :stories, :member => { :generate_feature => :get } do |r|
11
- r.resources :scenarios
12
- end
13
16
 
14
17
  map.logout '/logout', :controller => 'sessions', :action => 'destroy'
15
18
  map.login '/login', :controller => 'sessions', :action => 'new'
@@ -135,7 +135,7 @@
135
135
  </tbody>
136
136
  </table>
137
137
 
138
- <p>Generated on Fri Dec 11 11:38:48 +0000 2009 with <a href="http://github.com/relevance/rcov">rcov 0.9.2.1</a></p>
138
+ <p>Generated on Wed Dec 23 14:36:07 +0000 2009 with <a href="http://github.com/relevance/rcov">rcov 0.9.2.1</a></p>
139
139
 
140
140
  </body>
141
141
  </html>
@@ -693,7 +693,7 @@
693
693
  </tbody>
694
694
  </table>
695
695
 
696
- <p>Generated on Fri Dec 11 11:38:48 +0000 2009 with <a href="http://github.com/relevance/rcov">rcov 0.9.2.1</a></p>
696
+ <p>Generated on Wed Dec 23 14:36:07 +0000 2009 with <a href="http://github.com/relevance/rcov">rcov 0.9.2.1</a></p>
697
697
 
698
698
  </body>
699
699
  </html>
@@ -669,7 +669,7 @@
669
669
  </tbody>
670
670
  </table>
671
671
 
672
- <p>Generated on Fri Dec 11 11:38:48 +0000 2009 with <a href="http://github.com/relevance/rcov">rcov 0.9.2.1</a></p>
672
+ <p>Generated on Wed Dec 23 14:36:07 +0000 2009 with <a href="http://github.com/relevance/rcov">rcov 0.9.2.1</a></p>
673
673
 
674
674
  </body>
675
675
  </html>
@@ -693,7 +693,7 @@
693
693
  </tbody>
694
694
  </table>
695
695
 
696
- <p>Generated on Fri Dec 11 11:38:48 +0000 2009 with <a href="http://github.com/relevance/rcov">rcov 0.9.2.1</a></p>
696
+ <p>Generated on Wed Dec 23 14:36:07 +0000 2009 with <a href="http://github.com/relevance/rcov">rcov 0.9.2.1</a></p>
697
697
 
698
698
  </body>
699
699
  </html>
@@ -615,7 +615,7 @@
615
615
  </tbody>
616
616
  </table>
617
617
 
618
- <p>Generated on Fri Dec 11 11:38:48 +0000 2009 with <a href="http://github.com/relevance/rcov">rcov 0.9.2.1</a></p>
618
+ <p>Generated on Wed Dec 23 14:36:07 +0000 2009 with <a href="http://github.com/relevance/rcov">rcov 0.9.2.1</a></p>
619
619
 
620
620
  </body>
621
621
  </html>