diff options
author | Matt Jankowski <matt@jankowski.online> | 2024-04-19 09:57:32 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-19 13:57:32 +0000 |
commit | 4837bfcc6ab38dc86c619167b7c2e260a92a270a (patch) | |
tree | 67612d905acecc326bd8a953712b5883d9f92542 /app/views/admin | |
parent | e5d5bd7ff114c43babc4ca563112bf31c5fee65a (diff) |
Use shared `form` partial for `admin/announcements` views (#29608)
Diffstat (limited to 'app/views/admin')
-rw-r--r-- | app/views/admin/announcements/_form.html.haml | 28 | ||||
-rw-r--r-- | app/views/admin/announcements/edit.html.haml | 35 | ||||
-rw-r--r-- | app/views/admin/announcements/new.html.haml | 36 |
3 files changed, 38 insertions, 61 deletions
diff --git a/app/views/admin/announcements/_form.html.haml b/app/views/admin/announcements/_form.html.haml new file mode 100644 index 00000000000..3a9b3719077 --- /dev/null +++ b/app/views/admin/announcements/_form.html.haml @@ -0,0 +1,28 @@ +.fields-group + = form.input :starts_at, + html5: true, + include_blank: true, + input_html: { pattern: datetime_pattern, placeholder: datetime_placeholder }, + wrapper: :with_block_label + = form.input :ends_at, + html5: true, + include_blank: true, + input_html: { pattern: datetime_pattern, placeholder: datetime_placeholder }, + wrapper: :with_block_label + +.fields-group + = form.input :all_day, + as: :boolean, + wrapper: :with_label + +.fields-group + = form.input :text, + wrapper: :with_block_label + +- unless form.object.published? + .fields-group + = form.input :scheduled_at, + html5: true, + include_blank: true, + input_html: { pattern: datetime_pattern, placeholder: datetime_placeholder }, + wrapper: :with_block_label diff --git a/app/views/admin/announcements/edit.html.haml b/app/views/admin/announcements/edit.html.haml index 23c568a885d..8cec7d36c2d 100644 --- a/app/views/admin/announcements/edit.html.haml +++ b/app/views/admin/announcements/edit.html.haml @@ -1,37 +1,12 @@ - content_for :page_title do = t('.title') -= simple_form_for @announcement, url: admin_announcement_path(@announcement), html: { novalidate: false } do |f| += simple_form_for @announcement, url: admin_announcement_path(@announcement), html: { novalidate: false } do |form| = render 'shared/error_messages', object: @announcement - .fields-group - = f.input :starts_at, - html5: true, - include_blank: true, - input_html: { pattern: datetime_pattern, placeholder: datetime_placeholder }, - wrapper: :with_block_label - = f.input :ends_at, - html5: true, - include_blank: true, - input_html: { pattern: datetime_pattern, placeholder: datetime_placeholder }, - wrapper: :with_block_label - - .fields-group - = f.input :all_day, - as: :boolean, - wrapper: :with_label - - .fields-group - = f.input :text, - wrapper: :with_block_label - - - unless @announcement.published? - .fields-group - = f.input :scheduled_at, - html5: true, - include_blank: true, - input_html: { pattern: datetime_pattern, placeholder: datetime_placeholder }, - wrapper: :with_block_label + = render form .actions - = f.button :button, t('generic.save_changes'), type: :submit + = form.button :button, + t('generic.save_changes'), + type: :submit diff --git a/app/views/admin/announcements/new.html.haml b/app/views/admin/announcements/new.html.haml index a681ed789ec..266ca65e80e 100644 --- a/app/views/admin/announcements/new.html.haml +++ b/app/views/admin/announcements/new.html.haml @@ -1,38 +1,12 @@ - content_for :page_title do = t('.title') -= simple_form_for @announcement, url: admin_announcements_path, html: { novalidate: false } do |f| += simple_form_for @announcement, url: admin_announcements_path, html: { novalidate: false } do |form| = render 'shared/error_messages', object: @announcement - .fields-group - = f.input :starts_at, - html5: true, - include_blank: true, - input_html: { pattern: datetime_pattern, placeholder: datetime_placeholder }, - wrapper: :with_block_label - = f.input :ends_at, - html5: true, - include_blank: true, - input_html: { pattern: datetime_pattern, placeholder: datetime_placeholder }, - wrapper: :with_block_label - - .fields-group - = f.input :all_day, - as: :boolean, - wrapper: :with_label - - .fields-group - = f.input :text, - wrapper: :with_block_label - - .fields-group - = f.input :scheduled_at, - html5: true, - include_blank: true, - input_html: { pattern: datetime_pattern, placeholder: datetime_placeholder }, - wrapper: :with_block_label + = render form .actions - = f.button :button, - t('.create'), - type: :submit + = form.button :button, + t('.create'), + type: :submit |