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
rubycentral/cfp-app
https://github.com/rubycentral/cfp-app
app/controllers/comments_controller.rb
Ruby
mit
234
main
1,069
class CommentsController < ApplicationController def create @proposal = Proposal.find(comment_params[:proposal_id]) comment_attributes = comment_params.merge(user: current_user) if comment_type == 'InternalComment' @comment = @proposal.internal_comments.create(comment_attributes) else @c...
github
rubycentral/cfp-app
https://github.com/rubycentral/cfp-app
app/controllers/application_controller.rb
Ruby
mit
234
main
5,608
class ApplicationController < ActionController::Base include Pundit::Authorization rescue_from Pundit::NotAuthorizedError, with: :user_not_authorized # Prevent CSRF attacks by raising an exception. # For APIs, you may want to use :null_session instead. protect_from_forgery with: :exception helper_method :...
github
rubycentral/cfp-app
https://github.com/rubycentral/cfp-app
app/controllers/schedule_controller.rb
Ruby
mit
234
main
401
class ScheduleController < ApplicationController include WebsiteScheduleHelper after_action :set_cache_headers, only: :show private decorates_assigned :schedule, with: Staff::TimeSlotDecorator def show @schedule = current_website.time_slots.grid_order .includes(:room, program_session: { proposal: {s...
github
rubycentral/cfp-app
https://github.com/rubycentral/cfp-app
app/controllers/profiles_controller.rb
Ruby
mit
234
main
2,766
class ProfilesController < ApplicationController before_action :require_user def show redirect_to edit_profile_path end def edit current_user.valid? flash.now[:warning] = incomplete_profile_msg unless current_user.complete? end def update if current_user.update(user_params) if curr...
github
rubycentral/cfp-app
https://github.com/rubycentral/cfp-app
app/controllers/concerns/authentication.rb
Ruby
mit
234
main
1,297
module Authentication extend ActiveSupport::Concern included do before_action :require_authentication helper_method :authenticated? end class_methods do def allow_unauthenticated_access(**options) skip_before_action :require_authentication, **options end end private def authenti...
github
rubycentral/cfp-app
https://github.com/rubycentral/cfp-app
app/controllers/concerns/program_support.rb
Ruby
mit
234
main
906
require "active_support/concern" module ProgramSupport extend ActiveSupport::Concern included do before_action :require_program_team before_action :set_proposal_counts helper_method :sticky_selected_track end private def sticky_selected_track session["event/#{current_event.id}/program/tra...
github
rubycentral/cfp-app
https://github.com/rubycentral/cfp-app
app/controllers/users/omniauth_callbacks_controller.rb
Ruby
mit
234
main
2,867
class Users::OmniauthCallbacksController < ApplicationController class AuthHash < SimpleDelegator def account_name dig('info', 'nickname') || dig('extra', 'raw_info', 'screen_name') end def provider_name Identity::PROVIDER_NAMES[provider] end end before_action :link_identity_to_curre...
github
rubycentral/cfp-app
https://github.com/rubycentral/cfp-app
app/controllers/admin/application_controller.rb
Ruby
mit
234
main
314
class Admin::ApplicationController < ApplicationController before_action :require_user before_action :require_admin private def require_admin unless current_user.admin? redirect_to events_path, flash: {danger: 'You must be signed in as an administrator to access this page.'} end end end
github
rubycentral/cfp-app
https://github.com/rubycentral/cfp-app
app/controllers/admin/users_controller.rb
Ruby
mit
234
main
1,193
class Admin::UsersController < Admin::ApplicationController before_action :set_user, only: [:show, :edit, :update, :destroy] # GET /admin/users def index render locals: { users: User.includes(:teammates, :proposals, :identities) } end # GET /admin/users/1 def show render locals: { user: @user } ...
github
rubycentral/cfp-app
https://github.com/rubycentral/cfp-app
app/controllers/admin/events_controller.rb
Ruby
mit
234
main
1,087
class Admin::EventsController < Admin::ApplicationController before_action :require_event, only: [:destroy, :archive, :unarchive] def index @events = Event.order(:archived, id: :desc) end def new @event = Event.new end def create @event = Event.new(event_params) if @event.save @even...
github
rubycentral/cfp-app
https://github.com/rubycentral/cfp-app
app/controllers/staff/reviewer_tags_controller.rb
Ruby
mit
234
main
340
class Staff::ReviewerTagsController < Staff::ApplicationController before_action :enable_staff_event_subnav def edit end def update authorize @event, :update? @event.update!(reviewer_tags_params) render :show end private def reviewer_tags_params params.require(:event).permit(:valid_rev...
github
rubycentral/cfp-app
https://github.com/rubycentral/cfp-app
app/controllers/staff/speaker_email_templates_controller.rb
Ruby
mit
234
main
2,142
class Staff::SpeakerEmailTemplatesController < Staff::ApplicationController before_action :enable_staff_event_subnav before_action :set_type_key, only: [:show, :edit, :update, :destroy, :test] helper_method :sticky_template_test_email def index @event.initialize_speaker_emails end def show end d...
github
rubycentral/cfp-app
https://github.com/rubycentral/cfp-app
app/controllers/staff/custom_fields_controller.rb
Ruby
mit
234
main
343
class Staff::CustomFieldsController < Staff::ApplicationController before_action :enable_staff_event_subnav def edit end def update authorize @event, :update? @event.update!(custom_fields_params) render :show end private def custom_fields_params params.require(:event).permit(:custom_fi...
github
rubycentral/cfp-app
https://github.com/rubycentral/cfp-app
app/controllers/staff/grids_controller.rb
Ruby
mit
234
main
366
class Staff::GridsController < Staff::ApplicationController include ScheduleSupport def show @schedule = Schedule.new(current_event) @sessions = current_event.program_sessions @unscheduled_sessions = current_event.program_sessions.unscheduled @schedule_counts = EventStats.new(current_event).schedul...
github
rubycentral/cfp-app
https://github.com/rubycentral/cfp-app
app/controllers/staff/websites_controller.rb
Ruby
mit
234
main
2,008
class Staff::WebsitesController < Staff::ApplicationController before_action :set_website before_action :authorize_website before_action :enable_website_subnav def new; end def create if @website.update(website_params) flash[:success] = "Website was successfully created." redirect_to edit_ev...
github
rubycentral/cfp-app
https://github.com/rubycentral/cfp-app
app/controllers/staff/ratings_controller.rb
Ruby
mit
234
main
1,268
class Staff::RatingsController < Staff::ApplicationController before_action :track_program_use before_action :require_proposal before_action :prevent_self_review private decorates_assigned :proposal def create authorize @proposal, :rate? @rating = Rating.find_or_initialize_by(proposal: @proposal, u...
github
rubycentral/cfp-app
https://github.com/rubycentral/cfp-app
app/controllers/staff/rooms_controller.rb
Ruby
mit
234
main
1,858
class Staff::RoomsController < Staff::ApplicationController include ScheduleSupport before_action :set_room, only: [:update, :destroy] def index @rooms = current_event.rooms.grid_order end def create @room = current_event.rooms.build(room_params) if @room.save respond_to do |format| ...
github
rubycentral/cfp-app
https://github.com/rubycentral/cfp-app
app/controllers/staff/guidelines_controller.rb
Ruby
mit
234
main
495
class Staff::GuidelinesController < Staff::ApplicationController before_action :enable_staff_event_subnav def show end def edit end def update authorize @event, :update? if @event.update(params.require(:event).permit(:guidelines)) redirect_to event_staff_guidelines_path else flash...
github
rubycentral/cfp-app
https://github.com/rubycentral/cfp-app
app/controllers/staff/pages_controller.rb
Ruby
mit
234
main
2,676
class Staff::PagesController < Staff::ApplicationController before_action :require_website before_action :enable_website_subnav before_action :set_page, except: :index before_action :authorize_page, except: :index def index @pages = current_website.pages authorize(@pages) end def show @body ...
github
rubycentral/cfp-app
https://github.com/rubycentral/cfp-app
app/controllers/staff/proposal_reviews_controller.rb
Ruby
mit
234
main
2,502
class Staff::ProposalReviewsController < Staff::ApplicationController before_action :track_program_use before_action :require_proposal, except: [:index] before_action :prevent_self_review, except: [:index] private decorates_assigned :proposal, with: Staff::ProposalDecorator def index authorize Proposal,...
github
rubycentral/cfp-app
https://github.com/rubycentral/cfp-app
app/controllers/staff/program_sessions_controller.rb
Ruby
mit
234
main
3,767
class Staff::ProgramSessionsController < Staff::ApplicationController include ProgramSupport before_action :enable_staff_program_subnav private decorates_assigned :program_session, with: Staff::ProgramSessionDecorator private decorates_assigned :sessions, with: Staff::ProgramSessionDecorator private decorat...
github
rubycentral/cfp-app
https://github.com/rubycentral/cfp-app
app/controllers/staff/application_controller.rb
Ruby
mit
234
main
1,027
class Staff::ApplicationController < ApplicationController before_action :require_user before_action :require_event before_action :require_staff private def require_staff unless current_user.staff_for?(current_event) redirect_to events_path, flash: {danger: 'You must be signed in as event staff to...
github
rubycentral/cfp-app
https://github.com/rubycentral/cfp-app
app/controllers/staff/proposal_tags_controller.rb
Ruby
mit
234
main
342
class Staff::ProposalTagsController < Staff::ApplicationController before_action :enable_staff_event_subnav def edit end def update authorize @event, :update? @event.update!(proposal_tags_params) render :show end private def proposal_tags_params params.require(:event).permit(:valid_pro...
github
rubycentral/cfp-app
https://github.com/rubycentral/cfp-app
app/controllers/staff/speakers_controller.rb
Ruby
mit
234
main
2,399
class Staff::SpeakersController < Staff::ApplicationController include ProgramSupport before_action :set_program_session, only: [:new, :create] before_action :speaker_count_check, only: [:destroy] before_action :enable_staff_program_subnav def index @program_speakers = current_event.speakers.in_program....
github
rubycentral/cfp-app
https://github.com/rubycentral/cfp-app
app/controllers/staff/teammates_controller.rb
Ruby
mit
234
main
2,269
class Staff::TeammatesController < Staff::ApplicationController before_action :enable_staff_event_subnav before_action :require_contact_email, only: [:create] def index @staff = TeammateDecorator.decorate_collection(current_event.teammates.accepted.alphabetize) @invitations = current_event.teammates.invi...
github
rubycentral/cfp-app
https://github.com/rubycentral/cfp-app
app/controllers/staff/session_formats_controller.rb
Ruby
mit
234
main
1,970
class Staff::SessionFormatsController < Staff::ApplicationController before_action :set_session_format, only: [:edit, :update, :destroy] def index @session_formats = @event.session_formats end def new @session_format = SessionFormat.new render layout: false end def edit render layout: fal...
github
rubycentral/cfp-app
https://github.com/rubycentral/cfp-app
app/controllers/staff/proposals_controller.rb
Ruby
mit
234
main
3,872
class Staff::ProposalsController < Staff::ApplicationController include ProgramSupport before_action :require_proposal, only: [:show, :update_state, :update, :finalize] before_action :enable_staff_selection_subnav skip_before_action :require_program_team, only: [:update] before_action :require_staff, only: [...
github
rubycentral/cfp-app
https://github.com/rubycentral/cfp-app
app/controllers/staff/sponsors_controller.rb
Ruby
mit
234
main
1,651
class Staff::SponsorsController < Staff::ApplicationController before_action :enable_website_subnav def index @sponsors = current_event.sponsors.order_by_tier end def new @sponsor = current_event.sponsors.build end def create @sponsor = current_event.sponsors.build(sponsor_params) if @spo...
github
rubycentral/cfp-app
https://github.com/rubycentral/cfp-app
app/controllers/staff/time_slots_controller.rb
Ruby
mit
234
main
3,319
class Staff::TimeSlotsController < Staff::ApplicationController include ScheduleSupport before_action :set_time_slot, only: [:edit, :update, :destroy] helper_method :time_slot_decorated private decorates_assigned :time_slots, with: Staff::TimeSlotDecorator def index @time_slots = current_event.time_sl...
github
rubycentral/cfp-app
https://github.com/rubycentral/cfp-app
app/controllers/staff/events_controller.rb
Ruby
mit
234
main
1,794
class Staff::EventsController < Staff::ApplicationController before_action :enable_staff_event_subnav def edit authorize @event, :edit? end def show render locals: { event: @event.decorate } end def info end def update_status authorize_update if @event.update(params.require(:event).p...
github
rubycentral/cfp-app
https://github.com/rubycentral/cfp-app
app/controllers/staff/tracks_controller.rb
Ruby
mit
234
main
1,776
class Staff::TracksController < Staff::ApplicationController before_action :set_track, only: [:edit, :update, :destroy] def index @tracks = current_event.tracks.sort_by_name end def new @track = Track.new render layout: false end def edit render layout: false end def create @trac...
github
rubycentral/cfp-app
https://github.com/rubycentral/cfp-app
app/controllers/staff/grids/program_sessions_controller.rb
Ruby
mit
234
main
252
class Staff::Grids::ProgramSessionsController < Staff::ApplicationController include ScheduleSupport def show @session = current_event.program_sessions.find(params[:id]) render partial: 'show_dialog', locals: {session: @session} end end
github
rubycentral/cfp-app
https://github.com/rubycentral/cfp-app
app/controllers/staff/grids/bulk_time_slots_controller.rb
Ruby
mit
234
main
1,475
class Staff::Grids::BulkTimeSlotsController < Staff::ApplicationController include ScheduleSupport def new @bulk = BulkTimeSlot.new(day: params[:day]) render partial: 'create_dialog', locals: {bulk: @bulk} end def preview @bulk = BulkTimeSlot.new(bulk_time_slot_params) unless @bulk.valid? ...
github
rubycentral/cfp-app
https://github.com/rubycentral/cfp-app
app/controllers/staff/grids/time_slots_controller.rb
Ruby
mit
234
main
1,345
class Staff::Grids::TimeSlotsController < Staff::ApplicationController include ScheduleSupport protect_from_forgery except: :edit before_action :set_time_slot, only: [:edit, :update] helper_method :time_slot_decorated def edit render partial: 'edit_dialog', locals: {time_slot: time_slot_decorated, event...
github
rubycentral/cfp-app
https://github.com/rubycentral/cfp-app
app/helpers/application_helper.rb
Ruby
mit
234
main
3,923
module ApplicationHelper class MarkdownRenderer < Redcarpet::Render::HTML def block_code(code, language) language ||= 'ruby' %(<pre><code class="language-#{language}">#{ERB::Util.html_escape(code)}</code></pre>) end end MARKDOWN_RENDERER = Redcarpet::Markdown.new( MarkdownRenderer.new(fil...
github
rubycentral/cfp-app
https://github.com/rubycentral/cfp-app
app/helpers/schedule_helper.rb
Ruby
mit
234
main
1,234
module ScheduleHelper def row_time(time_slot) if time_slot && time_slot.start_time fmt = "%l:%M%p" "#{time_slot.start_time.strftime(fmt)} - #{time_slot.end_time.strftime(fmt)}" end end def grid_data tracks = current_event.tracks.sort_by_name.pluck(:name).map(&:parameterize) { ...
github
rubycentral/cfp-app
https://github.com/rubycentral/cfp-app
app/helpers/website_schedule_helper.rb
Ruby
mit
234
main
391
module WebsiteScheduleHelper def schedule_for_day(schedule, day_number) schedule.select { |time_slot| time_slot[:conference_day] == day_number } .filter { |time_slot| !time_slot[:title].blank? || time_slot.program_session } .sort_by {|time_slot| time_slot[:start_time] } .group_...
github
rubycentral/cfp-app
https://github.com/rubycentral/cfp-app
app/helpers/staff_helper.rb
Ruby
mit
234
main
1,177
module StaffHelper def show_rating_form?(proposal, rating) !proposal.has_speaker?(current_user) && !ratings_closed?(proposal, rating) end def disable_rating_form?(proposal) proposal.withdrawn? || proposal.finalized? end def show_ratings?(proposal, rating) rating.persisted? || program_mode? || (p...
github
rubycentral/cfp-app
https://github.com/rubycentral/cfp-app
app/helpers/time_slot_helper.rb
Ruby
mit
234
main
585
module TimeSlotHelper def unmet_requirements(event) @_unmet_requirements ||= event.unmet_requirements_for_scheduling.map do |msg| content_tag :li, msg, class: 'list-group-item custom-list-group-item-danger' end safe_join(@_unmet_requirements, "\n") end def has_missing_requirements?(event) @...
github
rubycentral/cfp-app
https://github.com/rubycentral/cfp-app
app/helpers/program_session_helper.rb
Ruby
mit
234
main
233
module ProgramSessionHelper def session_states_collection ProgramSession.states.values.map { |state| [state.titleize, state] } end def speakers_emails(session) session.speakers.map{ |speaker| speaker.email } end end
github
rubycentral/cfp-app
https://github.com/rubycentral/cfp-app
app/helpers/proposal_helper.rb
Ruby
mit
234
main
1,374
module ProposalHelper def diff(content1, content2) changes = Diffy::Diff.new(content1, content2, include_plus_and_minus_in_html: true, include_diff_info: true) changes.to_s.present? ? changes.to_s(:html).html_safe : 'No Changes' end def rati...
github
rubycentral/cfp-app
https://github.com/rubycentral/cfp-app
app/helpers/image_helper.rb
Ruby
mit
234
main
729
module ImageHelper def resize_image_tag(image, width:, height: width) width ||= 100 return unless image.attached? if image.content_type.match('svg') image_tag(image, width: width) else image_tag(image.variant(resize_to_fit: [width, height])) end end def image_input(form, field, wi...
github
rubycentral/cfp-app
https://github.com/rubycentral/cfp-app
app/helpers/website_helper.rb
Ruby
mit
234
main
725
module WebsiteHelper DOCS_PAGE = "https://github.com/rubycentral/cfp-app/blob/main/docs/website_documentation.md".freeze def website_event_slug params[:slug] || (@older_domain_website && @older_domain_website.event.slug) end def font_file_label(font) "File".tap do |label| label.concat(" (Current ...
github
rubycentral/cfp-app
https://github.com/rubycentral/cfp-app
app/helpers/profiles_helper.rb
Ruby
mit
234
main
707
module ProfilesHelper def notification_preferences_tooltip <<-HTML <p><strong>Notification Preferences</strong></p> <p><b>All Via Email</b> - You will receive emails for all public and internal comments. You will also receive in-app notications for all public and internal comments. </p> <p><b>Menti...
github
rubycentral/cfp-app
https://github.com/rubycentral/cfp-app
app/helpers/comments_helper.rb
Ruby
mit
234
main
630
module CommentsHelper def choose_class_for(comment) if comment.proposal.has_speaker?(comment.user) 'by_myself right speaker-comment' elsif comment.user.organizer_for_event?(comment.proposal.event) 'from_user left organizer-comment' elsif comment.user.reviewer_for_event?(comment.proposal.event)...
github
rubycentral/cfp-app
https://github.com/rubycentral/cfp-app
app/helpers/page_helper.rb
Ruby
mit
234
main
1,103
module PageHelper TAGS = { "<sponsors-banner-adds></sponsors-banner-adds>" => "sponsors/banner_ads", #DEPRECATED spelling mistake "<sponsors-banner-ads></sponsors-banner-ads>" => "sponsors/banner_ads", "<sponsors-footer></sponsors-footer>" => "sponsors/sponsors_footer", /(<logo-image.*><\/logo-image>)...
github
rubycentral/cfp-app
https://github.com/rubycentral/cfp-app
app/helpers/navbar_helper.rb
Ruby
mit
234
main
3,553
module NavbarHelper using Module.new { refine NavbarHelper do def path_for(*args) url_for(args << {only_path: true}) end end } NAV_ITEM_MAP = { my_proposals: ->(pp) { [->(p) { p.start_with?(path_for(Proposal)) }, ->(p) { p.start_with?(path_for(current_event, Proposal)) }].any? { i...
github
rubycentral/cfp-app
https://github.com/rubycentral/cfp-app
app/serializers/program_session_serializer.rb
Ruby
mit
234
main
312
class ProgramSessionSerializer < ActiveModel::Serializer attributes :title, :abstract, :format, :track, :tags, :id, :video_url, :slides_url has_many :speakers def tags object.proposal&.review_tags end def format object.session_format&.name end def track object.track&.name end end
github
rubycentral/cfp-app
https://github.com/rubycentral/cfp-app
app/serializers/time_slot_serializer.rb
Ruby
mit
234
main
617
class TimeSlotSerializer < ActiveModel::Serializer attributes :conference_day, :start_time, :end_time, :program_session_id, :title, :presenter, :room, :track, :description def start_time object.start_time&.to_fs(:time) end def end_time object.end_time&.to_fs(:time) end def room object.roo...
github
rubycentral/cfp-app
https://github.com/rubycentral/cfp-app
app/decorators/website_decorator.rb
Ruby
mit
234
main
5,423
class WebsiteDecorator < Draper::Decorator delegate_all delegate :title, :author, :description, to: :meta_data DEFAULT_LINKS = { 'Schedule' => 'schedule', 'Program' => 'program', 'Sponsors' => 'sponsors', }.freeze def name event.name end def date_range event.date_range end def ...
github
rubycentral/cfp-app
https://github.com/rubycentral/cfp-app
app/decorators/event_decorator.rb
Ruby
mit
234
main
1,607
class EventDecorator < Draper::Decorator delegate_all def path_for(user) path = if user && user.organizer_for_event?(object) h.event_staff_proposals_path(object) else h.event_path(object.slug) end h.link_to h.pluralize(object.proposals.count, 'proposal'), path end def closes_at(fo...
github
rubycentral/cfp-app
https://github.com/rubycentral/cfp-app
app/decorators/user_decorator.rb
Ruby
mit
234
main
283
class UserDecorator < Draper::Decorator delegate_all def proposal_notification_url(proposal) event = proposal.event if proposal.has_speaker?(object) h.event_proposal_url(event, proposal) else h.event_staff_proposal_url(event, proposal) end end end
github
rubycentral/cfp-app
https://github.com/rubycentral/cfp-app
app/decorators/invitation_decorator.rb
Ruby
mit
234
main
876
class InvitationDecorator < Draper::Decorator delegate_all decorates_association :proposal STATE_LABEL_MAP = { Invitation.states[:pending] => 'label-default', Invitation.states[:declined] => 'label-danger', Invitation.states[:accepted] => 'label-success' } def decline_button(small: false) cl...
github
rubycentral/cfp-app
https://github.com/rubycentral/cfp-app
app/decorators/proposal_decorator.rb
Ruby
mit
234
main
3,055
class ProposalDecorator < Draper::Decorator decorates :proposal delegate_all decorates_association :speakers def speaker_state(small: false) speaker_state = if object.awaiting_confirmation? 'Waiting for speaker confirmation' elsif state.include?('soft') Proposal.states[:submitted] else ...
github
rubycentral/cfp-app
https://github.com/rubycentral/cfp-app
app/decorators/speaker_decorator.rb
Ruby
mit
234
main
217
class SpeakerDecorator < Draper::Decorator delegate_all decorates_association :proposals decorates_association :program_sessions def bio object.bio.present? ? object.bio : object.user.try(:bio) end end
github
rubycentral/cfp-app
https://github.com/rubycentral/cfp-app
app/decorators/staff/time_slots_decorator.rb
Ruby
mit
234
main
624
class Staff::TimeSlotsDecorator < Draper::CollectionDecorator def to_csv CSV.generate do |csv| columns = { conference_day: 'Conference Day', start_time: 'Start Time', end_time: 'End Time', room_name: 'Room Name', display_title: 'Title', display_track_name: 'T...
github
rubycentral/cfp-app
https://github.com/rubycentral/cfp-app
app/decorators/staff/program_session_decorator.rb
Ruby
mit
234
main
1,976
class Staff::ProgramSessionDecorator < Draper::Decorator decorates_association :speakers delegate_all def state_label(large: false, state: nil) state ||= self.state classes = "label #{state_class(state)}" classes += ' label-large' if large h.content_tag :span, object.state_before_type_cast, cla...
github
rubycentral/cfp-app
https://github.com/rubycentral/cfp-app
app/decorators/staff/proposals_decorator.rb
Ruby
mit
234
main
602
class Staff::ProposalsDecorator < Draper::CollectionDecorator def to_csv CSV.generate do |csv| columns = %w[ id uuid state average_rating review_tags_list speaker_name title abstract details pitch bio created_at updated_at confirmed_at ] csv << columns each do |proposal| csv << ...
github
rubycentral/cfp-app
https://github.com/rubycentral/cfp-app
app/decorators/staff/proposal_decorator.rb
Ruby
mit
234
main
4,330
class Staff::ProposalDecorator < ProposalDecorator decorates :proposal def update_state_link(new_state) if new_state == object.state h.content_tag :span, new_state, class: 'disabled-state' else h.link_to new_state, update_state_path(new_state), data: {turbo: true, turbo_method: :post} end ...
github
rubycentral/cfp-app
https://github.com/rubycentral/cfp-app
app/decorators/staff/time_slot_decorator.rb
Ruby
mit
234
main
3,045
class Staff::TimeSlotDecorator < Draper::Decorator decorates :time_slot delegate_all def start_time object.start_time.try(:to_fs, :time_p) end def end_time object.end_time.try(:to_fs, :time_p) end def session_duration "#{object.session_duration.try(:to_fs, :time)} minutes" end def time...
github
rubycentral/cfp-app
https://github.com/rubycentral/cfp-app
app/models/invitation.rb
Ruby
mit
234
main
1,308
class Invitation < ApplicationRecord enum :state, {pending: 'pending', accepted: 'accepted', declined: 'declined'}, default: :pending do event :accept do transition :pending => :accepted before do |user| self.user = user proposal.speakers.create!(user: user, event: proposal.event, ski...
github
rubycentral/cfp-app
https://github.com/rubycentral/cfp-app
app/models/session_format_config.rb
Ruby
mit
234
main
785
class SessionFormatConfig < ApplicationRecord belongs_to :website belongs_to :session_format scope :displayed, ->{ where(display: true) } scope :in_order, ->{ order(:position) } def slug session_format.name.parameterize.pluralize end end # == Schema Information # # Table name: session_format_configs ...
github
rubycentral/cfp-app
https://github.com/rubycentral/cfp-app
app/models/notification.rb
Ruby
mit
234
main
1,264
class Notification < ApplicationRecord belongs_to :user UNREAD_LIMIT = 10 scope :recent_unread, -> { unread.order(created_at: :desc).limit(UNREAD_LIMIT) } scope :unread, -> { where(read_at: nil) } def self.create_for_all(users, args = {}) users.each { |user| create_for(user, args) } end def self.cr...
github
rubycentral/cfp-app
https://github.com/rubycentral/cfp-app
app/models/event.rb
Ruby
mit
234
main
6,596
class Event < ApplicationRecord enum :state, {draft: 'draft', open: 'open', closed: 'closed'}, default: :draft has_many :teammates, dependent: :destroy has_many :staff, through: :teammates, source: :user has_many :proposals, dependent: :destroy has_many :speakers has_many :rooms, dependent: :destroy has_...
github
rubycentral/cfp-app
https://github.com/rubycentral/cfp-app
app/models/program_session.rb
Ruby
mit
234
main
4,747
class ProgramSession < ApplicationRecord enum :state, { live: 'live', draft: 'draft', unconfirmed_accepted: 'unconfirmed accepted', unconfirmed_waitlisted: 'unconfirmed waitlisted', confirmed_waitlisted: 'confirmed waitlisted', declined: 'declined' }, default: :draft do event :confirm do...
github
rubycentral/cfp-app
https://github.com/rubycentral/cfp-app
app/models/session_format.rb
Ruby
mit
234
main
767
class SessionFormat < ApplicationRecord belongs_to :event has_many :proposals has_one :session_format_config validates_presence_of :event validates :description, length: { maximum: 250 } validates :name, uniqueness: {scope: :event}, presence: true scope :sort_by_name, ->{ order(:name) } scope :public...
github
rubycentral/cfp-app
https://github.com/rubycentral/cfp-app
app/models/finalization_notifier.rb
Ruby
mit
234
main
493
# frozen_string_literal: true class FinalizationNotifier include FinalizationMessages def self.notify(proposal) new(proposal).notify end attr_reader :proposal, :users def initialize(proposal) @proposal = proposal @users = proposal.speakers.map(&:user) end def notify Staff::ProposalM...
github
rubycentral/cfp-app
https://github.com/rubycentral/cfp-app
app/models/teammate.rb
Ruby
mit
234
main
2,814
class Teammate < ApplicationRecord NOTIFICATION_PREFERENCE_LABELS = { 'all' => 'All Via Email', 'mentions' => 'Mention Only Via Email', 'in_app_only' => 'In App Only' } enum :role, {reviewer: 'reviewer', program_team: 'program team', organizer: 'organizer'}, scopes: false enum :state, {pending: 'p...
github
rubycentral/cfp-app
https://github.com/rubycentral/cfp-app
app/models/event_stats.rb
Ruby
mit
234
main
5,867
class EventStats attr_reader :event def initialize(event) @event = event end def rated_proposals(include_withdrawn=false) q = event.proposals.rated q = q.not_withdrawn if include_withdrawn q.size end def total_proposals(include_withdrawn=false) q = event.proposals q = q.not_withdr...
github
rubycentral/cfp-app
https://github.com/rubycentral/cfp-app
app/models/proposal.rb
Ruby
mit
234
main
9,980
# frozen_string_literal: true class Proposal < ApplicationRecord enum :state, { submitted: 'submitted', soft_accepted: 'soft accepted', soft_waitlisted: 'soft waitlisted', soft_rejected: 'soft rejected', accepted: 'accepted', waitlisted: 'waitlisted', rejected: 'rejected', withdrawn: ...
github
rubycentral/cfp-app
https://github.com/rubycentral/cfp-app
app/models/user.rb
Ruby
mit
234
main
7,372
class User < ApplicationRecord normalizes :email, with: ->(e) { e.strip.downcase } # Include default devise modules. Others available are: # :confirmable, :lockable, :timeoutable devise :database_authenticatable, :registerable, :rememberable, :trackable, :confirmable #:validatable, has_secure_passw...
github
rubycentral/cfp-app
https://github.com/rubycentral/cfp-app
app/models/time_slot.rb
Ruby
mit
234
main
3,747
class TimeSlot < ApplicationRecord belongs_to :program_session, optional: true belongs_to :room belongs_to :track, optional: true belongs_to :event belongs_to :sponsor, optional: true DEFAULT_TIME = Time.current.beginning_of_day.change(hour: 9) DEFAULT_DURATION = 60 # minutes STANDARD_LENGTH = 40.minut...
github
rubycentral/cfp-app
https://github.com/rubycentral/cfp-app
app/models/public_comment.rb
Ruby
mit
234
main
1,541
class PublicComment < Comment after_create :notify private # Generate notifications for PublicComment # 1. If a speaker is leaving a comment, # all reviewers/organizers get an in app notification # if they have reviewed/rated or commented on the proposal. # 2. If anyone else (reviewer/program ...
github
rubycentral/cfp-app
https://github.com/rubycentral/cfp-app
app/models/tagging.rb
Ruby
mit
234
main
792
class Tagging < ApplicationRecord belongs_to :proposal scope :proposal, -> { where(internal: false).order('tag ASC') } scope :review, -> { where(internal: true).order('tag ASC') } def self.count_by_tag(event) event.taggings.group(:tag).count end # 'one, two, three' -> ['one','two','three'] # does s...
github
rubycentral/cfp-app
https://github.com/rubycentral/cfp-app
app/models/website.rb
Ruby
mit
234
main
2,301
class Website < ApplicationRecord enum :caching, { off: 'off', automatic: 'automatic', manual: 'manual' }, prefix: true belongs_to :event has_many :time_slots, through: :event has_many :sponsors, through: :event has_many :program_sessions, through: :event has_many :pages, dependent: :destroy has_many :fo...
github
rubycentral/cfp-app
https://github.com/rubycentral/cfp-app
app/models/speaker.rb
Ruby
mit
234
main
2,422
class Speaker < ApplicationRecord AGE_RANGES = [ "Under 18 years old", "18-24 years old", "25-34 years old", "35-44 years old", "45-54 years old", "55-64 years old", "65-74 years old", "75 years or older", "Decline to say" ].freeze GENDER_PRONOUNS = [ "he/him/his", "sh...
github
rubycentral/cfp-app
https://github.com/rubycentral/cfp-app
app/models/rating.rb
Ruby
mit
234
main
674
class Rating < ApplicationRecord belongs_to :proposal belongs_to :user scope :for_event, -> (event) { joins(:proposal).where("proposals.event_id = ?", event.id) } scope :not_withdrawn, -> { joins(:proposal).where.not(proposals: {state: :withdrawn}) } def teammate user.teammates.where(event: proposal.eve...
github
rubycentral/cfp-app
https://github.com/rubycentral/cfp-app
app/models/identity.rb
Ruby
mit
234
main
813
class Identity < ApplicationRecord PROVIDER_NAMES = {'github' => 'GitHub', 'twitter' => 'Twitter'}.freeze enum :provider, {github: 'github', twitter: 'twitter'}, scopes: false, instance_methods: false belongs_to :user validates :provider, presence: true validates :uid, presence: true, uniqueness: {scope: :...
github
rubycentral/cfp-app
https://github.com/rubycentral/cfp-app
app/models/track.rb
Ruby
mit
234
main
696
class Track < ApplicationRecord NO_TRACK = 'General' belongs_to :event has_many :program_sessions has_many :proposals validates :name, uniqueness: {scope: :event}, presence: true validates :description, length: {maximum: 250} scope :sort_by_name, -> { order(:name) } def self.count_by_track(event) ...
github
rubycentral/cfp-app
https://github.com/rubycentral/cfp-app
app/models/page.rb
Ruby
mit
234
main
1,792
class Page < ApplicationRecord TEMPLATES = { 'splash' => { hide_header: true, hide_footer: true }, 'home' => { }, } belongs_to :website after_save_commit :purge_website_cache scope :published, -> { where.not(published_body: nil).where(hide_page: false) } scope :in_footer, -> { published.where.not(...
github
rubycentral/cfp-app
https://github.com/rubycentral/cfp-app
app/models/room.rb
Ruby
mit
234
main
672
class Room < ApplicationRecord belongs_to :event has_many :time_slots validates :name, uniqueness: {scope: :event_id}, presence: true scope :by_grid_position, -> {where.not(grid_position: nil).order(:grid_position)} scope :grid_order, -> { order(:grid_position) } end # == Schema Information # # Table name: ...
github
rubycentral/cfp-app
https://github.com/rubycentral/cfp-app
app/models/sponsor.rb
Ruby
mit
234
main
1,391
class Sponsor < ApplicationRecord belongs_to :event has_one :website, through: :event, touch: :purged_at has_many :time_slots has_one_attached :primary_logo has_one_attached :footer_logo has_one_attached :banner_ad validates_presence_of :primary_logo, :name, :tier, :url, :description TIERS = ['diamo...
github
rubycentral/cfp-app
https://github.com/rubycentral/cfp-app
app/models/schedule.rb
Ruby
mit
234
main
1,033
class Schedule attr_reader :event def initialize(event) @event = event end def each_day (1..event.days).each do |d| yield(d, slots[d] || {}) end end def each_room(day) rooms.each do |r| room_slots = slots[day][r] if slots[day] yield(r, room_slots || []) end end ...
github
rubycentral/cfp-app
https://github.com/rubycentral/cfp-app
app/models/bulk_time_slot.rb
Ruby
mit
234
main
1,238
class BulkTimeSlot include ActiveModel::Model attr_accessor :session_format attr_reader :event, :day, :rooms, :start_times, :duration validates :day, :rooms, :start_times, :duration, presence: true def event=(event) @event = event end def day=(day) @day = day.to_i end def rooms=(rooms) ...
github
rubycentral/cfp-app
https://github.com/rubycentral/cfp-app
app/models/internal_comment.rb
Ruby
mit
234
main
1,745
class InternalComment < Comment after_create :notify def mention_names body.scan(/@(\w+)/).flatten end private # Generate notifications for InternalComment # If a reviewer/organizer leaves a comment, # only the other reviewers of proposal get an in-app notification. # if the comment contains an ...
github
rubycentral/cfp-app
https://github.com/rubycentral/cfp-app
app/models/comment.rb
Ruby
mit
234
main
590
class Comment < ApplicationRecord belongs_to :proposal belongs_to :user validates :proposal, :user, presence: true validates :body, presence: true def public? type == "PublicComment" end end # == Schema Information # # Table name: comments # # id :integer not null, primary key # p...
github
rubycentral/cfp-app
https://github.com/rubycentral/cfp-app
app/models/speaker_email_template.rb
Ruby
mit
234
main
367
class SpeakerEmailTemplate TYPES = [ :accept, :waitlist, :reject ] DISPLAY_TYPES = { accept: 'Accept', waitlist: 'Waitlist', reject: 'Not Accepted' }.with_indifferent_access TYPES_TO_STATES = { accept: :accepted, waitlist: :waitlisted, reject: :rejected }.with_indifferent...
github
rubycentral/cfp-app
https://github.com/rubycentral/cfp-app
app/models/website/font.rb
Ruby
mit
234
main
582
class Website::Font < ApplicationRecord belongs_to :website has_one_attached :file validates :file, :name, presence: true scope :primary, -> { where(primary: true) } scope :secondary, -> { where(secondary: true) } end # == Schema Information # # Table name: website_fonts # # id :integer ...
github
rubycentral/cfp-app
https://github.com/rubycentral/cfp-app
app/models/website/meta_data.rb
Ruby
mit
234
main
592
class Website::MetaData < ApplicationRecord belongs_to :website after_initialize :defaults has_one_attached :image def defaults self.title ||= website.event.name self.description ||= website.event.name end end # == Schema Information # # Table name: website_meta_data # # id :integer ...
github
rubycentral/cfp-app
https://github.com/rubycentral/cfp-app
app/models/website/content.rb
Ruby
mit
234
main
591
class Website::Content < ApplicationRecord PLACEMENTS = [ HEAD = "head", FOOTER = "footer", ].freeze belongs_to :website scope :for, -> (placement) { where(placement: placement) } end # == Schema Information # # Table name: website_contents # # id :integer not null, primary key # c...
github
rubycentral/cfp-app
https://github.com/rubycentral/cfp-app
app/models/concerns/conference_day_slot.rb
Ruby
mit
234
main
1,292
class ConferenceDaySlot attr_reader :conference_day, :start_time, :event def initialize(conference_day, start_time, event) @conference_day = conference_day @start_time = start_time @event = event end def sessions sessions = raw_sessions unless conference_wide? sessions = sessions.by_...
github
rubycentral/cfp-app
https://github.com/rubycentral/cfp-app
app/models/concerns/finalization_messages.rb
Ruby
mit
234
main
611
# frozen_string_literal: true module FinalizationMessages MESSAGES = { accepted: ->(event_name) { "Your proposal for #{event_name} has been accepted" }, rejected: ->(event_name) { "Your proposal for #{event_name} has not been accepted" }, waitlisted: ->(event_name) { "Your proposal for #{event_name} has ...
github
rubycentral/cfp-app
https://github.com/rubycentral/cfp-app
app/models/concerns/conference_day.rb
Ruby
mit
234
main
621
class ConferenceDay attr_reader :conf_slots def initialize(day, event) start_times = TimeSlot.where(conference_day: day, event_id: event.id).pluck(:start_time).uniq.sort_by { |start_time| start_time } @conf_slots = start_times.map do |start_time| ConferenceDaySlot.new(day, start_time, event) end ...
github
rubycentral/cfp-app
https://github.com/rubycentral/cfp-app
app/jobs/application_job.rb
Ruby
mit
234
main
267
class ApplicationJob < ActiveJob::Base # 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 end
github
rubycentral/cfp-app
https://github.com/rubycentral/cfp-app
app/jobs/bulk_finalize_job.rb
Ruby
mit
234
main
596
class BulkFinalizeJob < ApplicationJob queue_as :default def perform(proposals_state) proposals = Proposal.where(state: proposals_state) ActionCable.server.broadcast "notifications", { message: "Finalizing #{proposals.size} #{proposals_state} proposals..." } proposals.each do |proposal| ...
github
rubycentral/cfp-app
https://github.com/rubycentral/cfp-app
app/mailers/comment_notification_mailer.rb
Ruby
mit
234
main
1,310
class CommentNotificationMailer < ApplicationMailer def reviewer_notification(proposal, comment, users) @comment = comment @proposal = proposal # Email all reviewers of this proposal if notifications is true unless they made the comment to = users.map(&:email).reject{|e| e.blank? } if to.any? ...
github
rubycentral/cfp-app
https://github.com/rubycentral/cfp-app
app/mailers/speaker_invitation_mailer.rb
Ruby
mit
234
main
400
class SpeakerInvitationMailer < ApplicationMailer def create(invitation, speaker) @invitation = invitation @proposal = invitation.proposal @speaker = speaker mail_markdown to: @invitation.email, from: @proposal.event.contact_email, subject: "You've been invite...
github
rubycentral/cfp-app
https://github.com/rubycentral/cfp-app
app/mailers/application_mailer.rb
Ruby
mit
234
main
469
class ApplicationMailer < ActionMailer::Base helper MailerHelper MARKDOWN_RENDERER = Redcarpet::Markdown.new(Redcarpet::Render::HTML).freeze attr_accessor :template_name def mail_markdown(options) mail options do |format| markdown_string = render_to_string(template_name || action_name, formats: :md...
github
rubycentral/cfp-app
https://github.com/rubycentral/cfp-app
app/mailers/teammate_invitation_mailer.rb
Ruby
mit
234
main
312
class TeammateInvitationMailer < ApplicationMailer def create(teammate) @teammate = teammate @event = teammate.event mail_markdown to: teammate.email, from: @event.contact_email, subject: "You've been invited to participate in the #{@event.name} CFP" end end
github
rubycentral/cfp-app
https://github.com/rubycentral/cfp-app
app/mailers/staff/proposal_mailer_template.rb
Ruby
mit
234
main
965
class Staff::ProposalMailerTemplate include Rails.application.routes.url_helpers def initialize(template, event, proposal, tag_whitelist = []) @template = template @event = event @proposal = proposal @tags = build_tags(tag_whitelist) end def render replace_simple_tags @template.html_sa...