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
ruby-no-kai/sponsor-app
https://github.com/ruby-no-kai/sponsor-app
app/resources/expense_report_resource.rb
Ruby
mit
19
master
550
# frozen_string_literal: true class ExpenseReportResource include Alba::Resource attributes :id, :status, :total_amount, :total_tax_amount, :revision, :created_at, :updated_at has_many :line_items, resource: ExpenseLineItemResource, key: 'line_items' attribute :files do |report| report.sponsorship.expen...
github
ruby-no-kai/sponsor-app
https://github.com/ruby-no-kai/sponsor-app
app/controllers/expense_files_controller.rb
Ruby
mit
19
master
1,291
# frozen_string_literal: true class ExpenseFilesController < ApplicationController include AssetFileSessionable before_action :require_sponsorship_session before_action :set_conference before_action :set_asset_file, only: [:show, :update, :destroy, :initiate_update] def create @asset_file = ExpenseFile...
github
ruby-no-kai/sponsor-app
https://github.com/ruby-no-kai/sponsor-app
app/controllers/expense_line_items_controller.rb
Ruby
mit
19
master
3,050
# frozen_string_literal: true class ExpenseLineItemsController < ApplicationController before_action :require_sponsorship_session before_action :set_conference before_action :require_custom_sponsorship before_action :set_expense_report before_action :set_line_item, only: [:update, :destroy] def create ...
github
ruby-no-kai/sponsor-app
https://github.com/ruby-no-kai/sponsor-app
app/controllers/exhibitions_controller.rb
Ruby
mit
19
master
1,798
# frozen_string_literal: true class ExhibitionsController < ApplicationController before_action :require_sponsorship_session def new return render(status: :not_found, plain: '404') if current_sponsorship.exhibition return render(status: :not_found, plain: '404') unless current_sponsorship.booth_assigned? ...
github
ruby-no-kai/sponsor-app
https://github.com/ruby-no-kai/sponsor-app
app/controllers/broadcasts_controller.rb
Ruby
mit
19
master
676
# frozen_string_literal: true class BroadcastsController < ApplicationController before_action :require_sponsorship_session def index @conference = current_sponsorship.conference @broadcast_deliveries = BroadcastDelivery .includes(:broadcast) .where(sponsorship: current_sponsorship, broadcast...
github
ruby-no-kai/sponsor-app
https://github.com/ruby-no-kai/sponsor-app
app/controllers/expense_report_submissions_controller.rb
Ruby
mit
19
master
1,219
# frozen_string_literal: true class ExpenseReportSubmissionsController < ApplicationController before_action :require_sponsorship_session before_action :set_conference before_action :require_custom_sponsorship before_action :set_expense_report def create @expense_report.submit! SlackWebhookJob.perf...
github
ruby-no-kai/sponsor-app
https://github.com/ruby-no-kai/sponsor-app
app/controllers/sponsor_event_asset_files_controller.rb
Ruby
mit
19
master
1,316
# frozen_string_literal: true class SponsorEventAssetFilesController < ApplicationController include AssetFileSessionable before_action :require_sponsorship_session before_action :require_accepted_sponsorship before_action :set_conference before_action :set_asset_file, only: %i(show update initiate_update) ...
github
ruby-no-kai/sponsor-app
https://github.com/ruby-no-kai/sponsor-app
app/controllers/sponsorship_asset_files_controller.rb
Ruby
mit
19
master
1,529
# frozen_string_literal: true class SponsorshipAssetFilesController < ApplicationController include AssetFileSessionable before_action :set_conference before_action :set_asset_file, only: [:show, :update, :initiate_update] def show redirect_to @asset_file.download_url, allow_other_host: true end def...
github
ruby-no-kai/sponsor-app
https://github.com/ruby-no-kai/sponsor-app
app/controllers/expense_reports_controller.rb
Ruby
mit
19
master
2,213
# frozen_string_literal: true class ExpenseReportsController < ApplicationController before_action :require_sponsorship_session before_action :set_conference before_action :require_custom_sponsorship before_action :set_expense_report, only: [:show, :update, :calculate] def create @expense_report = curre...
github
ruby-no-kai/sponsor-app
https://github.com/ruby-no-kai/sponsor-app
app/controllers/conferences_controller.rb
Ruby
mit
19
master
463
# frozen_string_literal: true class ConferencesController < ApplicationController def index @conferences = Conference.application_open.publicly_visible.order(id: :asc) if @conferences.one? redirect_to user_conference_sponsorship_path(@conferences.first) elsif @conferences.empty? && current_availab...
github
ruby-no-kai/sponsor-app
https://github.com/ruby-no-kai/sponsor-app
app/controllers/sponsorships_controller.rb
Ruby
mit
19
master
5,655
# frozen_string_literal: true class SponsorshipsController < ApplicationController def show unless current_sponsorship return redirect_to new_user_conference_sponsorship_path(conference: @conference) end @sponsorship = current_sponsorship @conference = current_sponsorship&.conference raise...
github
ruby-no-kai/sponsor-app
https://github.com/ruby-no-kai/sponsor-app
app/controllers/pass_redemptions_controller.rb
Ruby
mit
19
master
511
# frozen_string_literal: true class PassRedemptionsController < ApplicationController before_action :require_sponsorship_session def index @sponsorship = current_sponsorship @conference = @sponsorship.conference raise ActiveRecord::RecordNotFound unless @conference.distributing_ticket? && @conference....
github
ruby-no-kai/sponsor-app
https://github.com/ruby-no-kai/sponsor-app
app/controllers/root_controller.rb
Ruby
mit
19
master
486
# frozen_string_literal: true class RootController < ApplicationController def index if current_available_sponsorships&.exists? redirect_to user_conferences_path return end unless current_staff session.clear request.session_options[:skip] = true @cacheable = true resp...
github
ruby-no-kai/sponsor-app
https://github.com/ruby-no-kai/sponsor-app
app/controllers/pass_retractions_controller.rb
Ruby
mit
19
master
1,797
# frozen_string_literal: true class PassRetractionsController < ApplicationController before_action :require_sponsorship_session before_action :set_conference_and_sponsorship before_action :require_pass_retraction_enabled, only: [:create] def new @retraction = find_or_prepare_retraction @pass_retracti...
github
ruby-no-kai/sponsor-app
https://github.com/ruby-no-kai/sponsor-app
app/controllers/sponsor_events_controller.rb
Ruby
mit
19
master
4,140
# frozen_string_literal: true class SponsorEventsController < ApplicationController include Rails.application.routes.url_helpers before_action :require_sponsorship_session before_action :require_event_submission_open, only: %i(new create edit update destroy) before_action :require_accepted_sponsorship befor...
github
ruby-no-kai/sponsor-app
https://github.com/ruby-no-kai/sponsor-app
app/controllers/sessions_controller.rb
Ruby
mit
19
master
1,682
# frozen_string_literal: true class SessionsController < ApplicationController def new end def create contact = Contact.find_by(kind: :primary, email: params[:email]) unless contact flash.now[:alert] = t('.no_email_found') return render :new, status: :unauthorized end set_back_to ...
github
ruby-no-kai/sponsor-app
https://github.com/ruby-no-kai/sponsor-app
app/controllers/application_controller.rb
Ruby
mit
19
master
3,665
# frozen_string_literal: true class ApplicationController < ActionController::Base before_action :set_locale before_action :populate_sentry_scope private def set_locale locale_cookie_name = Rails.application.config.x.locale_cookie_name case when params[:hl] if I18n.available_locales.include?(...
github
ruby-no-kai/sponsor-app
https://github.com/ruby-no-kai/sponsor-app
app/controllers/concerns/asset_file_sessionable.rb
Ruby
mit
19
master
857
# frozen_string_literal: true require 'active_support/concern' module AssetFileSessionable extend ActiveSupport::Concern def update @asset_file.assign_attributes(params.permit(:version_id)) @asset_file.extension = params[:extension]&.then { _1.downcase.gsub(/[^a-z0-9]/, '') } || 'unknown' @asset_fil...
github
ruby-no-kai/sponsor-app
https://github.com/ruby-no-kai/sponsor-app
app/controllers/admin/application_controller.rb
Ruby
mit
19
master
707
class Admin::ApplicationController < ::ApplicationController layout 'admin' before_action :require_staff class RestrictedAccessForbidden < StandardError; end rescue_from(RestrictedAccessForbidden) do render status: 403, plain: 'Forbidden' end private def check_staff_conference_authorization!(conferen...
github
ruby-no-kai/sponsor-app
https://github.com/ruby-no-kai/sponsor-app
app/controllers/admin/sponsorship_editing_histories_controller.rb
Ruby
mit
19
master
434
# frozen_string_literal: true module Admin class SponsorshipEditingHistoriesController < Admin::ApplicationController def index @conference = Conference.find_by!(slug: params[:conference_slug]) check_staff_conference_authorization!(@conference) @sponsorship = Sponsorship.where(conference: @conf...
github
ruby-no-kai/sponsor-app
https://github.com/ruby-no-kai/sponsor-app
app/controllers/admin/broadcasts_controller.rb
Ruby
mit
19
master
2,185
# frozen_string_literal: true module Admin class BroadcastsController < Admin::ApplicationController before_action :set_conference before_action :set_broadcast, only: %i(show edit update dispatch_delivery) def index @broadcasts = @conference.broadcasts.order(id: :desc) end def new @...
github
ruby-no-kai/sponsor-app
https://github.com/ruby-no-kai/sponsor-app
app/controllers/admin/expense_reports_controller.rb
Ruby
mit
19
master
1,925
# frozen_string_literal: true module Admin class ExpenseReportsController < Admin::ApplicationController before_action :set_conference before_action :set_sponsorship, except: [:index] before_action :set_expense_report, except: [:index] def index @sponsorships = @conference.sponsorships ...
github
ruby-no-kai/sponsor-app
https://github.com/ruby-no-kai/sponsor-app
app/controllers/admin/conferences_controller.rb
Ruby
mit
19
master
3,132
# frozen_string_literal: true module Admin class ConferencesController < Admin::ApplicationController before_action :require_unrestricted_staff, only: [:index, :new, :create] before_action :set_conference, only: [:show, :edit, :update, :destroy, :attendees_keeper, :sponsors_yml, :sponsors_json, :asset_urls, ...
github
ruby-no-kai/sponsor-app
https://github.com/ruby-no-kai/sponsor-app
app/controllers/admin/expense_report_reviews_controller.rb
Ruby
mit
19
master
1,227
# frozen_string_literal: true module Admin class ExpenseReportReviewsController < Admin::ApplicationController before_action :set_conference before_action :set_sponsorship before_action :set_expense_report def create submission = @expense_report.current_submission raise ActiveRecord::Rec...
github
ruby-no-kai/sponsor-app
https://github.com/ruby-no-kai/sponsor-app
app/controllers/admin/broadcast_deliveries_controller.rb
Ruby
mit
19
master
1,565
# frozen_string_literal: true module Admin class BroadcastDeliveriesController < Admin::ApplicationController before_action :set_broadcast before_action :set_delivery, only: [:destroy] def create if @broadcast.ready? ApplicationRecord.transaction do @broadcast.lock! if ...
github
ruby-no-kai/sponsor-app
https://github.com/ruby-no-kai/sponsor-app
app/controllers/admin/sponsorship_staff_notes_controller.rb
Ruby
mit
19
master
2,792
# frozen_string_literal: true module Admin class SponsorshipStaffNotesController < Admin::ApplicationController before_action :set_conference before_action :set_staff_note, only: [:edit, :update, :destroy] def index @sponsorship = Sponsorship.find(params[:sponsorship_id]) @conference = @spon...
github
ruby-no-kai/sponsor-app
https://github.com/ruby-no-kai/sponsor-app
app/controllers/admin/sponsorship_impersonations_controller.rb
Ruby
mit
19
master
786
# frozen_string_literal: true module Admin class SponsorshipImpersonationsController < Admin::ApplicationController before_action :require_sponsor_impersonation def create @conference = Conference.find_by!(slug: params[:conference_slug]) check_staff_conference_authorization!(@conference) @...
github
ruby-no-kai/sponsor-app
https://github.com/ruby-no-kai/sponsor-app
app/controllers/admin/sponsorships_controller.rb
Ruby
mit
19
master
3,519
# frozen_string_literal: true module Admin class SponsorshipsController < Admin::ApplicationController before_action :set_conference before_action :set_sponsorship def show @pinned_staff_notes = @sponsorship.staff_notes.where('stickiness > 0').order(stickiness: :desc, created_at: :desc).includes(:...
github
ruby-no-kai/sponsor-app
https://github.com/ruby-no-kai/sponsor-app
app/controllers/admin/booth_assignments_controller.rb
Ruby
mit
19
master
1,382
class Admin::BoothAssignmentsController < ::Admin::ApplicationController before_action :set_conference def show @not_withdrawn_sponsorships = @conference.sponsorships .includes(:plan) .not_withdrawn .where(booth_requested: true) .order('plans.booth_size desc, sponsorships.name asc') ...
github
ruby-no-kai/sponsor-app
https://github.com/ruby-no-kai/sponsor-app
app/controllers/admin/form_descriptions_controller.rb
Ruby
mit
19
master
1,702
# frozen_string_literal: true module Admin class FormDescriptionsController < Admin::ApplicationController before_action :set_conference before_action :set_form_description, only: [:show, :edit, :update] def show end def new @form_description = FormDescription.new(conference: @conference)...
github
ruby-no-kai/sponsor-app
https://github.com/ruby-no-kai/sponsor-app
app/controllers/admin/announcements_controller.rb
Ruby
mit
19
master
2,318
class Admin::AnnouncementsController < Admin::ApplicationController before_action :set_conference before_action :set_announcement, only: %i(show edit update) def index @announcements = @conference.announcements .order('issue ASC, id ASC') .select(:id, :conference_id, :issue, :locale, :title, :sti...
github
ruby-no-kai/sponsor-app
https://github.com/ruby-no-kai/sponsor-app
app/controllers/admin/organizations_controller.rb
Ruby
mit
19
master
1,423
# frozen_string_literal: true module Admin class OrganizationsController < Admin::ApplicationController before_action :set_organization, except: %i[index new create] def index @organizations = Organization.all.order(:name) end def show @sponsorships = @organization.sponsorships.includes...
github
ruby-no-kai/sponsor-app
https://github.com/ruby-no-kai/sponsor-app
app/controllers/admin/expense_line_items_controller.rb
Ruby
mit
19
master
3,180
# frozen_string_literal: true module Admin class ExpenseLineItemsController < Admin::ApplicationController before_action :set_conference before_action :set_sponsorship before_action :set_expense_report before_action :set_line_item, only: [:update, :destroy] def create @line_item = @expense...
github
ruby-no-kai/sponsor-app
https://github.com/ruby-no-kai/sponsor-app
app/controllers/admin/sponsor_event_editing_histories_controller.rb
Ruby
mit
19
master
473
# frozen_string_literal: true module Admin class SponsorEventEditingHistoriesController < Admin::ApplicationController def index @conference = Conference.find_by!(slug: params[:conference_slug]) check_staff_conference_authorization!(@conference) @sponsor_event = @conference.sponsor_events.find(...
github
ruby-no-kai/sponsor-app
https://github.com/ruby-no-kai/sponsor-app
app/controllers/admin/expense_files_controller.rb
Ruby
mit
19
master
1,609
# frozen_string_literal: true module Admin class ExpenseFilesController < Admin::ApplicationController include AssetFileSessionable before_action :set_conference before_action :set_sponsorship before_action :set_asset_file, only: [:show, :update, :destroy, :initiate_update] def create @as...
github
ruby-no-kai/sponsor-app
https://github.com/ruby-no-kai/sponsor-app
app/controllers/admin/dashboard_controller.rb
Ruby
mit
19
master
691
# frozen_string_literal: true module Admin class DashboardController < Admin::ApplicationController class Boom < StandardError; end def index redirect_to conferences_path end def slacktown SlackWebhookJob.perform_later( text: "This is SlackWebhookJob Test Notification invoked by...
github
ruby-no-kai/sponsor-app
https://github.com/ruby-no-kai/sponsor-app
app/controllers/admin/sessions_controller.rb
Ruby
mit
19
master
2,690
# frozen_string_literal: true module Admin class SessionsController < ::ApplicationController layout 'admin' def new if params[:proceed] session.delete(:back_to) if params[:back_to] uri = Addressable::URI.parse(params[:back_to]) if uri && uri.host.nil? && uri.scheme...
github
ruby-no-kai/sponsor-app
https://github.com/ruby-no-kai/sponsor-app
app/controllers/admin/plans_controller.rb
Ruby
mit
19
master
1,565
# frozen_string_literal: true module Admin class PlansController < Admin::ApplicationController before_action :set_conference before_action :set_plan, only: [:edit, :update] def index @plans = @conference.plans.order(:rank) end def new @plan = Plan.new(conference: @conference) e...
github
ruby-no-kai/sponsor-app
https://github.com/ruby-no-kai/sponsor-app
app/controllers/admin/sponsor_events_controller.rb
Ruby
mit
19
master
2,013
# frozen_string_literal: true module Admin class SponsorEventsController < Admin::ApplicationController before_action :set_conference before_action :set_sponsor_event, only: %i(show edit update download_asset) def index @sponsor_events = @conference.sponsor_events .includes(:sponsorship) ...
github
ruby-no-kai/sponsor-app
https://github.com/ruby-no-kai/sponsor-app
app/controllers/webhooks/mailgun_controller.rb
Ruby
mit
19
master
1,260
# frozen_string_literal: true require 'openssl' module Webhooks class MailgunController < ApplicationController skip_before_action :verify_authenticity_token def webhook return render(status: :unauthorized, plain: 'Signature Invalid') unless signature_valid? case user_variables[:mailer] ...
github
ruby-no-kai/sponsor-app
https://github.com/ruby-no-kai/sponsor-app
app/helpers/admin/broadcasts_helper.rb
Ruby
mit
19
master
530
# frozen_string_literal: true module Admin module BroadcastsHelper def status_badge_class(model) color = case model.status.to_sym when :created, :preparing :warning when :ready :primary when :pending :warning when :sending :warning when :sent, :...
github
ruby-no-kai/sponsor-app
https://github.com/ruby-no-kai/sponsor-app
app/helpers/admin/sponsorships_helper.rb
Ruby
mit
19
master
598
# frozen_string_literal: true module Admin module SponsorshipsHelper def front_mail_to_link(to, from: nil, cc: []) base = "mailto:#{URI.encode_www_form_component(to).gsub("%40", "@")}" extras = [] extras << "cc=#{cc.map { |e| URI.encode_www_form_component(e).gsub("%40", "@") }.join(",")}" if cc...
github
ruby-no-kai/sponsor-app
https://github.com/ruby-no-kai/sponsor-app
app/models/sponsorship_asset_file.rb
Ruby
mit
19
master
1,698
# frozen_string_literal: true class SponsorshipAssetFile < ApplicationRecord include AssetFileUploadable ALLOWED_CONTENT_TYPES = %w[ image/jpeg image/png image/gif image/webp image/svg+xml application/pdf application/zip application/x-zip-compressed application/postscript a...
github
ruby-no-kai/sponsor-app
https://github.com/ruby-no-kai/sponsor-app
app/models/sponsor_event.rb
Ruby
mit
19
master
2,730
# frozen_string_literal: true class SponsorEvent < ApplicationRecord include EditingHistoryTarget belongs_to :sponsorship belongs_to :conference has_one :asset_file, class_name: 'SponsorEventAssetFile', dependent: :destroy enum :status, {pending: 0, accepted: 1, rejected: 2, withdrawn: 3} validates :slu...
github
ruby-no-kai/sponsor-app
https://github.com/ruby-no-kai/sponsor-app
app/models/broadcast.rb
Ruby
mit
19
master
1,126
# frozen_string_literal: true class Broadcast < ApplicationRecord include MarkdownBody belongs_to :conference belongs_to :staff has_many :deliveries, class_name: 'BroadcastDelivery', dependent: :destroy enum :status, {created: 0, preparing: 1, modifying: 2, ready: 3, pending: 4, sending: 5, sent: 6, faile...
github
ruby-no-kai/sponsor-app
https://github.com/ruby-no-kai/sponsor-app
app/models/github_installation.rb
Ruby
mit
19
master
1,406
# frozen_string_literal: true require 'jwt' class GithubInstallation GITHUB_MEDIA_TYPE = 'application/vnd.github.machine-man-preview+json' attr_reader :repo_name def initialize(repo_name, branch: nil) @repo_name = repo_name @branch = branch @octokit = nil @app_octokit = nil @github_install...
github
ruby-no-kai/sponsor-app
https://github.com/ruby-no-kai/sponsor-app
app/models/tito_ticket_retraction.rb
Ruby
mit
19
master
2,734
# frozen_string_literal: true class TitoTicketRetraction < ApplicationRecord belongs_to :conference belongs_to :sponsorship validates :reason, presence: true validates :tito_registration, presence: true validates :tito_registration_id, presence: true validate :validate_retractable, on: :create # @para...
github
ruby-no-kai/sponsor-app
https://github.com/ruby-no-kai/sponsor-app
app/models/expense_line_item.rb
Ruby
mit
19
master
784
# frozen_string_literal: true class ExpenseLineItem < ApplicationRecord belongs_to :expense_report has_many :expense_line_item_files, dependent: :destroy has_many :expense_files, through: :expense_line_item_files validates :title, presence: true validates :amount, numericality: {greater_than_or_equal_to: 0,...
github
ruby-no-kai/sponsor-app
https://github.com/ruby-no-kai/sponsor-app
app/models/expense_line_item_file.rb
Ruby
mit
19
master
214
# frozen_string_literal: true class ExpenseLineItemFile < ApplicationRecord belongs_to :expense_line_item belongs_to :expense_file validates :expense_file_id, uniqueness: {scope: :expense_line_item_id} end
github
ruby-no-kai/sponsor-app
https://github.com/ruby-no-kai/sponsor-app
app/models/sponsorship_request.rb
Ruby
mit
19
master
283
# frozen_string_literal: true class SponsorshipRequest < ApplicationRecord # Trust the foreign key: https://github.com/rails/rails/issues/25198 belongs_to :sponsorship, optional: true enum :kind, {billing: 0, customization: 1, note: 2} validates :kind, presence: true end
github
ruby-no-kai/sponsor-app
https://github.com/ruby-no-kai/sponsor-app
app/models/expense_file.rb
Ruby
mit
19
master
953
# frozen_string_literal: true class ExpenseFile < ApplicationRecord include AssetFileUploadable MAX_FILE_SIZE = 20.megabytes ALLOWED_CONTENT_TYPES = %w[image/jpeg image/png image/gif image/webp application/pdf].freeze belongs_to :sponsorship has_many :expense_line_item_files, dependent: :destroy validat...
github
ruby-no-kai/sponsor-app
https://github.com/ruby-no-kai/sponsor-app
app/models/tito_cached_release.rb
Ruby
mit
19
master
387
# frozen_string_literal: true # Cached Tito 'release' object (ticket kind) for a conference. class TitoCachedRelease < ApplicationRecord belongs_to :conference validates :tito_release_slug, presence: true, uniqueness: {scope: :conference_id} validates :tito_release_id, presence: true, uniqueness: {scope: :confe...
github
ruby-no-kai/sponsor-app
https://github.com/ruby-no-kai/sponsor-app
app/models/tito_api.rb
Ruby
mit
19
master
3,802
# frozen_string_literal: true # XXX: move this to somewhere else (is this a model???) class TitoApi ENDPOINT = "https://api.tito.io/v3" def initialize(token: Rails.application.config.x.tito.token, endpoint: ENDPOINT) @token = token @endpoint = ENDPOINT raise ArgumentError, "token is blank" if @token....
github
ruby-no-kai/sponsor-app
https://github.com/ruby-no-kai/sponsor-app
app/models/expense_report_review.rb
Ruby
mit
19
master
622
# frozen_string_literal: true class ExpenseReportReview < ApplicationRecord belongs_to :expense_report_submission belongs_to :staff, optional: true validates :action, inclusion: {in: %w[approve reject]} validates :comment, presence: true, if: -> { action == 'reject' } def self.create_for!(submission, actio...
github
ruby-no-kai/sponsor-app
https://github.com/ruby-no-kai/sponsor-app
app/models/contact.rb
Ruby
mit
19
master
804
# frozen_string_literal: true class Contact < ApplicationRecord # Trust the foreign key: https://github.com/rails/rails/issues/25198 belongs_to :sponsorship, optional: true enum :kind, {primary: 0, billing: 1} validates :kind, presence: true validates :email, presence: true validates :address, presence: t...
github
ruby-no-kai/sponsor-app
https://github.com/ruby-no-kai/sponsor-app
app/models/tito_source.rb
Ruby
mit
19
master
387
# frozen_string_literal: true # cache of 'source' object on Tito class TitoSource < ApplicationRecord belongs_to :conference belongs_to :sponsorship, optional: true validates :tito_source_id, presence: true, uniqueness: {scope: :conference_id} # rubocop:disable Rails/UniqueValidationWithoutIndex def code ...
github
ruby-no-kai/sponsor-app
https://github.com/ruby-no-kai/sponsor-app
app/models/sponsorship.rb
Ruby
mit
19
master
10,255
# frozen_string_literal: true require 'securerandom' class Sponsorship < ApplicationRecord include EditingHistoryTarget belongs_to :conference belongs_to :organization belongs_to :plan, optional: true has_many :contacts, dependent: :destroy has_one :contact, -> { where(kind: :primary) }, class_name: 'Co...
github
ruby-no-kai/sponsor-app
https://github.com/ruby-no-kai/sponsor-app
app/models/exhibition.rb
Ruby
mit
19
master
291
# frozen_string_literal: true class Exhibition < ApplicationRecord include EditingHistoryTarget belongs_to :sponsorship validates :description, presence: true def to_h_for_history { "sponsorship_id" => sponsorship_id, "description" => description, } end end
github
ruby-no-kai/sponsor-app
https://github.com/ruby-no-kai/sponsor-app
app/models/expense_report.rb
Ruby
mit
19
master
2,248
# frozen_string_literal: true class ExpenseReport < ApplicationRecord belongs_to :sponsorship has_many :line_items, -> { order(:position) }, class_name: 'ExpenseLineItem', inverse_of: :expense_report, dependent: :destroy has_many :submissions, class_name: 'ExpenseReportSubmission', dependent: :destroy validat...
github
ruby-no-kai/sponsor-app
https://github.com/ruby-no-kai/sponsor-app
app/models/pass_redemption.rb
Ruby
mit
19
master
3,943
# frozen_string_literal: true # Controls Tito registrations and tickets thru source attributed to a sponsorship, for self managed pass management. class PassRedemption class PaginationNotSupported < StandardError; end Registration = Data.define( :id, :reference, :discount_code, :source, :email, :s...
github
ruby-no-kai/sponsor-app
https://github.com/ruby-no-kai/sponsor-app
app/models/expense_report_submission.rb
Ruby
mit
19
master
231
# frozen_string_literal: true class ExpenseReportSubmission < ApplicationRecord belongs_to :expense_report has_one :review, class_name: 'ExpenseReportReview', dependent: :destroy def reviewed? review.present? end end
github
ruby-no-kai/sponsor-app
https://github.com/ruby-no-kai/sponsor-app
app/models/plan.rb
Ruby
mit
19
master
622
# frozen_string_literal: true class Plan < ApplicationRecord belongs_to :conference has_many :sponsorships, dependent: nil validates :name, presence: true validates :price_text, presence: true validates :words_limit, presence: true def booth_eligible? (booth_size || 0) > 0 end def available?(t =...
github
ruby-no-kai/sponsor-app
https://github.com/ruby-no-kai/sponsor-app
app/models/announcement.rb
Ruby
mit
19
master
1,776
# frozen_string_literal: true class Announcement < ApplicationRecord include MarkdownBody belongs_to :staff belongs_to :conference validates :issue, presence: true validates :locale, presence: true validates :title, presence: true validates :body, presence: true before_validation :generate_issue b...
github
ruby-no-kai/sponsor-app
https://github.com/ruby-no-kai/sponsor-app
app/models/staff.rb
Ruby
mit
19
master
213
# frozen_string_literal: true class Staff < ApplicationRecord validates :login, presence: true validates :name, presence: true validates :uid, presence: true serialize :restricted_repos, coder: JSON end
github
ruby-no-kai/sponsor-app
https://github.com/ruby-no-kai/sponsor-app
app/models/form_description.rb
Ruby
mit
19
master
3,625
# frozen_string_literal: true class FormDescription < ApplicationRecord FallbackOptionCondition = Data.define(:plans, :booth_request) do def as_json = to_h.compact def valid? plans_valid = plans.nil? || plans.is_a?(Array) booth_valid = booth_request.nil? || [true, false].include?(booth_request) ...
github
ruby-no-kai/sponsor-app
https://github.com/ruby-no-kai/sponsor-app
app/models/sponsor_event_asset_file.rb
Ruby
mit
19
master
1,093
# frozen_string_literal: true class SponsorEventAssetFile < ApplicationRecord include AssetFileUploadable MAX_FILE_SIZE = 20.megabytes ALLOWED_CONTENT_TYPES = %w[image/jpeg image/png image/gif image/webp].freeze belongs_to :sponsorship belongs_to :sponsor_event, optional: true validates :extension, incl...
github
ruby-no-kai/sponsor-app
https://github.com/ruby-no-kai/sponsor-app
app/models/broadcast_delivery.rb
Ruby
mit
19
master
650
# frozen_string_literal: true class BroadcastDelivery < ApplicationRecord belongs_to :broadcast belongs_to :sponsorship, optional: true validates :recipient, presence: true validates :status, presence: true enum :status, {created: 0, preparing: 1, ready: 2, pending: 3, sending: 4, sent: 5, failed: 6, rejec...
github
ruby-no-kai/sponsor-app
https://github.com/ruby-no-kai/sponsor-app
app/models/tito_discount_code.rb
Ruby
mit
19
master
393
# frozen_string_literal: true class TitoDiscountCode < ApplicationRecord belongs_to :sponsorship enum :kind, {attendee: 0, booth_staff: 1, booth_paid: 2} def url "https://ti.to/#{sponsorship.conference.tito_slug}/discount/#{code}" end def dashboard_orders_url "https://dashboard.tito.io/#{sponsorsh...
github
ruby-no-kai/sponsor-app
https://github.com/ruby-no-kai/sponsor-app
app/models/organization.rb
Ruby
mit
19
master
820
# frozen_string_literal: true class Organization < ApplicationRecord attribute :affiliation_code, :string, default: -> { SecureRandom.urlsafe_base64(24) } has_many :sponsorships, dependent: nil validates :name, presence: true validates :domain, presence: true validates :affiliation_code, presence: true, uni...
github
ruby-no-kai/sponsor-app
https://github.com/ruby-no-kai/sponsor-app
app/models/conference.rb
Ruby
mit
19
master
3,441
# frozen_string_literal: true class Conference < ApplicationRecord GithubRepo = Struct.new(:raw, :name, :path, :branch, keyword_init: true) do def to_s raw end end has_many :form_descriptions, dependent: :destroy has_many :plans, -> { order(rank: :asc) }, dependent: :destroy, inverse_of: :confer...
github
ruby-no-kai/sponsor-app
https://github.com/ruby-no-kai/sponsor-app
app/models/session_token.rb
Ruby
mit
19
master
921
# frozen_string_literal: true require 'securerandom' class SessionToken < ApplicationRecord belongs_to :sponsorship, optional: true belongs_to :staff, optional: true validates :handle, presence: true validates :expires_at, presence: true scope :active, -> { where('expires_at > ?', Time.zone.now) } befo...
github
ruby-no-kai/sponsor-app
https://github.com/ruby-no-kai/sponsor-app
app/models/concerns/editing_history.rb
Ruby
mit
19
master
635
# frozen_string_literal: true module EditingHistory extend ActiveSupport::Concern included do belongs_to :staff, optional: true validates :raw, presence: true before_validation :calculate_diff end def diff_summary diff.map { |d| "#{d[0]}#{d[1]}" } end private def calculate_diff if ...
github
ruby-no-kai/sponsor-app
https://github.com/ruby-no-kai/sponsor-app
app/models/concerns/editing_history_target.rb
Ruby
mit
19
master
559
# frozen_string_literal: true module EditingHistoryTarget extend ActiveSupport::Concern included do has_many :editing_histories, -> { order(id: :desc) }, class_name: "#{name}EditingHistory", dependent: :destroy, inverse_of: false around_save :create_history attr_accessor :staff end def last_edit...
github
ruby-no-kai/sponsor-app
https://github.com/ruby-no-kai/sponsor-app
app/models/concerns/asset_file_uploadable.rb
Ruby
mit
19
master
5,459
# frozen_string_literal: true require 'active_support/concern' module AssetFileUploadable extend ActiveSupport::Concern MAX_FILE_SIZE = 200.megabytes included do validates :handle, presence: true before_validation do self.handle ||= SecureRandom.urlsafe_base64(32) end before_destroy :c...
github
ruby-no-kai/sponsor-app
https://github.com/ruby-no-kai/sponsor-app
app/models/concerns/markdown_body.rb
Ruby
mit
19
master
898
# frozen_string_literal: true module MarkdownBody def html if persisted? Rails.cache.fetch("#{self.class.name}:html:#{id}/#{updated_at.to_f}", expires_in: 1.month) { render_html }.html_safe # rubocop:disable Rails/OutputSafety else render_html.html_safe # rubocop:disable Rails/OutputSafety en...
github
ruby-no-kai/sponsor-app
https://github.com/ruby-no-kai/sponsor-app
app/mailers/application_mailer.rb
Ruby
mit
19
master
3,213
# frozen_string_literal: true class ApplicationMailer < ActionMailer::Base default( from: "#{Rails.application.config.x.org_name} Sponsorships <#{Rails.application.config.x.default_email_address}>", reply_to: Rails.application.config.x.default_email_reply_to, ) layout 'mailer' before_action :add_mail...
github
ruby-no-kai/sponsor-app
https://github.com/ruby-no-kai/sponsor-app
app/mailers/sponsorship_welcome_mailer.rb
Ruby
mit
19
master
1,492
# frozen_string_literal: true class SponsorshipWelcomeMailer < ApplicationMailer def user_email @sponsorship = params[:sponsorship] @session_token = params[:session_token] @conference_name = @sponsorship.conference.name @sponsor_org_name = @sponsorship.contact.organization @sponsor_contact_name ...
github
ruby-no-kai/sponsor-app
https://github.com/ruby-no-kai/sponsor-app
app/mailers/session_token_mailer.rb
Ruby
mit
19
master
324
# frozen_string_literal: true class SessionTokenMailer < ApplicationMailer def notify @token = params[:token] @sponsorship = @token.sponsorship # For mailgun tag message_id_for "session_tokens/#{@token.id}" list_name 'login' mail( to: @token.email, subject: make_subject, ) end ...
github
ruby-no-kai/sponsor-app
https://github.com/ruby-no-kai/sponsor-app
app/mailers/broadcast_mailer.rb
Ruby
mit
19
master
1,397
# frozen_string_literal: true class BroadcastMailer < ApplicationMailer def announce @delivery = params[:delivery] @broadcast = @delivery.broadcast @sponsorship = @delivery.sponsorship @conference = @broadcast.conference message_id_for "broadcasts/#{@broadcast.id}/deliveries/#{@delivery.id}" ...
github
ruby-no-kai/sponsor-app
https://github.com/ruby-no-kai/sponsor-app
app/jobs/create_broadcast_deliveries_job.rb
Ruby
mit
19
master
4,697
# frozen_string_literal: true class CreateBroadcastDeliveriesJob < ApplicationJob Recipient = Struct.new(:sponsorship, :email, :email_ccs, keyword_init: true) module Filters class Base def initialize(broadcast:, params:) @broadcast = broadcast @params = params end attr_reade...
github
ruby-no-kai/sponsor-app
https://github.com/ruby-no-kai/sponsor-app
app/jobs/process_sponsor_event_edit_job.rb
Ruby
mit
19
master
1,911
# frozen_string_literal: true class ProcessSponsorEventEditJob < ApplicationJob include Rails.application.routes.url_helpers def perform(edit) @sponsor_event = edit.sponsor_event @sponsorship = @sponsor_event.sponsorship @conference = @sponsor_event.conference is_new_submission = edit.id == @spon...
github
ruby-no-kai/sponsor-app
https://github.com/ruby-no-kai/sponsor-app
app/jobs/dispatch_broadcast_delivery_job.rb
Ruby
mit
19
master
1,788
# frozen_string_literal: true class DispatchBroadcastDeliveryJob < ApplicationJob def perform(delivery, force: false) Rails.logger.info "Delivering (#{delivery.id}): #{delivery.broadcast.description} (broadcast=#{delivery.broadcast.id}))" Sentry.with_scope do |scope| scope.set_tags(delivery_id: deliver...
github
ruby-no-kai/sponsor-app
https://github.com/ruby-no-kai/sponsor-app
app/jobs/application_job.rb
Ruby
mit
19
master
228
# frozen_string_literal: true class ApplicationJob < ActiveJob::Base include Rails.application.routes.url_helpers def default_url_options {host: Rails.application.config.x.public_url_host, protocol: 'https'} end end
github
ruby-no-kai/sponsor-app
https://github.com/ruby-no-kai/sponsor-app
app/jobs/ensure_sponsorship_tito_discount_code_job.rb
Ruby
mit
19
master
3,564
# frozen_string_literal: true class EnsureSponsorshipTitoDiscountCodeJob < ApplicationJob def perform(sponsorship, kind, ignore_quantity: false) return unless Rails.application.config.x.tito.token @kind = kind @sponsorship = sponsorship @conference = @sponsorship.conference return if @conference...
github
ruby-no-kai/sponsor-app
https://github.com/ruby-no-kai/sponsor-app
app/jobs/push_event_asset_file_job.rb
Ruby
mit
19
master
3,889
# frozen_string_literal: true require 'open3' class PushEventAssetFileJob < ApplicationJob def perform(record) resolve_record(record) @sponsorship = @event.sponsorship @conference = @event.conference return if @conference.github_repo_images_path.blank? repo = @conference.github_repo return...
github
ruby-no-kai/sponsor-app
https://github.com/ruby-no-kai/sponsor-app
app/jobs/generate_sponsors_yaml_file_job.rb
Ruby
mit
19
master
10,423
# frozen_string_literal: true class GenerateSponsorsYamlFileJob < ApplicationJob def perform(conference, push: true) @conference = conference yaml_data # to generate if push ApplicationRecord.transaction do @last&.lock! push_to_github end end end def repo @confer...
github
ruby-no-kai/sponsor-app
https://github.com/ruby-no-kai/sponsor-app
app/jobs/backfill_sponsorship_asset_file_checksum_job.rb
Ruby
mit
19
master
776
# frozen_string_literal: true class BackfillSponsorshipAssetFileChecksumJob < ApplicationJob def perform(sponsorship_asset_file) sponsorship = sponsorship_asset_file.sponsorship resp = sponsorship_asset_file.get_object sponsorship_asset_file.put_object(body: resp.body, checksum_algorithm: 'SHA256', conte...
github
ruby-no-kai/sponsor-app
https://github.com/ruby-no-kai/sponsor-app
app/jobs/process_broadcast_delivery_mailgun_event_job.rb
Ruby
mit
19
master
913
# frozen_string_literal: true class ProcessBroadcastDeliveryMailgunEventJob < ApplicationJob def perform(event_data) @event_data = event_data delivery_id = user_variables['delivery_id'] ApplicationRecord.transaction do delivery = BroadcastDelivery.lock.find(delivery_id) delivery.add_mailgun_e...
github
ruby-no-kai/sponsor-app
https://github.com/ruby-no-kai/sponsor-app
app/jobs/process_sponsorship_edit_job.rb
Ruby
mit
19
master
899
# frozen_string_literal: true class ProcessSponsorshipEditJob < ApplicationJob def perform(edit) @sponsorship = edit.sponsorship @conference = @sponsorship.conference actor = edit.staff ? "#{edit.staff.login} (staff)" : 'sponsor' SlackWebhookJob.perform_now( { text: ":pencil: <#{confer...
github
ruby-no-kai/sponsor-app
https://github.com/ruby-no-kai/sponsor-app
app/jobs/slack_webhook_job.rb
Ruby
mit
19
master
455
# frozen_string_literal: true require 'net/http' require 'uri' require 'json' require 'optparse' class SlackWebhookJob < ApplicationJob def perform(payload, hook_name: :default) return unless webhook_url(hook_name) Net::HTTP.post_form( URI.parse(webhook_url(hook_name)), payload: payload.to_json...
github
ruby-no-kai/sponsor-app
https://github.com/ruby-no-kai/sponsor-app
app/jobs/retract_tito_ticket_job.rb
Ruby
mit
19
master
2,325
# frozen_string_literal: true class RetractTitoTicketJob < ApplicationJob class Unable < StandardError; end # @param retraction [TitoTicketRetraction] def perform(retraction) logger.tagged(retraction_id: retraction.id, sponsorship_id: retraction.sponsorship_id, tito_registration_id: retraction.tito_registra...
github
ruby-no-kai/sponsor-app
https://github.com/ruby-no-kai/sponsor-app
app/jobs/sponsorship_welcome_job.rb
Ruby
mit
19
master
942
# frozen_string_literal: true class SponsorshipWelcomeJob < ApplicationJob def perform(sponsorship) token = SessionToken.create!(email: sponsorship.contact.email, expires_at: Time.zone.now + 1.year) SponsorshipWelcomeMailer.with( sponsorship: sponsorship, session_token: token, ).user_email.d...
github
ampedandwired/rancher-reaper
https://github.com/ampedandwired/rancher-reaper
lib/config.ru
Ruby
mit
19
master
1,091
require 'logger' require 'rack' require 'thin' require_relative 'reaper' Thin::Logging.silent = true logger = Logger.new(STDOUT) def verify_environment_variable_set(var_name) if !ENV[var_name] puts "Environment variable #{var_name} not set - exiting" exit 1 end end mandatory_variables = ["CATTLE_URL", "C...
github
ampedandwired/rancher-reaper
https://github.com/ampedandwired/rancher-reaper
lib/reaper.rb
Ruby
mit
19
master
4,051
#!/usr/bin/env ruby require "set" require "logger" require "aws-sdk" require_relative "rancher_api" class RancherAwsHostReaper DEFAULT_INTERVAL_SECS = 30 DEFAULT_HOSTS_PER_PAGE = 100 def initialize( interval_secs: DEFAULT_INTERVAL_SECS, hosts_per_page: DEFAULT_HOSTS_PER_PAGE, dry_run: false, ...
github
ampedandwired/rancher-reaper
https://github.com/ampedandwired/rancher-reaper
lib/rancher_api.rb
Ruby
mit
19
master
1,648
require "net/http" require "uri" class RancherApi def initialize @api_url = ENV['CATTLE_URL'] @access_key = ENV["CATTLE_ACCESS_KEY"] @secret_key = ENV["CATTLE_SECRET_KEY"] end def get(url) make_api_request(Net::HTTP::Get, url) end def get_all(url, &block) Enumerator.new do |enum| ...
github
ampedandwired/rancher-reaper
https://github.com/ampedandwired/rancher-reaper
spec/reaper_spec.rb
Ruby
mit
19
master
5,958
require "hashie" require "spec_helper.rb" describe RancherAwsHostReaper do before do setup_aws_regions end it "deletes hosts in rancher that have been terminated in aws" do rancher_api = setup_hosts([ create_host("0", rancher_state: "active", aws_instance_state: "terminated", availability_zone: "u...
github
codebar/mentoring.io
https://github.com/codebar/mentoring.io
Gemfile
Ruby
mit
19
master
648
source 'https://rubygems.org' ruby '2.1.5' gem 'rails', '4.1.6' gem 'sass-rails', '~> 4.0.3' gem 'bootstrap-sass' gem 'uglifier', '>= 1.3.0' gem 'haml-rails' gem 'simple_form' gem 'jquery-rails' gem 'turbolinks' gem 'spring', group: :development gem 'devise' gem 'omniauth-github', '1.1.1' gem 'twilio-ruby' ...
github
codebar/mentoring.io
https://github.com/codebar/mentoring.io
config/application.rb
Ruby
mit
19
master
1,219
require File.expand_path('../boot', __FILE__) # Pick the frameworks you want: require "active_model/railtie" require "active_record/railtie" require "action_controller/railtie" require "action_mailer/railtie" require "action_view/railtie" require "sprockets/railtie" # require "rails/test_unit/railtie" # Require the g...
github
codebar/mentoring.io
https://github.com/codebar/mentoring.io
config/routes.rb
Ruby
mit
19
master
1,001
Rails.application.routes.draw do devise_for :members, :controllers => { :omniauth_callbacks => "omniauth_callbacks", :registrations => "members/registrations", sessions: 'members/sessions' } root 'home#index' get 'new_mentor', to: 'members#new_mentor' resources :members, only: [:index, :new, :create] reso...
github
codebar/mentoring.io
https://github.com/codebar/mentoring.io
config/environments/production.rb
Ruby
mit
19
master
3,565
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...