Skip to content
Snippets Groups Projects
Unverified Commit e1f03c7b authored by Sébastien Gaya's avatar Sébastien Gaya
Browse files

feedback

parent 15ce5ca4
No related branches found
No related tags found
No related merge requests found
......@@ -51,7 +51,12 @@ class Admin::Education::Programs::TeachersController < Admin::Education::Program
def get_available_people
used_person_ids = @program.university_person_involvements.where.not(id: @involvement.id).pluck(:person_id)
@available_people = current_university.people.for_language_id(current_university.default_language_id).teachers.where.not(id: used_person_ids).accessible_by(current_ability).ordered
@available_people = current_university.people
.for_language_id(current_university.default_language_id)
.teachers
.where.not(id: used_person_ids)
.accessible_by(current_ability)
.ordered
end
def breadcrumb
......
......@@ -33,21 +33,16 @@ module WithFeaturedImage
photo = Unsplash::Photo.find id
url = "#{photo['urls']['full']}&w=2048&fit=max"
filename = "#{photo['id']}.jpg"
begin
file = URI.open url
featured_image.attach(io: file, filename: filename)
photo.track_download
rescue
end
file = URI.open url
featured_image.attach(io: file, filename: filename)
photo.track_download
end
def photo_import_pexels(id)
photo = Pexels::Client.new.photos.find id
url = "#{photo.src['original']}?auto=compress&cs=tinysrgb&w=2048"
filename = "#{photo.id}.png"
begin
file = URI.open url
featured_image.attach(io: file, filename: filename)
end
file = URI.open url
featured_image.attach(io: file, filename: filename)
end
end
......@@ -6,8 +6,9 @@ module WithTranslations
belongs_to :original, class_name: base_class.to_s, optional: true
has_many :translations, class_name: base_class.to_s, foreign_key: :original_id, dependent: :nullify
scope :for_language_id, -> (language_id) { where(language_id: language_id) }
scope :for_language, -> (language) { for_language_id(language.id) }
# The for_language_id scope can be used when you have the ID without needing to load the Language itself
scope :for_language_id, -> (language_id) { where(language_id: language_id) }
end
def available_languages
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment