repo stringlengths 5 92 | file_url stringlengths 80 287 | file_path stringlengths 5 197 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:37:27 2026-01-04 17:58:21 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/controllers/course/assessment/question/rubric_based_responses_controller.rb | app/controllers/course/assessment/question/rubric_based_responses_controller.rb | # frozen_string_literal: true
class Course::Assessment::Question::RubricBasedResponsesController < Course::Assessment::Question::Controller
include Course::Assessment::Question::RubricBasedResponseQuestionConcern
include Course::Assessment::Question::RubricBasedResponseControllerConcern
build_and_authorize_new_q... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/controllers/course/assessment/condition/scholaistic_assessments_controller.rb | app/controllers/course/assessment/condition/scholaistic_assessments_controller.rb | # frozen_string_literal: true
class Course::Assessment::Condition::ScholaisticAssessmentsController <
Course::Condition::ScholaisticAssessmentsController
include Course::AssessmentConditionalConcern
end
| ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/controllers/course/assessment/condition/assessments_controller.rb | app/controllers/course/assessment/condition/assessments_controller.rb | # frozen_string_literal: true
class Course::Assessment::Condition::AssessmentsController <
Course::Condition::AssessmentsController
include Course::AssessmentConditionalConcern
end
| ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/controllers/course/assessment/condition/levels_controller.rb | app/controllers/course/assessment/condition/levels_controller.rb | # frozen_string_literal: true
class Course::Assessment::Condition::LevelsController < Course::Condition::LevelsController
include Course::AssessmentConditionalConcern
end
| ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/controllers/course/assessment/condition/surveys_controller.rb | app/controllers/course/assessment/condition/surveys_controller.rb | # frozen_string_literal: true
class Course::Assessment::Condition::SurveysController < Course::Condition::SurveysController
include Course::AssessmentConditionalConcern
end
| ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/controllers/course/assessment/condition/achievements_controller.rb | app/controllers/course/assessment/condition/achievements_controller.rb | # frozen_string_literal: true
class Course::Assessment::Condition::AchievementsController <
Course::Condition::AchievementsController
include Course::AssessmentConditionalConcern
end
| ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/controllers/course/statistics/aggregate_controller.rb | app/controllers/course/statistics/aggregate_controller.rb | # frozen_string_literal: true
# This is named aggregate controller as naming this as course controller leads to name conflict issues
class Course::Statistics::AggregateController < Course::Statistics::Controller
before_action :preload_levels, only: [:all_students, :course_performance]
include Course::Statistics::Ti... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/controllers/course/statistics/assessments_controller.rb | app/controllers/course/statistics/assessments_controller.rb | # frozen_string_literal: true
class Course::Statistics::AssessmentsController < Course::Statistics::Controller # rubocop:disable Metrics/ClassLength
include Course::UsersHelper
include Course::Statistics::SubmissionsConcern
include Course::Statistics::UsersConcern
def assessment_statistics
@assessment = Co... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/controllers/course/statistics/statistics_controller.rb | app/controllers/course/statistics/statistics_controller.rb | # frozen_string_literal: true
class Course::Statistics::StatisticsController < Course::Statistics::Controller
# This is the base page of the statistics page. All other information are fetched
# via the respective API endpoints in the statistics module.
def index
end
end
| ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/controllers/course/statistics/users_controller.rb | app/controllers/course/statistics/users_controller.rb | # frozen_string_literal: true
class Course::Statistics::UsersController < Course::Statistics::Controller
def learning_rate_records
@course_user = CourseUser.find(params[:user_id])
@learning_rate_records = @course_user.learning_rate_records
end
end
| ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/controllers/course/statistics/controller.rb | app/controllers/course/statistics/controller.rb | # frozen_string_literal: true
class Course::Statistics::Controller < Course::ComponentController
before_action :authorize_read_statistics!
private
def authorize_read_statistics!
authorize!(:read_statistics, current_course)
end
# @return [Course::StatisticsComponent]
# @return [nil] If component is di... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/controllers/course/experience_points/disbursement_controller.rb | app/controllers/course/experience_points/disbursement_controller.rb | # frozen_string_literal: true
class Course::ExperiencePoints::DisbursementController < Course::ComponentController
before_action :load_resource
before_action :authorize_resource
def new
respond_to do |format|
format.json { render 'new' }
end
end
def create
if @disbursement.save
rende... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/controllers/course/experience_points/forum_disbursement_controller.rb | app/controllers/course/experience_points/forum_disbursement_controller.rb | # frozen_string_literal: true
class Course::ExperiencePoints::ForumDisbursementController <
Course::ExperiencePoints::DisbursementController
def create
if @disbursement.save
render json: { count: recipient_count }, status: :ok
else
render json: { errors: @disbursement.errors }, status: :bad_requ... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/controllers/course/material/folders_controller.rb | app/controllers/course/material/folders_controller.rb | # frozen_string_literal: true
class Course::Material::FoldersController < Course::Material::Controller
rescue_from ActiveRecord::RecordNotFound, with: :handle_not_found
skip_load_resource :folder, only: [:index]
before_action :authorize_read_owner!, only: [:show, :download]
def index
load_root_folder_with_... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/controllers/course/material/materials_controller.rb | app/controllers/course/material/materials_controller.rb | # frozen_string_literal: true
class Course::Material::MaterialsController < Course::Material::Controller
load_and_authorize_resource :material, through: :folder, class: 'Course::Material'
def show
authorize!(:read_owner, @material.folder)
create_submission if @folder.owner_type == 'Course::Assessment'
... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/controllers/course/material/controller.rb | app/controllers/course/material/controller.rb | # frozen_string_literal: true
class Course::Material::Controller < Course::ComponentController
load_and_authorize_resource :folder, through: :course, through_association: :material_folders,
class: 'Course::Material::Folder'
def create_text_chunks
material_ids = material_c... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/controllers/course/survey/questions_controller.rb | app/controllers/course/survey/questions_controller.rb | # frozen_string_literal: true
class Course::Survey::QuestionsController < Course::Survey::Controller
load_and_authorize_resource :question, through: :survey, class: 'Course::Survey::Question'
def create
last_weight = @survey.questions.maximum(:weight)
@question.weight = last_weight ? last_weight + 1 : 0
... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/controllers/course/survey/sections_controller.rb | app/controllers/course/survey/sections_controller.rb | # frozen_string_literal: true
class Course::Survey::SectionsController < Course::Survey::Controller
load_and_authorize_resource :section, through: :survey, class: 'Course::Survey::Section'
def create
last_weight = @survey.sections.maximum(:weight)
@section.weight = last_weight ? last_weight + 1 : 0
if ... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/controllers/course/survey/responses_controller.rb | app/controllers/course/survey/responses_controller.rb | # frozen_string_literal: true
class Course::Survey::ResponsesController < Course::Survey::Controller
load_and_authorize_resource :response, through: :survey, class: 'Course::Survey::Response'
def index
authorize!(:manage, @survey)
@course_users = current_course.course_users.order_alphabetically
@my_stu... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/controllers/course/survey/surveys_controller.rb | app/controllers/course/survey/surveys_controller.rb | # frozen_string_literal: true
class Course::Survey::SurveysController < Course::Survey::Controller
include Course::Survey::ReorderingConcern
skip_load_and_authorize_resource :survey, only: [:new, :create]
build_and_authorize_new_lesson_plan_item :survey, class: Course::Survey, through: :course, only: [:new, :cre... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/controllers/course/survey/controller.rb | app/controllers/course/survey/controller.rb | # frozen_string_literal: true
class Course::Survey::Controller < Course::ComponentController
include Course::LessonPlan::ActsAsLessonPlanItemConcern
load_and_authorize_resource :survey, through: :course, class: 'Course::Survey'
private
# Define survey component for the check whether the component is defined.... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/controllers/course/video/topics_controller.rb | app/controllers/course/video/topics_controller.rb | # frozen_string_literal: true
class Course::Video::TopicsController < Course::Video::Controller
load_and_authorize_resource :topic, through: :video, class: 'Course::Video::Topic'
include Course::Discussion::PostsConcern
skip_load_and_authorize_resource :post, except: :create
def index
@topics = @video.top... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/controllers/course/video/controller.rb | app/controllers/course/video/controller.rb | # frozen_string_literal: true
class Course::Video::Controller < Course::ComponentController
include Course::LessonPlan::ActsAsLessonPlanItemConcern
load_and_authorize_resource :video, through: :course, class: 'Course::Video'
private
def current_tab
raise NotImplementedError
end
# @return [Course::Vi... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/controllers/course/video/videos_controller.rb | app/controllers/course/video/videos_controller.rb | # frozen_string_literal: true
class Course::Video::VideosController < Course::Video::Controller
skip_load_and_authorize_resource :video, only: [:create]
build_and_authorize_new_lesson_plan_item :video, class: Course::Video, through: :course, only: [:create]
before_action :load_video_tabs
def index
respond_... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/controllers/course/video/submission/controller.rb | app/controllers/course/video/submission/controller.rb | # frozen_string_literal: true
class Course::Video::Submission::Controller < Course::Video::Controller
load_and_authorize_resource :submission, class: 'Course::Video::Submission', through: :video
end
| ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/controllers/course/video/submission/submissions_controller.rb | app/controllers/course/video/submission/submissions_controller.rb | # frozen_string_literal: true
class Course::Video::Submission::SubmissionsController < Course::Video::Submission::Controller
include Signals::EmissionConcern
before_action :authorize_attempt_video!, only: :create
before_action :authorize_analyze_video!, only: [:index, :show]
skip_authorize_resource :submission... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/controllers/course/video/submission/sessions_controller.rb | app/controllers/course/video/submission/sessions_controller.rb | # frozen_string_literal: true
class Course::Video::Submission::SessionsController < Course::Video::Submission::Controller
load_and_authorize_resource :session, class: 'Course::Video::Session', through: :submission
def create
head :bad_request unless @session.save
end
def update
# We received a message... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/controllers/test/factories_controller.rb | app/controllers/test/factories_controller.rb | # frozen_string_literal: true
class Test::FactoriesController < Test::Controller
before_action :set_user_stamper, only: [:create]
def create
models = {}
ActsAsTenant.with_tenant(Instance.default) do
create_params.each do |factory_name, attributes|
traits = traits_from(attributes)
mod... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/controllers/test/controller.rb | app/controllers/test/controller.rb | # frozen_string_literal: true
class Test::Controller < ActionController::Base
before_action :restrict_to_test
private
def restrict_to_test
head :not_found unless Rails.env.test?
end
end
| ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/controllers/test/mailer_controller.rb | app/controllers/test/mailer_controller.rb | # frozen_string_literal: true
class Test::MailerController < Test::Controller
def last_sent
render json: ActionMailer::Base.deliveries.last
end
def clear
ActionMailer::Base.deliveries.clear
head :ok
end
end
| ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/controllers/components/course/scholaistic_component.rb | app/controllers/components/course/scholaistic_component.rb | # frozen_string_literal: true
class Course::ScholaisticComponent < SimpleDelegator
include Course::ControllerComponentHost::Component
include Course::Scholaistic::Concern
def self.enabled_by_default?
false
end
def sidebar_items
main_sidebar_items + settings_sidebar_items
end
private
def main... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/controllers/components/course/survey_component.rb | app/controllers/components/course/survey_component.rb | # frozen_string_literal: true
class Course::SurveyComponent < SimpleDelegator
include Course::ControllerComponentHost::Component
def self.lesson_plan_item_actable_names
[Course::Survey.name]
end
def sidebar_items
[
{
key: :surveys,
icon: :survey,
weight: 11,
path:... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/controllers/components/course/experience_points_component.rb | app/controllers/components/course/experience_points_component.rb | # frozen_string_literal: true
class Course::ExperiencePointsComponent < SimpleDelegator
include Course::ControllerComponentHost::Component
def self.gamified?
true
end
def sidebar_items
return [] unless can_create_experience_points_record?
[
{
key: :sidebar_experience_points,
... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/controllers/components/course/groups_component.rb | app/controllers/components/course/groups_component.rb | # frozen_string_literal: true
class Course::GroupsComponent < SimpleDelegator
include Course::ControllerComponentHost::Component
include Course::Group::GroupManagerConcern
def sidebar_items
return [] unless show_group_sidebar_item?
[
{
key: self.class.key,
icon: :groups,
ty... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/controllers/components/course/controller_component_host.rb | app/controllers/components/course/controller_component_host.rb | # frozen_string_literal: true
#
# The course component framework isolates features as components. The intent is to allow
# each feature to be enabled / disabled indepenedently within a course.
#
# When creating a component:
#
# - Your component class should `include Course::ControllerComponentHost::Component`.
# This i... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/controllers/components/course/lesson_plan_component.rb | app/controllers/components/course/lesson_plan_component.rb | # frozen_string_literal: true
class Course::LessonPlanComponent < SimpleDelegator
include Course::ControllerComponentHost::Component
def self.lesson_plan_item_actable_names
[Course::LessonPlan::Event.name]
end
def sidebar_items
main_sidebar_items + settings_sidebar_items
end
private
def main_s... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/controllers/components/course/videos_component.rb | app/controllers/components/course/videos_component.rb | # frozen_string_literal: true
class Course::VideosComponent < SimpleDelegator
include Course::ControllerComponentHost::Component
include Course::UnreadCountsConcern
def self.lesson_plan_item_actable_names
[Course::Video.name]
end
def sidebar_items
main_sidebar_items + settings_sidebar_items
end
... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/controllers/components/course/statistics_component.rb | app/controllers/components/course/statistics_component.rb | # frozen_string_literal: true
class Course::StatisticsComponent < SimpleDelegator
include Course::ControllerComponentHost::Component
def sidebar_items
return [] unless can?(:read_statistics, current_course)
[
{
key: self.class.key,
icon: :statistics,
type: :admin,
wei... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/controllers/components/course/forums_component.rb | app/controllers/components/course/forums_component.rb | # frozen_string_literal: true
class Course::ForumsComponent < SimpleDelegator
include Course::ControllerComponentHost::Component
include Course::UnreadCountsConcern
def sidebar_items
main_sidebar_items + settings_sidebar_items
end
private
def main_sidebar_items
[
{
key: :forums,
... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/controllers/components/course/settings_component.rb | app/controllers/components/course/settings_component.rb | # frozen_string_literal: true
class Course::SettingsComponent < SimpleDelegator
include Course::ControllerComponentHost::Component
# Prevent user from locking him/herself out of settings.
def self.can_be_disabled_for_course?
false
end
def sidebar_items
admin_sidebar_items + settings_sidebar_items
... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/controllers/components/course/levels_component.rb | app/controllers/components/course/levels_component.rb | # frozen_string_literal: true
class Course::LevelsComponent < SimpleDelegator
include Course::ControllerComponentHost::Component
def self.gamified?
true
end
def sidebar_items
return [] unless can?(:read, Course::Level.new(course: current_course))
[
{
key: self.class.key,
ico... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/controllers/components/course/materials_component.rb | app/controllers/components/course/materials_component.rb | # frozen_string_literal: true
class Course::MaterialsComponent < SimpleDelegator
include Course::ControllerComponentHost::Component
def sidebar_items
main_sidebar_items + settings_sidebar_items
end
private
def main_sidebar_items
[
{
key: :materials,
icon: :material,
ti... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/controllers/components/course/duplication_component.rb | app/controllers/components/course/duplication_component.rb | # frozen_string_literal: true
class Course::DuplicationComponent < SimpleDelegator
include Course::ControllerComponentHost::Component
def sidebar_items
return [] unless can?(:duplicate_from, current_course)
[
{
key: :admin_duplication,
icon: :duplication,
type: :admin,
... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/controllers/components/course/rag_wise_component.rb | app/controllers/components/course/rag_wise_component.rb | # frozen_string_literal: true
class Course::RagWiseComponent < SimpleDelegator
include Course::ControllerComponentHost::Component
def self.enabled_by_default?
false
end
def sidebar_items
settings_sidebar_items
end
private
def settings_sidebar_items
[
{
key: self.class.key,
... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/controllers/components/course/leaderboard_component.rb | app/controllers/components/course/leaderboard_component.rb | # frozen_string_literal: true
class Course::LeaderboardComponent < SimpleDelegator
include Course::ControllerComponentHost::Component
def self.gamified?
true
end
def sidebar_items
main_sidebar_items + settings_sidebar_items
end
private
def main_sidebar_items
[
{
key: :leaderb... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/controllers/components/course/stories_component.rb | app/controllers/components/course/stories_component.rb | # frozen_string_literal: true
class Course::StoriesComponent < SimpleDelegator
include Course::ControllerComponentHost::Component
def self.enabled_by_default?
false
end
def sidebar_items
main_sidebar_items + settings_sidebar_items
end
private
def main_sidebar_items
return [] unless
c... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/controllers/components/course/assessments_component.rb | app/controllers/components/course/assessments_component.rb | # frozen_string_literal: true
class Course::AssessmentsComponent < SimpleDelegator
include Course::ControllerComponentHost::Component
include Course::UnreadCountsConcern
def self.lesson_plan_item_actable_names
[Course::Assessment.name]
end
def sidebar_items
main_sidebar_items + admin_sidebar_items +... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/controllers/components/course/learning_map_component.rb | app/controllers/components/course/learning_map_component.rb | # frozen_string_literal: true
class Course::LearningMapComponent < SimpleDelegator
include Course::ControllerComponentHost::Component
def self.enabled_by_default?
false
end
def sidebar_items
[
{
key: :learning_map,
icon: :map,
weight: 5,
path: course_learning_map_... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/controllers/components/course/koditsu_platform_component.rb | app/controllers/components/course/koditsu_platform_component.rb | # frozen_string_literal: true
class Course::KoditsuPlatformComponent < SimpleDelegator
include Course::ControllerComponentHost::Component
def self.enabled_by_default?
false
end
end
| ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/controllers/components/course/users_component.rb | app/controllers/components/course/users_component.rb | # frozen_string_literal: true
class Course::UsersComponent < SimpleDelegator
include Course::ControllerComponentHost::Component
include Course::UnreadCountsConcern
def self.can_be_disabled_for_course?
false
end
def sidebar_items
main_sidebar_items + admin_sidebar_items
end
private
def main_... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/controllers/components/course/multiple_reference_timelines_component.rb | app/controllers/components/course/multiple_reference_timelines_component.rb | # frozen_string_literal: true
class Course::MultipleReferenceTimelinesComponent < SimpleDelegator
include Course::ControllerComponentHost::Component
def self.enabled_by_default?
false
end
def sidebar_items
return [] unless can?(:manage, Course::ReferenceTimeline.new(course: current_course))
[
... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/controllers/components/course/achievements_component.rb | app/controllers/components/course/achievements_component.rb | # frozen_string_literal: true
class Course::AchievementsComponent < SimpleDelegator
include Course::ControllerComponentHost::Component
def self.gamified?
true
end
def sidebar_items
[
{
key: :achievements,
icon: :achievement,
weight: 4,
path: course_achievements_pa... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/controllers/components/course/codaveri_component.rb | app/controllers/components/course/codaveri_component.rb | # frozen_string_literal: true
class Course::CodaveriComponent < SimpleDelegator
include Course::ControllerComponentHost::Component
def sidebar_items
settings_sidebar_items
end
private
def settings_sidebar_items
[
{
key: self.class.key,
type: :settings,
weight: 6,
... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/controllers/components/course/monitoring_component.rb | app/controllers/components/course/monitoring_component.rb | # frozen_string_literal: true
class Course::MonitoringComponent < SimpleDelegator
include Course::ControllerComponentHost::Component
def self.enabled_by_default?
false
end
end
| ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/controllers/components/course/plagiarism_component.rb | app/controllers/components/course/plagiarism_component.rb | # frozen_string_literal: true
class Course::PlagiarismComponent < SimpleDelegator
include Course::ControllerComponentHost::Component
def self.enabled_by_default?
false
end
def sidebar_items
return [] unless can?(:manage_plagiarism, current_course)
[
{
key: :admin_plagiarism,
... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/controllers/components/course/announcements_component.rb | app/controllers/components/course/announcements_component.rb | # frozen_string_literal: true
class Course::AnnouncementsComponent < SimpleDelegator
include Course::ControllerComponentHost::Component
include Course::UnreadCountsConcern
def sidebar_items
main_sidebar_items + settings_sidebar_items
end
private
def main_sidebar_items
[
{
key: :anno... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/controllers/components/course/discussion/topics_component.rb | app/controllers/components/course/discussion/topics_component.rb | # frozen_string_literal: true
class Course::Discussion::TopicsComponent < SimpleDelegator
include Course::ControllerComponentHost::Component
include Course::UnreadCountsConcern
def sidebar_items
main_sidebar_items + settings_sidebar_items
end
private
def main_sidebar_items
[
{
key: ... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/notifiers/notifier/base.rb | app/notifiers/notifier/base.rb | # frozen_string_literal: true
# The base class of notifiers. This is meant to be called by the Notifications Framework
#
# @api notifications
class Notifier::Base
include ApplicationNotificationsHelper
class << self
# This is to allow client code to create notifications without explicitly instantiating
# n... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/notifiers/course/video_notifier.rb | app/notifiers/course/video_notifier.rb | # frozen_string_literal: true
class Course::VideoNotifier < Notifier::Base
def video_attempted(user, video)
create_activity(actor: user, object: video, event: :attempted).
notify(video.course, :feed).
save!
end
def video_closing(user, video)
email_enabled = video.course.email_enabled(:videos,... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/notifiers/course/announcement_notifier.rb | app/notifiers/course/announcement_notifier.rb | # frozen_string_literal: true
class Course::AnnouncementNotifier < Notifier::Base
# To be called when an announcement is made.
def new_announcement(user, announcement)
email_enabled = announcement.course.email_enabled(:announcements, :new_announcement)
return unless email_enabled.regular || email_enabled.ph... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/notifiers/course/assessment_notifier.rb | app/notifiers/course/assessment_notifier.rb | # frozen_string_literal: true
class Course::AssessmentNotifier < Notifier::Base
# To be called when user attempted an assessment.
def assessment_attempted(user, assessment)
create_activity(actor: user, object: assessment, event: :attempted).
notify(assessment.tab.category.course, :feed).
save!
end... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/notifiers/course/consolidated_opening_reminder_notifier.rb | app/notifiers/course/consolidated_opening_reminder_notifier.rb | # frozen_string_literal: true
class Course::ConsolidatedOpeningReminderNotifier < Notifier::Base
# Create an opening reminder activity if there are upcoming items for the course.
def opening_reminder(course)
return unless course.upcoming_lesson_plan_items_exist?
create_activity(actor: User.system, object: ... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/notifiers/course/level_notifier.rb | app/notifiers/course/level_notifier.rb | # frozen_string_literal: true
class Course::LevelNotifier < Notifier::Base
# To be called when user reached a new level.
def level_reached(user, level)
create_activity(actor: user, object: level, event: :reached).
notify(level.course, :feed).
notify(user, :popup).
save
end
end
| ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/notifiers/course/achievement_notifier.rb | app/notifiers/course/achievement_notifier.rb | # frozen_string_literal: true
class Course::AchievementNotifier < Notifier::Base
# To be called when user gained an achievement.
def achievement_gained(user, achievement)
create_activity(actor: user, object: achievement, event: :gained).
notify(achievement.course, :feed).
notify(user, :popup).
... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/notifiers/course/forum/post_notifier.rb | app/notifiers/course/forum/post_notifier.rb | # frozen_string_literal: true
class Course::Forum::PostNotifier < Notifier::Base
# Called when a user replies to a forum post.
#
# @param[User] User who replied to the forum post
# @param[CourseUser] course_user The course_user who replied to the forum post.
# This can be +nil+ in exceptional cases where th... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/notifiers/course/forum/topic_notifier.rb | app/notifiers/course/forum/topic_notifier.rb | # frozen_string_literal: true
class Course::Forum::TopicNotifier < Notifier::Base
# To be called when user created a new forum topic.
def topic_created(user, course_user, topic)
course = topic.forum.course
email_enabled = course.email_enabled(:forums, :new_topic)
return unless email_enabled.regular || e... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/notifiers/course/assessment/submission_question/comment_notifier.rb | app/notifiers/course/assessment/submission_question/comment_notifier.rb | # frozen_string_literal: true
class Course::Assessment::SubmissionQuestion::CommentNotifier < Notifier::Base
# Called when a user comments on an submission_question.
#
# @param[Course::Discussion::Post] post The post that was created.
def post_replied(post)
category = post.topic.actable.submission.assessmen... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/notifiers/course/assessment/answer/comment_notifier.rb | app/notifiers/course/assessment/answer/comment_notifier.rb | # frozen_string_literal: true
class Course::Assessment::Answer::CommentNotifier < Notifier::Base
# Called when a user adds a post to a programming annotation.
#
# @param[Course::Discussion::Post] post The post that was created.
def annotation_replied(post)
category = post.topic.actable.file.answer.submissio... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/duplication_traceable.rb | app/models/duplication_traceable.rb | # frozen_string_literal: true
class DuplicationTraceable < ApplicationRecord
actable
validates :actable_type, length: { maximum: 255 }, allow_nil: true
validates :actable_type, uniqueness: { scope: [:actable_id], allow_nil: true,
if: -> { actable_id? && actable_type_chang... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/course_user.rb | app/models/course_user.rb | # frozen_string_literal: true
class CourseUser < ApplicationRecord
include CourseUser::StaffConcern
include CourseUser::LevelProgressConcern
include CourseUser::TodoConcern
after_initialize :set_defaults, if: :new_record?
before_validation :set_defaults, if: :new_record?
enum :role, { student: 0, teaching... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/ability.rb | app/models/ability.rb | # frozen_string_literal: true
class Ability
include CanCan::Ability
attr_reader :user, :course, :course_user, :instance_user, :session
# Load all components which declare abilities.
AbilityHost.components.each { |component| prepend(component) }
# Initialize the ability of user.
#
# @param [User|nil] use... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/attachment_reference.rb | app/models/attachment_reference.rb | # frozen_string_literal: true
class AttachmentReference < ApplicationRecord
include DuplicationStateTrackingConcern
before_save :update_expires_at
validates :attachable_type, length: { maximum: 255 }, allow_blank: true
validates :name, length: { maximum: 255 }, allow_blank: true
validates :name, presence: t... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/generic_announcement.rb | app/models/generic_announcement.rb | # frozen_string_literal: true
# Represents a generic announcement, which may be either a system-level or instance-level one.
#
# This is the abstract single-table inheritance table used for both announcement types.
class GenericAnnouncement < ApplicationRecord
include AnnouncementConcern
acts_as_readable on: :upda... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/cikgo_user.rb | app/models/cikgo_user.rb | # frozen_string_literal: true
class CikgoUser < ApplicationRecord
validates :user, presence: true
validates :provided_user_id, presence: true
belongs_to :user, inverse_of: :cikgo_user
end
| ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/settings.rb | app/models/settings.rb | # frozen_string_literal: true
class Settings
include ActiveModel::Model
include ActiveModel::Conversion
include ActiveModel::Validations
# Initialises the settings adapter
#
# @param [#settable] settable The settable object that has settings_on_rails settings.
def initialize(settable)
@settable = set... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/attachment.rb | app/models/attachment.rb | # frozen_string_literal: true
class Attachment < ApplicationRecord
TEMPORARY_FILE_PREFIX = 'attachment'
mount_uploader :file_upload, FileUploader
validates :name, length: { maximum: 255 }, presence: true, uniqueness: { if: :name_changed? }
validates :file_upload, presence: true
validates_integrity_of :file... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/activity.rb | app/models/activity.rb | # frozen_string_literal: true
# The object which represents the user's activity. This is meant to be called by the Notifications
# Framework
#
# @api notifications
class Activity < ApplicationRecord
validates :object_type, length: { maximum: 255 }, presence: true
validates :event, length: { maximum: 255 }, presence... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/application_record.rb | app/models/application_record.rb | # frozen_string_literal: true
class ApplicationRecord < ActiveRecord::Base
self.abstract_class = true
include ApplicationUserstampConcern
include ApplicationActsAsConcern
end
| ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/instance_user.rb | app/models/instance_user.rb | # frozen_string_literal: true
class InstanceUser < ApplicationRecord
include InstanceUserSearchConcern
include Generic::CollectionConcern
acts_as_tenant :instance, inverse_of: :instance_users
after_initialize :set_defaults, if: :new_record?
enum :role, { normal: 0, instructor: 1, administrator: 2 }
valida... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/user_notification.rb | app/models/user_notification.rb | # frozen_string_literal: true
# The user level notification. This is meant to be called by the Notifications Framework
#
# @api notifications
class UserNotification < ApplicationRecord
acts_as_readable on: :created_at
enum :notification_type, { popup: 0, email: 1 }
validates :notification_type, presence: true
... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/instance.rb | app/models/instance.rb | # frozen_string_literal: true
class Instance < ApplicationRecord
include Instance::CourseComponentsConcern
include Generic::CollectionConcern
DEFAULT_INSTANCE_ID = 0
has_settings_on :settings
class << self
# Finds the default instance.
#
# @return [Instance]
def default
@default ||= f... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/course.rb | app/models/course.rb | # frozen_string_literal: true
class Course < ApplicationRecord
include Course::SearchConcern
include Course::DuplicationConcern
include Course::CourseComponentsConcern
include TimeZoneConcern
include Generic::CollectionConcern
acts_as_tenant :instance, inverse_of: :courses
has_settings_on :settings do |s... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/user.rb | app/models/user.rb | # frozen_string_literal: true
# Represents a user in the application. Users are shared across all instances.
class User < ApplicationRecord
SYSTEM_USER_ID = 0
DELETED_USER_ID = -1
include UserSearchConcern
include TimeZoneConcern
include Generic::CollectionConcern
model_stamper
acts_as_reader
mount_upl... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/system/announcement.rb | app/models/system/announcement.rb | # frozen_string_literal: true
class System::Announcement < GenericAnnouncement
validates :instance, absence: true
end
| ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/concerns/duplication_state_tracking_concern.rb | app/models/concerns/duplication_state_tracking_concern.rb | # frozen_string_literal: true
#
# This concern provides methods to track the duplication states.
module DuplicationStateTrackingConcern
extend ActiveSupport::Concern
included do
# Only clear the flag after the transaction is committed.
# `after_save` could be called multiple times, which could result in th... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/concerns/user_search_concern.rb | app/models/concerns/user_search_concern.rb | # frozen_string_literal: true
module UserSearchConcern
extend ActiveSupport::Concern
module ClassMethods
# Search and filter users by their names or emails.
#
# @param [String] keyword The keywords for filtering users.
# @return [Array<User>] The users which match the keyword. All users will be ret... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/concerns/time_zone_concern.rb | app/models/concerns/time_zone_concern.rb | # frozen_string_literal: true
module TimeZoneConcern
extend ActiveSupport::Concern
def self.included(base)
base.class_eval { validates_with TimeZoneValidator }
end
# Override ActiveRecord's default time_zone getter method.
#
# If time_zone for model is not set, default it to Application Default.
# I... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/concerns/course_component_query_concern.rb | app/models/concerns/course_component_query_concern.rb | # frozen_string_literal: true
#
# This concern provides methods to query which course components are set as enabled/disabled
# for the models in which they are included (e.g. Course, Instance).
#
# The core functionality that this concern provides is the logic to reconcile:
# 1. Settings specified by users who are ma... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/concerns/user_authentication_concern.rb | app/models/concerns/user_authentication_concern.rb | # frozen_string_literal: true
module UserAuthenticationConcern
extend ActiveSupport::Concern
included do
# Include default devise modules. Others available are:
# :validatable, :confirmable, :lockable, :timeoutable and :omniauthable
# Devise is now only used to manage user registration.
# Authentic... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/concerns/component_settings_concern.rb | app/models/concerns/component_settings_concern.rb | # frozen_string_literal: true
module ComponentSettingsConcern
extend ActiveSupport::Concern
# This is used when generating checkboxes for each of the components
def disableable_component_collection
@settable.disableable_components.map { |c| c.key.to_s }
end
# Returns the ids of enabled components that c... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/concerns/announcement_concern.rb | app/models/concerns/announcement_concern.rb | # frozen_string_literal: true
#
# Concern of common methods for the announcements - GenericAnnouncement and Course::Announcement.
module AnnouncementConcern
extend ActiveSupport::Concern
included do
has_many_attachments on: :content
after_initialize :set_defaults, if: :new_record?
after_create :mark_a... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/concerns/safe_mark_as_read_concern.rb | app/models/concerns/safe_mark_as_read_concern.rb | # frozen_string_literal: true
module SafeMarkAsReadConcern
extend ActiveSupport::Concern
def safely_mark_as_read!(options)
unless respond_to?(:mark_as_read!) || Rails.env.production?
raise "Did you have #{self.class.name} `acts_as_readable`?"
end
mark_as_read!(options)
rescue ActiveRecord::Rec... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/concerns/application_acts_as_concern.rb | app/models/concerns/application_acts_as_concern.rb | # frozen_string_literal: true
module ApplicationActsAsConcern
extend ActiveSupport::Concern
module ClassMethods
# Subclasses +acts_as+ to automatically inject the +inverse_of+ option.
def acts_as(*args)
options = args.extract_options!
options.reverse_merge!(inverse_of: :actable)
args.pus... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/concerns/instance_user_search_concern.rb | app/models/concerns/instance_user_search_concern.rb | # frozen_string_literal: true
module InstanceUserSearchConcern
extend ActiveSupport::Concern
module ClassMethods
# Search and filter users by their names or emails.
#
# @param [String] keyword The keywords for filtering users.
# @return [Array<User>] The users which match the keyword. All users wil... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/concerns/application_userstamp_concern.rb | app/models/concerns/application_userstamp_concern.rb | # frozen_string_literal: true
module ApplicationUserstampConcern
extend ActiveSupport::Concern
module ClassMethods
# Bring forward the userstamp association definitions
# TODO: Remove after lowjoel/activerecord-userstamp#27 is closed
def inherited(klass)
super
klass.class_eval do
a... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/concerns/user_notifications_concern.rb | app/models/concerns/user_notifications_concern.rb | # frozen_string_literal: true
module UserNotificationsConcern
# Get user's unread notifications
def unread
unread_by(proxy_association.owner)
end
end
| ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/concerns/course_user/todo_concern.rb | app/models/concerns/course_user/todo_concern.rb | # frozen_string_literal: true
module CourseUser::TodoConcern
extend ActiveSupport::Concern
included do
after_create :create_todos_for_course_user
after_destroy :delete_todos
end
# Create todos for all course_users.
def create_todos_for_course_user
return unless user
items =
Course::Le... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/concerns/course_user/achievements_concern.rb | app/models/concerns/course_user/achievements_concern.rb | # frozen_string_literal: true
module CourseUser::AchievementsConcern
# Order achievements based on when each course_user obtained the achievement.
def ordered_by_date_obtained
unscope(:order).
order('course_user_achievements.obtained_at DESC')
end
def recently_obtained(num = 3)
ordered_by_date_ob... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/concerns/course_user/level_progress_concern.rb | app/models/concerns/course_user/level_progress_concern.rb | # frozen_string_literal: true
module CourseUser::LevelProgressConcern
extend ActiveSupport::Concern
delegate :level_number, :next_level_threshold, to: :current_level
# Returns the level object of the CourseUser with respect to a course's Course::Levels.
#
# @return [Course::Level] Level of CourseUser.
def... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Coursemology/coursemology2 | https://github.com/Coursemology/coursemology2/blob/f6a688831806eb56d4d9a9c2942a1430d1ecd262/app/models/concerns/course_user/staff_concern.rb | app/models/concerns/course_user/staff_concern.rb | # frozen_string_literal: true
# This concern related to staff performance calculation.
module CourseUser::StaffConcern
extend ActiveSupport::Concern
included do
# Sort the staff by their average marking time.
# Note that nil time will be considered as the largest, which will come to the bottom of the
... | ruby | MIT | f6a688831806eb56d4d9a9c2942a1430d1ecd262 | 2026-01-04T17:32:51.807345Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.