Skip to content

feat: Adds GitLab VCS URL support #415

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Dec 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/models/questionnaire.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class Questionnaire < ApplicationRecord

validates :portfolio_url, url: { allow_blank: true }
validates :vcs_url, url: { allow_blank: true }
validates_format_of :vcs_url, with: %r{((github.com\/\w+\/?)|(bitbucket.org\/\w+\/?))}, allow_blank: true, message: "Must be a GitHub or BitBucket url"
validates_format_of :vcs_url, with: %r{((github.com\/\w+\/?)|(gitlab.com\/\w+\/?)|(bitbucket.org\/\w+\/?))}, allow_blank: true, message: "Must be a GitHub, GitLab or Bitbucket url"

strip_attributes

Expand Down
2 changes: 1 addition & 1 deletion app/views/application/_questionnaire_summary.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
%b Portfolio link:
= @questionnaire.portfolio_url? ? link_to(@questionnaire.portfolio_url, @questionnaire.portfolio_url, target: '_blank') : 'Not provided'
%p
%b GitHub/BitBucket link:
%b GitHub/GitLab/Bitbucket link:
= @questionnaire.vcs_url? ? link_to(@questionnaire.vcs_url, @questionnaire.vcs_url, target: '_blank') : 'Not provided'
%p
%b Resume:
Expand Down
2 changes: 1 addition & 1 deletion app/views/manage/questionnaires/_form.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
= f.input :resume, as: :deletable_attachment, hint: "Must be under 2MB", input_html: { "data-validate" => "file-max-size file-content-type", "data-validate-file-max-size" => "2097152", "data-validate-file-content-type" => "application/pdf" }, label: "Resume (PDF)"

= f.input :portfolio_url, label: "Portfolio Link"
= f.input :vcs_url, label: "GitHub/BitBucket"
= f.input :vcs_url, label: "GitHub/GitLab/Bitbucket"

= f.input :can_share_info, label: "Share resume with employers?"

Expand Down
2 changes: 1 addition & 1 deletion app/views/manage/questionnaires/_overview.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
%dt.col-md-4 Portfolio
%dd.col-md-8
= @questionnaire.portfolio_url? ? link_to(@questionnaire.portfolio_url, @questionnaire.portfolio_url, target: '_blank') : not_provided
%dt.col-md-4 GitHub/BitBucket
%dt.col-md-4 GitHub/GitLab/Bitbucket
%dd.col-md-8
= @questionnaire.vcs_url? ? link_to(@questionnaire.vcs_url, @questionnaire.vcs_url, target: '_blank') : not_provided
%dt.col-md-4 Resume
Expand Down
2 changes: 1 addition & 1 deletion app/views/questionnaires/_form.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
= f.input :race_ethnicity, as: :select, collection: Questionnaire::POSSIBLE_RACE_ETHNICITIES, include_blank: "(select one...)", label: "Race/Ethnicity", input_html: { "data-validate" => "presence" }, wrapper_html: { class: 'input--half' }

= f.input :portfolio_url, label: "Portfolio link", placeholder: "http://mywebsite.com"
= f.input :vcs_url, label: "GitHub/Bitbucket link", placeholder: "https://github.com/coderit"
= f.input :vcs_url, label: "GitHub/GitLab/Bitbucket link", placeholder: "https://github.com/coderit"
= f.input :resume, as: :deletable_attachment, hint: "Must be a PDF, under 2MB", input_html: { "data-validate" => "file-max-size file-content-type", "data-validate-file-max-size" => "2097152", "data-validate-file-content-type" => "application/pdf" }, label: "Resume"
= f.input :can_share_info, as: :radio_buttons, collection: { " Yes please!" => true, " No, thank you." => false }, label: "Share info with sponsors?", hint: "Our sponsors would receive info such as your name, email, resume, GitHub link, etc"

Expand Down
4 changes: 2 additions & 2 deletions test/models/questionnaire_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ class QuestionnaireTest < ActiveSupport::TestCase
end

should allow_value('foo.com').for(:portfolio_url)
should allow_value('github.com/foo', 'bitbucket.org/sman591').for(:vcs_url)
should allow_value('https://github.com/foo', 'https://bitbucket.org/sman591').for(:vcs_url)
should allow_value('github.com/foo', 'gitlab.com/bar', 'bitbucket.org/baz').for(:vcs_url)
should allow_value('https://github.com/foo', 'https://gitlab.com/bar', 'https://bitbucket.org/baz').for(:vcs_url)
should_not allow_value('http://foo.com', 'https://bar.com').for(:vcs_url)

context "#school" do
Expand Down