Skip to content

Commit

Permalink
Added releases feature
Browse files Browse the repository at this point in the history
  • Loading branch information
Francisco Tufró committed Aug 3, 2010
1 parent 2a9c504 commit 3b58572
Show file tree
Hide file tree
Showing 15 changed files with 68 additions and 26 deletions.
1 change: 1 addition & 0 deletions app/controllers/stories_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ def index
# GET /projects/:project_id/stories/new
def new
@story = (params[:team_id].blank?) ? @project.stories.build : Story.new
@story.release = true if(!params[:release].blank?)
@projects = @team.projects if !params[:team_id].blank?
@default_realid = @project ? @project.next_realid : @team.projects.first.next_realid
@default_priority = @project ? @project.next_priority : @team.next_priority
Expand Down
2 changes: 1 addition & 1 deletion app/models/story.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class Story < ActiveRecord::Base
# Attributes Accessible
#
################################################################################################################
attr_accessible :name, :priority, :size, :description, :realid, :project
attr_accessible :name, :priority, :size, :description, :realid, :project, :release

################################################################################################################
#
Expand Down
2 changes: 2 additions & 0 deletions app/views/backlog/_menu.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
.item.new_story{ 'data-project-id' => @project.to_param, 'data-team-id' => @team.to_param }
- link_to @view == :project ? project_backlog_export_path(@project.to_param) : team_backlog_export_path(@team.to_param) do
.item.export_backlog

.item.new_release{ 'data-project-id' => @project.to_param, 'data-team-id' => @team.to_param }

- link_to logout_path do
.item.logout
Expand Down
23 changes: 17 additions & 6 deletions app/views/stories/_form.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,28 @@
= form.label :name
= form.text_field :name

.field
= form.label :realid, "Story ID"
= form.text_field :realid, :value => @story.realid ? @story.realid : @default_realid
- if @story.release?
= form.hidden_field :realid, :value => @story.realid ? @story.realid : @default_realid
- else
.field
= form.label :realid, "Story ID"
= form.text_field :realid, :value => @story.realid ? @story.realid : @default_realid

.field
= form.label :priority
= form.text_field :priority, :value => @story.priority ? @story.priority : @default_priority

.field
= form.label :size
= form.text_field :size
- if @story.release?
= form.hidden_field :size, :value => 9000
- else
.field
= form.label :size
= form.text_field :size

- if @story.release?
= form.hidden_field :release, :value => true
- else
= form.hidden_field :release, :value => false

.field
= form.label :description
Expand Down
23 changes: 12 additions & 11 deletions app/views/stories/_story.html.haml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
%tr.story{:id => "story-#{story.id}", :class => "#{story.status}", 'data-story-id' => story.id, 'data-project-id' => story.project_id}
%tr.story{:id => "story-#{story.id}", :class => "#{story.status} #{ 'release' if story.release? }", 'data-story-id' => story.id, 'data-project-id' => story.project_id}
%td.name-cell
%strong
= story.realid
= story.release? ? 'RELEASE' : story.realid
= story.name
- if @view == :team
== - #{link_to("#{story.project.name}", project_backlog_index_path(story.project.id))} -
Expand All @@ -28,21 +28,22 @@
== #{link_to_remote "Delete", :url => project_story_url(story.project,story), :confirm => 'Are you sure?', :method => :delete, :complete => "location.reload(true);"} ]
- else
== [ #{link_to_remote('Re-open', :url => project_story_start_path(story.project, story), :success => 'location = location')} / Date Finished: #{story.updated_at.strftime("%d %b %Y")}]
%td.priority-cell
%td.priority-cell{ :colspan => story.release? ? 2 : 1 }
%span.in_place_edit{ :id => "priority-#{story.id}" }
- if !story.finished?
%p{ :id => "edit_priority_#{story.id}"}= story.priority
:javascript
new Ajax.InPlaceEditor('edit_priority_#{story.id}', '/projects/#{story.project.to_param}/stories/#{story.to_param}/update_priority', {cancelControl: 'button', onComplete: function(){ location = location }});
- else
%p -
%td.size-cell
%span.in_place_edit{ :id => "size-#{story.id}" }
- if !story.finished?
%p{ :id => "edit_size_#{story.id}"}= story.size ? story.size : "Edit"
:javascript
new Ajax.InPlaceEditor('edit_size_#{story.id}', '/projects/#{story.project.to_param}/stories/#{story.to_param}/update_size', { cancelControl: 'button' });
- else
%p= story.id
- if !story.release?
%td.size-cell
%span.in_place_edit{ :id => "size-#{story.id}" }
- if !story.finished?
%p{ :id => "edit_size_#{story.id}"}= story.size ? story.size : "Edit"
:javascript
new Ajax.InPlaceEditor('edit_size_#{story.id}', '/projects/#{story.project.to_param}/stories/#{story.to_param}/update_size', { cancelControl: 'button' });
- else
%p= story.id
%td.description-cell
= story.description
2 changes: 1 addition & 1 deletion app/views/stories/edit.html.haml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#form
#form-logo= image_tag "logo-projects.png"
%h1.organization Edit Story
%h1.organization== Edit #{ @story.release? ? 'Release' : 'Story' }
- remote_form_for @story, :url => project_story_path(@project, @story, :format => :json), :success => 'Stories.afterUpdate(request.responseText);', :failure => 'ModalDialog.displayFormErrors(request.responseJSON);' do |f|
= render :partial => 'form', :object => f
= f.submit
2 changes: 1 addition & 1 deletion app/views/stories/new.html.haml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#form
#form-logo= image_tag "logo-projects.png"
%h1.organization Create Story
%h1.organization== Add #{ @story.release? ? 'Release' : 'Story' }
- remote_form_for @story, :url => (params[:team_id].blank?) ? project_stories_path(@project, :format => :json) : team_stories_path(@team, :format => :json), :success => 'Stories.afterCreate(request.responseText);', :failure => 'ModalDialog.displayFormErrors(request.responseJSON);' do |f|
= render :partial => 'form', :object => f
= f.submit
1 change: 1 addition & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
p.resources :taskboard, :only => [:index]
p.resources :backlog, :only => [:index]
p.backlog_export 'backlog/export', :controller => :backlog, :action => :export
p.new_release 'releases/new', :controller => :stories, :action => :new, :release => true
p.resources :stories do |s|
s.resources :tasks, :has_many => [ :statustags, :nametags ]
s.task_start 'tasks/:id/start', :controller => :tasks, :action => :start, :conditions => { :method => :post }
Expand Down
9 changes: 9 additions & 0 deletions db/migrate/20100803173622_add_release_to_story.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
class AddReleaseToStory < ActiveRecord::Migration
def self.up
add_column :stories, :release, :boolean
end

def self.down
remove_column :stories, :release
end
end
Binary file added public/images/CD.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/add_release.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 12 additions & 4 deletions public/javascripts/helpers/stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@ Application.Helpers.Stories = {
this._setupListeners();
},

newForm: function(projectId,teamId){
newForm: function(projectId,teamId,isRelease){
var controller = 'stories'
if(isRelease)
controller = 'releases'
if(projectId){
var request_url = '/projects/'+ projectId + '/stories/new'
var request_url = '/projects/'+ projectId + '/' + controller + '/new'
}else{
var request_url = '/teams/'+ teamId + '/stories/new'
var request_url = '/teams/'+ teamId + '/' + controller + '/new'
}
// Request form
new Ajax.Request(request_url, {
Expand Down Expand Up @@ -151,7 +154,12 @@ Application.Helpers.Stories = {
if(target.match('.new_story')){
projectId = target.readAttribute('data-project-id');
teamId = target.readAttribute('data-team-id');
Stories.newForm(projectId,teamId);
Stories.newForm(projectId,teamId,false);
}
if(target.match('.new_release')){
projectId = target.readAttribute('data-project-id');
teamId = target.readAttribute('data-team-id');
Stories.newForm(projectId,teamId,true);
}
// // Listener for remove story
// if(target.match('.remove_story')){
Expand Down
2 changes: 2 additions & 0 deletions public/stylesheets/sass/backlog.sass
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ tr
background: white
&.finished
background: #afc6e9
&.release
background: #c8b7c4

.in_place_edit
p
Expand Down
8 changes: 7 additions & 1 deletion public/stylesheets/sass/menu.sass
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
background: url("/images/export_backlog.png") no-repeat
width: 86px
height: 85px
left: 230px
left: 300px
top: 9px
.task-add
:cursor move
Expand All @@ -41,6 +41,12 @@
background: url("/images/add_story.png") no-repeat
left: 145px
top: 9px
.new_release
width: 81px
height: 80px
background: url("/images/add_release.png") no-repeat
left: 220px
top: 9px
.dashboard
background: url("/images/admin_section.png") no-repeat
left: 225px
Expand Down
3 changes: 2 additions & 1 deletion test/unit/story_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ class StoryTest < ActiveSupport::TestCase
should_validate_presence_of :priority
should_allow_values_for :priority, 0, 10, 20
should_not_allow_values_for :priority, "hola", "okaopsdgjko", "1 bla", "20 asdasd"


should_allow_values_for :release, true, false
end

context "When created" do
Expand Down

0 comments on commit 3b58572

Please sign in to comment.