hobo 0.5.3
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/LICENSE.txt +22 -0
- data/README.txt +18 -0
- data/bin/hobo +81 -0
- data/hobo_files/plugin/CHANGES.txt +963 -0
- data/hobo_files/plugin/LICENSE.txt +22 -0
- data/hobo_files/plugin/README +4 -0
- data/hobo_files/plugin/Rakefile +11 -0
- data/hobo_files/plugin/generators/hobo/hobo_generator.rb +37 -0
- data/hobo_files/plugin/generators/hobo/templates/application.dryml +2 -0
- data/hobo_files/plugin/generators/hobo/templates/guest.rb +31 -0
- data/hobo_files/plugin/generators/hobo_front_controller/USAGE +11 -0
- data/hobo_files/plugin/generators/hobo_front_controller/hobo_front_controller_generator.rb +90 -0
- data/hobo_files/plugin/generators/hobo_front_controller/templates/controller.rb +51 -0
- data/hobo_files/plugin/generators/hobo_front_controller/templates/functional_test.rb +18 -0
- data/hobo_files/plugin/generators/hobo_front_controller/templates/helper.rb +2 -0
- data/hobo_files/plugin/generators/hobo_front_controller/templates/index.dryml +43 -0
- data/hobo_files/plugin/generators/hobo_front_controller/templates/login.dryml +44 -0
- data/hobo_files/plugin/generators/hobo_front_controller/templates/search.dryml +18 -0
- data/hobo_files/plugin/generators/hobo_front_controller/templates/signup.dryml +45 -0
- data/hobo_files/plugin/generators/hobo_model/USAGE +26 -0
- data/hobo_files/plugin/generators/hobo_model/hobo_model_generator.rb +38 -0
- data/hobo_files/plugin/generators/hobo_model/templates/fixtures.yml +11 -0
- data/hobo_files/plugin/generators/hobo_model/templates/migration.rb +13 -0
- data/hobo_files/plugin/generators/hobo_model/templates/model.rb +24 -0
- data/hobo_files/plugin/generators/hobo_model/templates/unit_test.rb +10 -0
- data/hobo_files/plugin/generators/hobo_model_controller/USAGE +30 -0
- data/hobo_files/plugin/generators/hobo_model_controller/hobo_model_controller_generator.rb +43 -0
- data/hobo_files/plugin/generators/hobo_model_controller/templates/controller.rb +5 -0
- data/hobo_files/plugin/generators/hobo_model_controller/templates/functional_test.rb +18 -0
- data/hobo_files/plugin/generators/hobo_model_controller/templates/helper.rb +2 -0
- data/hobo_files/plugin/generators/hobo_model_controller/templates/view.rhtml +2 -0
- data/hobo_files/plugin/generators/hobo_rapid/hobo_rapid_generator.rb +51 -0
- data/hobo_files/plugin/generators/hobo_rapid/templates/hobo_rapid.js +436 -0
- data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/default_mapping.rb +11 -0
- data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/banner.gif +0 -0
- data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/bkg_bodytop.gif +0 -0
- data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/bkg_corner_01.gif +0 -0
- data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/bkg_corner_02.gif +0 -0
- data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/bkg_corner_03.gif +0 -0
- data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/bkg_corner_04.gif +0 -0
- data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/bkg_shadow_bottom.gif +0 -0
- data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/bkg_shadow_left.gif +0 -0
- data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/bkg_shadow_right.gif +0 -0
- data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/bkg_shadow_top.gif +0 -0
- data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/header_blue.gif +0 -0
- data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/header_dblue.gif +0 -0
- data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/header_green.gif +0 -0
- data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/header_purple.gif +0 -0
- data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/header_red.gif +0 -0
- data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/logo.gif +0 -0
- data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/spinner.gif +0 -0
- data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/txt_list_img_dblue.gif +0 -0
- data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/txt_list_img_green.gif +0 -0
- data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/txt_list_img_purple.gif +0 -0
- data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/txt_list_img_red.gif +0 -0
- data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/window_corner_01.gif +0 -0
- data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/window_corner_02.gif +0 -0
- data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/window_corner_03.gif +0 -0
- data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/window_corner_04.gif +0 -0
- data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/window_shadow_bottom.gif +0 -0
- data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/window_shadow_left.gif +0 -0
- data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/window_shadow_right.gif +0 -0
- data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/window_shadow_top.gif +0 -0
- data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/stylesheets/application.css +390 -0
- data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/views/application.dryml +104 -0
- data/hobo_files/plugin/generators/hobo_user_model/USAGE +26 -0
- data/hobo_files/plugin/generators/hobo_user_model/hobo_user_model_generator.rb +38 -0
- data/hobo_files/plugin/generators/hobo_user_model/templates/fixtures.yml +11 -0
- data/hobo_files/plugin/generators/hobo_user_model/templates/migration.rb +15 -0
- data/hobo_files/plugin/generators/hobo_user_model/templates/model.rb +58 -0
- data/hobo_files/plugin/generators/hobo_user_model/templates/unit_test.rb +10 -0
- data/hobo_files/plugin/init.rb +44 -0
- data/hobo_files/plugin/lib/action_view_extensions/base.rb +14 -0
- data/hobo_files/plugin/lib/active_record/has_many_association.rb +54 -0
- data/hobo_files/plugin/lib/active_record/has_many_through_association.rb +22 -0
- data/hobo_files/plugin/lib/active_record/table_definition.rb +34 -0
- data/hobo_files/plugin/lib/extensions.rb +245 -0
- data/hobo_files/plugin/lib/extensions/test_case.rb +130 -0
- data/hobo_files/plugin/lib/hobo.rb +353 -0
- data/hobo_files/plugin/lib/hobo/HtmlString +3 -0
- data/hobo_files/plugin/lib/hobo/authenticated_user.rb +106 -0
- data/hobo_files/plugin/lib/hobo/authentication_support.rb +108 -0
- data/hobo_files/plugin/lib/hobo/composite_model.rb +66 -0
- data/hobo_files/plugin/lib/hobo/controller.rb +134 -0
- data/hobo_files/plugin/lib/hobo/controller_helpers.rb +135 -0
- data/hobo_files/plugin/lib/hobo/core.rb +475 -0
- data/hobo_files/plugin/lib/hobo/define_tags.rb +56 -0
- data/hobo_files/plugin/lib/hobo/dryml.rb +161 -0
- data/hobo_files/plugin/lib/hobo/dryml/dryml_builder.rb +126 -0
- data/hobo_files/plugin/lib/hobo/dryml/tag_module.rb +9 -0
- data/hobo_files/plugin/lib/hobo/dryml/taglib.rb +57 -0
- data/hobo_files/plugin/lib/hobo/dryml/template.rb +586 -0
- data/hobo_files/plugin/lib/hobo/dryml/template_environment.rb +302 -0
- data/hobo_files/plugin/lib/hobo/dryml/template_handler.rb +19 -0
- data/hobo_files/plugin/lib/hobo/generator.rb +25 -0
- data/hobo_files/plugin/lib/hobo/html_string.rb +3 -0
- data/hobo_files/plugin/lib/hobo/lazy_hash.rb +28 -0
- data/hobo_files/plugin/lib/hobo/mapping_tags.rb +262 -0
- data/hobo_files/plugin/lib/hobo/markdown_string.rb +7 -0
- data/hobo_files/plugin/lib/hobo/model.rb +391 -0
- data/hobo_files/plugin/lib/hobo/model_controller.rb +676 -0
- data/hobo_files/plugin/lib/hobo/model_queries.rb +92 -0
- data/hobo_files/plugin/lib/hobo/model_support.rb +44 -0
- data/hobo_files/plugin/lib/hobo/password_string.rb +3 -0
- data/hobo_files/plugin/lib/hobo/predicate_dispatch.rb +78 -0
- data/hobo_files/plugin/lib/hobo/proc_binding.rb +32 -0
- data/hobo_files/plugin/lib/hobo/rapid.rb +447 -0
- data/hobo_files/plugin/lib/hobo/static_tags +92 -0
- data/hobo_files/plugin/lib/hobo/text.rb +3 -0
- data/hobo_files/plugin/lib/hobo/textile_string.rb +13 -0
- data/hobo_files/plugin/lib/hobo/undefined.rb +41 -0
- data/hobo_files/plugin/lib/hobo/undefined_access_error.rb +5 -0
- data/hobo_files/plugin/lib/hobo/where_fragment.rb +23 -0
- data/hobo_files/plugin/lib/rexml.rb +345 -0
- data/hobo_files/plugin/tags/core.dryml +6 -0
- data/hobo_files/plugin/tags/rapid.dryml +177 -0
- data/hobo_files/plugin/tags/rapid_editing.dryml +168 -0
- data/hobo_files/plugin/tags/rapid_navigation.dryml +95 -0
- data/hobo_files/plugin/tags/rapid_pages.dryml +175 -0
- data/hobo_files/plugin/tasks/environments.rake +19 -0
- data/hobo_files/plugin/tasks/hobo_tasks.rake +4 -0
- data/hobo_files/plugin/test/hobo_dryml_template_test.rb +7 -0
- data/hobo_files/plugin/test/hobo_test.rb +7 -0
- data/hobo_files/plugin/uninstall.rb +1 -0
- metadata +206 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
Copyright (c) 2006 Tom Locke
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person
|
|
4
|
+
obtaining a copy of this software and associated documentation
|
|
5
|
+
files (the "Software"), to deal in the Software without
|
|
6
|
+
restriction, including without limitation the rights to use,
|
|
7
|
+
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
+
copies of the Software, and to permit persons to whom the
|
|
9
|
+
Software is furnished to do so, subject to the following
|
|
10
|
+
conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be
|
|
13
|
+
included in all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
16
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
|
17
|
+
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
18
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
19
|
+
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
20
|
+
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
21
|
+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
22
|
+
OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
require 'rake'
|
|
2
|
+
require 'rake/rdoctask'
|
|
3
|
+
|
|
4
|
+
desc 'Generate documentation for the Hobo plugin.'
|
|
5
|
+
Rake::RDocTask.new(:rdoc) do |rdoc|
|
|
6
|
+
rdoc.rdoc_dir = 'rdoc'
|
|
7
|
+
rdoc.title = 'Hobo'
|
|
8
|
+
rdoc.options << '--line-numbers' << '--inline-source'
|
|
9
|
+
rdoc.rdoc_files.include('README')
|
|
10
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
|
11
|
+
end
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
class HoboGenerator < Rails::Generator::Base
|
|
2
|
+
|
|
3
|
+
def manifest
|
|
4
|
+
if options[:add_routes]
|
|
5
|
+
routes_path = File.join(RAILS_ROOT, "config/routes.rb")
|
|
6
|
+
|
|
7
|
+
route = " Hobo.add_routes(map)\n"
|
|
8
|
+
|
|
9
|
+
route_src = File.read(routes_path)
|
|
10
|
+
return if route_src.include?(route)
|
|
11
|
+
|
|
12
|
+
head = "ActionController::Routing::Routes.draw do |map|"
|
|
13
|
+
route_src.sub!(head, head + "\n\n" + route)
|
|
14
|
+
File.open(routes_path, 'w') {|f| f.write(route_src) }
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
record do |m|
|
|
18
|
+
m.directory File.join("app/views/hobolib")
|
|
19
|
+
m.directory File.join("app/views/hobolib/themes")
|
|
20
|
+
m.directory File.join("public/hobothemes")
|
|
21
|
+
m.file "application.dryml", File.join("app/views/hobolib/application.dryml")
|
|
22
|
+
m.file "guest.rb", File.join("app/models/guest.rb")
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
protected
|
|
27
|
+
def banner
|
|
28
|
+
"Usage: #{$0} generate [--add-routes]"
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def add_options!(opt)
|
|
32
|
+
opt.separator ''
|
|
33
|
+
opt.separator 'Options:'
|
|
34
|
+
opt.on("--add-routes",
|
|
35
|
+
"Add Hobo routes to config/routes.rb") { |v| options[:add_routes] = v }
|
|
36
|
+
end
|
|
37
|
+
end
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
class Guest
|
|
2
|
+
|
|
3
|
+
def display_name
|
|
4
|
+
"Guest"
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
def guest?
|
|
8
|
+
true
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def super_user?
|
|
12
|
+
false
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def can_update?(obj, field)
|
|
16
|
+
false
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def can_delete?(obj)
|
|
20
|
+
false
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def can_create?(obj)
|
|
24
|
+
false
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def can_view?(obj, field)
|
|
28
|
+
true
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
Description:
|
|
2
|
+
|
|
3
|
+
The hobo_front_controller generator creates a basic 'front
|
|
4
|
+
controller' and related views to get your app development kick started.
|
|
5
|
+
|
|
6
|
+
It takes a single argument -- the name of the controller
|
|
7
|
+
|
|
8
|
+
The front controller provides a simple front-page, ready to be
|
|
9
|
+
customized, and a search page.
|
|
10
|
+
|
|
11
|
+
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
class HoboFrontControllerGenerator < Rails::Generator::NamedBase
|
|
2
|
+
|
|
3
|
+
default_options :no_user => false, :delete_index => false, :add_routes => false
|
|
4
|
+
|
|
5
|
+
def full_class_path
|
|
6
|
+
class_path.blank? ? file_name : File.join(class_path, file_name)
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def manifest
|
|
10
|
+
if options[:command] == :create
|
|
11
|
+
add_routes if options[:add_routes]
|
|
12
|
+
remove_index_html if options[:delete_index]
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
record do |m|
|
|
16
|
+
# Check for class naming collisions.
|
|
17
|
+
m.class_collisions(class_path, "#{class_name}Controller",
|
|
18
|
+
"#{class_name}ControllerTest", "#{class_name}Helper")
|
|
19
|
+
|
|
20
|
+
# Controller, helper, views, and test directories.
|
|
21
|
+
m.directory File.join('app/controllers', class_path)
|
|
22
|
+
m.directory File.join('app/helpers', class_path)
|
|
23
|
+
m.directory File.join('app/views', class_path, file_name)
|
|
24
|
+
m.directory File.join('test/functional', class_path)
|
|
25
|
+
|
|
26
|
+
# Controller class, functional test, and helper class.
|
|
27
|
+
m.template('controller.rb',
|
|
28
|
+
File.join('app/controllers', class_path, "#{file_name}_controller.rb"))
|
|
29
|
+
|
|
30
|
+
m.template('functional_test.rb',
|
|
31
|
+
File.join('test/functional', class_path, "#{file_name}_controller_test.rb"))
|
|
32
|
+
|
|
33
|
+
m.template('helper.rb',
|
|
34
|
+
File.join('app/helpers', class_path, "#{file_name}_helper.rb"))
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
pages = options[:no_user] ? %w{index search} : %w{index search login signup}
|
|
38
|
+
for page in pages
|
|
39
|
+
m.template("#{page}.dryml", File.join('app/views', class_path, file_name, "#{page}.dryml"))
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def app_name
|
|
45
|
+
@app_name ||= File.basename(Dir.chdir(RAILS_ROOT) { Dir.getwd }).strip.titleize
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def add_routes
|
|
49
|
+
routes_path = File.join(RAILS_ROOT, "config/routes.rb")
|
|
50
|
+
name = full_class_path
|
|
51
|
+
|
|
52
|
+
route = (" map.search 'search', :controller => '#{name}', :action => 'search'\n" +
|
|
53
|
+
" map.homepage '', :controller => '#{name}', :action => 'index'")
|
|
54
|
+
unless options[:no_user]
|
|
55
|
+
route += ("\n map.login 'login', :controller => '#{name}', :action => 'login'\n" +
|
|
56
|
+
" map.logout 'logout', :controller => '#{name}', :action => 'logout'\n" +
|
|
57
|
+
" map.signup 'signup', :controller => '#{name}', :action => 'signup'")
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
route_src = File.read(routes_path)
|
|
61
|
+
return if route_src.include?(route)
|
|
62
|
+
|
|
63
|
+
head = "ActionController::Routing::Routes.draw do |map|"
|
|
64
|
+
route_src.sub!(head, head + "\n\n" + route)
|
|
65
|
+
File.open(routes_path, 'w') {|f| f.write(route_src) }
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
def remove_index_html
|
|
69
|
+
index_path = File.join(RAILS_ROOT, "public/index.html")
|
|
70
|
+
return unless File.exists?(index_path)
|
|
71
|
+
File.unlink(index_path)
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
protected
|
|
75
|
+
def banner
|
|
76
|
+
"Usage: #{$0} generate <controller-name> [--add-routes] [--no-user] [--delete-index]"
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
def add_options!(opt)
|
|
80
|
+
opt.separator ''
|
|
81
|
+
opt.separator 'Options:'
|
|
82
|
+
opt.on("--add-routes",
|
|
83
|
+
"Modify config/routes.rb to support the front controller") { |v| options[:add_routes] = true }
|
|
84
|
+
opt.on("--no-user",
|
|
85
|
+
"Don't create the login and signup pages") { |v| options[:no_user] = true }
|
|
86
|
+
opt.on("--delete-index",
|
|
87
|
+
"Delete public/index.html") { |v| options[:delete_index] = true }
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
end
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
class <%= class_name %>Controller < ApplicationController
|
|
2
|
+
|
|
3
|
+
hobo_controller
|
|
4
|
+
|
|
5
|
+
filter_parameter_logging "password"
|
|
6
|
+
|
|
7
|
+
def index; end
|
|
8
|
+
|
|
9
|
+
def search
|
|
10
|
+
if request.post?
|
|
11
|
+
site_search(params[:query])
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def login
|
|
16
|
+
return unless request.post?
|
|
17
|
+
user = Hobo.user_model.authenticate(params[:login], params[:password])
|
|
18
|
+
if user
|
|
19
|
+
self.current_user = user
|
|
20
|
+
if params[:remember_me] == "1"
|
|
21
|
+
self.current_user.remember_me
|
|
22
|
+
cookies[:auth_token] = { :value => self.current_user.remember_token ,
|
|
23
|
+
:expires => self.current_user.remember_token_expires_at }
|
|
24
|
+
end
|
|
25
|
+
redirect_back_or_default(:action => 'index')
|
|
26
|
+
flash[:notice] = "You have logged in"
|
|
27
|
+
else
|
|
28
|
+
flash[:notice] = "You did not provide a valid login and password"
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def signup
|
|
33
|
+
@user = Hobo.user_model.new(params[:user])
|
|
34
|
+
return unless request.post?
|
|
35
|
+
@user.save!
|
|
36
|
+
self.current_user = @user
|
|
37
|
+
redirect_back_or_default(:action => 'index')
|
|
38
|
+
flash[:notice] = "Thanks for signing up!"
|
|
39
|
+
rescue ActiveRecord::RecordInvalid
|
|
40
|
+
render :action => 'signup'
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def logout
|
|
44
|
+
self.current_user.forget_me if logged_in?
|
|
45
|
+
cookies.delete :auth_token
|
|
46
|
+
reset_session
|
|
47
|
+
flash[:notice] = "You have been logged out."
|
|
48
|
+
redirect_back_or_default(:action => 'index')
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
require File.dirname(__FILE__) + '<%= '/..' * class_nesting_depth %>/../test_helper'
|
|
2
|
+
require '<%= file_path %>_controller'
|
|
3
|
+
|
|
4
|
+
# Re-raise errors caught by the controller.
|
|
5
|
+
class <%= class_name %>Controller; def rescue_action(e) raise e end; end
|
|
6
|
+
|
|
7
|
+
class <%= class_name %>ControllerTest < Test::Unit::TestCase
|
|
8
|
+
def setup
|
|
9
|
+
@controller = <%= class_name %>Controller.new
|
|
10
|
+
@request = ActionController::TestRequest.new
|
|
11
|
+
@response = ActionController::TestResponse.new
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
# Replace this with your real tests.
|
|
15
|
+
def test_truth
|
|
16
|
+
assert true
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
<page title="<%= app_name %>">
|
|
2
|
+
|
|
3
|
+
<:intro>
|
|
4
|
+
<h1 class="front_page_title"><%= app_name %></h1>
|
|
5
|
+
</:intro>
|
|
6
|
+
|
|
7
|
+
<:main>
|
|
8
|
+
<panel>
|
|
9
|
+
<div style="margin-left: 40px; ">
|
|
10
|
+
<h3>Congratulations! Your Hobo Rails App is up and running</h3>
|
|
11
|
+
<ul>
|
|
12
|
+
<li>To customise this page: edit app/views/<%= file_name %>/index.dryml </li>
|
|
13
|
+
|
|
14
|
+
<li>To change the nav-bar: define <application_nav><br/>
|
|
15
|
+
See vendor/plugins/hobo/tags/rapid.dryml for an example</li>
|
|
16
|
+
|
|
17
|
+
<li>To change the logo: define <application_logo>.</li>
|
|
18
|
+
</ul>
|
|
19
|
+
</div>
|
|
20
|
+
</panel>
|
|
21
|
+
|
|
22
|
+
<repeat obj="#Hobo.models">
|
|
23
|
+
<panel>
|
|
24
|
+
<h2><%%= this.name.titlecase.pluralize %></h2>
|
|
25
|
+
<section>
|
|
26
|
+
<if q="#this.count == 0">
|
|
27
|
+
<p>There are no <%%= this.name.titleize.pluralize %></p>
|
|
28
|
+
<if q="#can_create?(this) and this != Hobo.user_model">
|
|
29
|
+
<p>Create a <new_object_link for="#this"/>.</p>
|
|
30
|
+
</if>
|
|
31
|
+
</if>
|
|
32
|
+
<else>
|
|
33
|
+
<repeat obj="#this.find(:all, :limit => 3)">
|
|
34
|
+
<if_can_view><object_card/></if_can_view>
|
|
35
|
+
</repeat>
|
|
36
|
+
<p><object_link>More</object_link> (<count/>)</p>
|
|
37
|
+
</else>
|
|
38
|
+
</section>
|
|
39
|
+
</panel>
|
|
40
|
+
</repeat>
|
|
41
|
+
</:main>
|
|
42
|
+
|
|
43
|
+
</page>
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
<page title="<%= app_name %>">
|
|
2
|
+
|
|
3
|
+
<:intro>
|
|
4
|
+
<h1 class="front_page_title"><%= app_name %></h1>
|
|
5
|
+
</:intro>
|
|
6
|
+
|
|
7
|
+
<:main>
|
|
8
|
+
<panel>
|
|
9
|
+
<h2>Login to <%= app_name %></h2>
|
|
10
|
+
<section>
|
|
11
|
+
<%% form_tag do %>
|
|
12
|
+
<table class="login_table">
|
|
13
|
+
<tr>
|
|
14
|
+
<td class="field_label"><label for="login">Username</label></td>
|
|
15
|
+
<td><%%= text_field_tag 'login' %></td>
|
|
16
|
+
</tr>
|
|
17
|
+
|
|
18
|
+
<tr>
|
|
19
|
+
<td class="field_label"><label for="password">Password</label></td>
|
|
20
|
+
<td><%%= password_field_tag 'password' %></td>
|
|
21
|
+
</tr>
|
|
22
|
+
|
|
23
|
+
<!-- Uncomment if required. You will also need to
|
|
24
|
+
add "before_filter :login_from_cookie" to ApplicationController
|
|
25
|
+
<tr>
|
|
26
|
+
<td class="field_label"><label for="remember_me">Remember me:</label></td>
|
|
27
|
+
<td><%%= check_box_tag 'remember_me' %></td>
|
|
28
|
+
</tr>
|
|
29
|
+
-->
|
|
30
|
+
</table>
|
|
31
|
+
|
|
32
|
+
<p><submit label='Log in'/></p>
|
|
33
|
+
<%% end %>
|
|
34
|
+
</section>
|
|
35
|
+
</panel>
|
|
36
|
+
|
|
37
|
+
<panel>
|
|
38
|
+
<div style="padding: 5px; text-align: center; font-style: italic;">
|
|
39
|
+
Edit app/views/<%= full_class_path %>/login.dryml to customise this page
|
|
40
|
+
</div>
|
|
41
|
+
</panel>
|
|
42
|
+
</:main>
|
|
43
|
+
|
|
44
|
+
</page>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<page title="Search" onload="Hobo.doSearch('search_field')">
|
|
2
|
+
|
|
3
|
+
<:main>
|
|
4
|
+
<panel class="red" style="margin-top: 40px">
|
|
5
|
+
<h2>Search</h2>
|
|
6
|
+
<div class='search' style='margin:10px'>
|
|
7
|
+
<input type='text' id="search_field" class="search_bhv" style="width: 90%"/>
|
|
8
|
+
<spinner id="search_spinner"/>
|
|
9
|
+
</div>
|
|
10
|
+
</panel>
|
|
11
|
+
|
|
12
|
+
<panel class="hidden" id="search_results_panel">
|
|
13
|
+
<h2>Results</h2>
|
|
14
|
+
<section id="search_results"></section>
|
|
15
|
+
</panel>
|
|
16
|
+
</:main>
|
|
17
|
+
|
|
18
|
+
</page>
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
<page title="<%= app_name %>">
|
|
2
|
+
|
|
3
|
+
<:intro>
|
|
4
|
+
<h1 class="front_page_title"><%= app_name %></h1>
|
|
5
|
+
</:intro>
|
|
6
|
+
|
|
7
|
+
<:main>
|
|
8
|
+
<panel>
|
|
9
|
+
<h2>Sign Up</h2>
|
|
10
|
+
<section>
|
|
11
|
+
<%%= error_messages_for :user %>
|
|
12
|
+
|
|
13
|
+
<%% form_for :user do |f| %>
|
|
14
|
+
<table class="login_table">
|
|
15
|
+
<tr>
|
|
16
|
+
<td class="field_label"><label for="login">Login</label></td>
|
|
17
|
+
<td><%%= f.text_field 'login' %></td>
|
|
18
|
+
</tr>
|
|
19
|
+
|
|
20
|
+
<tr>
|
|
21
|
+
<td class="field_label"><label for="password">Password</label></td>
|
|
22
|
+
<td><%%= f.password_field 'password' %></td>
|
|
23
|
+
</tr>
|
|
24
|
+
|
|
25
|
+
<tr>
|
|
26
|
+
<td class="field_label"><label for="password">Confirm Password</label></td>
|
|
27
|
+
<td><%%= f.password_field 'password_confirmation' %></td>
|
|
28
|
+
</tr>
|
|
29
|
+
|
|
30
|
+
</table>
|
|
31
|
+
|
|
32
|
+
<p><submit label='Sign Up'/></p>
|
|
33
|
+
<%% end %>
|
|
34
|
+
</section>
|
|
35
|
+
</panel>
|
|
36
|
+
|
|
37
|
+
<panel>
|
|
38
|
+
<div style="padding: 5px; text-align: center; font-style: italic;">
|
|
39
|
+
Edit app/views/<%= full_class_path %>/signup.dryml to customise this page
|
|
40
|
+
</div>
|
|
41
|
+
</panel>
|
|
42
|
+
</:main>
|
|
43
|
+
|
|
44
|
+
</page>
|
|
45
|
+
|