Skip to content

Commit edb0fd9

Browse files
feat: Adds GitLab VCS URL support (#415)
* feat: Adds GitLab VCS URL support * fix: Corrects Bitbucket capitalization * Update schema.rb Removes events * Update test/models/questionnaire_test.rb Co-authored-by: Peter Kos <[email protected]> * Update test/models/questionnaire_test.rb Co-authored-by: Peter Kos <[email protected]> Co-authored-by: Peter Kos <[email protected]>
1 parent a5b609f commit edb0fd9

File tree

6 files changed

+7
-7
lines changed

6 files changed

+7
-7
lines changed

app/models/questionnaire.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class Questionnaire < ApplicationRecord
4343

4444
validates :portfolio_url, url: { allow_blank: true }
4545
validates :vcs_url, url: { allow_blank: true }
46-
validates_format_of :vcs_url, with: %r{((github.com\/\w+\/?)|(bitbucket.org\/\w+\/?))}, allow_blank: true, message: "Must be a GitHub or BitBucket url"
46+
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"
4747

4848
strip_attributes
4949

app/views/application/_questionnaire_summary.html.haml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
%b Portfolio link:
1010
= @questionnaire.portfolio_url? ? link_to(@questionnaire.portfolio_url, @questionnaire.portfolio_url, target: '_blank') : 'Not provided'
1111
%p
12-
%b GitHub/BitBucket link:
12+
%b GitHub/GitLab/Bitbucket link:
1313
= @questionnaire.vcs_url? ? link_to(@questionnaire.vcs_url, @questionnaire.vcs_url, target: '_blank') : 'Not provided'
1414
%p
1515
%b Resume:

app/views/manage/questionnaires/_form.html.haml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
= 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)"
5959

6060
= f.input :portfolio_url, label: "Portfolio Link"
61-
= f.input :vcs_url, label: "GitHub/BitBucket"
61+
= f.input :vcs_url, label: "GitHub/GitLab/Bitbucket"
6262

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

app/views/manage/questionnaires/_overview.html.haml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@
8787
%dt.col-md-4 Portfolio
8888
%dd.col-md-8
8989
= @questionnaire.portfolio_url? ? link_to(@questionnaire.portfolio_url, @questionnaire.portfolio_url, target: '_blank') : not_provided
90-
%dt.col-md-4 GitHub/BitBucket
90+
%dt.col-md-4 GitHub/GitLab/Bitbucket
9191
%dd.col-md-8
9292
= @questionnaire.vcs_url? ? link_to(@questionnaire.vcs_url, @questionnaire.vcs_url, target: '_blank') : not_provided
9393
%dt.col-md-4 Resume

app/views/questionnaires/_form.html.haml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
= 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' }
3333

3434
= f.input :portfolio_url, label: "Portfolio link", placeholder: "http://mywebsite.com"
35-
= f.input :vcs_url, label: "GitHub/Bitbucket link", placeholder: "https://github.com/coderit"
35+
= f.input :vcs_url, label: "GitHub/GitLab/Bitbucket link", placeholder: "https://github.com/coderit"
3636
= 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"
3737
= 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"
3838

test/models/questionnaire_test.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,8 @@ class QuestionnaireTest < ActiveSupport::TestCase
101101
end
102102

103103
should allow_value('foo.com').for(:portfolio_url)
104-
should allow_value('github.com/foo', 'bitbucket.org/sman591').for(:vcs_url)
105-
should allow_value('https://github.com/foo', 'https://bitbucket.org/sman591').for(:vcs_url)
104+
should allow_value('github.com/foo', 'gitlab.com/bar', 'bitbucket.org/baz').for(:vcs_url)
105+
should allow_value('https://github.com/foo', 'https://gitlab.com/bar', 'https://bitbucket.org/baz').for(:vcs_url)
106106
should_not allow_value('http://foo.com', 'https://bar.com').for(:vcs_url)
107107

108108
context "#school" do

0 commit comments

Comments
 (0)