diff --git a/app/models/questionnaire.rb b/app/models/questionnaire.rb index 52ed77a6c..380370264 100644 --- a/app/models/questionnaire.rb +++ b/app/models/questionnaire.rb @@ -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 diff --git a/app/views/application/_questionnaire_summary.html.haml b/app/views/application/_questionnaire_summary.html.haml index fbd0660ee..8f3ae4b7b 100644 --- a/app/views/application/_questionnaire_summary.html.haml +++ b/app/views/application/_questionnaire_summary.html.haml @@ -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: diff --git a/app/views/manage/questionnaires/_form.html.haml b/app/views/manage/questionnaires/_form.html.haml index 8e5f23220..34e2bfed3 100644 --- a/app/views/manage/questionnaires/_form.html.haml +++ b/app/views/manage/questionnaires/_form.html.haml @@ -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?" diff --git a/app/views/manage/questionnaires/_overview.html.haml b/app/views/manage/questionnaires/_overview.html.haml index 84e579a26..ffdfecdd9 100644 --- a/app/views/manage/questionnaires/_overview.html.haml +++ b/app/views/manage/questionnaires/_overview.html.haml @@ -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 diff --git a/app/views/questionnaires/_form.html.haml b/app/views/questionnaires/_form.html.haml index 2b2fe540a..689ea67e9 100644 --- a/app/views/questionnaires/_form.html.haml +++ b/app/views/questionnaires/_form.html.haml @@ -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" diff --git a/test/models/questionnaire_test.rb b/test/models/questionnaire_test.rb index bfd141b00..d1ac8764b 100644 --- a/test/models/questionnaire_test.rb +++ b/test/models/questionnaire_test.rb @@ -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