docbrown/app/views/users/_integrations.html.erb
Mac Siri d74483dd5f Fix GitHub Repo feature (#78)
* Create MarkdownFixer spec

* Fix lint

* Fix lint

* Update GithubRepo::find_or_create

* Fix failing specs

* Fix failing specs

* Add error handling for GithubReposController

* Improve GithubRepo::update_to_latest
2018-03-15 11:36:22 -04:00

33 lines
1.3 KiB
Text

<h3>Pin a few of your GitHub repos to your profile</h3>
<% if @client %>
<div class="github-repos">
<% @client.repositories.each do |repo| %>
<% if (user_repo = GithubRepo.find_by(github_id_code: repo.id)) && user_repo.featured %>
<div class="github-repo-row github-repo-row-selected">
<div class="github-repo-row-name">
<%= repo.name %> <%= "<span class='github-repo-fork'>fork</span>".html_safe if repo.fork %>
<%= form_for(user_repo) do |f| %>
<button class="cta">Remove</button>
<% end %>
</div>
</div>
<% else %>
<div class="github-repo-row">
<div class="github-repo-row-name">
<%= repo.name %> <%= "<span class='github-repo-fork'>fork</span>".html_safe if repo.fork %>
<%= form_for(GithubRepo.new) do |f| %>
<%= f.hidden_field :github_id_code, value: repo.id %>
<button class="cta">Select</button>
<% end %>
</div>
</div>
<% end %>
<% end %>
</div>
<% else %>
<div class="field">
<a href="/users/auth/github" class="big-button cta" data-no-instant>
<img src="<%= asset_path('github-logo.svg') %>" /> CONNECT GITHUB ACCOUNT
</a>
</div>
<% end %>