branston 0.6.1 → 0.6.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +1 -1
- data/lib/branston/Gemfile +25 -0
- data/lib/branston/Gemfile.lock +76 -0
- data/lib/branston/app/controllers/application_controller.rb +1 -1
- data/lib/branston/app/controllers/outcomes_controller.rb +2 -0
- data/lib/branston/app/controllers/stories_controller.rb +82 -86
- data/lib/branston/app/controllers/users_controller.rb +69 -11
- data/lib/branston/app/helpers/iterations_helper.rb +13 -13
- data/lib/branston/app/models/iteration.rb +3 -1
- data/lib/branston/app/models/release.rb +0 -1
- data/lib/branston/app/models/story.rb +30 -28
- data/lib/branston/app/models/user.rb +46 -1
- data/lib/branston/app/views/layouts/_header.html.erb +8 -3
- data/lib/branston/app/views/layouts/user_roles.html.erb +5 -5
- data/lib/branston/app/views/sessions/new.html.erb +8 -14
- data/lib/branston/app/views/users/_admin_controls.html.erb +14 -0
- data/lib/branston/app/views/users/_form.html.erb +27 -0
- data/lib/branston/app/views/users/edit.html.erb +9 -0
- data/lib/branston/app/views/users/index.html.erb +14 -0
- data/lib/branston/app/views/users/new.html.erb +3 -22
- data/lib/branston/config/boot.rb +20 -0
- data/lib/branston/config/environment.rb +2 -7
- data/lib/branston/config/environments/test.rb +0 -8
- data/lib/branston/config/preinitializer.rb +21 -0
- data/lib/branston/config/routes.rb +15 -10
- data/lib/branston/db/development.sqlite3 +0 -0
- data/lib/branston/db/development_structure.sql +21 -8
- data/lib/branston/db/migrate/20100723161424_add_state_to_user.rb +12 -0
- data/lib/branston/db/migrate/20100726150322_add_activation_fields_to_user.rb +12 -0
- data/lib/branston/db/migrate/20100729125551_set_default_user_state_to_pending.rb +10 -0
- data/lib/branston/db/migrate/20100812133837_add_is_admin_property_to_user.rb +10 -0
- data/lib/branston/db/migrate/20100812140532_set_default_user_state_to_active.rb +10 -0
- data/lib/branston/db/migrate/20100812143455_add_default_admin_user.rb +17 -0
- data/lib/branston/db/migrate/20110408162438_remove_is_admin_property_and_add_role_instead.rb +12 -0
- data/lib/branston/db/pristine.sqlite3 +0 -0
- data/lib/branston/db/schema.rb +6 -8
- data/lib/branston/db/test.sqlite3 +0 -0
- data/lib/branston/log/development.log +1181 -433
- data/lib/branston/log/test.log +145306 -52026
- data/lib/branston/test/blueprints.rb +22 -28
- data/lib/branston/test/functional/iterations_controller_test.rb +149 -113
- data/lib/branston/test/functional/outcomes_controller_test.rb +94 -60
- data/lib/branston/test/functional/preconditions_controller_test.rb +101 -67
- data/lib/branston/test/functional/releases_controller_test.rb +85 -49
- data/lib/branston/test/functional/scenarios_controller_test.rb +104 -70
- data/lib/branston/test/functional/stories_controller_test.rb +41 -12
- data/lib/branston/test/functional/users_controller_test.rb +364 -43
- data/lib/branston/test/unit/iteration_test.rb +37 -6
- data/lib/branston/test/unit/outcome_test.rb +2 -2
- data/lib/branston/test/unit/participation_test.rb +2 -2
- data/lib/branston/test/unit/precondition_test.rb +3 -3
- data/lib/branston/test/unit/release_test.rb +4 -0
- data/lib/branston/test/unit/scenario_test.rb +4 -4
- data/lib/branston/test/unit/story_test.rb +62 -40
- data/lib/branston/test/unit/user_test.rb +195 -5
- metadata +136 -156
- data/lib/branston/app/controllers/user_roles_controller.rb +0 -105
- data/lib/branston/app/helpers/user_roles_helper.rb +0 -2
- data/lib/branston/app/models/user_role.rb +0 -21
- data/lib/branston/app/views/layouts/outcomes.html.erb +0 -17
- data/lib/branston/app/views/layouts/preconditions.html.erb +0 -17
- data/lib/branston/app/views/layouts/releases.html.erb +0 -17
- data/lib/branston/app/views/user_roles/edit.html.erb +0 -16
- data/lib/branston/app/views/user_roles/index.html.erb +0 -20
- data/lib/branston/app/views/user_roles/new.html.erb +0 -15
- data/lib/branston/app/views/user_roles/show.html.erb +0 -8
- data/lib/branston/coverage/app-controllers-application_controller_rb.html +0 -231
- data/lib/branston/coverage/app-controllers-iterations_controller_rb.html +0 -801
- data/lib/branston/coverage/app-controllers-outcomes_controller_rb.html +0 -759
- data/lib/branston/coverage/app-controllers-preconditions_controller_rb.html +0 -783
- data/lib/branston/coverage/app-controllers-releases_controller_rb.html +0 -705
- data/lib/branston/coverage/app-controllers-scenarios_controller_rb.html +0 -777
- data/lib/branston/coverage/app-controllers-sessions_controller_rb.html +0 -411
- data/lib/branston/coverage/app-controllers-stories_controller_rb.html +0 -1071
- data/lib/branston/coverage/app-controllers-user_roles_controller_rb.html +0 -693
- data/lib/branston/coverage/app-controllers-users_controller_rb.html +0 -315
- data/lib/branston/coverage/app-helpers-application_helper_rb.html +0 -327
- data/lib/branston/coverage/app-helpers-iterations_helper_rb.html +0 -363
- data/lib/branston/coverage/app-helpers-outcomes_helper_rb.html +0 -75
- data/lib/branston/coverage/app-helpers-preconditions_helper_rb.html +0 -75
- data/lib/branston/coverage/app-helpers-releases_helper_rb.html +0 -75
- data/lib/branston/coverage/app-helpers-sessions_helper_rb.html +0 -75
- data/lib/branston/coverage/app-helpers-stories_helper_rb.html +0 -75
- data/lib/branston/coverage/app-helpers-user_roles_helper_rb.html +0 -75
- data/lib/branston/coverage/app-models-iteration_rb.html +0 -321
- data/lib/branston/coverage/app-models-outcome_rb.html +0 -243
- data/lib/branston/coverage/app-models-participation_rb.html +0 -189
- data/lib/branston/coverage/app-models-precondition_rb.html +0 -243
- data/lib/branston/coverage/app-models-release_rb.html +0 -195
- data/lib/branston/coverage/app-models-scenario_rb.html +0 -231
- data/lib/branston/coverage/app-models-story_rb.html +0 -621
- data/lib/branston/coverage/app-models-user_rb.html +0 -513
- data/lib/branston/coverage/app-models-user_role_rb.html +0 -189
- data/lib/branston/coverage/index.html +0 -570
- data/lib/branston/coverage/jquery-1.3.2.min.js +0 -19
- data/lib/branston/coverage/jquery.tablesorter.min.js +0 -15
- data/lib/branston/coverage/lib-client_rb.html +0 -537
- data/lib/branston/coverage/lib-faker_extras_rb.html +0 -207
- data/lib/branston/coverage/lib-story_generator_rb.html +0 -873
- data/lib/branston/coverage/print.css +0 -12
- data/lib/branston/coverage/rcov.js +0 -42
- data/lib/branston/coverage/screen.css +0 -270
- data/lib/branston/db/migrate/20091127131037_create_user_roles.rb +0 -13
- data/lib/branston/db/migrate/20091127172950_add_story_id_to_user_role.rb +0 -10
- data/lib/branston/test/functional/user_roles_controller_test.rb +0 -71
- data/lib/branston/test/unit/helpers/user_roles_helper_test.rb +0 -4
- data/lib/branston/test/unit/user_role_test.rb +0 -9
- data/lib/branston/tmp/performance/BrowsingTest#test_homepage_process_time_flat.txt +0 -8
- data/lib/branston/tmp/performance/BrowsingTest#test_homepage_process_time_graph.html +0 -6718
- data/lib/branston/tmp/performance/BrowsingTest#test_homepage_process_time_tree.txt +0 -9942
- data/lib/branston/vendor/plugins/state_machine/CHANGELOG.rdoc +0 -298
- data/lib/branston/vendor/plugins/state_machine/LICENSE +0 -20
- data/lib/branston/vendor/plugins/state_machine/README.rdoc +0 -466
- data/lib/branston/vendor/plugins/state_machine/Rakefile +0 -98
- data/lib/branston/vendor/plugins/state_machine/examples/AutoShop_state.png +0 -0
- data/lib/branston/vendor/plugins/state_machine/examples/Car_state.png +0 -0
- data/lib/branston/vendor/plugins/state_machine/examples/TrafficLight_state.png +0 -0
- data/lib/branston/vendor/plugins/state_machine/examples/Vehicle_state.png +0 -0
- data/lib/branston/vendor/plugins/state_machine/examples/auto_shop.rb +0 -11
- data/lib/branston/vendor/plugins/state_machine/examples/car.rb +0 -19
- data/lib/branston/vendor/plugins/state_machine/examples/merb-rest/controller.rb +0 -51
- data/lib/branston/vendor/plugins/state_machine/examples/merb-rest/model.rb +0 -28
- data/lib/branston/vendor/plugins/state_machine/examples/merb-rest/view_edit.html.erb +0 -24
- data/lib/branston/vendor/plugins/state_machine/examples/merb-rest/view_index.html.erb +0 -23
- data/lib/branston/vendor/plugins/state_machine/examples/merb-rest/view_new.html.erb +0 -13
- data/lib/branston/vendor/plugins/state_machine/examples/merb-rest/view_show.html.erb +0 -17
- data/lib/branston/vendor/plugins/state_machine/examples/rails-rest/controller.rb +0 -43
- data/lib/branston/vendor/plugins/state_machine/examples/rails-rest/migration.rb +0 -11
- data/lib/branston/vendor/plugins/state_machine/examples/rails-rest/model.rb +0 -23
- data/lib/branston/vendor/plugins/state_machine/examples/rails-rest/view_edit.html.erb +0 -25
- data/lib/branston/vendor/plugins/state_machine/examples/rails-rest/view_index.html.erb +0 -23
- data/lib/branston/vendor/plugins/state_machine/examples/rails-rest/view_new.html.erb +0 -14
- data/lib/branston/vendor/plugins/state_machine/examples/rails-rest/view_show.html.erb +0 -17
- data/lib/branston/vendor/plugins/state_machine/examples/traffic_light.rb +0 -7
- data/lib/branston/vendor/plugins/state_machine/examples/vehicle.rb +0 -31
- data/lib/branston/vendor/plugins/state_machine/init.rb +0 -1
- data/lib/branston/vendor/plugins/state_machine/lib/state_machine.rb +0 -388
- data/lib/branston/vendor/plugins/state_machine/lib/state_machine/assertions.rb +0 -36
- data/lib/branston/vendor/plugins/state_machine/lib/state_machine/callback.rb +0 -189
- data/lib/branston/vendor/plugins/state_machine/lib/state_machine/condition_proxy.rb +0 -94
- data/lib/branston/vendor/plugins/state_machine/lib/state_machine/eval_helpers.rb +0 -67
- data/lib/branston/vendor/plugins/state_machine/lib/state_machine/event.rb +0 -252
- data/lib/branston/vendor/plugins/state_machine/lib/state_machine/event_collection.rb +0 -122
- data/lib/branston/vendor/plugins/state_machine/lib/state_machine/extensions.rb +0 -149
- data/lib/branston/vendor/plugins/state_machine/lib/state_machine/guard.rb +0 -230
- data/lib/branston/vendor/plugins/state_machine/lib/state_machine/integrations.rb +0 -68
- data/lib/branston/vendor/plugins/state_machine/lib/state_machine/integrations/active_record.rb +0 -492
- data/lib/branston/vendor/plugins/state_machine/lib/state_machine/integrations/active_record/locale.rb +0 -11
- data/lib/branston/vendor/plugins/state_machine/lib/state_machine/integrations/active_record/observer.rb +0 -41
- data/lib/branston/vendor/plugins/state_machine/lib/state_machine/integrations/data_mapper.rb +0 -351
- data/lib/branston/vendor/plugins/state_machine/lib/state_machine/integrations/data_mapper/observer.rb +0 -139
- data/lib/branston/vendor/plugins/state_machine/lib/state_machine/integrations/sequel.rb +0 -322
- data/lib/branston/vendor/plugins/state_machine/lib/state_machine/machine.rb +0 -1467
- data/lib/branston/vendor/plugins/state_machine/lib/state_machine/machine_collection.rb +0 -155
- data/lib/branston/vendor/plugins/state_machine/lib/state_machine/matcher.rb +0 -123
- data/lib/branston/vendor/plugins/state_machine/lib/state_machine/matcher_helpers.rb +0 -54
- data/lib/branston/vendor/plugins/state_machine/lib/state_machine/node_collection.rb +0 -152
- data/lib/branston/vendor/plugins/state_machine/lib/state_machine/state.rb +0 -249
- data/lib/branston/vendor/plugins/state_machine/lib/state_machine/state_collection.rb +0 -112
- data/lib/branston/vendor/plugins/state_machine/lib/state_machine/transition.rb +0 -394
- data/lib/branston/vendor/plugins/state_machine/state_machine.gemspec +0 -30
- data/lib/branston/vendor/plugins/state_machine/tasks/state_machine.rake +0 -1
- data/lib/branston/vendor/plugins/state_machine/tasks/state_machine.rb +0 -30
- data/lib/branston/vendor/plugins/state_machine/test/classes/switch.rb +0 -11
- data/lib/branston/vendor/plugins/state_machine/test/functional/state_machine_test.rb +0 -941
- data/lib/branston/vendor/plugins/state_machine/test/test_helper.rb +0 -4
- data/lib/branston/vendor/plugins/state_machine/test/unit/assertions_test.rb +0 -40
- data/lib/branston/vendor/plugins/state_machine/test/unit/callback_test.rb +0 -455
- data/lib/branston/vendor/plugins/state_machine/test/unit/condition_proxy_test.rb +0 -328
- data/lib/branston/vendor/plugins/state_machine/test/unit/eval_helpers_test.rb +0 -120
- data/lib/branston/vendor/plugins/state_machine/test/unit/event_collection_test.rb +0 -326
- data/lib/branston/vendor/plugins/state_machine/test/unit/event_test.rb +0 -743
- data/lib/branston/vendor/plugins/state_machine/test/unit/guard_test.rb +0 -908
- data/lib/branston/vendor/plugins/state_machine/test/unit/integrations/active_record_test.rb +0 -1367
- data/lib/branston/vendor/plugins/state_machine/test/unit/integrations/data_mapper_test.rb +0 -962
- data/lib/branston/vendor/plugins/state_machine/test/unit/integrations/sequel_test.rb +0 -859
- data/lib/branston/vendor/plugins/state_machine/test/unit/integrations_test.rb +0 -42
- data/lib/branston/vendor/plugins/state_machine/test/unit/invalid_event_test.rb +0 -7
- data/lib/branston/vendor/plugins/state_machine/test/unit/invalid_transition_test.rb +0 -7
- data/lib/branston/vendor/plugins/state_machine/test/unit/machine_collection_test.rb +0 -938
- data/lib/branston/vendor/plugins/state_machine/test/unit/machine_test.rb +0 -2004
- data/lib/branston/vendor/plugins/state_machine/test/unit/matcher_helpers_test.rb +0 -37
- data/lib/branston/vendor/plugins/state_machine/test/unit/matcher_test.rb +0 -155
- data/lib/branston/vendor/plugins/state_machine/test/unit/node_collection_test.rb +0 -207
- data/lib/branston/vendor/plugins/state_machine/test/unit/state_collection_test.rb +0 -280
- data/lib/branston/vendor/plugins/state_machine/test/unit/state_machine_test.rb +0 -31
- data/lib/branston/vendor/plugins/state_machine/test/unit/state_test.rb +0 -795
- data/lib/branston/vendor/plugins/state_machine/test/unit/transition_test.rb +0 -1212
data/README.rdoc
CHANGED
@@ -18,7 +18,7 @@ There's a bit of a dependency chain needed to get things running. Cucumber has
|
|
18
18
|
a dependency on Nokogiri, which itself has some libxml related dependencies
|
19
19
|
including a dependency on a C compiler. On a clean Debian/Ubuntu box, this...
|
20
20
|
|
21
|
-
sudo apt-get install libxml-ruby libxml2-dev libxslt-ruby libxslt-dev build-essential sqlite3
|
21
|
+
sudo apt-get install libxml-ruby libxml2-dev libxslt-ruby libxslt-dev build-essential sqlite3 libsqlite3-ruby libsqlite3-dev
|
22
22
|
sudo gem install branston
|
23
23
|
|
24
24
|
...currently does the trick.
|
@@ -0,0 +1,25 @@
|
|
1
|
+
source :gemcutter
|
2
|
+
gem 'rails', '~> 2.3.5'
|
3
|
+
gem 'sqlite3-ruby', :require => 'sqlite3'
|
4
|
+
|
5
|
+
# bundler requires these gems in all environments
|
6
|
+
gem 'calendar_date_select', '>= 1.15'
|
7
|
+
gem 'aasm'
|
8
|
+
gem 'googlecharts', ' ~> 1.4.0'
|
9
|
+
|
10
|
+
group :development do
|
11
|
+
# bundler requires these gems in development
|
12
|
+
# currently nothing...
|
13
|
+
end
|
14
|
+
|
15
|
+
group :test do
|
16
|
+
gem 'cucumber', '0.4.4'
|
17
|
+
gem 'shoulda'
|
18
|
+
gem 'machinist'
|
19
|
+
gem 'webrat', '~> 0.5.3'
|
20
|
+
gem 'faker'
|
21
|
+
gem 'relevance-rcov'
|
22
|
+
gem 'ruby-prof'
|
23
|
+
gem 'ruby-debug'
|
24
|
+
end
|
25
|
+
|
@@ -0,0 +1,76 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
aasm (2.1.5)
|
5
|
+
actionmailer (2.3.11)
|
6
|
+
actionpack (= 2.3.11)
|
7
|
+
actionpack (2.3.11)
|
8
|
+
activesupport (= 2.3.11)
|
9
|
+
rack (~> 1.1.0)
|
10
|
+
activerecord (2.3.11)
|
11
|
+
activesupport (= 2.3.11)
|
12
|
+
activeresource (2.3.11)
|
13
|
+
activesupport (= 2.3.11)
|
14
|
+
activesupport (2.3.11)
|
15
|
+
builder (2.1.2)
|
16
|
+
calendar_date_select (1.16.1)
|
17
|
+
columnize (0.3.2)
|
18
|
+
cucumber (0.4.4)
|
19
|
+
builder (= 2.1.2)
|
20
|
+
diff-lcs (= 1.1.2)
|
21
|
+
polyglot (= 0.2.9)
|
22
|
+
term-ansicolor (= 1.0.4)
|
23
|
+
treetop (= 1.4.2)
|
24
|
+
diff-lcs (1.1.2)
|
25
|
+
faker (0.9.5)
|
26
|
+
i18n (~> 0.4)
|
27
|
+
googlecharts (1.4.0)
|
28
|
+
i18n (0.5.0)
|
29
|
+
linecache (0.43)
|
30
|
+
machinist (1.0.6)
|
31
|
+
nokogiri (1.4.4)
|
32
|
+
polyglot (0.2.9)
|
33
|
+
rack (1.1.0)
|
34
|
+
rails (2.3.11)
|
35
|
+
actionmailer (= 2.3.11)
|
36
|
+
actionpack (= 2.3.11)
|
37
|
+
activerecord (= 2.3.11)
|
38
|
+
activeresource (= 2.3.11)
|
39
|
+
activesupport (= 2.3.11)
|
40
|
+
rake (>= 0.8.3)
|
41
|
+
rake (0.8.7)
|
42
|
+
relevance-rcov (0.9.2.1)
|
43
|
+
ruby-debug (0.10.4)
|
44
|
+
columnize (>= 0.1)
|
45
|
+
ruby-debug-base (~> 0.10.4.0)
|
46
|
+
ruby-debug-base (0.10.4)
|
47
|
+
linecache (>= 0.3)
|
48
|
+
ruby-prof (0.9.1)
|
49
|
+
shoulda (2.11.3)
|
50
|
+
sqlite3 (1.3.3)
|
51
|
+
sqlite3-ruby (1.3.3)
|
52
|
+
sqlite3 (>= 1.3.3)
|
53
|
+
term-ansicolor (1.0.4)
|
54
|
+
treetop (1.4.2)
|
55
|
+
polyglot (>= 0.2.5)
|
56
|
+
webrat (0.5.3)
|
57
|
+
nokogiri (>= 1.2.0)
|
58
|
+
rack (>= 1.0)
|
59
|
+
|
60
|
+
PLATFORMS
|
61
|
+
ruby
|
62
|
+
|
63
|
+
DEPENDENCIES
|
64
|
+
aasm
|
65
|
+
calendar_date_select (>= 1.15)
|
66
|
+
cucumber (= 0.4.4)
|
67
|
+
faker
|
68
|
+
googlecharts (~> 1.4.0)
|
69
|
+
machinist
|
70
|
+
rails (~> 2.3.5)
|
71
|
+
relevance-rcov
|
72
|
+
ruby-debug
|
73
|
+
ruby-prof
|
74
|
+
shoulda
|
75
|
+
sqlite3-ruby
|
76
|
+
webrat (~> 0.5.3)
|
@@ -20,7 +20,7 @@ class ApplicationController < ActionController::Base
|
|
20
20
|
protect_from_forgery # See ActionController::RequestForgeryProtection for details
|
21
21
|
|
22
22
|
# Scrub sensitive parameters from your log
|
23
|
-
|
23
|
+
filter_parameter_logging :password
|
24
24
|
|
25
25
|
# RESTful authentication system
|
26
26
|
include AuthenticatedSystem
|
@@ -15,6 +15,7 @@
|
|
15
15
|
class StoriesController < ApplicationController
|
16
16
|
|
17
17
|
layout 'main'
|
18
|
+
before_filter :login_or_password_required, :only => [:show, :generate_feature]
|
18
19
|
before_filter :login_required, :except => [:show, :generate_feature]
|
19
20
|
before_filter :retrieve_iterations, :except => [:generate_feature]
|
20
21
|
before_filter :load_iteration, :except => [:generate_feature, :show]
|
@@ -42,9 +43,9 @@ class StoriesController < ApplicationController
|
|
42
43
|
Story.for_iteration(@iteration.id).map { |s|
|
43
44
|
@total_assigned_points += s.points
|
44
45
|
}
|
45
|
-
|
46
|
+
|
46
47
|
@assignment_difference = @total_assigned_points - @iteration.velocity
|
47
|
-
|
48
|
+
|
48
49
|
respond_to do |format|
|
49
50
|
format.html # index.html.erb
|
50
51
|
format.xml { render :xml => @stories }
|
@@ -56,119 +57,114 @@ class StoriesController < ApplicationController
|
|
56
57
|
def show
|
57
58
|
@story = Story.find_by_slug(params[:id])
|
58
59
|
@iteration = @story.iteration unless @story.nil?
|
59
|
-
|
60
|
+
|
60
61
|
respond_to do |format|
|
61
62
|
if @story
|
62
63
|
format.html
|
63
64
|
format.xml {
|
64
|
-
render :xml => (@story.to_xml :include => {
|
65
|
+
render :xml => (@story.to_xml :include => {
|
65
66
|
:scenarios => { :include => [:preconditions, :outcomes] }
|
66
67
|
})
|
67
68
|
}
|
68
69
|
format.js { @active = true }
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
}
|
73
|
-
format.all { render :nothing => true, :status => 404 }
|
74
|
-
end
|
70
|
+
else
|
71
|
+
format.html { render_optional_error_file 404 }
|
72
|
+
format.all { render :nothing => true, :status => 404 }
|
75
73
|
end
|
76
74
|
end
|
75
|
+
end
|
77
76
|
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
77
|
+
# GET /stories/new
|
78
|
+
# GET /stories/new.xml
|
79
|
+
def new
|
80
|
+
@story = Story.new(:iteration => @iteration)
|
82
81
|
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
end
|
82
|
+
respond_to do |format|
|
83
|
+
format.html # new.html.erb
|
84
|
+
format.xml { render :xml => @story }
|
87
85
|
end
|
86
|
+
end
|
88
87
|
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
88
|
+
# GET /stories/1/edit
|
89
|
+
def edit
|
90
|
+
@story = Story.find_by_slug(params[:id])
|
91
|
+
end
|
92
|
+
|
93
|
+
# POST /stories
|
94
|
+
# POST /stories.xml
|
95
|
+
def create
|
96
|
+
@story = Story.new(params[:story])
|
97
|
+
@story.author = current_user
|
98
|
+
@story.iteration = @iteration
|
93
99
|
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
if @story.save
|
103
|
-
flash[:notice] = 'Story was successfully created.'
|
104
|
-
format.html { redirect_to iteration_stories_path(@iteration) }
|
105
|
-
format.xml { render :xml => @story, :status => :created, :location => @story }
|
106
|
-
else
|
107
|
-
format.html { render :action => "new" }
|
108
|
-
format.xml { render :xml => @story.errors, :status => :unprocessable_entity }
|
109
|
-
end
|
100
|
+
respond_to do |format|
|
101
|
+
if @story.save
|
102
|
+
flash[:notice] = 'Story was successfully created.'
|
103
|
+
format.html { redirect_to iteration_stories_path(@iteration) }
|
104
|
+
format.xml { render :xml => @story, :status => :created, :location => @story }
|
105
|
+
else
|
106
|
+
format.html { render :action => "new" }
|
107
|
+
format.xml { render :xml => @story.errors, :status => :unprocessable_entity }
|
110
108
|
end
|
111
109
|
end
|
110
|
+
end
|
112
111
|
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
if params[:story] and params[:story][:status]
|
119
|
-
if params[:story][:status] == 'in_progress'
|
120
|
-
@story.assign
|
121
|
-
end
|
122
|
-
|
123
|
-
if params[:story][:status] == 'quality_assurance'
|
124
|
-
@story.check_quality
|
125
|
-
end
|
126
|
-
|
127
|
-
if params[:story][:status] == 'new'
|
128
|
-
@story.back_to_new
|
129
|
-
end
|
112
|
+
# PUT /stories/"1
|
113
|
+
# PUT /stories/1.xml
|
114
|
+
def update
|
115
|
+
@story = Story.find_by_slug(params[:id])
|
130
116
|
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
117
|
+
if params[:story] and params[:story][:status]
|
118
|
+
@story.assign if params[:story][:status] == 'in_progress'
|
119
|
+
@story.check_quality if params[:story][:status] == 'quality_assurance'
|
120
|
+
@story.back_to_new if params[:story][:status] == 'new'
|
121
|
+
@story.finish if params[:story][:status] == 'completed'
|
122
|
+
end
|
135
123
|
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
end
|
124
|
+
respond_to do |format|
|
125
|
+
if @story.update_attributes(params[:story])
|
126
|
+
flash[:notice] = 'Story was successfully updated.'
|
127
|
+
format.html { redirect_to iteration_story_path(@iteration, @story) }
|
128
|
+
format.xml { head :ok }
|
129
|
+
format.js { redirect_to iteration_stories_path(@iteration) }
|
130
|
+
else
|
131
|
+
format.html { render :action => "edit" }
|
132
|
+
format.xml { render :xml => @story.errors, :status => :unprocessable_entity }
|
146
133
|
end
|
147
|
-
|
148
|
-
|
149
134
|
end
|
135
|
+
end
|
150
136
|
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
137
|
+
# DELETE /stories/1
|
138
|
+
# DELETE /stories/1.xml
|
139
|
+
def destroy
|
140
|
+
@story = Story.find_by_slug(params[:id])
|
141
|
+
@story.destroy
|
156
142
|
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
end
|
143
|
+
respond_to do |format|
|
144
|
+
format.html { redirect_to iteration_stories_path(@iteration) }
|
145
|
+
format.xml { head :ok }
|
161
146
|
end
|
147
|
+
end
|
162
148
|
|
163
149
|
|
164
|
-
|
150
|
+
private
|
165
151
|
|
166
|
-
|
167
|
-
|
168
|
-
|
152
|
+
def retrieve_iterations
|
153
|
+
@iterations = Iteration.all
|
154
|
+
end
|
155
|
+
|
156
|
+
def load_iteration
|
157
|
+
@iteration = Iteration.find(params[:iteration_id])
|
158
|
+
end
|
169
159
|
|
170
|
-
|
171
|
-
|
160
|
+
def login_or_password_required
|
161
|
+
user = User.authenticate(params[:login], params[:password])
|
162
|
+
if user
|
163
|
+
return true
|
164
|
+
else
|
165
|
+
return false
|
172
166
|
end
|
173
167
|
end
|
174
168
|
|
169
|
+
end
|
170
|
+
|
@@ -16,27 +16,85 @@ class UsersController < ApplicationController
|
|
16
16
|
|
17
17
|
layout 'main'
|
18
18
|
|
19
|
-
|
19
|
+
before_filter :login_required
|
20
|
+
before_filter :find_user, :only => [:suspend, :destroy, :activate]
|
21
|
+
before_filter :must_be_admin, :only => [:new, :create, :destroy, :suspend, :activate]
|
22
|
+
before_filter :must_be_admin_or_self, :only => [:edit, :update]
|
23
|
+
|
24
|
+
def index
|
25
|
+
@users = User.find(:all)
|
26
|
+
end
|
27
|
+
|
20
28
|
def new
|
21
29
|
@user = User.new
|
22
30
|
end
|
23
31
|
|
24
32
|
def create
|
25
|
-
logout_keeping_session!
|
26
33
|
@user = User.new(params[:user])
|
27
|
-
|
28
|
-
if
|
29
|
-
|
30
|
-
|
31
|
-
# button. Uncomment if you understand the tradeoffs.
|
32
|
-
# reset session
|
33
|
-
self.current_user = @user # !! now logged in
|
34
|
-
redirect_back_or_default('/')
|
35
|
-
flash[:notice] = "Thanks for signing up! We're sending you an email with your activation code."
|
34
|
+
@user.role = params[:user][:role] if current_user.has_role?("admin")
|
35
|
+
if @user && @user.valid? && @user.save!
|
36
|
+
redirect_to users_url
|
37
|
+
flash[:notice] = "User created."
|
36
38
|
else
|
37
39
|
flash[:error] = "We couldn't set up that account, sorry. Please try again, or contact an admin (link is above)."
|
38
40
|
render :action => 'new'
|
39
41
|
end
|
40
42
|
end
|
43
|
+
|
44
|
+
def edit
|
45
|
+
@user = User.find(params[:id])
|
46
|
+
end
|
47
|
+
|
48
|
+
def update
|
49
|
+
@user = User.find(params[:id])
|
50
|
+
@user.role = params[:user][:role] if current_user.has_role?("admin")
|
51
|
+
if @user.update_attributes(params[:user])
|
52
|
+
redirect_to users_path
|
53
|
+
else
|
54
|
+
render :action => 'edit'
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
def suspend
|
59
|
+
@user.suspend!
|
60
|
+
redirect_to users_path
|
61
|
+
end
|
62
|
+
|
63
|
+
def activate
|
64
|
+
@user.activate!
|
65
|
+
redirect_to users_path
|
66
|
+
end
|
67
|
+
|
68
|
+
def destroy
|
69
|
+
@user.delete!
|
70
|
+
redirect_to users_path
|
71
|
+
end
|
72
|
+
|
73
|
+
protected
|
74
|
+
|
75
|
+
def find_user
|
76
|
+
@user = User.find(params[:id])
|
77
|
+
end
|
78
|
+
|
79
|
+
# A security filter which freezes out all non-admin users except the user
|
80
|
+
# who is the user identified by params[:id]
|
81
|
+
#
|
82
|
+
def must_be_admin_or_self
|
83
|
+
user = User.find(params[:id])
|
84
|
+
unless current_user.has_role?("admin") || current_user == user
|
85
|
+
flash[:error] = "You are not allowed to do that."
|
86
|
+
redirect_to users_path
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
# A security filter which freezes out all non-admin users.
|
91
|
+
#
|
92
|
+
def must_be_admin
|
93
|
+
unless current_user.has_role?("admin")
|
94
|
+
flash[:error] = "You are not allowed to do that."
|
95
|
+
redirect_to users_path
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
41
99
|
end
|
42
100
|
|