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
Applifting/pomuzeme.si
https://github.com/Applifting/pomuzeme.si
app/admin/comments.rb
Ruby
mit
19
master
351
ActiveAdmin.register ActiveAdmin::Comment, as: 'Comment' do menu false actions :all, except: %i[index] controller do def destroy super do |success, failure| success.html { redirect_back fallback_location: request.referer } failure.html { redirect_back fallback_location: request.referer...
github
Applifting/pomuzeme.si
https://github.com/Applifting/pomuzeme.si
app/admin/organisations.rb
Ruby
mit
19
master
1,332
# frozen_string_literal: true ActiveAdmin.register Organisation do decorate_with OrganisationDecorator permit_params :abbreviation, :business_id_number, :contact_person, :contact_person_email, :contact_person_phone, :name, :volunteer_feedback_message, :volunteer_feedback_send_after_days index d...
github
Applifting/pomuzeme.si
https://github.com/Applifting/pomuzeme.si
app/admin/data_import.rb
Ruby
mit
19
master
1,836
ActiveAdmin.register_page 'Import Data' do menu false page_action :import_data, method: :post do temp_file = params[:import_form][:filename] group = Group.find(params[:import_form][:group_id]) DataImportService.call(temp_file.path, group) send_data File.read(DataImportService::ArrayToCsv::OUT...
github
Applifting/pomuzeme.si
https://github.com/Applifting/pomuzeme.si
app/admin/requested_volunteers.rb
Ruby
mit
19
master
3,190
# frozen_string_literal: true ActiveAdmin.register RequestedVolunteer do decorate_with RequestedVolunteerDecorator belongs_to :organisation_request, parent_class: Request permit_params :request_id, :volunteer_id, :state, :visible_sensitive, :note controller do def create super do |success, failure...
github
Applifting/pomuzeme.si
https://github.com/Applifting/pomuzeme.si
app/admin/dashboard.rb
Ruby
mit
19
master
1,476
ActiveAdmin.register_page 'Dashboard' do menu priority: 1, label: proc { I18n.t('active_admin.dashboard') } content title: proc { I18n.t('active_admin.dashboard') } do div style: 'max-width: 600px' do columns do column do panel 'Nábor' do count = GroupVolunteer.in_progress.i...
github
Applifting/pomuzeme.si
https://github.com/Applifting/pomuzeme.si
app/admin/requests.rb
Ruby
mit
19
master
8,576
# frozen_string_literal: true ActiveAdmin.register Request, as: 'OrganisationRequest' do decorate_with RequestDecorator config.sort_order = 'state_asc' menu priority: 2 permit_params :closed_note, :coordinator_id, :created_by_id, :fullfillment_date, :is_public, :organisation_id, :required_vol...
github
Applifting/pomuzeme.si
https://github.com/Applifting/pomuzeme.si
app/admin/volunteer_messages.rb
Ruby
mit
19
master
2,203
# frozen_string_literal: true ActiveAdmin.register Message, as: 'Volunteer Message' do menu false permit_params :volunteer_id, :request_id, :created_by_id, :text, :channel, :phone controller do def create # Potentional vulnerability due to trusting permitted_params values MessagingService.creat...
github
Applifting/pomuzeme.si
https://github.com/Applifting/pomuzeme.si
app/admin/groups.rb
Ruby
mit
19
master
1,061
# frozen_string_literal: true ActiveAdmin.register Group do decorate_with GroupDecorator permit_params :name, :slug, :channel_description, :thank_you, :exclusive_volunteer_signup, :signup_cta_button_text, :signup_tagline_text, :signup_partial_name index do para 'Organizační skupina zastřešu...
github
Applifting/pomuzeme.si
https://github.com/Applifting/pomuzeme.si
app/admin/subscriber_messages.rb
Ruby
mit
19
master
2,223
# frozen_string_literal: true ActiveAdmin.register Message, as: 'Subscriber Message' do menu false permit_params :request_id, :created_by_id, :text, :channel, :message_type, :phone controller do def create # Potentional vulnerability due to trusting permitted_params values MessagingService.crea...
github
Applifting/pomuzeme.si
https://github.com/Applifting/pomuzeme.si
app/admin/organisation_groups.rb
Ruby
mit
19
master
520
# frozen_string_literal: true ActiveAdmin.register OrganisationGroup do belongs_to :group permit_params :group_id, :organisation_id controller do def create super do |success, failure| success.html { redirect_to admin_group_path(resource.group_id) } failure.html { render :new } e...
github
Applifting/pomuzeme.si
https://github.com/Applifting/pomuzeme.si
app/admin/volunteer_labels.rb
Ruby
mit
19
master
1,063
# frozen_string_literal: true ActiveAdmin.register VolunteerLabel do belongs_to :volunteer permit_params :volunteer_id, :label_id, :created_by_id controller do def create super do |success, failure| success.html { redirect_to admin_volunteer_path(resource.volunteer_id) } failure.html {...
github
Applifting/pomuzeme.si
https://github.com/Applifting/pomuzeme.si
app/admin/addresses.rb
Ruby
mit
19
master
3,162
ActiveAdmin.register Address do menu false actions :all, except: %i[destroy new create] decorate_with AddressDecorator permit_params :id, :street_number, :street, :city, :city_part, :postal_code, :country_code, :latitude, :longitude, :geo_entry_id, :addressable_type, :addressable_id filter...
github
Applifting/pomuzeme.si
https://github.com/Applifting/pomuzeme.si
app/admin/news.rb
Ruby
mit
19
master
554
# frozen_string_literal: true ActiveAdmin.register News do menu parent: 'Admin' permit_params :title, :body, :url, :publication_type, :outlet, :created_at form do |f| f.input :publication_type, include_blank: false f.input :title f.input :created_at, as: :date_time_picker, ...
github
Applifting/pomuzeme.si
https://github.com/Applifting/pomuzeme.si
app/admin/recruitments.rb
Ruby
mit
19
master
1,202
# frozen_string_literal: true ActiveAdmin.register Recruitment do decorate_with GroupVolunteerDecorator scope :recruitment_in_progress, default: true, &:in_progress scope :recruitment_closed, &:closed scope :recruitment_all, &:all scope :recruitment_unassigned, &:unassigned filter :volunteer_full_name_co...
github
Applifting/pomuzeme.si
https://github.com/Applifting/pomuzeme.si
app/admin/users.rb
Ruby
mit
19
master
2,139
# frozen_string_literal: true ActiveAdmin.register User do decorate_with UserDecorator permit_params :email, :password, :password_confirmation, :first_name, :last_name, :phone # Filters filter :email filter :phone filter :current_sign_in_at filter :sign_in_count filter :created_at # Member actions...
github
Applifting/pomuzeme.si
https://github.com/Applifting/pomuzeme.si
app/errors/authorisation_error.rb
Ruby
mit
19
master
215
class AuthorisationError < StandardError attr_accessor :action, :subject def initialize(action, model) @action = action @subject = model end def message :not_authorised_for_resource end end
github
Applifting/pomuzeme.si
https://github.com/Applifting/pomuzeme.si
app/errors/api_errors.rb
Ruby
mit
19
master
582
module ApiErrors API_ERRORS = { VOLUNTEER_NOT_FOUND: :VOLUNTEER_NOT_FOUND, INVALID_CAPTCHA: :INVALID_CAPTCHA, INVALID_VERIFICATION_CODE: :INVALID_VERIFICATION_CODE, INVALID_TOKEN: :INVALID_TOKEN, INVALID_ARGUMENT: :INVALID_ARGUMENT, UNAUTHORIZED_RESOURCE: :UNAUTHORIZED_RESOURCE, ...
github
Applifting/pomuzeme.si
https://github.com/Applifting/pomuzeme.si
app/models/group.rb
Ruby
mit
19
master
894
class Group < ApplicationRecord # Associations has_many :labels, dependent: :destroy has_many :organisation_groups, dependent: :destroy has_many :organisations, through: :organisation_groups has_many :group_volunteers, dependent: :destroy has_many :volunteers, through: :group_volunteers # Validations v...
github
Applifting/pomuzeme.si
https://github.com/Applifting/pomuzeme.si
app/models/organisation_group.rb
Ruby
mit
19
master
484
class OrganisationGroup < ApplicationRecord # Associations belongs_to :group belongs_to :organisation # Attributes delegate :name, to: :organisation, prefix: true # Validations validates :organisation, uniqueness: { scope: :group } # Callbacks after_commit :invalidate_coordinators_cache private ...
github
Applifting/pomuzeme.si
https://github.com/Applifting/pomuzeme.si
app/models/message.rb
Ruby
mit
19
master
3,216
class Message < ApplicationRecord VOLUNTEER_MESSAGES_WITH_REQUEST_SQL = 'volunteer_id = %{volunteer_id} AND (request_id IS NULL OR request_id = %{request_id})'.freeze # Callbacks after_create :update_unread_messages_counter_cache after_destroy :update_unread_messages_counter_cache after_update :update_unre...
github
Applifting/pomuzeme.si
https://github.com/Applifting/pomuzeme.si
app/models/volunteer_label.rb
Ruby
mit
19
master
487
class VolunteerLabel < ApplicationRecord # Associations belongs_to :label belongs_to :volunteer belongs_to :user, foreign_key: :created_by_id, optional: true # Validations validates :volunteer_id, uniqueness: { scope: :label_id } # Delegations delegate :name, to: :label # Scopes scope :managable_...
github
Applifting/pomuzeme.si
https://github.com/Applifting/pomuzeme.si
app/models/group_volunteer.rb
Ruby
mit
19
master
1,030
class GroupVolunteer < ApplicationRecord DEFAULT_RECRUITMENT_STATUS = 1 WAITING_FOR_CONTACT = :waiting_for_contact ACTIVE = :active SRC_PUBLIC_POOL = :public_pool IN_RECRUITMENT = [1, 2].freeze # Enums enum recruitment_status: { WAITING_FOR_CONTACT => 1, onboarding: 2, ACTIVE => 3, inactive: 4 } enum s...
github
Applifting/pomuzeme.si
https://github.com/Applifting/pomuzeme.si
app/models/ability.rb
Ruby
mit
19
master
286
# frozen_string_literal: true class Ability include CanCan::Ability include Abilities::SuperAdmin include Abilities::Coordinator def initialize(user) add_coordinator_ability user if user.cached_coordinator? add_super_admin_ability user if user.cached_admin? end end
github
Applifting/pomuzeme.si
https://github.com/Applifting/pomuzeme.si
app/models/skill.rb
Ruby
mit
19
master
293
class Skill < ApplicationRecord before_validation :generate_code validates_presence_of :name, :code validates_uniqueness_of :name, :code private def generate_code return if code.present? self.code = I18n.transliterate(name).split(' ').map(&:downcase).join('_') end end
github
Applifting/pomuzeme.si
https://github.com/Applifting/pomuzeme.si
app/models/user.rb
Ruby
mit
19
master
2,355
# frozen_string_literal: true class User < ApplicationRecord rolify after_add: :handle_new_role include Authorizable include Cacheable # Include default devise modules. Others available are: # :confirmable, :lockable, :timeoutable, :trackable and :omniauthable devise :database_authenticatable, :r...
github
Applifting/pomuzeme.si
https://github.com/Applifting/pomuzeme.si
app/models/volunteer.rb
Ruby
mit
19
master
6,357
class Volunteer < ApplicationRecord include SmsConfirmable include Ransackers::VolunteerRansacker NEAREST_ADDRESSES_SQL = 'CROSS JOIN (SELECT ST_SetSRID(ST_MakePoint(%{longitude}, %{latitude}), 4326)::geography AS ref_geom) AS r'.freeze AVAILABLE_VOLUNTEERS_CONDITIONS = 'group_volunteers.id is null OR group_vo...
github
Applifting/pomuzeme.si
https://github.com/Applifting/pomuzeme.si
app/models/requested_volunteer.rb
Ruby
mit
19
master
2,354
# frozen_string_literal: true class RequestedVolunteer < ApplicationRecord REQUESTED_VOLUNTEERS_WITH_REQUEST_SQL = 'volunteer_id = %{volunteer_id} AND (request_id IS NULL OR request_id = %{request_id})'.freeze # Callbacks before_save :update_timestamps, if: :state_changed? # Associations belongs_to :reques...
github
Applifting/pomuzeme.si
https://github.com/Applifting/pomuzeme.si
app/models/location_subscription.rb
Ruby
mit
19
master
404
# frozen_string_literal: true class LocationSubscription < ApplicationRecord # Associations has_one :address, as: :addressable, dependent: :destroy # Validations validates :phone, phony_plausible: true, presence: true # Attributes accepts_nested_attributes_for :address phony_normalize :phone, default_...
github
Applifting/pomuzeme.si
https://github.com/Applifting/pomuzeme.si
app/models/news.rb
Ruby
mit
19
master
739
class News < ApplicationRecord # Attributes enum publication_type: { news: 1, from_media: 2 } # Validations validates_presence_of :publication_type, :title # Scopes scope :recent, -> { order(created_at: :desc) } scope :published, -> { where('created_at < ?', Time.zone.now) } # Hooks after_commit :i...
github
Applifting/pomuzeme.si
https://github.com/Applifting/pomuzeme.si
app/models/organisation.rb
Ruby
mit
19
master
2,661
# frozen_string_literal: true class Organisation < ApplicationRecord include TranslationsHelper include VolunteerFeedback::Helper resourcify # Associations has_many :coordinators, -> { joins(:roles).where(roles: { name: :coordinator }) }, class_name: :User, through: :roles, ...
github
Applifting/pomuzeme.si
https://github.com/Applifting/pomuzeme.si
app/models/label.rb
Ruby
mit
19
master
338
class Label < ApplicationRecord # Associations belongs_to :group has_many :volunteer_labels, dependent: :destroy # Validations validates :name, uniqueness: { scope: :group_id } # Scopes scope :managable_by, ->(user) { where(group_id: user.coordinating_groups.pluck(:id)) } scope :alphabetically, -> { o...
github
Applifting/pomuzeme.si
https://github.com/Applifting/pomuzeme.si
app/models/address.rb
Ruby
mit
19
master
3,463
class Address < ApplicationRecord NEAREST_ADDRESSES_SQL = 'CROSS JOIN (SELECT ST_SetSRID(ST_MakePoint(%{longitude}, %{latitude}), 4326)::geography AS ref_geom) AS r'.freeze # Hooks after_initialize :initialize_defaults # Associations belongs_to :addressable, polymorphic: true, autosave: true # Attributes...
github
Applifting/pomuzeme.si
https://github.com/Applifting/pomuzeme.si
app/models/interest.rb
Ruby
mit
19
master
379
class Interest < ApplicationRecord # Hooks before_validation :generate_code # Validations validates_presence_of :name, :code validates_uniqueness_of :name, :code # Scopes scope :alphabetically, -> { order(:name) } private def generate_code return if code.present? self.code = I18n.translit...
github
Applifting/pomuzeme.si
https://github.com/Applifting/pomuzeme.si
app/models/session.rb
Ruby
mit
19
master
477
class Session < Tableless phony_normalize :phone, default_country_code: 'CZ' phony_normalized_method :phone, default_country_code: 'CZ' attr_accessor :phone, :code, :redirect_to validates :phone, phony_plausible: true, presence: true validates_presence_of :volunteer, message: :not_found, if: proc { errors.m...
github
Applifting/pomuzeme.si
https://github.com/Applifting/pomuzeme.si
app/models/request.rb
Ruby
mit
19
master
5,556
# frozen_string_literal: true class Request < ApplicationRecord TITLE_MAX_LENGTH = 30 NEAREST_ADDRESSES_SQL = 'CROSS JOIN (SELECT ST_SetSRID(ST_MakePoint(%{longitude}, %{latitude}), 4326)::geography AS ref_geom) AS r'.freeze # Hooks before_validation :set_state, :set_state_last_updated_at # Associations ...
github
Applifting/pomuzeme.si
https://github.com/Applifting/pomuzeme.si
app/models/tableless.rb
Ruby
mit
19
master
217
class Tableless include ActiveModel::Validations include ActiveModel::Model include ActiveModel::Validations::Callbacks extend ActiveModel::Callbacks define_model_callbacks :create, :update, :validation end
github
Applifting/pomuzeme.si
https://github.com/Applifting/pomuzeme.si
app/models/role.rb
Ruby
mit
19
master
542
# frozen_string_literal: true class Role < ApplicationRecord has_and_belongs_to_many :users, join_table: :users_roles # Associations belongs_to :resource, polymorphic: true, optional: true validates :resource_type, inclusion: { in: Rolify.resource_types }, al...
github
Applifting/pomuzeme.si
https://github.com/Applifting/pomuzeme.si
app/models/concerns/cacheable.rb
Ruby
mit
19
master
692
module Cacheable include ActiveSupport::Concern CACHE_TIMEOUT = 5 # minutes CACHED_METHOD_PREFIX = 'cached_'.freeze def cache_output(key, expires_in: nil) Rails.cache.fetch "#{cache_key_with_version}::#{key}", expires_in: (expires_in || CACHE_TIMEOUT).minutes do yield self end end def respo...
github
Applifting/pomuzeme.si
https://github.com/Applifting/pomuzeme.si
app/models/concerns/authorizable.rb
Ruby
mit
19
master
273
# frozen_string_literal: true module Authorizable include ActiveSupport::Concern def has_any_role?(role_name) roles_name.include? role_name.to_s end def admin? has_any_role? :super_admin end def coordinator? has_any_role? :coordinator end end
github
Applifting/pomuzeme.si
https://github.com/Applifting/pomuzeme.si
app/models/concerns/sms_confirmable.rb
Ruby
mit
19
master
2,316
module SmsConfirmable extend ActiveSupport::Concern included do scope :confirmed, -> { where.not(confirmed_at: nil) } scope :unconfirmed, -> { where(confirmed_at: nil) } end CONFIRMATION_CODE_VALIDITY = 10 # minutes CONFIRMATION_CODE_LENGTH = 4 CONFIRMATION_CODE_REPEAT_BREAK = 5 # seconds AUTHOR...
github
Applifting/pomuzeme.si
https://github.com/Applifting/pomuzeme.si
app/models/concerns/ransackers/volunteer_ransacker.rb
Ruby
mit
19
master
614
# frozen_string_literal: true module Ransackers module VolunteerRansacker extend ActiveSupport::Concern included do def self.rans_full_name first_name = Arel::Nodes::InfixOperation.new('||', arel_table[:first_name], Arel::Nodes.build_quoted(' ')) Arel::Nodes::InfixOperation.new('||', f...
github
Applifting/pomuzeme.si
https://github.com/Applifting/pomuzeme.si
app/models/abilities/coordinator.rb
Ruby
mit
19
master
3,160
module Abilities module Coordinator def add_coordinator_ability(user) can :read, ActiveAdmin::Page, name: 'Dashboard' can %i[index read], [Organisation, OrganisationDecorator], id: user.cache_output(:user_group_organisations) { Organisation.user_group_organisations(user).pluck(:id) } can :update...
github
Applifting/pomuzeme.si
https://github.com/Applifting/pomuzeme.si
app/forms/address_form.rb
Ruby
mit
19
master
400
# typed: false # frozen_string_literal: true module AddressForm def self.build(address_params) data = Builder.build(address_params) Form.decorate data.address end class Form < ::AddressDecorator delegate_all decorates :address def persisted? return true object.persisted? end...
github
Applifting/pomuzeme.si
https://github.com/Applifting/pomuzeme.si
app/forms/address_form/builder.rb
Ruby
mit
19
master
1,126
# typed: true # frozen_string_literal: true module AddressForm class Builder attr_reader :data, :address def initialize(address_params) @data = address_params end def self.build(address_params) new(address_params).tap(&:build_address) end def build_address @address = data...
github
Applifting/pomuzeme.si
https://github.com/Applifting/pomuzeme.si
app/decorators/volunteer_decorator.rb
Ruby
mit
19
master
637
class VolunteerDecorator < ApplicationDecorator decorates_association :addresses delegate_all delegate :city, :street, to: :address def confirmed? object.confirmed? end def address @address ||= addresses[0] end def address_link if h.can? :manage, object h.link_to h.content_tag(:span...
github
Applifting/pomuzeme.si
https://github.com/Applifting/pomuzeme.si
app/decorators/address_decorator.rb
Ruby
mit
19
master
882
class AddressDecorator < ApplicationDecorator delegate_all def latitude object.coordinate.y end def longitude object.coordinate.x end def full_address [full_street, [address&.city_part, address&.city].uniq, address&.postal_code].flatten ...
github
Applifting/pomuzeme.si
https://github.com/Applifting/pomuzeme.si
app/decorators/request_decorator.rb
Ruby
mit
19
master
2,429
class RequestDecorator < ApplicationDecorator decorates_association :address delegate_all def volunteer_params { request_id: object.id }.merge search_params end def subscriber if h.current_user && h.can?(:manage, object) subscriber_organisation.present? ? "#{subscriber_organisation} (#{object....
github
Applifting/pomuzeme.si
https://github.com/Applifting/pomuzeme.si
app/decorators/requested_volunteer_decorator.rb
Ruby
mit
19
master
567
class RequestedVolunteerDecorator < ApplicationDecorator delegate_all def volunteer_name_link h.content_tag(:a, object.to_s, href: h.admin_volunteer_path(object.volunteer_id)) end def actions [button_edit].compact.join(' | ').html_safe end def button_edit h.link_to 'upravit', h.edit_admin_org...
github
Applifting/pomuzeme.si
https://github.com/Applifting/pomuzeme.si
app/decorators/message_decorator.rb
Ruby
mit
19
master
303
# frozen_string_literal: true class MessageDecorator < ApplicationDecorator delegate_all def sent_by_css(prefix_css = nil) [prefix_css, (object.direction == 'outgoing' ? :coordinator : :volunteer)].compact.join(' ') end def read_status_css :unread # read ? '' : :unread end end
github
Applifting/pomuzeme.si
https://github.com/Applifting/pomuzeme.si
app/decorators/group_decorator.rb
Ruby
mit
19
master
322
class GroupDecorator < ApplicationDecorator delegate_all def slug url = "https://pomuzeme.si/#{object.slug}" h.link_to url, url, target: '_blank' end def signup_partial signup_partial_name.present? ? "home/partials/partners/#{signup_partial_name}" : 'home/partials/section_partner_channel' end en...
github
Applifting/pomuzeme.si
https://github.com/Applifting/pomuzeme.si
config/puma.rb
Ruby
mit
19
master
1,635
require 'barnes' # Puma can serve each request in a thread from an internal thread pool. # The `threads` method setting takes two numbers: a minimum and maximum. # Any libraries that use thread pools should be configured to match # the maximum value specified for Puma. Default is set to 5 threads for minimum # and max...
github
Applifting/pomuzeme.si
https://github.com/Applifting/pomuzeme.si
config/application.rb
Ruby
mit
19
master
1,109
require_relative 'boot' require 'rails/all' # Require the gems listed in Gemfile, including any gems # you've limited to :test, :development, or :production. Bundler.require(*Rails.groups) module PomuzemeSi class Application < Rails::Application # Initialize configuration defaults for originally generated Rail...
github
Applifting/pomuzeme.si
https://github.com/Applifting/pomuzeme.si
config/routes.rb
Ruby
mit
19
master
3,367
Rails.application.routes.draw do require 'sidekiq/web' mount Sidekiq::Web => '/sidekiq' devise_for :users, ActiveAdmin::Devise.config ActiveAdmin.routes(self) # For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html root 'home#index', as: :home_page # Redirect...
github
Applifting/pomuzeme.si
https://github.com/Applifting/pomuzeme.si
config/initializers/devise.rb
Ruby
mit
19
master
14,415
# frozen_string_literal: true # Use this hook to configure devise mailer, warden hooks and so forth. # Many of these configuration options can be set straight in your model. Devise.setup do |config| # The secret key used by Devise. Devise uses this key to generate # random tokens. Changing this key will render inv...
github
Applifting/pomuzeme.si
https://github.com/Applifting/pomuzeme.si
config/initializers/rgeo.rb
Ruby
mit
19
master
569
# frozen_string_literal: true # # Having problem with # undefined method `point' for nil:NilClass ? # refer to https://stackoverflow.com/questions/31170055/activerecord-postgis-adapter-undefined-method-point-for-nilnilclass RGeo::ActiveRecord::SpatialFactoryStore.instance.tap do |config| # By default, use the GEOS i...
github
Applifting/pomuzeme.si
https://github.com/Applifting/pomuzeme.si
config/initializers/assets.rb
Ruby
mit
19
master
630
# Be sure to restart your server when you modify this file. # Version of your assets, change this if you want to expire all your assets. Rails.application.config.assets.version = '1.1' # Add additional assets to the asset load path. # Rails.application.config.assets.paths << Emoji.images_path # Add Yarn node_modules ...
github
Applifting/pomuzeme.si
https://github.com/Applifting/pomuzeme.si
config/initializers/locale.rb
Ruby
mit
19
master
289
# Where the I18n library should search for translation files I18n.load_path += Dir[Rails.root.join('lib', 'locale', '*.{rb,yml}')] # Permitted locales available for the application I18n.available_locales = [:cs] # Set default locale to something other than :en I18n.default_locale = :cs
github
Applifting/pomuzeme.si
https://github.com/Applifting/pomuzeme.si
config/initializers/active_admin.rb
Ruby
mit
19
master
11,087
# require custom Arbre components from app/components/ Dir[Rails.root.join('app/components/active_admin/inputs/*.rb')].sort.each { |f| require f } Dir[Rails.root.join('app/components/active_admin/views/*.rb')].sort.each { |f| require f } ActiveAdmin.setup do |config| # == Site Title # # Set the title that is dis...
github
Applifting/pomuzeme.si
https://github.com/Applifting/pomuzeme.si
config/initializers/rpush.rb
Ruby
mit
19
master
4,874
Rpush.configure do |config| # Supported clients are :active_record and :redis config.client = :active_record # Options passed to Redis.new # config.redis_options = {} # Frequency in seconds to check for new notifications. config.push_poll = 2 # The maximum number of notifications to load from the stor...
github
Applifting/pomuzeme.si
https://github.com/Applifting/pomuzeme.si
config/initializers/rack_attack.rb
Ruby
mit
19
master
696
# Using the `rack-attack` and `cloudflare-rails` gems. # Set ENV["REJECT_UNPROXIED_REQUESTS"] in protected environments. class Rack::Attack if ENV['REJECT_UNPROXIED_REQUESTS'] blocklist('block non-proxied requests in production') do |request| raw_ip = request.get_header('HTTP_X_FORWARDED_FOR') ip_add...
github
Applifting/pomuzeme.si
https://github.com/Applifting/pomuzeme.si
config/initializers/geocoder.rb
Ruby
mit
19
master
1,099
class GeoCache < Hash alias del delete end Geocoder.configure( # Geocoding optionsÅ # timeout: 3, # geocoding service timeout (secs) lookup: :google, # name of geocoding service (symbol) # ip_lookup: :ipinfo_io, # name of IP address geocoding service (symbol) language: :cs, # ISO-639 la...
github
Applifting/pomuzeme.si
https://github.com/Applifting/pomuzeme.si
config/initializers/message_receiver.rb
Ruby
mit
19
master
404
# Rails.logger.debug Rails.env # return if Rails.env.test? # require 'sidekiq/api' # Sidekiq.configure_client do |_config| # Rails.application.config.after_initialize do # Messages::ReceiverJob.perform_later unless ENV['DISABLE_SMS_RECEIVER'] == 'true' # end # end # if Rails.env.development? && ENV['INLINE_S...
github
Applifting/pomuzeme.si
https://github.com/Applifting/pomuzeme.si
config/initializers/rolify.rb
Ruby
mit
19
master
386
Rolify.configure do |config| # By default ORM adapter is ActiveRecord. uncomment to use mongoid # config.use_mongoid # Dynamic shortcuts for User class (user.is_admin? like methods). Default is: false # config.use_dynamic_shortcuts # Configuration to remove roles from database once the last resource is re...
github
Applifting/pomuzeme.si
https://github.com/Applifting/pomuzeme.si
config/environments/development.rb
Ruby
mit
19
master
2,378
Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. # In the development environment your application's code is reloaded on # every request. This slows down response time but is perfect for development # since you don't have to restart the web serv...
github
Applifting/pomuzeme.si
https://github.com/Applifting/pomuzeme.si
config/environments/production.rb
Ruby
mit
19
master
5,785
Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. # Code is not reloaded between requests. config.cache_classes = true # Eager load code on boot. This eager loads most of Rails and # your application in memory, allowing both threaded web serve...
github
Applifting/pomuzeme.si
https://github.com/Applifting/pomuzeme.si
spec/rails_helper.rb
Ruby
mit
19
master
2,204
ENV['RAILS_ENV'] ||= 'test' ENV['SMS_MOCK'] ||= 'true' require 'simplecov' require 'support/wait_for_ajax' SimpleCov.start 'rails' do add_filter 'app/admin' # ignore ActiveAdmin pages add_filter 'app/errors' # errors classes end require File.expand_path('../config/environment', __dir__) if ENV['CI'] == 'true' ...
github
Applifting/pomuzeme.si
https://github.com/Applifting/pomuzeme.si
spec/support/wait_for_ajax.rb
Ruby
mit
19
master
277
# frozen_string_literal: true module WaitForAjax def wait_for_ajax Timeout.timeout(Capybara.default_max_wait_time) do loop until finished_all_ajax_requests? end end def finished_all_ajax_requests? page.evaluate_script('jQuery.active').zero? end end
github
Applifting/pomuzeme.si
https://github.com/Applifting/pomuzeme.si
spec/support/geocoder_helper.rb
Ruby
mit
19
master
2,513
module GeocoderHelper def mock_geocoder_search allow(Geocoder).to receive(:search).with(any_args).and_return(geocoder_search_mock) end def geocoder_search_mock [OpenStruct.new(data: { 'address_components' => [{ 'long_name' => '476/9', 'sh...
github
Applifting/pomuzeme.si
https://github.com/Applifting/pomuzeme.si
spec/support/messaging_service_helper.rb
Ruby
mit
19
master
357
module MessagingServiceHelper def mock_message_response(message_id: nil, number: nil, text: nil, timestamp: nil) OpenStruct.new(channel_msg_id: message_id || 42, from_number: number || '123456789', text: text || 'response text', delivery_receipt_timestamp:...
github
Applifting/pomuzeme.si
https://github.com/Applifting/pomuzeme.si
spec/helpers/volunteer_feedback_helper_spec.rb
Ruby
mit
19
master
1,141
# frozen_string_literal: true require 'rails_helper' RSpec.describe VolunteerFeedback::Helper do let(:helper) { double('helper') } before do helper.extend(VolunteerFeedback::Helper) end describe 'permitted_interpolations' do it 'lists permitted interpolation keys' do expect(helper.permitted_in...
github
Applifting/pomuzeme.si
https://github.com/Applifting/pomuzeme.si
spec/models/user_spec.rb
Ruby
mit
19
master
5,062
# frozen_string_literal: true require 'rails_helper' RSpec.describe User, type: :model do context 'validations' do subject { build(:user) } it { is_expected.to validate_presence_of(:first_name) } it { is_expected.to validate_presence_of(:last_name) } it { is_expected.to validate_presence_of(:email)...
github
Applifting/pomuzeme.si
https://github.com/Applifting/pomuzeme.si
spec/models/group_volunteer_spec.rb
Ruby
mit
19
master
2,751
# frozen_string_literal: true require 'rails_helper' RSpec.describe GroupVolunteer, type: :model do context 'validations' do subject { create(:group_volunteer) } it 'should validate uniqueness of volunteer scoped to group' do group_volunteer = subject.dup expect(group_volunteer.valid?).to be fa...
github
Applifting/pomuzeme.si
https://github.com/Applifting/pomuzeme.si
spec/models/message_spec.rb
Ruby
mit
19
master
3,071
# frozen_string_literal: true require 'rails_helper' RSpec.describe Message, type: :model do context 'validations' do subject { create(:message) } it { is_expected.to validate_presence_of(:text) } end context 'associations' do it { should belong_to(:volunteer).optional } it { should belong_to(...
github
Applifting/pomuzeme.si
https://github.com/Applifting/pomuzeme.si
spec/models/organisation_group_spec.rb
Ruby
mit
19
master
1,029
require 'rails_helper' describe OrganisationGroup do context 'validations' do subject { create(:organisation_group) } it 'should validate uniqueness of organisation scoped to group' do organisation_group = subject.dup expect(organisation_group.valid?).to be false expect(organisation_group....
github
Applifting/pomuzeme.si
https://github.com/Applifting/pomuzeme.si
spec/models/label_spec.rb
Ruby
mit
19
master
1,361
# frozen_string_literal: true require 'rails_helper' RSpec.describe Label, type: :model do context 'validations' do subject { create(:label) } it { is_expected.to validate_uniqueness_of(:name).scoped_to(:group_id) } end context 'associations' do it { should belong_to(:group) } it { should have...
github
Applifting/pomuzeme.si
https://github.com/Applifting/pomuzeme.si
spec/models/address_spec.rb
Ruby
mit
19
master
3,959
# frozen_string_literal: true require 'rails_helper' require 'support/geocoder_helper' RSpec.describe Address, type: :model do include GeocoderHelper context 'validations' do subject { build(:address) } it { is_expected.to validate_presence_of(:city) } it { is_expected.to validate_presence_of(:city_...
github
Applifting/pomuzeme.si
https://github.com/Applifting/pomuzeme.si
spec/models/group_spec.rb
Ruby
mit
19
master
2,661
# frozen_string_literal: true require 'rails_helper' RSpec.describe Group, type: :model do context 'validations' do subject { build(:group) } it { is_expected.to validate_presence_of(:name) } it { is_expected.to validate_uniqueness_of(:name) } it { is_expected.to validate_presence_of(:slug) } i...
github
Applifting/pomuzeme.si
https://github.com/Applifting/pomuzeme.si
spec/models/request_spec.rb
Ruby
mit
19
master
8,276
# frozen_string_literal: true require 'rails_helper' RSpec.describe Request, type: :model do context 'validations' do subject { build(:request) } it { is_expected.to validate_presence_of(:text) } it { is_expected.to validate_length_of(:text).is_at_most(160) } it { is_expected.to validate_presence_o...
github
Applifting/pomuzeme.si
https://github.com/Applifting/pomuzeme.si
spec/models/volunteer_spec.rb
Ruby
mit
19
master
10,706
require 'rails_helper' describe Volunteer do let_it_be(:volunteer) { create(:volunteer, phone: '+420 666 666 666') } describe 'validations' do subject { build(:volunteer) } it { is_expected.to validate_presence_of(:first_name) } it { is_expected.to validate_presence_of(:last_name) } it { is_expec...
github
Applifting/pomuzeme.si
https://github.com/Applifting/pomuzeme.si
spec/models/requested_volunteer_spec.rb
Ruby
mit
19
master
3,131
# frozen_string_literal: true require 'rails_helper' RSpec.describe RequestedVolunteer, type: :model do describe 'associations' do it { should belong_to(:request) } it { should belong_to(:volunteer) } it { should have_many(:messages) } it { should have_one(:feedback_request) } end describe 'sco...
github
Applifting/pomuzeme.si
https://github.com/Applifting/pomuzeme.si
spec/models/sms_confirmable_spec.rb
Ruby
mit
19
master
4,019
require 'rails_helper' describe SmsConfirmable do before(:all) { I18n.locale = :en } describe '#confirmed?' do subject(:confirmable) { build(:volunteer, confirmed_at: confirmed_at) } context 'given confirmed_at is not set, "confirmed?"' do let(:confirmed_at) { nil } it { expect(confirmable.c...
github
Applifting/pomuzeme.si
https://github.com/Applifting/pomuzeme.si
spec/models/news_spec.rb
Ruby
mit
19
master
1,243
# frozen_string_literal: true require 'rails_helper' RSpec.describe News, type: :model do context 'validations' do subject { create(:news) } it { is_expected.to validate_presence_of(:title) } it { is_expected.to validate_presence_of(:publication_type) } end context 'enums' do it { should defin...
github
Applifting/pomuzeme.si
https://github.com/Applifting/pomuzeme.si
spec/models/organisation_spec.rb
Ruby
mit
19
master
3,425
require 'rails_helper' describe Organisation do describe 'validations' do subject { build(:organisation) } it { is_expected.to validate_presence_of(:name) } it { is_expected.to validate_presence_of(:abbreviation) } it { is_expected.to validate_length_of(:abbreviation).is_equal_to(4) } it { is_ex...
github
Applifting/pomuzeme.si
https://github.com/Applifting/pomuzeme.si
spec/features/volunteer_messages_spec.rb
Ruby
mit
19
master
3,497
require 'rails_helper' require 'support/messaging_service_helper' RSpec.feature 'Volunteer Messages' do include MessagingServiceHelper let(:organisation) { create :organisation, :with_group } let(:user) { create :user, :with_organisation_group, organisation: organisation } let(:request) { create :request, sta...
github
Applifting/pomuzeme.si
https://github.com/Applifting/pomuzeme.si
spec/factories/message.rb
Ruby
mit
19
master
801
# frozen_string_literal: true FactoryBot.define do factory :message do text { FFaker::HipsterIpsum.sentence } read_at { nil } outgoing pending trait :incoming do direction { :incoming } end trait :outgoing do direction { :outgoing } end trait :pending do state...
github
Applifting/pomuzeme.si
https://github.com/Applifting/pomuzeme.si
spec/factories/news.rb
Ruby
mit
19
master
327
# frozen_string_literal: true FactoryBot.define do factory :news do title { FFaker::HipsterIpsum.sentence } body { FFaker::HipsterIpsum.sentence } news_type trait :news_type do publication_type { :news } end trait :from_media_type do publication_type { :from_media } end e...
github
Applifting/pomuzeme.si
https://github.com/Applifting/pomuzeme.si
spec/factories/requested_volunteer.rb
Ruby
mit
19
master
332
# frozen_string_literal: true FactoryBot.define do factory :requested_volunteer do request volunteer state { :pending_notification } trait :accepted do state { :accepted } end trait :notified do state { :notified } end trait :rejected do state { :rejected } en...
github
Applifting/pomuzeme.si
https://github.com/Applifting/pomuzeme.si
spec/factories/group.rb
Ruby
mit
19
master
318
# frozen_string_literal: true FactoryBot.define do factory :group do name { 'People in need' } slug { 'pin' } channel_description { 'We help.' } end factory :group_applifting, class: 'Group' do name { 'Applifting' } slug { 'app' } channel_description { 'We develop things.' } end end
github
Applifting/pomuzeme.si
https://github.com/Applifting/pomuzeme.si
spec/factories/request.rb
Ruby
mit
19
master
556
# frozen_string_literal: true FactoryBot.define do factory :request do organisation text { 'Request for 5 volunteers' } required_volunteer_count { 5 } subscriber { 'Subscriber' } subscriber_phone { "+420#{rand(111111111...999999999)}" } creator state_last_updated_at { DateTime.now } b...
github
Applifting/pomuzeme.si
https://github.com/Applifting/pomuzeme.si
spec/factories/organisation.rb
Ruby
mit
19
master
790
# frozen_string_literal: true FactoryBot.define do factory :organisation do name { 'Fiendisch Organization for World Larceny' } abbreviation { 'FOWL' } contact_person { FFaker::Name.name } contact_person_email { FFaker::Internet.email } contact_person_phone { "+420#{rand(111111111...999999999)}" ...
github
Applifting/pomuzeme.si
https://github.com/Applifting/pomuzeme.si
spec/factories/user.rb
Ruby
mit
19
master
591
# frozen_string_literal: true FactoryBot.define do factory :user, aliases: [:creator] do first_name { 'First' } last_name { 'Last '} email { FFaker::Internet.email } phone { FFaker::PhoneNumberDE.international_phone_number } password { 'Test1234 '} initialize_with { User.find_or_initialize_by...
github
Applifting/pomuzeme.si
https://github.com/Applifting/pomuzeme.si
spec/factories/address.rb
Ruby
mit
19
master
506
# frozen_string_literal: true FactoryBot.define do factory :address do street_number { FFaker::AddressDE.building_number } street { FFaker::AddressDE.street_name } city { FFaker::AddressDE.city } city_part { FFaker::AddressDE.city } postal_code { FFaker::AddressUK.postcode } coordinate { Geog...
github
Applifting/pomuzeme.si
https://github.com/Applifting/pomuzeme.si
spec/factories/volunteer.rb
Ruby
mit
19
master
531
# frozen_string_literal: true FactoryBot.define do factory :volunteer do first_name { 'Firstname' } last_name { 'Lastname' } phone { "+420#{rand(111111111...999999999)}" } email { FFaker::Internet.email } after :build do |volunteer| volunteer.addresses << build(:address) end end f...
github
Applifting/pomuzeme.si
https://github.com/Applifting/pomuzeme.si
spec/jobs/messages_received_processor_job_spec.rb
Ruby
mit
19
master
3,877
require 'rails_helper' describe Messages::ReceivedProcessorJob do before(:all) { I18n.locale = :cs } describe '#perform' do let(:requested_volunteer) { create :requested_volunteer, :notified } let(:request) { requested_volunteer.request } let(:volunteer) { requested_volunteer.volunteer } let(:unre...
github
Applifting/pomuzeme.si
https://github.com/Applifting/pomuzeme.si
spec/services/sms_service_spec.rb
Ruby
mit
19
master
1,479
require 'rails_helper' describe SmsService do before(:all) { I18n.locale = :cs } let(:message) { create :message } let(:outgoing_message) { MessagingService::OutgoingMessage.new message } describe '.send_message' do it 'sends message via default connector with delivery report' do expect(SmsService:...
github
Applifting/pomuzeme.si
https://github.com/Applifting/pomuzeme.si
spec/services/messaging_service_spec.rb
Ruby
mit
19
master
2,227
require 'rails_helper' describe MessagingService do before(:all) { I18n.locale = :cs } let(:message) { create :message } let(:outgoing_message) { MessagingService::OutgoingMessage.new message } describe '.create_message' do it 'creates Message with given args' do create_args = {text: 'foobar'} ...
github
Applifting/pomuzeme.si
https://github.com/Applifting/pomuzeme.si
spec/services/volunteer_feedback_sender_spec.rb
Ruby
mit
19
master
2,808
require 'rails_helper' describe VolunteerFeedback::Sender do describe '.call' do let(:organisation) { create :organisation, volunteer_feedback_message: 'Feedback form for %{prijimajici_organizace}', volunteer_feedback_send_after_days: 1 } let(:requ...
github
Applifting/pomuzeme.si
https://github.com/Applifting/pomuzeme.si
spec/services/push_service_spec.rb
Ruby
mit
19
master
2,329
require 'rails_helper' describe PushService do before(:all) { I18n.locale = :cs } let(:message) { create :message, request: create(:request) } let(:outgoing_message) { MessagingService::OutgoingMessage.new message } describe '.send_message' do it 'sends message via default connector' do expect(Push...
github
Applifting/pomuzeme.si
https://github.com/Applifting/pomuzeme.si
spec/services/push_service/connector/fcm_push/helper_spec.rb
Ruby
mit
19
master
1,747
require 'rails_helper' describe PushService::Connector::FcmPush::Helper do before(:all) { I18n.locale = :cs } describe '.event_type' do it 'handles event type for request offer messages' do message = OpenStruct.new(message: build(:message, :request_offer)) expect(PushService::Connector::FcmPush::H...
github
Applifting/pomuzeme.si
https://github.com/Applifting/pomuzeme.si
spec/services/admin/requests/volunteer_notifier_spec.rb
Ruby
mit
19
master
7,622
require 'rails_helper' describe Admin::Requests::VolunteerNotifier do let(:request) { create :request } let(:user) { request.creator } let(:requested_volunteer) { create :requested_volunteer, request: request } let(:volunteer) { requested_volunteer.volunteer } before(:all) { I18n.locale = :cs } describe ...