From 7639c20f6412fa5097029236ec5ca42aad361903 Mon Sep 17 00:00:00 2001 From: Andreas Nedbal Date: Sun, 10 May 2020 14:29:10 +0200 Subject: [PATCH] Fix lints in app/views/announcement --- app/views/announcement/edit.haml | 37 ++++++++++++++++++++++++++ app/views/announcement/edit.html.haml | 31 --------------------- app/views/announcement/index.haml | 20 ++++++++++++++ app/views/announcement/index.html.haml | 16 ----------- app/views/announcement/new.haml | 37 ++++++++++++++++++++++++++ app/views/announcement/new.html.haml | 31 --------------------- 6 files changed, 94 insertions(+), 78 deletions(-) create mode 100644 app/views/announcement/edit.haml delete mode 100644 app/views/announcement/edit.html.haml create mode 100644 app/views/announcement/index.haml delete mode 100644 app/views/announcement/index.html.haml create mode 100644 app/views/announcement/new.haml delete mode 100644 app/views/announcement/new.html.haml diff --git a/app/views/announcement/edit.haml b/app/views/announcement/edit.haml new file mode 100644 index 00000000..e0a4c43b --- /dev/null +++ b/app/views/announcement/edit.haml @@ -0,0 +1,37 @@ +- provide(:title, generate_title('Edit announcement')) +.container.container--main + .card + .card-body + = bootstrap_form_for(@announcement, url: { action: 'update' }, method: 'PATCH') do |f| + - if @announcement.errors.any? + .row + .col-md-12 + .alert.alert-danger + %strong + = pluralize(@announcement.errors.count, 'error') + prohibited this announcement from being saved: + %ul + - @announcement.errors.full_messages.each do |err| + %li= err + .row + .col-md-12 + = f.text_area :content, label: 'Content' + .row + .col-md-6 + = f.url_field :link_href, label: 'Link URL' + .col-md-6 + = f.text_field :link_text, label: 'Link text' + .row + .col-md-6 + = f.datetime_field :starts_at, + label: 'Start time', + class: 'datetimepicker-input', + data: { toggle: 'datetimepicker', target: '#announcement_starts_at', 'date-format': 'YYYY-MM-DD hh:mm A' } + .col-md-6 + = f.datetime_field :ends_at, + label: 'End time', + class: 'datetimepicker-input', + data: { toggle: 'datetimepicker', target: '#announcement_ends_at', 'date-format': 'YYYY-MM-DD hh:mm A' } + .row + .col-md-12.text-right + = f.submit class: 'btn btn-primary' diff --git a/app/views/announcement/edit.html.haml b/app/views/announcement/edit.html.haml deleted file mode 100644 index 45f54008..00000000 --- a/app/views/announcement/edit.html.haml +++ /dev/null @@ -1,31 +0,0 @@ -- provide(:title, generate_title("Edit announcement")) -.container.container--main - .card - .card-body - = bootstrap_form_for(@announcement, url: {action: "update"}, method: "PATCH") do |f| - - if @announcement.errors.any? - .row - .col-md-12 - .alert.alert-danger - %strong - = pluralize(@announcement.errors.count, "error") - prohibited this announcement from being saved: - %ul - - @announcement.errors.full_messages.each do |err| - %li= err - .row - .col-md-12 - = f.text_area :content, label: "Content" - .row - .col-md-6 - = f.url_field :link_href, label: "Link URL" - .col-md-6 - = f.text_field :link_text, label: "Link text" - .row - .col-md-6 - = f.datetime_field :starts_at, label: "Start time", class: "datetimepicker-input", data: { toggle: "datetimepicker", target: "#announcement_starts_at", "date-format": "YYYY-MM-DD hh:mm A" } - .col-md-6 - = f.datetime_field :ends_at, label: "End time", class: "datetimepicker-input", data: { toggle: "datetimepicker", target: "#announcement_ends_at", "date-format": "YYYY-MM-DD hh:mm A" } - .row - .col-md-12.text-right - = f.submit class: "btn btn-primary" diff --git a/app/views/announcement/index.haml b/app/views/announcement/index.haml new file mode 100644 index 00000000..1cf04dda --- /dev/null +++ b/app/views/announcement/index.haml @@ -0,0 +1,20 @@ +- provide(:title, generate_title('Announcements')) +.container.container--main + - @announcements.each do |announcement| + .card + .card-body + .d-flex.w-100.justify-content-between + %p.mb-3= announcement.content + %small.text-muted= announcement.starts_at + + .d-flex.w-100 + = link_to 'Edit', announcement_edit_path(id: announcement.id), class: 'btn btn-link text-primary' + = button_to 'Delete', + announcement_destroy_path(id: announcement.id), + method: :delete, + class: 'btn btn-link text-danger', + confirm: 'Are you sure you want to delete this announcement?' + + .row + .col-md-12 + = link_to 'Add new', :announcement_new, class: 'btn btn-primary' diff --git a/app/views/announcement/index.html.haml b/app/views/announcement/index.html.haml deleted file mode 100644 index bb8c3616..00000000 --- a/app/views/announcement/index.html.haml +++ /dev/null @@ -1,16 +0,0 @@ -- provide(:title, generate_title("Announcements")) -.container.container--main - - @announcements.each do |announcement| - .card - .card-body - .d-flex.w-100.justify-content-between - %p.mb-3= announcement.content - %small.text-muted= announcement.starts_at - - .d-flex.w-100 - = link_to "Edit", announcement_edit_path(id: announcement.id), class: 'btn btn-link text-primary' - = button_to "Delete", announcement_destroy_path(id: announcement.id), method: :delete, class: 'btn btn-link text-danger', confirm: 'Are you sure you want to delete this announcement?' - - .row - .col-md-12 - = link_to "Add new", :announcement_new, class: "btn btn-primary" \ No newline at end of file diff --git a/app/views/announcement/new.haml b/app/views/announcement/new.haml new file mode 100644 index 00000000..a4495bc7 --- /dev/null +++ b/app/views/announcement/new.haml @@ -0,0 +1,37 @@ +- provide(:title, generate_title('Add new announcement')) +.container.container--main + .card + .card-body + = bootstrap_form_for(@announcement, url: { action: 'create' }) do |f| + - if @announcement.errors.any? + .row + .col-md-12 + .alert.alert-danger + %strong + = pluralize(@announcement.errors.count, 'error') + prohibited this announcement from being saved: + %ul + - @announcement.errors.full_messages.each do |err| + %li= err + .row + .col-md-12 + = f.text_area :content, label: 'Content' + .row + .col-md-6 + = f.url_field :link_href, label: 'Link URL' + .col-md-6 + = f.text_field :link_text, label: 'Link text' + .row + .col-md-6 + = f.datetime_field :starts_at, + label: 'Start time', + class: 'datetimepicker-input', + data: { toggle: 'datetimepicker', target: '#announcement_starts_at', 'date-format': 'YYYY-MM-DD hh:mm A' } + .col-md-6 + = f.datetime_field :ends_at, + label: 'End time', + class: 'datetimepicker-input', + data: { toggle: 'datetimepicker', target: '#announcement_ends_at', 'date-format': 'YYYY-MM-DD hh:mm A' } + .row + .col-md-12.text-right + = f.submit class: 'btn btn-primary' diff --git a/app/views/announcement/new.html.haml b/app/views/announcement/new.html.haml deleted file mode 100644 index 69e61d2c..00000000 --- a/app/views/announcement/new.html.haml +++ /dev/null @@ -1,31 +0,0 @@ -- provide(:title, generate_title("Add new announcement")) -.container.container--main - .card - .card-body - = bootstrap_form_for(@announcement, url: {action: "create"}) do |f| - - if @announcement.errors.any? - .row - .col-md-12 - .alert.alert-danger - %strong - = pluralize(@announcement.errors.count, "error") - prohibited this announcement from being saved: - %ul - - @announcement.errors.full_messages.each do |err| - %li= err - .row - .col-md-12 - = f.text_area :content, label: "Content" - .row - .col-md-6 - = f.url_field :link_href, label: "Link URL" - .col-md-6 - = f.text_field :link_text, label: "Link text" - .row - .col-md-6 - = f.datetime_field :starts_at, label: "Start time", class: "datetimepicker-input", data: { toggle: "datetimepicker", target: "#announcement_starts_at", "date-format": "YYYY-MM-DD hh:mm A" } - .col-md-6 - = f.datetime_field :ends_at, label: "End time", class: "datetimepicker-input", data: { toggle: "datetimepicker", target: "#announcement_ends_at", "date-format": "YYYY-MM-DD hh:mm A" } - .row - .col-md-12.text-right - = f.submit class: "btn btn-primary"