forked from ifournight/tower_homework
-
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.
Create minimal home, project controller/ page
- Loading branch information
1 parent
d44a9af
commit 204d34a
Showing
9 changed files
with
103 additions
and
31 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,7 +1,7 @@ | ||
class HomeController < ApplicationController | ||
def index | ||
@uncompleted_todos = Todo.where('completed = ?', false).order('edited_at DESC') | ||
@completed_todos = Todo.where('completed = ?', true).order('edited_at DESC') | ||
@create_todo = CreateTodo.new(creator_id: current_user.id) | ||
@user = current_user | ||
@owned_teams = current_user.owned_teams | ||
@joined_teams = current_user.joined_teams | ||
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,11 @@ | ||
class ProjectsController < ApplicationController | ||
def show | ||
@project = Project.find(params[:id]) | ||
@uncompleted_todos = @project.todos.uncompleted | ||
@completed_todos = @project.todos.completed | ||
|
||
@create_todo = CreateTodo.new(creator_id: current_user.id, project_id: @project.id) | ||
|
||
session[:team_id] = @project.team.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
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 |
---|---|---|
@@ -1,23 +1,39 @@ | ||
<section class='section' id="todo-list-section"> | ||
<h2 class='title is-2'>任务</h2> | ||
<section class='section' id="team-list-section"> | ||
|
||
<% if @completed_todos.any? %> | ||
<section> | ||
<h3 class='title is-3'>未完成</h3> | ||
<ul id="todo-list-uncompleted"> | ||
<%= render @uncompleted_todos %> | ||
</ul> | ||
</section> | ||
<% if @owned_teams.any? %> | ||
<section class='section'> | ||
<h2 class='title is-2'>拥有的团队</h2> | ||
<% @owned_teams.each do |team| %> | ||
<h3 class='title is-3'><%= team.name.upcase %></h3> | ||
<ul> | ||
<% @user.anticipated_projects_in_team(team).each do |project| %> | ||
<% if project.collaborators.include?(@user) %> | ||
<%= content_tag_for :li, project do %> | ||
<%= link_to project.name, project %> | ||
<% end %> | ||
<% end %> | ||
<% end %> | ||
</ul> | ||
<% end %> | ||
</section> | ||
<% end %> | ||
<% if @completed_todos.any? %> | ||
<section> | ||
<h3 class='title is-3'>已完成</h3> | ||
<ul id="todo-list-completed"> | ||
<%= render @completed_todos %> | ||
</ul> | ||
</section> | ||
|
||
<% if @joined_teams.any? %> | ||
<section class='section'> | ||
<h2 class='title is-2'>参与的团队</h2> | ||
<% @joined_teams.each do |team| %> | ||
<h3 class='title is-3'><%= team.name.upcase %></h3> | ||
<ul> | ||
<% @user.anticipated_projects_in_team(team).each do |project| %> | ||
<% if project.collaborators.include?(@user) %> | ||
<%= content_tag_for :li, project do %> | ||
<%= link_to project.name, project %> | ||
<% end %> | ||
<% end %> | ||
<% end %> | ||
</ul> | ||
<% end %> | ||
</section> | ||
<% end %> | ||
<section id="todo-list-create"> | ||
<%= render @create_todo %> | ||
</section> | ||
|
||
</section> |
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,23 @@ | ||
<section class='section' id="todo-list-section"> | ||
|
||
<% if @uncompleted_todos.any? %> | ||
<section> | ||
<h3 class='title is-3'>未完成</h3> | ||
<ul id="todo-list-uncompleted"> | ||
<%= render @uncompleted_todos %> | ||
</ul> | ||
</section> | ||
<% end %> | ||
<% if @completed_todos.any? %> | ||
<section> | ||
<h3 class='title is-3'>已完成</h3> | ||
<ul id="todo-list-completed"> | ||
<%= render @completed_todos %> | ||
</ul> | ||
</section> | ||
<% end %> | ||
<section id="todo-list-create"> | ||
<%= render @create_todo %> | ||
</section> | ||
|
||
</seciont> |
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