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

Conversation

diegoOG09
Copy link
Collaborator

@diegoOG09 diegoOG09 commented Jan 29, 2022

Vistas creadas junto con el controlador.

  • Vista creada de la sección principal de "Chambas".
  • Vista creada de cuando se accede a una determinada "chamba".
  • El controlador fue modificado para mostrar algunos filtros de ejemplo en la vista.
  • Se han añadido rutas al archivo 'routes.rb' para poder ver los cambios en el
    servidor local.

Co-authored-by: diegoOG09 [email protected]
Co-authored-by: armanirmr [email protected]
Co-authored-by: YxMARCKxY [email protected]
Co-authored-by: rene3255 [email protected]
Co-authored-by: BrandonVG [email protected]

image

What type of PR is this? (check all applicable)

  • Refactor
  • Feature
  • Bug Fix
  • Optimization
  • Documentation Update

Description

Related Tickets & Documents

QA Instructions, Screenshots, Recordings

Please replace this line with instructions on how to test your changes, a note
on the devices and browsers this has been tested on, as well as any relevant
images for UI changes.

UI accessibility concerns?

If your PR includes UI changes, please replace this line with details on how
accessibility is impacted and tested. For more info, check out the
Forem Accessibility Docs.

Added/updated tests?

  • Yes
  • No, and this is why: please replace this line with details on why tests
    have not been included
  • I need help with writing tests

[Forem core team only] How will this change be communicated?

Will this PR introduce a change that impacts Forem members or creators, the
development process, or any of our internal teams? If so, please note how you
will share this change with the people who need to know about it.

  • I've updated the Developer Docs or
    Storybook (for Crayons components)
  • This PR changes the Forem platform and our documentation needs to be
    updated. I have filled out the
    Changes Requested
    issue template so Community Success can help update the Admin Docs
    appropriately.
  • I've updated the README or added inline documentation
  • I've added an entry to
    CHANGELOG.md
  • I will share this change in a Changelog
    or in a forem.dev post
  • I will share this change internally with the appropriate teams
  • I'm not sure how best to communicate this change and need help
  • This change does not need to be communicated, and this is why not: please
    replace this line with details on why this change doesn't need to be
    shared

[optional] Are there any post deployment tasks we need to perform?

[optional] What gif best describes this PR or how it makes you feel?

alt_text

…base.

- Created view of the main section of "Chambas".
- Created view of the "Glossary" section, although some details are still to be added.
- Created view of when a particular "chamba" is accessed.
- The controller was modified to show some example filters in the view.
- Added routes to the 'routes.rb' file to be able to view changes on the
  local server.

Co-authored-by: diegoOG09 <[email protected]>
Co-authored-by: armanirmr <[email protected]>
Co-authored-by: YxMARCKxY <[email protected]>
Co-authored-by: rene3255 <[email protected]>
Co-authored-by: BrandonVG <[email protected]>
@@ -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? 😄

Comment on lines 1 to 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? 😄

Comment on lines 78 to 80
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

@@ -0,0 +1,6 @@
class ChambasController < ApplicationController
def chambas
@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? 😄

Comment on lines +1 to +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>
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 👍🏽

Comment on lines +33 to +36
username: forem-test
password: forem-test

#url: <%= ENV.fetch("DATABASE_URL", "postgres:///Forem_development") %>
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.

@@ -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 😄

@@ -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? 😄 🙏🏽

Comment on lines +1 to +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
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?

@@ -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


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? 😄

@@ -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?

Copy link
Member

@EduardoGHdez EduardoGHdez left a comment

Choose a reason for hiding this comment

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

Buen avance! 🔥

Deje unos cuantos comentarios, pero esto se ve genial 🙌🏽
Gracias por la contribución 💯

@diegoOG09 diegoOG09 changed the title Views created, "Chambas" controller created and edited and draft data… Vistas creadas junto con el controlador. Jan 31, 2022
Co-authored-by: diegoOG09 <[email protected]>
Co-authored-by: armanirmr <[email protected]>
Co-authored-by: YxMARCKxY <[email protected]>
Co-authored-by: rene3255 <[email protected]>
Co-authored-by: BrandonVG <[email protected]>
@@ -589,6 +589,49 @@

##############################################################################

Chamba.create(title: "Se busca Developer en 'RUBY'", post_date: "2022-02-01", exp_date: "2022-02-01",
description: "Se reuiere developer en ruby para desarrollar una web-app", organization: "FOCUSEM", location: "Mexico", salary: 10_000, created_at: "2022-02-02", updated_at: "2022-02-02")

Choose a reason for hiding this comment

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

[rubocop] <Layout/LineLength> reported by reviewdog 🐶
Line is too long. [200/120] (https://rubystyle.guide#max-line-length)

Chamba.create(title: "Se busca Developer en 'RUBY'", post_date: "2022-02-01", exp_date: "2022-02-01",
description: "Se reuiere developer en ruby para desarrollar una web-app", organization: "FOCUSEM", location: "Mexico", salary: 10_000, created_at: "2022-02-02", updated_at: "2022-02-02")
Chamba.create(title: "Se busca 'Full-stack'", post_date: "2022-02-01", exp_date: "2022-02-01",
description: "Se reuiere developer en fullstack para desarrollar una web-app", organization: "FOREM", location: "Canada", salary: 15_000, created_at: "2022-02-02", updated_at: "2022-02-02")

Choose a reason for hiding this comment

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

[rubocop] <Layout/LineLength> reported by reviewdog 🐶
Line is too long. [203/120] (https://rubystyle.guide#max-line-length)

Chamba.create(title: "Se busca 'Full-stack'", post_date: "2022-02-01", exp_date: "2022-02-01",
description: "Se reuiere developer en fullstack para desarrollar una web-app", organization: "FOREM", location: "Canada", salary: 15_000, created_at: "2022-02-02", updated_at: "2022-02-02")
Chamba.create(title: "Se busca 'Developer UX/UI'", post_date: "2022-02-01", exp_date: "2022-02-01",
description: "Se reuiere diseñador UX/UI", organization: "DEVS-MEXICO", location: "España", salary: 30_000, created_at: "2022-02-02", updated_at: "2022-02-02")

Choose a reason for hiding this comment

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

[rubocop] <Layout/LineLength> reported by reviewdog 🐶
Line is too long. [173/120] (https://rubystyle.guide#max-line-length)

Chamba.create(title: "Se busca 'Developer UX/UI'", post_date: "2022-02-01", exp_date: "2022-02-01",
description: "Se reuiere diseñador UX/UI", organization: "DEVS-MEXICO", location: "España", salary: 30_000, created_at: "2022-02-02", updated_at: "2022-02-02")
Chamba.create(title: "Se busca 'QA'", post_date: "2022-02-01", exp_date: "2022-02-01",
description: "Se reuiere un especialista en QA", organization: "BRIGHTCODERS", location: "Panama", salary: 17_000, created_at: "2022-02-02", updated_at: "2022-02-02")

Choose a reason for hiding this comment

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

[rubocop] <Layout/LineLength> reported by reviewdog 🐶
Line is too long. [180/120] (https://rubystyle.guide#max-line-length)

Chamba.create(title: "Se busca 'QA'", post_date: "2022-02-01", exp_date: "2022-02-01",
description: "Se reuiere un especialista en QA", organization: "BRIGHTCODERS", location: "Panama", salary: 17_000, created_at: "2022-02-02", updated_at: "2022-02-02")
Chamba.create(title: "Se busca 'Manager of database'", post_date: "2022-02-01", exp_date: "2022-02-01",
description: "Se reuiere un db-manager para administrar una base de datos", organization: "GOOGLE-INC", location: "Mexico", salary: 22_000, created_at: "2022-02-02", updated_at: "2022-02-02")

Choose a reason for hiding this comment

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

[rubocop] <Layout/LineLength> reported by reviewdog 🐶
Line is too long. [205/120] (https://rubystyle.guide#max-line-length)

diegoOG09 and others added 3 commits February 24, 2022 18:11
- We add certain fields in the model of chambas as: stall, approve

Co-authored-by: diegoOG09 <[email protected]>
Co-authored-by: armanirmr <[email protected]>
Co-authored-by: YxMARCKxY <[email protected]>
Co-authored-by: rene3255 <[email protected]>
Co-authored-by: BrandonVG [email protected]
Co-authored-by: IrenehMDev <[email protected]>
- we put together some migration to chambas in only one  by esthetic and good practice

Co-authored-by: armanirmr <[email protected]>
Co-authored-by: YxMARCKxY <[email protected]>
Co-authored-by: rene3255 <[email protected]>
Co-authored-by: BrandonVG [email protected]
-We added the new section of chambas within the content manager.
-We added the list within the content manager in chambas.
-We create the view to see a single job.
-We create the crud within the administration section in content manager.
-We add some js scripts to manipulate the information of the chambas within the form when making updates of specific chambas.
-We add some styles to the cards of the chambas.
-We added some features in the content manager section for jobs such as:
-Ban chamba posts
-Update the expiration date of the jobs
-Approve the publications of new chambas

Co-authored-by: armanirmr [email protected]
Co-authored-by: YxMARCKxY [email protected]
Co-authored-by: rene3255 [email protected]
Co-authored-by: BrandonVG [email protected]
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Remaining comments which cannot be posted as a review comment to avoid GitHub Rate Limit

rubocop

config/routes.rb|255 col 1| Trailing whitespace detected. (https://rubystyle.guide#no-trailing-whitespace)
config/routes.rb|368 col 98| Missing space after #. (https://rubystyle.guide#hash-space)
config/routes.rb|368 col 121| Line is too long. [163/120] (https://rubystyle.guide#max-line-length)
config/routes.rb|371 col 1| Trailing whitespace detected. (https://rubystyle.guide#no-trailing-whitespace)
config/routes.rb|373 col 1| Extra blank line detected. (https://rubystyle.guide#two-or-more-empty-lines)

layout "admin"

def index
delete_exp_date()

Choose a reason for hiding this comment

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

[rubocop] <Style/MethodCallWithoutArgsParentheses> reported by reviewdog 🐶
Do not use parentheses for method calls with no arguments. (https://rubystyle.guide#method-invocation-parens)

Suggested change
delete_exp_date()
delete_exp_date)


def update_chamba_from_list
record_chamba = Chamba.find(params[:chamba_to_edit][:id])
record_chamba.created_at = params[:chamba_to_edit][:published_at] + " " + params[:chamba_to_edit][:time] + ":00"

Choose a reason for hiding this comment

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

[rubocop] <Style/StringConcatenation> reported by reviewdog 🐶
Prefer string interpolation to string concatenation. (https://rubystyle.guide#string-interpolation)

Suggested change
record_chamba.created_at = params[:chamba_to_edit][:published_at] + " " + params[:chamba_to_edit][:time] + ":00"
record_chamba.created_at = "#{params[:chamba_to_edit][:published_at]} #{params[:chamba_to_edit][:time]}:00"

def delete_exp_date
chambas = Chamba.all
chambas.length.times do |reg|
if chambas[reg].exp_date.to_s < Time.now.strftime("%F").to_s

Choose a reason for hiding this comment

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

[rubocop] <Style/Next> reported by reviewdog 🐶
Use next to skip iteration. (https://rubystyle.guide#no-nested-conditionals)

Suggested change
if chambas[reg].exp_date.to_s < Time.now.strftime("%F").to_s
next unless chambas[reg].exp_date.to_s < Time.now.strftime("%F").to_sif chambas[reg].exp_date.to_s < Time.now.strftime("%F").to_s

def delete_exp_date
chambas = Chamba.all
chambas.length.times do |reg|
if chambas[reg].exp_date.to_s < Time.now.strftime("%F").to_s

Choose a reason for hiding this comment

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

[rubocop] <Rails/TimeZone> reported by reviewdog 🐶
Do not use Time.now without zone. Use one of Time.zone.now, Time.current, Time.now.in_time_zone, Time.now.utc, Time.now.getlocal, Time.now.xmlschema, Time.now.iso8601, Time.now.jisx0301, Time.now.rfc3339, Time.now.httpdate, Time.now.to_i, Time.now.to_f instead. (https://rails.rubystyle.guide#time, http://danilenko.org/2012/7/6/rails_timezones)

Suggested change
if chambas[reg].exp_date.to_s < Time.now.strftime("%F").to_s
if chambas[reg].exp_date.to_s < Time.zone.now.strftime("%F").to_s

def create_chamba_from_forem
chamba = Chamba.new(form_create_chamba_params)
new_chamba = Chamba.create(title: chamba.title, exp_date: chamba.exp_date, location: chamba.location,
description: chamba.description, organization: chamba.organization, salary: chamba.salary, stall: chamba.stall, requirements: chamba.requirements)

Choose a reason for hiding this comment

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

[rubocop] <Layout/ArgumentAlignment> reported by reviewdog 🐶
Align the arguments of a method call if they span more than one line. (https://rubystyle.guide#no-double-indent)

Suggested change
description: chamba.description, organization: chamba.organization, salary: chamba.salary, stall: chamba.stall, requirements: chamba.requirements)
description: chamba.description, organization: chamba.organization, salary: chamba.salary, stall: chamba.stall, requirements: chamba.requirements)

class ChambasController < ApplicationController

def index
delete_exp_date()

Choose a reason for hiding this comment

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

[rubocop] <Style/MethodCallWithoutArgsParentheses> reported by reviewdog 🐶
Do not use parentheses for method calls with no arguments. (https://rubystyle.guide#method-invocation-parens)

Suggested change
delete_exp_date()
delete_exp_date)

def delete_exp_date
chambas = Chamba.all
chambas.length.times do |reg|
if chambas[reg].exp_date.to_s < Time.now.strftime("%F").to_s

Choose a reason for hiding this comment

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

[rubocop] <Style/Next> reported by reviewdog 🐶
Use next to skip iteration. (https://rubystyle.guide#no-nested-conditionals)

Suggested change
if chambas[reg].exp_date.to_s < Time.now.strftime("%F").to_s
next unless chambas[reg].exp_date.to_s < Time.now.strftime("%F").to_sif chambas[reg].exp_date.to_s < Time.now.strftime("%F").to_s

def delete_exp_date
chambas = Chamba.all
chambas.length.times do |reg|
if chambas[reg].exp_date.to_s < Time.now.strftime("%F").to_s

Choose a reason for hiding this comment

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

[rubocop] <Rails/TimeZone> reported by reviewdog 🐶
Do not use Time.now without zone. Use one of Time.zone.now, Time.current, Time.now.in_time_zone, Time.now.utc, Time.now.getlocal, Time.now.xmlschema, Time.now.iso8601, Time.now.jisx0301, Time.now.rfc3339, Time.now.httpdate, Time.now.to_i, Time.now.to_f instead. (https://rails.rubystyle.guide#time, http://danilenko.org/2012/7/6/rails_timezones)

Suggested change
if chambas[reg].exp_date.to_s < Time.now.strftime("%F").to_s
if chambas[reg].exp_date.to_s < Time.zone.now.strftime("%F").to_s

# vista chamba
def chamba
@chamba = Chamba.find(params[:chamba_id])
@requerimientos = ''

Choose a reason for hiding this comment

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

[rubocop] <Style/StringLiterals> reported by reviewdog 🐶
Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping. (https://rubystyle.guide#consistent-string-literals)

Suggested change
@requerimientos = ''
@requerimientos = ""

@chamba = Chamba.find(params[:chamba_id])
@requerimientos = ''
variable = Chamba.find(params[:chamba_id]).requirements
if variable.nil? == false

Choose a reason for hiding this comment

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

[rubocop] <Style/GuardClause> reported by reviewdog 🐶
Use a guard clause (return unless variable.nil? == false) instead of wrapping the code inside a conditional expression. (https://rubystyle.guide#no-nested-conditionals)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants