Merge branch 'design_team' into ldap
This commit is contained in:
commit
6b9c8eb15d
40 files changed
+618
-121
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
|
||||
@@ -0,0 +1,8 @@
|
||||
class Admin::AssetTagsController < Admin::TagsController
|
||||
|
||||
def initialize
|
||||
super
|
||||
@app_title = 'asset'
|
||||
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,8 @@ class Admin::AssetsController < ApplicationController
|
||||
|
||||
def new
|
||||
@asset = Asset.new
|
||||
@asset_categories = AssetCategory.all
|
||||
@tags = AssetTag.all
|
||||
respond_to do |format|
|
||||
format.html {}
|
||||
format.js { render 'js/show_pop_up', :locals => {:partial => 'admin/assets/new'} }
|
||||
@@ -22,6 +20,8 @@ class Admin::AssetsController < ApplicationController
|
||||
|
||||
def edit
|
||||
@asset = Asset.find(params[:id])
|
||||
@asset_categories = AssetCategory.all
|
||||
@tags = AssetTag.all
|
||||
respond_to do |format|
|
||||
format.html {}
|
||||
format.js { render 'js/show_pop_up', :locals => {:partial => 'admin/assets/edit'} }
|
||||
@@ -30,15 +30,29 @@ class Admin::AssetsController < ApplicationController
|
||||
|
||||
def create
|
||||
@asset = Asset.new(params[:asset])
|
||||
if @asset.save
|
||||
@asset.filename = @asset.i18n_variable[I18n.locale] rescue nil
|
||||
if @asset.filename && @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 {
|
||||
if params[:uploader]
|
||||
render 'create'
|
||||
else
|
||||
render 'js/remove_pop_up_and_reload_content', :locals => {:function => 'replaceWith', :id => "asset_#{@asset.id}", :value => @asset, :values => nil, :partial => 'admin/assets/asset', :locals => nil}
|
||||
end
|
||||
}
|
||||
end
|
||||
else
|
||||
flash[:error] = t(:create_fail)
|
||||
@asset_categories = AssetCategory.all
|
||||
@tags = AssetTag.all
|
||||
respond_to do |format|
|
||||
format.html { render :action => :new }
|
||||
format.js { render 'js/reload_pop_up', :locals => {:value => @asset, :values => nil, :partial => 'admin/assets/new', :locals => {:is_html => false}} }
|
||||
format.js {
|
||||
if params[:uploader]
|
||||
render 'file_upload'
|
||||
else
|
||||
render 'js/reload_pop_up', :locals => {:value => @asset, :values => nil, :partial => 'admin/assets/new', :locals => {:is_html => false}}
|
||||
end
|
||||
}
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -51,6 +65,9 @@ class Admin::AssetsController < ApplicationController
|
||||
format.js { render 'js/remove_pop_up_and_reload_content', :locals => {:function => 'replaceWith', :id => "asset_#{@asset.id}", :value => @asset, :values => nil, :partial => 'admin/assets/asset', :locals => nil} }
|
||||
end
|
||||
else
|
||||
flash[:error] = t(:update_fail)
|
||||
@asset_categories = AssetCategory.all
|
||||
@tags = AssetTag.all
|
||||
respond_to do |format|
|
||||
format.html { render :action => :edit }
|
||||
format.js { render 'js/reload_pop_up', :locals => {:value => @asset, :values => nil, :partial => 'admin/assets/edit', :locals => {:is_html => false}} }
|
||||
@@ -66,5 +83,24 @@ 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
|
||||
|
||||
def file_upload
|
||||
@asset = Asset.new
|
||||
@asset_categories = AssetCategory.all
|
||||
@tags = AssetTag.all
|
||||
render :layout => false
|
||||
end
|
||||
|
||||
def file_select
|
||||
@assets = Asset.all
|
||||
render :layout => false
|
||||
end
|
||||
|
||||
end
|
||||
Reference in new issue
Block a user