diff --git a/.github/workflows/specs.yml b/.github/workflows/specs.yml index 8eb5a7be..23f634ae 100644 --- a/.github/workflows/specs.yml +++ b/.github/workflows/specs.yml @@ -53,8 +53,8 @@ jobs: uses: codecov/codecov-action@v2 with: token: ${{ secrets.CODECOV_TOKEN }} - - name: Publish Code Climate - run: | - export GIT_BRANCH="${GITHUB_REF/refs\/heads\//}" - $CCTR sum-coverage coverage/codeclimate.*.json - $CCTR upload-coverage --id "$CC_TEST_REPORTER_ID" + # - name: Publish Code Climate + # run: | + # export GIT_BRANCH="${GITHUB_REF/refs\/heads\//}" + # $CCTR sum-coverage coverage/codeclimate.*.json + # $CCTR upload-coverage --id "${{ secrets.CC_TEST_REPORTER_ID }}" diff --git a/app/models/school.rb b/app/models/school.rb index b51b546c..29966ddc 100644 --- a/app/models/school.rb +++ b/app/models/school.rb @@ -60,7 +60,8 @@ def website end def location - "#{city}, #{state}, #{country}" + country_text = country == "US" ? "" : ", #{country}" + "#{city}, #{state}#{country_text}" end # TODO: Consider renaming this. @@ -107,9 +108,7 @@ def format_school(data) end def self.search_list - School.pluck(:name, :city, :state, :country).map do |data| - format_school(data) - end + School.pluck(:name, :city, :state, :country).map(&:format_school) end def self.grade_level_options diff --git a/app/views/schools/_form.html.erb b/app/views/schools/_form.html.erb index e6b87526..6cb701aa 100644 --- a/app/views/schools/_form.html.erb +++ b/app/views/schools/_form.html.erb @@ -9,7 +9,7 @@
<%= f.label :city, class: "label-required", for: "school_city" %> - <%= f.text_field :city, placeholder: 'Name of City', class: 'form-control', + <%= f.text_field :city, placeholder: 'Berkeley', class: 'form-control', required: false, id: 'school_city' %>
diff --git a/app/views/schools/show.html.erb b/app/views/schools/show.html.erb index 09ad27fc..300c5b9d 100644 --- a/app/views/schools/show.html.erb +++ b/app/views/schools/show.html.erb @@ -18,7 +18,7 @@
Location
- <%= "#{@school.location}, #{@school.country}" %> + <%= @school.location %>
diff --git a/app/views/teachers/_table_headers.erb b/app/views/teachers/_table_headers.erb index 13c40fa1..b0814d97 100644 --- a/app/views/teachers/_table_headers.erb +++ b/app/views/teachers/_table_headers.erb @@ -7,6 +7,5 @@ Status Snap! School -Country Approved? Created diff --git a/app/views/teachers/_teacher.erb b/app/views/teachers/_teacher.erb index 788fc988..281cdb02 100644 --- a/app/views/teachers/_teacher.erb +++ b/app/views/teachers/_teacher.erb @@ -36,9 +36,6 @@ <%= link_to(teacher.school.name, school_path(teacher.school)) %> <%= teacher.school.location %> - - <%= teacher.school.country %> - <%= teacher.short_application_status %> diff --git a/app/views/teachers/_teacher_info.html.erb b/app/views/teachers/_teacher_info.html.erb index 6e243182..cbee90a6 100644 --- a/app/views/teachers/_teacher_info.html.erb +++ b/app/views/teachers/_teacher_info.html.erb @@ -108,7 +108,6 @@
School Location:
- <%= "#{teacher.school.location}" %>
diff --git a/features/admin.feature b/features/admin.feature index e8e4867f..776ad96e 100644 --- a/features/admin.feature +++ b/features/admin.feature @@ -182,26 +182,6 @@ Feature: basic admin functionality And I press "Update" Then I should not have sent out any emails - Scenario: Updating application status persists changes in database - Given the following schools exist: - | name | country | city | state | website | grade_level | school_type | - | UC Berkeley | US | Berkeley | CA | https://www.berkeley.edu | university | public | - Given the following teachers exist: - | first_name | last_name | admin | primary_email | school | snap | application_status | - | Bobby | John | false | testteacher@berkeley.edu | UC Berkeley | bobby | denied | - Given I am on the BJC home page - And I have an admin email - And I follow "Log In" - Then I can log in with Google - When I go to the teachers page - And I go to the edit page for Bobby John - And I set my application status as "Validated" - And I press "Update" - Then I see a confirmation "Saved" - When I go to the teachers page - And I check "Validated" - Then I should see "Bobby John" - Scenario: Deny teacher as an admin Given the following schools exist: | name | country | city | state | website | grade_level | school_type | @@ -234,30 +214,6 @@ Feature: basic admin functionality When I go to the edit page for Joseph Mamoa Then should see "You need to log in to access this." - Scenario: Filter all teacher info as an admin - Given the following schools exist: - | name | country | city | state | website | grade_level | school_type | - | UC Berkeley | US | Berkeley | CA | https://www.berkeley.edu | university | public | - Given the following teachers exist: - | first_name | last_name | admin | primary_email | school | application_status | - | Victor | Validateme | false | testteacher1@berkeley.edu | UC Berkeley | Validated | - | Danny | Denyme | false | testteacher2@berkeley.edu | UC Berkeley | Denied | - | Peter | Pendme | false | testteacher3@berkeley.edu | UC Berkeley | Not Reviewed | - Given I am on the BJC home page - Given I have an admin email - And I follow "Log In" - Then I can log in with Google - When I go to the teachers page - And I check "Not Reviewed" - And I uncheck "Validated" - Then I should see "Peter" - Then I should not see "Victor" - Then I should not see "Danny" - And I check "Validated" - Then I should see "Peter" - Then I should see "Victor" - Then I should not see "Danny" - Scenario: View teacher info as an admin Given the following schools exist: | name | country | city | state | website | grade_level | school_type | @@ -385,7 +341,7 @@ Feature: basic admin functionality | UC Berkeley | US | Berkeley | CA | https://www.berkeley.edu | university | public | And the following teachers exist: | first_name | last_name | admin | primary_email | primary_email | school | - | Jane | Doe | false | janedoe@berkeley.edu | jd@berkeley.edu | UC Berkeley | + | Jane | Doe | false | janedoe@berkeley.edu | jd@berkeley.edu | UC Berkeley | | Bobby | John | false | bobbyjohn@berkeley.edu | bj@berkeley.edu | UC Berkeley | Given I am on the BJC home page And I have an admin email @@ -437,14 +393,14 @@ Feature: basic admin functionality And the following entries should exist in the teachers database: | first_name | last_name | session_count | ip_history | last_session_at | admin | primary_email | school | | Bobby | John | 534 | 1.2.3.4, 4.5.6.7, 7.8.9.10 | 2023-04-10 12:30:00 | false | bobbyjohn@berkeley.edu | UC Berkeley | - + Scenario: Admin can access merge page from teacher show page Given the following schools exist: | name | country | city | state | website | grade_level | school_type | | UC Berkeley | US | Berkeley | CA | https://www.berkeley.edu | university | public | And the following teachers exist: | first_name | last_name | admin | primary_email | school | - | Jane | Doe | false | janedoe@berkeley.edu | UC Berkeley | + | Jane | Doe | false | janedoe@berkeley.edu | UC Berkeley | | Bobby | John | false | bobbyjohn@berkeley.edu | UC Berkeley | Given I am on the BJC home page And I have an admin email @@ -490,9 +446,9 @@ Feature: basic admin functionality Then I go to the show page for Jane Doe When I attach the file with name "test_file.txt" on the show page Then I see a confirmation "File was successfully uploaded" - When I click the first file deletion button + When I click the first file deletion button And I accept the popup alert - Then I see a confirmation "File was successfully removed" + Then I see a confirmation "File was successfully removed" # Scenario: Admin can import csv file. The loader should filter invalid record and create associate school. # Given the following schools exist: diff --git a/features/data_tables.feature b/features/data_tables.feature new file mode 100644 index 00000000..de79ef7f --- /dev/null +++ b/features/data_tables.feature @@ -0,0 +1,54 @@ +Feature: Admin Data Tables functionality + + As an admin + So that I can see how many people are teaching BJC + I can use interactive datatables + + Background: Has an Admin in DB + Given the following teachers exist: + | first_name | last_name | admin | email | + | Admin | User | true | testadminuser@berkeley.edu | + + Scenario: Updating application status persists changes in database + Given the following schools exist: + | name | country | city | state | website | grade_level | school_type | + | UC Berkeley | US | Berkeley | CA | https://www.berkeley.edu | university | public | + Given the following teachers exist: + | first_name | last_name | admin | primary_email | school | snap | application_status | + | Bobby | John | false | testteacher@berkeley.edu | UC Berkeley | bobby | denied | + Given I am on the BJC home page + And I have an admin email + And I follow "Log In" + Then I can log in with Google + When I go to the teachers page + And I go to the edit page for Bobby John + And I set my application status as "Validated" + And I press "Update" + Then I see a confirmation "Saved" + When I go to the teachers page + And I check "Validated" + Then I should see "Bobby John" + + Scenario: Filter all teacher info as an admin + Given the following schools exist: + | name | country | city | state | website | grade_level | school_type | + | UC Berkeley | US | Berkeley | CA | https://www.berkeley.edu | university | public | + Given the following teachers exist: + | first_name | last_name | admin | primary_email | school | application_status | + | Victor | Validateme | false | testteacher1@berkeley.edu | UC Berkeley | Validated | + | Danny | Denyme | false | testteacher2@berkeley.edu | UC Berkeley | Denied | + | Peter | Pendme | false | testteacher3@berkeley.edu | UC Berkeley | Not Reviewed | + Given I am on the BJC home page + Given I have an admin email + And I follow "Log In" + Then I can log in with Google + When I go to the teachers page + And I check "Not Reviewed" + And I uncheck "Validated" + Then I should see "Peter" + Then I should not see "Victor" + Then I should not see "Danny" + And I check "Validated" + Then I should see "Peter" + Then I should see "Victor" + Then I should not see "Danny" diff --git a/package.json b/package.json index 58ea9cc3..3a29ae15 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "popper.js": "^1.16.0", "selectize": "^0.12.6", "tinymce": "^5.x", - "trix": "^1.2.0", + "trix": "^2.1.1", "turbolinks": "^5.2.0" }, "devDependencies": { diff --git a/yarn.lock b/yarn.lock index 28d6981d..c3044e45 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4560,6 +4560,11 @@ minipass@^3.0.0, minipass@^3.1.1: dependencies: yallist "^4.0.0" +minipass@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/minipass/-/minipass-5.0.0.tgz#3e9788ffb90b694a5d0ec94479a45b5d8738133d" + integrity sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ== + minizlib@^2.1.1: version "2.1.2" resolved "https://registry.npmjs.org/minizlib/-/minizlib-2.1.2.tgz" @@ -6765,13 +6770,13 @@ tapable@^1.0.0, tapable@^1.1.3: integrity sha512-4WK/bYZmj8xLr+HUCODHGF1ZFzsYffasLUgEiMBY4fgtltdO6B4WJtlSbPaDTLpYTcGVwM2qLnFTICEcNxs3kA== tar@^6.0.2: - version "6.1.11" - resolved "https://registry.npmjs.org/tar/-/tar-6.1.11.tgz" - integrity sha512-an/KZQzQUkZCkuoAA64hM92X0Urb6VpRhAFllDzz44U2mcD5scmT3zBc4VgVpkugF580+DQn8eAFSyoQt0tznA== + version "6.2.1" + resolved "https://registry.yarnpkg.com/tar/-/tar-6.2.1.tgz#717549c541bc3c2af15751bea94b1dd068d4b03a" + integrity sha512-DZ4yORTwrbTj/7MZYq2w+/ZFdI6OZ/f9SFHR+71gIVUZhOQPHzVCLpvRnPgyaMpfWxxk/4ONva3GQSyNIKRv6A== dependencies: chownr "^2.0.0" fs-minipass "^2.0.0" - minipass "^3.0.0" + minipass "^5.0.0" minizlib "^2.1.1" mkdirp "^1.0.3" yallist "^4.0.0" @@ -6902,10 +6907,10 @@ toidentifier@1.0.1: resolved "https://registry.yarnpkg.com/toidentifier/-/toidentifier-1.0.1.tgz#3be34321a88a820ed1bd80dfaa33e479fbb8dd35" integrity sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA== -trix@^1.2.0: - version "1.3.1" - resolved "https://registry.npmjs.org/trix/-/trix-1.3.1.tgz" - integrity sha512-BbH6mb6gk+AV4f2as38mP6Ucc1LE3OD6XxkZnAgPIduWXYtvg2mI3cZhIZSLqmMh9OITEpOBCCk88IVmyjU7bA== +trix@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/trix/-/trix-2.1.1.tgz#688f1213601316cf8b92c5e625d2f562c118c780" + integrity sha512-IljOMGOlRUPg1i5Pk/+x/Ia65ZY7Gw5JxxKCh/4caxG5ZaKuFJCKdn1+TF0efUYfdg+bqWenB/mAYCHjZu0zpQ== ts-pnp@^1.1.6: version "1.2.0"