Skip to content

Commit

Permalink
Change CreateUniversity Back to SaveUniversity.
Browse files Browse the repository at this point in the history
  • Loading branch information
zw963 committed Apr 29, 2024
1 parent 3b0ea85 commit 0cacd1a
Show file tree
Hide file tree
Showing 10 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion db/migrations/20240427102500_update_batch_level_data.cr
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ class UpdateBatchLevelData::V20240427102500 < Avram::Migrator::Migration::V1
def migrate
UniversityQuery.new.each do |university|
# if university.batch_number == "A"
# CreateUniversity.update!(university, batch_level: University::BatchNumber::LevelOne_A)
# SaveUniversity.update!(university, batch_level: University::BatchNumber::LevelOne_A)
# end
end

Expand Down
2 changes: 1 addition & 1 deletion src/actions/universities/create.cr
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
class Universities::Create < BrowserAction
post "/universities" do
CreateUniversity.create(params) do |operation, university|
SaveUniversity.create(params) do |operation, university|
if university
flash.success = "创建成功"
redirect New
Expand Down
2 changes: 1 addition & 1 deletion src/actions/universities/edit.cr
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class Universities::Edit < BrowserAction
.preload_city
.find(university_id)

op = CreateUniversity.new(
op = SaveUniversity.new(
university,
province_name: university.province.name,
province_code: university.province.code,
Expand Down
2 changes: 1 addition & 1 deletion src/actions/universities/new.cr
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
class Universities::New < BrowserAction
get "/universities/new" do
op = CreateUniversity.new(
op = SaveUniversity.new(
province_code: 110000,
province_name: "北京市",
city_code: 110100,
Expand Down
2 changes: 1 addition & 1 deletion src/actions/universities/update.cr
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
class Universities::Update < BrowserAction
put "/universities/:university_id" do
university = UniversityQuery.find(university_id)
CreateUniversity.update(university, params) do |operation, updated_university|
SaveUniversity.update(university, params) do |operation, updated_university|
if operation.saved?
flash.success = "修改成功"
redirect Show.with(updated_university.id)
Expand Down
2 changes: 1 addition & 1 deletion src/components/universities/address_selector.cr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class Universities::AddressSelector < BaseComponent
needs operation : CreateUniversity
needs operation : SaveUniversity

def render
div id: "select_address", class: "s12 m8 input-field" do
Expand Down
2 changes: 1 addition & 1 deletion src/components/universities/form_fields.cr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class Universities::FormFields < BaseComponent
needs op : CreateUniversity
needs op : SaveUniversity

def render
div do
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class CreateUniversity < University::SaveOperation
class SaveUniversity < University::SaveOperation
upsert_lookup_columns name
permit_columns name, description, code,
is_211, is_985, is_good,
Expand Down
2 changes: 1 addition & 1 deletion src/pages/universities/edit_page.cr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class Universities::EditPage < MainLayout
needs operation : CreateUniversity
needs operation : SaveUniversity
needs university : University

quick_def page_title, "编辑 #{university.name}"
Expand Down
2 changes: 1 addition & 1 deletion src/pages/universities/new_page.cr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class Universities::NewPage < MainLayout
needs operation : CreateUniversity
needs operation : SaveUniversity
quick_def page_title, "新增学校"

def content
Expand Down

0 comments on commit 0cacd1a

Please sign in to comment.