Change assets
This commit is contained in:
1 parent
80e84c10ba
commit
0b0916179f
24 files changed
+346
-71
No files matched your search
@@ -0,0 +1,65 @@
|
||||
class Admin::AssetCategoriesController < OrbitBackendController
|
||||
|
||||
def index
|
||||
@asset_categories = AssetCategory.all
|
||||
@asset_category = AssetCategory.new
|
||||
@url = admin_asset_categories_path
|
||||
|
||||
end
|
||||
|
||||
def show
|
||||
@asset_category = AssetCategory.find(params[:id])
|
||||
end
|
||||
|
||||
def new
|
||||
@asset_category = AssetCategory.new
|
||||
end
|
||||
|
||||
def edit
|
||||
@asset_category = AssetCategory.find(params[:id])
|
||||
@i18n_variable = @asset_category.i18n_variable
|
||||
@url = admin_asset_categories_path(@asset_category)
|
||||
end
|
||||
|
||||
def create
|
||||
@asset_category = AssetCategory.new(params[:asset_category])
|
||||
|
||||
respond_to do |format|
|
||||
if @asset_category.save
|
||||
format.html { redirect_to(admin_asset_categories_url, :notice => t('announcement.create_asset_category_success')) }
|
||||
format.js
|
||||
else
|
||||
format.html { render :action => "new" }
|
||||
format.js { render action: "new" }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def update
|
||||
@asset_category = AssetCategory.find(params[:id])
|
||||
|
||||
@url = admin_asset_categories_path(@asset_category)
|
||||
|
||||
respond_to do |format|
|
||||
if @asset_category.update_attributes(params[:asset_category])
|
||||
# format.html { redirect_to(panel_announcement_back_end_asset_category_url(@asset_category), :notice => t('asset_category.update_asset_category_success')) }
|
||||
# format.html { redirect_to(panel_announcement_back_end_asset_categories_url, :notice => t('asset_category.update_asset_category_success')) }
|
||||
# format.xml { head :ok }
|
||||
format.js
|
||||
else
|
||||
format.html { render :action => "edit" }
|
||||
format.js { render :action => "edit" }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
@asset_category = AssetCategory.find(params[:id])
|
||||
@asset_category.destroy
|
||||
|
||||
respond_to do |format|
|
||||
format.html { redirect_to(admin_asset_categories_url) }
|
||||
format.js
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1,11 +1,7 @@
|
||||
class Admin::AssetsController < ApplicationController
|
||||
|
||||
layout "admin"
|
||||
before_filter :authenticate_user!
|
||||
before_filter :is_admin?
|
||||
class Admin::AssetsController < OrbitBackendController
|
||||
|
||||
def index
|
||||
@assets = Asset.all.entries
|
||||
@assets = (params[:sort] || @filter) ? get_sorted_and_filtered("asset") : Asset.all.page(params[:page]).per(10)
|
||||
end
|
||||
|
||||
def show
|
||||
@@ -14,6 +10,7 @@ class Admin::AssetsController < ApplicationController
|
||||
|
||||
def new
|
||||
@asset = Asset.new
|
||||
@asset_categories = AssetCategory.all
|
||||
respond_to do |format|
|
||||
format.html {}
|
||||
format.js { render 'js/show_pop_up', :locals => {:partial => 'admin/assets/new'} }
|
||||
@@ -22,6 +19,7 @@ class Admin::AssetsController < ApplicationController
|
||||
|
||||
def edit
|
||||
@asset = Asset.find(params[:id])
|
||||
@asset_categories = AssetCategory.all
|
||||
respond_to do |format|
|
||||
format.html {}
|
||||
format.js { render 'js/show_pop_up', :locals => {:partial => 'admin/assets/edit'} }
|
||||
@@ -33,7 +31,7 @@ class Admin::AssetsController < ApplicationController
|
||||
if @asset.save
|
||||
respond_to do |format|
|
||||
format.html { redirect_to admin_assets_url }
|
||||
format.js { render 'js/remove_pop_up_and_reload_content', :locals => {:function => 'append', :id => 'asset_tbody', :value => @asset, :values => nil, :partial => 'admin/assets/asset', :locals => nil} }
|
||||
format.js { render 'js/remove_pop_up_and_reload_content', :locals => {:function => 'append', :id => 'tbody_assets', :value => @asset, :values => nil, :partial => 'admin/assets/asset', :locals => nil} }
|
||||
end
|
||||
else
|
||||
respond_to do |format|
|
||||
@@ -66,5 +64,12 @@ class Admin::AssetsController < ApplicationController
|
||||
format.js { render 'js/remove_element', :locals => {:id => "asset_#{@asset.id}"} }
|
||||
end
|
||||
end
|
||||
|
||||
def delete
|
||||
if params[:to_delete]
|
||||
asset = Asset.any_in(:_id => params[:to_delete]).delete_all
|
||||
end
|
||||
redirect_to assets_url(:filter => params[:filter], :direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options])
|
||||
end
|
||||
|
||||
end
|
||||
Reference in new issue
Block a user