Skip to content

Commit

Permalink
Merge pull request #35 from TreinaDev/feature/layout-da-home
Browse files Browse the repository at this point in the history
Feature/layout da home e projetos
  • Loading branch information
Luckvc authored Jan 29, 2024
2 parents de9e7b6 + 963c299 commit b68b15d
Show file tree
Hide file tree
Showing 55 changed files with 481 additions and 281 deletions.
Binary file added app/assets/images/favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/images/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/images/logo_cola_bora.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions app/assets/stylesheets/application.bootstrap.scss
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
@import 'bootstrap/scss/bootstrap';
@import 'bootstrap-icons/font/bootstrap-icons';
@import 'home.css';
30 changes: 30 additions & 0 deletions app/assets/stylesheets/home.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
.logo {
width: 150px;
}
nav a {
color: #13795b!important;
text-decoration: none!important;
}
nav a:hover {
color: #10674d!important;
}

/* .btn.btn-primary {
background-color: #4f8471;
border: 0;
color: rgb(226, 226, 226)!important;
}
.btn.btn-secondary {
background-color: #6c757d;
border: 0;
color: rgb(226, 226, 226)!important;
}
.btn.btn-primary:hover {
background-color:#8dcbbb;
border: 0;
}
.btn.btn-primary:active {
background-color:#8dcbbb!important;
border: 0;
}
*/
4 changes: 4 additions & 0 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,8 @@ def configure_permitted_parameters
def not_found
redirect_to root_path, alert: t('.not_found')
end

def after_sign_in_path_for(resource)
stored_location_for(resource) || projects_path
end
end
7 changes: 1 addition & 6 deletions app/controllers/projects_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,7 @@ class ProjectsController < ApplicationController
before_action :check_contributor, only: %i[show edit destroy]

def index
@projects = Project.all
end

def my_projects
@projects = Project.where(user_id: current_user)
render :index
end

def new
Expand All @@ -35,7 +30,7 @@ def destroy
return redirect_to root_path, alert: t('.fail') unless current_user == @project.user

@project.destroy
redirect_to my_projects_projects_path, notice: t('.success')
redirect_to projects_path, notice: t('.success')
end

private
Expand Down
14 changes: 5 additions & 9 deletions app/views/devise/passwords/new.html.erb
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
<h2><%= I18n.t "devise.passwords.new.forgot_your_password" %></h2>

<%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f| %>
<%= render "devise/shared/error_messages", resource: resource %>

<div class="field">
<%= f.label :email %><br />
<%= f.email_field :email, autofocus: true, autocomplete: "email" %>
<div class="mb-3">
<%= f.label :email, class: 'form-label' %><br />
<%= f.email_field :email, autofocus: true, autocomplete: "email", class: 'form-control' %>
</div>

<div class="actions">
<%= f.submit I18n.t "devise.passwords.new.send_me_reset_password_instructions" %>
<div class="mb-3">
<%= f.submit I18n.t("devise.passwords.new.send_me_reset_password_instructions"), class: 'btn btn-primary' %>
</div>
<% end %>

<%= render "devise/shared/links" %>
37 changes: 15 additions & 22 deletions app/views/devise/registrations/new.html.erb
Original file line number Diff line number Diff line change
@@ -1,34 +1,27 @@
<h2><%= I18n.t :sign_up %></h2>

<%= form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %>
<%= render "devise/shared/error_messages", resource: resource %>

<div class="field">
<%= f.label :cpf %><br />
<%= f.text_field :cpf, autofocus: true %>
<div class="mb-3">
<%= f.label :cpf, class: 'form-label' %><br />
<%= f.text_field :cpf, autofocus: true, class: 'form-control' %>
</div>

<div class="field">
<%= f.label :email %><br />
<%= f.email_field :email, autocomplete: "email" %>
<div class="mb-3">
<%= f.label :email, class: 'form-label' %><br />
<%= f.email_field :email, autocomplete: "email", class: 'form-control' %>
</div>

<div class="field">
<%= f.label :password %>
<div class="mb-3">
<%= f.label :password, class: 'form-label' %>
<% if @minimum_password_length %>
<em><%= I18n.t("devise.shared.minimum_password_length.other", count: @minimum_password_length) %></em>
<em><%= I18n.t("devise.shared.minimum_password_length.other", count: @minimum_password_length) %></em>
<% end %><br />
<%= f.password_field :password, autocomplete: "new-password" %>
<%= f.password_field :password, autocomplete: "new-password", class: 'form-control' %>
</div>

<div class="field">
<%= f.label :password_confirmation %><br />
<%= f.password_field :password_confirmation, autocomplete: "new-password" %>
<div class="mb-3">
<%= f.label :password_confirmation, class: 'form-label' %><br />
<%= f.password_field :password_confirmation, autocomplete: "new-password", class: 'form-control' %>
</div>

<div class="actions">
<%= f.submit I18n.t :sign_up %>
<div class="mb-3">
<%= f.submit I18n.t(:sign_up), class: 'btn btn-primary' %>
</div>
<% end %>

<%= render "devise/shared/links" %>
23 changes: 9 additions & 14 deletions app/views/devise/sessions/new.html.erb
Original file line number Diff line number Diff line change
@@ -1,26 +1,21 @@
<h2><%= I18n.t :log_in %></h2>

<%= form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %>
<div class="field">
<%= f.label :email %><br />
<%= f.email_field :email, autofocus: true, autocomplete: I18n.t("activerecord.attributes.user.email") %>
<div class="mb-3">
<%= f.label :email, class: 'form-label' %><br />
<%= f.email_field :email, autofocus: true, autocomplete: I18n.t("activerecord.attributes.user.email"), class: 'form-control' %>
</div>

<div class="field">
<%= f.label :password %><br />
<%= f.password_field :password, autocomplete: I18n.t("activerecord.attributes.user.current_password")%>
<div class="mb-3">
<%= f.label :password, class: 'form-label' %><br />
<%= f.password_field :password, autocomplete: I18n.t("activerecord.attributes.user.current_password"), class: 'form-control'%>
</div>

<% if devise_mapping.rememberable? %>
<div class="field">
<div class="mb-3">
<%= f.check_box :remember_me %>
<%= f.label :remember_me %>
</div>
<% end %>

<div class="actions">
<%= f.submit I18n.t :log_in %>
<div class="mb-3">
<%= f.submit I18n.t(:log_in), class: 'btn btn-primary' %>
</div>
<% end %>

<%= render "devise/shared/links" %>
11 changes: 3 additions & 8 deletions app/views/devise/shared/_links.html.erb
Original file line number Diff line number Diff line change
@@ -1,23 +1,18 @@
<%- if controller_name != 'sessions' %>
<%= link_to I18n.t("devise.shared.links.sign_in"), new_session_path(resource_name) %><br />
<%= link_to I18n.t("devise.shared.links.sign_in"), new_session_path(resource_name)%><br />
<% end %>

<%- if devise_mapping.registerable? && controller_name != 'registrations' %>
<%= link_to I18n.t(:sign_up), new_registration_path(resource_name) %><br />
<%= link_to I18n.t(:sign_up), new_registration_path(resource_name)%><br />
<% end %>

<%- if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations' %>
<%= link_to I18n.t("devise.shared.links.forgot_your_password"), new_password_path(resource_name) %><br />
<%= link_to I18n.t("devise.shared.links.forgot_your_password"), new_password_path(resource_name), class: 'text-decoration-none' %><br />
<% end %>

<%- if devise_mapping.confirmable? && controller_name != 'confirmations' %>
<%= link_to I18n.t("devise.shared.links.didn_t_receive_confirmation_instructions"), new_confirmation_path(resource_name) %><br />
<% end %>

<%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %>
<%= link_to I18n.t("devise.shared.links.didn_t_receive_unlock_instructions"), new_unlock_path(resource_name) %><br />
<% end %>

<%- if devise_mapping.omniauthable? %>
<%- resource_class.omniauth_providers.each do |provider| %>
<%= button_to "devise.shared.links.sign_in_with_provider #{OmniAuth::Utils.camelize(provider)}", omniauth_authorize_path(resource_name, provider), data: { turbo: false } %><br />
Expand Down
6 changes: 3 additions & 3 deletions app/views/documents/_document_row.html.erb
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<tr>
<tr class="align-middle">
<td><%= document.title %></td>
<td><%= document.file.filename.extension.upcase %></td>
<td><%= document.user.email %></td>
<td><%= l(document.created_at.to_date) %></td>
<td colspan="2">
<%= link_to t(:document_details_btn), document_path(document), class: "btn btn-secondary" %>
<%= link_to t(:document_details_btn), document_path(document), class: "btn btn-sm btn-secondary" %>
<%= link_to t(:document_download_btn),
rails_blob_path(document.file, disposition: "attachment"),
class: "btn btn-primary ms-2" %>
class: "btn btn-sm btn-primary ms-2" %>
</td>
</tr>
12 changes: 7 additions & 5 deletions app/views/documents/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
<%= link_to t(:back), project_path(@project), class: "btn btn-sm btn-secondary" %>

<h1><%= Document.model_name.human count: 2 %> | <%= @project.title %></h1>
<%= render 'shared/project_header', project: @project %>

<section>
<div class="mb-3 mt-3">
<%= link_to t(:document_new_btn), new_project_document_path, class: "btn btn-primary" %>
<%= link_to t(:document_new_btn),
new_project_document_path,
class: "btn btn-primary" %>
</div>

<div id="documents-list">
<% if @documents.empty? %>
<p><%= t(:documents_empty_state) %></p>
<div class="text-muted">
<%= t(:documents_empty_state) %>
</div>
<% else %>
<table class="table table-hover">
<thead>
Expand Down
2 changes: 2 additions & 0 deletions app/views/documents/new.html.erb
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
<%= render 'shared/project_header', project: @project %>

<h1>Novo documento</h1>
<%= render 'form' %>
11 changes: 6 additions & 5 deletions app/views/documents/show.html.erb
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<main>
<%= link_to t(:back),
project_documents_path(@document.project),
class: "btn btn-sm btn-secondary" %>
<%= render 'shared/project_header', project: @document.project %>

<main>
<div id="document-details">
<h1><%= @document.title %></h1>

Expand Down Expand Up @@ -44,8 +42,11 @@
archive_document_path(@document),
method: :patch,
data: { turbo_confirm: t(:document_archive_confirm) },
class: "btn btn-danger" %>
class: "btn btn-danger me-3" %>
<% end %>
<%= link_to t(:back),
project_documents_path(@document.project),
class: "btn btn-secondary" %>
</div>
</div>
</main>
23 changes: 13 additions & 10 deletions app/views/home/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@

<div id="vue-app" class="card">
<div class="card-body">
<label>Mensagem
<input type="text" v-model="insertText" placeholder="Coloque uma mensagem aqui" class="form-control">
</label>
<button v-on:click="insertMessage" class="btn btn-primary">Imprimir</button>
</div>
<div class="card-footer">
<p>{{ message }}</p>
<div class="container my-5">
<div class="p-5 text-center bg-body-tertiary rounded-3">
<%= image_tag 'logo_cola_bora.png', class:'bi mt-4 mb-3 logo' %>
<h1 class="text-body-emphasis">Cola?Bora!</h1>
<p class="col-lg-8 mx-auto fs-5 text-muted">A maior plataforma colaborativa para gerenciamento de projetos com times de grande e pequeno porte.</p>
<div class="d-inline-flex gap-2 mb-5">
<% if user_signed_in? %>
<%= link_to "Ver Projetos", projects_path, class: 'd-inline-flex align-items-center btn btn-primary btn-lg px-4 rounded-pill' %>
<%else%>
<%= link_to "Entrar", new_user_session_path, class: 'd-inline-flex align-items-center btn btn-primary btn-lg px-4 rounded-pill' %>
<%= link_to "Criar sua conta", new_user_registration_path, class: 'btn btn-outline-secondary btn-lg px-4 rounded-pill' %>
<% end %>
</div>
</div>
</div>
5 changes: 5 additions & 0 deletions app/views/layouts/_flash.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<% if flash[:notice]%>
<div class="alert alert-success text-center"><%= flash[:notice]%></div>
<%elsif flash[:alert]%>
<div class="alert alert-danger text-center"><%= flash[:alert]%></div>
<% end %>
50 changes: 39 additions & 11 deletions app/views/layouts/_navbar.html.erb
Original file line number Diff line number Diff line change
@@ -1,22 +1,50 @@
<nav class="navbar navbar-expand-lg bg-body-tertiary">
<nav class="navbar navbar-expand-lg bg-body-tertiary" id="navbar">
<div class="container-fluid">
<a class="navbar-brand" href="#">Cola?Bora!</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNavAltMarkup" aria-controls="navbarNavAltMarkup" aria-expanded="false" aria-label="Toggle navigation">
<%= link_to 'Cola?Bora!',
root_path,
class:"navbar-brand" %>
<button class="navbar-toggler"
type="button"
data-bs-toggle="collapse"
data-bs-target="#navbarNavAltMarkup"
aria-controls="navbarNavAltMarkup"
aria-expanded="false"
aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNavAltMarkup">
<div class="navbar-nav">
<%= link_to 'Home', root_path, class:"nav-link" %>
<%= link_to 'Criar Projeto', new_project_path, class:"nav-link" %>
<%= link_to 'Projetos', projects_path, class:"nav-link" %>
<ul class="navbar-nav justify-content-end flex-grow-1 pe-3">
<% if user_signed_in? %>
<%= link_to 'Meu perfil', profile_path(current_user.profile), class: 'nav-link' %>
<li class="nav-item">
<%= link_to t(:create_project_link),
new_project_path,
class:"nav-link" %>
</li>
<li class="nav-item">
<%= link_to Project.model_name.human(count: 2),
projects_path,
class:"nav-link" %>
</li>
<li class="nav-item">
<%= link_to t(:my_profile),
profile_path(current_user.profile),
class: 'nav-link' %>
</li>
<p class="nav-link"><%= current_user.email %></p>
<%= button_to "Sair", destroy_user_session_path, method: :delete, class: 'btn btn-danger' %>
<li class="nav-item">
<%= button_to t(:log_out),
destroy_user_session_path,
method: :delete,
class: 'btn btn-danger' %>
</li>
<% else %>
<%= link_to "Entrar", new_user_session_path, class: 'btn btn-primary' %>
<li>
<%= link_to t(:log_in),
new_user_session_path,
class: 'btn btn-primary link-light' %>
</li>
<% end %>
</div>
</ul>
</div>
</div>
</nav>
11 changes: 4 additions & 7 deletions app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,14 @@
<%= csp_meta_tag %>
<%= stylesheet_link_tag "application", "data-turbo-track": "reload" %>
<%= javascript_include_tag "application", "data-turbo-track": "reload", type: "module" %>
<%= favicon_link_tag asset_path('favicon.png') %>
</head>
<body>
<div class="container">

<%= render partial: 'layouts/navbar' %>

<div>
<p class="notice"><%= notice %></p>
<p class="alert"><%= alert %></p>
<div class="mb-3">
<%= render partial: 'layouts/navbar' %>
</div>

<%= render partial: 'layouts/flash' %>
<%= yield %>
</div>
</body>
Expand Down
Loading

0 comments on commit b68b15d

Please sign in to comment.