Skip to content

Commit

Permalink
Wanna help feature basics.
Browse files Browse the repository at this point in the history
  • Loading branch information
orendon committed Sep 30, 2012
1 parent 8a18121 commit ae73195
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
12 changes: 12 additions & 0 deletions app/controllers/wannahelp_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,16 @@ class WannahelpController < ApplicationController
def index
@repos = Repo.limit(5)
end

def update
repo = Repo.find(params[:id])
star(repo.user, repo.name)
redirect_to user_wannahelp_index_path(current_user)
end

private
def star(user, repo)
github = Github.new basic_auth: 'gomayonqui:desarrollo1'
github.repos.starring.starred(owner: 'orendon', repo: 'ruby-shop')
end
end
10 changes: 7 additions & 3 deletions app/views/wannahelp/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,15 @@
<tr>
<th>Repo</th>
<th>Author</th>
<th>Actions</th>
</tr>
<tr>
<%- @repos.each do |repo| %>
<td><%= repo.name %></td>
<td><%= repo.user.name %></td>
<% end%>
<%= form_tag(user_wannahelp_path(current_user, repo), method: :put) do %>
<td><%= repo.name %></td>
<td><%= repo.user.name %></td>
<td><%= submit_tag %></td>
<% end %>
<% end %>
</tr>
</table>

0 comments on commit ae73195

Please sign in to comment.