Show major or patch version update on menu

This commit is contained in:
KMY 2023-09-21 13:22:10 +09:00
parent fa511c3eab
commit e11be48100
5 changed files with 20 additions and 2 deletions

View file

@ -36,5 +36,13 @@ class SoftwareUpdate < ApplicationRecord
def urgent_pending? def urgent_pending?
pending_to_a.any?(&:urgent?) pending_to_a.any?(&:urgent?)
end end
def major_pending?
pending_to_a.any?(&:major_type?)
end
def patch_pending?
pending_to_a.any?(&:patch_type?)
end
end end
end end

View file

@ -31,7 +31,7 @@
.fields-row .fields-row
.fields-group.fields-row__column.fields-row__column-12 .fields-group.fields-row__column.fields-row__column-12
= ff.input :default_searchability, collection: Status.selectable_searchabilities, wrapper: :with_label, kmyblue: true, include_blank: false, label_method: lambda { |searchability| safe_join([I18n.t("statuses.searchabilities.#{searchability}"), I18n.t("statuses.searchabilities.#{searchability}_long")], ' - ') }, required: false, hint: false, label: I18n.t('simple_form.labels.defaults.setting_default_searchability') = ff.input :default_searchability, collection: Status.selectable_searchabilities, wrapper: :with_label, kmyblue: true, include_blank: false, label_method: lambda { |searchability| safe_join([I18n.t("statuses.searchabilities.#{searchability}"), I18n.t("statuses.searchabilities.#{searchability}_long")], ' - ') }, required: false, hint: false, label: I18n.t('simple_form.labels.defaults.setting_default_searchability'), hint: I18n.t('simple_form.hints.defaults.setting_default_searchability')
.fields-group .fields-group
= ff.input :disallow_unlisted_public_searchability, wrapper: :with_label, kmyblue: true, label: I18n.t('simple_form.labels.defaults.setting_disallow_unlisted_public_searchability'), hint: I18n.t('simple_form.hints.defaults.setting_disallow_unlisted_public_searchability') = ff.input :disallow_unlisted_public_searchability, wrapper: :with_label, kmyblue: true, label: I18n.t('simple_form.labels.defaults.setting_disallow_unlisted_public_searchability'), hint: I18n.t('simple_form.hints.defaults.setting_disallow_unlisted_public_searchability')

View file

@ -997,6 +997,9 @@ en:
other: Used by %{count} people over the last week other: Used by %{count} people over the last week
title: Trends title: Trends
trending: Trending trending: Trending
update-pendings:
major: Major update pending
patch: Patch update pending
warning_presets: warning_presets:
add_new: Add new add_new: Add new
delete: Delete delete: Delete

View file

@ -991,6 +991,9 @@ ja:
other: 週間%{count}人に使用されました other: 週間%{count}人に使用されました
title: トレンド title: トレンド
trending: トレンド trending: トレンド
update_pendings:
major: メジャーアップデートあり
patch: パッチアップデートあり
warning_presets: warning_presets:
add_new: 追加 add_new: 追加
delete: 削除 delete: 削除

View file

@ -4,7 +4,11 @@ SimpleNavigation::Configuration.run do |navigation|
navigation.items do |n| navigation.items do |n|
n.item :web, safe_join([fa_icon('chevron-left fw'), t('settings.back')]), root_path n.item :web, safe_join([fa_icon('chevron-left fw'), t('settings.back')]), root_path
n.item :software_updates, safe_join([fa_icon('exclamation-circle fw'), t('admin.critical_update_pending')]), admin_software_updates_path, if: -> { ENV['UPDATE_CHECK_URL'] != '' && current_user.can?(:view_devops) && SoftwareUpdate.urgent_pending? }, html: { class: 'warning' } if ENV['UPDATE_CHECK_URL'] != '' && current_user.can?(:view_devops)
n.item :software_updates, safe_join([fa_icon('exclamation-circle fw'), t('admin.critical_update_pending')]), admin_software_updates_path, if: -> { SoftwareUpdate.urgent_pending? }, html: { class: 'warning' }
n.item :software_updates, safe_join([fa_icon('exclamation-circle fw'), t('admin.update_pendings.major')]), admin_software_updates_path, if: -> { !SoftwareUpdate.urgent_pending? && SoftwareUpdate.major_pending? }, html: { class: 'warning' }
n.item :software_updates, safe_join([fa_icon('exclamation-circle fw'), t('admin.update_pendings.patch')]), admin_software_updates_path, if: -> { !SoftwareUpdate.urgent_pending? && SoftwareUpdate.patch_pending? }, html: { class: 'warning' }
end
n.item :profile, safe_join([fa_icon('user fw'), t('settings.profile')]), settings_profile_path, if: -> { current_user.functional? }, highlights_on: %r{/settings/profile|/settings/featured_tags|/settings/verification|/settings/privacy} n.item :profile, safe_join([fa_icon('user fw'), t('settings.profile')]), settings_profile_path, if: -> { current_user.functional? }, highlights_on: %r{/settings/profile|/settings/featured_tags|/settings/verification|/settings/privacy}