diff --git a/README.md b/README.md index 95beff5..4bf4c65 100644 --- a/README.md +++ b/README.md @@ -96,6 +96,10 @@ Para o projecto funcionar a 100%, precisa de algumas dependências externas: Todas estas coisas são configuráveis via variáveis de ambiente. A lista de variáveis está disponível no ficheiro `env.example`. +**NOTA**: o projecto ainda não está pronto para ser personalizado à imagem de +outras associações, estando o contexto da ANSOL codificado em vários pontos da +aplicação. Alguns destes detalhes podem ser definidos em `app/lib/config.rb`. + ## Pôr isto a dar @@ -113,6 +117,6 @@ Quando se acede à plataforma pela primeira vez, é-nos pedido um endereço de email para criar a primeira conta de administração. Este endereço precisa de conseguir receber mensagens para o processo de recuperação de senha funcionar. -Depois deste processo terminado, é possível gerir até 5 contas de +Depois deste processo terminado, é possível gerir até 6 contas de administração. Atenção que qualquer uma delas consegue apagar as restantes (e até a si própria). diff --git a/app/assets/images/logo.svg b/app/assets/images/logo.svg new file mode 100644 index 0000000..8de1c96 --- /dev/null +++ b/app/assets/images/logo.svg @@ -0,0 +1,38 @@ + + diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index 3305272..a5418a4 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -1,10 +1,38 @@ /* Application styles */ body { - max-width: 1000px; - margin: 0 auto; + margin: 0px; } +main, nav, footer { + margin: 0 auto; + max-width: 1000px; +} + +main { + padding: 10px; +} + +.banner { + width: 100%; + height: 30px; + padding: 15px; + background-image: url(logo.svg); + background-size: auto 30px; + background-repeat: no-repeat; + background-position: center; + background-color: #041952; +} + +footer { + border-top: 1px solid #aaa; + margin-top: 20px; + padding: 20px 10px; +} + +footer div + div { margin-top: 10px; } + + table { border: 1px solid black; border-collapse: collapse; diff --git a/app/controllers/boards_controller.rb b/app/controllers/boards_controller.rb index 564557d..9b5caf2 100644 --- a/app/controllers/boards_controller.rb +++ b/app/controllers/boards_controller.rb @@ -3,7 +3,7 @@ class BoardsController < ApplicationController def edit @users = User.where(active: true) - @users += Array.new(5 - @users.size) { User.new } + @users += Array.new(6 - @users.size) { User.new } end def update diff --git a/app/controllers/payments_controller.rb b/app/controllers/payments_controller.rb new file mode 100644 index 0000000..d55aac1 --- /dev/null +++ b/app/controllers/payments_controller.rb @@ -0,0 +1,5 @@ +class PaymentsController < ApplicationController + def show + @payment = Payment.find(params[:id]) + end +end diff --git a/app/lib/config.rb b/app/lib/config.rb new file mode 100644 index 0000000..975f53e --- /dev/null +++ b/app/lib/config.rb @@ -0,0 +1,34 @@ +module Config + def self.organization_full_name + "ANSOL - Associação Nacional para o Software Livre" + end + + def self.organization_website + "https://ansol.org" + end + + def self.regular_payment_value + 30 + end + + def self.reduced_payment_value + 6 + end + + def self.ifthenpay_payment_title + "Quotas ANSOL" + end + + def self.payment_iban + "PT50 0035 2178 00027478430 14" + end + + def self.payment_proof_email + "direccao@ansol.org" + end + + def self.reduced_payment_description + "Caso queiras usufruir da quota reduzida de 6.00€ para estudantes, pessoas + desempregadas ou reformadas, envia-nos um comprovativo desse estatuto." + end +end diff --git a/app/mailers/notification_mailer.rb b/app/mailers/notification_mailer.rb index b9f355b..64ba322 100644 --- a/app/mailers/notification_mailer.rb +++ b/app/mailers/notification_mailer.rb @@ -33,6 +33,6 @@ class NotificationMailer < ApplicationMailer private def set_notification @notification = params[:notification] - @link = @notification.member.regular_ifthenpay_link + @payment = @notification.member.create_payment end end diff --git a/app/models/member.rb b/app/models/member.rb index 3488915..c6e7e7c 100644 --- a/app/models/member.rb +++ b/app/models/member.rb @@ -2,16 +2,25 @@ class Member < ApplicationRecord default_scope { where(excluded: false) } has_many :contributions has_many :notifications + has_many :payments has_paper_trail def self.ransackable_attributes(auth_object = nil) %w[display_name legal_name email identification_number] end + def create_payment + payments.create(status: "pending") + end + def cancelled_on expires_on + 90.days end + def obtains_full_rights_on + joined_on + 6.months + end + def reset_status! update(status: expected_status) end @@ -36,7 +45,7 @@ class Member < ApplicationRecord def expected_status if joined_on.nil? :pending - elsif (joined_on + 6.months).future? + elsif obtains_full_rights_on.future? :passive elsif expires_on.future? :active @@ -82,14 +91,14 @@ class Member < ApplicationRecord def generate_missing_ifthenpay_links! self.regular_ifthenpay_link = IfThenPay.generate_gateway_link( id: number, - amount: "30.00", - description: "Quotas ANSOL", + amount: "%.2f" % Config.regular_payment_value, + description: Config.ifthenpay_payment_title, ) unless self.regular_ifthenpay_link.present? self.reduced_ifthenpay_link = IfThenPay.generate_gateway_link( id: number, - amount: "6.00", - description: "Quotas ANSOL", + amount: "%.2f" % Config.reduced_payment_value, + description: Config.ifthenpay_payment_title, ) unless self.reduced_ifthenpay_link.present? save! diff --git a/app/models/payment.rb b/app/models/payment.rb new file mode 100644 index 0000000..6514060 --- /dev/null +++ b/app/models/payment.rb @@ -0,0 +1,3 @@ +class Payment < ApplicationRecord + belongs_to :member +end diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 26a489e..6931a1f 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -11,6 +11,7 @@
+ <% if signed_in? %> <% end %> - <%= yield %> +