wheels 0.0.48 → 0.0.49
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/app/controllers/access_control_entries_controller.rb +4 -4
- data/app/controllers/external_links_controller.rb +5 -0
- data/app/controllers/feedbacks_controller.rb +10 -0
- data/app/controllers/menus_controller.rb +2 -0
- data/app/controllers/pages_controller.rb +16 -29
- data/app/controllers/sitemaps_controller.rb +135 -0
- data/app/helpers/application_helper.rb +4 -3
- data/app/helpers/external_links_helper.rb +2 -0
- data/app/helpers/feedbacks_helper.rb +2 -0
- data/app/helpers/menus_helper.rb +2 -0
- data/app/helpers/sitemaps_helper.rb +12 -0
- data/app/mailers/feedback_mailer.rb +10 -0
- data/app/models/ability.rb +2 -1
- data/app/models/access_control_entry.rb +17 -15
- data/app/models/external_link.rb +4 -0
- data/app/models/feedback.rb +13 -0
- data/app/models/image.rb +1 -1
- data/app/models/menu.rb +4 -0
- data/app/models/page.rb +2 -5
- data/app/models/sitemap.rb +153 -0
- data/app/models/user.rb +7 -1
- data/app/validators/email_validator.rb +22 -0
- data/app/views/access_control_entries/_form.html.haml +1 -1
- data/app/views/access_control_entries/_index.html.haml +3 -3
- data/app/views/access_control_entries/_show.html.haml +1 -1
- data/app/views/external_links/_fields_for.html.haml +2 -0
- data/app/views/external_links/_form.html.haml +18 -0
- data/app/views/external_links/_show.html.haml +7 -0
- data/app/views/external_links/edit.html.haml +7 -0
- data/app/views/external_links/index.html.haml +23 -0
- data/app/views/external_links/new.html.haml +5 -0
- data/app/views/external_links/show.html.haml +2 -0
- data/app/views/feedback_mailer/submit_feedback.html.haml +22 -0
- data/app/views/feedbacks/_form.html.haml +37 -0
- data/app/views/feedbacks/index.html.haml +27 -0
- data/app/views/feedbacks/new.html.haml +5 -0
- data/app/views/feedbacks/show.html.haml +19 -0
- data/app/views/layouts/application.html.haml +21 -16
- data/app/views/layouts/bare.html.haml +2 -0
- data/app/views/loadbehind/_view.js.haml +1 -2
- data/app/views/menus/_form.html.haml +13 -0
- data/app/views/menus/edit.html.haml +7 -0
- data/app/views/menus/index.html.haml +19 -0
- data/app/views/menus/new.html.haml +5 -0
- data/app/views/menus/show.html.haml +7 -0
- data/app/views/pages/_child_pages_links.html.haml +1 -1
- data/app/views/pages/_control_panel.html.haml +1 -6
- data/app/views/pages/_form.html.haml +2 -2
- data/app/views/pages/_form_fields.html.haml +7 -2
- data/app/views/pages/_show.html.haml +4 -0
- data/app/views/pages/create.js.haml +2 -1
- data/app/views/pages/destroy.js.haml +3 -0
- data/app/views/pages/edit.js.haml +4 -0
- data/app/views/pages/index.html.haml +4 -2
- data/app/views/pages/index.js.haml +3 -0
- data/app/views/pages/new.js.haml +3 -0
- data/app/views/pages/show.html.haml +2 -10
- data/app/views/pages/show.js.haml +3 -0
- data/app/views/pages/update.js.haml +2 -2
- data/app/views/sitemaps/edit.html.haml +12 -0
- data/app/views/sitemaps/edit.js.erb +0 -0
- data/app/views/sitemaps/index.html.haml +93 -0
- data/app/views/sitemaps/index.json.erb +23 -0
- data/app/views/sitemaps/new.html.haml +8 -0
- data/app/views/sitemaps/new.js.erb +0 -0
- data/app/views/users/edit.html.haml +45 -0
- data/db/migrate/{add_fields_to_users.rb → 0010_add_fields_to_users.rb} +0 -0
- data/db/migrate/{create_blogs.rb → 0020_create_blogs.rb} +0 -0
- data/db/migrate/{create_galleries.rb → 0030_create_galleries.rb} +0 -0
- data/db/migrate/{create_images.rb → 0040_create_images.rb} +0 -0
- data/db/migrate/{create_profiles.rb → 0050_create_profiles.rb} +0 -0
- data/db/migrate/{insert_admin_user_and_roles.rb → 0060_insert_admin_user_and_roles.rb} +0 -0
- data/db/migrate/{create_pages.rb → 0070_create_pages.rb} +0 -0
- data/db/migrate/{create_forums.rb → 0080_create_forums.rb} +0 -0
- data/db/migrate/{create_discussions.rb → 0090_create_discussions.rb} +0 -0
- data/db/migrate/{create_forum_messages.rb → 0100_create_forum_messages.rb} +0 -0
- data/db/migrate/{create_access_control_entries.rb → 0110_create_access_control_entries.rb} +3 -3
- data/db/migrate/{create_attachments.rb → 0120_create_attachments.rb} +0 -4
- data/db/migrate/{create_roles.rb → 0130_create_roles.rb} +0 -0
- data/db/migrate/0140_create_feedbacks.rb +20 -0
- data/db/migrate/0150_create_external_links.rb +14 -0
- data/db/migrate/0160_create_sitemaps.rb +17 -0
- data/db/migrate/0170_create_menus.rb +14 -0
- data/lib/development_mail_interceptor.rb +7 -0
- data/lib/generators/wheels/recipes/wheels.rb +18 -12
- data/lib/wheels/base.rb +7 -0
- data/lib/wheels/routes.rb +8 -3
- data/lib/wheels.rb +2 -0
- data/public/javascripts/jquery-validate/additional-methods.js +259 -0
- data/public/javascripts/jquery-validate/changelog.txt +239 -0
- data/public/javascripts/jquery-validate/jquery.validate.js +1146 -0
- data/public/javascripts/jquery-validate/jquery.validate.min.js +16 -0
- data/public/javascripts/jquery-validate/jquery.validate.pack.js +15 -0
- data/public/javascripts/jquery-validate/lib/jquery-1.4.2.js +6240 -0
- data/public/javascripts/jquery-validate/lib/jquery.form.js +660 -0
- data/public/javascripts/jquery-validate/lib/jquery.js +4376 -0
- data/public/javascripts/jquery-validate/lib/jquery.metadata.js +122 -0
- data/public/javascripts/jquery-validate/localization/messages_ar.js +24 -0
- data/public/javascripts/jquery-validate/localization/messages_bg.js +23 -0
- data/public/javascripts/jquery-validate/localization/messages_cn.js +23 -0
- data/public/javascripts/jquery-validate/localization/messages_cs.js +23 -0
- data/public/javascripts/jquery-validate/localization/messages_da.js +20 -0
- data/public/javascripts/jquery-validate/localization/messages_de.js +20 -0
- data/public/javascripts/jquery-validate/localization/messages_el.js +24 -0
- data/public/javascripts/jquery-validate/localization/messages_es.js +23 -0
- data/public/javascripts/jquery-validate/localization/messages_fa.js +23 -0
- data/public/javascripts/jquery-validate/localization/messages_fi.js +21 -0
- data/public/javascripts/jquery-validate/localization/messages_fr.js +23 -0
- data/public/javascripts/jquery-validate/localization/messages_he.js +23 -0
- data/public/javascripts/jquery-validate/localization/messages_hu.js +20 -0
- data/public/javascripts/jquery-validate/localization/messages_it.js +23 -0
- data/public/javascripts/jquery-validate/localization/messages_kk.js +23 -0
- data/public/javascripts/jquery-validate/localization/messages_lt.js +23 -0
- data/public/javascripts/jquery-validate/localization/messages_lv.js +23 -0
- data/public/javascripts/jquery-validate/localization/messages_nl.js +23 -0
- data/public/javascripts/jquery-validate/localization/messages_no.js +23 -0
- data/public/javascripts/jquery-validate/localization/messages_pl.js +23 -0
- data/public/javascripts/jquery-validate/localization/messages_ptbr.js +23 -0
- data/public/javascripts/jquery-validate/localization/messages_ptpt.js +23 -0
- data/public/javascripts/jquery-validate/localization/messages_ro.js +23 -0
- data/public/javascripts/jquery-validate/localization/messages_ru.js +23 -0
- data/public/javascripts/jquery-validate/localization/messages_se.js +21 -0
- data/public/javascripts/jquery-validate/localization/messages_sk.js +20 -0
- data/public/javascripts/jquery-validate/localization/messages_tr.js +23 -0
- data/public/javascripts/jquery-validate/localization/messages_tw.js +23 -0
- data/public/javascripts/jquery-validate/localization/messages_ua.js +23 -0
- data/public/javascripts/jquery-validate/localization/methods_de.js +12 -0
- data/public/javascripts/jquery-validate/localization/methods_nl.js +9 -0
- data/public/javascripts/jquery-validate/localization/methods_pt.js +9 -0
- data/public/javascripts/jquery-validate/todo +172 -0
- data/public/javascripts/jquery.cookie.js +96 -0
- data/public/javascripts/jquery.filedrop.js +253 -0
- data/public/javascripts/jquery.hotkeys.js +99 -0
- data/public/javascripts/jquery.js +6240 -0
- data/public/javascripts/jquery.jstree.js +3510 -0
- data/public/javascripts/jquery.uploadify.js +26 -0
- data/public/javascripts/jquery.validate.js +1147 -0
- data/public/javascripts/sitemap_jstree.js +329 -0
- data/public/javascripts/swfobject.js +4 -0
- data/public/jstree/_demo/_dump.sql +20 -0
- data/public/jstree/_demo/_inc/__mysql_errors.log +0 -0
- data/public/jstree/_demo/_inc/class._database.php +146 -0
- data/public/jstree/_demo/_inc/class._database_i.php +152 -0
- data/public/jstree/_demo/_inc/class.tree.php +602 -0
- data/public/jstree/_demo/_install.txt +6 -0
- data/public/jstree/_demo/config.php +14 -0
- data/public/jstree/_demo/index.html +262 -0
- data/public/jstree/_demo/server.php +69 -0
- data/public/jstree/_docs/!style.css +37 -0
- data/public/jstree/_docs/_drive.png +0 -0
- data/public/jstree/_docs/_html_data.html +2 -0
- data/public/jstree/_docs/_json_data.json +4 -0
- data/public/jstree/_docs/_search_data.json +6 -0
- data/public/jstree/_docs/_search_result.json +1 -0
- data/public/jstree/_docs/_xml_flat.xml +12 -0
- data/public/jstree/_docs/_xml_nest.xml +18 -0
- data/public/jstree/_docs/checkbox.html +148 -0
- data/public/jstree/_docs/contextmenu.html +120 -0
- data/public/jstree/_docs/cookies.html +96 -0
- data/public/jstree/_docs/core.html +622 -0
- data/public/jstree/_docs/crrm.html +315 -0
- data/public/jstree/_docs/dnd.html +197 -0
- data/public/jstree/_docs/hotkeys.html +81 -0
- data/public/jstree/_docs/html_data.html +174 -0
- data/public/jstree/_docs/index.html +75 -0
- data/public/jstree/_docs/json_data.html +240 -0
- data/public/jstree/_docs/languages.html +138 -0
- data/public/jstree/_docs/search.html +114 -0
- data/public/jstree/_docs/sort.html +84 -0
- data/public/jstree/_docs/syntax/!script.js +2232 -0
- data/public/jstree/_docs/syntax/!style.css +511 -0
- data/public/jstree/_docs/syntax/clipboard.swf +0 -0
- data/public/jstree/_docs/syntax/help.png +0 -0
- data/public/jstree/_docs/syntax/magnifier.png +0 -0
- data/public/jstree/_docs/syntax/page_white_code.png +0 -0
- data/public/jstree/_docs/syntax/page_white_copy.png +0 -0
- data/public/jstree/_docs/syntax/printer.png +0 -0
- data/public/jstree/_docs/syntax/wrapping.png +0 -0
- data/public/jstree/_docs/themeroller.html +98 -0
- data/public/jstree/_docs/themes.html +126 -0
- data/public/jstree/_docs/types.html +173 -0
- data/public/jstree/_docs/ui.html +188 -0
- data/public/jstree/_docs/unique.html +70 -0
- data/public/jstree/_docs/xml_data.html +214 -0
- data/public/jstree/_lib/jquery.cookie.js +96 -0
- data/public/jstree/_lib/jquery.hotkeys.js +99 -0
- data/public/jstree/_lib/jquery.js +6240 -0
- data/public/jstree/jquery.jstree.js +3510 -0
- data/public/jstree/jstree.html +237 -0
- data/public/jstree/themes/apple/bg.jpg +0 -0
- data/public/jstree/themes/apple/d.png +0 -0
- data/public/jstree/themes/apple/dot_for_ie.gif +0 -0
- data/public/jstree/themes/apple/style.css +60 -0
- data/public/jstree/themes/apple/throbber.gif +0 -0
- data/public/jstree/themes/classic/d.png +0 -0
- data/public/jstree/themes/classic/dot_for_ie.gif +0 -0
- data/public/jstree/themes/classic/style.css +59 -0
- data/public/jstree/themes/classic/throbber.gif +0 -0
- data/public/jstree/themes/default/d.gif +0 -0
- data/public/jstree/themes/default/d.png +0 -0
- data/public/jstree/themes/default/style.css +73 -0
- data/public/jstree/themes/default/throbber.gif +0 -0
- data/public/jstree/themes/default-rtl/d.gif +0 -0
- data/public/jstree/themes/default-rtl/d.png +0 -0
- data/public/jstree/themes/default-rtl/dots.gif +0 -0
- data/public/jstree/themes/default-rtl/style.css +83 -0
- data/public/jstree/themes/default-rtl/throbber.gif +0 -0
- data/public/stylesheets/sass/dreamy.sass +21 -56
- data/public/stylesheets/sass/menu.sass +43 -9
- data/public/stylesheets/sass/uploadify.sass +52 -0
- data/public/stylesheets/ui-lightness/images/ui-icons_228ef1_256x240.png +0 -0
- data/public/stylesheets/ui-lightness/jquery-ui-1.8.4.custom.css +549 -0
- data/wheels.gemspec +187 -15
- metadata +188 -16
@@ -0,0 +1,45 @@
|
|
1
|
+
%h1 Change Your Password
|
2
|
+
|
3
|
+
.form
|
4
|
+
= form_for resource do |f|
|
5
|
+
-if resource.errors.any?
|
6
|
+
#errorExplanation
|
7
|
+
%h2= "#{pluralize(resource.errors.count, "error")} prohibited this change:"
|
8
|
+
%ul
|
9
|
+
- resource.errors.full_messages.each do |msg|
|
10
|
+
%li= msg
|
11
|
+
.field
|
12
|
+
.fieldName Old Password:
|
13
|
+
= f.password_field :old_password, :id=>"old_password"
|
14
|
+
.field
|
15
|
+
.fieldName New Password:
|
16
|
+
= f.password_field :password, :id=>"password"
|
17
|
+
.field
|
18
|
+
.fieldName Confirm Password:
|
19
|
+
= f.password_field :password_confirmation
|
20
|
+
.submit= f.submit "Change Password"
|
21
|
+
|
22
|
+
:css
|
23
|
+
.extra_form_data {
|
24
|
+
display: none;
|
25
|
+
}
|
26
|
+
|
27
|
+
= content_for :head do
|
28
|
+
= javascript_include_tag 'jquery.validate'
|
29
|
+
|
30
|
+
|
31
|
+
:javascript
|
32
|
+
var checkingPassword = true;
|
33
|
+
$(function(){
|
34
|
+
jQuery.validator.addMethod("verify_user", function(value, element, params) {
|
35
|
+
//alert($(element).attr('data-verify-user-path'));
|
36
|
+
return $.ajax({
|
37
|
+
async: false,
|
38
|
+
url: $(element).attr('data-verify-user-path')+ '?password='+value
|
39
|
+
}).responseText == "true";
|
40
|
+
}, "Password is incorrect.");
|
41
|
+
|
42
|
+
$('form').validate({onkeyup: function(element) {}});
|
43
|
+
$('#old_password').rules("add", {verify_user : true, alphanumeric: true})
|
44
|
+
});
|
45
|
+
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -1,7 +1,7 @@
|
|
1
1
|
class CreateAccessControlEntries < ActiveRecord::Migration
|
2
2
|
def self.up
|
3
3
|
create_table :access_control_entries do |t|
|
4
|
-
t.string :
|
4
|
+
t.string :resource_type
|
5
5
|
t.integer :resource_id
|
6
6
|
t.integer :user_id
|
7
7
|
t.integer :role_id
|
@@ -10,8 +10,8 @@ class CreateAccessControlEntries < ActiveRecord::Migration
|
|
10
10
|
t.string :serialized_options
|
11
11
|
t.timestamps
|
12
12
|
end
|
13
|
-
add_index :access_control_entries, :
|
14
|
-
add_index :access_control_entries, [:
|
13
|
+
add_index :access_control_entries, :resource_type
|
14
|
+
add_index :access_control_entries, [:resource_type, :resource_id]
|
15
15
|
add_index :access_control_entries, :user_id
|
16
16
|
add_index :access_control_entries, :role_id
|
17
17
|
end
|
@@ -6,12 +6,8 @@ class CreateAttachments < ActiveRecord::Migration
|
|
6
6
|
t.integer :file_file_size
|
7
7
|
t.datetime :file_updated_at
|
8
8
|
t.integer :page_id
|
9
|
-
t.string :resource_class_name
|
10
|
-
t.integer :resource_id
|
11
|
-
|
12
9
|
t.timestamps
|
13
10
|
end
|
14
|
-
add_index :attachments, [:resource_class_name, :resource_id]
|
15
11
|
end
|
16
12
|
|
17
13
|
def self.down
|
File without changes
|
@@ -0,0 +1,20 @@
|
|
1
|
+
class CreateFeedbacks < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table :feedbacks do |t|
|
4
|
+
t.string :name
|
5
|
+
t.string :phone
|
6
|
+
t.string :subject
|
7
|
+
t.boolean :been_read
|
8
|
+
t.string :email
|
9
|
+
t.text :message
|
10
|
+
t.boolean :want_response
|
11
|
+
|
12
|
+
t.timestamps
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.down
|
17
|
+
drop_table :feedbacks
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
@@ -0,0 +1,17 @@
|
|
1
|
+
class CreateSitemaps < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table :sitemaps do |t|
|
4
|
+
t.integer :position
|
5
|
+
t.string :menu_text
|
6
|
+
t.string :resource_type
|
7
|
+
t.integer :resource_id
|
8
|
+
t.integer :parent_id
|
9
|
+
t.timestamps
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.down
|
14
|
+
drop_table :sitemaps
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
@@ -37,20 +37,26 @@ run "git submodule add -b rails3 http://github.com/mislav/will_paginate.git vend
|
|
37
37
|
stategies << lambda do
|
38
38
|
generate "devise:install"
|
39
39
|
generate "devise User"; sleep 1
|
40
|
-
migration_template 'db/migrate/
|
40
|
+
migration_template 'db/migrate/0010_add_fields_to_users.rb', 'db/migrate/add_fields_to_users'
|
41
41
|
generate "acts_as_taggable_on:migration"; sleep 1
|
42
|
+
migration_template 'db/migrate/0020_create_blogs.rb', 'db/migrate/create_blogs'; sleep 1
|
43
|
+
migration_template 'db/migrate/0030_create_galleries.rb', 'db/migrate/create_galleries'; sleep 1
|
44
|
+
migration_template 'db/migrate/0040_create_images.rb', 'db/migrate/create_images'; sleep 1
|
45
|
+
migration_template 'db/migrate/0050_create_profiles.rb', 'db/migrate/create_profiles'; sleep 1
|
46
|
+
migration_template 'db/migrate/0060_insert_admin_user_and_roles.rb', 'db/migrate/insert_admin_user_and_roles'; sleep 1
|
47
|
+
migration_template "db/migrate/0070_create_pages.rb", "db/migrate/create_pages"; sleep 1
|
48
|
+
migration_template "db/migrate/0080_create_forums.rb", "db/migrate/create_forums"; sleep 1
|
49
|
+
migration_template "db/migrate/0090_create_discussions.rb", "db/migrate/create_discussions"; sleep 1
|
50
|
+
migration_template "db/migrate/0100_create_forum_messages.rb", "db/migrate/create_forum_messages"; sleep 1
|
51
|
+
migration_template "db/migrate/0110_create_access_control_entries.rb", "db/migrate/create_access_control_entries"; sleep 1
|
52
|
+
migration_template "db/migrate/0120_create_attachments.rb", "db/migrate/create_attachments"; sleep 1
|
53
|
+
migration_template 'db/migrate/0130_create_roles.rb', 'db/migrate/create_roles'; sleep 1
|
54
|
+
migration_template "db/migrate/0140_create_feedbacks.rb", "db/migrate/create_feedbacks"; sleep 1
|
55
|
+
migration_template "db/migrate/0150_create_external_links.rb", "db/migrate/create_external_links"; sleep 1
|
56
|
+
migration_template "db/migrate/0160_create_sitemaps.rb", "db/migrate/create_sitemaps"; sleep 1
|
57
|
+
migration_template "db/migrate/0170_create_menus.rb", "db/migrate/create_menus"; sleep 1
|
58
|
+
|
42
59
|
|
43
|
-
migration_template "db/migrate/create_access_control_entries.rb", "db/migrate/create_access_control_entries"; sleep 1
|
44
|
-
migration_template "db/migrate/create_attachments.rb", "db/migrate/create_attachments"; sleep 1
|
45
|
-
migration_template 'db/migrate/create_blogs.rb', 'db/migrate/create_blogs'; sleep 1
|
46
|
-
migration_template "db/migrate/create_discussions.rb", "db/migrate/create_discussions"; sleep 1
|
47
|
-
migration_template "db/migrate/create_forums.rb", "db/migrate/create_forums"; sleep 1
|
48
|
-
migration_template 'db/migrate/create_galleries.rb', 'db/migrate/create_galleries'; sleep 1
|
49
|
-
migration_template 'db/migrate/create_images.rb', 'db/migrate/create_images'; sleep 1
|
50
|
-
migration_template "db/migrate/create_pages.rb", "db/migrate/create_pages"; sleep 1
|
51
|
-
migration_template 'db/migrate/create_profiles.rb', 'db/migrate/create_profiles'; sleep 1
|
52
|
-
migration_template 'db/migrate/create_roles.rb', 'db/migrate/create_roles'; sleep 1
|
53
|
-
migration_template 'db/migrate/insert_admin_user_and_roles.rb', 'db/migrate/insert_admin_user_and_roles'; sleep 1
|
54
60
|
plugin 'hassle', :git=>"http://github.com/pedro/hassle.git"
|
55
61
|
|
56
62
|
# create wheels_resources first so that devise_for :users will appear first in routes.rb
|
data/lib/wheels/base.rb
ADDED
data/lib/wheels/routes.rb
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
module ActionDispatch::Routing
|
2
2
|
class Mapper
|
3
3
|
def wheels_resources
|
4
|
-
|
5
|
-
resources :access_control_entries
|
6
|
-
end
|
4
|
+
resources :access_control_entries
|
7
5
|
|
8
6
|
resources :blogs, :path=>"blog"
|
9
7
|
|
8
|
+
resources :external_links
|
9
|
+
|
10
10
|
resources :forums do
|
11
11
|
resources :discussions do
|
12
12
|
resources :forum_messages
|
@@ -19,6 +19,8 @@ module ActionDispatch::Routing
|
|
19
19
|
|
20
20
|
resources :layouts
|
21
21
|
|
22
|
+
resources :menus
|
23
|
+
|
22
24
|
resources :pages do
|
23
25
|
resources :attachments
|
24
26
|
resources :children, :controller=>"pages", :as => "children"
|
@@ -26,6 +28,8 @@ module ActionDispatch::Routing
|
|
26
28
|
|
27
29
|
resource :profile
|
28
30
|
|
31
|
+
resources :sitemaps
|
32
|
+
|
29
33
|
devise_for :users
|
30
34
|
resources :users do
|
31
35
|
resources :blogs, :path=>"blog"
|
@@ -36,6 +40,7 @@ module ActionDispatch::Routing
|
|
36
40
|
end
|
37
41
|
end
|
38
42
|
|
43
|
+
match '/admin' => "sitemaps#index"
|
39
44
|
match "change_password" => "users#edit"
|
40
45
|
match "verify_password" => "users#verify", :format=>:json
|
41
46
|
end
|
data/lib/wheels.rb
CHANGED
@@ -0,0 +1,259 @@
|
|
1
|
+
(function() {
|
2
|
+
|
3
|
+
function stripHtml(value) {
|
4
|
+
// remove html tags and space chars
|
5
|
+
return value.replace(/<.[^<>]*?>/g, ' ').replace(/ | /gi, ' ')
|
6
|
+
// remove numbers and punctuation
|
7
|
+
.replace(/[0-9.(),;:!?%#$'"_+=\/-]*/g,'');
|
8
|
+
}
|
9
|
+
jQuery.validator.addMethod("maxWords", function(value, element, params) {
|
10
|
+
return this.optional(element) || stripHtml(value).match(/\b\w+\b/g).length < params;
|
11
|
+
}, jQuery.validator.format("Please enter {0} words or less."));
|
12
|
+
|
13
|
+
jQuery.validator.addMethod("minWords", function(value, element, params) {
|
14
|
+
return this.optional(element) || stripHtml(value).match(/\b\w+\b/g).length >= params;
|
15
|
+
}, jQuery.validator.format("Please enter at least {0} words."));
|
16
|
+
|
17
|
+
jQuery.validator.addMethod("rangeWords", function(value, element, params) {
|
18
|
+
return this.optional(element) || stripHtml(value).match(/\b\w+\b/g).length >= params[0] && value.match(/bw+b/g).length < params[1];
|
19
|
+
}, jQuery.validator.format("Please enter between {0} and {1} words."));
|
20
|
+
|
21
|
+
})();
|
22
|
+
|
23
|
+
jQuery.validator.addMethod("letterswithbasicpunc", function(value, element) {
|
24
|
+
return this.optional(element) || /^[a-z-.,()'\"\s]+$/i.test(value);
|
25
|
+
}, "Letters or punctuation only please");
|
26
|
+
|
27
|
+
jQuery.validator.addMethod("alphanumeric", function(value, element) {
|
28
|
+
return this.optional(element) || /^\w+$/i.test(value);
|
29
|
+
}, "Letters, numbers, spaces or underscores only please");
|
30
|
+
|
31
|
+
jQuery.validator.addMethod("lettersonly", function(value, element) {
|
32
|
+
return this.optional(element) || /^[a-z]+$/i.test(value);
|
33
|
+
}, "Letters only please");
|
34
|
+
|
35
|
+
jQuery.validator.addMethod("nowhitespace", function(value, element) {
|
36
|
+
return this.optional(element) || /^\S+$/i.test(value);
|
37
|
+
}, "No white space please");
|
38
|
+
|
39
|
+
jQuery.validator.addMethod("ziprange", function(value, element) {
|
40
|
+
return this.optional(element) || /^90[2-5]\d\{2}-\d{4}$/.test(value);
|
41
|
+
}, "Your ZIP-code must be in the range 902xx-xxxx to 905-xx-xxxx");
|
42
|
+
|
43
|
+
jQuery.validator.addMethod("integer", function(value, element) {
|
44
|
+
return this.optional(element) || /^-?\d+$/.test(value);
|
45
|
+
}, "A positive or negative non-decimal number please");
|
46
|
+
|
47
|
+
/**
|
48
|
+
* Return true, if the value is a valid vehicle identification number (VIN).
|
49
|
+
*
|
50
|
+
* Works with all kind of text inputs.
|
51
|
+
*
|
52
|
+
* @example <input type="text" size="20" name="VehicleID" class="{required:true,vinUS:true}" />
|
53
|
+
* @desc Declares a required input element whose value must be a valid vehicle identification number.
|
54
|
+
*
|
55
|
+
* @name jQuery.validator.methods.vinUS
|
56
|
+
* @type Boolean
|
57
|
+
* @cat Plugins/Validate/Methods
|
58
|
+
*/
|
59
|
+
jQuery.validator.addMethod(
|
60
|
+
"vinUS",
|
61
|
+
function(v){
|
62
|
+
if (v.length != 17)
|
63
|
+
return false;
|
64
|
+
var i, n, d, f, cd, cdv;
|
65
|
+
var LL = ["A","B","C","D","E","F","G","H","J","K","L","M","N","P","R","S","T","U","V","W","X","Y","Z"];
|
66
|
+
var VL = [1,2,3,4,5,6,7,8,1,2,3,4,5,7,9,2,3,4,5,6,7,8,9];
|
67
|
+
var FL = [8,7,6,5,4,3,2,10,0,9,8,7,6,5,4,3,2];
|
68
|
+
var rs = 0;
|
69
|
+
for(i = 0; i < 17; i++){
|
70
|
+
f = FL[i];
|
71
|
+
d = v.slice(i,i+1);
|
72
|
+
if(i == 8){
|
73
|
+
cdv = d;
|
74
|
+
}
|
75
|
+
if(!isNaN(d)){
|
76
|
+
d *= f;
|
77
|
+
}
|
78
|
+
else{
|
79
|
+
for(n = 0; n < LL.length; n++){
|
80
|
+
if(d.toUpperCase() === LL[n]){
|
81
|
+
d = VL[n];
|
82
|
+
d *= f;
|
83
|
+
if(isNaN(cdv) && n == 8){
|
84
|
+
cdv = LL[n];
|
85
|
+
}
|
86
|
+
break;
|
87
|
+
}
|
88
|
+
}
|
89
|
+
}
|
90
|
+
rs += d;
|
91
|
+
}
|
92
|
+
cd = rs % 11;
|
93
|
+
if(cd == 10){cd = "X";}
|
94
|
+
if(cd == cdv){return true;}
|
95
|
+
return false;
|
96
|
+
},
|
97
|
+
"The specified vehicle identification number (VIN) is invalid."
|
98
|
+
);
|
99
|
+
|
100
|
+
/**
|
101
|
+
* Return true, if the value is a valid date, also making this formal check dd/mm/yyyy.
|
102
|
+
*
|
103
|
+
* @example jQuery.validator.methods.date("01/01/1900")
|
104
|
+
* @result true
|
105
|
+
*
|
106
|
+
* @example jQuery.validator.methods.date("01/13/1990")
|
107
|
+
* @result false
|
108
|
+
*
|
109
|
+
* @example jQuery.validator.methods.date("01.01.1900")
|
110
|
+
* @result false
|
111
|
+
*
|
112
|
+
* @example <input name="pippo" class="{dateITA:true}" />
|
113
|
+
* @desc Declares an optional input element whose value must be a valid date.
|
114
|
+
*
|
115
|
+
* @name jQuery.validator.methods.dateITA
|
116
|
+
* @type Boolean
|
117
|
+
* @cat Plugins/Validate/Methods
|
118
|
+
*/
|
119
|
+
jQuery.validator.addMethod(
|
120
|
+
"dateITA",
|
121
|
+
function(value, element) {
|
122
|
+
var check = false;
|
123
|
+
var re = /^\d{1,2}\/\d{1,2}\/\d{4}$/;
|
124
|
+
if( re.test(value)){
|
125
|
+
var adata = value.split('/');
|
126
|
+
var gg = parseInt(adata[0],10);
|
127
|
+
var mm = parseInt(adata[1],10);
|
128
|
+
var aaaa = parseInt(adata[2],10);
|
129
|
+
var xdata = new Date(aaaa,mm-1,gg);
|
130
|
+
if ( ( xdata.getFullYear() == aaaa ) && ( xdata.getMonth () == mm - 1 ) && ( xdata.getDate() == gg ) )
|
131
|
+
check = true;
|
132
|
+
else
|
133
|
+
check = false;
|
134
|
+
} else
|
135
|
+
check = false;
|
136
|
+
return this.optional(element) || check;
|
137
|
+
},
|
138
|
+
"Please enter a correct date"
|
139
|
+
);
|
140
|
+
|
141
|
+
jQuery.validator.addMethod("dateNL", function(value, element) {
|
142
|
+
return this.optional(element) || /^\d\d?[\.\/-]\d\d?[\.\/-]\d\d\d?\d?$/.test(value);
|
143
|
+
}, "Vul hier een geldige datum in."
|
144
|
+
);
|
145
|
+
|
146
|
+
jQuery.validator.addMethod("time", function(value, element) {
|
147
|
+
return this.optional(element) || /^([01][0-9])|(2[0123]):([0-5])([0-9])$/.test(value);
|
148
|
+
}, "Please enter a valid time, between 00:00 and 23:59"
|
149
|
+
);
|
150
|
+
|
151
|
+
/**
|
152
|
+
* matches US phone number format
|
153
|
+
*
|
154
|
+
* where the area code may not start with 1 and the prefix may not start with 1
|
155
|
+
* allows '-' or ' ' as a separator and allows parens around area code
|
156
|
+
* some people may want to put a '1' in front of their number
|
157
|
+
*
|
158
|
+
* 1(212)-999-2345
|
159
|
+
* or
|
160
|
+
* 212 999 2344
|
161
|
+
* or
|
162
|
+
* 212-999-0983
|
163
|
+
*
|
164
|
+
* but not
|
165
|
+
* 111-123-5434
|
166
|
+
* and not
|
167
|
+
* 212 123 4567
|
168
|
+
*/
|
169
|
+
jQuery.validator.addMethod("phoneUS", function(phone_number, element) {
|
170
|
+
phone_number = phone_number.replace(/\s+/g, "");
|
171
|
+
return this.optional(element) || phone_number.length > 9 &&
|
172
|
+
phone_number.match(/^(1-?)?(\([2-9]\d{2}\)|[2-9]\d{2})-?[2-9]\d{2}-?\d{4}$/);
|
173
|
+
}, "Please specify a valid phone number");
|
174
|
+
|
175
|
+
jQuery.validator.addMethod('phoneUK', function(phone_number, element) {
|
176
|
+
return this.optional(element) || phone_number.length > 9 &&
|
177
|
+
phone_number.match(/^(\(?(0|\+44)[1-9]{1}\d{1,4}?\)?\s?\d{3,4}\s?\d{3,4})$/);
|
178
|
+
}, 'Please specify a valid phone number');
|
179
|
+
|
180
|
+
jQuery.validator.addMethod('mobileUK', function(phone_number, element) {
|
181
|
+
return this.optional(element) || phone_number.length > 9 &&
|
182
|
+
phone_number.match(/^((0|\+44)7(5|6|7|8|9){1}\d{2}\s?\d{6})$/);
|
183
|
+
}, 'Please specify a valid mobile number');
|
184
|
+
|
185
|
+
// TODO check if value starts with <, otherwise don't try stripping anything
|
186
|
+
jQuery.validator.addMethod("strippedminlength", function(value, element, param) {
|
187
|
+
return jQuery(value).text().length >= param;
|
188
|
+
}, jQuery.validator.format("Please enter at least {0} characters"));
|
189
|
+
|
190
|
+
// same as email, but TLD is optional
|
191
|
+
jQuery.validator.addMethod("email2", function(value, element, param) {
|
192
|
+
return this.optional(element) || /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)*(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i.test(value);
|
193
|
+
}, jQuery.validator.messages.email);
|
194
|
+
|
195
|
+
// same as url, but TLD is optional
|
196
|
+
jQuery.validator.addMethod("url2", function(value, element, param) {
|
197
|
+
return this.optional(element) || /^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)*(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(value);
|
198
|
+
}, jQuery.validator.messages.url);
|
199
|
+
|
200
|
+
// NOTICE: Modified version of Castle.Components.Validator.CreditCardValidator
|
201
|
+
// Redistributed under the the Apache License 2.0 at http://www.apache.org/licenses/LICENSE-2.0
|
202
|
+
// Valid Types: mastercard, visa, amex, dinersclub, enroute, discover, jcb, unknown, all (overrides all other settings)
|
203
|
+
jQuery.validator.addMethod("creditcardtypes", function(value, element, param) {
|
204
|
+
|
205
|
+
if (/[^0-9-]+/.test(value))
|
206
|
+
return false;
|
207
|
+
|
208
|
+
value = value.replace(/\D/g, "");
|
209
|
+
|
210
|
+
var validTypes = 0x0000;
|
211
|
+
|
212
|
+
if (param.mastercard)
|
213
|
+
validTypes |= 0x0001;
|
214
|
+
if (param.visa)
|
215
|
+
validTypes |= 0x0002;
|
216
|
+
if (param.amex)
|
217
|
+
validTypes |= 0x0004;
|
218
|
+
if (param.dinersclub)
|
219
|
+
validTypes |= 0x0008;
|
220
|
+
if (param.enroute)
|
221
|
+
validTypes |= 0x0010;
|
222
|
+
if (param.discover)
|
223
|
+
validTypes |= 0x0020;
|
224
|
+
if (param.jcb)
|
225
|
+
validTypes |= 0x0040;
|
226
|
+
if (param.unknown)
|
227
|
+
validTypes |= 0x0080;
|
228
|
+
if (param.all)
|
229
|
+
validTypes = 0x0001 | 0x0002 | 0x0004 | 0x0008 | 0x0010 | 0x0020 | 0x0040 | 0x0080;
|
230
|
+
|
231
|
+
if (validTypes & 0x0001 && /^(51|52|53|54|55)/.test(value)) { //mastercard
|
232
|
+
return value.length == 16;
|
233
|
+
}
|
234
|
+
if (validTypes & 0x0002 && /^(4)/.test(value)) { //visa
|
235
|
+
return value.length == 16;
|
236
|
+
}
|
237
|
+
if (validTypes & 0x0004 && /^(34|37)/.test(value)) { //amex
|
238
|
+
return value.length == 15;
|
239
|
+
}
|
240
|
+
if (validTypes & 0x0008 && /^(300|301|302|303|304|305|36|38)/.test(value)) { //dinersclub
|
241
|
+
return value.length == 14;
|
242
|
+
}
|
243
|
+
if (validTypes & 0x0010 && /^(2014|2149)/.test(value)) { //enroute
|
244
|
+
return value.length == 15;
|
245
|
+
}
|
246
|
+
if (validTypes & 0x0020 && /^(6011)/.test(value)) { //discover
|
247
|
+
return value.length == 16;
|
248
|
+
}
|
249
|
+
if (validTypes & 0x0040 && /^(3)/.test(value)) { //jcb
|
250
|
+
return value.length == 16;
|
251
|
+
}
|
252
|
+
if (validTypes & 0x0040 && /^(2131|1800)/.test(value)) { //jcb
|
253
|
+
return value.length == 15;
|
254
|
+
}
|
255
|
+
if (validTypes & 0x0080) { //unknown
|
256
|
+
return true;
|
257
|
+
}
|
258
|
+
return false;
|
259
|
+
}, "Please enter a valid credit card number.");
|