hobo 0.8 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGES.txt +56 -0
- data/Manifest +2 -0
- data/Rakefile +116 -0
- data/dryml_generators/rapid/forms.dryml.erb +6 -4
- data/dryml_generators/rapid/pages.dryml.erb +9 -7
- data/hobo.gemspec +316 -162
- data/lib/hobo/controller.rb +14 -1
- data/lib/hobo/hobo_helper.rb +2 -2
- data/lib/hobo/lifecycles/actions.rb +1 -0
- data/lib/hobo/lifecycles/creator.rb +3 -2
- data/lib/hobo/lifecycles/lifecycle.rb +10 -5
- data/lib/hobo/lifecycles/transition.rb +3 -2
- data/lib/hobo/lifecycles.rb +1 -1
- data/lib/hobo/model.rb +5 -1
- data/lib/hobo/model_controller.rb +5 -1
- data/lib/hobo/model_router.rb +7 -5
- data/lib/hobo/rapid_helper.rb +1 -5
- data/lib/hobo/user.rb +4 -0
- data/lib/hobo/user_controller.rb +2 -4
- data/lib/hobo.rb +2 -2
- data/rails_generators/hobo/hobo_generator.rb +1 -0
- data/rails_generators/hobo/templates/patch_routing.rb +32 -0
- data/rails_generators/hobo_rapid/templates/hobo-rapid.js +8 -7
- data/rails_generators/hobo_subsite/hobo_subsite_generator.rb +1 -1
- data/rails_generators/hobo_user_model/templates/forgot_password.erb +2 -2
- data/rails_generators/hobo_user_model/templates/mailer.rb +1 -1
- data/rails_generators/hobo_user_model/templates/model.rb +2 -2
- data/taglibs/rapid_forms.dryml +4 -1
- data/taglibs/rapid_plus.dryml +1 -1
- metadata +18 -6
@@ -55,7 +55,11 @@ module Hobo
|
|
55
55
|
if force || !@controllers_loaded[subsite]
|
56
56
|
dir = "#{RAILS_ROOT}/app/controllers#{'/' + subsite if subsite}"
|
57
57
|
Dir.entries(dir).each do |f|
|
58
|
-
f =~ /^[a-zA-Z_][a-zA-Z0-9_]*_controller\.rb$/
|
58
|
+
if f =~ /^[a-zA-Z_][a-zA-Z0-9_]*_controller\.rb$/
|
59
|
+
name = f.sub(/.rb$/, '').camelize
|
60
|
+
name = "#{subsite.camelize}::#{name}" if subsite
|
61
|
+
name.constantize
|
62
|
+
end
|
59
63
|
end
|
60
64
|
@controllers_loaded[subsite] = true
|
61
65
|
end
|
data/lib/hobo/model_router.rb
CHANGED
@@ -32,7 +32,7 @@ module Hobo
|
|
32
32
|
class ModelRouter
|
33
33
|
|
34
34
|
class << self
|
35
|
-
|
35
|
+
|
36
36
|
attr_accessor :reload_routes_on_every_request
|
37
37
|
|
38
38
|
def reset_linkables
|
@@ -102,6 +102,8 @@ module Hobo
|
|
102
102
|
|
103
103
|
end
|
104
104
|
|
105
|
+
# specify that an id CANNOT be null - needed to disambiguate /models from /models/[nil] - see #251
|
106
|
+
ID_REQUIREMENT = { :id => /[^#{ActionController::Routing::SEPARATORS.join}]+/ }
|
105
107
|
|
106
108
|
def initialize(map, controller, subsite)
|
107
109
|
@map = map
|
@@ -132,7 +134,7 @@ module Hobo
|
|
132
134
|
def add_routes
|
133
135
|
# Simple support for composite models, we might later need a CompositeModelController
|
134
136
|
if model < Hobo::CompositeModel
|
135
|
-
map.connect "#{plural}/:id", :controller => plural, :action => 'show'
|
137
|
+
map.connect "#{plural}/:id", :controller => plural, :action => 'show', :requirements => ID_REQUIREMENT
|
136
138
|
|
137
139
|
elsif controller < Hobo::ModelController
|
138
140
|
# index routes need to be first so the index names don't get
|
@@ -161,11 +163,11 @@ module Hobo
|
|
161
163
|
linkable_route("new_#{singular}", "#{plural}/new", :new, :conditions => { :method => :get })
|
162
164
|
linkable_route("edit_#{singular}", "#{plural}/:id/edit", :edit, :conditions => { :method => :get })
|
163
165
|
|
164
|
-
linkable_route(singular, "#{plural}/:id", :show, :conditions => { :method => :get })
|
166
|
+
linkable_route(singular, "#{plural}/:id", :show, :conditions => { :method => :get }, :requirements => ID_REQUIREMENT)
|
165
167
|
|
166
168
|
linkable_route("create_#{singular}", plural, :create, :conditions => { :method => :post })
|
167
|
-
linkable_route("update_#{singular}", "#{plural}/:id", :update, :conditions => { :method => :put })
|
168
|
-
linkable_route("destroy_#{singular}", "#{plural}/:id", :destroy, :conditions => { :method => :delete })
|
169
|
+
linkable_route("update_#{singular}", "#{plural}/:id", :update, :conditions => { :method => :put }, :requirements => ID_REQUIREMENT)
|
170
|
+
linkable_route("destroy_#{singular}", "#{plural}/:id", :destroy, :conditions => { :method => :delete }, :requirements => ID_REQUIREMENT)
|
169
171
|
end
|
170
172
|
|
171
173
|
|
data/lib/hobo/rapid_helper.rb
CHANGED
@@ -95,7 +95,7 @@ module Hobo::RapidHelper
|
|
95
95
|
def in_place_editor(attributes)
|
96
96
|
blank_message = attributes.delete(:blank_message) || "(click to edit)"
|
97
97
|
|
98
|
-
attributes = add_classes(attributes,
|
98
|
+
attributes = add_classes(attributes, "in-place-edit", model_id_class(this_parent, this_field))
|
99
99
|
attributes.update(:hobo_blank_message => blank_message,
|
100
100
|
:if_blank => blank_message,
|
101
101
|
:no_wrapper => false)
|
@@ -115,10 +115,6 @@ module Hobo::RapidHelper
|
|
115
115
|
:reset_form, :refocus_form, :result_update, :spinner_next_to ]
|
116
116
|
|
117
117
|
|
118
|
-
def editor_class
|
119
|
-
end
|
120
|
-
|
121
|
-
|
122
118
|
def through_collection_names(object=this)
|
123
119
|
object.class.reflections.values.select do |refl|
|
124
120
|
refl.macro == :has_many && refl.options[:through]
|
data/lib/hobo/user.rb
CHANGED
data/lib/hobo/user_controller.rb
CHANGED
@@ -88,9 +88,9 @@ module Hobo
|
|
88
88
|
|
89
89
|
def hobo_do_signup(&b)
|
90
90
|
do_creator_action(:signup) do
|
91
|
+
flash[:notice] = "Thanks for signing up!" if valid?
|
91
92
|
response_block(&b) or if valid?
|
92
|
-
self.current_user = this
|
93
|
-
flash[:notice] = "Thanks for signing up!"
|
93
|
+
self.current_user = this if this.account_active?
|
94
94
|
redirect_back_or_default(home_page)
|
95
95
|
end
|
96
96
|
end
|
@@ -112,8 +112,6 @@ module Hobo
|
|
112
112
|
if request.post?
|
113
113
|
user = model.find_by_email_address(params[:email_address])
|
114
114
|
if user && (!block_given? || yield(user))
|
115
|
-
Hobo::Controller.request_host = request.host_with_port
|
116
|
-
Hobo::Controller.app_name = call_tag(:app_name)
|
117
115
|
user.lifecycle.request_password_reset(:nobody)
|
118
116
|
end
|
119
117
|
render_tag :forgot_password_email_sent_page
|
data/lib/hobo.rb
CHANGED
@@ -7,7 +7,7 @@ rescue MissingSourceFile
|
|
7
7
|
# OK, Hobo won't do pagination then
|
8
8
|
end
|
9
9
|
|
10
|
-
Dependencies.load_paths |= [ File.dirname(__FILE__) ]
|
10
|
+
(defined?(ActiveSupport::Dependencies) ? ActiveSupport::Dependencies : Dependencies).load_paths |= [ File.dirname(__FILE__) ]
|
11
11
|
|
12
12
|
# Hobo can be installed in /vendor/hobo, /vendor/plugins/hobo, vendor/plugins/hobo/hobo, etc.
|
13
13
|
::HOBO_ROOT = File.expand_path(File.dirname(__FILE__) + "/..")
|
@@ -26,7 +26,7 @@ class HoboError < RuntimeError; end
|
|
26
26
|
|
27
27
|
module Hobo
|
28
28
|
|
29
|
-
VERSION = "0.8"
|
29
|
+
VERSION = "0.8.1"
|
30
30
|
|
31
31
|
class RawJs < String; end
|
32
32
|
|
@@ -22,6 +22,7 @@ class HoboGenerator < Rails::Generator::Base
|
|
22
22
|
m.file "dryml-support.js", File.join("public/javascripts/dryml-support.js")
|
23
23
|
m.file "application.css", File.join("public/stylesheets/application.css")
|
24
24
|
m.file "initializer.rb", File.join("config/initializers/hobo.rb")
|
25
|
+
m.file "patch_routing.rb", File.join("config/initializers/patch_routing.rb")
|
25
26
|
end
|
26
27
|
end
|
27
28
|
|
@@ -0,0 +1,32 @@
|
|
1
|
+
if Rails::VERSION::STRING.in? ["2.1.0", "2.1.1"]
|
2
|
+
module ActionController
|
3
|
+
module Routing
|
4
|
+
class RouteSet
|
5
|
+
def clear_recognize_optimized!
|
6
|
+
instance_eval %{
|
7
|
+
def recognize_optimized(path, env)
|
8
|
+
write_recognize_optimized
|
9
|
+
recognize_optimized(path, env)
|
10
|
+
end
|
11
|
+
}, __FILE__, __LINE__
|
12
|
+
end
|
13
|
+
|
14
|
+
def clear_with_optimization!
|
15
|
+
clear_without_optimization!
|
16
|
+
clear_recognize_optimized!
|
17
|
+
end
|
18
|
+
alias_method_chain :clear!, :optimization
|
19
|
+
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
ActionController::Routing::Routes.reload!
|
25
|
+
|
26
|
+
else
|
27
|
+
RAILS_DEFAULT_LOGGER.info "****"
|
28
|
+
RAILS_DEFAULT_LOGGER.info "**** The file config/initializers/patch_routing.rb is not in use"
|
29
|
+
RAILS_DEFAULT_LOGGER.info "**** with this version of Rails and can be removed"
|
30
|
+
RAILS_DEFAULT_LOGGER.info "****"
|
31
|
+
end
|
32
|
+
|
@@ -617,25 +617,25 @@ Event.addBehavior({
|
|
617
617
|
'.autocompleter' : AutocompleteBehavior(),
|
618
618
|
|
619
619
|
'.string.in-place-edit, .datetime.in-place-edit, .date.in-place-edit, .integer.in-place-edit, .float.in-place.edit, big-integer.in-place-edit' :
|
620
|
-
function (
|
621
|
-
var ipe = Hobo._makeInPlaceEditor(
|
620
|
+
function (e) {
|
621
|
+
var ipe = Hobo._makeInPlaceEditor(this)
|
622
622
|
ipe.getText = function() {
|
623
623
|
return this.element.innerHTML.gsub(/<br\s*\/?>/, "\n").unescapeHTML()
|
624
624
|
}
|
625
625
|
},
|
626
626
|
|
627
|
-
'.text.in-place-edit' : function (
|
628
|
-
var ipe = Hobo._makeInPlaceEditor(
|
627
|
+
'.text.in-place-edit, .markdown.in-place-edit, .textile.in-place-edit' : function (e) {
|
628
|
+
var ipe = Hobo._makeInPlaceEditor(this, {rows: 2})
|
629
629
|
ipe.getText = function() {
|
630
630
|
return this.element.innerHTML.gsub(/<br\s*\/?>/, "\n").unescapeHTML()
|
631
631
|
}
|
632
632
|
},
|
633
633
|
|
634
|
-
".html.in-place-edit" : function (
|
634
|
+
".html.in-place-edit" : function (e) {
|
635
635
|
var nicEditPresent = typeof(nicEditor) != "undefined"
|
636
636
|
var options = { rows: 2, handleLineBreaks: false, okButton: true, cancelLink: true, okText: "Save" }
|
637
637
|
if (nicEditPresent) options["submitOnBlur"] = false
|
638
|
-
var ipe = Hobo._makeInPlaceEditor(
|
638
|
+
var ipe = Hobo._makeInPlaceEditor(this, options)
|
639
639
|
if (nicEditPresent) {
|
640
640
|
ipe.afterEnterEditMode = function() {
|
641
641
|
var editor = this._controls.editor
|
@@ -652,7 +652,8 @@ Event.addBehavior({
|
|
652
652
|
}
|
653
653
|
},
|
654
654
|
|
655
|
-
"select.integer.editor" : function(
|
655
|
+
"select.integer.editor" : function(e) {
|
656
|
+
var el = this
|
656
657
|
el.onchange = function() {
|
657
658
|
Hobo.ajaxSetFieldForElement(el, $F(el))
|
658
659
|
}
|
@@ -45,7 +45,7 @@ class HoboSubsiteGenerator < Rails::Generator::NamedBase
|
|
45
45
|
m.directory File.join('app', 'controllers', file_name)
|
46
46
|
m.directory File.join('app', 'views', file_name)
|
47
47
|
|
48
|
-
m.template "controller.rb", File.join('app/controllers', file_name, "#{file_name}
|
48
|
+
m.template "controller.rb", File.join('app/controllers', file_name, "#{file_name}_site_controller.rb")
|
49
49
|
m.template "site_taglib.dryml", File.join('app/views/taglibs', "#{file_name}_site.dryml")
|
50
50
|
end
|
51
51
|
end
|
@@ -1,9 +1,9 @@
|
|
1
1
|
<%%= @user %>,
|
2
2
|
|
3
|
-
If you have
|
3
|
+
If you have forgotten your password for <%%= @app_name %>, you can chose
|
4
4
|
a new one by clicking on this link:
|
5
5
|
|
6
|
-
<%%=
|
6
|
+
<%%= <%= name -%>_reset_password_url :host => @host, :id => @user, :key => @key %>
|
7
7
|
|
8
8
|
Thanks very much,
|
9
9
|
|
@@ -24,8 +24,8 @@ class <%= class_name %> < ActiveRecord::Base
|
|
24
24
|
:params => [:username, :email_address, :password, :password_confirmation],
|
25
25
|
:become => :active, :if => proc {|_, u| u.guest?}
|
26
26
|
|
27
|
-
transition :nobody, :request_password_reset, { :active => :active } do
|
28
|
-
|
27
|
+
transition :nobody, :request_password_reset, { :active => :active }, :new_key => true do
|
28
|
+
<%= class_name %>Mailer.deliver_forgot_password(self, lifecycle.key)
|
29
29
|
end
|
30
30
|
|
31
31
|
transition :with_key, :reset_password, { :active => :active },
|
data/taglibs/rapid_forms.dryml
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
<def tag="hidden-fields" attrs="fields, skip, for-query-string"><%=
|
2
|
+
skip = comma_split(skip)
|
2
3
|
pairs = if for_query_string
|
3
4
|
query_params.to_a
|
4
5
|
else
|
@@ -20,7 +21,7 @@
|
|
20
21
|
%></def>
|
21
22
|
|
22
23
|
|
23
|
-
<def tag="form" polymorphic attrs="update, hidden-fields, action, method, web-method, lifecycle, owner"><%=
|
24
|
+
<def tag="form" polymorphic attrs="update, hidden-fields, action, method, web-method, lifecycle, owner, enctype"><%=
|
24
25
|
ajax_attrs, html_attrs = attributes.partition_hash(Hobo::RapidHelper::AJAX_ATTRS)
|
25
26
|
|
26
27
|
new_record = this.try.new_record?
|
@@ -94,6 +95,8 @@
|
|
94
95
|
add_classes!(html_attrs, "#{'new_' if new_record}#{type_id}")
|
95
96
|
end
|
96
97
|
end
|
98
|
+
|
99
|
+
html_attrs[:enctype] = enctype
|
97
100
|
|
98
101
|
Hobo::Dryml.last_if = true
|
99
102
|
element("form", html_attrs, body)
|
data/taglibs/rapid_plus.dryml
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
<div class="header" param="header">
|
6
6
|
<div class="search">
|
7
7
|
<form param="search-form" method="get" action="">
|
8
|
-
<hidden-fields for-query-string skip="page,
|
8
|
+
<hidden-fields for-query-string skip="page, search"/>
|
9
9
|
<span>Search</span>
|
10
10
|
<input class="search" type="search" name="search" value="¶ms[:search]"/>
|
11
11
|
<submit label="Go" class="search-button" param="search-submit"/>
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hobo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 0.8.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tom Locke
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-09-
|
12
|
+
date: 2008-09-08 00:00:00 +01:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -20,7 +20,7 @@ dependencies:
|
|
20
20
|
requirements:
|
21
21
|
- - ">="
|
22
22
|
- !ruby/object:Gem::Version
|
23
|
-
version:
|
23
|
+
version: 0.8.1
|
24
24
|
version:
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: hobofields
|
@@ -30,7 +30,7 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 0.8.1
|
34
34
|
version:
|
35
35
|
- !ruby/object:Gem::Dependency
|
36
36
|
name: rails
|
@@ -52,6 +52,16 @@ dependencies:
|
|
52
52
|
- !ruby/object:Gem::Version
|
53
53
|
version: 2.2.1
|
54
54
|
version:
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: echoe
|
57
|
+
type: :development
|
58
|
+
version_requirement:
|
59
|
+
version_requirements: !ruby/object:Gem::Requirement
|
60
|
+
requirements:
|
61
|
+
- - ">="
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: "0"
|
64
|
+
version:
|
55
65
|
description: The web app builder for Rails
|
56
66
|
email: tom@tomlocke.com
|
57
67
|
executables:
|
@@ -195,6 +205,7 @@ files:
|
|
195
205
|
- rails_generators/hobo/templates/dryml-support.js
|
196
206
|
- rails_generators/hobo/templates/guest.rb
|
197
207
|
- rails_generators/hobo/templates/initializer.rb
|
208
|
+
- rails_generators/hobo/templates/patch_routing.rb
|
198
209
|
- rails_generators/hobo_front_controller/hobo_front_controller_generator.rb
|
199
210
|
- rails_generators/hobo_front_controller/templates/controller.rb
|
200
211
|
- rails_generators/hobo_front_controller/templates/functional_test.rb
|
@@ -247,6 +258,7 @@ files:
|
|
247
258
|
- rails_generators/hobo_user_model/templates/model.rb
|
248
259
|
- rails_generators/hobo_user_model/templates/unit_test.rb
|
249
260
|
- rails_generators/hobo_user_model/USAGE
|
261
|
+
- Rakefile
|
250
262
|
- README
|
251
263
|
- script/destroy
|
252
264
|
- script/generate
|
@@ -291,9 +303,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
291
303
|
version:
|
292
304
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
293
305
|
requirements:
|
294
|
-
- - "
|
306
|
+
- - "="
|
295
307
|
- !ruby/object:Gem::Version
|
296
|
-
version: "
|
308
|
+
version: "1.2"
|
297
309
|
version:
|
298
310
|
requirements: []
|
299
311
|
|