Skip to content

Commit

Permalink
Merge pull request #89 from portabilis/portabilis-patch-2022-01-21
Browse files Browse the repository at this point in the history
Portabilis patch 21/01/2022
  • Loading branch information
edersoares authored Jan 28, 2022
2 parents c023328 + 7e15441 commit aa47599
Show file tree
Hide file tree
Showing 206 changed files with 4,618 additions and 517 deletions.
61 changes: 61 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Tests

on:
push:
branches: [ main ]
pull_request:

jobs:
default:

name: Unit and Integration

runs-on: ubuntu-latest

env:
RAILS_ENV: test

services:
postgres:
image: postgres
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: idiario_test
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 3

redis:
image: redis
ports:
- 6379:6379
options: --health-cmd "redis-cli ping" --health-interval 10s --health-timeout 5s --health-retries 3

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Setup Ruby and install gems
uses: ruby/setup-ruby@v1
with:
ruby-version: '2.4.10'
bundler: '1.17.3'
bundler-cache: true

- name: Configure database
run: cp config/database.sample.yml config/database.yml

- name: Configure secrets
run: |
echo -e "
test:
secret_key_base: `bundle exec rake secret`
redis_url: redis://localhost:6379
" > config/secrets.yml
- name: Migrate
run: RAILS_ENV=test bundle exec rake db:migrate

- name: Tests
run: bundle exec rspec --exclude-pattern 'spec/acceptance/*.feature'
4 changes: 2 additions & 2 deletions app/assets/html/500.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@
<p class="image">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 517 268" fill="none"><g fill-rule="evenodd" fill="#fff"><path d="M511.412 39.314l-3.197 4.423 1.2-5.322L505 35.22l5.315 1.204L513.52 32l-1.208 5.322 4.415 3.195-5.316-1.204zM104.583 55.54L90 52.564l14.583-2.976 2.98-14.562 2.98 14.562 14.583 2.976-14.583 2.976-2.98 14.562-2.98-14.562z"/><use xlink:href="#B"/><path d="M191.004 158.9l-5.347-1.09 5.347-1.092 1.093-5.34 1.093 5.34 5.347 1.092-5.347 1.09-1.093 5.34-1.093-5.34z"/><use xlink:href="#B" x="51.334" y="160.48"/><path d="M472.348 182.903L467 181.8l5.348-1.1 1.092-5.34 1.093 5.34 5.348 1.1-5.348 1.092-1.093 5.34-1.092-5.34zm17.387-17.373l-5.348-1.1 5.348-1.1 1.093-5.34 1.093 5.34 5.347 1.1-5.347 1.1-1.093 5.34-1.093-5.34z"/><use xlink:href="#B" x="324.302" y="174.877"/><path d="M505.412 54.314l-3.197 4.423 1.2-5.322L499 50.22l5.315 1.204L507.52 47l-1.208 5.322 4.415 3.195-5.316-1.204zm-14-18l-3.197 4.423 1.2-5.322L485 32.22l5.315 1.204L493.52 29l-1.208 5.322 4.415 3.195-5.316-1.204zM317.875 243.826l9.585 11.386-4.357-14.232 11.366-9.58-14.216 4.343-9.585-11.386 4.357 14.232-11.365 9.58 14.215-4.343zm34.345-31.683l3.515 4.175-1.598-5.22 4.167-3.512-5.212 1.592-3.515-4.175 1.598 5.22-4.167 3.512 5.212-1.592zm-144.44 51.275l3.515 4.175-1.598-5.218 4.168-3.512-5.213 1.592-3.514-4.175 1.597 5.22-4.167 3.512 5.212-1.593zm-98.56-34.28l3.515 4.175-1.598-5.218 4.167-3.513-5.212 1.593-3.515-4.175 1.598 5.218-4.167 3.513 5.212-1.593zM13.844 86.715L17.36 90.9l-1.6-5.23 4.167-3.512-5.212 1.593-3.515-4.175 1.598 5.218-4.167 3.512 5.212-1.593zM20.8 63.138l3.515 4.175-1.598-5.218 4.167-3.512-5.212 1.592L18.147 56l1.598 5.218-4.167 3.512 5.212-1.593zM5.22 69.835L8.736 74l-1.598-5.218 4.167-3.513-5.212 1.593-3.515-4.175 1.598 5.218L.01 71.427l5.212-1.592z"/></g><path d="M129.64 125c8.933 0 16.8 1.933 23.6 5.8 6.8 3.733 12.067 9.067 15.8 16 3.733 6.8 5.6 14.667 5.6 23.6 0 9.333-2.133 17.6-6.4 24.8-4.267 7.067-10.4 12.6-18.4 16.6-8 3.867-17.267 5.8-27.8 5.8-8.933 0-17.733-1.467-26.4-4.4-8.667-3.067-15.8-7.133-21.4-12.2l8.6-18.8c12.933 9.867 26.133 14.8 39.6 14.8 8.933 0 15.733-2.2 20.4-6.6 4.8-4.533 7.2-10.933 7.2-19.2 0-7.867-2.467-14.133-7.4-18.8-4.8-4.8-11.267-7.2-19.4-7.2-5.6 0-10.867 1.067-15.8 3.2-4.933 2-9.267 5-13 9h-15.6V73.6h89.2v20h-64v38.8c7.2-4.933 15.733-7.4 25.6-7.4z" fill="#003473"/><g fill-rule="evenodd"><path d="M282.453 222.03c40.318-10.587 64.428-51.82 53.852-92.094s-51.833-64.342-92.15-53.755-64.428 51.82-53.852 92.094 51.833 64.342 92.15 53.755z" fill="#ffc95c"/><path d="M280.015 213.335c11.132-2.923 17.676-14.736 14.617-26.386s-14.563-18.723-25.695-15.8-17.676 14.736-14.617 26.385 14.563 18.723 25.695 15.8zM310.72 189.6c5.406-1.42 8.578-7.185 7.083-12.876s-7.1-9.154-12.495-7.735-8.578 7.185-7.083 12.876 7.088 9.154 12.495 7.735z" fill="#f7b228"/><path d="M384.664 37.748c15.938 13.295-26.345 70.294-94.44 127.3s-136.22 92.46-152.156 79.166c-12.103-10.096 9.366-45.392 50.217-86.76.35 3.107.895 6.226 1.648 9.34-23.903 26.476-35.342 47.876-27.204 54.75 12.533 10.587 66.754-17.29 121.104-62.263s88.25-90.014 75.718-100.6c-8.078-6.823-33.468 2.33-65.05 21.737-3.002-1.362-6.097-2.53-9.264-3.493l10.022-6.647c43.097-27.9 78.5-41.645 89.405-32.54z" fill="#fff"/><path d="M221.068 136.562c5.407-1.42 8.578-7.184 7.083-12.875s-7.1-9.155-12.495-7.735-8.578 7.184-7.083 12.876 7.1 9.154 12.495 7.734zm23.737-8.078c3.975-1.044 6.34-5.15 5.284-9.174s-5.135-6.44-9.1-5.395-6.34 5.15-5.285 9.175 5.135 6.438 9.1 5.394z" fill="#f7b228"/></g><path d="M409.04 215.8c-16.933 0-29.867-6.2-38.8-18.6-8.8-12.533-13.2-30.733-13.2-54.6 0-23.467 4.4-41.4 13.2-53.8 8.933-12.4 21.867-18.6 38.8-18.6s29.8 6.2 38.6 18.6c8.933 12.267 13.4 30.2 13.4 53.8 0 23.733-4.467 41.867-13.4 54.4-8.8 12.533-21.667 18.8-38.6 18.8zm0-20.2c9.2 0 15.867-4.2 20-12.6 4.267-8.533 6.4-22 6.4-40.4 0-18.133-2.133-31.333-6.4-39.6-4.133-8.4-10.8-12.6-20-12.6s-15.933 4.2-20.2 12.6c-4.133 8.267-6.2 21.467-6.2 39.6 0 18.4 2.067 31.867 6.2 40.4 4.267 8.4 11 12.6 20.2 12.6z" fill="#003473"/><defs ><path id="B" d="M166.993 7.53l-5.347-1.09 5.347-1.09 1.093-5.34 1.093 5.34 5.347 1.09-5.347 1.09-1.093 5.34-1.093-5.34z"/></defs></svg>
</p>
<p class="title">Oops! Ocorreu um erro!</p>
<p class="text">Fique tranquilo, estamos cientes e trabalhando na correção.</p>
<p class="title">Oops! Ocorreu um erro.</p>
<p class="text">Tente recarregar a página, se o problema persistir entre em contato com a Secretaria de Educação do seu município.</p>
<p><a href="#" onclick="window.history.go(-1);return false;" class="btn">Voltar para a página anterior</a></p>
</div>
</div>
Expand Down
Binary file added app/assets/images/beta.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions app/assets/images/exemption.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions app/assets/images/exemption_disabled.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions app/assets/images/undo_exemption.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
104 changes: 104 additions & 0 deletions app/assets/javascripts/resources/daily_notes.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,4 +136,108 @@ $(function () {
}
}
});

var checkBoxes = $('.exempt_student_check'),
exemptButton = $('#exempt_students_button'),
studentsIds = $('#exemption_students_ids');

$(document).on('click', 'a.open-exemption-modal', function(){
var title = 'Tem certeza que deseja dispensar este aluno?'

if($(this).attr('id') == 'exempt_students_button'){
title = 'Tem certeza que deseja dispensar os alunos selecionados?';
} else {
studentsIds.val($(this).data('student-id'));
}

$('.modal-title').text(title);
$('#exemption-modal').modal('show');
});

$('#exemption-modal').on('hidden.bs.modal', function () {
studentsIds.val('');
});

$('#exemption-modal').on('show.bs.modal', function () {
$('#reason').val('');
$('#exemption-modal button:submit').attr('disabled', true);
});

$('#reason').keyup(function(){
if($(this).val().trim().length !=0) {
$('#exemption-modal button:submit').attr('disabled', false);
} else {
$('#exemption-modal button:submit').attr('disabled',true);
}
});

function updateStudentIds(checked, value) {
var studentsIdsCurrentValue = studentsIds.val();

if(checked) {
if (studentsIdsCurrentValue){
studentsIds.val(studentsIdsCurrentValue + ',' + value);
} else{
studentsIds.val(value);
}
} else {
var newList = removeStudentId(studentsIdsCurrentValue, value);
studentsIds.val(newList);
}
}

function removeStudentId(list, id) {
separator = ",";
var values = list.split(separator);
for(var i = 0 ; i < values.length ; i++) {
if(values[i] == id) {
values.splice(i, 1);
return values.join(separator);
}
}
return list;
}

function toggleExemptionButtonState(enabled){
exemptButton.attr('disabled', !enabled);

if (enabled) {
exemptButton.removeClass('btn-exempt-students-disabled');
exemptButton.addClass('btn-exempt-students-enabled');
} else {
exemptButton.addClass('btn-exempt-students-disabled');
exemptButton.removeClass('btn-exempt-students-enabled');
}
}

function updateBackgound(checked, student_id) {
if (checked) {
$('#tr_student_'+ student_id).addClass('selected-student-tr');
} else {
$('#tr_student_'+ student_id).removeClass('selected-student-tr');
}
}

checkBoxes.click(function() {
var checked = checkBoxes.is(":checked");

updateBackgound($(this).is(":checked"), this.value);
toggleExemptionButtonState(checked);
updateStudentIds($(this).is(":checked"), this.value)
});

$('.exempt_student_check_all:input').change(function() {
var enabledCheckoxes = $('.exempt_student_check');

if (enabledCheckoxes.length > 0) {
var check_all = this.checked;
studentsIds.val('');
enabledCheckoxes.prop('checked', check_all);
$.each(enabledCheckoxes, function(i, element){
updateBackgound(check_all, element.value);
updateStudentIds(check_all, element.value);
});
toggleExemptionButtonState(check_all);
}
});
});
Loading

0 comments on commit aa47599

Please sign in to comment.