Merge branch 'design_team' of https://github.com/Rulingcom/orbit into nccu_0509
Conflicts: app/controllers/admin/object_auths_new_interface_controller.rb app/helpers/application_helper.rb app/models/ad_banner.rb
This commit is contained in:
commit
a31a9c4792
169 files changed
+14400
-185
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
|
||||
@@ -7,6 +7,7 @@ class Admin::DashboardsController < ApplicationController
|
||||
def index
|
||||
@module_app_contents, @module_app_contents_total = get_module_app_count('bulletin', 'news_bulletin', 'page_context', 'web_link')
|
||||
@recent_updated = get_recently_updated('bulletin', 'news_bulletin', 'page_context', 'web_link')
|
||||
@most_visited = get_most_visited('bulletin', 'news_bulletin', 'page_context')
|
||||
end
|
||||
|
||||
protected
|
||||
@@ -35,5 +36,18 @@ class Admin::DashboardsController < ApplicationController
|
||||
sorted_objects = a.sort {|a,b| b[1]<=>a[1]}
|
||||
sorted_objects[0..9]
|
||||
end
|
||||
|
||||
def get_most_visited(*args)
|
||||
a = {}
|
||||
args.each do |module_app|
|
||||
module_app_class = module_app.classify.constantize
|
||||
objects = module_app_class.order_by(:view_count, :desc).limit(10)
|
||||
objects.each do |object|
|
||||
a.merge!(object => object.view_count) if object.view_count > 0
|
||||
end
|
||||
end
|
||||
sorted_objects = a.sort {|a,b| b[1]<=>a[1]}
|
||||
sorted_objects[0..9]
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,8 +1,6 @@
|
||||
class Admin::ObjectAuthsNewInterfaceController < OrbitBackendController
|
||||
include OrbitCoreLib::PermissionUnility
|
||||
layout "new_admin"
|
||||
before_filter :force_order
|
||||
|
||||
|
||||
|
||||
def setting
|
||||
|
||||
@@ -7,6 +7,7 @@ class PagesController < ApplicationController
|
||||
def index
|
||||
@item = Page.find_by_name('home')
|
||||
if @item
|
||||
impressionist(@item)
|
||||
render_page
|
||||
else
|
||||
render :text => 'You need a home page'
|
||||
@@ -14,18 +15,19 @@ class PagesController < ApplicationController
|
||||
end
|
||||
|
||||
def show
|
||||
#begin
|
||||
@item = Item.first(:conditions => {:path => params[:page_name]})
|
||||
if @item && @item.is_published && (@item.enabled_for.nil? ? true : @item.enabled_for.include?(I18n.locale.to_s))
|
||||
case @item._type
|
||||
when 'Page'
|
||||
render_page
|
||||
when 'Link'
|
||||
redirect_to "http://#{@item[:url]}"
|
||||
end
|
||||
else
|
||||
render :file => "#{Rails.root}/public/404.html", :status => :not_found
|
||||
end
|
||||
#begin
|
||||
@item = Item.first(:conditions => {:path => params[:page_name]})
|
||||
if @item && @item.is_published && (@item.enabled_for.nil? ? true : @item.enabled_for.include?(I18n.locale.to_s))
|
||||
impressionist(@item)
|
||||
case @item._type
|
||||
when 'Page'
|
||||
render_page
|
||||
when 'Link'
|
||||
redirect_to @item[:url]
|
||||
end
|
||||
else
|
||||
render :file => "#{Rails.root}/public/404.html", :status => :not_found
|
||||
end
|
||||
#rescue
|
||||
# render :file => "#{Rails.root}/public/404.html", :status => :not_found
|
||||
#end
|
||||
@@ -55,11 +57,7 @@ class PagesController < ApplicationController
|
||||
|
||||
def get_item
|
||||
module_app = ModuleApp.first(:conditions => {:key => params[:app_name]})
|
||||
# if params[:category_id]
|
||||
# @item = Item.first(:conditions => {:module_app_id => module_app.id, :app_frontend_url => params[:app_action], :category => params[:category_id]})
|
||||
# else
|
||||
@item = Item.first(:conditions => {:module_app_id => module_app.id, :app_frontend_url => params[:app_action]})
|
||||
# end
|
||||
@item = Item.first(:conditions => {:module_app_id => module_app.id, :app_frontend_url => params[:app_action]})
|
||||
end
|
||||
|
||||
end
|
||||
Reference in new issue
Block a user