code stringlengths 1 1.73M | language stringclasses 1
value |
|---|---|
source :gemcutter
gem 'sinatra', :require => 'sinatra/base'
gem 'thin', '~> 1.3'
gem 'pg'
gem 'sinatra-activerecord'
gem 'google-api-client', '>= 0.4.4', :require => 'google/api_client'
group :development do
gem 'rake'
gem 'sqlite3-ruby'
end
| Ruby |
require 'sinatra.rb'
# Sinatra defines #set at the top level as a way to set application configuration
set :run, false
set :env, (ENV['RACK_ENV'] ? ENV['RACK_ENV'].to_sym : :development)
require './main'
run Sinatra::Application | Ruby |
require 'sinatra/activerecord/rake'
require './main' | Ruby |
# Make sure that ActiveScaffold has already been included
ActiveScaffold rescue throw "should have included ActiveScaffold plug in first. Please make sure that this overwrite plugging comes alphabetically after the ActiveScaffold plug in"
# Load our overrides
load 'actions/export.rb'
load 'config/export.rb'
loa... | Ruby |
# Workaround a problem with script/plugin and http-based repos.
# See http://dev.rubyonrails.org/ticket/8189
Dir.chdir(Dir.getwd.sub(/vendor.*/, '')) do
##
## Copy over asset files (javascript/css/images) from the plugin directory to public/
##
def copy_files(source_path, destination_path, directory)
source, destin... | Ruby |
module ActiveScaffold::Config
class Core
# configures where the active_scaffold_export plugin itself is located. there is no instance version of this.
cattr_accessor :export_plugin_directory
@@export_plugin_directory = File.expand_path(__FILE__).match(/vendor\/plugins\/([^\/]*)/)[1]
# the active_scaf... | Ruby |
module ActiveScaffold::Config
class Export < Base
self.crud_type = :read
def initialize(core_config)
@core = core_config
end
# global level configuration
# --------------------------
# the ActionLink for this action
cattr_accessor :link
@@link = ActiveScaffold::DataStructures::... | Ruby |
module ActionView::Helpers
module ActiveScaffoldHelpers
# Add the export plugin includes
def active_scaffold_includes_with_export
css = stylesheet_link_tag(ActiveScaffold::Config::Core.asset_path(:stylesheet, 'export-stylesheet.css'))
ie_css = stylesheet_link_tag(ActiveScaffold::Config::Core... | Ruby |
module ActionView::Helpers
module ActiveScaffoldListHelpers
##
## Table cell formatting methods
##
def render_csv_column(record, column)
# check for an override helper
value = record.send(column.name)
if column.association.nil? or column_empty?(value)
... | Ruby |
module ActiveScaffold::Actions
module Search
def self.included(base)
base.before_filter :search_authorized?, :only => :show_search
base.before_filter :do_search
base.before_filter :init_session_var
end
def init_session_var
session[:search] = params[:search]
end
end
end
| Ruby |
module ActiveScaffold::Actions
module Export
def self.included(base)
base.before_filter :export_authorized?, :only => [:export]
base.before_filter :init_session_var
end
def init_session_var
session[:search] = params[:search] if !params[:search].nil? || params[:commit]=='Recherche'
... | Ruby |
# Make sure that ActiveScaffold has already been included
ActiveScaffold rescue throw "should have included ActiveScaffold plug in first. Please make sure that this plug-in comes alphabetically after the ActiveScaffold plug-in"
# Load our overrides
Kernel::load 'actions/export.rb'
Kernel::load 'config/export.rb'... | Ruby |
# Workaround a problem with script/plugin and http-based repos.
# See http://dev.rubyonrails.org/ticket/8189
Dir.chdir(Dir.getwd.sub(/vendor.*/, '')) do
##
## Copy over asset files (javascript/css/images) from the plugin directory to public/
##
def copy_files(source_path, destination_path, directory)
source, destin... | Ruby |
module ActiveScaffold::Config
class Core
# configures where the active_scaffold_export plugin itself is located. there is no instance version of this.
cattr_accessor :export_plugin_directory
@@export_plugin_directory = File.expand_path(__FILE__).match(/vendor\/plugins\/([^\/]*)/)[1]
# the active_scaf... | Ruby |
module ActiveScaffold::Config
class Export < Base
self.crud_type = :read
def initialize(core_config)
@core = core_config
end
# global level configuration
# --------------------------
# the ActionLink for this action
cattr_accessor :link
@@link = ActiveScaffold::DataStructures::... | Ruby |
module ActiveScaffold
module Helpers
module ViewHelpers
# Add the export plugin includes
def active_scaffold_includes_with_export(frontend = :default)
css = stylesheet_link_tag(ActiveScaffold::Config::Core.asset_path('export-stylesheet.css', frontend))
ie_css = stylesheet_link_ta... | Ruby |
module ActiveScaffold::Actions
module Export
def self.included(base)
base.before_filter :export_authorized?, :only => [:export]
base.before_filter :init_session_var
end
def init_session_var
session[:search] = params[:search] if !params[:search].nil? || params[:commit] == as_('Search... | Ruby |
# Require any additional compass plugins here.
# Set this to the root of your project when deployed:
http_path = "/"
css_dir = "theme/css"
sass_dir = "theme/scss"
images_dir = "images"
javascripts_dir = "js"
# You can select your preferred output style here (can be overridden via the command line):
output_style = :co... | Ruby |
require 'rake'
require 'rake/testtask'
require 'tempfile'
task :default => [:java_compile,:test]
def java_classpath_arg #myriad of ways to discover JRuby classpath
begin
require 'java' # already running in a JRuby JVM
jruby_cpath = Java::java.lang.System.getProperty('java.class.path')
rescue L... | Ruby |
module Hibernate
PropertySpecifier = Struct.new :name, :type, :column
module Configuration
def define_hibernate_variable(name, default_value)
# self references an object of class Class
self.instance_variable_set :"@#{name}", default_value
(class <<self; self; end).send :define_method,... | Ruby |
require 'ActiveHibernateInternal'
require 'rubygems'
require_gem 'builder'
require_gem 'activesupport'
require 'active_support/inflector'
module ActiveHibernate
ManagedSessionContext = Java::org.hibernate.context.ManagedSessionContext
Configuration = Java::org.hibernate.cfg.Configuration
EntityNameInt... | Ruby |
$CLASSPATH << 'lib/hsqldb.jar'
$CLASSPATH << 'cfg/'
$CLASSPATH << 'test/'
DB_CONFIG = {
:driver => 'org.hsqldb.jdbcDriver',
:url => 'jdbc:hsqldb:test.db',
:username => 'sa',
:password => '',
:dialect => 'org.hibernate.dialect.HSQLDialect'
} | Ruby |
require 'rake'
require 'rake/testtask'
require 'tempfile'
task :default => [:java_compile,:test]
def java_classpath_arg #myriad of ways to discover JRuby classpath
begin
require 'java' # already running in a JRuby JVM
jruby_cpath = Java::java.lang.System.getProperty('java.class.path')
rescue L... | Ruby |
module Hibernate
PropertySpecifier = Struct.new :name, :type, :column
module Configuration
def define_hibernate_variable(name, default_value)
# self references an object of class Class
self.instance_variable_set :"@#{name}", default_value
(class <<self; self; end).send :define_method,... | Ruby |
require 'ActiveHibernateInternal'
require 'rubygems'
require 'builder'
gem 'activesupport'
require 'active_support/inflector'
module ActiveHibernate
ManagedSessionContext = Java::org.hibernate.context.ManagedSessionContext
Configuration = Java::org.hibernate.cfg.Configuration
EntityNameInterceptor = J... | Ruby |
$CLASSPATH << 'lib/hsqldb.jar'
$CLASSPATH << 'cfg/'
$CLASSPATH << 'test/'
DB_CONFIG = {
:driver => 'org.hsqldb.jdbcDriver',
:url => 'jdbc:hsqldb:.',
:username => 'sa',
:password => '',
:dialect => 'org.hibernate.dialect.HSQLDialect',
:pk_strategy => Proc.new { primary_key_accessor :id, :long }
... | Ruby |
require 'fileutils'
# Install hook code here
public_dir = File.dirname(__FILE__) + "/../../../public"
plugin_dir = File.dirname(__FILE__) + "/public"
FileUtils.install(plugin_dir + "/images/calendar.png", public_dir + "/images")
FileUtils.cp_r(plugin_dir + "/javascripts/jscalendar-1.0", public_dir + "/javascripts")
| Ruby |
# Include hook code here
require 'assay_depot/calendar'
| Ruby |
require 'fileutils'
# Uninstall hook code here
public_dir = File.dirname(__FILE__) + "/../../../public"
FileUtils.rm(public_dir + "/images/calendar.png")
FileUtils.rm_rf(public_dir + "/javascripts/jscalendar-1.0")
| Ruby |
# Calendar
require "date"
module ActionView
module Helpers
module DepotDateHelper
def depot_date_select(options = {})
if(options[:id].blank?)
options[:id] = options[:name]
end
options[:ifFormat] ||= "%m/%d/%Y"
if value(object) == nil
date ... | Ruby |
class ActivePollUserAnswer < ActiveRecord::Base
belongs_to :active_poll_answer
belongs_to :xxUSER_MODELxx
end
| Ruby |
module ActivePoll
public
# Save the vote, render an answer
def ap_vote_registered
poll_name = params[:poll_name]
answer_ids = params[:active_poll_answer]
in_place = params[:in_place]
redirect = params[:redirect]
view_dir = get_view_dir(params[:view_dir])
... | Ruby |
require 'fileutils'
class ActivePollGenerator < Rails::Generator::Base
RAILS_ROOT||= File.join(File.dirname(__FILE__), '..', '..', '..')
ACTIVE_POLL_ROOT = RAILS_ROOT + '/vendor/plugins/active_poll/'
TEMPLATE_FILES = { 'user_answer_model.rb' => 'generators/active_poll/templates/user_answer_model.rb',
... | Ruby |
require 'acts_as_vote_handler'
ActionController::Base.send :include, ActivePoll::Acts::VoteHandler
ActionView::Base.send :include, ActivePollHelper
| Ruby |
module ActivePollHelper
TARGET_LOGGED_USER = 1
TARGET_ANONYMOUS = 2
TARGET_BOTH = 3
# Render the poll
def active_poll(name, opthash)
view_dir = get_view_dir(opthash[:view_dir])
cookie_name = "active_poll_#{name}"
already_cookie = cookies[cookie_name]
poll = ActivePollQuestion.find... | Ruby |
class <%= migration_name %> < ActiveRecord::Migration
def self.up
create_table :<%= questions_table_name %> do |t|
t.column "name", :string
t.column "description", :string
t.column "multiple", :boolean
t.column "max_multiple", :integer
t.column "start_date", :datetime
... | Ruby |
# I show the README file.
puts IO.read(File.join(File.dirname(__FILE__), 'README'))
# Then, I run the script to onfigure the plugin
#require File.join(File.dirname(__FILE__), 'configurate.rb')
| Ruby |
print "\n\nCreate poll script"
print "\n=================="
print "\n\nPoll name (internal, used to refer to in your views):"
poll_name = gets.chop
print "\n\nPoll is multiple option? (y/n)"
multiple_str = gets.chop
max_multiple = 1
if multiple_str.upcase == 'Y'
multiple = true
max_multiple_str = nil
... | Ruby |
require 'fileutils'
namespace :active_poll do
#remove generated files
task :remove do
template_dir = File.join(ACTIVE_POLL_ROOT, 'basic_template')
end
end
| Ruby |
require 'fileutils'
class ActivePollGenerator < Rails::Generator::Base
RAILS_ROOT||= File.join(File.dirname(__FILE__), '..', '..', '..')
ACTIVE_POLL_ROOT = RAILS_ROOT + '/vendor/plugins/active_poll/'
TEMPLATE_FILES = { 'user_answer_model.rb' => 'generators/active_poll/templates/user_answer_model.rb',
... | Ruby |
class ActivePollUserAnswer < ActiveRecord::Base
belongs_to :active_poll_answer
belongs_to :subscriber
end
| Ruby |
class ActivePollAnswer < ActiveRecord::Base
belongs_to :active_poll_question
end
| Ruby |
class ActivePollQuestion < ActiveRecord::Base
has_many :active_poll_answers
end
| Ruby |
class <%= migration_name %> < ActiveRecord::Migration
def self.up
create_table :<%= questions_table_name %> do |t|
t.column "name", :string
t.column "description", :string
t.column "multiple", :boolean
t.column "max_multiple", :integer
t.column "start_date", :datetim... | Ruby |
# Uninstall hook code here
| Ruby |
require 'rake'
require 'rake/testtask'
require 'rake/rdoctask'
desc 'Default: run unit tests.'
task :default => :test
desc 'Test the active_polls plugin.'
Rake::TestTask.new(:test) do |t|
t.libs << 'lib'
t.pattern = 'test/**/*_test.rb'
t.verbose = true
end
desc 'Generate documentation for the active_polls plug... | Ruby |
require 'fileutils'
RAILS_ROOT||= File.join(File.dirname(__FILE__), '..', '..', '..')
ACTIVE_POLL_ROOT = RAILS_ROOT + '/vendor/plugins/active_poll/'
temp_folder = 'output'
default_model = 'user'
template_folder = 'basic_template'
TEMPLATE_FILES = { 'user_answer_model.rb' => 'generators/active_poll/templates/user_ans... | Ruby |
##
## Initialize the environment
##
require File.dirname(__FILE__) + '/environment'
##
## Run the install assets script, too, just to make sure
## But at least rescue the action in production
##
begin
require File.dirname(__FILE__) + '/install_assets'
rescue
raise $! unless RAILS_ENV == 'production'
end
| Ruby |
require 'rake'
require 'rake/testtask'
require 'rake/packagetask'
require 'rake/rdoctask'
require 'find'
desc 'Default: run unit tests.'
task :default => :test
desc 'Test ActiveScaffold.'
Rake::TestTask.new(:test) do |t|
t.libs << 'lib'
t.pattern = 'test/**/*_test.rb'
t.verbose = true
end
desc 'Generate docume... | Ruby |
require 'exceptions'
##
## Check for dependencies
##
version = Rails::VERSION::STRING.split(".")
if version[0] < "1" or (version[0] == "1" and version[1] < "2")
message = <<-EOM
************************************************************************
Rails 1.2.1 or greater is required. Please remove ActiveSc... | Ruby |
# Workaround a problem with script/plugin and http-based repos.
# See http://dev.rubyonrails.org/ticket/8189
Dir.chdir(Dir.getwd.sub(/vendor.*/, '')) do
##
## Copy over asset files (javascript/css/images) from the plugin directory to public/
##
def copy_files(source_path, destination_path, directory)
sourc... | Ruby |
##
## Delete public asset files
##
require 'fileutils'
directory = File.dirname(__FILE__)
[ :stylesheets, :javascripts, :images].each do |asset_type|
path = File.join(directory, "../../../public/#{asset_type}/active_scaffold")
FileUtils.rm_r(path)
end | Ruby |
##
## Install ActiveScaffold assets into /public
##
require File.dirname(__FILE__) + '/install_assets'
##
## Install Counter
##
#
# What's going on here?
# We're incrementing a web counter so we can track SVN installs of ActiveScaffold
#
# How?
# We're making a GET request to errcount.com to up... | Ruby |
module ActiveScaffold::Config
class Core < Base
# global level configuration
# --------------------------
# provides read/write access to the global Actions DataStructure
cattr_reader :actions
def self.actions=(val)
@@actions = ActiveScaffold::DataStructures::Actions.new(*val)
end
s... | Ruby |
module ActiveScaffold::Config
class Delete < Base
self.crud_type = :destroy
def initialize(core_config)
@core = core_config
# start with the ActionLink defined globally
@link = self.class.link.clone
end
# global level configuration
# --------------------------
# the Actio... | Ruby |
module ActiveScaffold::Config
class Subform < Base
def initialize(core_config)
@core = core_config
end
# global level configuration
# --------------------------
# instance-level configuration
# ----------------------------
# provides access to the list of columns specifically mean... | Ruby |
module ActiveScaffold::Config
class Create < Form
self.crud_type = :create
def initialize(*args)
super
self.persistent = self.class.persistent
end
# global level configuration
# --------------------------
# the ActionLink for this action
def self.link
@@link
end
... | Ruby |
module ActiveScaffold::Config
class Nested < Base
self.crud_type = :read
def initialize(core_config)
@core = core_config
end
# global level configuration
# --------------------------
cattr_accessor :shallow_delete
@@shallow_delete = false
# instance-level configuration
# -... | Ruby |
module ActiveScaffold::Config
class Update < Form
self.crud_type = :update
# global level configuration
# --------------------------
# the ActionLink for this action
def self.link
@@link
end
def self.link=(val)
@@link = val
end
@@link = ActiveScaffold::DataStructures::... | Ruby |
module ActiveScaffold::Config
class FieldSearch < Base
self.crud_type = :read
def initialize(core_config)
@core = core_config
@full_text_search = self.class.full_text_search?
# start with the ActionLink defined globally
@link = self.class.link.clone
end
# global level conf... | Ruby |
module ActiveScaffold::Config
class Show < Base
self.crud_type = :read
def initialize(core_config)
@core = core_config
# start with the ActionLink defined globally
@link = self.class.link.clone
end
# global level configuration
# --------------------------
cattr_accessor :l... | Ruby |
module ActiveScaffold::Config
class List < Base
self.crud_type = :read
def initialize(core_config)
@core = core_config
# inherit from global scope
# full configuration path is: defaults => global table => local table
@per_page = self.class.per_page
# originates here
@sor... | Ruby |
module ActiveScaffold::Config
class Search < Base
self.crud_type = :read
def initialize(core_config)
@core = core_config
@full_text_search = self.class.full_text_search?
# start with the ActionLink defined globally
@link = self.class.link.clone
end
# global level configura... | Ruby |
module ActiveScaffold::Config
class Form < Base
def initialize(core_config)
@core = core_config
# start with the ActionLink defined globally
@link = self.class.link.clone
# no global setting here because multipart should only be set for specific forms
@multipart = false
end
... | Ruby |
module ActiveScaffold::Config
class Base
include ActiveScaffold::Configurable
extend ActiveScaffold::Configurable
def self.inherited(subclass)
class << subclass
# the crud type of the action. possible values are :create, :read, :update, :destroy, and nil.
# this is not a setting for... | Ruby |
module ActiveScaffold::Config
class LiveSearch < Base
self.crud_type = :read
def initialize(core_config)
@core = core_config
@full_text_search = self.class.full_text_search?
# start with the ActionLink defined globally
@link = self.class.link.clone
end
# global level confi... | Ruby |
# save and validation support for associations.
class ActiveRecord::Base
def associated_valid?
# using [].all? syntax to avoid a short-circuit
with_unsaved_associated { |a| [a.valid?, a.associated_valid?].all? {|v| v == true} }
end
def save_associated
with_unsaved_associated { |a| a.save and a.save_a... | Ruby |
# The view_paths functionality in Edge Rails (Rails 2.0) doesn't support
# the idea of a fallback generic template file, such as what make ActiveScaffold
# work. This patch adds generic_view_paths, which are folders containing templates
# that may apply to all controllers.
#
# There is one major difference with generic... | Ruby |
class Object
def as_(string_to_localize, *args)
args.empty? ? string_to_localize : (sprintf string_to_localize, *args)
end
end
| Ruby |
module ActionView
module Helpers
class InstanceTag
# patch an issue with integer size parameters
def to_text_area_tag(options = {})
options = DEFAULT_TEXT_AREA_OPTIONS.merge(options.stringify_keys)
add_default_name_and_id(options)
if size = options.delete("size")
opt... | Ruby |
class ActionController::Routing::RouteSet
def generate_with_nil_id_awareness(*args)
args[0].delete(:id) if args[0][:id].nil?
generate_without_nil_id_awareness(*args)
end
alias_method_chain :generate, :nil_id_awareness
end | Ruby |
##
## Add MIME type for JSON (backwards compat)
##
unless Mime.const_defined?(:JSON)
# Rails 1.1 Method
# Register a new Mime::Type
Mime::JSON = Mime::Type.new 'application/json', :json, %w( text/json )
Mime::LOOKUP["application/json"] = Mime::JSON
Mime::LOOKUP["text/json"] = Mime::JSON
# Its default handl... | Ruby |
# wrap the action rendering for ActiveScaffold controllers
module ActionController #:nodoc:
class Base
def render_with_active_scaffold(*args, &block)
if self.class.uses_active_scaffold? and params[:adapter] and @rendering_adapter.nil?
@rendering_adapter = true # recursion control
# if we nee... | Ruby |
class Array
# returns the value after the given value. wraps around. defaults to first element in array.
def after(value)
return nil unless include? value
self[(index(value).to_i + 1) % length]
end
end | Ruby |
# the ever-useful to_label method
class ActiveRecord::Base
def to_label
[:name, :label, :title, :to_s].each do |attribute|
return send(attribute) if respond_to?(attribute) and send(attribute).is_a?(String)
end
end
end
| Ruby |
module ActionController
module Resources
class Resource
ACTIVE_SCAFFOLD_ROUTING = {
:collection => {:show_search => :get, :update_table => :get, :edit_associated => :get, :list => :get, :new_existing => :get},
:member => {:row => :get, :nested => :get, :edit_associated => :get, :add_associat... | Ruby |
# wrap the action rendering for ActiveScaffold views
module ActionView #:nodoc:
class Base
# Adds two rendering options.
#
# ==render :super
#
# This syntax skips all template overrides and goes directly to the provided ActiveScaffold templates.
# Useful if you want to wrap an existing templat... | Ruby |
# a simple (manual) unsaved? flag and method. at least it automatically reverts after a save!
class ActiveRecord::Base
# acts like a dirty? flag, manually thrown during update_record_from_params.
def unsaved=(val)
@unsaved = (val) ? true : false
end
# whether the unsaved? flag has been thrown
def unsaved... | Ruby |
module ActiveRecord
class Errors
# uses config.columns[attr].label instead of attr.humanize, for improved consistency in form feedback.
# also passes strings through as_(), since it's handy.
def as_full_messages(config)
@as_config = config
full_messages = []
@errors.each_key do |attr|
... | Ruby |
module ActionController #:nodoc:
module Components
module InstanceMethods
# Extracts the action_name from the request parameters and performs that action.
private
# This is to fix a bug in Rails. 1.2.2 was calling klass.controller_name instead of klass.controller_path, which was in turn settin... | Ruby |
# Apply patch (http://dev.rubyonrails.org/changeset/6343) that is already in edge, soon to be 1.2.4
# Allow array and hash query parameters. Array route parameters are converted/to/a/path as before. #6765, #7047, #7462 [bgipsy, Jeremy McAnally, Dan Kubb, brendan]
module ActionController
module Routing
class Rout... | Ruby |
module ActiveRecord
module Reflection
class AssociationReflection #:nodoc:
def reverse_for?(klass)
reverse_matches_for(klass).empty? ? false : true
end
attr_writer :reverse
def reverse
unless @reverse
reverse_matches = reverse_matches_for(self.class_nam... | Ruby |
require 'forwardable'
class Paginator
VERSION = '1.0.9'
class ArgumentError < ::ArgumentError; end
class MissingCountError < ArgumentError; end
class MissingSelectError < ArgumentError; end
attr_reader :per_page, :count
# Instantiate a new Paginator object
#
# Provide:
# * A total count ... | Ruby |
# Matt Mower <matt@cominded.com>
#
# A base class for creating DHTML confirmation types.
#
# The real work is done by the onclick_function and onclick_handler methods. In
# general it should only be required to override the default onclick_handler
# method and provide the specific Javascript required to invoke the DHT... | Ruby |
module ActiveScaffold
def self.included(base)
base.extend(ClassMethods)
base.module_eval do
# TODO: these should be in actions/core
before_filter :handle_user_settings
end
end
def self.set_defaults(&block)
ActiveScaffold::Config::Core.configure &block
end
def active_... | Ruby |
module ActionView
module Helpers
module FormOptionsHelper
# Return a full select and option tags for the given object and method, using usa_state_options_for_select to generate the list of option <tags>.
def usa_state_select(object, method, priority_states = nil, options = {}, html_options = {})
... | Ruby |
module ActiveScaffold
module Helpers
# A bunch of helper methods to produce the common view ids
module Ids
def controller_id
@controller_id ||= (params[:parent_controller] || params[:controller]).gsub("/", "__")
end
def active_scaffold_id
"#{controller_id}-active-sc... | Ruby |
module ActiveScaffold
module Helpers
# Helpers that assist with the rendering of a Form Column
module FormColumns
# This method decides which input to use for the given column.
# It does not do any rendering. It only decides which method is responsible for rendering.
def active_scaffold_inpu... | Ruby |
module ActiveScaffold
module Helpers
module Associations
# Provides a way to honor the :conditions on an association while searching the association's klass
def association_options_find(association, conditions = nil)
association.klass.find(:all, :conditions => controller.send(:merge_conditions... | Ruby |
module ActiveScaffold
module Helpers
# All extra helpers that should be included in the View.
# Also a dumping ground for uncategorized helpers.
module ViewHelpers
include ActiveScaffold::Helpers::Ids
include ActiveScaffold::Helpers::Associations
include ActiveScaffold::Helpers::P... | Ruby |
module ActiveScaffold
module Helpers
module ControllerHelpers
include ActiveScaffold::Helpers::Ids
end
end
end | Ruby |
module ActiveScaffold
module Helpers
module Pagination
def pagination_ajax_link(page_number, params)
page_link = link_to_remote(page_number,
{ :url => params.merge(:page => page_number),
:after => "$('#{loading_indicator_id(:action => :pagination)}').style.visib... | Ruby |
module ActiveScaffold
module Helpers
# Helpers that assist with the rendering of a List Column
module ListColumns
def get_column_value(record, column)
# check for an override helper
value = if column_override? column
# we only pass the record as the argument. we previously also... | Ruby |
module ActiveScaffold
module Constraints
def self.included(base)
base.module_eval do
before_filter :register_constraints_with_action_columns
end
end
protected
# Returns the current constraints
def active_scaffold_constraints
return active_scaffold_session_storage[:const... | Ruby |
module ActiveScaffold
# Provides support for param hashes assumed to be model attributes.
# Support is primarily needed for creating/editing associated records using a nested hash structure.
#
# Paradigm Params Hash (should write unit tests on this):
# params[:record] = {
# # a simple record attribute... | Ruby |
module ActiveScaffold::Actions
module Core
def self.included(base)
base.class_eval do
after_filter :clear_flashes
end
end
protected
def authorized_for?(*args)
active_scaffold_config.model.authorized_for?(*args)
end
def clear_flashes
if request.xhr?
fl... | Ruby |
module ActiveScaffold::Actions
module Delete
def self.included(base)
base.before_filter :delete_authorized?, :only => [:delete, :destroy]
end
# this method is for html mode. it provides "the missing action" (http://thelucid.com/articles/2006/07/26/simply-restful-the-missing-action).
# it also g... | Ruby |
module ActiveScaffold::Actions
module Subform
def edit_associated
@parent_record = params[:id].nil? ? active_scaffold_config.model.new : find_if_allowed(params[:id], :update)
@column = active_scaffold_config.columns[params[:association]]
# NOTE: we don't check whether the user is allowed to upd... | Ruby |
module ActiveScaffold::Actions
module Create
def self.included(base)
base.before_filter :create_authorized?, :only => [:new, :create]
base.verify :method => :post,
:only => :create,
:redirect_to => { :action => :index }
end
def new
do_new
respo... | Ruby |
module ActiveScaffold::Actions
# The Nested module basically handles automatically linking controllers together. It does this by creating column links with the right parameters, and by providing any supporting systems (like a /:controller/nested action for returning associated scaffolds).
module Nested
def... | Ruby |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.