source
stringclasses
1 value
repo
stringlengths
5
63
repo_url
stringlengths
24
82
path
stringlengths
5
167
language
stringclasses
1 value
license
stringclasses
5 values
stars
int64
10
51.4k
ref
stringclasses
23 values
size_bytes
int64
200
258k
text
stringlengths
137
258k
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/forms/providers/means/state_benefit_form.rb
Ruby
mit
19
main
1,124
module Providers module Means class StateBenefitForm < BaseForm form_for RegularTransaction attr_accessor :description, :amount, :frequency, :transaction_type_id attr_reader :owner_id, :owner_type validates :description, presen...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/forms/providers/means/receives_state_benefits_form.rb
Ruby
mit
19
main
334
module Providers module Means class ReceivesStateBenefitsForm < BaseForm form_for Applicant attr_accessor :receives_state_benefits validates :receives_state_benefits, presence: true, unless: :draft? def receives_state_benefits? receives_state_benefits.eql?("true") end ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/forms/providers/means/capital_disregards/add_details_form.rb
Ruby
mit
19
main
3,067
module Providers module Means module CapitalDisregards class AddDetailsForm < BaseForm form_for CapitalDisregard attr_accessor :payment_reason, :amount, :account_name, :date_received_1i, :date_received_2...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/forms/providers/means/capital_disregards/mandatory_form.rb
Ruby
mit
19
main
4,036
module Providers module Means module CapitalDisregards class MandatoryForm include ActiveModel::Model DISREGARD_TYPES = %i[ backdated_benefits backdated_community_care budgeting_advances compensation_miscarriage_of_justice government_cost_of...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/forms/providers/means/capital_disregards/discretionary_form.rb
Ruby
mit
19
main
3,955
module Providers module Means module CapitalDisregards class DiscretionaryForm include ActiveModel::Model DISREGARD_TYPES = %i[ backdated_benefits compensation_for_personal_harm criminal_injuries_compensation grenfell_tower_fire_victims lond...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/forms/providers/dwp/fallback_form.rb
Ruby
mit
19
main
354
module Providers module DWP class FallbackForm < OverridesForm form_for Partner private def error_scope if model.is_a?(Partner) && model.persisted? "providers.dwp.fallback.show.error.with_partner" else "providers.dwp.fallback.show.error.without_partner" ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/forms/providers/dwp/partner_overrides_form.rb
Ruby
mit
19
main
217
module Providers module DWP class PartnerOverridesForm < OverridesForm form_for Partner private def error_scope "providers.dwp.partner_overrides.show.error" end end end end
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/forms/providers/dwp/overrides_form.rb
Ruby
mit
19
main
993
module Providers module DWP class OverridesForm < BaseForm form_for Partner VALID_VALUES = %w[ benefit_received joint_benefit_with_partner no_benefit_received ].freeze attr_accessor :confirm_dwp_result validate :response_present? def correct_dwp_resu...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/forms/providers/proceeding_merits_task/vary_order_form.rb
Ruby
mit
19
main
237
module Providers module ProceedingMeritsTask class VaryOrderForm < BaseForm form_for ::ProceedingMeritsTask::VaryOrder attr_accessor :details, :proceeding_id validates :details, presence: true end end end
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/forms/providers/proceeding_merits_task/opponents_application_form.rb
Ruby
mit
19
main
815
module Providers module ProceedingMeritsTask class OpponentsApplicationForm < BaseForm form_for ::ProceedingMeritsTask::OpponentsApplication attr_accessor :has_opponents_application, :reason_for_applying, :proceeding_id validates :has_opponents_application, inclusion: { in: %w[true false] } ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/forms/providers/proceeding_merits_task/child_care_assessment_form.rb
Ruby
mit
19
main
679
module Providers module ProceedingMeritsTask class ChildCareAssessmentForm < BaseForm form_for ::ProceedingMeritsTask::ChildCareAssessment attr_accessor :proceeding_id, :assessed validates :assessed, inclusion: %w[true false], unless: :draft? set_callback :save, :before, :sync_result_de...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/forms/providers/proceeding_merits_task/chances_of_success_form.rb
Ruby
mit
19
main
854
module Providers module ProceedingMeritsTask class ChancesOfSuccessForm < BaseForm form_for ::ProceedingMeritsTask::ChancesOfSuccess attr_accessor :proceeding_id, :success_likely, :success_prospect_details validates :success_likely, inclusion: %w[true false], unless: :draft? validates :s...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/forms/providers/proceeding_merits_task/linked_children_form.rb
Ruby
mit
19
main
1,718
module Providers module ProceedingMeritsTask class LinkedChildrenForm < BaseForm form_for ::ProceedingMeritsTask::ProceedingLinkedChild attr_accessor :linked_children validate :one_selected_child?, unless: :draft? def value_list @value_list ||= legal_aid_application.involved_chi...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/forms/providers/proceeding_merits_task/child_care_assessment_result_form.rb
Ruby
mit
19
main
672
module Providers module ProceedingMeritsTask class ChildCareAssessmentResultForm < BaseForm form_for ::ProceedingMeritsTask::ChildCareAssessment attr_accessor :proceeding_id, :result, :details validates :result, inclusion: %w[true false], unless: :draft? validates :details, presence: tru...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/forms/providers/proceeding_merits_task/attempts_to_settle_form.rb
Ruby
mit
19
main
488
module Providers module ProceedingMeritsTask class AttemptsToSettleForm < BaseForm form_for ::ProceedingMeritsTask::AttemptsToSettle attr_accessor :attempts_made, :proceeding_id validate :attempts_made_present? def attempts_made_present? errors.add :attempts_made, error_message ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/forms/providers/proceeding_merits_task/specific_issue_form.rb
Ruby
mit
19
main
245
module Providers module ProceedingMeritsTask class SpecificIssueForm < BaseForm form_for ::ProceedingMeritsTask::SpecificIssue attr_accessor :details, :proceeding_id validates :details, presence: true end end end
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/forms/providers/proceeding_merits_task/prohibited_steps_form.rb
Ruby
mit
19
main
632
module Providers module ProceedingMeritsTask class ProhibitedStepsForm < BaseForm form_for ::ProceedingMeritsTask::ProhibitedSteps attr_accessor :uk_removal, :details, :proceeding_id before_validation :clear_details, if: :uk_removal? validates :uk_removal, inclusion: { in: %w[true false...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/forms/concerns/date_of_birth_handling.rb
Ruby
mit
19
main
1,034
module DateOfBirthHandling extend ActiveSupport::Concern included do def initialize(*args) super set_instance_variables_for_attributes_if_not_set_but_in_model( attrs: dob_date_fields.fields, model_attributes: dob_date_fields.model_attributes, ) end def date_of_birth ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/forms/concerns/national_insurance_handling.rb
Ruby
mit
19
main
1,339
module NationalInsuranceHandling extend ActiveSupport::Concern included do private def has_national_insurance_number? has_national_insurance_number.in?(["true", true]) end def normalise_national_insurance_number attributes[:national_insurance_number] = nil unless has_national_insurance_...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/forms/concerns/date_field_builder.rb
Ruby
mit
19
main
2,365
class DateFieldBuilder YearError = Class.new(StandardError) DATE_PARTS = %i[year month day].freeze FORM_PARTS = %i[1i 2i 3i].freeze attr_reader :form, :model, :method, :prefix, :label # :method is the target method on the model # :prefix is used to construct date part fields def initialize(form:, model...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/forms/home_address/status_form.rb
Ruby
mit
19
main
544
module HomeAddress class StatusForm < BaseForm form_for Applicant attr_accessor :no_fixed_residence validates :no_fixed_residence, inclusion: ["true", "false", true, false], unless: :draft? def save model.home_address = nil if no_fixed_residence? super end alias_method :save!, :...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/forms/legal_aid_applications/restrictions_form.rb
Ruby
mit
19
main
655
module LegalAidApplications class RestrictionsForm < BaseForm form_for LegalAidApplication attr_accessor :has_restrictions, :restrictions_details before_validation :clear_restrictions_details validates :has_restrictions, presence_partner_optional: { partner_labels: :has_partner_with_no_contrary_int...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/forms/legal_aid_applications/emergency_cost_override_form.rb
Ruby
mit
19
main
1,634
module LegalAidApplications class EmergencyCostOverrideForm < BaseForm form_for LegalAidApplication attr_accessor :emergency_cost_override, :emergency_cost_requested, :emergency_cost_reasons, :substantive_cost_override, :substantive_cost_requested, :substantive_cost_reasons validates :...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/forms/legal_aid_applications/has_evidence_of_benefit_form.rb
Ruby
mit
19
main
731
module LegalAidApplications class HasEvidenceOfBenefitForm < BaseForm form_for DWPOverride attr_accessor :has_evidence_of_benefit validate :evidence_present private def passporting_benefit_error ".shared.forms.received_benefit_confirmation.form.providers.received_benefit_confirmations.#{mo...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/forms/legal_aid_applications/has_other_opponents_form.rb
Ruby
mit
19
main
296
module LegalAidApplications class HasOtherOpponentsForm < BaseForm form_for LegalAidApplication attr_accessor :has_other_opponents validates :has_other_opponents, presence: true, unless: :draft? def has_other_opponents? @has_other_opponents == "true" end end end
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/forms/legal_aid_applications/full_employment_details_form.rb
Ruby
mit
19
main
470
module LegalAidApplications class FullEmploymentDetailsForm < BaseForm form_for LegalAidApplication attr_accessor :full_employment_details validate :full_employment_details_presence private def full_employment_details_presence return if draft? errors.add(:full_employment_details, I1...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/forms/legal_aid_applications/confirm_separate_representation_form.rb
Ruby
mit
19
main
259
module LegalAidApplications class ConfirmSeparateRepresentationForm < BaseForm form_for LegalAidApplication attr_accessor :separate_representation_required validates :separate_representation_required, presence: true, unless: :draft? end end
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/forms/legal_aid_applications/has_dependants_form.rb
Ruby
mit
19
main
287
module LegalAidApplications class HasDependantsForm < BaseForm form_for LegalAidApplication attr_accessor :has_dependants, :draft validates :has_dependants, presence_partner_optional: { partner_labels: :has_partner_with_no_contrary_interest? }, unless: :draft? end end
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/forms/legal_aid_applications/own_vehicle_form.rb
Ruby
mit
19
main
394
module LegalAidApplications class OwnVehicleForm < BaseForm form_for LegalAidApplication attr_accessor :own_vehicle validate :own_vehicle_presence def own_vehicle_presence return if draft? || own_vehicle.present? errors.add(:own_vehicle, I18n.t("activemodel.errors.models.legal_aid_appl...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/forms/legal_aid_applications/property_details_form.rb
Ruby
mit
19
main
1,458
module LegalAidApplications class PropertyDetailsForm < BaseForm form_for LegalAidApplication ATTRIBUTES = %i[ property_value outstanding_mortgage_amount shared_ownership percentage_home ].freeze attr_accessor(*ATTRIBUTES) validates :property_value, presence_partner_opti...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/forms/legal_aid_applications/confirm_client_declaration_form.rb
Ruby
mit
19
main
478
module LegalAidApplications class ConfirmClientDeclarationForm < BaseForm include ActiveModel::Attributes form_for LegalAidApplication attribute :client_declaration_confirmed, :boolean validates :client_declaration_confirmed, acceptance: true, allow_nil: false, unless: :draft? de...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/forms/legal_aid_applications/own_home_form.rb
Ruby
mit
19
main
697
module LegalAidApplications class OwnHomeForm < BaseForm form_for LegalAidApplication attr_accessor :own_home validates :own_home, presence_partner_optional: { partner_labels: :has_partner_with_no_contrary_interest? }, unless: :draft? def save! model.update!(attributes_to_reset) super ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/forms/legal_aid_applications/dependant_form.rb
Ruby
mit
19
main
4,367
module LegalAidApplications class DependantForm < BaseForm form_for Dependant before_validation :clear_value_fields BASE_ATTRIBUTES = %i[name relationship in_full_time_education has_income monthly_income ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/forms/legal_aid_applications/open_banking_consent_form.rb
Ruby
mit
19
main
475
module LegalAidApplications class OpenBankingConsentForm < BaseForm form_for LegalAidApplication attr_accessor :provider_received_citizen_consent validate :consent_presence private def consent_presence return if draft? || provider_received_citizen_consent.present? errors.add(:provid...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/forms/legal_aid_applications/has_other_proceedings_form.rb
Ruby
mit
19
main
678
module LegalAidApplications class HasOtherProceedingsForm < BaseForm form_for LegalAidApplication attr_accessor :has_other_proceeding validates :has_other_proceeding, presence: true, unless: :draft? delegate :proceedings, to: :model def remaining_proceedings @remaining_proceedings ||= Le...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/forms/legal_aid_applications/substantive_application_form.rb
Ruby
mit
19
main
295
module LegalAidApplications class SubstantiveApplicationForm < BaseForm form_for LegalAidApplication attr_accessor :substantive_application validates :substantive_application, presence: { unless: :draft? } delegate :substantive_application_deadline_on, to: :model end end
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/forms/addresses/choice_form.rb
Ruby
mit
19
main
1,078
module Addresses class ChoiceForm < BaseForm form_for Applicant attr_accessor :correspondence_address_choice validates :correspondence_address_choice, presence: true, unless: :draft? validates :correspondence_address_choice, inclusion: { in: %w[home residence office] }, allow_blank: true, unless: :d...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/forms/addresses/non_uk_home_address_form.rb
Ruby
mit
19
main
881
module Addresses class NonUkHomeAddressForm < BaseForm form_for Address attr_accessor :country_name, :address_line_one, :address_line_two, :city, :county, :postcode validates :address_line_one, presence: true, unless: :draft? validate :validate_country_name, unless: :draft? def countries ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/forms/addresses/care_of_form.rb
Ruby
mit
19
main
901
module Addresses class CareOfForm < BaseForm form_for Address attr_accessor :care_of, :care_of_first_name, :care_of_last_name, :care_of_organisation_name validates :care_of, presence: true, unless: :draft? validates :care_of_first_name, :care_of_last_name, presence: true, if: :person_name_required? ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/forms/addresses/address_form.rb
Ruby
mit
19
main
860
module Addresses class AddressForm < BaseForm form_for Address attr_accessor :address_line_one, :address_line_two, :address_line_three, :city, :county, :postcode, :lookup_postcode, :lookup_error, :location before_validation :normalise_postcode validates :address_line_one, :city, :postcode, ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/forms/addresses/address_selection_form.rb
Ruby
mit
19
main
222
module Addresses class AddressSelectionForm < BaseAddressSelectionForm form_for Address attr_accessor :addresses, :postcode, :address_line_one, :address_line_two, :city, :county, :lookup_id, :location end end
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/forms/vehicles/details_form.rb
Ruby
mit
19
main
2,050
module Vehicles class DetailsForm < BaseForm RadioOption = Struct.new(:value, :label) SINGLE_VALUE_ATTRIBUTES = %i[ client partner client_and_partner ].freeze form_for Vehicle attr_accessor :owner, :estimated_value, :more_than_three_years_ol...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/workers/import_bank_data_worker.rb
Ruby
mit
19
main
525
class ImportBankDataWorker include Sidekiq::Worker include Sidekiq::Status::Worker sidekiq_options retry: false attr_reader :legal_aid_application_id def perform(legal_aid_application_id) @legal_aid_application_id = legal_aid_application_id command = TrueLayer::BankDataImportService.call( leg...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/workers/true_layer_banks_update_worker.rb
Ruby
mit
19
main
692
class TrueLayerBanksUpdateWorker DataRetrievalError = Class.new(StandardError) include Sidekiq::Worker include Sidekiq::Status::Worker UPDATE_INTERVAL = 1.hour def perform return true if last_updated && last_updated.updated_at > UPDATE_INTERVAL.ago return last_updated.touch if last_updated && stored...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/workers/reports_creator_worker.rb
Ruby
mit
19
main
315
class ReportsCreatorWorker include Sidekiq::Worker include Sidekiq::Status::Worker sidekiq_options queue: :report_creator def perform(legal_aid_application_id) legal_aid_application = LegalAidApplication.find(legal_aid_application_id) Reports::ReportsCreator.call(legal_aid_application) end end
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/workers/provider_contract_details_worker.rb
Ruby
mit
19
main
418
class ProviderContractDetailsWorker # NOTE: This is intended as a temporary class while we switch from CCMS Provider Details API # to the new Provider Details API. # Once that change over is complete, the aim is that this can be removed. include Sidekiq::Worker include Sidekiq::Status::Worker sidekiq_optio...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/workers/pdf_converter_worker.rb
Ruby
mit
19
main
743
class PDFConverterWorker include Sidekiq::Worker include Sidekiq::Status::Worker class SentryIgnoreThisSidekiqFailError < StandardError; end attr_accessor :retry_count MAX_RETRIES = 5 sidekiq_options retry: MAX_RETRIES sidekiq_retries_exhausted do |msg, _ex| Sentry.capture_message Sidekiq::Exhauste...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/workers/bank_holiday_update_worker.rb
Ruby
mit
19
main
991
class BankHolidayUpdateWorker DataRetrievalError = Class.new(StandardError) include Sidekiq::Worker include Sidekiq::Status::Worker def perform sync_cached_data! return true if last_updated.updated_at > 1.month.ago return last_updated.touch if stored_data_current? latest_data.save! end de...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/workers/ccms/restart_submission_worker.rb
Ruby
mit
19
main
226
module CCMS class RestartSubmissionWorker include Sidekiq::Worker include Sidekiq::Status::Worker def perform(application_id) LegalAidApplication.find(application_id).restart_submission! end end end
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/workers/ccms/submission_process_worker.rb
Ruby
mit
19
main
1,687
module CCMS class SubmissionStateUnchanged < StandardError; end class SentryIgnoreThisSidekiqFailError < StandardError; end class SubmissionProcessWorker include Sidekiq::Worker include Sidekiq::Status::Worker attr_accessor :retry_count, :submission MAX_RETRIES = 10 sidekiq_options retry: ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/workers/ccms/turn_on_submissions_worker.rb
Ruby
mit
19
main
986
module CCMS class TurnOnSubmissionsWorker include Sidekiq::Worker include Sidekiq::Status::Worker SUBMISSION_INTERVAL = 5 def perform # get applications where state is submission_paused applications = LegalAidApplication.joins(:state_machine).where(state_machine_proxies: { aasm_state: "s...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/workers/hmrc/submission_worker.rb
Ruby
mit
19
main
398
module HMRC class SubmissionWorker < BaseWorker def perform(hmrc_response_id) super do response = HMRC::Interface::SubmissionService.call(@hmrc_response) @hmrc_response.update!(url: response[:_links][0][:href], submission_id: response[:id]) HMRC::ResultWorker.perform_in(5.seconds, hm...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/workers/hmrc/result_worker.rb
Ruby
mit
19
main
401
module HMRC class ResultWorker < BaseWorker def perform(hmrc_response_id) super do response = HMRC::Interface::ResultService.call(@hmrc_response) raise SentryIgnoreThisSidekiqFailError, "HMRC Submission still in progress, fail silently and re-try" if %w[created processing].include?(response[...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/workers/hmrc/base_worker.rb
Ruby
mit
19
main
975
module HMRC class BaseWorker include Sidekiq::Worker include Sidekiq::Status::Worker attr_accessor :retry_count MAX_RETRIES = 10 sidekiq_options retry: MAX_RETRIES sidekiq_retries_exhausted do |msg, _ex| Sentry.capture_message Sidekiq::ExhaustedFailureMessage.call(msg) end def...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/policies/legal_aid_application_policy.rb
Ruby
mit
19
main
859
class LegalAidApplicationPolicy < ApplicationPolicy def index? authorized_to_process? end def new? authorized_to_process? end def show? authorized_to_process? end def list? authorized_to_process? end def update? authorized_to_process? end def destroy? authorized_to_pro...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/policies/application_policy.rb
Ruby
mit
19
main
310
class ApplicationPolicy attr_reader :provider, :record def initialize(authorization_context, record) @provider = authorization_context.provider @controller = authorization_context.controller @record = record raise Pundit::NotAuthorizedError, "must be logged in" unless @provider end end
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/helpers/proceeding_helper.rb
Ruby
mit
19
main
938
module ProceedingHelper def position_in_array(proceeding) application = proceeding.legal_aid_application proceedings = application.proceedings.in_order_of_addition if proceedings.many? position = proceedings.pluck(:id).find_index(proceeding.id) + 1 I18n.t("providers.proceeding_loop.multi_proce...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/helpers/means_report_helper.rb
Ruby
mit
19
main
2,153
module MeansReportHelper TransactionTypeItem = Struct.new(:name, :value_method, :scope, :suppress_border) def outgoings_detail_items [ TransactionTypeItem.new(:housing, :moe_housing, "outgoing", false), TransactionTypeItem.new(:childcare, :moe_childcare, "outgoing", false), TransactionTypeIte...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/helpers/task_list_helper.rb
Ruby
mit
19
main
2,373
module TaskListHelper def task_list_includes?(legal_aid_application, task_name) legal_aid_application.legal_framework_merits_task_list.serialized_data.match?(/name: :#{task_name}\n\s+dependencies: \*\d+/) end def _task_url(name, legal_aid_application, status) url = if name.eql?(:client_relationship_to_ch...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/helpers/client_helper.rb
Ruby
mit
19
main
303
module ClientHelper def means_tested_description(legal_aid_application) return t("generic.means_tested.no_sca") if legal_aid_application.special_children_act_proceedings? return t("generic.means_tested.no_under_18") if legal_aid_application.applicant.under_18? t("generic.yes") end end
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/helpers/transaction_period_helper.rb
Ruby
mit
19
main
374
module TransactionPeriodHelper def date_from(application) return unless application.transaction_period_start_on l(application.transaction_period_start_on.to_date, format: :long_date) end def date_to(application) return unless application.transaction_period_finish_on l(application.transaction_pe...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/helpers/home_path_helper.rb
Ruby
mit
19
main
550
module HomePathHelper def home_path return citizens_legal_aid_applications_path if citizen_journey? return your_applications_default_tab_path if provider_journey? && !before_applications_page? root_path end private def provider_journey? request.path.starts_with?("/providers") end def citiz...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/helpers/time_helper.rb
Ruby
mit
19
main
285
module TimeHelper def number_of_days_ago(number_of_days, format = "%d %_m %Y") Time.zone.now.ago(number_of_days.days).strftime(format) end def gds_human_time(time) if time.min.zero? time.strftime("%-l%P") else time.strftime("%-l:%M%P") end end end
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/helpers/gov_uk_form_helper.rb
Ruby
mit
19
main
1,391
module GovUkFormHelper RadioOption = Struct.new(:value, :label, :radio_hint) # Creates a template variable for yes/no options for radio buttons on a form for use with govuk_collection_radio_buttons method. # # include hash for radio button hints if required, e.g. # # yes_no_options ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/helpers/capital_disregard_helper.rb
Ruby
mit
19
main
2,104
module CapitalDisregardHelper def mandatory_capital_disregards_list(legal_aid_application) capital_disregard_names(legal_aid_application.mandatory_capital_disregards).join("<br>").html_safe end def mandatory_capital_disregards_detailed_list(legal_aid_application) legal_aid_application.mandatory_capital_d...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/helpers/state_benefit_partial_url_helper.rb
Ruby
mit
19
main
695
module StateBenefitPartialUrlHelper def state_benefit_partial_url(type, version, *) url = case type when :change_benefits "providers_legal_aid_application_#{version}_state_benefit_path" when :add_benefits "providers_legal_aid_application_#{version}_add_other_state_benef...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/helpers/uploaded_evidence_helper.rb
Ruby
mit
19
main
1,371
module UploadedEvidenceHelper def evidence_message(legal_aid_application, evidence_type_translation) if legal_aid_application.allowed_document_categories.size == 1 single_evidence_message(legal_aid_application, evidence_type_translation) else multiple_evidence_message(legal_aid_application) en...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/helpers/ineligible_reasons_helper.rb
Ruby
mit
19
main
960
module IneligibleReasonsHelper def ineligible_reasons(cfe_result) return "" unless cfe_result.assessment_result == "ineligible" reasons = ineligible_reasons_array(cfe_result) return ineligible_reason(reasons.first) if reasons.length == 1 ineligible_reasons = ":<ul class='govuk-list govuk-list--bulle...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/helpers/attachments_helper.rb
Ruby
mit
19
main
257
module AttachmentsHelper def attachments_with_size(attachments) return [] unless attachments attachments&.map do |at| (at.original_filename || at.attachment_type) + " (#{number_to_human_size(at.document.blob.byte_size)})" end end end
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/helpers/address_helper.rb
Ruby
mit
19
main
674
module AddressHelper def address_with_line_breaks(address) return unless address sanitize [address.address_line_one, address.address_line_two, address.city, address.county, address.pretty_postcode, address.country_name?].compact.compact_bl...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/helpers/page_template_helper.rb
Ruby
mit
19
main
3,618
module PageTemplateHelper # A wrapper for the main elements needed in a page. # # `page_template` will wrap the main content, and add the main elements needed # at the start of each page (HTML title, navigation links, and heading): # # <%= page_template(page_title: 'Some Page') do %> # <p>Some conte...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/helpers/policy_disregards_helper.rb
Ruby
mit
19
main
2,557
module PolicyDisregardsHelper include CheckAnswersHelper ATTRIBUTES = %i[ england_infected_blood_support vaccine_damage_payments variant_creutzfeldt_jakob_disease criminal_injuries_compensation_scheme national_emergencies_trust we_love_manchester_emergency_fund london_emergencies_trust ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/helpers/dependant_helper.rb
Ruby
mit
19
main
1,950
module DependantHelper include CheckAnswersHelper ATTRIBUTES = %i[ _name date_of_birth relationship in_full_time_education income assets ].freeze def dependant_hash(dependant) items = dependant_as_array(dependant) items&.compact! return nil if items.blank? { item...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/helpers/hash_format_helper.rb
Ruby
mit
19
main
1,668
# frozen_string_literal: true module HashFormatHelper # These methods add classes to the HTML structure def format_hash(hash, html = "") hash.each do |key, value| next if value.blank? if value.is_a?(Array) html += build_dl_array(key, value) elsif standard_type?(value) || value.is_a?(...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/helpers/check_answer_url_helper.rb
Ruby
mit
19
main
330
module CheckAnswerUrlHelper def check_answer_url_for(journey_type, field_name, application = nil, args = {}) flow_service = Flow::BaseFlowService.flow_service_for( journey_type, current_step: field_name, legal_aid_application: application, params: args, ) flow_service.current_path ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/helpers/dwp_outcome_helper.rb
Ruby
mit
19
main
479
module DWPOutcomeHelper def reset_confirm_dwp_status!(application) application.dwp_override&.destroy! dwp_result_confirmation!(application, nil) end def checking_dwp_status!(application) dwp_result_confirmation!(application, false) end def confirm_dwp_status_correct!(application) dwp_result_...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/helpers/has_other_proceedings_helper.rb
Ruby
mit
19
main
827
module HasOtherProceedingsHelper # Where a proceeding could come under more than one matter type (e.g. child arrangement orders come under both PLF and S8), this method is to # add warning component to has_other_proceedings page. This is to warn users to check they have selected the correct matter type. def show_...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/helpers/application_helper.rb
Ruby
mit
19
main
4,315
module ApplicationHelper include YourApplicationsHelper include HomePathHelper def html_title default = t("shared.page-title.suffix") return default unless content_for?(:head_title) || content_for?(:page_title) title = content_for?(:head_title) ? content_for(:head_title) : content_for(:page_title) ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/helpers/cookie_banner_helper.rb
Ruby
mit
19
main
215
module CookieBannerHelper def display_cookie_banner?(provider) provider.cookies_enabled.nil? || provider.cookies_saved_at.nil? || (provider.cookies_enabled && provider.cookies_saved_at < 1.year.ago) end end
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/helpers/linked_applications_helper.rb
Ruby
mit
19
main
1,414
module LinkedApplicationsHelper def all_linked_applications_details(legal_aid_application) return unless legal_aid_application.lead_application @all_linked_applications_details ||= sanitize(all_linked_applications(legal_aid_application)&.map { |application| "#{application.application_ref}, #{application.appl...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/helpers/check_provider_answers_helper.rb
Ruby
mit
19
main
844
module CheckProviderAnswersHelper def correspondence_address_change_link(legal_aid_application) if legal_aid_application.applicant.correspondence_address_choice.eql?("home") nil elsif legal_aid_application.applicant.correspondence_address_choice.eql?("office") providers_legal_aid_application_corre...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/helpers/flow_helper.rb
Ruby
mit
19
main
1,284
module FlowHelper def next_action_buttons_with_form( url:, method: :post, show_continue: true, inverse_continue: false, continue_button_text: t("generic.save_and_continue"), show_draft: false, draft_button_text: t("generic.save_and_come_back_later"), additional_link: nil, container...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/helpers/payments_summary_partial_url_helper.rb
Ruby
mit
19
main
461
module PaymentsSummaryPartialUrlHelper def payments_summary_partial_url(partner, credit, regular_payments, *) version = partner == true ? "partners" : "means" payment_type = credit == true ? "income" : "outgoing" page = regular_payments || partner ? "regular_#{payment_type}s" : "identify_types_of_#{paymen...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/helpers/opponent_helper.rb
Ruby
mit
19
main
648
module OpponentHelper def opponent_url(legal_aid_application, opponent) if opponent.individual? providers_legal_aid_application_opponent_individual_path(legal_aid_application.id, opponent.id) elsif opponent.organisation? && opponent.ccms_opponent_id.blank? providers_legal_aid_application_opponent_...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/helpers/capital_helper.rb
Ruby
mit
19
main
837
module CapitalHelper CapitalAmountItem = Struct.new(:label, :name, :amount, :type, :amount_text) def capital_amounts_list(legal_aid_application) return nil if legal_aid_application.savings_amount.nil? amounts_list = legal_aid_application.savings_amount.amount_attributes&.reject! { |a| a.end_with?("account...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/helpers/transaction_type_helper.rb
Ruby
mit
19
main
3,843
module TransactionTypeHelper def answer_for_transaction_type(legal_aid_application:, transaction_type:, owner_type:) total = legal_aid_application.transactions_total_by_category(transaction_type.id) has_transaction_type = legal_aid_application.has_transaction_type?(transaction_type, owner_type) if has_tr...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/helpers/money_helper.rb
Ruby
mit
19
main
663
module MoneyHelper def value_with_currency_unit(value, currency) number_to_currency(value, unit: I18n.t("currency.#{currency.downcase}", default: currency)) end def number_to_currency_or_original_string(value) value.is_a?(String) ? value : gds_number_to_currency(value, unit: "") end def gds_number_t...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/helpers/liquid_capital_items_helper.rb
Ruby
mit
19
main
488
module LiquidCapitalItemsHelper def capital_items_to_display?(legal_aid_application, item) return false if legal_aid_application.passported? && ["Online current accounts", "Online savings accounts"].include?(item[:description]) true end def item_description(legal_aid_application, item) return "Savin...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/helpers/check_answers_helper.rb
Ruby
mit
19
main
664
module CheckAnswersHelper ItemStruct = Struct.new(:label, :amount_text, :name) def number_to_currency_or_na(number) number.to_d == BigDecimal("999_999_999_999.0", 12) ? "N/a" : gds_number_to_currency(number) end def nino_with_spaces(national_insurance_number) return nil if national_insurance_number.bl...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/helpers/google_tag_manager_helper.rb
Ruby
mit
19
main
427
module GoogleTagManagerHelper def cookies_enabled? current_provider_enabled_cookies? && google_tag_present? end private def current_provider_enabled_cookies? current_provider? && opted_in? end def current_provider? current_provider end def opted_in? current_provider.cookies_enabled? ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/helpers/language_switcher_helper.rb
Ruby
mit
19
main
680
# frozen_string_literal: true module LanguageSwitcherHelper def language_links links = +"" I18n.available_locales.each do |locale| link = I18n.locale == locale ? t("generic.#{locale}") : govuk_link_to(t("generic.#{locale}"), url_for(locale:)) links << "#{link} | " end links.delete_suffix...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/presenters/applicant_account_presenter.rb
Ruby
mit
19
main
495
class ApplicantAccountPresenter attr_reader :bank_provider delegate :name, :bank_accounts, to: :bank_provider def initialize(bank_provider) @bank_provider = bank_provider end delegate :main_account_holder, to: :@bank_provider def main_account_holder_name main_account_holder&.full_name end d...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/presenters/bank_transaction_presenter.rb
Ruby
mit
19
main
2,107
class BankTransactionPresenter CELLS = %i[ happened_at debit credit type description merchant balance_running_total account_type account_name sort_code account_number category selected_by flagged ].freeze attr_reader :transaction def self.present!(item, ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/presenters/task_list/subsection.rb
Ruby
mit
19
main
628
module TaskList class Subsection < SectionRenderer attr_reader :sub_name def initialize(application, name:, sub_name:, tasks:, index:, body_override: nil, display_section_header: true, status_results: {}) super(application, name:, tasks:, index:, body_override:, display_section_header:, status_results:...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/presenters/task_list/start_page_collection.rb
Ruby
mit
19
main
2,808
module TaskList class StartPageCollection < Collection NEW_RECORD = "00000000-0000-0000-0000-000000000000".freeze # Template: # # SECTIONS = { # task_list_section: { # body_override ->(application) { "my section message content" if application.my_condition? }, # task_list_item_1...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/presenters/task_list/collection.rb
Ruby
mit
19
main
2,150
module TaskList class Collection < SimpleDelegator attr_reader :view, :application, :show_index delegate :size, :count, to: :all_tasks delegate :tag, :safe_join, to: :view class << self delegate :t!, to: I18n end def initialize(view, application:, show_index: true) @view = view ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/presenters/task_list/section_renderer.rb
Ruby
mit
19
main
1,869
module TaskList class SectionRenderer include ActionView::Helpers::TagHelper include ActionView::Context attr_reader :application, :name, :tasks, :index, :body_override, :display_section_header alias_method :display_section_header?, :display_section_header delegate :t!, to: I18n def initial...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/presenters/task/proceedings_types.rb
Ruby
mit
19
main
297
module Task class ProceedingsTypes < Base def path if application.proceedings.any? Flow::Steps::ProviderStart::HasOtherProceedingsStep.path.call(application) else Flow::Steps::ProviderStart::ProceedingsTypesStep.path.call(application) end end end end
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/presenters/task/dwp_outcome.rb
Ruby
mit
19
main
449
module Task class DWPOutcome < Base def path if !application.applicant.national_insurance_number? Flow::Steps::ProviderStart::NoNationalInsuranceNumbersStep.path.call(application) elsif application.non_means_tested? Flow::Steps::ProviderStart::ConfirmNonMeansTestedApplicationStep.path....
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/presenters/task/base.rb
Ruby
mit
19
main
2,596
# A Task::List is a hash module Task class Base include ActionView::Helpers::TagHelper include ActionView::Context include Rails.application.routes.url_helpers def self.build(application, name, status_results) class_name = "Task::#{name.camelize}" if const_defined?(class_name) c...