hobo 1.3.0.pre26 → 1.3.0.pre27

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.3.0.pre26
1
+ 1.3.0.pre27
@@ -113,7 +113,7 @@ NOTE: You might want to sign up as the administrator before adding this!
113
113
  end
114
114
  inject_into_file 'app/controllers/application_controller.rb', <<EOI, :after => "protect_from_forgery\n" if private_site
115
115
  include Hobo::Controller::AuthenticationSupport
116
- before_filter :except => [:login, :forgot_password] do
116
+ before_filter :except => [:login, :forgot_password, :accept_invitation, :do_accept_invitation] do
117
117
  login_required unless #{@user_resource_name.camelize}.count == 0
118
118
  end
119
119
  EOI
@@ -63,7 +63,7 @@ private
63
63
  block = "\n config.generators do |g|"
64
64
  block << "\n g.test_framework :#{n}, :fixtures => #{options[:fixtures].inspect}" if !options[:fixtures] || name != 'test_unit'
65
65
  block << "\n g.fallbacks[:#{n}] = :test_unit" unless name == 'test_unit'
66
- block << "\n g.fixture_replacement => :#{options[:fixture_replacement]}" unless options[:fixture_replacement].blank?
66
+ block << "\n g.fixture_replacement = :#{options[:fixture_replacement]}" unless options[:fixture_replacement].blank?
67
67
  block << "\n end\n"
68
68
  environment block
69
69
  end
@@ -27,7 +27,7 @@ module Hobo
27
27
  end
28
28
  before_filter :set_mailer_default_url_options
29
29
  @included_taglibs = []
30
- rescue_from ActionController::RoutingError, :with => :not_found
30
+ rescue_from ActionController::RoutingError, :with => :not_found unless Rails.env.development?
31
31
  end
32
32
  Hobo::Helper.add_to_controller(klass)
33
33
  end
@@ -77,7 +77,7 @@ module Hobo
77
77
  renderer = Dryml.page_renderer(view_context, identifier, [], controller)
78
78
 
79
79
  render :update do |page|
80
- page << options[:preamble] || "var _update = typeof Hobo == 'undefined' ? Element.update : Hobo.updateElement;"
80
+ page << (options[:preamble] || "var _update = typeof Hobo == 'undefined' ? Element.update : Hobo.updateElement;")
81
81
  for spec in render_specs
82
82
  function = spec[:function] || "_update"
83
83
  dom_id = spec[:id]
@@ -27,7 +27,7 @@ module Hobo
27
27
  helper_method :model, :current_user
28
28
  before_filter :set_no_cache_headers
29
29
 
30
- rescue_from ActiveRecord::RecordNotFound, :with => :not_found
30
+ rescue_from ActiveRecord::RecordNotFound, :with => :not_found unless Rails.env.development?
31
31
 
32
32
  rescue_from Hobo::PermissionDeniedError, :with => :permission_denied
33
33
  rescue_from Hobo::Model::Lifecycles::LifecycleKeyError, :with => :permission_denied
@@ -33,11 +33,15 @@ module Hobo
33
33
  require 'hobo/extensions/active_record/relation_with_origin'
34
34
  require 'hobo/extensions/active_model/name'
35
35
  require 'hobo/extensions/active_model/translation'
36
+ # added legacy namespace for backward compatibility
37
+ # TODO: remove the following line if Hobo::VERSION > 1.3.x
38
+ Hobo::ViewHints = Hobo::Model::ViewHints
36
39
  end
37
40
 
38
41
  ActiveSupport.on_load(:action_view) do
39
42
  require 'hobo/extensions/action_view/tag_helper'
40
43
  require 'hobo/extensions/action_view/translation_helper'
44
+ include Hobo::Helper::Translations::Normalizer
41
45
  end
42
46
 
43
47
  ActiveSupport.on_load(:before_initialize) do
@@ -1,7 +1,5 @@
1
1
  ActionView::Helpers::TranslationHelper.module_eval do
2
2
 
3
- include Hobo::Helper::Translations::Normalizer
4
-
5
3
  # simple wrapper around the translate helper
6
4
  # it implements a dryml <translate> and a <t> tag
7
5
  # Improved security: interpolated variables are escaped
@@ -127,7 +127,7 @@ module Hobo
127
127
 
128
128
 
129
129
  def recognize_page_path
130
- Rails.application.routes.recognize_path(params[:page_path])
130
+ Rails.application.routes.recognize_path(params[:page_path]||request.fullpath)
131
131
  end
132
132
 
133
133
  def url_for_page_path(options={})
@@ -34,7 +34,7 @@ module Hobo
34
34
 
35
35
  module_eval "class ::#{name}::LifecycleStateField < HoboFields::Types::LifecycleState; end"
36
36
  state_field_class = self::LifecycleStateField
37
- state_field_class.table_name = name.tableize
37
+ state_field_class.model_name = name
38
38
  end
39
39
 
40
40
  dsl = Hobo::Model::Lifecycles::DeclarationDSL.new(lifecycle)
@@ -2,62 +2,82 @@ module Hobo
2
2
  module Model
3
3
  class ViewHints
4
4
 
5
- def self.setter(name, default=nil, &block)
6
- ivname = name.to_s.remove(/\?$/)
7
- metaclass.send :define_method, name do |*args|
8
- if args.empty?
9
- val = instance_variable_get("@#{ivname}")
10
- if val.nil?
11
- val = default.is_a?(Proc) ? instance_eval(&default) : default
12
- instance_variable_set("@#{ivname}", val)
5
+ class << self
6
+
7
+ # allows delayed set of children in order to avoid circular references
8
+ # triggered by declaring children in the model
9
+ def children(*args)
10
+ if args.empty? # reader
11
+ if @children_args.nil? # value already set
12
+ @children ||= []
13
+ else # set
14
+ child_model = model.reflect_on_association(@children_args.first).klass
15
+ if child_model.view_hints.parent.nil? and !child_model.view_hints.parent_defined
16
+ parent = model.reverse_reflection(@children_args.first)
17
+ child_model.view_hints.parent(parent.name, :undefined => true) if parent
18
+ end
19
+ @children = @children_args
20
+ @children_args = nil
21
+ @children
13
22
  end
14
- val
15
- else
16
- arg = if block
17
- instance_exec(*args, &block)
18
- else
19
- args.first
20
- end
21
- instance_variable_set("@#{ivname}", arg)
23
+ else # writer (only stores the args for delayed setting)
24
+ @children_args = args
22
25
  end
23
26
  end
24
- end
25
27
 
26
- setter :children, [] do |*args|
27
- # Setting children also gives a default parent using the reverse association
28
- child_model = model.reflect_on_association(args.first).klass
29
- if child_model.view_hints.parent.nil? and !child_model.view_hints.parent_defined
30
- parent = model.reverse_reflection(args.first)
31
- child_model.view_hints.parent(parent.name, :undefined => true) if parent
28
+ def inline_booleans(*args)
29
+ if args.empty? # reader
30
+ if @inline_booleans_args.nil?
31
+ @inline_booleans ||= []
32
+ else
33
+ @inline_booleans = if @inline_booleans_args.first == true
34
+ model.columns.select { |c| c.type == :boolean }.*.name
35
+ else
36
+ @inline_booleans_args.*.to_s
37
+ end
38
+ @inline_booleans_args = nil
39
+ @inline_booleans
40
+ end
41
+ else # writer
42
+ @inline_booleans_args = args
43
+ end
32
44
  end
33
- args
34
- end
35
-
36
- setter :parent, nil do |*args|
37
- options = args.extract_options!
38
- parent_defined(true) unless options[:undefined]
39
- args.first
40
- end
41
45
 
42
- setter :parent_defined, nil
43
-
44
- setter :paginate?, proc { !sortable? }
45
-
46
- setter :sortable?, proc { defined?(ActiveRecord::Acts::List::InstanceMethods) &&
47
- model < ActiveRecord::Acts::List::InstanceMethods &&
48
- model.new.try.scope_condition == "1 = 1" }
46
+ def parent(*args)
47
+ if args.empty? #reader
48
+ @parent
49
+ else # writer
50
+ options = args.extract_options!
51
+ parent_defined(true) unless options[:undefined]
52
+ @parent = args.first
53
+ end
54
+ end
49
55
 
50
- setter :inline_booleans, [] do |*args|
51
- if args[0] == true
52
- model.columns.select { |c| c.type == :boolean }.*.name
53
- else
54
- args.*.to_s
55
- end
56
- end
56
+ def parent_defined(arg=nil)
57
+ if arg.nil?
58
+ @parent_defined
59
+ else
60
+ @parent_defined = arg
61
+ end
62
+ end
57
63
 
58
- # Accessors
64
+ def paginate?(arg=nil)
65
+ if arg.nil?
66
+ @paginate ||= !sortable?
67
+ else
68
+ @paginate = arg
69
+ end
70
+ end
59
71
 
60
- class << self
72
+ def sortable?(arg=nil)
73
+ if arg.nil?
74
+ @sortable ||= defined?(ActiveRecord::Acts::List::InstanceMethods) &&
75
+ model < ActiveRecord::Acts::List::InstanceMethods &&
76
+ model.new.try.scope_condition == "1 = 1"
77
+ else
78
+ @sortable = arg
79
+ end
80
+ end
61
81
 
62
82
  def _name
63
83
  @_name ||= name.sub(/Hints$/, '')
@@ -37,7 +37,7 @@ model_key = model.to_s.underscore
37
37
  <input type="hidden" name="key" value="&this.lifecycle.provided_key" if="&this.lifecycle.provided_key"/>
38
38
  <field-list fields="<%= transition.parameters * ', ' %>" param/>
39
39
  <div param="actions">
40
- <submit label="#{ht '<%= model_key %>.actions.<%= transition.name.to_s %>', :default=>['<%= transition.name.to_s.titleize %>']}" param/><or-cancel param="cancel"/>
40
+ <submit label="#{t 'activerecord.attributes.<%= model_key %>.lifecycle.transitions.<%= transition.name.to_s %>', :default=>['<%= transition.name.to_s.titleize %>']}" param/><or-cancel param="cancel"/>
41
41
  </div>
42
42
  </form>
43
43
  </def>
@@ -104,7 +104,7 @@ The easiest way to see what this tag does is to look at the source.
104
104
 
105
105
  -->
106
106
  <def tag="not-found-page" attrs="message">
107
- <% message ||= "The page you were looking for could not be found" %>
107
+ <% message ||= t("hobo.messages.not_found", :default=>["The page you requested cannot be found."]) %>
108
108
  <page merge>
109
109
  <body: class="not-found"/>
110
110
  <content: param>
metadata CHANGED
@@ -1,14 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hobo
3
3
  version: !ruby/object:Gem::Version
4
- hash: -1637108448
5
- prerelease: true
6
- segments:
7
- - 1
8
- - 3
9
- - 0
10
- - pre26
11
- version: 1.3.0.pre26
4
+ prerelease: 6
5
+ version: 1.3.0.pre27
12
6
  platform: ruby
13
7
  authors:
14
8
  - Tom Locke
@@ -16,7 +10,7 @@ autorequire:
16
10
  bindir: bin
17
11
  cert_chain: []
18
12
 
19
- date: 2011-01-22 00:00:00 -04:00
13
+ date: 2011-02-22 00:00:00 -04:00
20
14
  default_executable:
21
15
  dependencies:
22
16
  - !ruby/object:Gem::Dependency
@@ -27,11 +21,6 @@ dependencies:
27
21
  requirements:
28
22
  - - ">="
29
23
  - !ruby/object:Gem::Version
30
- hash: 7
31
- segments:
32
- - 3
33
- - 0
34
- - 0
35
24
  version: 3.0.0
36
25
  type: :runtime
37
26
  version_requirements: *id001
@@ -43,11 +32,6 @@ dependencies:
43
32
  requirements:
44
33
  - - ">="
45
34
  - !ruby/object:Gem::Version
46
- hash: 961915916
47
- segments:
48
- - 3
49
- - 0
50
- - pre
51
35
  version: 3.0.pre
52
36
  type: :runtime
53
37
  version_requirements: *id002
@@ -59,13 +43,7 @@ dependencies:
59
43
  requirements:
60
44
  - - "="
61
45
  - !ruby/object:Gem::Version
62
- hash: -1637108448
63
- segments:
64
- - 1
65
- - 3
66
- - 0
67
- - pre26
68
- version: 1.3.0.pre26
46
+ version: 1.3.0.pre27
69
47
  type: :runtime
70
48
  version_requirements: *id003
71
49
  - !ruby/object:Gem::Dependency
@@ -76,13 +54,7 @@ dependencies:
76
54
  requirements:
77
55
  - - "="
78
56
  - !ruby/object:Gem::Version
79
- hash: -1637108448
80
- segments:
81
- - 1
82
- - 3
83
- - 0
84
- - pre26
85
- version: 1.3.0.pre26
57
+ version: 1.3.0.pre27
86
58
  type: :runtime
87
59
  version_requirements: *id004
88
60
  - !ruby/object:Gem::Dependency
@@ -93,13 +65,7 @@ dependencies:
93
65
  requirements:
94
66
  - - "="
95
67
  - !ruby/object:Gem::Version
96
- hash: -1637108448
97
- segments:
98
- - 1
99
- - 3
100
- - 0
101
- - pre26
102
- version: 1.3.0.pre26
68
+ version: 1.3.0.pre27
103
69
  type: :runtime
104
70
  version_requirements: *id005
105
71
  - !ruby/object:Gem::Dependency
@@ -110,9 +76,6 @@ dependencies:
110
76
  requirements:
111
77
  - - ">="
112
78
  - !ruby/object:Gem::Version
113
- hash: 3
114
- segments:
115
- - 0
116
79
  version: "0"
117
80
  type: :development
118
81
  version_requirements: *id006
@@ -124,9 +87,6 @@ dependencies:
124
87
  requirements:
125
88
  - - ">="
126
89
  - !ruby/object:Gem::Version
127
- hash: 3
128
- segments:
129
- - 0
130
90
  version: "0"
131
91
  type: :development
132
92
  version_requirements: *id007
@@ -138,11 +98,6 @@ dependencies:
138
98
  requirements:
139
99
  - - ">="
140
100
  - !ruby/object:Gem::Version
141
- hash: 9
142
- segments:
143
- - 0
144
- - 7
145
- - 5
146
101
  version: 0.7.5
147
102
  type: :development
148
103
  version_requirements: *id008
@@ -365,25 +320,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
365
320
  requirements:
366
321
  - - ">="
367
322
  - !ruby/object:Gem::Version
368
- hash: 3
369
- segments:
370
- - 0
371
323
  version: "0"
372
324
  required_rubygems_version: !ruby/object:Gem::Requirement
373
325
  none: false
374
326
  requirements:
375
327
  - - ">="
376
328
  - !ruby/object:Gem::Version
377
- hash: 23
378
- segments:
379
- - 1
380
- - 3
381
- - 6
382
329
  version: 1.3.6
383
330
  requirements: []
384
331
 
385
332
  rubyforge_project: hobo
386
- rubygems_version: 1.3.7
333
+ rubygems_version: 1.5.0
387
334
  signing_key:
388
335
  specification_version: 3
389
336
  summary: The web app builder for Rails