2019-10-21 19:01:31 +08:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class RepositoryColumnSerializer < ActiveModel::Serializer
|
|
|
|
include Rails.application.routes.url_helpers
|
2023-03-15 23:01:01 +08:00
|
|
|
include InputSanitizeHelper
|
2019-10-21 19:01:31 +08:00
|
|
|
|
2020-01-14 18:13:19 +08:00
|
|
|
attributes :message
|
2019-10-21 19:01:31 +08:00
|
|
|
|
|
|
|
def message
|
2019-10-25 16:39:12 +08:00
|
|
|
if instance_options[:creating]
|
2023-03-15 23:01:01 +08:00
|
|
|
I18n.t('libraries.repository_columns.create.success_flash', name: escape_input(object.name))
|
2019-10-25 16:39:12 +08:00
|
|
|
elsif instance_options[:editing]
|
2023-03-15 23:01:01 +08:00
|
|
|
I18n.t('libraries.repository_columns.update.success_flash', name: escape_input(object.name))
|
2019-10-25 16:39:12 +08:00
|
|
|
end
|
2019-10-21 19:01:31 +08:00
|
|
|
end
|
|
|
|
end
|