-
Notifications
You must be signed in to change notification settings - Fork 1
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
base: dev
Are you sure you want to change the base?
Changes from all commits
40302ba
3329949
531f813
97b012c
b35dc93
bff3b39
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,77 @@ | ||||||||||||||||||||||||||||
module Admin | ||||||||||||||||||||||||||||
class ChambasController < Admin::ApplicationController | ||||||||||||||||||||||||||||
layout "admin" | ||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
def index | ||||||||||||||||||||||||||||
delete_exp_date() | ||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [rubocop] <Style/MethodCallWithoutArgsParentheses> reported by reviewdog 🐶
Suggested change
|
||||||||||||||||||||||||||||
@chamba = Chamba.new | ||||||||||||||||||||||||||||
@chambas = Chamba.all | ||||||||||||||||||||||||||||
end | ||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
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" | ||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [rubocop] <Style/StringConcatenation> reported by reviewdog 🐶
Suggested change
|
||||||||||||||||||||||||||||
if params[:chamba_to_edit][:approve] == "on" | ||||||||||||||||||||||||||||
record_chamba.approve = true | ||||||||||||||||||||||||||||
elsif params[:chamba_to_edit][:bann] == "on" | ||||||||||||||||||||||||||||
record_chamba.approve = false | ||||||||||||||||||||||||||||
end | ||||||||||||||||||||||||||||
record_chamba.save | ||||||||||||||||||||||||||||
end | ||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
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 | ||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [rubocop] <Style/Next> reported by reviewdog 🐶
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [rubocop] <Rails/TimeZone> reported by reviewdog 🐶
Suggested change
|
||||||||||||||||||||||||||||
record = Chamba.find(chambas[reg].id) | ||||||||||||||||||||||||||||
record.destroy | ||||||||||||||||||||||||||||
record.save | ||||||||||||||||||||||||||||
end | ||||||||||||||||||||||||||||
end | ||||||||||||||||||||||||||||
end | ||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
def delete | ||||||||||||||||||||||||||||
id_to_delete = params[:id_chamba] | ||||||||||||||||||||||||||||
# modificar esto despues para eliminar en cascada (por medio de los modelos) | ||||||||||||||||||||||||||||
RequerimientosChamba.find(id_to_delete).destroy | ||||||||||||||||||||||||||||
AreasChamba.find(id_to_delete).destroy | ||||||||||||||||||||||||||||
Chamba.find(id_to_delete).destroy | ||||||||||||||||||||||||||||
Area.find(id_to_delete).destroy | ||||||||||||||||||||||||||||
end | ||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
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) | ||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [rubocop] <Layout/ArgumentAlignment> reported by reviewdog 🐶
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [rubocop] <Layout/HashAlignment> reported by reviewdog 🐶
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [rubocop] <Layout/LineLength> reported by reviewdog 🐶 |
||||||||||||||||||||||||||||
if new_chamba.save | ||||||||||||||||||||||||||||
redirect_to "/admin/content_manager/chambas", :notice => 'La chambita fue agregada! 😀' | ||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [rubocop] <Style/HashSyntax> reported by reviewdog 🐶
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [rubocop] <Style/StringLiterals> reported by reviewdog 🐶
Suggested change
|
||||||||||||||||||||||||||||
else | ||||||||||||||||||||||||||||
redirect_to "/admin/content_manager/chambas", :flash => { :record_save_status => 'La chambita no fue agregada 😔'} | ||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [rubocop] <Style/HashSyntax> reported by reviewdog 🐶
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [rubocop] <Style/HashSyntax> reported by reviewdog 🐶
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [rubocop] <Style/StringLiterals> reported by reviewdog 🐶
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [rubocop] <Layout/LineLength> reported by reviewdog 🐶
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [rubocop] <Layout/SpaceInsideHashLiteralBraces> reported by reviewdog 🐶
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [rubocop] <Layout/TrailingWhitespace> reported by reviewdog 🐶
Suggested change
|
||||||||||||||||||||||||||||
end | ||||||||||||||||||||||||||||
end | ||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
def update_chamba | ||||||||||||||||||||||||||||
record_to_update = Chamba.find(params[:chamba][:id]) | ||||||||||||||||||||||||||||
record_to_update.title = params[:chamba][:title] | ||||||||||||||||||||||||||||
record_to_update.location = params[:chamba][:location] | ||||||||||||||||||||||||||||
record_to_update.organization = params[:chamba][:organization] | ||||||||||||||||||||||||||||
record_to_update.exp_date = params[:chamba][:exp_date] | ||||||||||||||||||||||||||||
record_to_update.stall = params[:chamba][:stall] | ||||||||||||||||||||||||||||
record_to_update.salary = params[:chamba][:salary] | ||||||||||||||||||||||||||||
record_to_update.description = params[:chamba][:description] | ||||||||||||||||||||||||||||
record_to_update.requirements = params[:chamba][:requirements] | ||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
if record_to_update.save | ||||||||||||||||||||||||||||
redirect_to "/admin/content_manager/chambas", :notice => 'La chambita se actualizo correctamente! 😀' | ||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [rubocop] <Style/HashSyntax> reported by reviewdog 🐶
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [rubocop] <Style/StringLiterals> reported by reviewdog 🐶
Suggested change
|
||||||||||||||||||||||||||||
else | ||||||||||||||||||||||||||||
redirect_to "/admin/content_manager/chambas", :flash => { :record_save_status => 'La chambita no se actualizo! 😔'} | ||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [rubocop] <Style/HashSyntax> reported by reviewdog 🐶
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [rubocop] <Style/HashSyntax> reported by reviewdog 🐶
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [rubocop] <Style/StringLiterals> reported by reviewdog 🐶
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [rubocop] <Layout/LineLength> reported by reviewdog 🐶
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [rubocop] <Layout/SpaceInsideHashLiteralBraces> reported by reviewdog 🐶
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [rubocop] <Layout/TrailingWhitespace> reported by reviewdog 🐶
Suggested change
|
||||||||||||||||||||||||||||
end | ||||||||||||||||||||||||||||
end | ||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
private | ||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [rubocop] <Layout/EmptyLinesAroundAccessModifier> reported by reviewdog 🐶
Suggested change
|
||||||||||||||||||||||||||||
def form_create_chamba_params | ||||||||||||||||||||||||||||
params.require(:chamba).permit(:title, :exp_date, :location, :description, :organization, :salary, :stall, | ||||||||||||||||||||||||||||
:requirements) | ||||||||||||||||||||||||||||
end | ||||||||||||||||||||||||||||
end | ||||||||||||||||||||||||||||
end |
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,41 @@ | ||||||||||
class ChambasController < ApplicationController | ||||||||||
|
||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [rubocop] <Layout/TrailingWhitespace> reported by reviewdog 🐶
Suggested change
|
||||||||||
def index | ||||||||||
delete_exp_date() | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [rubocop] <Style/MethodCallWithoutArgsParentheses> reported by reviewdog 🐶
Suggested change
|
||||||||||
@chambas_vec = Chamba.all.where(approve: true) | ||||||||||
@areas = %w[Mexico Web-Developer Programación Issues] | ||||||||||
@filters = req_filters | ||||||||||
@areas_chambas = AreasChamba.all | ||||||||||
end | ||||||||||
|
||||||||||
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 | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [rubocop] <Style/Next> reported by reviewdog 🐶
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [rubocop] <Rails/TimeZone> reported by reviewdog 🐶
Suggested change
|
||||||||||
record = Chamba.find(chambas[reg].id) | ||||||||||
record.destroy | ||||||||||
record.save | ||||||||||
end | ||||||||||
end | ||||||||||
end | ||||||||||
|
||||||||||
# vista chamba | ||||||||||
def chamba | ||||||||||
@chamba = Chamba.find(params[:chamba_id]) | ||||||||||
@requerimientos = '' | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [rubocop] <Style/StringLiterals> reported by reviewdog 🐶
Suggested change
|
||||||||||
variable = Chamba.find(params[:chamba_id]).requirements | ||||||||||
if variable.nil? == false | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [rubocop] <Style/GuardClause> reported by reviewdog 🐶 |
||||||||||
@requerimientos = variable.split(",") | ||||||||||
end | ||||||||||
end | ||||||||||
|
||||||||||
def req_chambas | ||||||||||
# DESIDO HACERLO FUERA EN OTRO METODO PARA DESPUES PRE-PROSESAR LAS PUBS | ||||||||||
Chamba.all | ||||||||||
end | ||||||||||
|
||||||||||
def req_filters | ||||||||||
%w[Mexico Web-Developer Programación Issues] | ||||||||||
# @var_back = params[:filter_active] | ||||||||||
end | ||||||||||
end |
There was a problem hiding this comment.
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? 😄