active_scaffold 3.0.0 → 3.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,11 @@
1
+ = 3.0.1
2
+
3
+ - Fixing the requiring of files.
4
+
5
+ = 3.0.0
6
+
7
+ - Packaging up vhochstein's fork for Rails 3.0 as a gem.
8
+
1
9
  = 1.2RC1
2
10
 
3
11
  == FEATURES
data/README CHANGED
@@ -29,16 +29,22 @@ Rails < 2.1: Active Scaffold 1-1-stable (no guarantees)
29
29
  Since Rails 2.3, render_component plugin is needed for nested and embbeded scaffolds. It works with rails-2.3 branch from ewildgoose repository:
30
30
  script/plugin install git://github.com/ewildgoose/render_component.git -r rails-2.3
31
31
 
32
- Rails 3.0 compatible fork of activesaffold by Volker Hochstein:
32
+ == Rails 3.0 compatible fork of activesaffold by Volker Hochstein:
33
33
 
34
- Since Rails 3.0 render_component is nt used for nesting, but optional for embedded scaffolds
35
- Rails 3.0 version of render_component:
36
- rails plugin install git://github.com/vhochstein/render_component.git
34
+ Since Rails 3.0 render_component is not used for nesting, but is optional for embedded scaffolds.
35
+ Since Rails 3.0, https://github.com/rails/verification.git is also needed.
37
36
 
38
- Since Rails 3.0, the following is needed:
39
- rails plugin install git://github.com/rails/verification.git
37
+ If you want to install as plugins under vendor/plugins, install these versions:
38
+ rails plugin install git://github.com/vhochstein/render_component.git
39
+ rails plugin install git://github.com/rails/verification.git
40
+ rails plugin install git://github.com/vhochstein/active_scaffold.git
40
41
 
41
- Fork uses unobtrusive Javascript, so you are basically free to pick your javascript framework
42
+ If you want to use the gem, add to your Gemfile:
43
+ gem "active_scaffold"
44
+
45
+ == Pick your own javascript framework
46
+
47
+ The Rails 3.0 version uses unobtrusive Javascript, so you are free to pick your javascript framework.
42
48
  Out of the box Prototype or JQuery are supported:
43
49
 
44
50
  Prototype 1.7 (default js framework)
@@ -46,6 +52,12 @@ rails.js in git://github.com/vhochstein/prototype-ujs.git
46
52
 
47
53
  JQuery 1.4.1
48
54
  rails.js in git://github.com/vhochstein/jquery-ujs.git
49
- uncomment last line in ...plugins/active_scaffold/environment.rb in order tu use jquery instead of prototype
55
+
56
+ To configure the javascript framework when installed under vendor/plugins/
57
+ uncomment last line in ...plugins/active_scaffold/environment.rb in order to use jquery instead of prototype
58
+
59
+ To configure the javascript framework when installed as a gem:
60
+ Add a config/initializers/active_scaffold.rb containing:
61
+ ActiveScaffold.js_framework = :jquery # :prototype is the default
50
62
 
51
63
  Released under the MIT license (included)
@@ -2,7 +2,7 @@ $:.push File.expand_path("../lib", __FILE__)
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "active_scaffold"
5
- s.version = "3.0.0"
5
+ s.version = "3.0.1"
6
6
  s.platform = Gem::Platform::RUBY
7
7
  s.authors = ["Many, see README"]
8
8
  s.email = ["activescaffold@googlegroups.com"]
@@ -3,39 +3,39 @@ module ActiveScaffold
3
3
  def self.bridge(name, &block)
4
4
  ActiveScaffold::Bridges::Bridge.new(name, &block)
5
5
  end
6
-
6
+
7
7
  class Bridge
8
8
  attr_accessor :name
9
9
  cattr_accessor :bridges
10
10
  cattr_accessor :bridges_run
11
11
  self.bridges = []
12
-
12
+
13
13
  def initialize(name, &block)
14
14
  self.name = name
15
15
  @install = nil
16
16
  # by convention and default, use the bridge name as the required constant for installation
17
17
  @install_if = lambda { Object.const_defined?(name) }
18
18
  self.instance_eval(&block)
19
-
19
+
20
20
  ActiveScaffold::Bridges::Bridge.bridges << self
21
21
  end
22
-
22
+
23
23
  # Set the install block
24
24
  def install(&block)
25
25
  @install = block
26
26
  end
27
-
27
+
28
28
  # Set the install_if block (to check to see whether or not to install the block)
29
29
  def install?(&block)
30
30
  @install_if = block
31
31
  end
32
-
33
-
32
+
33
+
34
34
  def run
35
35
  raise(ArgumentError, "install and install? not defined for bridge #{name}" ) unless @install && @install_if
36
36
  @install.call if @install_if.call
37
37
  end
38
-
38
+
39
39
  def self.run_all
40
40
  return false if self.bridges_run
41
41
  ActiveScaffold::Bridges::Bridge.bridges.each{|bridge|
@@ -47,6 +47,7 @@ module ActiveScaffold
47
47
  end
48
48
  end
49
49
 
50
+ require "#{File.dirname(__FILE__)}/shared/date_bridge"
50
51
  Dir[File.join(File.dirname(__FILE__), "*/bridge.rb")].each{|bridge_require|
51
52
  require bridge_require
52
- }
53
+ }
@@ -2,14 +2,14 @@ ActiveScaffold::Bridges.bridge "CalendarDateSelect" do
2
2
  install do
3
3
  # check to see if the old bridge was installed. If so, warn them
4
4
  # we can detect this by checking to see if the bridge was installed before calling this code
5
-
5
+
6
6
  if ActiveScaffold::Config::Core.instance_methods.include?("initialize_with_calendar_date_select")
7
7
  raise RuntimeError, "We've detected that you have active_scaffold_calendar_date_select_bridge installed. This plugin has been moved to core. Please remove active_scaffold_calendar_date_select_bridge to prevent any conflicts"
8
8
  end
9
-
9
+
10
10
  require File.join(File.dirname(__FILE__), "lib/as_cds_bridge.rb")
11
11
  end
12
-
12
+
13
13
  install? do
14
14
  Object.const_defined?(name) && ActiveScaffold.js_framework == :prototype
15
15
  end
@@ -2,6 +2,8 @@ ActiveScaffold::Bridges.bridge "CarrierWave" do
2
2
  install do
3
3
  require File.join(File.dirname(__FILE__), "lib/form_ui")
4
4
  require File.join(File.dirname(__FILE__), "lib/list_ui")
5
+ require File.join(File.dirname(__FILE__), "lib/carrierwave_bridge")
6
+ require File.join(File.dirname(__FILE__), "lib/carrierwave_bridge_helpers")
5
7
  ActiveScaffold::Config::Core.send :include, ActiveScaffold::Bridges::Carrierwave::Lib::CarrierwaveBridge
6
8
  end
7
- end
9
+ end
@@ -15,7 +15,7 @@ ActiveScaffold::Bridges.bridge "DatePicker" do
15
15
  FileUtils.rm(File.join(destination, 'date_picker_bridge.js')) if File.exist?(File.join(destination, 'date_picker_bridge.js'))
16
16
  end
17
17
  end
18
-
18
+
19
19
  install? do
20
20
  true
21
21
  end
@@ -14,26 +14,26 @@ module ActiveScaffold
14
14
  tags << active_scaffold_search_date_bridge_range_tag(column, options, current_search)
15
15
  tags.join("&nbsp;").html_safe
16
16
  end
17
-
17
+
18
18
  def active_scaffold_search_date_bridge_comparator_options(column)
19
19
  select_options = ActiveScaffold::Finder::DateComparators.collect {|comp| [as_(comp.downcase.to_sym), comp]}
20
20
  select_options + ActiveScaffold::Finder::NumericComparators.collect {|comp| [as_(comp.downcase.to_sym), comp]}
21
21
  end
22
-
22
+
23
23
  def active_scaffold_search_date_bridge_comparator_tag(column, options, current_search)
24
24
  select_tag("#{options[:name]}[opt]", options_for_select(active_scaffold_search_date_bridge_comparator_options(column),current_search['opt']), :id => "#{options[:id]}_opt", :class => "as_search_range_option as_search_date_time_option")
25
25
  end
26
-
26
+
27
27
  def active_scaffold_search_date_bridge_numeric_tag(column, options, current_search)
28
- numeric_controls = "" <<
28
+ numeric_controls = "" <<
29
29
  active_scaffold_search_date_bridge_calendar_control(column, options, current_search, 'from') <<
30
30
  content_tag(:span, (" - " + active_scaffold_search_date_bridge_calendar_control(column, options, current_search, 'to')).html_safe,
31
- :id => "#{options[:id]}_between", :class => "as_search_range_between", :style => "display:#{current_search['opt'] == 'BETWEEN' ? '' : 'none'}")
31
+ :id => "#{options[:id]}_between", :class => "as_search_range_between", :style => "display:#{current_search['opt'] == 'BETWEEN' ? '' : 'none'}")
32
32
  content_tag("span", numeric_controls.html_safe, :id => "#{options[:id]}_numeric", :style => "display:#{ActiveScaffold::Finder::NumericComparators.include?(current_search['opt']) ? '' : 'none'}")
33
33
  end
34
-
34
+
35
35
  def active_scaffold_search_date_bridge_trend_tag(column, options, current_search)
36
- active_scaffold_date_bridge_trend_tag(column, options,
36
+ active_scaffold_date_bridge_trend_tag(column, options,
37
37
  {:name_prefix => 'search',
38
38
  :number_value => current_search['number'],
39
39
  :unit_value => current_search["unit"],
@@ -53,14 +53,14 @@ module ActiveScaffold
53
53
  options = ActiveScaffold::Finder::TimeUnits.collect{|unit| [as_(unit.downcase.to_sym), unit]} + options if column_datetime?(column)
54
54
  options
55
55
  end
56
-
56
+
57
57
  def active_scaffold_search_date_bridge_range_tag(column, options, current_search)
58
- range_controls = select_tag("search[#{column.name}][range]",
59
- options_for_select( ActiveScaffold::Finder::DateRanges.collect{|range| [as_(range.downcase.to_sym), range]}, current_search["range"]),
58
+ range_controls = select_tag("search[#{column.name}][range]",
59
+ options_for_select( ActiveScaffold::Finder::DateRanges.collect{|range| [as_(range.downcase.to_sym), range]}, current_search["range"]),
60
60
  :class => 'text-input')
61
61
  content_tag("span", range_controls.html_safe, :id => "#{options[:id]}_range", :style => "display:#{(current_search['opt'] == 'RANGE') ? '' : 'none'}")
62
62
  end
63
-
63
+
64
64
  def column_datetime?(column)
65
65
  (!column.column.nil? && [:datetime, :time].include?(column.column.type))
66
66
  end
@@ -79,24 +79,24 @@ module ActiveScaffold
79
79
  end
80
80
  end
81
81
  end
82
-
82
+
83
83
  module Finder
84
84
  module ClassMethods
85
85
  def condition_for_date_bridge_type(column, value, like_pattern)
86
86
  operator = ActiveScaffold::Finder::NumericComparators.include?(value[:opt]) && value[:opt] != 'BETWEEN' ? value[:opt] : nil
87
87
  from_value, to_value = date_bridge_from_to(column, value)
88
-
88
+
89
89
  if column.search_sql.is_a? Proc
90
90
  column.search_sql.call(from_value, to_value, operator)
91
91
  else
92
92
  unless operator.nil?
93
93
  ["#{column.search_sql} #{value[:opt]} ?", from_value.to_s(:db)] unless from_value.nil?
94
94
  else
95
- ["#{column.search_sql} BETWEEN ? AND ?", from_value.to_s(:db), to_value.to_s(:db)] unless from_value.nil? && to_value.nil?
95
+ ["#{column.search_sql} BETWEEN ? AND ?", from_value.to_s(:db), to_value.to_s(:db)] unless from_value.nil? && to_value.nil?
96
96
  end
97
97
  end
98
98
  end
99
-
99
+
100
100
  def date_bridge_from_to(column, value)
101
101
  conversion = column.column.type == :date ? :to_date : :to_time
102
102
  case value[:opt]
@@ -108,7 +108,7 @@ module ActiveScaffold
108
108
  ['from', 'to'].collect { |field| condition_value_for_datetime(value[field], conversion)}
109
109
  end
110
110
  end
111
-
111
+
112
112
  def date_bridge_from_to_for_trend(column, value)
113
113
  case value['opt']
114
114
  when "PAST"
@@ -135,7 +135,7 @@ module ActiveScaffold
135
135
  return from, to
136
136
  end
137
137
  end
138
-
138
+
139
139
  def date_bridge_from_to_for_range(column, value)
140
140
  case value[:range]
141
141
  when 'TODAY'
@@ -155,7 +155,7 @@ module ActiveScaffold
155
155
  when 'next'
156
156
  return Time.zone.now.in(1.send(range.to_sym)).send("beginning_of_#{range}".to_sym), Time.zone.now.in(1.send(range.to_sym)).send("end_of_#{range}".to_sym)
157
157
  else
158
- return nil, nil
158
+ return nil, nil
159
159
  end
160
160
  end
161
161
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_scaffold
3
3
  version: !ruby/object:Gem::Version
4
- hash: 7
4
+ hash: 5
5
5
  prerelease: false
6
6
  segments:
7
7
  - 3
8
8
  - 0
9
- - 0
10
- version: 3.0.0
9
+ - 1
10
+ version: 3.0.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Many, see README
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-11-16 00:00:00 -05:00
18
+ date: 2010-11-17 00:00:00 -05:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency