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 | osunyorg/admin | https://github.com/osunyorg/admin | app/models/concerns/as_localized_tree.rb | Ruby | mit | 48 | main | 2,032 | module AsLocalizedTree
extend ActiveSupport::Concern
included do
scope :root, -> {
joins(:about).where(about_table_name => { parent_id: nil })
}
scope :ordered, -> (language = nil) {
# Use the ordered scope from the about class
joins(:about)
.merge(about_class.ordered(language... |
github | osunyorg/admin | https://github.com/osunyorg/admin | app/models/concerns/with_abouts.rb | Ruby | mit | 48 | main | 753 | module WithAbouts
extend ActiveSupport::Concern
included do
belongs_to :about,
polymorphic: true,
optional: true
before_validation :nullify_about_id_if_about_type_changed_to_blank
scope :for_about_type, -> (about_type, language = nil) {
value = about_type.includ... |
github | osunyorg/admin | https://github.com/osunyorg/admin | app/models/concerns/searchable.rb | Ruby | mit | 48 | main | 1,436 | module Searchable
extend ActiveSupport::Concern
SEARCH_FIELDS_OPTIONAL = [
:biography,
:text,
:long_name
]
included do
after_save :save_search_data
end
def save_search_data
localizations.each do |l10n|
search = Search.where(
university: university,
about_object: ... |
github | osunyorg/admin | https://github.com/osunyorg/admin | app/models/concerns/as_tree.rb | Ruby | mit | 48 | main | 1,638 | module AsTree
extend ActiveSupport::Concern
included do
scope :root, -> { where(parent_id: nil) }
scope :ordered_by_position_in_tree, -> { order(:position_in_tree)}
after_save :update_position_in_tree_later
after_touch :update_position_in_tree_later
end
def has_children?
children.any?
e... |
github | osunyorg/admin | https://github.com/osunyorg/admin | app/models/concerns/templatable.rb | Ruby | mit | 48 | main | 2,574 | module Templatable
extend ActiveSupport::Concern
included do
belongs_to :template,
class_name: self.name,
optional: true
has_many :generated_objects,
class_name: self.name,
foreign_key: :template_id,
dependent: :nullify
... |
github | osunyorg/admin | https://github.com/osunyorg/admin | app/models/concerns/has_list_blocks.rb | Ruby | mit | 48 | main | 590 | module HasListBlocks
extend ActiveSupport::Concern
included do
after_save :synchronize_list_blocks
after_destroy :synchronize_list_blocks
after_restore :synchronize_list_blocks if paranoid?
after_touch :synchronize_list_blocks
end
protected
def synchronize_list_blocks
websites.each... |
github | osunyorg/admin | https://github.com/osunyorg/admin | app/models/concerns/categorizable.rb | Ruby | mit | 48 | main | 1,401 | module Categorizable
extend ActiveSupport::Concern
include Bodyclassed
included do
attr_accessor :categories_were_changed
has_and_belongs_to_many :categories,
after_add: :mark_categories_as_changed,
after_remove: :mark_categories_as_changed
a... |
github | osunyorg/admin | https://github.com/osunyorg/admin | app/models/concerns/libre_translatable.rb | Ruby | mit | 48 | main | 383 | # Always applied to a localization
module LibreTranslatable
extend ActiveSupport::Concern
def libre_translatable?
# Might evolve in the future to allow re-translating from another localization.
# For now, do not translate originals.
return false if original?
original.language.supported_by_libretran... |
github | osunyorg/admin | https://github.com/osunyorg/admin | app/models/concerns/addable_to_calendar.rb | Ruby | mit | 48 | main | 2,916 | module AddableToCalendar
extend ActiveSupport::Concern
included do
# Add condition to prevent double-setting
before_save :set_add_to_calendar_urls, unless: :add_to_calendar_urls_changed?
end
def cal
@cal ||= AddToCalendar::URLs.new(
start_datetime: cal_from_time,
end_datetime: cal_to_t... |
github | osunyorg/admin | https://github.com/osunyorg/admin | app/models/communication/website.rb | Ruby | mit | 48 | main | 9,055 | # == Schema Information
#
# Table name: communication_websites
#
# id :uuid not null, primary key
# about_type :string indexed => [about_id]
# access_token :string
# apache_config_custom_content :text
# archive_content :... |
github | osunyorg/admin | https://github.com/osunyorg/admin | app/models/communication/extranet.rb | Ruby | mit | 48 | main | 4,835 | # == Schema Information
#
# Table name: communication_extranets
#
# id :uuid not null, primary key
# about_type :string indexed => [about_id]
# color :string
# css :text
# feature_alumni :boolean ... |
github | osunyorg/admin | https://github.com/osunyorg/admin | app/models/communication/block.rb | Ruby | mit | 48 | main | 5,357 | # == Schema Information
#
# Table name: communication_blocks
#
# id :uuid not null, primary key
# about_type :string indexed => [about_id]
# data :jsonb
# deleted_at :datetime
# html_class :string
# metadata ... |
github | osunyorg/admin | https://github.com/osunyorg/admin | app/models/communication/media.rb | Ruby | mit | 48 | main | 7,413 | # == Schema Information
#
# Table name: communication_medias
#
# id :uuid not null, primary key
# origin :integer default("upload"), not null
# original_byte_size :bigint
# original_checksum :string
# orig... |
github | osunyorg/admin | https://github.com/osunyorg/admin | app/models/communication/extranet/document.rb | Ruby | mit | 48 | main | 1,699 | # == Schema Information
#
# Table name: communication_extranet_documents
#
# id :uuid not null, primary key
# created_at :datetime not null
# updated_at :datetime not null
# category_id :uuid indexed
# extranet_id :uuid not null, indexed
# k... |
github | osunyorg/admin | https://github.com/osunyorg/admin | app/models/communication/extranet/with_style.rb | Ruby | mit | 48 | main | 400 | module Communication::Extranet::WithStyle
extend ActiveSupport::Concern
included do
before_validation :generate_css
end
protected
def generate_css
if sass.blank?
self.css = ''
return
end
begin
self.css = SassC::Engine.new(sass, syntax: :sass, style: :compressed).render
... |
github | osunyorg/admin | https://github.com/osunyorg/admin | app/models/communication/extranet/with_connected_objects.rb | Ruby | mit | 48 | main | 935 | module Communication::Extranet::WithConnectedObjects
extend ActiveSupport::Concern
included do
has_many :connections, dependent: :destroy
end
def connected?(object)
connections.where(university: university, about: object).any?
end
def connect(object)
connections.where(university: university, ... |
github | osunyorg/admin | https://github.com/osunyorg/admin | app/models/communication/extranet/post.rb | Ruby | mit | 48 | main | 2,932 | # == Schema Information
#
# Table name: communication_extranet_posts
#
# id :uuid not null, primary key
# created_at :datetime not null
# updated_at :datetime not null
# author_id :uuid indexed
# category_id :uuid indexed
# extranet_id :... |
github | osunyorg/admin | https://github.com/osunyorg/admin | app/models/communication/extranet/with_features.rb | Ruby | mit | 48 | main | 471 | module Communication::Extranet::WithFeatures
extend ActiveSupport::Concern
included do
FEATURES = [
:posts,
:contacts,
:documents,
:alumni,
:jobs,
]
validate :feature_alumni_is_available
end
def has_feature?(identifier)
public_send "feature_#{identifier}"
end
... |
github | osunyorg/admin | https://github.com/osunyorg/admin | app/models/communication/extranet/with_legal.rb | Ruby | mit | 48 | main | 578 | module Communication::Extranet::WithLegal
extend ActiveSupport::Concern
include ActionView::Helpers::SanitizeHelper
def has_terms_in?(language)
l10n = localization_for(language)
l10n.present? && strip_tags(l10n.terms).to_s.strip.present?
end
def has_cookies_policy_in?(language)
l10n = localizat... |
github | osunyorg/admin | https://github.com/osunyorg/admin | app/models/communication/extranet/connection.rb | Ruby | mit | 48 | main | 1,510 | # == Schema Information
#
# Table name: communication_extranet_connections
#
# id :uuid not null, primary key
# about_type :string indexed => [about_id]
# created_at :datetime not null
# updated_at :datetime not null
# about_id :uuid indexe... |
github | osunyorg/admin | https://github.com/osunyorg/admin | app/models/communication/extranet/localization.rb | Ruby | mit | 48 | main | 2,741 | # == Schema Information
#
# Table name: communication_extranet_localizations
#
# id :uuid not null, primary key
# cookies_policy :text
# home_sentence :text
# invitation_message_subject :string default("")
# invitation_message_text :text ... |
github | osunyorg/admin | https://github.com/osunyorg/admin | app/models/communication/extranet/post/category.rb | Ruby | mit | 48 | main | 892 | # == Schema Information
#
# Table name: communication_extranet_post_categories
#
# id :uuid not null, primary key
# created_at :datetime not null
# updated_at :datetime not null
# extranet_id :uuid not null, indexed
# university_id :uuid not nu... |
github | osunyorg/admin | https://github.com/osunyorg/admin | app/models/communication/extranet/post/localization.rb | Ruby | mit | 48 | main | 2,471 | # == Schema Information
#
# Table name: communication_extranet_post_localizations
#
# id :uuid not null, primary key
# featured_image_alt :string
# featured_image_credit :text
# pinned :boolean default(FALSE)
# published :boolean defaul... |
github | osunyorg/admin | https://github.com/osunyorg/admin | app/models/communication/extranet/post/category/localization.rb | Ruby | mit | 48 | main | 1,865 | # == Schema Information
#
# Table name: communication_extranet_post_category_localizations
#
# id :uuid not null, primary key
# name :string
# slug :string
# created_at :datetime not null
# updated_at :datetime not null
# about_id :uuid ... |
github | osunyorg/admin | https://github.com/osunyorg/admin | app/models/communication/extranet/document/facets.rb | Ruby | mit | 48 | main | 859 | class Communication::Extranet::Document::Facets < FacetedSearch::Facets
attr_reader :language
def initialize(params, extranet, language)
super(params)
@model = extranet.documents
@language = language
filter_with_text :name, {
title: Communication::Extranet::Document::Localization.human_attr... |
github | osunyorg/admin | https://github.com/osunyorg/admin | app/models/communication/extranet/document/localization.rb | Ruby | mit | 48 | main | 1,612 | # == Schema Information
#
# Table name: communication_extranet_document_localizations
#
# id :uuid not null, primary key
# name :string
# published :boolean default(FALSE)
# published_at :datetime
# created_at :datetime not null
# updated_at :datetime ... |
github | osunyorg/admin | https://github.com/osunyorg/admin | app/models/communication/extranet/document/category.rb | Ruby | mit | 48 | main | 1,043 | # == Schema Information
#
# Table name: communication_extranet_document_categories
#
# id :uuid not null, primary key
# created_at :datetime not null
# updated_at :datetime not null
# extranet_id :uuid not null, indexed
# university_id :uuid no... |
github | osunyorg/admin | https://github.com/osunyorg/admin | app/models/communication/extranet/document/kind.rb | Ruby | mit | 48 | main | 1,024 | # == Schema Information
#
# Table name: communication_extranet_document_kinds
#
# id :uuid not null, primary key
# created_at :datetime not null
# updated_at :datetime not null
# extranet_id :uuid not null, indexed
# university_id :uuid not nul... |
github | osunyorg/admin | https://github.com/osunyorg/admin | app/models/communication/extranet/document/category/localization.rb | Ruby | mit | 48 | main | 1,832 | # == Schema Information
#
# Table name: communication_extranet_document_category_localizations
#
# id :uuid not null, primary key
# name :string
# slug :string
# created_at :datetime not null
# updated_at :datetime not null
# about_id :uuid ... |
github | osunyorg/admin | https://github.com/osunyorg/admin | app/models/communication/extranet/document/kind/localization.rb | Ruby | mit | 48 | main | 1,819 | # == Schema Information
#
# Table name: communication_extranet_document_kind_localizations
#
# id :uuid not null, primary key
# name :string
# slug :string
# created_at :datetime not null
# updated_at :datetime not null
# about_id :uuid ... |
github | osunyorg/admin | https://github.com/osunyorg/admin | app/models/communication/block/with_html_class.rb | Ruby | mit | 48 | main | 553 | module Communication::Block::WithHtmlClass
extend ActiveSupport::Concern
included do
before_validation :parameterize_html_class
end
def html_class_prepared
return if html_class.blank?
html_class.split(' ')
.map { |klass| "block-class-#{klass}" }
.join(' ')
end
prot... |
github | osunyorg/admin | https://github.com/osunyorg/admin | app/models/communication/block/with_heading_ranks.rb | Ruby | mit | 48 | main | 2,236 | module Communication::Block::WithHeadingRanks
extend ActiveSupport::Concern
# h1 is the page title
DEFAULT_HEADING_LEVEL = 2
# Title is the block intrinsic title
# Not to be confused with `block_title``
def heading_self?
title.present?
end
# Self rank is used for the title (h2 if root, h3 if belo... |
github | osunyorg/admin | https://github.com/osunyorg/admin | app/models/communication/block/with_media_library.rb | Ruby | mit | 48 | main | 745 | module Communication::Block::WithMediaLibrary
extend ActiveSupport::Concern
included do
# after_save :synchronize_media_library
end
protected
def synchronize_media_library
media_blob_ids = []
# Add
template.media_blobs.each do |media_blob|
blob = media_blob[:blob]
alt = media_bl... |
github | osunyorg/admin | https://github.com/osunyorg/admin | app/models/communication/block/with_open_api.rb | Ruby | mit | 48 | main | 2,865 | module Communication::Block::WithOpenApi
extend ActiveSupport::Concern
included do
OPENAPI_SCHEMA = {
type: :object,
title: "Communication::Block",
properties: {
id: { type: :string, format: :uuid, nullable: true },
migration_identifier: { type: :string, nullable: true },
... |
github | osunyorg/admin | https://github.com/osunyorg/admin | app/models/communication/block/with_template.rb | Ruby | mit | 48 | main | 3,418 | module Communication::Block::WithTemplate
extend ActiveSupport::Concern
included do
OPTION_PREFIX = 'option_'.freeze
# Les numéros sont un peu en vrac
# Dans l'idée, pour le futur
# 1000 basic
# 2000 storytelling
# 3000 references
# 4000 utilities
enum :template_kind, {
chapt... |
github | osunyorg/admin | https://github.com/osunyorg/admin | app/models/communication/block/component/base.rb | Ruby | mit | 48 | main | 848 | class Communication::Block::Component::Base
include WithAccessibility
include WithDependencies
attr_reader :property, :template
def self.openapi_property_type
:string
end
def self.openapi_property_format
nil
end
def self.openapi_property_additional_properties
{}
end
def initialize(p... |
github | osunyorg/admin | https://github.com/osunyorg/admin | app/models/communication/block/component/person.rb | Ruby | mit | 48 | main | 253 | class Communication::Block::Component::Person < Communication::Block::Component::BaseReference
def person
template.block
.university
.people
.find_by(id: data)
end
def dependencies
[person]
end
end |
github | osunyorg/admin | https://github.com/osunyorg/admin | app/models/communication/block/component/volume.rb | Ruby | mit | 48 | main | 232 | class Communication::Block::Component::Volume < Communication::Block::Component::BaseReference
def volume
return unless website
website.research_volumes.find_by(id: data)
end
def dependencies
[volume]
end
end |
github | osunyorg/admin | https://github.com/osunyorg/admin | app/models/communication/block/component/time_slot.rb | Ruby | mit | 48 | main | 577 | class Communication::Block::Component::TimeSlot < Communication::Block::Component::Base
def self.openapi_property_type
:object
end
def self.openapi_property_additional_properties
{
properties: {
from: { type: :string, format: 'time' },
to: { type: :string, format: 'time' }
}
... |
github | osunyorg/admin | https://github.com/osunyorg/admin | app/models/communication/block/component/layout.rb | Ruby | mit | 48 | main | 262 | class Communication::Block::Component::Layout < Communication::Block::Component::Base
def default_data
"#{template.default_layout}"
end
def data=(value)
@data = value.blank? ? template.default_layout
: value
end
end |
github | osunyorg/admin | https://github.com/osunyorg/admin | app/models/communication/block/component/program.rb | Ruby | mit | 48 | main | 219 | class Communication::Block::Component::Program < Communication::Block::Component::BaseReference
def program
template.block.university.programs.find_by(id: data)
end
def dependencies
[program]
end
end |
github | osunyorg/admin | https://github.com/osunyorg/admin | app/models/communication/block/component/person_category.rb | Ruby | mit | 48 | main | 277 | class Communication::Block::Component::PersonCategory < Communication::Block::Component::BaseReference
def categories
@categories ||= university.person_categories
end
def category
categories.find_by(id: data)
end
def dependencies
[category]
end
end |
github | osunyorg/admin | https://github.com/osunyorg/admin | app/models/communication/block/component/page_category.rb | Ruby | mit | 48 | main | 287 | class Communication::Block::Component::PageCategory < Communication::Block::Component::Base
def categories
@categories ||= website.page_categories
end
def category
return unless website
categories.find_by(id: data)
end
def dependencies
[category]
end
end |
github | osunyorg/admin | https://github.com/osunyorg/admin | app/models/communication/block/component/file.rb | Ruby | mit | 48 | main | 714 | class Communication::Block::Component::File < Communication::Block::Component::Base
def self.openapi_property_type
:object
end
def self.openapi_property_additional_properties
{
properties: {
id: { type: :string, format: :uuid, nullable: true },
filename: { type: :string, nullable: ... |
github | osunyorg/admin | https://github.com/osunyorg/admin | app/models/communication/block/component/event.rb | Ruby | mit | 48 | main | 305 | class Communication::Block::Component::Event < Communication::Block::Component::Base
def event
return unless website
website.events
.except_templates
.published_now_in(template.block.language)
.find_by(id: data)
end
def dependencies
[event]
end
end |
github | osunyorg/admin | https://github.com/osunyorg/admin | app/models/communication/block/component/agenda_category.rb | Ruby | mit | 48 | main | 300 | class Communication::Block::Component::AgendaCategory < Communication::Block::Component::BaseReference
def categories
@categories ||= website.agenda_categories
end
def category
return unless website
categories.find_by(id: data)
end
def dependencies
[category]
end
end |
github | osunyorg/admin | https://github.com/osunyorg/admin | app/models/communication/block/component/location.rb | Ruby | mit | 48 | main | 238 | class Communication::Block::Component::Location < Communication::Block::Component::BaseReference
def location
template.block.university.administration_locations.find_by(id: data)
end
def dependencies
[location]
end
end |
github | osunyorg/admin | https://github.com/osunyorg/admin | app/models/communication/block/component/post.rb | Ruby | mit | 48 | main | 281 | class Communication::Block::Component::Post < Communication::Block::Component::BaseReference
def post
return unless website
website.posts
.published_now_in(template.block.language)
.find_by(id: data)
end
def dependencies
[post]
end
end |
github | osunyorg/admin | https://github.com/osunyorg/admin | app/models/communication/block/component/exhibition.rb | Ruby | mit | 48 | main | 296 | class Communication::Block::Component::Exhibition < Communication::Block::Component::Base
def exhibition
return unless website
website.exhibitions
.published_now_in(template.block.language)
.find_by(id: data)
end
def dependencies
[exhibition]
end
end |
github | osunyorg/admin | https://github.com/osunyorg/admin | app/models/communication/block/component/post_category.rb | Ruby | mit | 48 | main | 296 | class Communication::Block::Component::PostCategory < Communication::Block::Component::BaseReference
def categories
@categories ||= website.post_categories
end
def category
return unless website
categories.find_by(id: data)
end
def dependencies
[category]
end
end |
github | osunyorg/admin | https://github.com/osunyorg/admin | app/models/communication/block/component/project.rb | Ruby | mit | 48 | main | 293 | class Communication::Block::Component::Project < Communication::Block::Component::BaseReference
def project
return unless website
website.projects
.published_now_in(template.block.language)
.find_by(id: data)
end
def dependencies
[project]
end
end |
github | osunyorg/admin | https://github.com/osunyorg/admin | app/models/communication/block/component/job_category.rb | Ruby | mit | 48 | main | 299 | class Communication::Block::Component::JobCategory < Communication::Block::Component::BaseReference
def categories
@categories ||= website.jobboard_categories
end
def category
return unless website
categories.find_by(id: data)
end
def dependencies
[category]
end
end |
github | osunyorg/admin | https://github.com/osunyorg/admin | app/models/communication/block/component/page.rb | Ruby | mit | 48 | main | 280 | class Communication::Block::Component::Page < Communication::Block::Component::BaseReference
def page
return unless website
website.pages
.published_now_in(template.block.language)
.find_by(id: data)
end
def dependencies
[page]
end
end |
github | osunyorg/admin | https://github.com/osunyorg/admin | app/models/communication/block/component/taxonomy.rb | Ruby | mit | 48 | main | 253 | # Used by the Category template
class Communication::Block::Component::Taxonomy < Communication::Block::Component::Base
def taxonomy
template.available_categories
.find_by(id: data)
end
def dependencies
[taxonomy]
end
end |
github | osunyorg/admin | https://github.com/osunyorg/admin | app/models/communication/block/component/array.rb | Ruby | mit | 48 | main | 367 | class Communication::Block::Component::Array < Communication::Block::Component::Base
def self.openapi_property_type
:array
end
def self.openapi_property_additional_properties
{ items: { type: :string } }
end
def data=(value)
# Nil values must be turned to ""
@data = value.map { |s| s.to_s }... |
github | osunyorg/admin | https://github.com/osunyorg/admin | app/models/communication/block/component/project_category.rb | Ruby | mit | 48 | main | 304 | class Communication::Block::Component::ProjectCategory < Communication::Block::Component::BaseReference
def categories
@categories ||= website.portfolio_categories
end
def category
return unless website
categories.find_by(id: data)
end
def dependencies
[category]
end
end |
github | osunyorg/admin | https://github.com/osunyorg/admin | app/models/communication/block/component/option.rb | Ruby | mit | 48 | main | 202 | class Communication::Block::Component::Option < Communication::Block::Component::Base
attr_reader :options
def data
@data || default_data
end
def default_data
options.first
end
end |
github | osunyorg/admin | https://github.com/osunyorg/admin | app/models/communication/block/component/category.rb | Ruby | mit | 48 | main | 305 | # Not used yet, will be used by the Category Template to select specific categories
class Communication::Block::Component::Category < Communication::Block::Component::Base
def category
template.available_categories
.find_by(id: data)
end
def dependencies
[category]
end
end |
github | osunyorg/admin | https://github.com/osunyorg/admin | app/models/communication/block/component/rich_text.rb | Ruby | mit | 48 | main | 489 | class Communication::Block::Component::RichText < Communication::Block::Component::Base
def data=(value)
value = SummernoteCleaner.clean value.to_s
value = Osuny::Sanitizer.sanitize value, 'text'
@data = value
end
# Add whitespace between tags https://stackoverflow.com/a/28449868
# strip_tags does... |
github | osunyorg/admin | https://github.com/osunyorg/admin | app/models/communication/block/component/string.rb | Ruby | mit | 48 | main | 203 | class Communication::Block::Component::String < Communication::Block::Component::Base
def data=(value)
@data = Osuny::Sanitizer.sanitize value, 'string'
end
def full_text
data
end
end |
github | osunyorg/admin | https://github.com/osunyorg/admin | app/models/communication/block/component/boolean.rb | Ruby | mit | 48 | main | 384 | class Communication::Block::Component::Boolean < Communication::Block::Component::Base
def self.openapi_property_type
:boolean
end
def default_data
@default.nil? ? false
: @default
end
def data
@data.nil? ? default_data
: @data
end
def data=(value)
@d... |
github | osunyorg/admin | https://github.com/osunyorg/admin | app/models/communication/block/component/organization_category.rb | Ruby | mit | 48 | main | 289 | class Communication::Block::Component::OrganizationCategory < Communication::Block::Component::BaseReference
def categories
@categories ||= university.organization_categories
end
def category
categories.find_by(id: data)
end
def dependencies
[category]
end
end |
github | osunyorg/admin | https://github.com/osunyorg/admin | app/models/communication/block/component/organization.rb | Ruby | mit | 48 | main | 278 | class Communication::Block::Component::Organization < Communication::Block::Component::BaseReference
def organization
template.block
.university
.organizations
.find_by(id: data)
end
def dependencies
[organization]
end
end |
github | osunyorg/admin | https://github.com/osunyorg/admin | app/models/communication/block/component/paper.rb | Ruby | mit | 48 | main | 228 | class Communication::Block::Component::Paper < Communication::Block::Component::BaseReference
def paper
return unless website
website.research_papers.find_by(id: data)
end
def dependencies
[paper]
end
end |
github | osunyorg/admin | https://github.com/osunyorg/admin | app/models/communication/block/component/job.rb | Ruby | mit | 48 | main | 277 | class Communication::Block::Component::Job < Communication::Block::Component::Base
def job
return unless website
website.jobboard_jobs
.published_now_in(template.block.language)
.find_by(id: data)
end
def dependencies
[job]
end
end |
github | osunyorg/admin | https://github.com/osunyorg/admin | app/models/communication/block/template/testimonial.rb | Ruby | mit | 48 | main | 290 | class Communication::Block::Template::Testimonial < Communication::Block::Template::Base
has_elements
has_layouts [
:carousel,
:grid,
:list,
:large
]
def allowed_for_about?
!about.respond_to?(:extranet)
end
def top_screen_reader_only
true
end
end |
github | osunyorg/admin | https://github.com/osunyorg/admin | app/models/communication/block/template/category.rb | Ruby | mit | 48 | main | 2,532 | class Communication::Block::Template::Category < Communication::Block::Template::Base
has_layouts [
:grid,
:list,
:cards,
:alternate,
:large
]
has_component :category_kind, :option, options: (
Communication::Block::CATEGORIES[:references] - [
:categories,
:locations,
:pa... |
github | osunyorg/admin | https://github.com/osunyorg/admin | app/models/communication/block/template/base.rb | Ruby | mit | 48 | main | 2,609 | class Communication::Block::Template::Base
include WithAccessibility
include WithData
include WithDependencies
include WithTop
class_attribute :components_descriptions,
:layouts,
:element_class
attr_reader :block, :elements
delegate :university, to: :block
delegate... |
github | osunyorg/admin | https://github.com/osunyorg/admin | app/models/communication/block/template/definition.rb | Ruby | mit | 48 | main | 254 | class Communication::Block::Template::Definition < Communication::Block::Template::Base
has_elements
has_component :description, :rich_text
def allowed_for_about?
!about.respond_to?(:extranet)
end
def empty?
elements.none?
end
end |
github | osunyorg/admin | https://github.com/osunyorg/admin | app/models/communication/block/template/timeline.rb | Ruby | mit | 48 | main | 285 | class Communication::Block::Template::Timeline < Communication::Block::Template::Base
has_elements
has_layouts [:vertical, :horizontal]
def allowed_for_about?
!about.respond_to?(:extranet)
end
def children
elements
end
def empty?
elements.none?
end
end |
github | osunyorg/admin | https://github.com/osunyorg/admin | app/models/communication/block/template/gallery.rb | Ruby | mit | 48 | main | 325 | class Communication::Block::Template::Gallery < Communication::Block::Template::Base
has_elements
has_layouts [:grid, :carousel, :large]
has_component :description, :rich_text
def empty?
media_blobs.none?
end
def media_blobs
return [] if elements.none?
elements.map(&:media_blob).compact
end... |
github | osunyorg/admin | https://github.com/osunyorg/admin | app/models/communication/block/template/embed.rb | Ruby | mit | 48 | main | 726 | class Communication::Block::Template::Embed < Communication::Block::Template::Base
has_component :code, :code
has_component :transcription, :rich_text
has_component :transcription_title, :string
protected
def check_accessibility
super
accessibility_error 'accessibility.blocks.templates.embed.title_... |
github | osunyorg/admin | https://github.com/osunyorg/admin | app/models/communication/block/template/chapter.rb | Ruby | mit | 48 | main | 660 | class Communication::Block::Template::Chapter < Communication::Block::Template::Base
has_layouts [:no_background, :alt_background, :accent_background]
has_component :text, :rich_text
has_component :notes, :rich_text
has_component :image, :image
has_component :alt, :string
has_component :credit, :rich_text... |
github | osunyorg/admin | https://github.com/osunyorg/admin | app/models/communication/block/template/job.rb | Ruby | mit | 48 | main | 2,334 | class Communication::Block::Template::Job < Communication::Block::Template::Base
has_elements
has_layouts [
:grid,
:list
]
has_component :mode, :option, options: [
:all,
:category,
:selection
]
has_component :jobs_quantity, :number, default: 3
has_component :category_id, :job_category... |
github | osunyorg/admin | https://github.com/osunyorg/admin | app/models/communication/block/template/post.rb | Ruby | mit | 48 | main | 2,730 | class Communication::Block::Template::Post < Communication::Block::Template::Base
has_elements
has_layouts [
:grid,
:list,
:highlight,
:alternate,
:large,
:carousel
]
has_component :mode, :option, options: [
:all,
:category,
:selection
]
has_component :posts_quantity, :n... |
github | osunyorg/admin | https://github.com/osunyorg/admin | app/models/communication/block/template/key_figure.rb | Ruby | mit | 48 | main | 217 | class Communication::Block::Template::KeyFigure < Communication::Block::Template::Base
has_elements
has_component :description, :rich_text
def allowed_for_about?
!about.respond_to?(:extranet)
end
end |
github | osunyorg/admin | https://github.com/osunyorg/admin | app/models/communication/block/template/organization.rb | Ruby | mit | 48 | main | 2,446 | class Communication::Block::Template::Organization < Communication::Block::Template::Base
has_elements
has_layouts [
:grid,
:large,
:map,
:carousel
]
has_component :mode, :option, options: [
:selection,
:category
]
has_component :category_id, :organization_category
has_component :... |
github | osunyorg/admin | https://github.com/osunyorg/admin | app/models/communication/block/template/call_to_action.rb | Ruby | mit | 48 | main | 747 | class Communication::Block::Template::CallToAction < Communication::Block::Template::Base
has_layouts [
:accent_background,
:no_background
]
has_elements
has_component :text, :rich_text
has_component :image, :image
has_component :alt, :string
has_component :credit, :rich_text
def allowed_for_... |
github | osunyorg/admin | https://github.com/osunyorg/admin | app/models/communication/block/template/program.rb | Ruby | mit | 48 | main | 837 | class Communication::Block::Template::Program < Communication::Block::Template::Base
has_elements
has_layouts [:list, :grid]
has_component :option_diploma, :boolean, default: true
has_component :option_image, :boolean, default: false
has_component :option_summary, :boolean, default: false
... |
github | osunyorg/admin | https://github.com/osunyorg/admin | app/models/communication/block/template/license.rb | Ruby | mit | 48 | main | 584 | class Communication::Block::Template::License < Communication::Block::Template::Base
has_component :description, :rich_text
has_component :type, :option, options: [:creative_commons]
has_component :creative_commons_attribution, :option, options: [:false, :true]
has_component :creative_commons_commercial_use, :... |
github | osunyorg/admin | https://github.com/osunyorg/admin | app/models/communication/block/template/contact.rb | Ruby | mit | 48 | main | 1,535 | class Communication::Block::Template::Contact < Communication::Block::Template::Base
has_component :description, :rich_text
has_component :name, :string
has_component :address, :string
has_component :information, :rich_text
has_component :zipcode, :string
has_component :city, :string
has_component :count... |
github | osunyorg/admin | https://github.com/osunyorg/admin | app/models/communication/block/template/video.rb | Ruby | mit | 48 | main | 1,651 | class Communication::Block::Template::Video < Communication::Block::Template::Base
has_layouts [:player, :button]
has_component :description, :rich_text
has_component :url, :string
has_component :video_title, :string
has_component :transcription, :rich_text
def video_iframe
video_provider.iframe_tag(... |
github | osunyorg/admin | https://github.com/osunyorg/admin | app/models/communication/block/template/image.rb | Ruby | mit | 48 | main | 605 | class Communication::Block::Template::Image < Communication::Block::Template::Base
has_component :image, :image
has_component :alt, :string
has_component :credit, :rich_text
has_component :text, :rich_text
def media_blobs
return [] unless image_component.blob.present?
[
{
blob: image_c... |
github | osunyorg/admin | https://github.com/osunyorg/admin | app/models/communication/block/template/sound.rb | Ruby | mit | 48 | main | 589 | class Communication::Block::Template::Sound < Communication::Block::Template::Base
has_component :file, :file
has_component :title, :string
has_component :transcription, :rich_text
def allowed_for_about?
!about.respond_to?(:extranet)
end
def empty?
file_component.blob.nil?
end
protected
... |
github | osunyorg/admin | https://github.com/osunyorg/admin | app/models/communication/block/template/location.rb | Ruby | mit | 48 | main | 642 | class Communication::Block::Template::Location < Communication::Block::Template::Base
has_elements
has_layouts [
:grid,
:list,
:map
]
has_component :option_image, :boolean, default: true
has_component :option_summary, :boolean, default: true
def dependencies
selected_location... |
github | osunyorg/admin | https://github.com/osunyorg/admin | app/models/communication/block/template/project.rb | Ruby | mit | 48 | main | 2,421 | class Communication::Block::Template::Project < Communication::Block::Template::Base
has_elements
has_layouts [
:grid,
:list,
:alternate,
:large
]
has_component :mode, :option, options: [
:all,
:category,
:selection
]
has_component :projects_quantity, :number, default: 3
has_c... |
github | osunyorg/admin | https://github.com/osunyorg/admin | app/models/communication/block/template/link.rb | Ruby | mit | 48 | main | 321 | class Communication::Block::Template::Link < Communication::Block::Template::Base
has_elements
has_layouts [
:cards,
:grid,
:list
]
has_component :description, :rich_text
has_component :option_icons, :boolean, default: false
def allowed_for_about?
!about.respond_to?(:extranet)
end
en... |
github | osunyorg/admin | https://github.com/osunyorg/admin | app/models/communication/block/template/exhibition.rb | Ruby | mit | 48 | main | 3,195 | class Communication::Block::Template::Exhibition < Communication::Block::Template::Base
has_elements
has_layouts [
:grid,
:list,
:large
]
has_component :mode, :option, options: [
:all,
:category,
:selection
]
has_component :category_id, :agenda_category
has_component :description,... |
github | osunyorg/admin | https://github.com/osunyorg/admin | app/models/communication/block/template/page.rb | Ruby | mit | 48 | main | 1,968 | class Communication::Block::Template::Page < Communication::Block::Template::Base
has_elements
has_layouts [
:grid,
:list,
:cards,
:alternate,
:large
]
has_component :mode, :option, options: [
:selection,
:children,
:category
]
has_component :text, :rich_text # Deprecated
... |
github | osunyorg/admin | https://github.com/osunyorg/admin | app/models/communication/block/template/volume.rb | Ruby | mit | 48 | main | 1,291 | class Communication::Block::Template::Volume < Communication::Block::Template::Base
has_elements
has_component :mode, :option, options: [
:all,
:selection
]
has_component :quantity, :number, default: 3
def dependencies
selected_volumes
end
def selected_volumes
@selected_volumes ||= send... |
github | osunyorg/admin | https://github.com/osunyorg/admin | app/models/communication/block/template/datatable.rb | Ruby | mit | 48 | main | 502 | class Communication::Block::Template::Datatable < Communication::Block::Template::Base
has_elements
has_component :alphabetical, :boolean
has_component :caption, :string
has_component :columns, :array
has_component :description, :rich_text
def allowed_for_about?
!about.respond_to?(:extranet)
end
... |
github | osunyorg/admin | https://github.com/osunyorg/admin | app/models/communication/block/template/person.rb | Ruby | mit | 48 | main | 2,126 | class Communication::Block::Template::Person < Communication::Block::Template::Base
has_elements
has_layouts [
:grid,
:list,
:large
]
has_component :mode, :option, options: [
:selection,
:category
]
has_component :category_id, :person_category
has_component :description, :rich_text
... |
github | osunyorg/admin | https://github.com/osunyorg/admin | app/models/communication/block/template/paper.rb | Ruby | mit | 48 | main | 1,083 | class Communication::Block::Template::Paper < Communication::Block::Template::Base
has_elements
has_component :mode, :option, options: [
:all,
:selection
]
has_component :quantity, :number, default: 3
def dependencies
selected_papers
end
def selected_papers
@selected_papers ||= send "se... |
github | osunyorg/admin | https://github.com/osunyorg/admin | app/models/communication/block/template/agenda.rb | Ruby | mit | 48 | main | 2,902 | class Communication::Block::Template::Agenda < Communication::Block::Template::Base
has_elements
has_layouts [
:grid,
:list,
:large
]
has_component :mode, :option, options: [
:all,
:category,
:selection
]
has_component :category_id, :agenda_category
has_component :description, :ri... |
github | osunyorg/admin | https://github.com/osunyorg/admin | app/models/communication/block/template/feature.rb | Ruby | mit | 48 | main | 345 | class Communication::Block::Template::Feature < Communication::Block::Template::Base
has_elements
has_layouts [
:grid,
:list
]
has_component :description, :rich_text
has_component :option_icons, :boolean, default: false
def allowed_for_about?
!about.respond_to?(:extranet)
end
def childre... |
github | osunyorg/admin | https://github.com/osunyorg/admin | app/models/communication/block/template/base/with_data.rb | Ruby | mit | 48 | main | 2,147 | module Communication::Block::Template::Base::WithData
extend ActiveSupport::Concern
# Transforms raw json into ruby objects, based on components
def data=(value)
json = json_from value
components.each do |component|
next unless json.has_key? component.property
component.data = json[component.... |
github | osunyorg/admin | https://github.com/osunyorg/admin | app/models/communication/block/template/base/with_top.rb | Ruby | mit | 48 | main | 389 | module Communication::Block::Template::Base::WithTop
extend ActiveSupport::Concern
def top_active
top_title.present? || top_description.present?
end
def top_title
block.try(:title)
end
def top_heading
block.heading_rank_base
end
def top_link
nil
end
def top_screen_reader_only
... |
github | osunyorg/admin | https://github.com/osunyorg/admin | app/models/communication/block/template/gallery/element.rb | Ruby | mit | 48 | main | 604 | class Communication::Block::Template::Gallery::Element < Communication::Block::Template::Base
has_component :image, :image
has_component :alt, :string
has_component :credit, :rich_text
has_component :text, :rich_text
def blob
image_component.blob
end
def media_blob
return unless image_component.... |
github | osunyorg/admin | https://github.com/osunyorg/admin | app/models/communication/block/template/file/element.rb | Ruby | mit | 48 | main | 230 | class Communication::Block::Template::File::Element < Communication::Block::Template::Base
has_component :title, :string
has_component :file, :file
has_component :image, :image
def blob
file_component.blob
end
end |
github | osunyorg/admin | https://github.com/osunyorg/admin | app/models/communication/block/template/link/element.rb | Ruby | mit | 48 | main | 422 | class Communication::Block::Template::Link::Element < Communication::Block::Template::Base
has_component :title, :string
has_component :description, :rich_text
has_component :url, :string
has_component :image, :image
def url_external?(website)
url.present? &&
!url.start_with?('/') &&
!url.start_... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.