From 40302ba2989c4f0560751d2307b858e6144b2fb0 Mon Sep 17 00:00:00 2001 From: mantequilla Date: Fri, 28 Jan 2022 16:08:10 -0600 Subject: [PATCH 1/6] Views created, "Chambas" controller created and edited and draft database. - 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 Co-authored-by: armanirmr Co-authored-by: YxMARCKxY Co-authored-by: rene3255 Co-authored-by: BrandonVG --- Gemfile.lock | 1 + app/assets/images/chamba-icon.png | Bin 0 -> 10902 bytes app/assets/stylesheets/chambas.scss | 3 + app/assets/stylesheets/components/cards.scss | 101 ++++++++++++++++++ app/controllers/chambas_controller.rb | 6 ++ app/controllers/pages_controller.rb | 6 ++ app/helpers/chambas_helper.rb | 2 + app/views/chambas/chamba.html.erb | 35 ++++++ app/views/chambas/chambas.html.erb | 79 ++++++++++++++ app/views/layouts/application.html.erb | 1 + app/views/pages/glosario.html.erb | 28 +++++ config/database.yml | 4 +- config/routes.rb | 4 + db/schema.rb | 3 +- spec/helpers/chambas_helper_spec.rb | 15 +++ spec/requests/chambas_spec.rb | 7 ++ .../acts_as_follower.gemspec | 6 +- 17 files changed, 295 insertions(+), 6 deletions(-) create mode 100644 app/assets/images/chamba-icon.png create mode 100644 app/assets/stylesheets/chambas.scss create mode 100644 app/controllers/chambas_controller.rb create mode 100644 app/helpers/chambas_helper.rb create mode 100644 app/views/chambas/chamba.html.erb create mode 100644 app/views/chambas/chambas.html.erb create mode 100644 app/views/pages/glosario.html.erb create mode 100644 spec/helpers/chambas_helper_spec.rb create mode 100644 spec/requests/chambas_spec.rb 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 0000000000000000000000000000000000000000..ca7fe1e77bc909414b5a3f141859ebcff78db78d GIT binary patch literal 10902 zcmV;HDrwb;P)3LGmgvn9**zHr|*rU0y>K0jDU;|E`tlM zBfQc1)X(=Z=;wQWsQ5lbpYuRl*=d$;y1Jo(1{#X$s;<%>$Fbmv`*`^PV2Nz>$FbGLI|fWQQI$JLqm6m=jX%W zN+qfphOQe%LFc@}B0Qw=h`}rw3d|^Ase-5(j77?b#Y!Z?i|y@&(vc&>Wq>=&aEj8Y zq)6D^eMV=w9NM61YygpMWSsXI2!p_3h;tYqVe|p;1P2yp$m1L!Lix0X{FIcJ436`Z zZXS@&P`WAP{21r_1;+3wH;flK)5aO&6Qxr5*zD}%(;^?70(6oq(yR2|-qabzV&M&p zX)kBMw~}%s5wMdKr;A!228#^%;w3IznaRoH#KSsIe3j@bP23qoew;YZax@;|T>C{j zT{sAExBw?9om7f6I5-&3=ey2C1GjO+Hxuh3`riZ%t0E+RioX1M?tfQA<_#EUt{Gl(A&k+KGI37@;9^};cyQKeth z7IMHS@+gJ&5OWVH{JrUP^Z>wvC0N6>mKBM$w~uZK>&D;EO?m@eZxUUWh~TDMj0;U{ zaQvu-Ic-BdOx@UGdNa?Q2bEe_*PPNY7I5u)f?}X$BJ)NM{ubVH|4@IIqpvw27H$@ zd|2E5+|r1{7%;r4TrT~H=BB1#71CSCiD>k5T?_ZEv& zIXHoI0u|{x*3t3eS?w|WpMdxwVstvws6^Wg9|NX`CgS{-3lO{`bf%}t%s3#skTG^% zEY|l_J|CF`m^mRMyAz~HyF=aG`~HkE_zFGauOyKutWYZzsTF*$xaGoeOJB8Qe9ppO4@5FJ#L>mq`^N7n3eVkV)!iIQT*WO%idInaAR?H#|4D4(x<||)A z@VYgymW+d#=LWx{R4Kk^Ztn0TtN^WuMM@@j z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_fsxFa2YxBRNqtpKhs0}s;Q}i$Dzg4azzp( zetFUrNsd(z255M>om#Uj<*bu$5 z0;`9dBMv#KrW@)Mq=9Z&UUl%B1{7t;ern4ot*;M5b!|`L{w+F(cK6ik9-DL6SH{dC8BUFOARIH6Dvv!z#gW&EOY@-% zx_=o}iKdG1fpUdkF+YFsDOg5Y_AW=9Kh)OVeTPwD;$(9Igr&i&pu+SskFOHx5K4mmd zO7z2u5&BFjwf`AdA!??6dpQ0BYx{)wJTn^7;AsQa-$~yanx}rNhvE=g(LH-tZCfZ#>Kgg2k7J4L?V0RGtWHU^uD5I=>*O1j2rp< zrl%v({C$jTeI$z=_1j_IS6rhYPHH30i32Ubk>@in!C1=z2bQV~GnTyl>b4mi_A-v| zJ2%t+>xa`1FKIhSvvdL{3WYKqpXf{s{(@Ga(+v4GzHsV?AejyELqToWa^v{LuJZ%s z(4d(kg$_uVcyNk2lh)UT5_GGhg8g&udX!S|FkN09?Zz6w6^Ky)3d_N;JHy>#chgV<3 zJVDDJcL7#z<2<}i)3S%Brw`A<8t{Mo&`G6864E<5ww|GB{Lc|I@s`M8TFvUC(O)Os zy>4+r8%Sl~SDkDrYQNIRP!e%`UW!saVE}s&vH0tB+BoRv;PbUgC%Yn<3A?*@cb3bg z4Z2?LM}rH?H9#Z4A#UJCQigsKMlWeYf-FZ{^^kTBVfxmpzf0w4&}gbe-R3;;$O+~d za>u49iYyI(o+jj9;6`PFGyMg|_(Z8>Ow7(6Oo8H!izgeMN{S?*OSF-ZhxBw>3m1!8 z$S`!>FbaBkrwI<3<>t +
+ +
+ +
+ <%= image_tag "chamba-icon.png" %> + Codeando México +
+

Intern en tecnología

+ Remoto (México) | Internship | $1M +
+ +
+
+
+

Responsabilidades

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

Requerimientos

+
    +
  • Hola
  • +
  • Bubulubuenas noches
  • +
  • Como stas
  • +
  • arriva paiton
  • +
+
+
+
+
+ diff --git a/app/views/chambas/chambas.html.erb b/app/views/chambas/chambas.html.erb new file mode 100644 index 0000000000000..539f933fc050a --- /dev/null +++ b/app/views/chambas/chambas.html.erb @@ -0,0 +1,79 @@ + 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..8762dbc641cfb 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -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" diff --git a/db/schema.rb b/db/schema.rb index bcfa1a0be252a..5c1c04a2cb80e 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -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" enable_extension "pg_trgm" enable_extension "pgcrypto" enable_extension "plpgsql" @@ -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" t.datetime "last_notification_activity" t.string "last_onboarding_page" t.datetime "last_reacted_at" 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/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..894e4e546ae8a 100644 --- a/vendor/cache/acts_as_follower-06393d3693a1/acts_as_follower.gemspec +++ b/vendor/cache/acts_as_follower-06393d3693a1/acts_as_follower.gemspec @@ -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" 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 From 33299491bbf6f263e23ccb16154c4ca9e9a9ccea Mon Sep 17 00:00:00 2001 From: mantequilla Date: Mon, 31 Jan 2022 19:38:33 -0600 Subject: [PATCH 2/6] We resolved the observations from the last PR Co-authored-by: diegoOG09 Co-authored-by: armanirmr Co-authored-by: YxMARCKxY Co-authored-by: rene3255 Co-authored-by: BrandonVG --- app/assets/stylesheets/base/layout.scss | 76 ++++++++++++++++++ app/assets/stylesheets/chambas.scss | 3 - app/assets/stylesheets/components/cards.scss | 2 +- app/controllers/chambas_controller.rb | 2 +- app/views/chambas/chambas.html.erb | 79 ------------------- config/routes.rb | 2 +- .../acts_as_follower.gemspec | 2 +- 7 files changed, 80 insertions(+), 86 deletions(-) delete mode 100644 app/assets/stylesheets/chambas.scss delete mode 100644 app/views/chambas/chambas.html.erb diff --git a/app/assets/stylesheets/base/layout.scss b/app/assets/stylesheets/base/layout.scss index 8802fd019143c..0bfc0cd13faf7 100644 --- a/app/assets/stylesheets/base/layout.scss +++ b/app/assets/stylesheets/base/layout.scss @@ -322,3 +322,79 @@ } } } + +.chamba-info { + padding-left: 80px; + padding-bottom: 20px; +} + +.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; +} + +.chamba-title h1 { + font-size: 80px; +} + +.chamba-title h2 { + font-weight: 400; +} + +.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; +} diff --git a/app/assets/stylesheets/chambas.scss b/app/assets/stylesheets/chambas.scss deleted file mode 100644 index 2db8cdb34892d..0000000000000 --- a/app/assets/stylesheets/chambas.scss +++ /dev/null @@ -1,3 +0,0 @@ -// 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/ diff --git a/app/assets/stylesheets/components/cards.scss b/app/assets/stylesheets/components/cards.scss index 1e2094d0b506b..38bea9bca7736 100644 --- a/app/assets/stylesheets/components/cards.scss +++ b/app/assets/stylesheets/components/cards.scss @@ -75,7 +75,7 @@ } } -i { +.i-icon { margin-right: 0.3rem; } diff --git a/app/controllers/chambas_controller.rb b/app/controllers/chambas_controller.rb index 88905c996a0cf..620c300b3ebde 100644 --- a/app/controllers/chambas_controller.rb +++ b/app/controllers/chambas_controller.rb @@ -1,5 +1,5 @@ class ChambasController < ApplicationController - def chambas + def index @filters = %w[Mexico Web-Developer Programación Issues] @var_back = params[:filter_active] end diff --git a/app/views/chambas/chambas.html.erb b/app/views/chambas/chambas.html.erb deleted file mode 100644 index 539f933fc050a..0000000000000 --- a/app/views/chambas/chambas.html.erb +++ /dev/null @@ -1,79 +0,0 @@ - diff --git a/config/routes.rb b/config/routes.rb index 8762dbc641cfb..db98a4481e4df 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -247,7 +247,7 @@ get "/sponsors", to: "pages#sponsors" get "/glosario", to: "pages#glosario" get "/search", to: "stories/articles_search#index" - get "/chambas", to: "chambas#chambas" + get "/chambas", to: "chambas#index" get "/chambas/:filter_active", to: "chambas#chamba" get "/chamba", to: "chambas#chamba" post "articles/preview", to: "articles#preview" 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 894e4e546ae8a..df73f65d05570 100644 --- a/vendor/cache/acts_as_follower-06393d3693a1/acts_as_follower.gemspec +++ b/vendor/cache/acts_as_follower-06393d3693a1/acts_as_follower.gemspec @@ -8,7 +8,7 @@ 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 = "2022-01-25" + s.date = "2021-04-09" 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] From 531f813c79b3390b65cb3fdc1b522e2ce26027ce Mon Sep 17 00:00:00 2001 From: diegoOG09 Date: Mon, 14 Feb 2022 20:03:42 -0600 Subject: [PATCH 3/6] Chambas usuario y admin OK|Create chamba Admin OK --- app/assets/stylesheets/base/layout.scss | 12 +- app/assets/stylesheets/components/cards.scss | 129 +++++++++++++----- app/controllers/admin/chambas_controller.rb | 57 ++++++++ app/controllers/chambas_controller.rb | 23 +++- app/javascript/admin/adminModal.js | 3 + app/models/admin_menu.rb | 1 + app/models/area.rb | 3 + app/models/areas_chamba.rb | 4 + app/models/chamba.rb | 3 + app/models/requerimientos_chamba.rb | 3 + .../chambas/_image_upload_script.html.erb | 31 +++++ .../chambas/_individual_chambas.html.erb | 43 ++++++ app/views/admin/chambas/_new.html.erb | 1 + app/views/admin/chambas/index.html.erb | 61 +++++++++ app/views/admin/chambas/show.html.erb | 12 ++ app/views/chambas/chamba.html.erb | 56 +++++--- app/views/chambas/chambas.html.erb | 41 ++++++ app/views/chambas/index.html.erb | 27 ++++ config/routes.rb | 11 +- .../20220203010118_add_columns_to_chambas.rb | 7 + db/migrate/20220203235658_create_chambas.rb | 16 +++ db/migrate/20220204001843_create_areas.rb | 9 ++ .../20220204002225_create_areas_chambas.rb | 10 ++ ...204002336_create_requerimientos_chambas.rb | 10 ++ ...04004138_add_column_position_to_chambas.rb | 5 + .../20220209231957_add_img_route_column.rb | 5 + db/schema.rb | 43 +++++- db/seeds.rb | 43 ++++++ spec/models/area_spec.rb | 5 + spec/models/areas_chamba_spec.rb | 5 + spec/models/chamba_spec.rb | 5 + spec/models/requerimientos_chamba_spec.rb | 5 + 32 files changed, 629 insertions(+), 60 deletions(-) create mode 100644 app/controllers/admin/chambas_controller.rb create mode 100644 app/models/area.rb create mode 100644 app/models/areas_chamba.rb create mode 100644 app/models/chamba.rb create mode 100644 app/models/requerimientos_chamba.rb create mode 100644 app/views/admin/chambas/_image_upload_script.html.erb create mode 100644 app/views/admin/chambas/_individual_chambas.html.erb create mode 100644 app/views/admin/chambas/_new.html.erb create mode 100644 app/views/admin/chambas/index.html.erb create mode 100644 app/views/admin/chambas/show.html.erb create mode 100644 app/views/chambas/chambas.html.erb create mode 100644 app/views/chambas/index.html.erb create mode 100644 db/migrate/20220203010118_add_columns_to_chambas.rb create mode 100644 db/migrate/20220203235658_create_chambas.rb create mode 100644 db/migrate/20220204001843_create_areas.rb create mode 100644 db/migrate/20220204002225_create_areas_chambas.rb create mode 100644 db/migrate/20220204002336_create_requerimientos_chambas.rb create mode 100644 db/migrate/20220204004138_add_column_position_to_chambas.rb create mode 100644 db/migrate/20220209231957_add_img_route_column.rb create mode 100644 spec/models/area_spec.rb create mode 100644 spec/models/areas_chamba_spec.rb create mode 100644 spec/models/chamba_spec.rb create mode 100644 spec/models/requerimientos_chamba_spec.rb diff --git a/app/assets/stylesheets/base/layout.scss b/app/assets/stylesheets/base/layout.scss index 0bfc0cd13faf7..f2d95ed1c02a1 100644 --- a/app/assets/stylesheets/base/layout.scss +++ b/app/assets/stylesheets/base/layout.scss @@ -324,8 +324,8 @@ } .chamba-info { - padding-left: 80px; padding-bottom: 20px; + padding-left: 80px; } .card-chamba { @@ -357,14 +357,17 @@ .chamba-title { color: #4449e0d6; + padding-left: 80px; + padding-right: 80px; } .chamba-title h1 { - font-size: 80px; + font-size: 70px; } .chamba-title h2 { font-weight: 400; + margin: 5px; } .chamba-btn .apply { @@ -398,3 +401,8 @@ 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 38bea9bca7736..5e0f9bd72e48a 100644 --- a/app/assets/stylesheets/components/cards.scss +++ b/app/assets/stylesheets/components/cards.scss @@ -43,42 +43,16 @@ } } -.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-icon { margin-right: 0.3rem; } +.chambita-title { + a { + font-weight: 700; + } +} + .chambas-found { display: flex; justify-content: space-between; @@ -97,6 +71,33 @@ } } +.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; + } +} + +#add-btn { + border: none; + color: white; + background-color: #6c7a89; + + &:hover { + background-color: #bdc3c7; + } +} + .chambas-card { display: grid; grid-template-columns: 13% 77% 10%; @@ -143,3 +144,67 @@ 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..d085fc8bf3803 --- /dev/null +++ b/app/controllers/admin/chambas_controller.rb @@ -0,0 +1,57 @@ +module Admin + class ChambasController < Admin::ApplicationController + layout "admin" + + @chamba_record_save = nil + + def index + @chambas = Chamba.all + @chamba_save = @chamba_record_save + # variable para crear una nueva chamba + @chamba = Chamba.new + end + + # //////para crear nueva chamaba + + def create + @chamba = Chamba.new(chamba_params) + if @chamba.save + @chamba_record_save = true + else + @chamba_record_save = false + render admin_path + end + end + + # def create + # @employee = Employee.new(employee_params) + # if @employee.save + # redirect_to pages_employees_path + # else + # render :new + # end + # end + + # //////para editar una chamaba + def edit + @chamba = Chamba.find(params[:id_chamba]) + end + + # //////para borrar una chamaba + 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 + + private + + def chamba_params + params.require(:chamba).permit(:title, :exp_date, :location, :description, :organization, :salary) + end + end +end diff --git a/app/controllers/chambas_controller.rb b/app/controllers/chambas_controller.rb index 620c300b3ebde..2305e76d003f0 100644 --- a/app/controllers/chambas_controller.rb +++ b/app/controllers/chambas_controller.rb @@ -1,6 +1,25 @@ class ChambasController < ApplicationController + # vista index (chambas) def index - @filters = %w[Mexico Web-Developer Programación Issues] - @var_back = params[:filter_active] + @chambas_vec = req_chambas + @areas = %w[Mexico Web-Developer Programación Issues] + @filters = req_filters + @areas_chambas = AreasChamba.all + end + + # vista chamba + def chamba + @chamba = Chamba.find(params[:chamba_id]) + @requerimientos = RequerimientosChamba.where(chamba_id: params[:chamba_id]) + 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/javascript/admin/adminModal.js b/app/javascript/admin/adminModal.js index 87110f0976213..cd6679007d573 100644 --- a/app/javascript/admin/adminModal.js +++ b/app/javascript/admin/adminModal.js @@ -16,6 +16,9 @@ * @param {string} modalProps.leftCustomDataAttr A custom data attribute for the left button. * @param {string} modalProps.rightCustomDataAttr A custom data attribute for the right button. */ + +//AQUI PONES EL SCRIPT DEL CRUD: + export const adminModal = function ({ title, controllerName, 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..0c7258fc12d63 --- /dev/null +++ b/app/models/chamba.rb @@ -0,0 +1,3 @@ +class Chamba < ApplicationRecord + has_many :requerimientos_chamba, dependent: :nil +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..e2be7d8717ca0 --- /dev/null +++ b/app/views/admin/chambas/_individual_chambas.html.erb @@ -0,0 +1,43 @@ + +
+
+

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

+ +
+ %>/edit" target="_blank" rel="noopener">Edit + + Manage User +
+ <%= image_tag "chamba-icon.png", class: "chamba-image mt-5 mb-5" %> +
+ <%= form_with do |f| %> +
+
+ + +
+
+
+
+ + <%= f.datetime_select :published_at, required: true, include_blank: true, include_seconds: true, class: "form-control" %> UTC +
+
+
+ +
+ <% 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..a005a388e8972 --- /dev/null +++ b/app/views/admin/chambas/index.html.erb @@ -0,0 +1,61 @@ +<% if @chamba_save == true %> + + <% elsif @chamba_save == false %> + +<% end %> + +
+
+
+
+ +   +   +   + + +
+ +
+ Organización / empresa + +
+ +
+ Puesto + +   +   +   + $ + +
+ +
+ Descripción + +
+
+ + +
+ + Agregar + Ver requerimientos +
+ + +
+
+
+ +
+
+ <%= 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 index ce8a7de200b0d..82f7a84d569f2 100644 --- a/app/views/chambas/chamba.html.erb +++ b/app/views/chambas/chamba.html.erb @@ -1,32 +1,44 @@
-
- +
-
- Regresar -
-
- <%= image_tag "chamba-icon.png" %> - Codeando México -
-

Intern en tecnología

- Remoto (México) | Internship | $1M -
- + -
+
+ +
+
+

<%= @chamba.title %>

+
+ +

<%= @chamba.location %>

+

|

+

<%= @chamba.position %>

+

|

+

$<%= @chamba.salary %>

+
+
+ +
+
+
+
-

Responsabilidades

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

Responsabilidades

+

<%= @chamba.description %>

-

Requerimientos

+

Requerimientos

    -
  • Hola
  • -
  • Bubulubuenas noches
  • -
  • Como stas
  • -
  • arriva paiton
  • + <% @requerimientos.length.times do |reg_req| %> +
  • <%= @requerimientos[reg_req].description %>
  • + <% 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 @@ + diff --git a/config/routes.rb b/config/routes.rb index db98a4481e4df..cc8da3eb394f7 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -247,9 +247,12 @@ get "/sponsors", to: "pages#sponsors" get "/glosario", to: "pages#glosario" get "/search", to: "stories/articles_search#index" + get "/chambas", to: "chambas#index" - get "/chambas/:filter_active", to: "chambas#chamba" + 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" @@ -357,6 +360,12 @@ 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" + + # new chamba creation + post "/chambas", to: "admin/chambas#create" + # 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/20220203010118_add_columns_to_chambas.rb b/db/migrate/20220203010118_add_columns_to_chambas.rb new file mode 100644 index 0000000000000..1f70abf936d07 --- /dev/null +++ b/db/migrate/20220203010118_add_columns_to_chambas.rb @@ -0,0 +1,7 @@ +class AddColumnsToChambas < ActiveRecord::Migration[6.1] + def change + add_column :chambas, :organization, :string + add_column :chambas, :location, :string + add_column :chambas, :sueldo, :integer + end +end 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/20220204004138_add_column_position_to_chambas.rb b/db/migrate/20220204004138_add_column_position_to_chambas.rb new file mode 100644 index 0000000000000..7e4dfca05a829 --- /dev/null +++ b/db/migrate/20220204004138_add_column_position_to_chambas.rb @@ -0,0 +1,5 @@ +class AddColumnPositionToChambas < ActiveRecord::Migration[6.1] + def change + add_column :chambas, :position, :string + end +end diff --git a/db/migrate/20220209231957_add_img_route_column.rb b/db/migrate/20220209231957_add_img_route_column.rb new file mode 100644 index 0000000000000..e699817125b46 --- /dev/null +++ b/db/migrate/20220209231957_add_img_route_column.rb @@ -0,0 +1,5 @@ +class AddImgRouteColumn < ActiveRecord::Migration[6.1] + def change + add_column :chambas, :cover_image, :string + end +end diff --git a/db/schema.rb b/db/schema.rb index 5c1c04a2cb80e..6bc545f1603bc 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # 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_09_231957) do # These are extensions that must be enabled in order to support this database enable_extension "citext" @@ -79,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 @@ -287,6 +302,21 @@ t.index ["title", "type_of"], name: "index_broadcasts_on_title_and_type_of", unique: true end + create_table "chambas", force: :cascade do |t| + t.string "cover_image" + 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.integer "salary" + 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 @@ -961,6 +991,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 @@ -1365,6 +1403,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 @@ -1426,6 +1466,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/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 From 97b012ce59897579e89f201461148ba18eaf7159 Mon Sep 17 00:00:00 2001 From: diegoOG09 Date: Thu, 24 Feb 2022 18:11:20 -0600 Subject: [PATCH 4/6] Migrations added to Chambas db - We add certain fields in the model of chambas as: stall, approve Co-authored-by: diegoOG09 Co-authored-by: armanirmr Co-authored-by: YxMARCKxY Co-authored-by: rene3255 Co-authored-by: BrandonVG bvadillo0@ucol.mx Co-authored-by: IrenehMDev --- db/migrate/20220203010118_add_columns_to_chambas.rb | 7 ------- db/migrate/20220209231957_add_img_route_column.rb | 5 ----- db/migrate/20220216222509_req_and_stall_added_to_chamba.rb | 6 ++++++ db/migrate/20220217230122_add_column_aprove_to_chambas.rb | 5 +++++ db/schema.rb | 5 ++++- 5 files changed, 15 insertions(+), 13 deletions(-) delete mode 100644 db/migrate/20220203010118_add_columns_to_chambas.rb delete mode 100644 db/migrate/20220209231957_add_img_route_column.rb create mode 100644 db/migrate/20220216222509_req_and_stall_added_to_chamba.rb create mode 100644 db/migrate/20220217230122_add_column_aprove_to_chambas.rb diff --git a/db/migrate/20220203010118_add_columns_to_chambas.rb b/db/migrate/20220203010118_add_columns_to_chambas.rb deleted file mode 100644 index 1f70abf936d07..0000000000000 --- a/db/migrate/20220203010118_add_columns_to_chambas.rb +++ /dev/null @@ -1,7 +0,0 @@ -class AddColumnsToChambas < ActiveRecord::Migration[6.1] - def change - add_column :chambas, :organization, :string - add_column :chambas, :location, :string - add_column :chambas, :sueldo, :integer - end -end diff --git a/db/migrate/20220209231957_add_img_route_column.rb b/db/migrate/20220209231957_add_img_route_column.rb deleted file mode 100644 index e699817125b46..0000000000000 --- a/db/migrate/20220209231957_add_img_route_column.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddImgRouteColumn < ActiveRecord::Migration[6.1] - def change - add_column :chambas, :cover_image, :string - end -end diff --git a/db/migrate/20220216222509_req_and_stall_added_to_chamba.rb b/db/migrate/20220216222509_req_and_stall_added_to_chamba.rb new file mode 100644 index 0000000000000..9bbe09ce83bec --- /dev/null +++ b/db/migrate/20220216222509_req_and_stall_added_to_chamba.rb @@ -0,0 +1,6 @@ +class ReqAndStallAddedToChamba < ActiveRecord::Migration[6.1] + def change + add_column :chambas, :requirements, :string + add_column :chambas, :stall, :string + end +end diff --git a/db/migrate/20220217230122_add_column_aprove_to_chambas.rb b/db/migrate/20220217230122_add_column_aprove_to_chambas.rb new file mode 100644 index 0000000000000..210c327918296 --- /dev/null +++ b/db/migrate/20220217230122_add_column_aprove_to_chambas.rb @@ -0,0 +1,5 @@ +class AddColumnAproveToChambas < ActiveRecord::Migration[6.1] + def change + add_column :chambas, :approve, :boolean + end +end diff --git a/db/schema.rb b/db/schema.rb index 6bc545f1603bc..92239301af7cd 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 2022_02_09_231957) 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" @@ -303,6 +303,7 @@ end create_table "chambas", force: :cascade do |t| + t.boolean "approve" t.string "cover_image" t.datetime "created_at", precision: 6, null: false t.string "date" @@ -312,7 +313,9 @@ 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 From b35dc934d362e7ac973e924c568dee7d8ec4b74c Mon Sep 17 00:00:00 2001 From: diegoOG09 Date: Thu, 24 Feb 2022 18:28:32 -0600 Subject: [PATCH 5/6] Migrations modified - we put together some migration to chambas in only one by esthetic and good practice Co-authored-by: armanirmr Co-authored-by: YxMARCKxY Co-authored-by: rene3255 Co-authored-by: BrandonVG bvadillo0@ucol.mx --- db/migrate/20220204004138_add_column_position_to_chambas.rb | 5 ----- ..._chamba.rb => 20220216222509_columns_added_to_chambas.rb} | 3 ++- db/migrate/20220217230122_add_column_aprove_to_chambas.rb | 5 ----- db/schema.rb | 1 - 4 files changed, 2 insertions(+), 12 deletions(-) delete mode 100644 db/migrate/20220204004138_add_column_position_to_chambas.rb rename db/migrate/{20220216222509_req_and_stall_added_to_chamba.rb => 20220216222509_columns_added_to_chambas.rb} (52%) delete mode 100644 db/migrate/20220217230122_add_column_aprove_to_chambas.rb diff --git a/db/migrate/20220204004138_add_column_position_to_chambas.rb b/db/migrate/20220204004138_add_column_position_to_chambas.rb deleted file mode 100644 index 7e4dfca05a829..0000000000000 --- a/db/migrate/20220204004138_add_column_position_to_chambas.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddColumnPositionToChambas < ActiveRecord::Migration[6.1] - def change - add_column :chambas, :position, :string - end -end diff --git a/db/migrate/20220216222509_req_and_stall_added_to_chamba.rb b/db/migrate/20220216222509_columns_added_to_chambas.rb similarity index 52% rename from db/migrate/20220216222509_req_and_stall_added_to_chamba.rb rename to db/migrate/20220216222509_columns_added_to_chambas.rb index 9bbe09ce83bec..c90269f2dc78e 100644 --- a/db/migrate/20220216222509_req_and_stall_added_to_chamba.rb +++ b/db/migrate/20220216222509_columns_added_to_chambas.rb @@ -1,5 +1,6 @@ -class ReqAndStallAddedToChamba < ActiveRecord::Migration[6.1] +class ColumnsAddedToChamba < ActiveRecord::Migration[6.1] def change + add_column :chambas, :approve, :string add_column :chambas, :requirements, :string add_column :chambas, :stall, :string end diff --git a/db/migrate/20220217230122_add_column_aprove_to_chambas.rb b/db/migrate/20220217230122_add_column_aprove_to_chambas.rb deleted file mode 100644 index 210c327918296..0000000000000 --- a/db/migrate/20220217230122_add_column_aprove_to_chambas.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddColumnAproveToChambas < ActiveRecord::Migration[6.1] - def change - add_column :chambas, :approve, :boolean - end -end diff --git a/db/schema.rb b/db/schema.rb index 92239301af7cd..4db1dd2d8f5b1 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -304,7 +304,6 @@ create_table "chambas", force: :cascade do |t| t.boolean "approve" - t.string "cover_image" t.datetime "created_at", precision: 6, null: false t.string "date" t.string "description" From bff3b3942f84edf4580676af60b293de31e11d1c Mon Sep 17 00:00:00 2001 From: diegoOG09 Date: Thu, 24 Feb 2022 18:31:49 -0600 Subject: [PATCH 6/6] CRUD views and admin Chambas created -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 armanirmr@gmail.com Co-authored-by: YxMARCKxY mramirez73@ucol.mx Co-authored-by: rene3255 ranchoeltecal@gmail.com Co-authored-by: BrandonVG bvadillo0@ucol.mx --- app/assets/stylesheets/components/cards.scss | 19 ++-- app/controllers/admin/chambas_controller.rb | 82 ++++++++++------ app/controllers/chambas_controller.rb | 22 ++++- app/javascript/admin/adminModal.js | 2 - .../controllers/admin_chambas_controller.js | 96 +++++++++++++++++++ app/models/chamba.rb | 2 +- .../chambas/_individual_chambas.html.erb | 38 +++++--- app/views/admin/chambas/index.html.erb | 83 +++++++--------- app/views/chambas/chamba.html.erb | 4 +- config/routes.rb | 11 ++- 10 files changed, 248 insertions(+), 111 deletions(-) create mode 100644 app/javascript/admin/controllers/admin_chambas_controller.js diff --git a/app/assets/stylesheets/components/cards.scss b/app/assets/stylesheets/components/cards.scss index 5e0f9bd72e48a..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); @@ -71,6 +71,10 @@ } } +#info_icon_exp_date { + padding-left: .5rem; +} + .crud-card-main { background-color: #cdd1e4; border: none; @@ -83,9 +87,12 @@ } /* Firefox */ - input[type='number'] { + input[type="number"] { -moz-appearance: textfield; } + .requirements-label { + color: #686868; + } } #add-btn { @@ -103,8 +110,7 @@ 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; + 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 { @@ -147,15 +153,14 @@ .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; + 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: ''; + content: ""; display: table; clear: both; } diff --git a/app/controllers/admin/chambas_controller.rb b/app/controllers/admin/chambas_controller.rb index d085fc8bf3803..8b5ee366dc0ee 100644 --- a/app/controllers/admin/chambas_controller.rb +++ b/app/controllers/admin/chambas_controller.rb @@ -2,45 +2,36 @@ module Admin class ChambasController < Admin::ApplicationController layout "admin" - @chamba_record_save = nil - def index - @chambas = Chamba.all - @chamba_save = @chamba_record_save - # variable para crear una nueva chamba + delete_exp_date() @chamba = Chamba.new + @chambas = Chamba.all end - # //////para crear nueva chamaba - - def create - @chamba = Chamba.new(chamba_params) - if @chamba.save - @chamba_record_save = true - else - @chamba_record_save = false - render admin_path + 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 create - # @employee = Employee.new(employee_params) - # if @employee.save - # redirect_to pages_employees_path - # else - # render :new - # end - # end - - # //////para editar una chamaba - def edit - @chamba = Chamba.find(params[:id_chamba]) + 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 - # //////para borrar una chamaba 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 @@ -48,10 +39,39 @@ def delete Area.find(id_to_delete).destroy end - private + 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 - def chamba_params - params.require(:chamba).permit(:title, :exp_date, :location, :description, :organization, :salary) + 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 index 2305e76d003f0..dafe084fda107 100644 --- a/app/controllers/chambas_controller.rb +++ b/app/controllers/chambas_controller.rb @@ -1,16 +1,32 @@ class ChambasController < ApplicationController - # vista index (chambas) + def index - @chambas_vec = req_chambas + 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 = RequerimientosChamba.where(chamba_id: params[:chamba_id]) + @requerimientos = '' + variable = Chamba.find(params[:chamba_id]).requirements + if variable.nil? == false + @requerimientos = variable.split(",") + end end def req_chambas diff --git a/app/javascript/admin/adminModal.js b/app/javascript/admin/adminModal.js index cd6679007d573..7a0bb061351d5 100644 --- a/app/javascript/admin/adminModal.js +++ b/app/javascript/admin/adminModal.js @@ -17,8 +17,6 @@ * @param {string} modalProps.rightCustomDataAttr A custom data attribute for the right button. */ -//AQUI PONES EL SCRIPT DEL CRUD: - 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/chamba.rb b/app/models/chamba.rb index 0c7258fc12d63..644617938eac6 100644 --- a/app/models/chamba.rb +++ b/app/models/chamba.rb @@ -1,3 +1,3 @@ class Chamba < ApplicationRecord - has_many :requerimientos_chamba, dependent: :nil + has_many :requerimientos_chamba, dependent: :destroy end diff --git a/app/views/admin/chambas/_individual_chambas.html.erb b/app/views/admin/chambas/_individual_chambas.html.erb index e2be7d8717ca0..fb79ccd9e37e8 100644 --- a/app/views/admin/chambas/_individual_chambas.html.erb +++ b/app/views/admin/chambas/_individual_chambas.html.erb @@ -10,29 +10,37 @@ <%= chamba.title %> - +
- %>/edit" target="_blank" rel="noopener">Edit - - Manage User + Edit
<%= image_tag "chamba-icon.png", class: "chamba-image mt-5 mb-5" %>
- <%= form_with do |f| %> -
-
- - -
-
+ <%= form_with url:"edit_chambas_list" do |f| %>
-
- - <%= f.datetime_select :published_at, required: true, include_blank: true, include_seconds: true, class: "form-control" %> UTC + ℹ️ +
+ + + +
+ + <% if chamba.approve == true %> + + + + + <%else%> + + + + + <%end%> +
- +
<% end %> diff --git a/app/views/admin/chambas/index.html.erb b/app/views/admin/chambas/index.html.erb index a005a388e8972..16c0cc74d36f7 100644 --- a/app/views/admin/chambas/index.html.erb +++ b/app/views/admin/chambas/index.html.erb @@ -1,56 +1,45 @@ -<% if @chamba_save == true %> - - <% elsif @chamba_save == false %> - -<% end %> -
-
-
-
- -   -   -   - - -
- -
- Organización / empresa - -
- -
- Puesto - -   -   -   - $ - -
+
+ <%= 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%> +
-
- Descripción - -
-
- +
+ + + <%= 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%> +
-
- - Agregar - Ver requerimientos -
+
+ + <%= 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%>
diff --git a/app/views/chambas/chamba.html.erb b/app/views/chambas/chamba.html.erb index 82f7a84d569f2..25bd8a6ff5acc 100644 --- a/app/views/chambas/chamba.html.erb +++ b/app/views/chambas/chamba.html.erb @@ -31,13 +31,13 @@

Responsabilidades

-

<%= @chamba.description %>

+

<%= @chamba.description %>

Requerimientos

    <% @requerimientos.length.times do |reg_req| %> -
  • <%= @requerimientos[reg_req].description %>
  • +
  • <%= @requerimientos[reg_req] %>
  • <% end %>
diff --git a/config/routes.rb b/config/routes.rb index cc8da3eb394f7..c35e521f1451d 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -252,7 +252,7 @@ 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" @@ -363,8 +363,13 @@ # Chambas admin get "/:username/:slug/chambas", to: "admin/chambas#index" - # new chamba creation - post "/chambas", to: "admin/chambas#create" + # 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"