diff --git a/Gemfile.lock b/Gemfile.lock index bac81e2067c25..76c57616544dc 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -63,6 +63,7 @@ GEM activerecord (= 6.1.4.4) activesupport (= 6.1.4.4) marcel (~> 1.0.0) + mini_magick mini_mime (>= 1.1.0) activesupport (6.1.4.4) concurrent-ruby (~> 1.0, >= 1.0.2) diff --git a/app/assets/images/chamba-icon.png b/app/assets/images/chamba-icon.png new file mode 100644 index 0000000000000..ca7fe1e77bc90 Binary files /dev/null and b/app/assets/images/chamba-icon.png differ diff --git a/app/assets/stylesheets/base/layout.scss b/app/assets/stylesheets/base/layout.scss index 8802fd019143c..f2d95ed1c02a1 100644 --- a/app/assets/stylesheets/base/layout.scss +++ b/app/assets/stylesheets/base/layout.scss @@ -322,3 +322,87 @@ } } } + +.chamba-info { + padding-bottom: 20px; + padding-left: 80px; +} + +.card-chamba { + background: rgba(59, 73, 223, 0.21); + border-radius: 5px; +} + +.chamba-logo { + display: flex; + flex-direction: row; + align-items: center; + color: #4449e0d6; + margin-top: 30px; + margin-bottom: 30px; +} + +.chamba-logo h3 { + font-weight: bold; +} + +.chamba-logo h4 { + font-weight: 500; +} + +.codeando-logo { + width: 130px; + margin-right: 10px; +} + +.chamba-title { + color: #4449e0d6; + padding-left: 80px; + padding-right: 80px; +} + +.chamba-title h1 { + font-size: 70px; +} + +.chamba-title h2 { + font-weight: 400; + margin: 5px; +} + +.chamba-btn .apply { + color: white; + padding: 20px; + margin-top: 30px; + margin-bottom: 30px; + background-color: #4449e0d6; + border: none; + border-radius: 10px; + font-size: 20px; +} + +.chamba-details h3 { + font-style: normal; + font-weight: 600; + font-size: 30px; + color: rgba(68, 73, 224, 0.84); + margin-top: 30px; +} + +.chamba-details p { + font-size: 24px; +} + +.chamba-details ul { + font-size: 24px; +} + +.return-chamba { + font-size: 18.0778px; + padding-left: 30px; +} + +.chamba-div { + display: flex; + align-items: center; +} diff --git a/app/assets/stylesheets/components/cards.scss b/app/assets/stylesheets/components/cards.scss index 74d47fadd1b5b..8c8801c8a3a71 100644 --- a/app/assets/stylesheets/components/cards.scss +++ b/app/assets/stylesheets/components/cards.scss @@ -1,4 +1,4 @@ -@import '../config/import'; +@import "../config/import"; .crayons-card { border-radius: var(--radius-auto); @@ -42,3 +42,174 @@ padding: var(--su-4); } } + +.i-icon { + margin-right: 0.3rem; +} + +.chambita-title { + a { + font-weight: 700; + } +} + +.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; + } +} + +#info_icon_exp_date { + padding-left: .5rem; +} + +.crud-card-main { + background-color: #cdd1e4; + border: none; + + /* Chrome, Safari, Edge, Opera */ + input::-webkit-outer-spin-button, + input::-webkit-inner-spin-button { + -webkit-appearance: none; + margin: 0; + } + + /* Firefox */ + input[type="number"] { + -moz-appearance: textfield; + } + .requirements-label { + color: #686868; + } +} + +#add-btn { + border: none; + color: white; + background-color: #6c7a89; + + &:hover { + background-color: #bdc3c7; + } +} + +.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; + } +} + +.crud-card { + &: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); + } +} + +@mixin clearfix { + &:after { + content: ""; + display: table; + clear: both; + } +} + +.body-blackout { + position: absolute; + z-index: 1010; + left: 0; + top: 0; + width: 100%; + height: 100%; + background-color: rgba(0, 0, 0, 0.65); + display: none; + + &.is-blacked-out { + display: block; + } +} + +.popup-trigger { + display: inline-block; +} + +.popup-modal { + height: 365px; + width: 650px; + background-color: #fff; + position: absolute; + left: 50%; + top: 50%; + transform: translate(-50%, -50%); + padding: 45px; + opacity: 0; + pointer-events: none; + transition: all 300ms ease-in-out; + z-index: 1011; + border-radius: 6px; + + &.is--visible { + opacity: 1; + pointer-events: auto; + } + + &__close { + position: absolute; + font-size: 1.2rem; + right: -10px; + top: -10px; + cursor: pointer; + } +} diff --git a/app/controllers/admin/chambas_controller.rb b/app/controllers/admin/chambas_controller.rb new file mode 100644 index 0000000000000..8b5ee366dc0ee --- /dev/null +++ b/app/controllers/admin/chambas_controller.rb @@ -0,0 +1,77 @@ +module Admin + class ChambasController < Admin::ApplicationController + layout "admin" + + def index + delete_exp_date() + @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" + 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 + 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) + if new_chamba.save + redirect_to "/admin/content_manager/chambas", :notice => 'La chambita fue agregada! 😀' + else + redirect_to "/admin/content_manager/chambas", :flash => { :record_save_status => 'La chambita no fue agregada 😔'} + 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! 😀' + else + redirect_to "/admin/content_manager/chambas", :flash => { :record_save_status => 'La chambita no se actualizo! 😔'} + end + end + + private + def form_create_chamba_params + params.require(:chamba).permit(:title, :exp_date, :location, :description, :organization, :salary, :stall, + :requirements) + end + end +end diff --git a/app/controllers/chambas_controller.rb b/app/controllers/chambas_controller.rb new file mode 100644 index 0000000000000..dafe084fda107 --- /dev/null +++ b/app/controllers/chambas_controller.rb @@ -0,0 +1,41 @@ +class ChambasController < ApplicationController + + def index + delete_exp_date() + @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 + record = Chamba.find(chambas[reg].id) + record.destroy + record.save + end + end + end + + # vista chamba + def chamba + @chamba = Chamba.find(params[:chamba_id]) + @requerimientos = '' + variable = Chamba.find(params[:chamba_id]).requirements + if variable.nil? == false + @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 diff --git a/app/controllers/pages_controller.rb b/app/controllers/pages_controller.rb index 6f46d6cf2ce21..232b477d9ccf9 100644 --- a/app/controllers/pages_controller.rb +++ b/app/controllers/pages_controller.rb @@ -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( diff --git a/app/helpers/chambas_helper.rb b/app/helpers/chambas_helper.rb new file mode 100644 index 0000000000000..cfb1f64dff520 --- /dev/null +++ b/app/helpers/chambas_helper.rb @@ -0,0 +1,2 @@ +module ChambasHelper +end diff --git a/app/javascript/admin/adminModal.js b/app/javascript/admin/adminModal.js index 87110f0976213..7a0bb061351d5 100644 --- a/app/javascript/admin/adminModal.js +++ b/app/javascript/admin/adminModal.js @@ -16,6 +16,7 @@ * @param {string} modalProps.leftCustomDataAttr A custom data attribute for the left button. * @param {string} modalProps.rightCustomDataAttr A custom data attribute for the right button. */ + export const adminModal = function ({ title, controllerName, diff --git a/app/javascript/admin/controllers/admin_chambas_controller.js b/app/javascript/admin/controllers/admin_chambas_controller.js new file mode 100644 index 0000000000000..c8f97bac3cc0e --- /dev/null +++ b/app/javascript/admin/controllers/admin_chambas_controller.js @@ -0,0 +1,96 @@ +if (window.location.toString().endsWith("content_manager/chambas")) { + document.addEventListener('DOMContentLoaded', function () { + let alert = document.querySelector('.alert') + let salary = document.querySelector('#chamba_salary') + let title = document.querySelector('#chamba_title') + let location = document.querySelector('#chamba_location') + let organization = document.querySelector('#chamba_organization') + let date = document.querySelector('#chamba_exp_date') + let stall = document.querySelector('#chamba_stall') + let description = document.querySelector('#chamba_description') + let requirements = document.querySelector('#chamba_requirements') + let updateBtn = document.querySelector('#createChambaBtn') + const editBtn = document.querySelectorAll("#editBtn") + const form = document.querySelector('#new_chamba') + const inputHidden = document.createElement('input') + const cancelBtn = document.createElement('button') + inputHidden.type = 'hidden' + inputHidden.name = 'chamba[id]' + inputHidden.value = '' + form.appendChild(inputHidden) + + document.querySelector('html').style.scrollBehavior = 'smooth' + + editBtn.forEach(element => { + scrollTo(0, 0) + let fields = { + id: element.getAttribute('data-id'), + title: element.getAttribute('data-title'), + location: element.getAttribute('data-location'), + organization: element.getAttribute('data-organization'), + date: element.getAttribute('data-exp_date'), + stall: element.getAttribute('data-stall'), + salary: element.getAttribute('data-salary'), + description: element.getAttribute('data-description'), + requirements: element.getAttribute('data-requirements') + } + + element.addEventListener('click', () => { + window.scrollTo(0, 0) + updateBtn.innerHTML = 'Actualizar chambita' + form.action = "/admin/content_manager/update_chamba_list" + + updateFields(fields) + createCancelBtn() + + cancelBtn.addEventListener('click', cleanForm) + }) + }) + + if (alert) { + setTimeout(() => { + alert.remove() + }, 5000); + } + + salary.addEventListener('keypress', e => { + if (!onlyNumbers(event)) { + e.preventDefault() + } + }) + function onlyNumbers(e) { + var key = e.charCode; + return key >= 48 && key <= 57; + } + + function createCancelBtn() { + cancelBtn.setAttribute('id', 'cancelUpdateBtn') + cancelBtn.setAttribute('class', 'btn btn-primary') + cancelBtn.style.backgroundColor = '#e9ecef' + cancelBtn.style.color = '#495057' + cancelBtn.style.border = 'none' + cancelBtn.innerText = 'Cancelar' + form.appendChild(cancelBtn) + } + + function cleanForm() { + form.reset() + updateBtn.innerHTML = 'Crear chambita' + form.action = "/chambas" + form.removeChild(cancelBtn) + } + + function updateFields(fields) { + inputHidden.value = `${fields.id}` + title.value = fields.title + location.value = fields.location + organization.value = fields.organization + date.value = fields.date + stall.value = fields.stall + salary.value = fields.salary + description.value = fields.description + requirements.value = fields.requirements + } + + }, false); +} \ No newline at end of file diff --git a/app/models/admin_menu.rb b/app/models/admin_menu.rb index 806b72f83f7b5..94e55d5826e56 100644 --- a/app/models/admin_menu.rb +++ b/app/models/admin_menu.rb @@ -20,6 +20,7 @@ class AdminMenu item(name: "organizations"), item(name: "podcasts"), item(name: "tags"), + item(name: "chambas"), ] scope :customization, "tools-line", [ diff --git a/app/models/area.rb b/app/models/area.rb new file mode 100644 index 0000000000000..de104c2fbc220 --- /dev/null +++ b/app/models/area.rb @@ -0,0 +1,3 @@ +class Area < ApplicationRecord + has_many :areas_chamba, dependent: :nil +end diff --git a/app/models/areas_chamba.rb b/app/models/areas_chamba.rb new file mode 100644 index 0000000000000..a76b6a6454d79 --- /dev/null +++ b/app/models/areas_chamba.rb @@ -0,0 +1,4 @@ +class AreasChamba < ApplicationRecord + belongs_to :chamba + belongs_to :area +end diff --git a/app/models/chamba.rb b/app/models/chamba.rb new file mode 100644 index 0000000000000..644617938eac6 --- /dev/null +++ b/app/models/chamba.rb @@ -0,0 +1,3 @@ +class Chamba < ApplicationRecord + has_many :requerimientos_chamba, dependent: :destroy +end diff --git a/app/models/requerimientos_chamba.rb b/app/models/requerimientos_chamba.rb new file mode 100644 index 0000000000000..13c2ed7602d91 --- /dev/null +++ b/app/models/requerimientos_chamba.rb @@ -0,0 +1,3 @@ +class RequerimientosChamba < ApplicationRecord + belongs_to :chamba +end diff --git a/app/views/admin/chambas/_image_upload_script.html.erb b/app/views/admin/chambas/_image_upload_script.html.erb new file mode 100644 index 0000000000000..e148d24dd28f0 --- /dev/null +++ b/app/views/admin/chambas/_image_upload_script.html.erb @@ -0,0 +1,31 @@ + diff --git a/app/views/admin/chambas/_individual_chambas.html.erb b/app/views/admin/chambas/_individual_chambas.html.erb new file mode 100644 index 0000000000000..fb79ccd9e37e8 --- /dev/null +++ b/app/views/admin/chambas/_individual_chambas.html.erb @@ -0,0 +1,51 @@ + +
+
+

+ + <%= chamba.title %> + +

+ +
+ Edit +
+ <%= image_tag "chamba-icon.png", class: "chamba-image mt-5 mb-5" %> +
+ <%= form_with url:"edit_chambas_list" do |f| %> +
+ ℹ️ +
+ + + + +
+
+ + <% if chamba.approve == true %> + + + + + <%else%> + + + + + <%end%> + +
+ +
+ <% end %> + +
+ +
+ +
diff --git a/app/views/admin/chambas/_new.html.erb b/app/views/admin/chambas/_new.html.erb new file mode 100644 index 0000000000000..6139a25f5b42a --- /dev/null +++ b/app/views/admin/chambas/_new.html.erb @@ -0,0 +1 @@ +Esto sera un formulario para crear nuevas chambas desde el apartado de admin sin el bot de slack :) diff --git a/app/views/admin/chambas/index.html.erb b/app/views/admin/chambas/index.html.erb new file mode 100644 index 0000000000000..16c0cc74d36f7 --- /dev/null +++ b/app/views/admin/chambas/index.html.erb @@ -0,0 +1,50 @@ +
+
+ <%= form_for @chamba do |f|%> +
+ <%= f.text_field :title, :class => "form-control", placeholder: "Titulo de la chamba", :required => true%> + +       + + <%= f.text_field :location, :class => "form-control", placeholder: "Ubicación", :required => true%> +
+ +
+ + + <%= f.text_field :organization, :class => "form-control", placeholder: "Organización", :required => true%> +     + + + <%= f.date_field :exp_date, :class => "form-control", placeholder: "Fecha de expiración", :required => true%> +
+ +
+ + <%= f.text_field :stall, :class => "form-control", placeholder: "Puesto", :required => true%> +     + + <%= f.number_field :salary, :class => "form-control", placeholder: "Salario", :required => true%> +
+ +
+ + <%= f.text_area :description, :class => "form-control", placeholder: "Descripción", :required => true%> +
+ + +
+ + <%= f.text_field :requirements, :class => "form-control", placeholder: "Requerimientos", :required => true%> +
+ +
+ <%end%> +
+ +
+
+ <%= render partial: "individual_chambas", collection: @chambas, as: :chamba %> +
+
+<%= render partial: "image_upload_script" %> diff --git a/app/views/admin/chambas/show.html.erb b/app/views/admin/chambas/show.html.erb new file mode 100644 index 0000000000000..c72c84664abae --- /dev/null +++ b/app/views/admin/chambas/show.html.erb @@ -0,0 +1,12 @@ +
+ + <%= render partial: "individual_article", locals: { article: @article } %> +
diff --git a/app/views/chambas/chamba.html.erb b/app/views/chambas/chamba.html.erb new file mode 100644 index 0000000000000..25bd8a6ff5acc --- /dev/null +++ b/app/views/chambas/chamba.html.erb @@ -0,0 +1,47 @@ +
+
+
+
+ Regresar +
+
+ +
+
+

<%= @chamba.title %>

+
+ +

<%= @chamba.location %>

+

|

+

<%= @chamba.position %>

+

|

+

$<%= @chamba.salary %>

+
+
+ +
+
+
+
+
+

Responsabilidades

+

<%= @chamba.description %>

+
+
+

Requerimientos

+
    + <% @requerimientos.length.times do |reg_req| %> +
  • <%= @requerimientos[reg_req] %>
  • + <% end %> +
+
+
+
+
+ diff --git a/app/views/chambas/chambas.html.erb b/app/views/chambas/chambas.html.erb new file mode 100644 index 0000000000000..3e24f991d39f1 --- /dev/null +++ b/app/views/chambas/chambas.html.erb @@ -0,0 +1,41 @@ +
+
+
+
+ <%= link_to chambas_path do %>Regresar<% end %> +
+
+ + +
+

<%= @chamba.title %>

+
+

<%= @chamba.location %>

+

|

+

+

|

+

<%= @chamba.sueldo %>

+
+
+
+ +
+
+
+
+
+

Responsabilidades

+

<%= @chamba.descripcion %>

+
+
+

Requirimientos

+
    +
+
+
+
+
diff --git a/app/views/chambas/index.html.erb b/app/views/chambas/index.html.erb new file mode 100644 index 0000000000000..f99f069cfa1dc --- /dev/null +++ b/app/views/chambas/index.html.erb @@ -0,0 +1,27 @@ +
+ +
+ <%= @chambas_vec.length %> Chambitas encontradas +
+
+ +
+
diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index d287abc241390..a25479d48bb4c 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -31,6 +31,7 @@ "> "> "> + " rel="icon" sizes="192x192" /> " rel="icon" sizes="128x128" /> diff --git a/app/views/pages/glosario.html.erb b/app/views/pages/glosario.html.erb new file mode 100644 index 0000000000000..bfdde78367914 --- /dev/null +++ b/app/views/pages/glosario.html.erb @@ -0,0 +1,28 @@ +<% title "Glosario" %> + +
+ +
+

Glosario

+
+
+

+ 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. +

+
+
+

+ 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. +

+
+
+
+
diff --git a/config/database.yml b/config/database.yml index eb2b8ab26c086..0435f4c354b10 100644 --- a/config/database.yml +++ b/config/database.yml @@ -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") %> # 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 diff --git a/config/routes.rb b/config/routes.rb index 1dffa2f81d81d..c35e521f1451d 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -245,7 +245,14 @@ 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#index" + get "chambas/:chamba_id", to: "chambas#chamba", as: "chamba" + get "/chambas:filtro_area", to: "chambas#filtro_areas" + get "/chamba", to: "chambas#chamba" + post "articles/preview", to: "articles#preview" post "comments/preview", to: "comments#preview" @@ -353,6 +360,17 @@ get "/:username/:slug/comments/:id_code/edit", to: "comments#edit" get "/:username/:slug/comments/:id_code/delete_confirm", to: "comments#delete_confirm" + # Chambas admin + get "/:username/:slug/chambas", to: "admin/chambas#index" + + # crud chamba from forem + post "/chambas", to: "admin/chambas#create_chamba_from_forem" + post "/admin/content_manager/edit_chambas_list", to: "admin/chambas#update_chamba_from_list" #this is only for update exp_date, and for bann or approve chambas + post "/admin/content_manager/update_chamba_list", to: "admin/chambas#update_chamba" + + + + # Proper link format get "/:username/comment/:id_code", to: "comments#index" get "/:username/comment/:id_code/edit", to: "comments#edit" diff --git a/db/migrate/20220203235658_create_chambas.rb b/db/migrate/20220203235658_create_chambas.rb new file mode 100644 index 0000000000000..bdb8fea1d8e52 --- /dev/null +++ b/db/migrate/20220203235658_create_chambas.rb @@ -0,0 +1,16 @@ +class CreateChambas < ActiveRecord::Migration[6.1] + def change + create_table :chambas do |t| + t.string :title + t.string :post_date + t.string :date + t.date :exp_date + t.string :description + t.string :organization + t.string :location + t.integer :salary + + t.timestamps + end + end +end diff --git a/db/migrate/20220204001843_create_areas.rb b/db/migrate/20220204001843_create_areas.rb new file mode 100644 index 0000000000000..79eee80fd6a34 --- /dev/null +++ b/db/migrate/20220204001843_create_areas.rb @@ -0,0 +1,9 @@ +class CreateAreas < ActiveRecord::Migration[6.1] + def change + create_table :areas do |t| + t.string :name + + t.timestamps + end + end +end diff --git a/db/migrate/20220204002225_create_areas_chambas.rb b/db/migrate/20220204002225_create_areas_chambas.rb new file mode 100644 index 0000000000000..a501fd6736073 --- /dev/null +++ b/db/migrate/20220204002225_create_areas_chambas.rb @@ -0,0 +1,10 @@ +class CreateAreasChambas < ActiveRecord::Migration[6.1] + def change + create_table :areas_chambas do |t| + t.references :chamba, null: false, foreign_key: true + t.references :area, null: false, foreign_key: true + + t.timestamps + end + end +end diff --git a/db/migrate/20220204002336_create_requerimientos_chambas.rb b/db/migrate/20220204002336_create_requerimientos_chambas.rb new file mode 100644 index 0000000000000..0f26f16581465 --- /dev/null +++ b/db/migrate/20220204002336_create_requerimientos_chambas.rb @@ -0,0 +1,10 @@ +class CreateRequerimientosChambas < ActiveRecord::Migration[6.1] + def change + create_table :requerimientos_chambas do |t| + t.string :description + t.references :chamba, null: false, foreign_key: true + + t.timestamps + end + end +end diff --git a/db/migrate/20220216222509_columns_added_to_chambas.rb b/db/migrate/20220216222509_columns_added_to_chambas.rb new file mode 100644 index 0000000000000..c90269f2dc78e --- /dev/null +++ b/db/migrate/20220216222509_columns_added_to_chambas.rb @@ -0,0 +1,7 @@ +class ColumnsAddedToChamba < ActiveRecord::Migration[6.1] + def change + add_column :chambas, :approve, :string + add_column :chambas, :requirements, :string + add_column :chambas, :stall, :string + end +end diff --git a/db/schema.rb b/db/schema.rb index bcfa1a0be252a..4db1dd2d8f5b1 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,11 +10,10 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 2022_01_26_205052) do +ActiveRecord::Schema.define(version: 2022_02_17_230122) do # These are extensions that must be enabled in order to support this database enable_extension "citext" - enable_extension "pg_stat_statements" enable_extension "pg_trgm" enable_extension "pgcrypto" enable_extension "plpgsql" @@ -80,6 +79,21 @@ t.index ["user_id"], name: "index_api_secrets_on_user_id" end + create_table "areas", force: :cascade do |t| + t.datetime "created_at", precision: 6, null: false + t.string "name" + t.datetime "updated_at", precision: 6, null: false + end + + create_table "areas_chambas", force: :cascade do |t| + t.bigint "area_id", null: false + t.bigint "chamba_id", null: false + t.datetime "created_at", precision: 6, null: false + t.datetime "updated_at", precision: 6, null: false + t.index ["area_id"], name: "index_areas_chambas_on_area_id" + t.index ["chamba_id"], name: "index_areas_chambas_on_chamba_id" + end + create_table "articles", force: :cascade do |t| t.boolean "any_comments_hidden", default: false t.boolean "approved", default: false @@ -288,6 +302,23 @@ t.index ["title", "type_of"], name: "index_broadcasts_on_title_and_type_of", unique: true end + create_table "chambas", force: :cascade do |t| + t.boolean "approve" + t.datetime "created_at", precision: 6, null: false + t.string "date" + t.string "description" + t.date "exp_date" + t.string "location" + t.string "organization" + t.string "position" + t.string "post_date" + t.string "requirements" + t.integer "salary" + t.string "stall" + t.string "title" + t.datetime "updated_at", precision: 6, null: false + end + create_table "classified_listing_categories", force: :cascade do |t| t.integer "cost", null: false t.datetime "created_at", null: false @@ -962,6 +993,14 @@ t.index ["user_id", "reactable_id", "reactable_type", "category"], name: "index_reactions_on_user_id_reactable_id_reactable_type_category", unique: true end + create_table "requerimientos_chambas", force: :cascade do |t| + t.bigint "chamba_id", null: false + t.datetime "created_at", precision: 6, null: false + t.string "description" + t.datetime "updated_at", precision: 6, null: false + t.index ["chamba_id"], name: "index_requerimientos_chambas_on_chamba_id" + end + create_table "response_templates", force: :cascade do |t| t.text "content", null: false t.string "content_type", null: false @@ -1224,7 +1263,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" t.datetime "last_notification_activity" t.string "last_onboarding_page" t.datetime "last_reacted_at" @@ -1366,6 +1405,8 @@ add_foreign_key "ahoy_messages", "users", on_delete: :cascade add_foreign_key "ahoy_visits", "users", on_delete: :cascade add_foreign_key "api_secrets", "users", on_delete: :cascade + add_foreign_key "areas_chambas", "areas" + add_foreign_key "areas_chambas", "chambas" add_foreign_key "articles", "collections", on_delete: :nullify add_foreign_key "articles", "organizations", on_delete: :nullify add_foreign_key "articles", "users", on_delete: :cascade @@ -1427,6 +1468,7 @@ add_foreign_key "rating_votes", "articles", on_delete: :cascade add_foreign_key "rating_votes", "users", on_delete: :nullify add_foreign_key "reactions", "users", on_delete: :cascade + add_foreign_key "requerimientos_chambas", "chambas" add_foreign_key "response_templates", "users" add_foreign_key "sponsorships", "organizations" add_foreign_key "sponsorships", "users" diff --git a/db/seeds.rb b/db/seeds.rb index aa1db312aa256..28a04e54cbcf7 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -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") +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") +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") + +# AreasChamba.create(chamba_id: 1, area_id: 2, created_at: "2022-02-02", updated_at: "2022-02-02") +# AreasChamba.create(chamba_id: 3, area_id: 1, created_at: "2022-02-02", updated_at: "2022-02-02") +# AreasChamba.create(chamba_id: 2, area_id: 3, created_at: "2022-02-02", updated_at: "2022-02-02") +# AreasChamba.create(chamba_id: 4, area_id: 4, created_at: "2022-02-02", updated_at: "2022-02-02") +# AreasChamba.create(chamba_id: 5, area_id: 5, created_at: "2022-02-02", updated_at: "2022-02-02") + +# Area.create(name: "Full-stack", created_at: "2022-02-02", updated_at: "2022-02-02") +# Area.create(name: "Frontend", created_at: "2022-02-02", updated_at: "2022-02-02") +# Area.create(name: "Backend", created_at: "2022-02-02", updated_at: "2022-02-02") +# Area.create(name: "UX/UI", created_at: "2022-02-02", updated_at: "2022-02-02") +# Area.create(name: "QA", created_at: "2022-02-02", updated_at: "2022-02-02") +# Area.create(name: "Web", created_at: "2022-02-02", updated_at: "2022-02-02") +# Area.create(name: "Programación", created_at: "2022-02-02", updated_at: "2022-02-02") +# Area.create(name: "Api's", created_at: "2022-02-02", updated_at: "2022-02-02") + +# RequerimientosChamba.create(description: "HTML", chamba_id: 2) +# RequerimientosChamba.create(description: "Python", chamba_id: 3) +# RequerimientosChamba.create(description: "Javascript", chamba_id: 3) +# RequerimientosChamba.create(description: "Buena comunicacion en equipo", chamba_id: 4) +# RequerimientosChamba.create(description: "Atencion al detalle", chamba_id: 5) +# RequerimientosChamba.create(description: "C++", chamba_id: 1) +# RequerimientosChamba.create(description: "c#", chamba_id: 1) +# RequerimientosChamba.create(description: "PHP", chamba_id: 5) +# RequerimientosChamba.create(description: "MySQL", chamba_id: 3) +# RequerimientosChamba.create(description: "Ruby", chamba_id: 2) +# RequerimientosChamba.create(description: "RubyonRails", chamba_id: 2) +# RequerimientosChamba.create(description: "NoSQL", chamba_id: 4) +# RequerimientosChamba.create(description: "React Native", chamba_id: 5) +# RequerimientosChamba.create(description: "React", chamba_id: 4) + +############################################################################## + puts <<-ASCII :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: diff --git a/spec/helpers/chambas_helper_spec.rb b/spec/helpers/chambas_helper_spec.rb new file mode 100644 index 0000000000000..c0f90a8b847c6 --- /dev/null +++ b/spec/helpers/chambas_helper_spec.rb @@ -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 diff --git a/spec/models/area_spec.rb b/spec/models/area_spec.rb new file mode 100644 index 0000000000000..b8e21582b30d5 --- /dev/null +++ b/spec/models/area_spec.rb @@ -0,0 +1,5 @@ +require "rails_helper" + +RSpec.describe Area, type: :model do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/models/areas_chamba_spec.rb b/spec/models/areas_chamba_spec.rb new file mode 100644 index 0000000000000..b5e7a2d484051 --- /dev/null +++ b/spec/models/areas_chamba_spec.rb @@ -0,0 +1,5 @@ +require "rails_helper" + +RSpec.describe AreasChamba, type: :model do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/models/chamba_spec.rb b/spec/models/chamba_spec.rb new file mode 100644 index 0000000000000..dfe8720279553 --- /dev/null +++ b/spec/models/chamba_spec.rb @@ -0,0 +1,5 @@ +require "rails_helper" + +RSpec.describe Chamba, type: :model do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/models/requerimientos_chamba_spec.rb b/spec/models/requerimientos_chamba_spec.rb new file mode 100644 index 0000000000000..e34abfeb4a0c3 --- /dev/null +++ b/spec/models/requerimientos_chamba_spec.rb @@ -0,0 +1,5 @@ +require "rails_helper" + +RSpec.describe RequerimientosChamba, type: :model do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/requests/chambas_spec.rb b/spec/requests/chambas_spec.rb new file mode 100644 index 0000000000000..72482022a1855 --- /dev/null +++ b/spec/requests/chambas_spec.rb @@ -0,0 +1,7 @@ +require "rails_helper" + +RSpec.describe "Chambas", type: :request do + describe "GET /index" do + pending "add some examples (or delete) #{__FILE__}" + end +end diff --git a/vendor/cache/acts_as_follower-06393d3693a1/acts_as_follower.gemspec b/vendor/cache/acts_as_follower-06393d3693a1/acts_as_follower.gemspec index b6c96db3e2aec..df73f65d05570 100644 --- a/vendor/cache/acts_as_follower-06393d3693a1/acts_as_follower.gemspec +++ b/vendor/cache/acts_as_follower-06393d3693a1/acts_as_follower.gemspec @@ -14,10 +14,10 @@ Gem::Specification.new do |s| 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