This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.admin ||= {} | |
$.extend window.admin, | |
lightbox: | |
show: (options) -> | |
options = {} unless options | |
buttonDone = options.buttonDone or "Done" | |
buttonCancel = options.buttonCancel or "Cancel" | |
focus = options.focus or "input" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 :class => "blank_slate_container", :id => "dashboard_default_message" do | |
# span :class => "blank_slate" do | |
# span "Welcome to Active Admin. This is the default dashboard page." | |
# small "To add dashboard sections, checkout 'app/admin/dashboards.rb'" | |
# end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ThreadPool | |
attr_accessor :threads, :max_size, :wait_time_to_free, :name | |
def initialize max_size=4 | |
@max_size = max_size | |
@threads = [] | |
@wait_time_to_free = 0.1 | |
end | |
def start *args, &block |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ApplicationSerializer | |
include FastJsonapi::ObjectSerializer | |
#cache_options enabled: true, cache_length: 1.hour | |
def to_h | |
data = serializable_hash | |
if data[:data].is_a? Hash | |
data[:data][:attributes] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ApplicationJob < ActiveJob::Base | |
include ::PrivateInspector | |
include ::SanitizerHelper | |
# Automatically retry jobs that encountered a deadlock | |
# retry_on ActiveRecord::Deadlocked | |
# Most jobs are safe to ignore if the underlying records are no longer available | |
# discard_on ActiveJob::DeserializationError |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# frozen_string_literal: true | |
module JsonResponse | |
extend ActiveSupport::Concern | |
included do | |
end | |
module ClassMethods | |
def api_action action_name, &block |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# frozen_string_literal: true | |
require 'time_difference' | |
module JsonResponse | |
extend ActiveSupport::Concern | |
LOGGER = Logger.new("#{Rails.root}/log/fast_jsonapi.log") | |
included do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# frozen_string_literal: true | |
class ApplicationDatatable | |
delegate :params, :link_to, :strip_tags, :local_time_ago, :local_date, :current_user, :avatar, | |
:avatar_link, :local_time, :admin?, to: :@view | |
def initialize view, options={} | |
@view = view | |
@options = options |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# frozen_string_literal: true | |
module Searchable | |
module ApplicationRecordAddition | |
def search_on *method_names, &import_block | |
send :include, ::Searchable | |
scope :search_import, import_block if import_block |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# frozen_string_literal: true | |
module TextSanitizer | |
extend ActiveSupport::Concern | |
SKIP_COLUMNS = %w{encrypted_password confirmation_token current_sign_in_ip expires_at image image_url last_sign_in_ip refresh_token} | |
included do | |
include ::SanitizerHelper | |
extend ::SanitizerHelper |
NewerOlder