mirror of
https://github.com/mastodon/mastodon.git
synced 2024-12-25 04:25:01 +01:00
Add hints for rules (#29539)
This commit is contained in:
parent
98ef38e34e
commit
5b3a8737d6
@ -53,7 +53,7 @@ module Admin
|
|||||||
end
|
end
|
||||||
|
|
||||||
def resource_params
|
def resource_params
|
||||||
params.require(:rule).permit(:text, :priority)
|
params.require(:rule).permit(:text, :hint, :priority)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -170,7 +170,8 @@ class About extends PureComponent {
|
|||||||
<ol className='rules-list'>
|
<ol className='rules-list'>
|
||||||
{server.get('rules').map(rule => (
|
{server.get('rules').map(rule => (
|
||||||
<li key={rule.get('id')}>
|
<li key={rule.get('id')}>
|
||||||
<span className='rules-list__text'>{rule.get('text')}</span>
|
<div className='rules-list__text'>{rule.get('text')}</div>
|
||||||
|
{rule.get('hint').length > 0 && (<div className='rules-list__hint'>{rule.get('hint')}</div>)}
|
||||||
</li>
|
</li>
|
||||||
))}
|
))}
|
||||||
</ol>
|
</ol>
|
||||||
|
@ -53,4 +53,10 @@ $fluid-breakpoint: $maximum-width + 20px;
|
|||||||
border-bottom: 0;
|
border-bottom: 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&__hint {
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 400;
|
||||||
|
color: $darker-text-color;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
# text :text default(""), not null
|
# text :text default(""), not null
|
||||||
# created_at :datetime not null
|
# created_at :datetime not null
|
||||||
# updated_at :datetime not null
|
# updated_at :datetime not null
|
||||||
|
# hint :text default(""), not null
|
||||||
#
|
#
|
||||||
class Rule < ApplicationRecord
|
class Rule < ApplicationRecord
|
||||||
include Discard::Model
|
include Discard::Model
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class REST::RuleSerializer < ActiveModel::Serializer
|
class REST::RuleSerializer < ActiveModel::Serializer
|
||||||
attributes :id, :text
|
attributes :id, :text, :hint
|
||||||
|
|
||||||
def id
|
def id
|
||||||
object.id.to_s
|
object.id.to_s
|
||||||
|
@ -7,5 +7,8 @@
|
|||||||
.fields-group
|
.fields-group
|
||||||
= f.input :text, wrapper: :with_block_label
|
= f.input :text, wrapper: :with_block_label
|
||||||
|
|
||||||
|
.fields-group
|
||||||
|
= f.input :hint, wrapper: :with_block_label
|
||||||
|
|
||||||
.actions
|
.actions
|
||||||
= f.button :button, t('generic.save_changes'), type: :submit
|
= f.button :button, t('generic.save_changes'), type: :submit
|
||||||
|
@ -12,6 +12,9 @@
|
|||||||
.fields-group
|
.fields-group
|
||||||
= f.input :text, wrapper: :with_block_label
|
= f.input :text, wrapper: :with_block_label
|
||||||
|
|
||||||
|
.fields-group
|
||||||
|
= f.input :hint, wrapper: :with_block_label
|
||||||
|
|
||||||
.actions
|
.actions
|
||||||
= f.button :button, t('admin.rules.add_new'), type: :submit
|
= f.button :button, t('admin.rules.add_new'), type: :submit
|
||||||
|
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
- @rules.each do |rule|
|
- @rules.each do |rule|
|
||||||
%li
|
%li
|
||||||
.rules-list__text= rule.text
|
.rules-list__text= rule.text
|
||||||
|
.rules-list__hint= rule.hint
|
||||||
|
|
||||||
.stacked-actions
|
.stacked-actions
|
||||||
- accept_path = @invite_code.present? ? public_invite_url(invite_code: @invite_code, accept: @accept_token) : new_user_registration_path(accept: @accept_token)
|
- accept_path = @invite_code.present? ? public_invite_url(invite_code: @invite_code, accept: @accept_token) : new_user_registration_path(accept: @accept_token)
|
||||||
|
@ -116,6 +116,7 @@ en:
|
|||||||
sign_up_requires_approval: New sign-ups will require your approval
|
sign_up_requires_approval: New sign-ups will require your approval
|
||||||
severity: Choose what will happen with requests from this IP
|
severity: Choose what will happen with requests from this IP
|
||||||
rule:
|
rule:
|
||||||
|
hint: Optional. Provide more details about the rule
|
||||||
text: Describe a rule or requirement for users on this server. Try to keep it short and simple
|
text: Describe a rule or requirement for users on this server. Try to keep it short and simple
|
||||||
sessions:
|
sessions:
|
||||||
otp: 'Enter the two-factor code generated by your phone app or use one of your recovery codes:'
|
otp: 'Enter the two-factor code generated by your phone app or use one of your recovery codes:'
|
||||||
@ -299,6 +300,7 @@ en:
|
|||||||
patch: Notify on bugfix updates
|
patch: Notify on bugfix updates
|
||||||
trending_tag: New trend requires review
|
trending_tag: New trend requires review
|
||||||
rule:
|
rule:
|
||||||
|
hint: Additional information
|
||||||
text: Rule
|
text: Rule
|
||||||
settings:
|
settings:
|
||||||
indexable: Include profile page in search engines
|
indexable: Include profile page in search engines
|
||||||
|
7
db/migrate/20240310123453_add_hint_to_rules.rb
Normal file
7
db/migrate/20240310123453_add_hint_to_rules.rb
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
class AddHintToRules < ActiveRecord::Migration[7.1]
|
||||||
|
def change
|
||||||
|
add_column :rules, :hint, :text, null: false, default: ''
|
||||||
|
end
|
||||||
|
end
|
@ -10,7 +10,7 @@
|
|||||||
#
|
#
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
# It's strongly recommended that you check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema[7.1].define(version: 2024_03_04_090449) do
|
ActiveRecord::Schema[7.1].define(version: 2024_03_10_123453) do
|
||||||
# These are extensions that must be enabled in order to support this database
|
# These are extensions that must be enabled in order to support this database
|
||||||
enable_extension "plpgsql"
|
enable_extension "plpgsql"
|
||||||
|
|
||||||
@ -915,6 +915,7 @@ ActiveRecord::Schema[7.1].define(version: 2024_03_04_090449) do
|
|||||||
t.text "text", default: "", null: false
|
t.text "text", default: "", null: false
|
||||||
t.datetime "created_at", precision: nil, null: false
|
t.datetime "created_at", precision: nil, null: false
|
||||||
t.datetime "updated_at", precision: nil, null: false
|
t.datetime "updated_at", precision: nil, null: false
|
||||||
|
t.text "hint", default: "", null: false
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "scheduled_statuses", force: :cascade do |t|
|
create_table "scheduled_statuses", force: :cascade do |t|
|
||||||
|
Loading…
Reference in New Issue
Block a user