-
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.
Merge pull request #7 from odinsy/refactor
Subtasks and the work on appearance
- Loading branch information
Showing
51 changed files
with
478 additions
and
210 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,8 @@ | ||
language: ruby | ||
rvm: | ||
- 2.2.2 | ||
|
||
before_script: | ||
- "export DISPLAY=:99.0" | ||
- "sh -e /etc/init.d/xvfb start" | ||
- sleep 3 |
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
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,8 @@ | ||
class StatesController < ApplicationController | ||
|
||
def completed | ||
@tasks = current_user.tasks.completed | ||
@projects = current_user.projects.completed | ||
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,52 @@ | ||
class SubtasksController < ApplicationController | ||
|
||
before_action :find_subtask, only: [:edit, :update, :destroy, :run, :complete] | ||
|
||
respond_to :html, :js | ||
|
||
def run | ||
@subtask.run! | ||
@task = @subtask.task | ||
respond_to do |format| | ||
format.js { render 'subtasks' } | ||
end | ||
end | ||
|
||
def complete | ||
@subtask.complete! | ||
@task = @subtask.task | ||
respond_to do |format| | ||
format.js { render 'subtasks' } | ||
end | ||
end | ||
|
||
def create | ||
@task = current_user.tasks.find(params[:task_id]) | ||
@subtask = @task.subtasks.create(subtask_params) | ||
end | ||
|
||
def edit | ||
end | ||
|
||
def update | ||
end | ||
|
||
def destroy | ||
@task = @subtask.task | ||
@subtask.destroy | ||
respond_to do |format| | ||
format.js { render 'subtasks' } | ||
end | ||
end | ||
|
||
private | ||
|
||
def subtask_params | ||
params.require(:subtask).permit(:title, :user_id, :task_id).deep_merge!(user_id: current_user.id) | ||
end | ||
|
||
def find_subtask | ||
@subtask = current_user.subtasks.find(params[: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
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 @@ | ||
module ChangeState | ||
|
||
extend ActiveSupport::Concern | ||
|
||
included do | ||
aasm :column => 'state' do | ||
state :active, :initial => true | ||
state :completed | ||
event :run do | ||
transitions :from => :completed, :to => :active | ||
end | ||
event :complete do | ||
transitions :from => :active, :to => :completed | ||
end | ||
end | ||
end | ||
|
||
end |
Oops, something went wrong.