title check for category creation
This commit is contained in:
parent
3abcd5a09a
commit
afb9be2d07
|
@ -158,7 +158,13 @@ class Admin::UniversalTablesController < OrbitAdminController
|
|||
|
||||
def create
|
||||
category = Category.new
|
||||
category.title_translations = params[:u_table][:title_translations]
|
||||
title_for_category = params[:u_table][:title_translations]
|
||||
if title_for_category["en"] == "" && title_for_category["zh_tw"] != ""
|
||||
title_for_category["en"] = title_for_category["zh_tw"]
|
||||
elsif title_for_category["zh_tw"] == "" && title_for_category["en"] != ""
|
||||
title_for_category["zh_tw"] = title_for_category["en"]
|
||||
end
|
||||
category.title_translations = title_for_category
|
||||
category.module_app = @module_app
|
||||
category.save
|
||||
p = table_params
|
||||
|
@ -182,7 +188,13 @@ class Admin::UniversalTablesController < OrbitAdminController
|
|||
cat = Category.new
|
||||
cat.module_app = @module_app
|
||||
end
|
||||
cat.title_translations = p[:title_translations]
|
||||
title_for_category = p[:title_translations]
|
||||
if title_for_category["en"] == "" && title_for_category["zh_tw"] != ""
|
||||
title_for_category["en"] = title_for_category["zh_tw"]
|
||||
elsif title_for_category["zh_tw"] == "" && title_for_category["en"] != ""
|
||||
title_for_category["zh_tw"] = title_for_category["en"]
|
||||
end
|
||||
cat.title_translations = title_for_category
|
||||
cat.save
|
||||
p[:category_id] = cat.id
|
||||
table.update_attributes(p)
|
||||
|
|
Loading…
Reference in New Issue