Merge branch 'design_team' into ldap

Conflicts:
	vendor/built_in_modules/news/app/controllers/panel/news/back_end/news_approvals_controller.rb
	vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_news_bulletin.html.erb
This commit is contained in:
Christophe Vilayphiou committed 2012-05-22 20:33:07 +08:00
commit f1c8bed29d
76 files changed
+348 -171

No files matched your search

@@ -1,7 +1,7 @@
class Admin::AdBannersController < OrbitBackendController
layout "new_admin"
before_filter :authenticate_user!
before_filter :for_app_manager,:except => [:index,:show]
before_filter :for_app_manager,:except => [:index,:show,:update,:realtime_preview]
before_filter :for_app_sub_manager
def rename
@@ -1,8 +1,8 @@
class Admin::AdImagesController < ApplicationController
class Admin::AdImagesController < OrbitBackendController
layout 'new_admin'
before_filter :authenticate_user!
before_filter :is_admin?
before_filter :for_app_sub_manager
def edit
@ad_banner = AdBanner.find params[:ad_banner_id]
@ad_image = @ad_banner.ad_images.find params[:id]
+3 -1
View File
@@ -65,9 +65,11 @@ class Admin::LinksController < ApplicationController
end
def delete
@item = Link.find(params[:id])
@item.destroy
respond_to do |format|
format.html {}
format.js { destroy }
format.js { @item = @item.parent }
end
end
+5 -3
View File
@@ -51,7 +51,7 @@ class Admin::PagesController < ApplicationController
def create
@item = Page.new(params[:page])
if @item.module_app.key == 'page_content'
if @item.module_app && @item.module_app.key == 'page_content'
@item.page_contexts.build(:create_user_id => current_user.id, :update_user_id => current_user.id )
end
@@ -99,14 +99,16 @@ class Admin::PagesController < ApplicationController
format.html {
redirect_to admin_items_url( :parent_id => @item.parent_id )
}
format.js {}
format.js { redirect_to admin_items_url }
end
end
def delete
@item = Page.find(params[:id])
@item.destroy
respond_to do |format|
format.html {}
format.js { destroy }
format.js { @item = @item.parent }
end
end
+1 -1
View File
@@ -157,7 +157,7 @@ class ApplicationController < ActionController::Base
end
def get_homepage
Item.first(:conditions => {:parent_id => nil})
Page.root
end
def layout_by_resource
+38 -10
View File
@@ -32,13 +32,8 @@ class OrbitBackendController< ApplicationController
end
def get_sorted_and_filtered(object_class, query=nil)
objects = get_objects(object_class, query)
object_class = object_class.classify.constantize
if query
objects = object_class.all.where(query)
else
objects = object_class.all
end
if !params[:sort].blank?
options = params[:sort_options]
options = [options] if !options.class.eql?(Array)
@@ -79,7 +74,7 @@ class OrbitBackendController< ApplicationController
when 'categories'
a = Array.new
objects.each do |object|
a << object if value.include?(object.send("#{object.class.to_s.underscore}_category").id.to_s)
a << object if (value.include?(object.send("#{object.class.to_s.underscore}_category").id.to_s) rescue nil)
end
objects = a.uniq
when 'tags'
@@ -93,7 +88,7 @@ class OrbitBackendController< ApplicationController
end if value.size > 0
end
end
Kaminari.paginate_array(objects).page(params[:page]).per(10)
Kaminari.paginate_array(filter_authorized_objects(objects)).page(params[:page]).per(10)
end
def get_string_value_from_object(object)
@@ -104,9 +99,9 @@ class OrbitBackendController< ApplicationController
if s
case s.class.to_s
when "String"
s.downcase
s.downcase rescue ''
when "I18nVariable"
s[I18n.locale].downcase
s[I18n.locale].downcase rescue ''
else
nil
end
@@ -157,5 +152,38 @@ class OrbitBackendController< ApplicationController
a = params[:direction].eql?('asc') ? (sorted_tmp + sorted_objects) : (sorted_objects + sorted_tmp)
a.flatten
end
def get_viewable(object_class)
objects = get_objects(object_class)
Kaminari.paginate_array(objects).page(params[:page]).per(10)
end
def get_objects(object_class, query=nil)
object_class = object_class.classify.constantize
if query
objects = object_class.all.where(query)
else
objects = object_class.all
end
objects
end
def filter_authorized_objects(objects)
if(!is_admin? || !is_manager?)
objects.delete_if{ |object|
if object.is_pending == true
if check_permission(:manager)
object.create_user_id != current_user.id
else
!object.send("#{object.class.to_s.underscore}_category").authed_users('fact_check').include?(current_user) rescue false
end
else
false
end
}
end
objects
end
end