diff --git a/app/assets/stylesheets/login.css b/app/assets/stylesheets/login.css new file mode 100644 index 0000000000..a22f4ec6bf --- /dev/null +++ b/app/assets/stylesheets/login.css @@ -0,0 +1,94 @@ +body { + background: #efefef; + margin: 0; + font-family: Arial, sans-serif; +} + +.login-container { + width: 90%; + max-width: 1100px; + height: 500px; + + margin: 40px auto; + + display: flex; + + background: white; + border-radius: 10px; + + overflow: hidden; +} + +.login-form { + flex: 1; + + display: flex; + flex-direction: column; + justify-content: center; + + padding: 50px; +} + +.login-form h1 { + text-align: center; + margin-bottom: 40px; +} + +.field { + margin-bottom: 20px; +} + +.field label { + display: block; + margin-bottom: 8px; +} + +.field input { + width: 100%; + box-sizing: border-box; + + padding: 12px; + + border: 1px solid #ccc; + border-radius: 6px; +} + +.btn-login { + width: 100%; + + padding: 12px; + + border: none; + border-radius: 6px; + + background: #2ecc71; + color: white; + + cursor: pointer; + + font-size: 16px; +} + +.btn-login:hover { + opacity: 0.9; +} + +.btn-forgot { + margin-top: 15px; +} + +.login-banner { + flex: 1; + + background: #6d1f6d; + + display: flex; + justify-content: center; + align-items: center; +} + +.login-banner h2 { + color: white; + text-align: center; + font-size: 4rem; +} \ No newline at end of file diff --git a/app/assets/stylesheets/redefinir_senha.css b/app/assets/stylesheets/redefinir_senha.css new file mode 100644 index 0000000000..893bc54580 --- /dev/null +++ b/app/assets/stylesheets/redefinir_senha.css @@ -0,0 +1,83 @@ +html, +body { + margin: 0; + padding: 0; + height: 100%; + font-family: Arial, Helvetica, sans-serif; + background-color: #f5f5f5; +} + +.password-reset-container { + height: 100vh; + + display: flex; + justify-content: center; + align-items: center; +} + +.password-reset-box { + width: 100%; + max-width: 450px; + + background: white; + + padding: 40px; + + border-radius: 10px; + + box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1); + + box-sizing: border-box; +} + +.password-reset-box h1 { + text-align: center; + + margin-top: 0; + margin-bottom: 30px; + + font-size: 2rem; + font-weight: normal; +} + +.field { + display: flex; + flex-direction: column; + + margin-bottom: 20px; +} + +.field label { + margin-bottom: 8px; +} + +.field input { + padding: 12px; + + border: 1px solid #d0d0d0; + border-radius: 6px; + + font-size: 1rem; + box-sizing: border-box; +} + +.btn-submit { + width: 100%; + + padding: 12px; + + border: none; + border-radius: 6px; + + background-color: #6e1f69; + color: white; + + font-size: 1rem; + font-weight: bold; + + cursor: pointer; +} + +.btn-submit:hover { + opacity: 0.9; +} \ No newline at end of file diff --git a/app/models/discente.rb b/app/models/discente.rb index d06b0b7772..d76084e48a 100644 --- a/app/models/discente.rb +++ b/app/models/discente.rb @@ -1,4 +1,4 @@ class Discente < Usuario validates :curso_id, presence: true - has_and_belongs_to_many :turmas + has_and_belongs_to_many :turmas, join_table: "discentes_turmas" end \ No newline at end of file diff --git a/app/models/docente.rb b/app/models/docente.rb index bd48475299..8c670c642b 100644 --- a/app/models/docente.rb +++ b/app/models/docente.rb @@ -1,4 +1,4 @@ class Docente < Usuario validates :formacao, presence: true - has_and_belongs_to_many :turmas + has_and_belongs_to_many :turmas, join_table: "docentes_turmas" end \ No newline at end of file diff --git a/app/models/turma.rb b/app/models/turma.rb index e189be5359..6015166c43 100644 --- a/app/models/turma.rb +++ b/app/models/turma.rb @@ -1,8 +1,8 @@ class Turma < ApplicationRecord belongs_to :disciplina has_many :formularios, dependent: :destroy - has_and_belongs_to_many :discentes - has_and_belongs_to_many :docentes + has_and_belongs_to_many :discentes, join_table: "discentes_turmas" + has_and_belongs_to_many :docentes, join_table: "docentes_turmas" validates :numero_da_turma, presence: true, uniqueness: { scope: [:semestre, :disciplina_id], diff --git a/app/views/redefinicao_senhas/new.html.erb b/app/views/redefinicao_senhas/new.html.erb index 88c31f2ef6..e7234e77f1 100644 --- a/app/views/redefinicao_senhas/new.html.erb +++ b/app/views/redefinicao_senhas/new.html.erb @@ -1,12 +1,19 @@ -

Redefinição de senha

+
+
-<%= form_with url: redefinir_senha_path do %> -
- <%= label_tag :email, "Email" %> - <%= email_field_tag :email %> -
+

Redefinição de senha

+ + <%= form_with url: redefinir_senha_path do %> + +
+ <%= label_tag :email, "Email" %> + <%= email_field_tag :email %> +
+ + <%= submit_tag "Solicitar redefinição", + class: "btn-submit" %> + + <% end %> -
- <%= submit_tag "Solicitar redefinição" %>
-<% end %> +
\ No newline at end of file diff --git a/app/views/sessions/new.html.erb b/app/views/sessions/new.html.erb index a8cceae605..8f93b2236a 100644 --- a/app/views/sessions/new.html.erb +++ b/app/views/sessions/new.html.erb @@ -1,19 +1,30 @@ -

Login

+
+ \ No newline at end of file diff --git a/config/database.yml b/config/database.yml index a857bdc858..63ad6ca8d5 100644 --- a/config/database.yml +++ b/config/database.yml @@ -13,8 +13,8 @@ default: &default adapter: mysql2 encoding: utf8mb4 pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %> - username: root - password: root + username: camaar + password: senha_do_camaar socket: /var/run/mysqld/mysqld.sock development: diff --git a/db/seeds.rb b/db/seeds.rb index 4fbd6ed970..134d68ef30 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -1,9 +1,97 @@ -# This file should ensure the existence of records required to run the application in every environment (production, -# development, test). The code here should be idempotent so that it can be executed at any point in every environment. -# The data can then be loaded with the bin/rails db:seed command (or created alongside the database with db:setup). -# -# Example: -# -# ["Action", "Comedy", "Drama", "Horror"].each do |genre_name| -# MovieGenre.find_or_create_by!(name: genre_name) -# end +# This file should ensure the existence of records required to run the application in every environment. +# The code here should be idempotent so that it can be executed at any point in every environment. + +# Departamentos +dept_cic = Departamento.find_or_create_by!(codigo: "CIC") do |d| + d.nome = "Ciência da Computação" +end + +dept_mat = Departamento.find_or_create_by!(codigo: "MAT") do |d| + d.nome = "Matemática" +end + +# Cursos +curso_cc = Curso.find_or_create_by!(codigo: "CC") do |c| + c.nome = "Bacharelado em Ciência da Computação" + c.departamento = dept_cic +end + +# Disciplinas +disc_ed = Disciplina.find_or_create_by!(codigo: "CIC0001") do |d| + d.nome = "Estrutura de Dados" + d.departamento = dept_cic +end + +# Turmas +turma_a = Turma.find_or_create_by!(numero_da_turma: "A", semestre: "2026.1", disciplina: disc_ed) do |t| + t.horario = "35T23" +end + +# Usuários (Docente, Discente, Admin) +# A migration AjustaNulosParaSti permite que curso e departamento sejam nulos, +# mas vamos associá-los aos nossos testes para dados mais ricos. + +docente = Docente.find_or_initialize_by(email: "docente@teste.com") +docente.nome ||= "Docente Teste" +docente.matricula ||= "241000001" +docente.senha = "teste123" +docente.senha_confirmation = "teste123" +docente.departamento = dept_cic +docente.formacao = "doutorado" +docente.save! + +discente = Discente.find_or_initialize_by(email: "discente@teste.com") +discente.nome ||= "Discente Teste" +discente.matricula ||= "241000002" +discente.senha = "teste123" +discente.senha_confirmation = "teste123" +discente.curso = curso_cc +docente.formacao = "graduacao" +discente.save! + +admin = Administrador.find_or_initialize_by(email: "admin@teste.com") +admin.nome ||= "Admin Teste" +admin.matricula ||= "240000003" +admin.senha = "teste123" +admin.senha_confirmation = "teste123" +admin.departamento = dept_cic +admin.save! + +# Vinculando Usuários às Turmas +discente.turmas << turma_a unless discente.turmas.include?(turma_a) +docente.turmas << turma_a unless docente.turmas.include?(turma_a) + +# Templates, Elementos e Campos (Estrutura base de formulários) +template = Template.find_or_create_by!(nome: "Avaliação de Disciplina Padrão") + +elemento1 = Elemento.find_or_create_by!(enunciado: "Avalie a didática do professor", template: template) do |e| + e.ordem = 1 +end + +campo1 = Campo.find_or_create_by!(enunciado: "Nota de 1 a 5", elemento: elemento1) do |c| + c.ordem = 1 + c.tipo_elemento = "escala" +end + +# Formulários de Turma, Elementos de Form e Campos de Form +formulario = Formulario.find_or_create_by!(turma: turma_a) + +elemento_form = ElementoForm.find_or_create_by!(enunciado: elemento1.enunciado, formulario: formulario) do |ef| + ef.ordem = elemento1.ordem +end + +campo_form = CampoForm.find_or_create_by!(enunciado: campo1.enunciado, elemento_form: elemento_form) do |cf| + cf.ordem = campo1.ordem +end + +# Respostas (Simulando uma resposta de um Discente) +resposta_form = RespostaForm.find_or_create_by!(formulario: formulario, usuario: discente) do |rf| + rf.data_submissao = Date.today +end + +RespostaElem.find_or_create_by!(resposta_form: resposta_form, elemento_form: elemento_form) do |re| + re.texto_resposta = "5" + re.campo_form = campo_form # campo_form_id pode ser nulo pela sua migration, mas passamos aqui +end + +puts "Seeds finalizados com sucesso" \ No newline at end of file