Changes for helpers, not including all by default

This commit is contained in:
chris 2012-10-09 14:47:16 +08:00
parent a0103d55c4
commit 189fa553c5
17 changed files with 13 additions and 72 deletions

View File

@ -5,7 +5,7 @@ class ApplicationController < ActionController::Base
layout :layout_by_resource layout :layout_by_resource
helper :all helper :admin
before_filter :set_locale, :set_site before_filter :set_locale, :set_site
def set_current_user def set_current_user

View File

@ -1,4 +1,4 @@
module Admin::AdBannerHelper module Admin::AdBannersHelper
def preview_block_ad_images_helper(ad_banner) def preview_block_ad_images_helper(ad_banner)
printable_ad_images = [] printable_ad_images = []
ad_banner.ad_images.each do |ad_image| ad_banner.ad_images.each do |ad_image|

View File

@ -1,3 +0,0 @@
module Admin::AdImagesHelper
end

View File

@ -1,4 +1,4 @@
module Admin::AppAuthHelper module Admin::AppAuthsHelper
def on_off_switch(attribute,attribute_type) def on_off_switch(attribute,attribute_type)
link_to t(:enable), eval("admin_#{attribute_type}_path(attribute, :authenticity_token => form_authenticity_token, :#{attribute_type} => {:disabled => true})"), :remote => true, :method => :put, :id => "disable_#{attribute.id}", :style => "display:#{attribute.is_disabled? ? 'none' : ''}", :class => 'switch' link_to t(:enable), eval("admin_#{attribute_type}_path(attribute, :authenticity_token => form_authenticity_token, :#{attribute_type} => {:disabled => true})"), :remote => true, :method => :put, :id => "disable_#{attribute.id}", :style => "display:#{attribute.is_disabled? ? 'none' : ''}", :class => 'switch'
link_to t(:disable), eval("admin_#{attribute_type}_path(attribute, :authenticity_token => form_authenticity_token, :#{attribute_type} => {:disabled => false})"), :remote => true, :method => :put, :id => "enable_#{attribute.id}", :style => "display:#{attribute.is_disabled? ? '' : 'none'}", :class => 'switch' link_to t(:disable), eval("admin_#{attribute_type}_path(attribute, :authenticity_token => form_authenticity_token, :#{attribute_type} => {:disabled => false})"), :remote => true, :method => :put, :id => "enable_#{attribute.id}", :style => "display:#{attribute.is_disabled? ? '' : 'none'}", :class => 'switch'

View File

@ -1,4 +1,4 @@
module Admin::AssetHelper module Admin::AssetsHelper
def show_all_fields(asset, field) def show_all_fields(asset, field)
a = [] a = []

View File

@ -1,4 +1,4 @@
module Admin::DashboardHelper module Admin::DashboardsHelper
def get_link(title) def get_link(title)
case title case title

View File

@ -1,4 +1,4 @@
module Admin::ItemHelper module Admin::ItemsHelper
def render_node_and_children(node) def render_node_and_children(node)
ret = '' ret = ''

View File

@ -1,4 +1,4 @@
module Admin::ModuleAppHelper module Admin::ModuleAppsHelper
def if_permit_to_delete(item) def if_permit_to_delete(item)
case item.downcase case item.downcase

View File

@ -1,18 +0,0 @@
module Admin::PageContentHelper
include ActionView::Helpers::UrlHelper
def show_page_context_edit_auth_link(page_context)
type = 'Edit'
# debugger
# a=1
oa = page_context.get_object_auth_by_title(type)
if oa.nil?
page_context.object_auths.new(title: type ).save rescue
oa = page_context.get_object_auth_by_title(type)
end
# link_to t('announcement.bulletin.cate_auth'), edit_admin_object_auth_path(oa)
link_to t('admin.page_context.ob_auth.edit'),admin_object_auth_ob_auth_path(oa)
end
end

View File

@ -1,4 +1,4 @@
module Admin::PluginHelper module Admin::PluginsHelper
def render_plugin_list def render_plugin_list
ret = '' ret = ''

View File

@ -1,4 +1,4 @@
module Admin::UserHelper module Admin::UsersHelper
def show_attribute(object, field_id, locale = '') def show_attribute(object, field_id, locale = '')
attribute = object.attribute_values.detect {|av| av.attribute_field_id.eql?(field_id) || av[locale.to_s].eql?(locale.to_s) } rescue nil attribute = object.attribute_values.detect {|av| av.attribute_field_id.eql?(field_id) || av[locale.to_s].eql?(locale.to_s) } rescue nil

View File

@ -1,11 +0,0 @@
module Admin::WebLinkHelper
def show_web_link_permission_link(web_link)
type = 'edit'
oa = web_link.get_object_auth_by_title(type)
if oa.nil?
web_link.object_auths.new(title: type ).save
oa = web_link.get_object_auth_by_title(type)
end
link_to t('web_resource.cate_auth'),admin_object_auth_ob_auth_path(oa)
end
end

View File

@ -1,6 +1,6 @@
# require ActionView::Helpers::FormTagHelper # require ActionView::Helpers::FormTagHelper
module AttributeFieldHelper module AttributeFieldsHelper
include ActionView::Helpers::FormTagHelper include ActionView::Helpers::FormTagHelper
include ActionView::Helpers::FormOptionsHelper include ActionView::Helpers::FormOptionsHelper
include ActionView::Helpers::DateHelper include ActionView::Helpers::DateHelper

View File

@ -1,24 +0,0 @@
module CalendarHelper
def month_link(month_date)
link_to(I18n.localize(month_date, :format => "%B"), {:month => month_date.month, :year => month_date.year})
end
# custom options for this calendar
def event_calendar_opts
{
:year => @year,
:month => @month,
:event_strips => @event_strips,
:month_name_text => I18n.localize(@shown_month, :format => "%B %Y"),
:previous_month_text => "<< " + month_link(@shown_month.prev_month),
:next_month_text => month_link(@shown_month.next_month) + " >>" }
end
def event_calendar
# args is an argument hash containing :event, :day, and :options
calendar event_calendar_opts do |args|
event = args[:event]
%(<a href="/events/#{event.id}" title="#{h(event.name)}">#{h(event.name)}</a>)
end
end
end

View File

@ -1,4 +0,0 @@
module DesignHelper
end

View File

@ -1,2 +0,0 @@
module SitesHelper
end

View File

@ -34,6 +34,9 @@ module Orbit
config.autoload_paths += %W(#{config.root}/app/models/purchase) config.autoload_paths += %W(#{config.root}/app/models/purchase)
config.autoload_paths += %W(#{config.root}/app/models/user) config.autoload_paths += %W(#{config.root}/app/models/user)
# Include all helpers
# 'helper :all' must be removed in ApplicationController
config.action_controller.include_all_helpers = false
# Only load the plugins named here, in the order given (default is alphabetical). # Only load the plugins named here, in the order given (default is alphabetical).
# :all can be used as a placeholder for all plugins not explicitly named. # :all can be used as a placeholder for all plugins not explicitly named.