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

Vistas creadas junto con el controlador. #19

Open
wants to merge 6 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
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
1 change: 1 addition & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ GEM
activerecord (= 6.1.4.4)
activesupport (= 6.1.4.4)
marcel (~> 1.0.0)
mini_magick
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Me pregunto si agregaste mini_magick en el Gemfile para que el proyecto pudiera correr en tu ambiente local, o si esto se agrego solo 🤔

Si no es necesario, podriamos remover esto del commit? 😄

mini_mime (>= 1.1.0)
activesupport (6.1.4.4)
concurrent-ruby (~> 1.0, >= 1.0.2)
Expand Down
Binary file added app/assets/images/chamba-icon.png
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/stylesheets/chambas.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Place all the styles related to the chambas controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: https://sass-lang.com/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Si no necesitamos este fichero, podemos removerlo? 😄

101 changes: 101 additions & 0 deletions app/assets/stylesheets/components/cards.scss
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,104 @@
padding: var(--su-4);
}
}

.filters {
display: flex;
align-items: center;
flex-direction: row;
justify-content: space-between;

.filters-applied {
display: flex;
align-items: center;

.filter {
color: #3b49df;
background-color: #3b49df36;
border-radius: 40px;
border: 5px solid #3b49df;
padding: 0.5rem 1.5rem;
margin-right: 20px;
}
}
.filters-btn {
background-color: white;
border-radius: 40px;
border: 5px solid #d7d7d7;
padding: 0.5rem 1.5rem;
cursor: pointer;

a {
color: #b0b0b0;
}
}
}

i {
margin-right: 0.3rem;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hay que tener cuidado al usar elementos en CSS, Podriamos ser mas especificos con este selector?
Esto podria alterar el estilo de todos los elementos <i> en el proyecto


.chambas-found {
display: flex;
justify-content: space-between;
align-items: center;
span {
color: black;
font-weight: 600;
}
a {
color: #b0b0b0;
background-color: white;
border-radius: 5px;
border: 5px solid #d7d7d7;
padding: 0.5rem 1.5rem;
cursor: pointer;
}
}

.chambas-card {
display: grid;
grid-template-columns: 13% 77% 10%;

&:hover {
box-shadow: rgba(0, 0, 0, 0.1) 0px 10px 15px -3px,
rgba(0, 0, 0, 0.05) 0px 4px 6px -2px;
transition: all var(--transition-props);
}
.chamba-image {
display: block;
margin: 0 auto;
width: 130px;
}
.chamba-summary {
h4 {
color: #a3a3a3;
font-weight: 500;
font-size: 24px;
line-height: 36px;
}
h3 {
color: #84858c;
font-weight: 600;
font-size: 36px;
line-height: 54px;
margin-bottom: 0.7rem;
}
span {
color: #4449e0a8;
font-weight: 600;
font-size: 14px;
line-height: 21px;
border-radius: 14px;
background-color: #3b49df36;
padding: 0.5rem 0.7rem;
}
}
.chamba-date {
text-align: center;
font-weight: 600;
line-height: 21px;
font-size: 14px;
color: #84858c;
}
}
6 changes: 6 additions & 0 deletions app/controllers/chambas_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
class ChambasController < ApplicationController
def chambas
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
def chambas
def index

Intentemos seguir las conveciones de REST

@filters = %w[Mexico Web-Developer Programación Issues]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Podemos mover esto a una constante, en incluso al modelo de Chambas? 😄

@var_back = params[:filter_active]
end
end
6 changes: 6 additions & 0 deletions app/controllers/pages_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,12 @@ def terms
set_surrogate_key_header "terms_page"
end

def glosario
@page = Page.find_by(slug: "glosario")
render :show if @page
set_surrogate_key_header "glosario"
end

def report_abuse
reported_url = params[:reported_url] || params[:url] || request.referer.presence
@feedback_message = FeedbackMessage.new(
Expand Down
2 changes: 2 additions & 0 deletions app/helpers/chambas_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
module ChambasHelper
end
35 changes: 35 additions & 0 deletions app/views/chambas/chamba.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<div class="chamba">
<div class="crayons-layout crayons-layout--3-cols crayons-layout--3-cols--drop-right-left">
<div class="navbar">
</div>
<div class="card-chamba">
<div class="return-chamba">
<a href="#">Regresar</a>
</div>
<div class="title-chamba">
<%= image_tag "chamba-icon.png" %>
<span>Codeando México</span>
</div>
<h1>Intern en tecnología</h1>
<span>Remoto (México) | Internship | $1M</span>
<div class="chamba-btn">
<button type="button" class="btn btn-primary">Aplicar ahora</button>
</div>
<div class="chamba-info">
<div class="chamba-responsibilities">
<h3>Responsabilidades</h3>
<span>Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam .</span>
</div>
<div class="chamba-requirements">
<h3>Requerimientos</h3>
<ul>
<li>Hola</li>
<li>Bubulubuenas noches</li>
<li>Como stas</li>
<li>arriva paiton</li>
</ul>
</div>
</div>
</div>
</div>
</div>
79 changes: 79 additions & 0 deletions app/views/chambas/chambas.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
<div class="crayons-layout">
<div class="filters" style="display: flex; flex-direction: row;"><!--los estilos de esta etiqueta solo son temporales-->
<div class="filters-applied">
<% @filters.each do |filter| %>
<div class="filter"><%= link_to(filter.to_s, chambas_path(filter_active: filter)) %> </div>
<% end %>
</div>
<div class="filters-btn">
<a>
<i class="fas fa-filter"></i> Filtros
</a>
</div>
</div>
variable desde back:<%= @var_back %>
<div class="chambas-found mb-5">
<span>4 chambitas encontradas</span>
<a><i class="fas fa-sort-amount-down"></i>Mas recientes</a>
</div>
<div id="chambas">
<div class="chambas-list">
<a href="#">
<div class="chamba crayons-card mb-6 chambas-card pl-5 pr-5 pt-4 pb-4">
<%= image_tag "chamba-icon.png", class: "chamba-image" %>
<div class="chamba-summary pl-5">
<h4>Codeando México</h4>
<h3>Intern en Tecnologia</h3>
<span>Web</span>
<span>Diseño</span>
<span>APIs</span>
<span>Programacion</span>
</div>
<span class="chamba-date">27-Nov-2021</span>
</div>
</a>
<a href="#">
<div class="chamba crayons-card mb-6 chambas-card pl-5 pr-5 pt-4 pb-4">
<%= image_tag "chamba-icon.png", class: "chamba-image" %>
<div class="chamba-summary pl-5">
<h4>Codeando México</h4>
<h3>Intern en Tecnologia</h3>
<span>Web</span>
<span>Diseño</span>
<span>APIs</span>
<span>Programacion</span>
</div>
<span class="chamba-date">27-Nov-2021</span>
</div>
</a>
<a href="#">
<div class="chamba crayons-card mb-6 chambas-card pl-5 pr-5 pt-4 pb-4">
<%= image_tag "chamba-icon.png", class: "chamba-image" %>
<div class="chamba-summary pl-5">
<h4>Codeando México</h4>
<h3>Intern en Tecnologia</h3>
<span>Web</span>
<span>Diseño</span>
<span>APIs</span>
<span>Programacion</span>
</div>
<span class="chamba-date">27-Nov-2021</span>
</div>
</a>
<a href="#">
<div class="chamba crayons-card mb-6 chambas-card pl-5 pr-5 pt-4 pb-4">
<%= image_tag "chamba-icon.png", class: "chamba-image" %>
<div class="chamba-summary pl-5">
<h4>Codeando México</h4>
<h3>Intern en Tecnologia</h3>
<span>Web</span>
<span>Diseño</span>
<span>APIs</span>
<span>Programacion</span>
</div>
<span class="chamba-date">27-Nov-2021</span>
</div>
</a>
</div>
</div>
</div>
1 change: 1 addition & 0 deletions app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
<link rel="apple-touch-icon" sizes="152x152" href="<%= optimized_image_url(Settings::General.logo_png, width: 152, fetch_format: "png") %>">
<link rel="apple-touch-icon" sizes="180x180" href="<%= optimized_image_url(Settings::General.logo_png, width: 180, fetch_format: "png") %>">
<link rel="apple-touch-icon" sizes="167x167" href="<%= optimized_image_url(Settings::General.logo_png, width: 167, fetch_format: "png") %>">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.1/css/all.css" integrity="sha384-50oBUHEmvpQ+1lW4y57PTFmhCaXp0ML5d60M1M7uH2+nqUivzIebhndOJK28anvf" crossorigin="anonymous">
<link href="<%= optimized_image_url(Settings::General.logo_png, width: 192, fetch_format: "png") %>" rel="icon" sizes="192x192" />
<link href="<%= optimized_image_url(Settings::General.logo_png, width: 128, fetch_format: "png") %>" rel="icon" sizes="128x128" />
<meta name="apple-mobile-web-app-title" content="<%= Settings::General.app_domain %>">
Expand Down
28 changes: 28 additions & 0 deletions app/views/pages/glosario.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<% title "Glosario" %>

<div class="crayons-layout crayons-layout--2-cols crayons-layout--2-cols--drop-right-left">
<div class="sidebar-wrapper sidebar-wrapper-left crayons-layout__sidebar-left" id="sidebar-wrapper-left">
<aside class="side-bar" aria-label="Primary sidebar">
<%= render "layouts/main_nav" %>
</aside>
</div>
<main class="crayons-layout__content">
<h1 class="">Glosario</h1>
<div class="listings-columns" id="listings-results">
<div class="single-listing crayons-card text-styles text-padding">
<p>
Política publica: Acciones del gobierno (o documentos que generen o propongan acciones del gobierno), que surgen de
un proceso de diagnóstico y análisis de factibilidad para la atención efectiva de problemas públicos,
en donde la definición de problemas y soluciones se lleva a cabo con la participación ciudadana.
</p>
</div>
<div class="single-listing crayons-card text-styles text-padding">
<p>
Política publica: Acciones del gobierno (o documentos que generen o propongan acciones del gobierno), que surgen de
un proceso de diagnóstico y análisis de factibilidad para la atención efectiva de problemas públicos,
en donde la definición de problemas y soluciones se lleva a cabo con la participación ciudadana.
</p>
</div>
</div>
</main>
</div>
Comment on lines +1 to +28
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Estoy confundido, esta seccion estaba en el diseño?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Esta en los mockups es el glosario, o no es necesario?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ya veo!

Ignoren eso por ahora, y limitemos este PR a la seccion de Chambas unicamente 👍🏽

4 changes: 3 additions & 1 deletion config/database.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,13 @@ default: &default

development:
<<: *default
url: <%= ENV.fetch("DATABASE_URL", "postgres:///Forem_development") %>
database: <%= ENV.fetch("DATABASE_NAME", "Forem_development") %>
variables:
statement_timeout: <%= ENV.fetch("STATEMENT_TIMEOUT", 10_000).to_i %>
username: forem-test
password: forem-test

#url: <%= ENV.fetch("DATABASE_URL", "postgres:///Forem_development") %>
Comment on lines +33 to +36
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No es necesario agregar estos cambios al proyecto, ya que la configuracion puede cambiar segun preferencias personales.

# The specified database role being used to connect to postgres.
# To create additional roles in postgres see `$ createuser --help`.
# When left blank, postgres will use the default role. This is
Expand Down
4 changes: 4 additions & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,11 @@
get "/💸", to: redirect("t/hiring")
get "/survey", to: redirect("https://dev.to/ben/final-thoughts-on-the-state-of-the-web-survey-44nn")
get "/sponsors", to: "pages#sponsors"
get "/glosario", to: "pages#glosario"
get "/search", to: "stories/articles_search#index"
get "/chambas", to: "chambas#chambas"
get "/chambas/:filter_active", to: "chambas#chamba"
get "/chamba", to: "chambas#chamba"
post "articles/preview", to: "articles#preview"
post "comments/preview", to: "comments#preview"

Expand Down
3 changes: 1 addition & 2 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

# These are extensions that must be enabled in order to support this database
enable_extension "citext"
enable_extension "pg_stat_statements"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Este cambio no es necesario.

Chistosamente lei de esta extension hoy 😂

https://www.citusdata.com/blog/2019/02/08/the-most-useful-postgres-extension-pg-stat-statements/

por si gustas ver para que funciona, sin embargo, no es necesario que la habilites en tu maquina, solo evitemos commitear cambios al schema cuando no son necesarios 😄

enable_extension "pg_trgm"
enable_extension "pgcrypto"
enable_extension "plpgsql"
Expand Down Expand Up @@ -1224,7 +1223,7 @@
t.datetime "last_article_at", default: "2017-01-01 05:00:00"
t.datetime "last_comment_at", default: "2017-01-01 05:00:00"
t.datetime "last_followed_at"
t.datetime "last_moderation_notification", default: "2017-01-01 05:00:00"
t.datetime "last_moderation_notification", default: "2017-01-01 06:00:00"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Este es raro, no se por que se habra cambiado 🤔 , pero igual podemos quitarlo del PR, pls? 😄 🙏🏽

t.datetime "last_notification_activity"
t.string "last_onboarding_page"
t.datetime "last_reacted_at"
Expand Down
15 changes: 15 additions & 0 deletions spec/helpers/chambas_helper_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
require "rails_helper"

# Specs in this file have access to a helper object that includes
# the ChambasHelper. For example:
#
# describe ChambasHelper do
# describe "string concat" do
# it "concats two strings with spaces" do
# expect(helper.concat_strings("this","that")).to eq("this that")
# end
# end
# end
RSpec.describe ChambasHelper, type: :helper do
pending "add some examples to (or delete) #{__FILE__}"
end
Comment on lines +1 to +15
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removamos este modulo y su respectivo test, si es que hace sentido 😄

O hay algun plan para agregar estos helpers?

7 changes: 7 additions & 0 deletions spec/requests/chambas_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
require "rails_helper"

RSpec.describe "Chambas", type: :request do
describe "GET /index" do
pending "add some examples (or delete) #{__FILE__}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Podemos agregar algun test? 😄

end
end
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@ Gem::Specification.new do |s|
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
s.require_paths = ["lib".freeze]
s.authors = ["Tom Cocca".freeze]
s.date = "2021-04-09"
s.date = "2022-01-25"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesante 🤔

Como se dio este cambio?
Creo que fue por que forzamos la instalacion de las gemas... podemos intentar deshacer este cambio y ver si sigue funcionando?

s.description = "acts_as_follower is a Rubygem to allow any model to follow any other model. This is accomplished through a double polymorphic relationship on the Follow model. There is also built in support for blocking/un-blocking follow records. Main uses would be for Users to follow other Users or for Users to follow Books, etc\u2026 (Basically, to develop the type of follow system that GitHub has)".freeze
s.email = ["tom dot cocca at gmail dot com".freeze]
s.files = [".gitignore".freeze, ".travis.yml".freeze, "Gemfile".freeze, "MIT-LICENSE".freeze, "README.rdoc".freeze, "Rakefile".freeze, "acts_as_follower.gemspec".freeze, "init.rb".freeze, "lib/acts_as_follower.rb".freeze, "lib/acts_as_follower/follow_scopes.rb".freeze, "lib/acts_as_follower/followable.rb".freeze, "lib/acts_as_follower/follower.rb".freeze, "lib/acts_as_follower/follower_lib.rb".freeze, "lib/acts_as_follower/railtie.rb".freeze, "lib/acts_as_follower/version.rb".freeze, "lib/generators/USAGE".freeze, "lib/generators/acts_as_follower_generator.rb".freeze, "lib/generators/templates/migration.rb".freeze, "lib/generators/templates/model.rb".freeze, "test/README".freeze, "test/acts_as_followable_test.rb".freeze, "test/acts_as_follower_test.rb".freeze, "test/dummy30/Gemfile".freeze, "test/dummy30/Rakefile".freeze, "test/dummy30/app/models/application_record.rb".freeze, "test/dummy30/app/models/band.rb".freeze, "test/dummy30/app/models/band/punk.rb".freeze, "test/dummy30/app/models/band/punk/pop_punk.rb".freeze, "test/dummy30/app/models/custom_record.rb".freeze, "test/dummy30/app/models/some.rb".freeze, "test/dummy30/app/models/user.rb".freeze, "test/dummy30/config.ru".freeze, "test/dummy30/config/application.rb".freeze, "test/dummy30/config/boot.rb".freeze, "test/dummy30/config/database.yml".freeze, "test/dummy30/config/environment.rb".freeze, "test/dummy30/config/environments/development.rb".freeze, "test/dummy30/config/environments/test.rb".freeze, "test/dummy30/config/initializers/backtrace_silencers.rb".freeze, "test/dummy30/config/initializers/inflections.rb".freeze, "test/dummy30/config/initializers/secret_token.rb".freeze, "test/dummy30/config/initializers/session_store.rb".freeze, "test/dummy30/config/locales/en.yml".freeze, "test/dummy30/config/routes.rb".freeze, "test/factories/bands.rb".freeze, "test/factories/somes.rb".freeze, "test/factories/users.rb".freeze, "test/follow_test.rb".freeze, "test/schema.rb".freeze, "test/test_helper.rb".freeze]
s.homepage = "https://github.com/tcocca/acts_as_follower".freeze
s.licenses = ["MIT".freeze]
s.rubygems_version = "3.1.4".freeze
s.rubygems_version = "3.2.22".freeze
s.summary = "A Rubygem to add Follow functionality for ActiveRecord models".freeze

s.installed_by_version = "3.1.4" if s.respond_to? :installed_by_version
s.installed_by_version = "3.2.22" if s.respond_to? :installed_by_version

if s.respond_to? :specification_version then
s.specification_version = 4
Expand Down