* Change: #647 NGワードの入力フォーム * Wip: 画面改造 * テストコード、画面 * Fix: 複数の問題
This commit is contained in:
parent
0d2b415e26
commit
95ab1f729c
33 changed files with 526 additions and 172 deletions
10
app/views/admin/ng_words/keywords/_ng_word.html.haml
Normal file
10
app/views/admin/ng_words/keywords/_ng_word.html.haml
Normal file
|
@ -0,0 +1,10 @@
|
|||
- temporary_id = defined?(@temp_id) ? @temp_id += 1 : @temp_id = 1
|
||||
%tr{ class: template ? 'template-row' : nil }
|
||||
%td= f.input :keywords, as: :string, input_html: { multiple: true, value: ng_word.keyword }
|
||||
%td
|
||||
.label_input__wrapper= f.check_box :regexps, { multiple: true, checked: ng_word.regexp }, temporary_id, nil
|
||||
%td
|
||||
.label_input__wrapper= f.check_box :strangers, { multiple: true, checked: ng_word.stranger }, temporary_id, nil
|
||||
%td
|
||||
= hidden_field_tag :'form_admin_settings[ng_words_test][temporary_ids][]', temporary_id, class: 'temporary_id'
|
||||
= link_to safe_join([fa_icon('times'), t('filters.index.delete')]), '#', class: 'table-action-link delete-row-button'
|
43
app/views/admin/ng_words/keywords/show.html.haml
Normal file
43
app/views/admin/ng_words/keywords/show.html.haml
Normal file
|
@ -0,0 +1,43 @@
|
|||
- content_for :page_title do
|
||||
= t('admin.ng_words.title')
|
||||
|
||||
- content_for :header_tags do
|
||||
= javascript_pack_tag 'admin', async: true, crossorigin: 'anonymous'
|
||||
|
||||
- content_for :heading do
|
||||
%h2= t('admin.ng_words.title')
|
||||
= render partial: 'admin/ng_words/shared/links'
|
||||
|
||||
= simple_form_for @admin_settings, url: admin_ng_words_keywords_path, html: { method: :post } do |f|
|
||||
= render 'shared/error_messages', object: @admin_settings
|
||||
|
||||
%p.lead
|
||||
= t('admin.ng_words.preamble')
|
||||
= link_to t('admin.ngword_histories.title'), admin_ngword_histories_path
|
||||
|
||||
%p= t 'admin.ng_words.phrases.regexp_html'
|
||||
%p= t 'admin.ng_words.phrases.stranger_html'
|
||||
|
||||
%hr/
|
||||
|
||||
.table-wrapper
|
||||
%table.table.keywords-table#ng-words-table
|
||||
%thead
|
||||
%tr
|
||||
%th= t('simple_form.labels.defaults.phrase')
|
||||
%th= t('admin.ng_words.phrases.regexp_short')
|
||||
%th= t('admin.ng_words.phrases.stranger_short')
|
||||
%th
|
||||
%tbody
|
||||
= f.simple_fields_for :ng_words_test, @ng_words do |keyword|
|
||||
= render partial: 'ng_word', collection: @ng_words, locals: { f: keyword, template: false }
|
||||
|
||||
= f.simple_fields_for :ng_words_test, @ng_words do |keyword|
|
||||
= render partial: 'ng_word', collection: [NgWord.new], locals: { f: keyword, template: true }
|
||||
%tfoot
|
||||
%tr
|
||||
%td{ colspan: 4 }
|
||||
= link_to safe_join([fa_icon('plus'), t('filters.edit.add_keyword')]), '#', class: 'table-action-link add-row-button'
|
||||
|
||||
.actions
|
||||
= f.button :button, t('generic.save_changes'), type: :submit
|
|
@ -4,21 +4,13 @@
|
|||
- content_for :header_tags do
|
||||
= javascript_pack_tag 'admin', async: true, crossorigin: 'anonymous'
|
||||
|
||||
= simple_form_for @admin_settings, url: admin_ng_words_path, html: { method: :post } do |f|
|
||||
- content_for :heading do
|
||||
%h2= t('admin.ng_words.title')
|
||||
= render partial: 'admin/ng_words/shared/links'
|
||||
|
||||
= simple_form_for @admin_settings, url: admin_ng_words_settings_path, html: { method: :post } do |f|
|
||||
= render 'shared/error_messages', object: @admin_settings
|
||||
|
||||
%p.lead= t('admin.ng_words.preamble')
|
||||
|
||||
%p.hint
|
||||
= t 'admin.ng_words.history_hint'
|
||||
= link_to t('admin.ngword_histories.title'), admin_ngword_histories_path
|
||||
|
||||
.fields-group
|
||||
= f.input :ng_words_for_stranger_mention, wrapper: :with_label, as: :text, input_html: { rows: 10 }, label: t('admin.ng_words.keywords_for_stranger_mention'), hint: t('admin.ng_words.keywords_for_stranger_mention_hint')
|
||||
|
||||
.fields-group
|
||||
= f.input :ng_words, wrapper: :with_label, as: :text, input_html: { rows: 10 }, label: t('admin.ng_words.keywords'), hint: t('admin.ng_words.keywords_hint')
|
||||
|
||||
.fields-group
|
||||
= f.input :post_hash_tags_max, wrapper: :with_label, as: :integer, label: t('admin.ng_words.post_hash_tags_max')
|
||||
|
||||
|
@ -28,17 +20,6 @@
|
|||
.fields-group
|
||||
= f.input :post_mentions_max, wrapper: :with_label, as: :integer, label: t('admin.ng_words.post_mentions_max')
|
||||
|
||||
%h4= t('admin.ng_words.white_list')
|
||||
%p.lead
|
||||
= t('admin.ng_words.white_list_hint')
|
||||
= link_to t('admin.ng_words.remote_approval_list'), admin_accounts_path(status: 'remote_pending', origin: 'remote')
|
||||
|
||||
.fields-group
|
||||
= f.input :hold_remote_new_accounts, wrapper: :with_label, as: :boolean, label: t('admin.ng_words.hold_remote_new_accounts'), hint: t('admin.ng_words.remote_approval_hint')
|
||||
|
||||
.fields-group
|
||||
= f.input :permit_new_account_domains, wrapper: :with_label, as: :text, kmyblue: true, input_html: { rows: 6 }, label: t('admin.ng_words.permit_new_account_domains')
|
||||
|
||||
%h4= t('admin.ng_words.deprecated')
|
||||
%p.hint= t('admin.ng_words.deprecated_hint')
|
||||
|
6
app/views/admin/ng_words/shared/_links.html.haml
Normal file
6
app/views/admin/ng_words/shared/_links.html.haml
Normal file
|
@ -0,0 +1,6 @@
|
|||
.content__heading__tabs
|
||||
= render_navigation renderer: :links do |primary|
|
||||
:ruby
|
||||
primary.item :keywords, safe_join([fa_icon('pencil fw'), t('admin.ng_words.keywords')]), admin_ng_words_keywords_path
|
||||
primary.item :white_list, safe_join([fa_icon('list fw'), t('admin.ng_words.white_list')]), admin_ng_words_white_list_path
|
||||
primary.item :settings, safe_join([fa_icon('cog fw'), t('admin.ng_words.settings')]), admin_ng_words_settings_path
|
25
app/views/admin/ng_words/white_list/show.html.haml
Normal file
25
app/views/admin/ng_words/white_list/show.html.haml
Normal file
|
@ -0,0 +1,25 @@
|
|||
- content_for :page_title do
|
||||
= t('admin.ng_words.title')
|
||||
|
||||
- content_for :header_tags do
|
||||
= javascript_pack_tag 'admin', async: true, crossorigin: 'anonymous'
|
||||
|
||||
- content_for :heading do
|
||||
%h2= t('admin.ng_words.title')
|
||||
= render partial: 'admin/ng_words/shared/links'
|
||||
|
||||
= simple_form_for @admin_settings, url: admin_ng_words_white_list_path, html: { method: :post } do |f|
|
||||
= render 'shared/error_messages', object: @admin_settings
|
||||
|
||||
%p.lead
|
||||
= t('admin.ng_words.white_list_hint')
|
||||
= link_to t('admin.ng_words.remote_approval_list'), admin_accounts_path(status: 'remote_pending', origin: 'remote')
|
||||
|
||||
.fields-group
|
||||
= f.input :hold_remote_new_accounts, wrapper: :with_label, as: :boolean, label: t('admin.ng_words.hold_remote_new_accounts'), hint: t('admin.ng_words.remote_approval_hint')
|
||||
|
||||
.fields-group
|
||||
= f.input :permit_new_account_domains, wrapper: :with_label, as: :text, kmyblue: true, input_html: { rows: 6 }, label: t('admin.ng_words.permit_new_account_domains')
|
||||
|
||||
.actions
|
||||
= f.button :button, t('generic.save_changes'), type: :submit
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
.filters
|
||||
.back-link
|
||||
= link_to admin_ng_words_path do
|
||||
= link_to admin_ng_words_keywords_path do
|
||||
= fa_icon 'chevron-left fw'
|
||||
= t('admin.ngword_histories.back_to_ng_words')
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue