Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alterações de layout #142

Merged
merged 14 commits into from
Feb 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/assets/stylesheets/application.bootstrap.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
@import 'simple_calendar';
@import 'app_theme';

.form-control:focus {
.form-control:focus, .form-select:focus {
border-color: $colaBoraGreen;
box-shadow: 0 0 0 0.2rem rgba(19, 121, 91, 0.075);
}
4 changes: 4 additions & 0 deletions app/assets/stylesheets/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,7 @@
color: $colaBoraGreenHover!important;
}
}

label.required:after {
content: "*";
}
4 changes: 3 additions & 1 deletion app/controllers/home_controller.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
class HomeController < ApplicationController
skip_before_action :authenticate_user!, only: %i[index]

def index; end
def index
redirect_to projects_path if user_signed_in?
end
end
2 changes: 2 additions & 0 deletions app/controllers/projects_controller.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
class ProjectsController < ApplicationController
skip_before_action :authenticate_user!, only: %i[index]
before_action :set_project, only: %i[show edit update destroy members invitations]
before_action :check_contributor, only: %i[show edit update destroy members invitations]
before_action :check_leader, only: %i[edit update invitations]
before_action :set_all_job_categories, only: %i[new create edit update]
before_action :set_project_job_categories, only: %i[show edit]

def index
return redirect_to home_path unless user_signed_in?
return @projects = current_user.contributing_projects if params[:filter] == 'contributing_projects'
return @projects = current_user.my_projects if params[:filter] == 'my_projects'

Expand Down
61 changes: 34 additions & 27 deletions app/views/documents/_form.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<% if @document.errors.any? %>
<div class='text-danger'>
<section class="mb-3">
<% if @document.errors.any? %>
<div class='alert alert-danger'>
<h3><%= I18n.t(:error, count: @document.errors.count) %>:</h3>
<ul>
<% @document.errors.each do |error| %>
Expand All @@ -8,31 +9,37 @@
</ul>
</div>
<% end %>
<%= form_with model: [@project, @document] do |f| %>
<div class="mb-3">
<%= f.label :title, class: 'form-label' %>
<%= f.text_field :title,
placeholder: I18n.t(:document_title_placeholder),
class: 'form-control',
autofocus: true %>
</div>
<%= form_with model: [@project, @document] do |f| %>
<div class="mb-3">
<%= f.label :title, class: 'form-label required' %>
<%= f.text_field :title,
placeholder: I18n.t(:document_title_placeholder),
class: 'form-control',
autofocus: true %>
</div>

<div class="mb-3">
<%= f.label :description, class: 'form-label' %>
<%= f.text_area :description,
placeholder: I18n.t(:document_description_placeholder),
class: 'form-control' %>
</div>

<div class="mb-3">
<%= f.label :description, class: 'form-label' %>
<%= f.text_area :description,
placeholder: I18n.t(:document_description_placeholder),
class: 'form-control' %>
</div>
<div class="mb-3">
<%= f.label :file, class: 'form-label required' %>
<div class="small mb-2 text-secondary">
<small><%= t(:allowed_extensions) %></small>
</div>
<%= f.file_field :file, class: 'form-control' %>
</div>

<div class="mb-3">
<%= f.label :file, class: 'form-label' %>
<%= f.file_field :file, class: 'form-control' %>
</div>
<%= render 'shared/required_fields' %>

<div>
<%= f.submit class: 'btn btn-primary' %>
<%= link_to 'Voltar',
project_documents_path(@project),
class: 'btn btn-secondary' %>
</div>
<% end %>
<div>
<%= f.submit class: 'btn btn-primary' %>
<%= link_to 'Voltar',
project_documents_path(@project),
class: 'btn btn-secondary' %>
</div>
<% end %>
</section>
2 changes: 1 addition & 1 deletion app/views/documents/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<div id="documents-list">
<% if @documents.empty? %>
<div class="text-muted">
<%= t(:documents_empty_state) %>
<%= render 'shared/empty_state', message: t(:documents_empty_state) %>
</div>
<% else %>
<table class="table table-hover">
Expand Down
3 changes: 2 additions & 1 deletion app/views/documents/new.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<%= render 'shared/project_header', project: @project %>

<h1>Novo documento</h1>
<h1 class="display-6"><%= t(:new_document) %></h1>

<%= render 'form' %>
6 changes: 3 additions & 3 deletions app/views/documents/show.html.erb
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<%= render 'shared/project_header', project: @document.project %>

<main>
<main class="mb-3">
<div id="document-details">
<h1><%= @document.title %></h1>
<h1 class="display-6"><%= @document.title %></h1>

<div>
<% if @document.file.image? %>
Expand All @@ -15,7 +15,7 @@
<% elsif @document.file.video? %>
<video controls width="480">
<source src="<%= rails_blob_url @document.file %>"
type="<%= @document.file.content_type %>">
type="<%= @document.file.content_type %>">
</video>
<% end %>
</div>
Expand Down
2 changes: 1 addition & 1 deletion app/views/invitations/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
</div>
<% end %>
<% else %>
<h3><%= t('invitations.empty_state') %></h3>
<%= render 'shared/empty_state', message: t('invitations.empty_state') %>
<% end %>
</div>
</div>
2 changes: 2 additions & 0 deletions app/views/invitations/show.html.erb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<h1><%= t('invitations.details') %></h1>

<p>
<strong><%= @invitation.project.title %>: </strong>
<%= @invitation.project.description %>
Expand Down
10 changes: 5 additions & 5 deletions app/views/layouts/_navbar.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<nav class="navbar navbar-expand-lg bg-body-tertiary" id="navbar">
<div class="container-fluid">
<nav class="navbar navbar-expand-lg bg-light shadow-sm" id="navbar">
<div class="container">
<%= link_to 'Cola?Bora!',
root_path,
class:"navbar-brand" %>
Expand All @@ -13,7 +13,7 @@
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNavAltMarkup">
<ul class="navbar-nav justify-content-end flex-grow-1 pe-3">
<ul class="navbar-nav justify-content-end flex-grow-1 pe-3 d-flex align-items-center">
<% if user_signed_in? %>
<li class="nav-item">
<%= link_to t(:create_project_link),
Expand All @@ -35,12 +35,12 @@
profile_path(current_user.profile),
class: 'nav-link' %>
</li>
<p class="nav-link"><%= current_user.email %></p>
<li class="nav-link"><%= current_user.email %></li>
<li class="nav-item">
<%= button_to t(:log_out),
destroy_user_session_path,
method: :delete,
class: 'btn btn-danger' %>
class: 'btn btn-sm btn-outline-secondary' %>
</li>
<% else %>
<li>
Expand Down
6 changes: 3 additions & 3 deletions app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
<%= favicon_link_tag asset_path('favicon.png') %>
</head>
<body>
<div class="mb-3">
<%= render partial: 'layouts/navbar' %>
</div>
<div class="container">
<div class="mb-3">
<%= render partial: 'layouts/navbar' %>
</div>
<%= render partial: 'layouts/flash' %>
<%= yield %>
</div>
Expand Down
94 changes: 56 additions & 38 deletions app/views/meetings/_form.html.erb
Original file line number Diff line number Diff line change
@@ -1,40 +1,58 @@
<%= form_with(model: [@project, @meeting]) do |f| %>
<% if @meeting.errors.any? %>
<div class='text-danger'>
<h3><%= I18n.t('.errors_title') %>:</h3>
<ul>
<% @meeting.errors.each do |error| %>
<li><%= error.full_message %></li>
<% end %>
</ul>
<section class="mb-3">
<%= form_with(model: [@project, @meeting]) do |f| %>
<% if @meeting.errors.any? %>
<div class='alert alert-danger'>
<h3><%= I18n.t('.errors_title') %>:</h3>
<ul>
<% @meeting.errors.each do |error| %>
<li><%= error.full_message %></li>
<% end %>
</ul>
</div>
<% end %>

<div class="mb-3">
<%= f.label :title,
class: 'form-label required' %>
<%= f.text_field :title,
class: 'form-control',
autofocus: true,
placeholder: t('.title') %>
</div>
<div class="mb-3">
<%= f.label :description,
class: 'form-label' %>
<%= f.text_area :description,
class: 'form-control',
placeholder: t('.description') %>
</div>
<div class="mb-3">
<%= f.label :datetime,
class: 'form-label required' %>
<%= f.datetime_local_field :datetime,
class: 'form-control',
id:'datetime' %>
</div>
<div class="mb-3">
<%= f.label :duration,
class: 'form-label required' %>
<%= f.number_field :duration,
class: 'form-control',
placeholder: t('meetings.duration_placeholder') %>
</div>
<div class="mb-3">
<%= f.label :address,
class: 'form-label required' %>
<%= f.text_field :address,
class: 'form-control',
placeholder: t('.address') %>
</div>

<%= render 'shared/required_fields' %>

<div>
<%= f.submit I18n.t('meetings.save'), class: 'btn btn-primary'%>
<%= link_to t(:back), project_meetings_path(@project), class: 'btn btn-secondary' %>
</div>
<% end %>

<div class="mb-3">
<%= f.label :title, class: 'form-label' %>
<%= f.text_field :title, class: 'form-control' %>
</div>
<div class="mb-3">
<%= f.label :description, class: 'form-label' %>
<%= f.text_area :description, class: 'form-control' %>
</div>
<div class="mb-3">
<%= f.label :datetime, class: 'form-label' %>
<%= f.datetime_local_field :datetime, class: 'form-control', id:'datetime' %>
</div>
<div class="mb-3">
<%= f.label :duration, class: 'form-label' %>
<%= f.number_field :duration,
class: 'form-control',
placeholder: t('meetings.duration_placeholder') %>
</div>
<div class="mb-3">
<%= f.label :address, class: 'form-label' %>
<%= f.text_field :address, class: 'form-control' %>
</div>
<div>
<%= f.submit I18n.t('meetings.save'), class: 'btn btn-primary'%>
<%= link_to t(:back), project_meetings_path(@project), class: 'btn btn-secondary' %>
</div>
<% end %>

</section>
2 changes: 1 addition & 1 deletion app/views/meetings/edit.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<%= render 'shared/project_header', project: @project %>

<h1><%= I18n.t('meetings.edit_meeting')%></h1>
<h1 class="display-6"><%= I18n.t('meetings.edit_meeting')%></h1>

<%= render 'form' %>
2 changes: 1 addition & 1 deletion app/views/meetings/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

<div id="meeting-list">
<% if @meetings.empty? %>
<p><%= t('meetings.empty_state') %></p>
<%= render 'shared/empty_state', message: t('meetings.empty_state') %>
<% else %>
<table class="table table-hover">
<thead>
Expand Down
2 changes: 1 addition & 1 deletion app/views/meetings/new.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<%= render 'shared/project_header', project: @project %>

<h1><%= I18n.t('meetings.create_meeting')%></h1>
<h1 class="display-6"><%= I18n.t('meetings.create_meeting')%></h1>

<%= render 'form' %>
2 changes: 1 addition & 1 deletion app/views/meetings/show.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<%= render 'shared/project_header', project: @project %>

<h1><%= Meeting.model_name.human %>: <%= @meeting.title %></h1>
<h1 class="display-6"><%= Meeting.model_name.human %>: <%= @meeting.title %></h1>

<dl>
<dt><%= Meeting.human_attribute_name :user_role %></dt>
Expand Down
2 changes: 1 addition & 1 deletion app/views/portfoliorrr_profiles/_invitation_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</h3>

<% if invitation.errors.any? %>
<div class='text-danger'>
<div class='alert alert-danger'>
<h3><%= I18n.t('.errors_title') %>:</h3>
<ul>
<% invitation.errors.each do |error| %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/profiles/_form.html.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<%= form_with model: profile do |f| %>
<div class="mb-3">
<%= f.label :first_name, class: 'form-label' %>
<%= f.text_field :first_name, class: 'form-control' %>
<%= f.text_field :first_name, class: 'form-control', autofocus: true %>
</div>

<div class="mb-3">
Expand Down
4 changes: 2 additions & 2 deletions app/views/profiles/_profile_info.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@

<p>
<strong><%= Profile.human_attribute_name :work_experience %>: </strong>
<%= profile.work_experience %>
<%= profile.work_experience.present? ? profile.work_experience : t(:not_informed) %>
</p>

<p>
<strong><%= Profile.human_attribute_name :education %>: </strong>
<%= profile.education %>
<%= profile.education.present? ? profile.education : t(:not_informed) %>
</p>
14 changes: 8 additions & 6 deletions app/views/profiles/show.html.erb
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
<h1>Meu <%= Profile.model_name.human %></h1>
<h1><%= t(:my_profile) %></h1>


<% if @profile.first_update? %>
<h2>Seu perfil ainda não tem informações</h2>
<p>
<strong>Clique no botão abaixo para preencher</strong>
</p>

<h2><%= t(:profile_empty_state) %></h2>

<div class="text-muted mb-3">
<%= t(:click_the_button_below_to_fill_out) %>
</div>

<%= link_to 'Completar perfil',
<%= link_to t(:complete_profile),
edit_profile_path(current_user.profile),
class: 'btn btn-primary' %>
<% else %>
Expand Down
Loading
Loading