Skip to content

Commit

Permalink
Use crud namespace instead of admin
Browse files Browse the repository at this point in the history
  • Loading branch information
jonallured authored and github-actions[bot] committed Feb 24, 2024
1 parent ed03df5 commit e4b2295
Show file tree
Hide file tree
Showing 58 changed files with 175 additions and 175 deletions.
3 changes: 0 additions & 3 deletions app/controllers/admin/raw_hooks_controller.rb

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
class Admin::BooksController < ApplicationController
class Crud::BooksController < ApplicationController
expose(:book)

def create
if book.save
EnhanceBookJob.perform_later(book.id)
redirect_to edit_admin_book_path(book)
redirect_to edit_crud_book_path(book)
else
flash.alert = book.errors.full_messages
render :new
Expand All @@ -13,7 +13,7 @@ def create

def update
if book.update(book_params)
redirect_to edit_admin_book_path(book)
redirect_to edit_crud_book_path(book)
else
flash.alert = book.errors.full_messages
render :edit
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class Admin::CsvUploadsController < ApplicationController
class Crud::CsvUploadsController < ApplicationController
expose(:csv_upload)
expose(:csv_uploads) do
CsvUpload.order(created_at: :desc).page(params[:page])
Expand All @@ -8,27 +8,27 @@ def create
if csv_upload.save
ParseCsvUploadJob.perform_later(csv_upload.id)
flash.notice = "CSV Upload created"
redirect_to admin_csv_upload_path(csv_upload)
redirect_to crud_csv_upload_path(csv_upload)
else
flash.alert = csv_upload.errors.full_messages.to_sentence
redirect_to new_admin_csv_upload_path
redirect_to new_crud_csv_upload_path
end
end

def update
if csv_upload.update(csv_upload_params)
flash.notice = "CSV Upload updated"
redirect_to admin_csv_upload_path(csv_upload)
redirect_to crud_csv_upload_path(csv_upload)
else
flash.alert = csv_upload.errors.full_messages.to_sentence
redirect_to edit_admin_csv_upload_path(csv_upload)
redirect_to edit_crud_csv_upload_path(csv_upload)
end
end

def destroy
csv_upload.destroy
flash.notice = "CSV Upload deleted"
redirect_to admin_csv_uploads_path
redirect_to crud_csv_uploads_path
end

private
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class Admin::FinancialAccountsController < ApplicationController
class Crud::FinancialAccountsController < ApplicationController
expose(:financial_account)
expose(:financial_accounts) do
FinancialAccount.order(created_at: :desc).page(params[:page])
Expand All @@ -7,27 +7,27 @@ class Admin::FinancialAccountsController < ApplicationController
def create
if financial_account.save
flash.notice = "Financial Account created"
redirect_to admin_financial_account_path(financial_account)
redirect_to crud_financial_account_path(financial_account)
else
flash.alert = financial_account.errors.full_messages.to_sentence
redirect_to new_admin_financial_account_path
redirect_to new_crud_financial_account_path
end
end

def update
if financial_account.update(financial_account_params)
flash.notice = "Financial Account updated"
redirect_to admin_financial_account_path(financial_account)
redirect_to crud_financial_account_path(financial_account)
else
flash.alert = financial_account.errors.full_messages.to_sentence
redirect_to edit_admin_financial_account_path(financial_account)
redirect_to edit_crud_financial_account_path(financial_account)
end
end

def destroy
financial_account.destroy
flash.notice = "Financial Account deleted"
redirect_to admin_financial_accounts_path
redirect_to crud_financial_accounts_path
end

private
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class Admin::GiftIdeasController < ApplicationController
class Crud::GiftIdeasController < ApplicationController
expose(:gift_idea)
expose(:gift_ideas) do
GiftIdea.order(created_at: :desc).page(params[:page])
Expand All @@ -7,27 +7,27 @@ class Admin::GiftIdeasController < ApplicationController
def create
if gift_idea.save
flash.notice = "Gift Idea created"
redirect_to admin_gift_idea_path(gift_idea)
redirect_to crud_gift_idea_path(gift_idea)
else
flash.alert = gift_idea.errors.full_messages.to_sentence
redirect_to new_admin_gift_idea_path
redirect_to new_crud_gift_idea_path
end
end

def update
if gift_idea.update(gift_idea_params)
flash.notice = "Gift Idea updated"
redirect_to admin_gift_idea_path(gift_idea)
redirect_to crud_gift_idea_path(gift_idea)
else
flash.alert = gift_idea.errors.full_messages.to_sentence
redirect_to edit_admin_gift_idea_path(gift_idea)
redirect_to edit_crud_gift_idea_path(gift_idea)
end
end

def destroy
gift_idea.destroy
flash.notice = "Gift Idea deleted"
redirect_to admin_gift_ideas_path
redirect_to crud_gift_ideas_path
end

private
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class Admin::PostBinRequestsController < ApplicationController
class Crud::PostBinRequestsController < ApplicationController
expose(:post_bin_request)
expose(:post_bin_requests) { PostBinRequest.all.order(created_at: :desc).limit(10) }
end
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
class Admin::ProjectsController < ApplicationController
class Crud::ProjectsController < ApplicationController
expose(:projects) { Project.order(:touched_at) }
expose(:project)

def create
if project.save
redirect_to admin_projects_path
redirect_to crud_projects_path
else
flash[:alert] = t("projects.create_error")
render :index, status: :unprocessable_entity
Expand Down
3 changes: 3 additions & 0 deletions app/controllers/crud/raw_hooks_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
class Crud::RawHooksController < ApplicationController
expose(:raw_hook)
end
2 changes: 1 addition & 1 deletion app/javascript/controllers/projects_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export default class extends Controller {
event.preventDefault()
projectItem.classList.add("touched")
const id = projectItem.dataset.projectId
const url = `/admin/projects/${id}.json`
const url = `/crud/projects/${id}.json`
fetch(url, options)
})
})
Expand Down
14 changes: 0 additions & 14 deletions app/views/admin/csv_uploads/show.html.haml

This file was deleted.

7 changes: 0 additions & 7 deletions app/views/admin/financial_accounts/edit.html.haml

This file was deleted.

7 changes: 0 additions & 7 deletions app/views/admin/financial_accounts/new.html.haml

This file was deleted.

9 changes: 0 additions & 9 deletions app/views/admin/financial_accounts/show.html.haml

This file was deleted.

9 changes: 0 additions & 9 deletions app/views/admin/gift_ideas/show.html.haml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
= form_with model: [:admin, book] do |form|
= form_with model: [:crud, book] do |form|
= form.text_field :isbn
= form.date_field :finished_on
= form.button button_label
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
%h1 Edit CSV Upload #{csv_upload.id}

%p= link_to "Show CSV Upload", admin_csv_upload_path(csv_upload)
%p= link_to "Show CSV Upload", crud_csv_upload_path(csv_upload)

= form_with model: [:admin, csv_upload] do |form|
= form_with model: [:crud, csv_upload] do |form|
= form.text_field :original_filename, placeholder: "original filename"
= form.button "update"
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
%h1 CSV Uploads

%p= link_to "New CSV Upload", new_admin_csv_upload_path
%p= link_to "New CSV Upload", new_crud_csv_upload_path

%table
%thead
Expand All @@ -12,7 +12,7 @@
%tbody
- csv_uploads.each do |csv_upload|
%tr
%td= link_to csv_upload.id, admin_csv_upload_path(csv_upload.id)
%td= link_to csv_upload.id, crud_csv_upload_path(csv_upload.id)
%td= csv_upload.parser_class_name
%td= csv_upload.original_filename
%td.text-right= csv_upload.created_at.to_formatted_s(:long)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
%h1 New CSV Upload

%p= link_to "CSV Upload List", admin_csv_uploads_path
%p= link_to "CSV Upload List", crud_csv_uploads_path

= form_with model: [:admin, csv_upload], multipart: true do |form|
= form_with model: [:crud, csv_upload], multipart: true do |form|
%select#csv_upload_parser_class_name(name="csv_upload[parser_class_name]" required="true")
%option(value="" disabled="true" selected hidden) pick parser
%option(value="WellsFargoParser") WellsFargoParser
Expand Down
14 changes: 14 additions & 0 deletions app/views/crud/csv_uploads/show.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
%h1 CSV Upload #{csv_upload.id}

%p= link_to "CSV Upload List", crud_csv_uploads_path

%p= link_to "Edit CSV Upload", edit_crud_csv_upload_path(csv_upload)

%p= link_to "Delete CSV Upload", crud_csv_upload_path(csv_upload), data: { turbo_method: :delete, turbo_confirm: "Are you sure?" }

= render partial: "attrs_table", locals: { attrs: csv_upload.table_attrs }

%h2 Data

%pre.text-off-black.h-72
%code= csv_upload.data
7 changes: 7 additions & 0 deletions app/views/crud/financial_accounts/edit.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
%h1 Edit Financial Account #{financial_account.id}

%p= link_to "Show Financial Account", crud_financial_account_path(financial_account)

= form_with model: [:crud, financial_account] do |form|
= form.text_field :name, placeholder: "name"
= form.button "update"
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
%h1 Financial Accounts

%p= link_to "New Financial Account", new_admin_financial_account_path
%p= link_to "New Financial Account", new_crud_financial_account_path

%table
%thead
Expand All @@ -11,7 +11,7 @@
%tbody
- financial_accounts.each do |financial_account|
%tr
%td= link_to financial_account.id, admin_financial_account_path(financial_account)
%td= link_to financial_account.id, crud_financial_account_path(financial_account)
%td= financial_account.name
%td.text-right= financial_account.created_at.to_formatted_s(:long)

Expand Down
7 changes: 7 additions & 0 deletions app/views/crud/financial_accounts/new.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
%h1 New Financial Account

%p= link_to "Financial Account List", crud_financial_accounts_path

= form_with model: [:crud, financial_account] do |form|
= form.text_field :name, placeholder: "name"
= form.button "create"
9 changes: 9 additions & 0 deletions app/views/crud/financial_accounts/show.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
%h1 Financial Account #{financial_account.id}

%p= link_to "Financial Account List", crud_financial_accounts_path

%p= link_to "Edit Financial Account", edit_crud_financial_account_path(financial_account)

%p= link_to "Delete Financial Account", crud_financial_account_path(financial_account), data: { turbo_method: :delete, turbo_confirm: "Are you sure?" }

= render partial: "attrs_table", locals: { attrs: financial_account.table_attrs }
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
= form_with model: [:admin, gift_idea] do |form|
= form_with model: [:crud, gift_idea] do |form|
= form.text_field :title, placeholder: "title"
= form.text_field :website_url, placeholder: "website"
= form.text_area :note, placeholder: "note"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
%h1 Edit Gift Idea #{gift_idea.id}

%p= link_to "Show Gift Idea", admin_gift_idea_path(gift_idea)
%p= link_to "Show Gift Idea", crud_gift_idea_path(gift_idea)

= render "form", gift_idea: gift_idea, button_label: "update"
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
%h1 Gift Ideas

%p= link_to "New Gift Idea", new_admin_gift_idea_path
%p= link_to "New Gift Idea", new_crud_gift_idea_path

%table
%thead
Expand All @@ -11,7 +11,7 @@
%tbody
- gift_ideas.each do |gift_idea|
%tr
%td= link_to gift_idea.id, admin_gift_idea_path(gift_idea)
%td= link_to gift_idea.id, crud_gift_idea_path(gift_idea)
%td= gift_idea.title
%td.text-right= gift_idea.created_at.to_formatted_s(:long)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
%h1 New Gift Idea

%p= link_to "Gift Idea List", admin_gift_ideas_path
%p= link_to "Gift Idea List", crud_gift_ideas_path

= render "form", gift_idea: gift_idea, button_label: "create"
9 changes: 9 additions & 0 deletions app/views/crud/gift_ideas/show.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
%h1 Gift Idea #{gift_idea.id}

%p= link_to "Gift Idea List", crud_gift_ideas_path

%p= link_to "Edit Gift Idea", edit_crud_gift_idea_path(gift_idea)

%p= link_to "Delete Gift Idea", crud_gift_idea_path(gift_idea), data: { turbo_method: :delete, turbo_confirm: "Are you sure?" }

= render partial: "attrs_table", locals: { attrs: gift_idea.table_attrs }
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
%menu
%a(href="#") Create Project
%section
= form_with model: [:admin, project] do |f|
= form_with model: [:crud, project] do |f|
= f.text_field :name
= f.button "Create"
- if projects.any?
Expand Down
File renamed without changes.
Loading

0 comments on commit e4b2295

Please sign in to comment.