From 78d485e7114b51b691dcb84fbb273ba0ee551d0f Mon Sep 17 00:00:00 2001 From: "Chris Baudouin, Jr" Date: Fri, 4 Dec 2020 14:01:31 -0500 Subject: [PATCH 1/5] feat: Adds GitLab VCS URL support --- app/models/questionnaire.rb | 2 +- app/views/application/_questionnaire_summary.html.haml | 2 +- app/views/manage/questionnaires/_form.html.haml | 2 +- app/views/manage/questionnaires/_overview.html.haml | 2 +- app/views/questionnaires/_form.html.haml | 2 +- db/schema.rb | 10 ++++++++++ test/models/questionnaire_test.rb | 4 ++-- 7 files changed, 17 insertions(+), 7 deletions(-) diff --git a/app/models/questionnaire.rb b/app/models/questionnaire.rb index 310d6c6d1..2a6ee0ba3 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..2fdc44735 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 7d245df4b..7286d64d2 100644 --- a/app/views/manage/questionnaires/_form.html.haml +++ b/app/views/manage/questionnaires/_form.html.haml @@ -81,7 +81,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..1d45b6736 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 3aa07a83a..48a538e0e 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/db/schema.rb b/db/schema.rb index 7041720db..7d70662e8 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -119,6 +119,16 @@ t.datetime "updated_at", null: false end + create_table "events", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + t.string "title" + t.string "description" + t.string "location" + t.datetime "start" + t.datetime "finish" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + create_table "fips", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| t.string "fips_code" t.string "city" diff --git a/test/models/questionnaire_test.rb b/test/models/questionnaire_test.rb index 78ef68293..0ccc09724 100644 --- a/test/models/questionnaire_test.rb +++ b/test/models/questionnaire_test.rb @@ -103,8 +103,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/sman591').for(:vcs_url) + should allow_value('https://github.com/foo', 'https://gitlab.com/bar', 'https://bitbucket.org/sman591').for(:vcs_url) should_not allow_value('http://foo.com', 'https://bar.com').for(:vcs_url) context "#school" do From 2b303671572850b4a4f57316b6742fbc42d033ee Mon Sep 17 00:00:00 2001 From: "Chris Baudouin, Jr" Date: Fri, 4 Dec 2020 14:04:18 -0500 Subject: [PATCH 2/5] fix: Corrects Bitbucket capitalization --- app/models/questionnaire.rb | 2 +- app/views/application/_questionnaire_summary.html.haml | 2 +- app/views/manage/questionnaires/_form.html.haml | 2 +- app/views/manage/questionnaires/_overview.html.haml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/models/questionnaire.rb b/app/models/questionnaire.rb index 2a6ee0ba3..984217553 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+\/?)|(gitlab.com\/\w+\/?)|(bitbucket.org\/\w+\/?))}, allow_blank: true, message: "Must be a GitHub, GitLab 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 2fdc44735..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/GitLab/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 7286d64d2..ccf8c4886 100644 --- a/app/views/manage/questionnaires/_form.html.haml +++ b/app/views/manage/questionnaires/_form.html.haml @@ -81,7 +81,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/GitLab/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 1d45b6736..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/GitLab/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 From 7ca60513b0ff8b80667e6417287034b1b792a265 Mon Sep 17 00:00:00 2001 From: "Chris Baudouin, Jr" Date: Fri, 4 Dec 2020 14:09:00 -0500 Subject: [PATCH 3/5] Update schema.rb Removes events --- db/schema.rb | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/db/schema.rb b/db/schema.rb index 7d70662e8..7041720db 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -119,16 +119,6 @@ t.datetime "updated_at", null: false end - create_table "events", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| - t.string "title" - t.string "description" - t.string "location" - t.datetime "start" - t.datetime "finish" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - end - create_table "fips", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| t.string "fips_code" t.string "city" From c9787d5b7ed82e9bb6ee4af6af79b4863d0eae17 Mon Sep 17 00:00:00 2001 From: "Chris Baudouin, Jr" Date: Fri, 11 Dec 2020 03:16:42 -0500 Subject: [PATCH 4/5] Update test/models/questionnaire_test.rb Co-authored-by: Peter Kos --- test/models/questionnaire_test.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/models/questionnaire_test.rb b/test/models/questionnaire_test.rb index a54d90450..e26c9ff79 100644 --- a/test/models/questionnaire_test.rb +++ b/test/models/questionnaire_test.rb @@ -101,7 +101,7 @@ class QuestionnaireTest < ActiveSupport::TestCase end should allow_value('foo.com').for(:portfolio_url) - should allow_value('github.com/foo', 'gitlab.com/bar', '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/sman591').for(:vcs_url) should_not allow_value('http://foo.com', 'https://bar.com').for(:vcs_url) From 1546363a001daa097327cc26e241684a47929fe8 Mon Sep 17 00:00:00 2001 From: "Chris Baudouin, Jr" Date: Fri, 11 Dec 2020 03:16:48 -0500 Subject: [PATCH 5/5] Update test/models/questionnaire_test.rb Co-authored-by: Peter Kos --- test/models/questionnaire_test.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/models/questionnaire_test.rb b/test/models/questionnaire_test.rb index e26c9ff79..d1ac8764b 100644 --- a/test/models/questionnaire_test.rb +++ b/test/models/questionnaire_test.rb @@ -102,7 +102,7 @@ class QuestionnaireTest < ActiveSupport::TestCase should allow_value('foo.com').for(:portfolio_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/sman591').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