-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Atualizando backlogs e sprints para funcionar menos dependente do pro…
…ject
- Loading branch information
Showing
29 changed files
with
359 additions
and
44 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Place all the behaviors and hooks related to the matching controller here. | ||
# All this logic will automatically be available in application.js. | ||
# You can use CoffeeScript in this file: http://coffeescript.org/ |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// Place all the styles related to the Sprints controller here. | ||
// They will automatically be included in application.css. | ||
// You can use Sass (SCSS) here: http://sass-lang.com/ |
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
class SprintsController < ApplicationController | ||
before_action :set_sprint, only: [:show, :edit, :update, :destroy] | ||
|
||
# GET /project/:project_id/sprints | ||
# GET /project/:project_id/sprints.json | ||
def index | ||
@project = Project.find params[:project_id].to_i | ||
@sprints = @project.sprints | ||
end | ||
|
||
# GET /project/:project_id/sprints/1 | ||
# GET /project/:project_id/sprints/1.json | ||
def show | ||
end | ||
|
||
# GET /sprints/new | ||
def new | ||
#@sprint = Sprint.new | ||
@project = Project.find params[:project_id].to_i | ||
@sprint = @project.sprints.build | ||
end | ||
|
||
# GET /project/:project_id/sprints/1/edit | ||
def edit | ||
@project = Project.find params[:project_id].to_i | ||
@sprint = Sprint.find params[:id].to_i | ||
end | ||
|
||
# POST /sprints | ||
# POST /sprints.json | ||
def create | ||
|
||
@sprint = Sprint.new(sprint_params) | ||
|
||
respond_to do |format| | ||
if @sprint.save | ||
format.html { redirect_to @sprint.project, notice: 'Sprint criado com sucesso.' } | ||
format.json { render action: 'show', status: :created, location: @sprint } | ||
else | ||
format.html { render action: 'new' } | ||
format.json { render json: @sprint.errors, status: :unprocessable_entity } | ||
end | ||
end | ||
end | ||
|
||
# PATCH/PUT /sprints/1 | ||
# PATCH/PUT /sprints/1.json | ||
def update | ||
respond_to do |format| | ||
if @sprint.update(sprint_params) | ||
format.html { redirect_to project_sprints_path(@sprint.project.id), notice: 'Sprint atualizado com sucesso.' } | ||
format.json { head :no_content } | ||
else | ||
format.html { render action: 'edit' } | ||
format.json { render json: @sprint.errors, status: :unprocessable_entity } | ||
end | ||
end | ||
end | ||
|
||
# DELETE /sprints/1 | ||
# DELETE /sprints/1.json | ||
def destroy | ||
project = @sprint.project | ||
@sprint.destroy | ||
respond_to do |format| | ||
format.html { redirect_to project_sprints_path(project.id), :notice => "Sprint deletado com sucesso" } | ||
format.json { head :no_content } | ||
end | ||
end | ||
|
||
private | ||
# Use callbacks to share common setup or constraints between actions. | ||
def set_sprint | ||
@sprint = Sprint.find(params[:id]) | ||
end | ||
|
||
# Never trust parameters from the scary internet, only allow the white list through. | ||
def sprint_params | ||
params.require(:sprint).permit(:title, :description, :project_id) | ||
end | ||
end |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
module SprintsHelper | ||
end |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,17 @@ | ||
class Backlog < ActiveRecord::Base | ||
belongs_to :project | ||
|
||
# Ordenar os backlogs na base de dados, seguindo a ordem da lista backlog_ids | ||
def self.sort(backlog_ids) | ||
|
||
position = 0 | ||
|
||
backlog_ids.each do |id| | ||
b = Backlog.find id | ||
b.update_attribute(:position, position) | ||
position = position + 1 | ||
end | ||
|
||
end | ||
|
||
end |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
class Sprint < ActiveRecord::Base | ||
belongs_to :project | ||
end |
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<ul class="nav nav-tabs"> | ||
<li class="<%= 'active' if current_page?(project_backlogs_path) %>"><%= link_to "Backlogs", project_backlogs_path(@project) %></li> | ||
<li class="<%= 'active' if current_page?(project_sprints_path) %>"><%= link_to "Sprints", project_sprints_path(@project) %></li> | ||
<li><a href="#tab_members" data-toggle="tab">Membros do time</a></li> | ||
</ul> |
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<%= form_for [@project, @sprint] do |f| %> | ||
<div class="control-group"> | ||
<%= f.label "Nome", :class => 'control-label' %> | ||
<div class="controls"> | ||
<%= f.text_field :title, :class => 'text_field' %> | ||
</div> | ||
</div> | ||
<div class="control-group"> | ||
<%= f.label "Descricao", :class => 'control-label' %> | ||
<div class="controls"> | ||
<%= f.text_area :description, :class => 'text_field' %> | ||
</div> | ||
</div> | ||
<div class="form-actions"> | ||
<%= f.hidden_field :project_id %> | ||
<%= f.submit "Salvar", :class => 'btn btn-primary' %> | ||
</div> | ||
<% end %> |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<%- model_class = Sprint -%> | ||
<div class="page-header"> | ||
<h1>Editing sprint</h1> | ||
</div> | ||
<%= render 'form' %> |
Oops, something went wrong.