docbrown/app/views/users/_profile.html.erb
Corey Alexander ec388804df Embed Twitch Live Streaming (#2591)
* Get a job created that can create a webhook subscription for a twitch user login

* Remove ngork url

* Refactor add store the access token in the cache

* Get a controller stood up to recieve the webhooks. Now they just need to be processed

* Get User columns added and got webhook controller bones working

* Update the webhook job to use the User

* Add a way for the User to input their Twitch User Name. Plus a linter fix

* Delay webhook registration when profile is updated

* Don't add _ in username

* Use String columns

* Quick fix and add some more requests specs

* Specs for the webhook job

* Get a show page Twitch Live Streams. Just a straight embed of the Twitch Everything Embed UI. Works surprisingly well responsively, and works on all screen sizes

* Fix Gemfile.lock from merge issues

* Add support for expired tokens and add spec

* Add secrets to webhook registration and clean up spec to remove token logic

* Verify webhook secret and spec it

* Add rake task to enqueue webhook registration for all Users. This can be used from Heroku Scheduler

* Update the lease seconds to be for 5 days

* Actually lets do 7 so we can refresh twice a week and try to make sure that we can always miss one

* Hijack the existing Twitch logo instead of making a duplicate one

* Remove comment and replace with log line

* Remove some white space

* Log to Airbrake when webhook errors occur

* Move to passing in an id instead of User object

* Extract logic from Job to Service object

* Capitilize in the view

* Move out of models and into services

* Remove letover stub

* Remove one usage of Faraday

* Use HTTParty for all the HTTP here
2019-04-29 18:11:53 -04:00

163 lines
6.1 KiB
Text

<script src="https://cdnjs.cloudflare.com/ajax/libs/jscolor/2.0.4/jscolor.min.js"
integrity="sha256-CJWfUCeP3jLdUMVNUll6yQx37gh9AKmXTRxvRf7jzro=" crossorigin="anonymous"></script>
<% unless @user.identities.exists?(provider: 'github') %>
<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 %>
<% unless @user.identities.exists?(provider: 'twitter') %>
<div class="field">
<a href="/users/auth/twitter?callback_url=<%= ApplicationConfig["APP_PROTOCOL"] %><%= ApplicationConfig["APP_DOMAIN"] %>/users/auth/twitter/callback" class="big-button cta" data-no-instant>
<img src="<%= asset_path("twitter-logo.svg") %>" /> CONNECT TWITTER ACCOUNT
</a>
</div>
<% end %>
<h4>
<a href="https://<%= ApplicationConfig["APP_DOMAIN"] %>/<%= current_user.username %>"><img src="https://d2fltix0v2e0sb.cloudfront.net/dev-badge.svg" height="28" width="28" style="vertical-align:-7px;margin-right:4px;" class="dev-badge" /></a>
Add the DEV badge to your personal site. <a href="/p/badges">Click here for the code</a>
</h4>
<%= form_for(@user) do |f| %>
<div class="field">
<%= f.label :email %>
<%= f.text_field :email %>
</div>
<div class="field checkbox-label-first">
<%= f.label :email_public, "Display email on profile" %>
<%= f.check_box :email_public %>
</div>
<div class="field">
<%= f.label :username %>
<%= f.text_field :username, maxlength: 30 %>
</div>
<div class="field">
<%= f.label :name %>
<%= f.text_field :name %>
</div>
<%= f.label :profile_image %>
<div class="field">
<% if @user.profile_image_url.present? %>
<span class="image-present">
<img alt="<%= @user.username %> profile image" src="<%= ProfileImage.new(@user).get(50) %>" />
<%= f.file_field :profile_image %>
</span>
<% end %>
</div>
<div class="field checkbox-label-first">
<%= f.label :looking_for_work %>
<%= f.check_box :looking_for_work %>
</div>
<div class="field checkbox-label-first">
<%= f.label :looking_for_work_publicly, "Display \"looking for work\" on profile" %>
<%= f.check_box :looking_for_work_publicly %>
</div>
<div class="field checkbox-label-first">
<%= f.label :contact_consent, "Recruiters can contact me about job opportunities" %>
<%= f.check_box :contact_consent %>
</div>
<div class="field">
<%= f.label :website_url %>
<%= f.url_field :website_url, maxlength: 100, placeholder: "http://yoursite.com" %>
</div>
<div class="field">
<%= f.label :summary %>
<%= f.text_area :summary, placeholder: "a short bio.", maxlength: 200 %>
</div>
<div class="field">
<% @user.bg_color_hex = user_colors(@user)[:bg] if @user.bg_color_hex.blank? %>
<%= f.label :bg_color_hex, "background color" %>
<%= f.text_field :bg_color_hex, placeholder: "#000000", class: "jscolor {hash:true}" %>
</div>
<div class="field">
<% @user.bg_color_hex = user_colors(@user)[:text] if @user.text_color_hex.blank? %>
<%= f.label :text_color_hex, "text color" %>
<%= f.text_field :text_color_hex, placeholder: "#ffffff", class: "jscolor {hash:true}" %>
</div>
<div class="field">
<%= f.label :location %>
<%= f.text_field :location, maxlength: 100 %>
</div>
<div class="field">
<%= f.label :education %>
<%= f.text_field :education, maxlength: 100 %>
</div>
<div class="field">
<%= f.label :employer_name %>
<%= f.text_field :employer_name, maxlength: 100 %>
</div>
<div class="field">
<%= f.label :employer_url, "Employer URL" %>
<%= f.text_field :employer_url, maxlength: 100 %>
</div>
<div class="field">
<%= f.label :employment_title %>
<%= f.text_field :employment_title, maxlength: 100 %>
</div>
<div class="field">
<%= f.label :mostly_work_with, "Skills/Languages" %>
<%= f.text_area :mostly_work_with, placeholder: "What tools and languages are you most experienced with? are you specialized or more of a generalist?", maxlength: 500 %>
</div>
<div class="field">
<%= f.label :currently_learning, "I'm getting into" %>
<%= f.text_area :currently_learning, placeholder: "What are you learning right now? what are the new tools and languages you're picking up in #{Time.zone.now.year}?", maxlength: 500 %>
</div>
<div class="field">
<%= f.label :currently_hacking_on, "My projects and hacks" %>
<%= f.text_area :currently_hacking_on, placeholder: "What projects are currently occupying most of your time?", maxlength: 500 %>
</div>
<div class="field">
<%= f.label :available_for %>
<%= f.text_area :available_for, placeholder: "What kinds of collaborations or discussions are you available for? what's a good reason to say hey to you these days?", maxlength: 500 %>
</div>
<p><strong>Links</strong></p>
<div class="field">
<%= f.label :facebook_url, "Facebook URL" %>
<%= f.text_field :facebook_url %>
</div>
<div class="field">
<%= f.label :stackoverflow_url, "Stack Overflow URL" %>
<%= f.url_field :stackoverflow_url %>
</div>
<div class="field">
<%= f.label :linkedin_url, "LinkedIn URL" %>
<%= f.url_field :linkedin_url %>
</div>
<div class="field">
<%= f.label :behance_url, "Behance URL" %>
<%= f.url_field :behance_url %>
</div>
<div class="field">
<%= f.label :dribbble_url, "Dribbble URL" %>
<%= f.url_field :dribbble_url %>
</div>
<div class="field">
<%= f.label :medium_url, "Medium URL" %>
<%= f.url_field :medium_url %>
</div>
<div class="field">
<%= f.label :gitlab_url, "GitLab URL" %>
<%= f.url_field :gitlab_url %>
</div>
<div class="field">
<%= f.label :mastodon_url, "Mastodon URL" %>
<%= f.url_field :mastodon_url %>
</div>
<div class="field">
<%= f.label :twitch_url, "Twitch URL" %>
<%= f.url_field :twitch_url %>
</div>
<p><strong>Streaming</strong></p>
<div class="field">
<%= f.label :twitch_username, "Twitch User Name" %>
<%= f.text_field :twitch_username %>
</div>
<div class="field">
<label></label>
<%= f.hidden_field :tab, value: @tab %>
<%= f.submit "SUBMIT", class: "cta" %>
</div>
<% end %>