Structure link with json
This commit is contained in:
1 parent
a4d1c68299
commit
8ebfac2b99
13 files changed
+124
-136
No files matched your search
@@ -1,4 +1,5 @@
|
||||
class Admin::ItemsController < OrbitBackendController
|
||||
include ActionView::Helpers::DynamicForm
|
||||
|
||||
layout "structure"
|
||||
|
||||
|
||||
@@ -32,20 +32,22 @@ class Admin::LinksController < Admin::ItemsController
|
||||
|
||||
def update
|
||||
@item = Link.find(params[:id])
|
||||
|
||||
if @item.update_attributes(params[:link])
|
||||
success = true
|
||||
else
|
||||
success = check_valid_url
|
||||
unless @item.update_attributes(params[:link])
|
||||
@error = error_messages_for(@item)
|
||||
end
|
||||
if success
|
||||
flash.now[:notice] = t('update.success.link')
|
||||
respond_to do |format|
|
||||
format.js { render 'admin/items/reload_items' }
|
||||
end
|
||||
|
||||
def get_link_setting_json
|
||||
begin
|
||||
link = Link.find(params[:id])
|
||||
m = {}
|
||||
m["public"] = link.is_published ? 1 : 0
|
||||
m["link"] = @site_valid_locales.inject([]) do |result, locale|
|
||||
result << [locale, (link.enabled_for && link.enabled_for.include?(locale)) ? 1 : 0, (link.menu_enabled_for && link.menu_enabled_for[locale]) ? 1 :0]
|
||||
end
|
||||
else
|
||||
flash.now[:error] = t('update.error.link')
|
||||
render :action => "edit"
|
||||
render json: JSON.pretty_generate(m)
|
||||
rescue
|
||||
render :json => {error: ''}, status: 422
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -2,8 +2,6 @@ class Admin::PagesController < Admin::ItemsController
|
||||
helper Admin::PagePartsHelper
|
||||
include Admin::FrontendWidgetInterface
|
||||
|
||||
include ActionView::Helpers::DynamicForm
|
||||
|
||||
def show
|
||||
@item = Page.find(params[:id])
|
||||
@no_orbit_bar = true
|
||||
@@ -158,7 +156,7 @@ class Admin::PagesController < Admin::ItemsController
|
||||
m["count"] = page.frontend_data_count
|
||||
render json: JSON.pretty_generate({design: design, module: m})
|
||||
rescue
|
||||
render :json => {error: 'hahah'}, status: 422
|
||||
render :json => {error: ''}, status: 422
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in new issue
Block a user