Add antenna setting error view
This commit is contained in:
parent
29cf3b83bf
commit
aa430a96b4
5 changed files with 8 additions and 2 deletions
|
@ -220,7 +220,7 @@ class Antenna < ApplicationRecord
|
||||||
private
|
private
|
||||||
|
|
||||||
def validate_limit
|
def validate_limit
|
||||||
errors.add(:base, I18n.t('scheduled_statuses.over_total_limit', limit: LIMIT)) if account.antennas.count >= LIMIT
|
errors.add(:base, I18n.t('antennas.errors.over_limit', limit: LIMIT)) if account.antennas.count >= LIMIT
|
||||||
end
|
end
|
||||||
|
|
||||||
def validate_stl_limit
|
def validate_stl_limit
|
||||||
|
@ -228,6 +228,6 @@ class Antenna < ApplicationRecord
|
||||||
|
|
||||||
stls = account.antennas.where(stl: true).where.not(id: id)
|
stls = account.antennas.where(stl: true).where.not(id: id)
|
||||||
|
|
||||||
errors.add(:base, I18n.t('scheduled_statuses.over_total_limit', limit: LIMIT)) if list_id.zero? ? stls.any? { |tl| tl.list_id.zero? } : stls.any? { |tl| tl.list_id != 0 }
|
errors.add(:base, I18n.t('antennas.errors.over_stl_limit', limit: 1)) if list_id.zero? ? stls.any? { |tl| tl.list_id.zero? } : stls.any? { |tl| tl.list_id != 0 }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
= t('antennas.edit.title')
|
= t('antennas.edit.title')
|
||||||
|
|
||||||
= simple_form_for @antenna, url: antenna_path(@antenna), method: :put do |f|
|
= simple_form_for @antenna, url: antenna_path(@antenna), method: :put do |f|
|
||||||
|
= render 'shared/error_messages', object: @antenna
|
||||||
= render 'antenna_fields', f: f, lists: @lists
|
= render 'antenna_fields', f: f, lists: @lists
|
||||||
|
|
||||||
.actions
|
.actions
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
= t('antennas.new.title')
|
= t('antennas.new.title')
|
||||||
|
|
||||||
= simple_form_for @antenna, url: antennas_path do |f|
|
= simple_form_for @antenna, url: antennas_path do |f|
|
||||||
|
= render 'shared/error_messages', object: @antenna
|
||||||
= render 'antenna_fields', f: f, lists: @lists
|
= render 'antenna_fields', f: f, lists: @lists
|
||||||
|
|
||||||
.actions
|
.actions
|
||||||
|
|
|
@ -1032,6 +1032,8 @@ en:
|
||||||
empty_contexts: No contexts! You must set any context filters
|
empty_contexts: No contexts! You must set any context filters
|
||||||
invalid_context: None or invalid context supplied
|
invalid_context: None or invalid context supplied
|
||||||
invalid_list_owner: This list is not yours
|
invalid_list_owner: This list is not yours
|
||||||
|
over_limit: You have exceeded the limit of %{limit} antennas
|
||||||
|
over_stl_limit: You have exceeded the limit of %{limit} stl antennas
|
||||||
remove_list_with_antenna: Cannot remove list because this list is related to antenna.
|
remove_list_with_antenna: Cannot remove list because this list is related to antenna.
|
||||||
index:
|
index:
|
||||||
contexts: Antennas in %{contexts}
|
contexts: Antennas in %{contexts}
|
||||||
|
|
|
@ -999,6 +999,8 @@ ja:
|
||||||
errors:
|
errors:
|
||||||
empty_contexts: 絞り込み条件が1つも指定されていないため無効です(除外条件はカウントされません)
|
empty_contexts: 絞り込み条件が1つも指定されていないため無効です(除外条件はカウントされません)
|
||||||
invalid_list_owner: これはあなたのリストではありません
|
invalid_list_owner: これはあなたのリストではありません
|
||||||
|
over_limit: 所持できるアンテナ数 %{limit}を超えています
|
||||||
|
over_stl_limit: 所持できるSTLモード付きアンテナ数 (ホーム/リストそれぞれにつき%{limit}) を超えています
|
||||||
remove_list_with_antenna: アンテナが関連付けられているリストは削除できません
|
remove_list_with_antenna: アンテナが関連付けられているリストは削除できません
|
||||||
edit:
|
edit:
|
||||||
accounts_hint: ローカルアカウントの場合は「@info」、リモートアカウントの場合は「@info@example.com」の形式で指定します。サーバーが認識していないアカウントは保存時に自動的に削除されます。
|
accounts_hint: ローカルアカウントの場合は「@info」、リモートアカウントの場合は「@info@example.com」の形式で指定します。サーバーが認識していないアカウントは保存時に自動的に削除されます。
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue