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 | freeats/freeats | https://github.com/freeats/freeats | app/helpers/trix_helper.rb | Ruby | mit | 45 | main | 2,378 | # frozen_string_literal: true
# Original source: https://github.com/basecamp/trix/issues/55#issuecomment-335794073
module TrixHelper
def trix_sanitize_and_add_target_blank_to_links(html)
doc = Nokogiri::HTML(html)
doc.css("a").each do |link|
link["target"] = "_blank"
link["rel"] = "noopener noref... |
github | freeats/freeats | https://github.com/freeats/freeats | app/helpers/main_helper.rb | Ruby | mit | 45 | main | 1,169 | # frozen_string_literal: true
module MainHelper
EMAIL_TEMPLATE_VARIABLES =
YAML.safe_load(
Rails.root.join("config/email_templates/email_template_variables.yml").read
)
def plain_format(text, html_options = {}, options = {})
simple_format(
Rinku.auto_link(
text.strip.gsub(/\r?\n/, ... |
github | freeats/freeats | https://github.com/freeats/freeats | app/helpers/cards_helper.rb | Ruby | mit | 45 | main | 1,591 | # frozen_string_literal: true
module CardsHelper
def card_header(title:, icon_style:, &block)
content_tag(:div, class: "d-inline-block align-items-center text-truncate") do
concat(render(IconComponent.new(icon_style, size: :medium, class: "me-2")))
concat(title)
concat(capture(&block)) if block... |
github | freeats/freeats | https://github.com/freeats/freeats | app/helpers/schema_helper.rb | Ruby | mit | 45 | main | 341 | # frozen_string_literal: true
module SchemaHelper
def schema_errors_to_string(errors)
return "" if errors.blank?
errors.messages.map { |mes| schema_full_message(mes) }.join(", ")
end
def schema_full_message(message)
"#{message.path.is_a?(Array) ? message.path.join(', ') : message.path.to_s}: #{mess... |
github | freeats/freeats | https://github.com/freeats/freeats | app/helpers/note_threads_helper.rb | Ruby | mit | 45 | main | 2,004 | # frozen_string_literal: true
module NoteThreadsHelper
def note_thread_compose_user_options_for_select(thread:, all_active_members:)
unchangeable_ids =
[current_member, *thread.participants, *thread.mentioned_members].map(&:id)
selected_ids = [*unchangeable_ids, *thread.members.map(&:id)]
ids = [
... |
github | freeats/freeats | https://github.com/freeats/freeats | app/helpers/mailer_helper.rb | Ruby | mit | 45 | main | 1,162 | # frozen_string_literal: true
module MailerHelper
def mailer_button_link_to(label, path, custom_style: "")
# In order to make emails look similarly in Microsoft Outlook,
# we have to consider following limitations:
# - rem units aren't reliable, only use px and em;
# - Margins and paddings aren't wel... |
github | freeats/freeats | https://github.com/freeats/freeats | app/helpers/candidate_cards_helper.rb | Ruby | mit | 45 | main | 3,758 | # frozen_string_literal: true
module CandidateCardsHelper
def candidate_card_edit(
card_name,
candidate,
header: nil,
target_url: nil,
form_options: {},
&
)
card_edit(
card_name:,
target_model: candidate,
target_url: target_url || public_send(
:"update_card_ats... |
github | freeats/freeats | https://github.com/freeats/freeats | app/helpers/account_links_helper.rb | Ruby | mit | 45 | main | 2,309 | # frozen_string_literal: true
module AccountLinksHelper
PATH = "icons/"
def account_link_display(link, klass: "col-auto")
account_link = AccountLink.new(link)
domain = account_link.domain
unless domain
return link_to(
render(
IconComponent.new(
:world,
s... |
github | freeats/freeats | https://github.com/freeats/freeats | app/helpers/pictures_helper.rb | Ruby | mit | 45 | main | 785 | # frozen_string_literal: true
# Use <picture> HTML element to show different versions of an image,
# or when an image is combined with text in a view.
module PicturesHelper
def picture_avatar_icon(attachment, opts = {})
src_sym = :src
size = opts.delete(:size) || "sm"
opts[:class] = ["avatar", "avatar-#... |
github | freeats/freeats | https://github.com/freeats/freeats | app/helpers/ats/datagrid_helper.rb | Ruby | mit | 45 | main | 246 | # frozen_string_literal: true
module ATS::DatagridHelper
def ats_datagrid_render_row(grid, asset, options = {})
render(
partial: "datagrid/row",
locals: {
grid:,
asset:,
options:
}
)
end
end |
github | freeats/freeats | https://github.com/freeats/freeats | app/helpers/ats/positions_helper.rb | Ruby | mit | 45 | main | 5,978 | # frozen_string_literal: true
module ATS::PositionsHelper
def ats_position_display_activity(event)
actor_account_name = compose_actor_account_name(event)
to = event.changed_to
from = event.changed_from
field = event.changed_field&.humanize(capitalize: false)
text = "#{actor_account_name} "
t... |
github | freeats/freeats | https://github.com/freeats/freeats | app/helpers/ats/profiles_helper.rb | Ruby | mit | 45 | main | 362 | # frozen_string_literal: true
module ATS::ProfilesHelper
def ats_profile_button_tooltip_wrapper(tooltip:, **args, &)
data = args[:data] || {}
data = data.merge({ bs_toggle: "tooltip", bs_title: tooltip }) if tooltip.present?
content_tag(
:span,
class: "d-inline-block",
data:,
**ar... |
github | freeats/freeats | https://github.com/freeats/freeats | app/helpers/ats/members_helper.rb | Ruby | mit | 45 | main | 3,875 | # frozen_string_literal: true
module ATS::MembersHelper
def compose_member_options_for_select(
excluded_member_ids:,
unassignment_label:,
selected_member_id:
)
dataset = Member.active.where.not(id: excluded_member_ids).order("accounts.name").to_a
if dataset.include?(current_member)
datas... |
github | freeats/freeats | https://github.com/freeats/freeats | app/helpers/ats/tasks_helper.rb | Ruby | mit | 45 | main | 4,992 | # frozen_string_literal: true
module ATS::TasksHelper
def ats_task_due_date(task)
due_date =
case task.due_date
when Time.zone.yesterday then t("core.yesterday")
when Time.zone.today then t("core.today")
when Time.zone.tomorrow then t("core.tomorrow")
else
if task.due_date.b... |
github | freeats/freeats | https://github.com/freeats/freeats | app/helpers/ats/emails_helper.rb | Ruby | mit | 45 | main | 958 | # frozen_string_literal: true
module ATS::EmailsHelper
def ats_pretty_email_addresses(email_addresses)
email_addresses
.map { |name, address| name.present? ? "#{name} <#{address}>" : address }.join(", ")
end
def ats_timelink_in_email_message(controller_name, email_message, possible_id, event_id)
p... |
github | freeats/freeats | https://github.com/freeats/freeats | app/grids/ats/candidates_grid.rb | Ruby | mit | 45 | main | 5,224 | # frozen_string_literal: true
class ATS::CandidatesGrid
include Datagrid
SELECTED_FIELDS =
<<~SQL.squish
candidates.blacklisted,
candidates.candidate_source_id,
candidates.company,
candidates.created_at,
candidates.id,
candidates.last_activity_at,
candidates.location_... |
github | freeats/freeats | https://github.com/freeats/freeats | app/grids/ats/positions_grid.rb | Ruby | mit | 45 | main | 4,750 | # frozen_string_literal: true
class ATS::PositionsGrid
include Datagrid
#
# Scope
#
scope do
Position.with_color_codes
end
attr_accessor(:current_account)
#
# Filters
#
filter(:name, :string, placeholder: I18n.t("core.name")) do |value|
search_by_name(value)
end
filter(
:loc... |
github | freeats/freeats | https://github.com/freeats/freeats | app/grids/ats/tasks_grid.rb | Ruby | mit | 45 | main | 3,494 | # frozen_string_literal: true
class ATS::TasksGrid
include Datagrid
#
# Scope
#
scope do
Task.grid_scope
end
attr_accessor :current_member_id
#
# Filters
#
filter(
:name,
:string,
header: I18n.t("core.name"),
placeholder: I18n.t("core.name")
) do |name|
where("name ... |
github | freeats/freeats | https://github.com/freeats/freeats | app/grids/ats/profile_tasks_grid.rb | Ruby | mit | 45 | main | 1,186 | # frozen_string_literal: true
class ATS::ProfileTasksGrid
include Datagrid
#
# Scope
#
scope do
Task.grid_scope
end
#
# Columns
#
column(:task_status, header: "", html: true, order: false) do |model|
render partial: "ats/tasks/change_status_control", locals: { task: model, grid: :profil... |
github | freeats/freeats | https://github.com/freeats/freeats | app/grids/ats/team_grid.rb | Ruby | mit | 45 | main | 1,722 | # frozen_string_literal: true
class ATS::TeamGrid
include Datagrid
scope do
accounts_query =
Account
.joins(:member)
.select("name, email, access_level, created_at, accounts.id")
access_tokens_query =
AccessToken
.where(sent_at: AccessToken::MEMBER_INVITATION_TTL.ago..)
... |
github | freeats/freeats | https://github.com/freeats/freeats | app/grids/ats/dashboard_positions_grid.rb | Ruby | mit | 45 | main | 1,202 | # frozen_string_literal: true
class ATS::DashboardPositionsGrid
include Datagrid
#
# Scope
#
scope do
Position
.where(status: %i[draft open on_hold])
end
#
# Columns
#
column(
:position_status,
header: "",
order: false,
preload: :added_event,
html: true
) do |mod... |
github | freeats/freeats | https://github.com/freeats/freeats | app/grids/ats/dashboard_candidates_grid.rb | Ruby | mit | 45 | main | 1,545 | # frozen_string_literal: true
class ATS::DashboardCandidatesGrid
include Datagrid
attr_accessor :current_member_id
#
# Scope
#
scope do
Candidate.with_attached_avatar
end
#
# Columns
#
column(:avatar_image, html: true, header: "", order: false) do |model|
link_to(
tab_ats_candi... |
github | freeats/freeats | https://github.com/freeats/freeats | app/grids/settings/recruitment/email_templates_grid.rb | Ruby | mit | 45 | main | 780 | # frozen_string_literal: true
class Settings::Recruitment::EmailTemplatesGrid
include Datagrid
scope do
EmailTemplate.order(updated_at: :desc)
end
column(:name, html: true, order: false, class: "w-100") do |model|
link_to model.name, settings_recruitment_email_template_path(model.id)
end
column(... |
github | freeats/freeats | https://github.com/freeats/freeats | app/misc/rodauth_main.rb | Ruby | mit | 45 | main | 14,412 | # frozen_string_literal: true
require "sequel/core"
# https://rodauth.jeremyevans.net/rdoc/files/doc/create_account_rdoc.html
# https://rodauth.jeremyevans.net/rdoc/files/doc/guides/registration_field_rdoc.html
module CreateAccount
extend ActiveSupport::Concern
MAILER_ENABLED = ENV.fetch("EMAIL_NOTIFICATIONS", "d... |
github | freeats/freeats | https://github.com/freeats/freeats | app/misc/rodauth_app.rb | Ruby | mit | 45 | main | 440 | # frozen_string_literal: true
# rubocop:disable Style/MethodCallWithArgsParentheses
class RodauthApp < Rodauth::Rails::App
configure RodauthMain
route do |r|
rodauth.load_memory # autologin remembered users
# Ignore "remember" plugin's routes since we don't need them right now.
r.is "remember" do
... |
github | freeats/freeats | https://github.com/freeats/freeats | app/controllers/rodauth_controller.rb | Ruby | mit | 45 | main | 2,952 | # frozen_string_literal: true
class RodauthController < ApplicationController
layout "ats/application"
# used by Rodauth for rendering views, CSRF protection, and running any
# registered action callbacks and rescue_from handlers
before_action :validate_and_set_tokens, only: %i[invite accept_invite]
before_... |
github | freeats/freeats | https://github.com/freeats/freeats | app/controllers/note_threads_controller.rb | Ruby | mit | 45 | main | 1,688 | # frozen_string_literal: true
class NoteThreadsController < AuthorizedController
before_action :set_note_thread
before_action :set_all_active_members, only: :update
before_action -> { authorize!(@note_thread) }, only: %i[update]
def update
@note_thread.update_visibility_settings(thread_params, current_mem... |
github | freeats/freeats | https://github.com/freeats/freeats | app/controllers/devops_authentication_controller.rb | Ruby | mit | 45 | main | 329 | # frozen_string_literal: true
class DevopsAuthenticationController < ActionController::Base # rubocop:disable Rails/ApplicationController
include ErrorHandler
http_basic_authenticate_with(
name: ENV.fetch("SUPERUSER_NAME", "devops"),
password: ENV.fetch("SUPERUSER_PASSWORD", SecureRandom.alphanumeric(10))... |
github | freeats/freeats | https://github.com/freeats/freeats | app/controllers/application_controller.rb | Ruby | mit | 45 | main | 2,592 | # frozen_string_literal: true
class ApplicationController < ActionController::Base
include ErrorHandler
PRIVACY_LINK = ENV.fetch("PRIVACY_LINK", nil)
TOS_LINK = ENV.fetch("TOS_LINK", nil)
before_action :set_sentry_account_context
before_action :set_sentry_context
before_action :set_selector_id_for_page
... |
github | freeats/freeats | https://github.com/freeats/freeats | app/controllers/authorized_controller.rb | Ruby | mit | 45 | main | 1,391 | # frozen_string_literal: true
class AuthorizedController < ApplicationController
set_current_tenant_through_filter
before_action :authenticate
before_action :set_tenant
before_action :set_navbar_variables,
unless: -> {
request.format.json? || request.format.js? ||
... |
github | freeats/freeats | https://github.com/freeats/freeats | app/controllers/notes_controller.rb | Ruby | mit | 45 | main | 9,881 | # frozen_string_literal: true
class NotesController < AuthorizedController
include Dry::Monads[:result]
before_action :set_note, only: %i[update destroy show_edit_view show_show_view
add_reaction remove_reaction]
before_action :set_all_active_members,
only: %i... |
github | freeats/freeats | https://github.com/freeats/freeats | app/controllers/ats/placements_controller.rb | Ruby | mit | 45 | main | 9,265 | # frozen_string_literal: true
class ATS::PlacementsController < AuthorizedController
include Dry::Monads[:result]
layout "ats/application"
before_action :set_placement, only: %i[destroy change_status change_stage]
before_action :authorize!, only: %i[create]
before_action -> { authorize!(@placement) },
... |
github | freeats/freeats | https://github.com/freeats/freeats | app/controllers/ats/dashboard_controller.rb | Ruby | mit | 45 | main | 1,656 | # frozen_string_literal: true
class ATS::DashboardController < AuthorizedController
layout "ats/application"
before_action { @nav_item = :dashboard }
before_action { authorize! :dashboard }
def index
authorize! :dashboard
@dashboard_positions_grid =
ATS::DashboardPositionsGrid.new do |scope|
... |
github | freeats/freeats | https://github.com/freeats/freeats | app/controllers/ats/members_controller.rb | Ruby | mit | 45 | main | 3,786 | # frozen_string_literal: true
class ATS::MembersController < AuthorizedController
include Dry::Monads[:result]
layout "ats/application"
before_action { @nav_item = :team }
before_action :authorize!
def index
@team_grid = ATS::TeamGrid.new(current_member:)
end
def deactivate
account = Account.... |
github | freeats/freeats | https://github.com/freeats/freeats | app/controllers/ats/quick_search_controller.rb | Ruby | mit | 45 | main | 2,320 | # frozen_string_literal: true
class ATS::QuickSearchController < AuthorizedController
COUNT_LIMIT = 100
before_action { authorize! :quick_search }
def index
case params[:searching_for]
when "candidate"
search_candidates
when "position"
search_positions
end
render partial: "opti... |
github | freeats/freeats | https://github.com/freeats/freeats | app/controllers/ats/scorecard_templates_controller.rb | Ruby | mit | 45 | main | 2,929 | # frozen_string_literal: true
class ATS::ScorecardTemplatesController < AuthorizedController
include Dry::Monads[:result]
layout "ats/application"
before_action :set_scorecard_template, only: %i[show edit update destroy]
before_action :authorize!, only: %i[new create]
before_action -> { authorize!(@scoreca... |
github | freeats/freeats | https://github.com/freeats/freeats | app/controllers/ats/email_threads_controller.rb | Ruby | mit | 45 | main | 754 | # frozen_string_literal: true
class ATS::EmailThreadsController < AuthorizedController
include Dry::Monads[:result]
before_action :authorize!
def fetch_messages
email_thread = EmailThread.find(params[:email_thread_id])
collection =
EmailMessage
.with_addresses
.where(email_thread_id: ... |
github | freeats/freeats | https://github.com/freeats/freeats | app/controllers/ats/scorecards_controller.rb | Ruby | mit | 45 | main | 4,110 | # frozen_string_literal: true
class ATS::ScorecardsController < AuthorizedController
include Dry::Monads[:result]
layout "ats/application"
before_action :set_scorecard, only: %i[show edit update destroy]
before_action -> { authorize!(@scorecard) },
only: %i[show edit update destroy]
before_... |
github | freeats/freeats | https://github.com/freeats/freeats | app/controllers/ats/positions_controller.rb | Ruby | mit | 45 | main | 13,052 | # frozen_string_literal: true
class ATS::PositionsController < AuthorizedController
include Dry::Monads[:result]
layout "ats/application"
TABS = %w[
Info
Pipeline
Tasks
Activities
].freeze
ACTIVITIES_PAGINATION_LIMIT = 25
BATCH_SIZE_OF_PLACEMENTS_PER_COLUMN = 15
before_action { @nav_it... |
github | freeats/freeats | https://github.com/freeats/freeats | app/controllers/ats/position_stages_controller.rb | Ruby | mit | 45 | main | 2,276 | # frozen_string_literal: true
class ATS::PositionStagesController < AuthorizedController
include Dry::Monads[:result]
before_action :set_position_stage, only: :destroy
before_action -> { authorize!(@position_stage) }, only: %i[destroy]
def destroy
partial_name = "delete_stage_modal"
if params[partial... |
github | freeats/freeats | https://github.com/freeats/freeats | app/controllers/ats/lookbook_controller.rb | Ruby | mit | 45 | main | 1,012 | # frozen_string_literal: true
class ATS::LookbookController < AuthorizedController
before_action { authorize! :lookbook }
def fetch_options_for_select_component_preview
candidate = Struct.new(:id, :name, :candidate_emails)
candidates = [
candidate.new(1, "John Doe", ["john@doe.com"]),
candidat... |
github | freeats/freeats | https://github.com/freeats/freeats | app/controllers/ats/compose_controller.rb | Ruby | mit | 45 | main | 3,033 | # frozen_string_literal: true
class ATS::ComposeController < AuthorizedController
include SchemaHelper
before_action { authorize! :compose }
FROM_ADDRESS = ENV.fetch("NOTIFICATION_ADDRESS", nil)
def new
candidate = Candidate.find(params[:candidate_id])
candidate_email_addresses = candidate.all_emails... |
github | freeats/freeats | https://github.com/freeats/freeats | app/controllers/ats/candidates_controller.rb | Ruby | mit | 45 | main | 25,569 | # frozen_string_literal: true
class ATS::CandidatesController < AuthorizedController
include Dry::Monads[:result]
layout "ats/application"
ACTIVITIES_PAGINATION_LIMIT = 25
DEFAULT_TAB_PAGINATION_LIMIT = 10
TABS = %w[Info Tasks Emails Scorecards Files Activities].freeze
INFO_CARDS =
{
contact_in... |
github | freeats/freeats | https://github.com/freeats/freeats | app/controllers/ats/tasks_controller.rb | Ruby | mit | 45 | main | 8,354 | # frozen_string_literal: true
class ATS::TasksController < AuthorizedController
include Dry::Monads[:result]
layout "ats/application"
before_action { @nav_item = :tasks }
before_action :set_task, only: %i[show show_modal update update_status]
before_action :set_taskable, only: %i[new new_modal]
before_ac... |
github | freeats/freeats | https://github.com/freeats/freeats | app/controllers/settings/recruitment/sources_controller.rb | Ruby | mit | 45 | main | 2,755 | # frozen_string_literal: true
class Settings::Recruitment::SourcesController < AuthorizedController
include Dry::Monads[:result]
layout "ats/application"
before_action { @nav_item = :settings }
before_action { authorize! :sources }
before_action :active_tab
before_action :all_sources, only: :index
def... |
github | freeats/freeats | https://github.com/freeats/freeats | app/controllers/settings/recruitment/disqualify_reasons_controller.rb | Ruby | mit | 45 | main | 3,049 | # frozen_string_literal: true
class Settings::Recruitment::DisqualifyReasonsController < AuthorizedController
include Dry::Monads[:result]
layout "ats/application"
before_action { @nav_item = :settings }
before_action { authorize! :disqualify_reasons }
before_action :active_tab
def index
@disqualify... |
github | freeats/freeats | https://github.com/freeats/freeats | app/controllers/settings/recruitment/email_templates_controller.rb | Ruby | mit | 45 | main | 1,701 | # frozen_string_literal: true
class Settings::Recruitment::EmailTemplatesController < AuthorizedController
layout "ats/application"
before_action { @nav_item = :settings }
before_action { authorize! :email_templates }
before_action :active_tab
def index
@email_templates_grid = Settings::Recruitment::Em... |
github | freeats/freeats | https://github.com/freeats/freeats | app/controllers/settings/company/general_profiles_controller.rb | Ruby | mit | 45 | main | 718 | # frozen_string_literal: true
class Settings::Company::GeneralProfilesController < AuthorizedController
layout "ats/application"
before_action { @nav_item = :settings }
before_action { authorize! :general_profile }
before_action :active_tab
def show; end
def update
if current_tenant.update(name: par... |
github | freeats/freeats | https://github.com/freeats/freeats | app/controllers/settings/personal/profiles_controller.rb | Ruby | mit | 45 | main | 2,881 | # frozen_string_literal: true
class Settings::Personal::ProfilesController < AuthorizedController
layout "ats/application"
include Dry::Monads[:result]
before_action { @nav_item = :settings }
before_action { authorize! :profile }
before_action :set_partial_variables, only: :show
before_action :set_gon_va... |
github | freeats/freeats | https://github.com/freeats/freeats | app/controllers/api/v1/positions_controller.rb | Ruby | mit | 45 | main | 517 | # frozen_string_literal: true
class API::V1::PositionsController < AuthorizedController
before_action :authorize!
def fetch_positions
positions =
Position
.where.not(status: :closed)
dataset =
positions
.search_by_name(params[:q])
.order(:status, :name)
.limit(20)
r... |
github | freeats/freeats | https://github.com/freeats/freeats | app/controllers/api/v1/documents_controller.rb | Ruby | mit | 45 | main | 2,634 | # frozen_string_literal: true
class API::V1::DocumentsController < AuthorizedController
include Dry::Monads[:result]
skip_before_action :verify_authenticity_token
before_action { authorize! :document }
around_action :handle_error
def create
url = AccountLink.new(params[:url]).normalize
params_hash =... |
github | freeats/freeats | https://github.com/freeats/freeats | app/controllers/api/v1/email_templates_controller.rb | Ruby | mit | 45 | main | 975 | # frozen_string_literal: true
class API::V1::EmailTemplatesController < AuthorizedController
before_action :authorize!
def show
candidate = Candidate.find(params[:candidate_id])
template = EmailTemplate.find(params[:id])
template_attributes = LiquidTemplate.extract_attributes_from(
current_memb... |
github | freeats/freeats | https://github.com/freeats/freeats | app/controllers/api/v1/locations_controller.rb | Ruby | mit | 45 | main | 1,330 | # frozen_string_literal: true
# Does not belong to a specific model, provides API for manipulating cities and countries
class API::V1::LocationsController < AuthorizedController
before_action :authorize!
before_action :check_minimum_query_length
ALLOWED_LOCATION_TYPES = %w[city country].freeze
def fetch_loca... |
github | freeats/freeats | https://github.com/freeats/freeats | app/controllers/career_site/positions_controller.rb | Ruby | mit | 45 | main | 5,763 | # frozen_string_literal: true
class CareerSite::PositionsController < ApplicationController
include Dry::Monads[:result]
set_current_tenant_through_filter
layout "career_site/application"
before_action :set_cors_headers
before_action :set_gon_variables
before_action :set_locale
protect_from_forgery wit... |
github | freeats/freeats | https://github.com/freeats/freeats | app/controllers/concerns/error_handler.rb | Ruby | mit | 45 | main | 5,968 | # frozen_string_literal: true
module ErrorHandler
extend ActiveSupport::Concern
def render403
message = t("errors.403.heading")
status = :forbidden
respond_to do |format|
format.html do
render "errors/403", layout: "ats/application", status:
end
format.json do
render ... |
github | freeats/freeats | https://github.com/freeats/freeats | app/jobs/synchronize_email_messages_for_email_job.rb | Ruby | mit | 45 | main | 704 | # frozen_string_literal: true
class SynchronizeEmailMessagesForEmailJob < ApplicationJob
self.queue_adapter = :solid_queue
limits_concurrency key: ->(member_id, addresses) { { member_id => addresses } }
queue_as :sync_emails
def perform(member_id, addresses)
member = Member.find(member_id)
imap_acco... |
github | freeats/freeats | https://github.com/freeats/freeats | app/jobs/receive_email_message_updates_for_member_job.rb | Ruby | mit | 45 | main | 413 | # frozen_string_literal: true
class ReceiveEmailMessageUpdatesForMemberJob < ApplicationJob
self.queue_adapter = :solid_queue
limits_concurrency key: ->(member_id) { member_id }
queue_as :high
def perform(member_id)
member = Member.find(member_id)
ActsAsTenant.with_tenant(member.tenant) do
Ema... |
github | freeats/freeats | https://github.com/freeats/freeats | app/jobs/scheduler/receive_email_message_updates_job.rb | Ruby | mit | 45 | main | 384 | # frozen_string_literal: true
class Scheduler::ReceiveEmailMessageUpdatesJob < ApplicationJob
self.queue_adapter = :solid_queue
limits_concurrency key: "receive_email_message_updates"
queue_as :scheduler
def perform
Member.with_linked_email_service.pluck(:id).each do |member_id|
ReceiveEmailMessag... |
github | freeats/freeats | https://github.com/freeats/freeats | app/validation_schemas/email_message_schema.rb | Ruby | mit | 45 | main | 541 | # frozen_string_literal: true
class EmailMessageSchema < ApplicationSchema
include EmailRegexp
define do
required(:from).filled(:string).maybe(format?: EMAIL_REGEXP)
required(:to).filled(array[:string]).each(format?: EMAIL_REGEXP)
optional(:cc).maybe(array[:string]).each(format?: EMAIL_REGEXP)
opt... |
github | freeats/freeats | https://github.com/freeats/freeats | app/channels/application_cable/channel.rb | Ruby | mit | 45 | main | 203 | # frozen_string_literal: true
# rubocop:disable Style/ClassAndModuleChildren
module ApplicationCable
class Channel < ActionCable::Channel::Base
end
end
# rubocop:enable Style/ClassAndModuleChildren |
github | freeats/freeats | https://github.com/freeats/freeats | app/channels/application_cable/connection.rb | Ruby | mit | 45 | main | 209 | # frozen_string_literal: true
# rubocop:disable Style/ClassAndModuleChildren
module ApplicationCable
class Connection < ActionCable::Connection::Base
end
end
# rubocop:enable Style/ClassAndModuleChildren |
github | freeats/freeats | https://github.com/freeats/freeats | app/queries/base_queries.rb | Ruby | mit | 45 | main | 4,318 | # frozen_string_literal: true
class BaseQueries
FILES_PATH = "app/queries"
VARIABLE_PATTERN = "(?<!:)<prefix>\\w+\\b"
PREFIX_PATTERN = /^-- prefix: (.+)$/
DEFAULT_PREFIX = ":"
DATE_RANGE_TYPES = [Date, DateTime, ActiveSupport::TimeWithZone, NilClass].freeze
class Argument # rubocop:disable Style/ClassAnd... |
github | freeats/freeats | https://github.com/freeats/freeats | app/mailers/member_note_mailer.rb | Ruby | mit | 45 | main | 1,347 | # frozen_string_literal: true
class MemberNoteMailer < ApplicationMailer
before_action do
@note = params[:note]
@model = @note.note_thread.notable
@model_name = @model.try(:full_name) || @model.name
@task_prefix = " on #{@model.taskable_name}" if @model.is_a?(Task) && @model.taskable.present?
@r... |
github | freeats/freeats | https://github.com/freeats/freeats | app/mailers/rodauth_mailer.rb | Ruby | mit | 45 | main | 1,094 | # frozen_string_literal: true
class RodauthMailer < ApplicationMailer
default to: -> { @rodauth.email_to }
def reset_password(name, account_id, key)
@rodauth = rodauth(name, account_id) { @reset_password_key_value = key }
@account = @rodauth.rails_account
mail(subject: @rodauth.email_subject_prefix +... |
github | freeats/freeats | https://github.com/freeats/freeats | app/mailers/member_invite_mailer.rb | Ruby | mit | 45 | main | 255 | # frozen_string_literal: true
class MemberInviteMailer < ApplicationMailer
def invitation
@invite_token = params[:invite_token]
@company_name = params[:company_name]
mail(subject: "Invitation to join #{@company_name} on FreeATS")
end
end |
github | freeats/freeats | https://github.com/freeats/freeats | app/mailers/application_mailer.rb | Ruby | mit | 45 | main | 1,805 | # frozen_string_literal: true
class ApplicationMailer < ActionMailer::Base
DEFAULT_FROM = ENV.fetch("MAILER_DEFAULT_FROM", "doreply@#{ENV.fetch('HOST_URL', 'example')}.com")
helper_method :account_name
helper :mailer
helper :main
default from: DEFAULT_FROM,
to: -> { @to },
cc: -> { @cc }... |
github | freeats/freeats | https://github.com/freeats/freeats | app/mailers/interceptors/normalize_mailer_content_interceptor.rb | Ruby | mit | 45 | main | 255 | # frozen_string_literal: true
class Interceptors::NormalizeMailerContentInterceptor
def self.delivering_email(message)
message.subject = message.subject.unicode_normalize(:nfd)
message.body = message.body.to_s.unicode_normalize(:nfd)
end
end |
github | freeats/freeats | https://github.com/freeats/freeats | scripts/import_from_csv/import_from_csv.rb | Ruby | mit | 45 | main | 1,476 | # frozen_string_literal: true
# This script reads data from the csv file and
# creates records in the DB for the model which was passed.
# Columns in csv file should have the same name as the model's fields.
# This script is useful when need to add data from production to development.
# How to use:
# 1. Prepare csv f... |
github | freeats/freeats | https://github.com/freeats/freeats | lib/render_error_exception_for_tests.rb | Ruby | mit | 45 | main | 234 | # frozen_string_literal: true
# This exception is fired by `render_error` when it is a testing environment. This makes tests
# actively anticipate the error in an explicit way.
class RenderErrorExceptionForTests < StandardError; end |
github | freeats/freeats | https://github.com/freeats/freeats | lib/tabler_icons.rb | Ruby | mit | 45 | main | 1,926 | # frozen_string_literal: true
require "nokogiri"
# Original code from https://github.com/owaiswiz/tabler_icons_ruby
module TablerIcons
class Error < StandardError; end
def render_icon(
icon_name,
icon_type: "outline",
size: nil,
color: nil,
class: nil,
stroke_width: nil,
**options
)... |
github | freeats/freeats | https://github.com/freeats/freeats | lib/rubocop/cop/minitest/literal_as_expected_argument.rb | Ruby | mit | 45 | main | 1,362 | # frozen_string_literal: true
# Enforces correct order of actual and
# expected arguments for `assert_equal`.
#
# Prefer to place the actual value on the left and the expected value on the right,
# the reverse of the default Minitest setting.
#
# @example
# # good
# assert_equal foo, 2
# assert_equal foo, [1, 2]... |
github | freeats/freeats | https://github.com/freeats/freeats | lib/tasks/locations.rake | Ruby | mit | 45 | main | 5,751 | # frozen_string_literal: true
require "zip"
namespace :locations do
task fill_in_locations: :environment do
if ActiveRecord::Base.connection.table_exists?("location_aliases")
ActiveRecord::Base.connection.execute(
"TRUNCATE TABLE location_aliases RESTART IDENTITY CASCADE"
)
end
if A... |
github | freeats/freeats | https://github.com/freeats/freeats | lib/tasks/auth.rake | Ruby | mit | 45 | main | 1,232 | # frozen_string_literal: true
namespace :auth do
# Documented 👍
task :setup_account, %i[email] => :environment do |_task, args|
email = args.fetch(:email)
puts "Setting up an account for #{email}"
account = Account.find_or_create_by!(email:, name: email.split("@").first)
Member.create!(account:, a... |
github | freeats/freeats | https://github.com/freeats/freeats | lib/tasks/tenants.rake | Ruby | mit | 45 | main | 649 | # frozen_string_literal: true
namespace :tenants do
task populate_slugs: :environment do
Log.info("Populating slugs...")
Tenant.find_each do |tenant|
tenant.slug = nil
tenant.save!
Log.info("Generated tenant slug: #{tenant.slug}")
rescue StandardError => e
Log.error("Tenant #{ten... |
github | freeats/freeats | https://github.com/freeats/freeats | config/puma.rb | Ruby | mit | 45 | main | 1,705 | # frozen_string_literal: true
# This configuration file will be evaluated by Puma. The top-level methods that
# are invoked here are part of Puma's configuration DSL. For more information
# about methods provided by the DSL, see https://puma.io/puma/Puma/DSL.html.
# Puma can serve each request in a thread from an int... |
github | freeats/freeats | https://github.com/freeats/freeats | config/routes.rb | Ruby | mit | 45 | main | 6,261 | # frozen_string_literal: true
Rails.application.routes.draw do
root to: "ats/dashboard#index"
match "/403", to: "application#render403", via: :all
match "/404", to: "application#render404", via: :all
match "/422", to: "application#render422", via: :all
match "/500", to: "application#render500", via: :all
... |
github | freeats/freeats | https://github.com/freeats/freeats | config/application.rb | Ruby | mit | 45 | main | 1,894 | # frozen_string_literal: true
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)
# rubocop:disable Style/ClassAndModuleChildren
module ATS
class Application < Rails::Applicatio... |
github | freeats/freeats | https://github.com/freeats/freeats | config/initializers/recaptcha.rb | Ruby | mit | 45 | main | 294 | # frozen_string_literal: true
Recaptcha.configure do |config|
config.site_key = ENV.fetch("RECAPTCHA_V2_SITE_KEY", nil)
config.secret_key = ENV.fetch("RECAPTCHA_V2_SECRET_KEY", nil)
end
module Recaptcha
ENABLED = configuration.site_key.present? && configuration.secret_key.present?
end |
github | freeats/freeats | https://github.com/freeats/freeats | config/initializers/friendly_id.rb | Ruby | mit | 45 | main | 4,070 | # frozen_string_literal: true
# FriendlyId Global Configuration
#
# Use this to set up shared configuration options for your entire application.
# Any of the configuration options shown here can also be applied to single
# models by passing arguments to the `friendly_id` class method or defining
# methods in your mode... |
github | freeats/freeats | https://github.com/freeats/freeats | config/initializers/time_formats.rb | Ruby | mit | 45 | main | 728 | # frozen_string_literal: true
Time::DATE_FORMATS[:date] = "%d.%m.%Y" # DD.MM.YYYY
Date::DATE_FORMATS[:date] = "%d.%m.%Y" # DD.MM.YYYY
Time::DATE_FORMATS[:monthyear] = "%m.%Y" # MM.YYYY
Date::DATE_FORMATS[:monthyear] = "%m.%Y" # MM.YYYY
Time::DATE_FORMATS[:daymonth] = "%d.%m" # DD.MM
Date::DATE_FORMATS[:daymonth] = "%d... |
github | freeats/freeats | https://github.com/freeats/freeats | config/initializers/error_subscriber.rb | Ruby | mit | 45 | main | 303 | # frozen_string_literal: true
class ErrorSubscriber
def report(error, handled:, severity:, context:, source: nil)
return if handled
ATS::Logger
.new(where: source)
.external_log(
error,
extra: {
context:,
severity:
}
)
end
end |
github | freeats/freeats | https://github.com/freeats/freeats | config/initializers/sentry.rb | Ruby | mit | 45 | main | 529 | # frozen_string_literal: true
Sentry.init do |config|
config.dsn = ENV.fetch("SENTRY_DSN", "dummy")
config.breadcrumbs_logger = [:active_support_logger]
config.traces_sample_rate = 0.5
# Scrape values: user ip, user cookie, request body.
config.send_default_pii = true
# List all environments on which yo... |
github | freeats/freeats | https://github.com/freeats/freeats | config/initializers/rails_admin.rb | Ruby | mit | 45 | main | 2,780 | # frozen_string_literal: true
# TODO: replace with require
require_relative "../../app/lib/rails_admin/config/actions/delete_account"
# require "rails_admin/config/actions/delete_account"
RailsAdmin::Config::Actions.register(RailsAdmin::Config::Actions::DeleteAccount)
RailsAdmin.config do |config|
config.asset_sou... |
github | freeats/freeats | https://github.com/freeats/freeats | config/initializers/inflections.rb | Ruby | mit | 45 | main | 844 | # frozen_string_literal: true
# Be sure to restart your server when you modify this file.
# Add new inflection rules using the following format. Inflections
# are locale specific, and you may define rules for as many different
# locales as you wish. All of these examples are active by default:
# ActiveSupport::Inflec... |
github | freeats/freeats | https://github.com/freeats/freeats | config/environments/test.rb | Ruby | mit | 45 | main | 3,420 | # frozen_string_literal: true
require "active_support/core_ext/integer/time"
require "acts_as_tenant/test_tenant_middleware"
# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test s... |
github | freeats/freeats | https://github.com/freeats/freeats | config/environments/staging.rb | Ruby | mit | 45 | main | 337 | # frozen_string_literal: true
require File.expand_path("production.rb", __dir__)
Rails.application.configure do
# Here override any defaults
# config.serve_static_files = true
config.force_ssl = false
config.assume_ssl = false
# Raises error for missing translations.
config.i18n.raise_on_missing_transla... |
github | freeats/freeats | https://github.com/freeats/freeats | config/environments/development.rb | Ruby | mit | 45 | main | 3,832 | # frozen_string_literal: true
require "active_support/core_ext/integer/time"
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 any time
# it changes. This slows down response ti... |
github | freeats/freeats | https://github.com/freeats/freeats | config/environments/production.rb | Ruby | mit | 45 | main | 5,498 | # frozen_string_literal: true
require "active_support/core_ext/integer/time"
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests.
config.enable_reloading = false
# Eager load code on boot. This eager loads... |
github | jakewilkins/apptokit | https://github.com/jakewilkins/apptokit | share/ruby/setup.rb | Ruby | mit | 45 | main | 1,090 | # frozen_string_literal: true
require 'pathname'
require 'openssl'
require 'yaml'
require 'uri'
module Apptokit
autoload :JWT, "apptokit/jwt"
VERSION = '0.1.0'
RELOAD_ENV_EXIT_CODE = 234
class ApptokitError < RuntimeError
attr_reader :type
def initialize(msg, type: nil)
@type = type
su... |
github | jakewilkins/apptokit | https://github.com/jakewilkins/apptokit | share/ruby/apptokit/installation_token.rb | Ruby | mit | 45 | main | 2,170 | # frozen_string_literal: true
require 'apptokit/jwt'
require 'json'
require "apptokit/key_cache"
module Apptokit
class InstallationToken
def self.generate(installation_id: nil, skip_cache: false)
new(installation_id: installation_id, skip_cache: skip_cache).tap(&:generate)
end
attr_accessor :tok... |
github | jakewilkins/apptokit | https://github.com/jakewilkins/apptokit | share/ruby/apptokit/http.rb | Ruby | mit | 45 | main | 2,059 | # frozen_string_literal: true
require 'net/http'
module Apptokit
module HTTP
module_function
def requests
return @requests if defined?(@requests)
@requests = []
end
def get(path, auth: nil, config: Apptokit.config, type: :api)
uri = path_to_uri(path, config, type: type)
N... |
github | jakewilkins/apptokit | https://github.com/jakewilkins/apptokit | share/ruby/apptokit/manifest_app.rb | Ruby | mit | 45 | main | 2,744 | # frozen_string_literal: true
require 'base64'
require 'json'
require 'apptokit/manifest_app/creator'
require 'apptokit/manifest_app/installer'
module Apptokit
module ManifestApp
CACHE_DIR = Apptokit::ConfigLoader::HOME_DIR_CONF_DIR.join("manifest_apps")
module_function
def load_from_cache(conf_loader... |
github | jakewilkins/apptokit | https://github.com/jakewilkins/apptokit | share/ruby/apptokit/jwt.rb | Ruby | mit | 45 | main | 913 | # frozen_string_literal: true
require "jwt"
module Apptokit
class JWT
attr_accessor :token
private :token=
def self.generate(iat: nil, exp: nil, app_id: nil)
new(iat: iat, exp: exp, app_id: app_id).tap(&:generate)
end
def initialize(iat: nil, exp: nil, app_id: nil)
@iat, @exp, @app... |
github | jakewilkins/apptokit | https://github.com/jakewilkins/apptokit | share/ruby/apptokit/user_token.rb | Ruby | mit | 45 | main | 5,792 | # frozen_string_literal: true
require 'net/http'
require 'apptokit/key_cache'
require 'apptokit/callback_server'
module Apptokit
class UserToken
def self.generate(auto_open: true, code: nil, force: false, user: nil)
new(auto_open: auto_open, code: code, skip_cache: force, user: user).tap(&:generate)
e... |
github | jakewilkins/apptokit | https://github.com/jakewilkins/apptokit | share/ruby/apptokit/callback_server.rb | Ruby | mit | 45 | main | 4,575 | # frozen_string_literal: true
require 'webrick'
module Apptokit
class CallbackServer
AUTHORIZE_RESPONSE_BODY = <<-HTML
<html>
<head>
<title>GitHub App Authorized</title>
<style>
#outer {
width: 100%;
/* Firefox */
display: -moz-box;
... |
github | jakewilkins/apptokit | https://github.com/jakewilkins/apptokit | share/ruby/apptokit/key_cache.rb | Ruby | mit | 45 | main | 2,271 | # frozen_string_literal: true
require 'json'
require 'base64'
require 'date'
module Apptokit
class KeyCache
attr_reader :db, :db_path
def initialize(path: nil)
@db_path = path || db_file_path
@db = load_persisted_db || {}
end
def keys
db.keys
end
def get(key, ignore_expi... |
github | jakewilkins/apptokit | https://github.com/jakewilkins/apptokit | share/ruby/apptokit/configuration.rb | Ruby | mit | 45 | main | 3,481 | # frozen_string_literal: true
module Apptokit
class Configuration
SHARE_DIR = Pathname.new(__FILE__).dirname.dirname.dirname
YAML_OPTS = %w(
private_key_path
private_key_path_glob
app_id
webhook_secret
installation_id
github_url
github_api_url
client_id
... |
github | jakewilkins/apptokit | https://github.com/jakewilkins/apptokit | share/ruby/apptokit/config_loader.rb | Ruby | mit | 45 | main | 5,409 | # frozen_string_literal: true
require 'pathname'
require 'openssl'
require 'yaml'
require 'uri'
module Apptokit
class ConfigLoader
HOME_DIR_CONF_PATH = Pathname.new(ENV["HOME"]).join(".config/apptokit.yml")
HOME_DIR_CONF_DIR = Pathname.new(ENV["HOME"]).join(".config/apptokit")
PROJECT_DIR_CONF_PATH = Pa... |
github | jakewilkins/apptokit | https://github.com/jakewilkins/apptokit | share/ruby/apptokit/manifest_app/creator.rb | Ruby | mit | 45 | main | 4,667 | # frozen_string_literal: true
require 'erb'
require 'apptokit/callback_server'
module Apptokit
module ManifestApp
class Creator
FORM_TEMPLATE = ERB.new(
Configuration::SHARE_DIR.join("create_manifest_app.html.erb").read
)
attr_accessor :code
attr_reader :config, :mutex, :conditi... |
github | jakewilkins/apptokit | https://github.com/jakewilkins/apptokit | share/ruby/apptokit/manifest_app/installer.rb | Ruby | mit | 45 | main | 1,360 | # frozen_string_literal: true
module Apptokit
module ManifestApp
module Installer
module_function
def call(url:, name:, conf_loader:)
install_url = "#{url}/installations/new"
Apptokit.open(install_url)
sleep 2
installation = nil
count = 0
Apptokit.c... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.