Kalendarz Dotacji
--
-
-
Tutaj jakieś informacje co znajduje się na tej stronie czego można się spodziewać itd, może jakieś zdjęcie? coś do przemyślenia
--
-
-
diff --git a/app/assets/images/kd_logo.png b/app/assets/images/kd_logo.png new file mode 100644 index 0000000..101828d Binary files /dev/null and b/app/assets/images/kd_logo.png differ diff --git a/app/assets/images/kd_mini_logo.png b/app/assets/images/kd_mini_logo.png new file mode 100644 index 0000000..9e88cef Binary files /dev/null and b/app/assets/images/kd_mini_logo.png differ diff --git a/app/assets/images/main_kalendarz.png b/app/assets/images/main_kalendarz.png new file mode 100644 index 0000000..b4c6d33 Binary files /dev/null and b/app/assets/images/main_kalendarz.png differ diff --git a/app/assets/images/main_kalendarz1.png b/app/assets/images/main_kalendarz1.png new file mode 100644 index 0000000..bbe75cf Binary files /dev/null and b/app/assets/images/main_kalendarz1.png differ diff --git a/app/assets/stylesheets/main.css b/app/assets/stylesheets/main.css new file mode 100644 index 0000000..2bd22ef --- /dev/null +++ b/app/assets/stylesheets/main.css @@ -0,0 +1,33 @@ +.mainer-header { + position: relative; + min-height: 800px; + background: url("/assets/main_kalendarz1.png") no-repeat center center fixed; + background-size: cover; +} + +.mainer-header .overlay { + position: absolute; + left: 0; + top: 0; + width: 100%; + height: 100%; + background: rgba(33, 37, 41, 0.85); + color: #fff; + display: -webkit-box; + display: -ms-flexbox; + display: -webkit-flex; + display: flex; + -webkit-box-align: center; + -webkit-align-items: center; + -ms-flex-align: center; + align-items: center; + -webkit-box-orient: vertical; + -webkit-box-direction: normal; + -webkit-flex-direction: column; + -ms-flex-direction: column; + flex-direction: column; + -webkit-box-pack: center; + -webkit-justify-content: center; + -ms-flex-pack: center; + justify-content: center; +} diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index e4b1856..73b20c0 100644 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -20,7 +20,16 @@ class HomeController < ApplicationController .point_desc.end_date_asc.page(params[:page]) end - def contact; end + def contact + @email_message = EmailMessage.new + end + + def register_contact + @email_message = EmailMessage.new(email_messages_params) + return unless @email_message.save + + SendEmailJob.perform_later(@email_message.id) + end def show @dotation = Dotation.friendly.find(params[:id]) @@ -74,4 +83,9 @@ class HomeController < ApplicationController ammount_price: params[:ammount_price] } end + + # Only allow a list of trusted parameters through. + def email_messages_params + params.require(:email_message).permit(:subject, :email, :message) + end end diff --git a/app/controllers/partners_controller.rb b/app/controllers/partners_controller.rb index 851cc7b..b5875c8 100644 --- a/app/controllers/partners_controller.rb +++ b/app/controllers/partners_controller.rb @@ -71,6 +71,6 @@ class PartnersController < ApplicationController # Only allow a list of trusted parameters through. def partner_params - params.require(:partner).permit(:name, :description, :logo) + params.require(:partner).permit(:name, :description, :logo, :link_url) end end diff --git a/app/jobs/send_email_job.rb b/app/jobs/send_email_job.rb new file mode 100644 index 0000000..76adf28 --- /dev/null +++ b/app/jobs/send_email_job.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +class SendEmailJob < ApplicationJob + queue_as :default + + def perform(email_message_id) + email_message = EmailMessage.where(id: email_message_id).first + return if email_message.blank? + + NotifyEmailMailer.with(email: email_message_id).contact_page.deliver + end +end diff --git a/app/mailers/notify_email_mailer.rb b/app/mailers/notify_email_mailer.rb new file mode 100644 index 0000000..cb8343b --- /dev/null +++ b/app/mailers/notify_email_mailer.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +# Mailer for dotations +class NotifyEmailMailer < ApplicationMailer + default from: 'kalendarzdotacji@gmail.com' + + def contact_page + @email_message = EmailMessage.where(id: params[:email]).first + # @emailfilter = FilterForEmail.find(params[:emailfilter]) + mail(to: APP_CONFIG['notify_email'], subject: 'Nowa wiadomość ze strony kalendarzdotacji.pl') + end + + def contact_dotation + @email_filter = FilterForEmail.where(id: params[:email_filter]).first + @dotation = Dotation.where(id: params[:dotation_id]).first + @email_params = { + i: @email_filter.email, + k: @email_filter.unique_name + } + mail(to: @email_filter.email, subject: 'Pojawiła się nowa dotacja') + end +end diff --git a/app/models/email_message.rb b/app/models/email_message.rb new file mode 100644 index 0000000..93cf8ff --- /dev/null +++ b/app/models/email_message.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +# Email messages +class EmailMessage < ApplicationRecord + # == Constants ============================================================ + + # == Attributes =========================================================== + + # == Extensions =========================================================== + + # == Relationships ======================================================== + + # == Validations ========================================================== + validates :subject, presence: true + validates :email, presence: true + validates :message, presence: true + # == Scopes =============================================================== + + # == Callbacks ============================================================ + + # == Class Methods ======================================================== + + # == Instance Methods ===================================================== +end diff --git a/app/views/home/_contact_form.html.erb b/app/views/home/_contact_form.html.erb new file mode 100644 index 0000000..fe86b1d --- /dev/null +++ b/app/views/home/_contact_form.html.erb @@ -0,0 +1,22 @@ +
+
+
+
+
+
+
+ ul. Mikołaja Gomółki 2
+ 80-279 Gdańsk
+
+ tel. 58 380 15 96
+ tel. kom. 792 002 220
+ info@grantera.pl
+
+ KRS 0000529767,
+ NIP 585-14-69-751
+
Tutaj jakieś informacje co znajduje się na tej stronie czego można się spodziewać itd, może jakieś zdjęcie? coś do przemyślenia
-