caboose-cms 0.9.193 → 0.9.194

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.
Files changed (30) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/caboose/main.js +35 -34
  3. data/app/assets/stylesheets/caboose/login.scss +95 -0
  4. data/app/controllers/caboose/application_controller.rb +1 -1
  5. data/app/controllers/caboose/block_type_categories_controller.rb +25 -2
  6. data/app/controllers/caboose/block_types_controller.rb +34 -35
  7. data/app/controllers/caboose/login_controller.rb +33 -37
  8. data/app/controllers/caboose/pages_controller.rb +2 -7
  9. data/app/controllers/caboose/register_controller.rb +12 -14
  10. data/app/controllers/caboose/users_controller.rb +40 -46
  11. data/app/mailers/caboose/login_mailer.rb +3 -2
  12. data/app/models/caboose/authenticator.rb +2 -2
  13. data/app/models/caboose/block_type_category.rb +4 -2
  14. data/app/models/caboose/schema.rb +4 -2
  15. data/app/views/caboose/block_type_categories/admin_edit.html.erb +43 -0
  16. data/app/views/caboose/block_type_categories/admin_index.html.erb +23 -0
  17. data/app/{assets/javascripts/caboose/testing.js → views/caboose/block_type_categories/admin_new.html.erb} +0 -0
  18. data/app/views/caboose/block_types/admin_edit.html.erb +8 -8
  19. data/app/views/caboose/extras/error.html.erb +1 -1
  20. data/app/views/caboose/login/forgot_password_form.html.erb +38 -51
  21. data/app/views/caboose/login/index.html.erb +41 -64
  22. data/app/views/caboose/login/reset_password_form.html.erb +35 -35
  23. data/app/views/caboose/register/index.html.erb +51 -44
  24. data/lib/caboose/version.rb +1 -1
  25. metadata +6 -8
  26. data/app/assets/javascripts/caboose/cart_old.js +0 -184
  27. data/app/assets/javascripts/caboose/checkout_old.js +0 -151
  28. data/app/assets/javascripts/caboose/product_new.js +0 -306
  29. data/app/assets/javascripts/caboose/product_old.js +0 -324
  30. data/app/assets/stylesheets/caboose/login.css +0 -134
@@ -214,14 +214,16 @@ class Caboose::Schema < Caboose::Utilities::Schema
214
214
  ],
215
215
  Caboose::BlockTypeCategory => [
216
216
  [ :parent_id , :integer ],
217
- [ :name , :string ]
217
+ [ :name , :string ],
218
+ [ :sort_order, :integer ],
219
+ [ :show_in_sidebar, :boolean, { :default => true }]
218
220
  ],
219
221
  Caboose::BlockTypeSource => [
220
222
  [ :name , :string ],
221
223
  [ :url , :string ],
222
224
  [ :token , :string ],
223
225
  [ :priority , :integer, { :default => 0 }],
224
- [ :active , :boolean, { :default => true }],
226
+ [ :active , :boolean, { :default => true }]
225
227
  ],
226
228
  Caboose::BlockTypeSummary => [
227
229
  [ :block_type_source_id , :integer ],
@@ -0,0 +1,43 @@
1
+ <h1>Edit Block Type Category</h1>
2
+
3
+ <p><div id='blocktypecategory_<%= @btc.id %>_name' ></div></p>
4
+ <p><div id='blocktypecategory_<%= @btc.id %>_parent_id' ></div></p>
5
+ <p><div id='blocktypecategory_<%= @btc.id %>_sort_order' ></div></p>
6
+ <p><div id='blocktypecategory_<%= @btc.id %>_show_in_sidebar' ></div></p>
7
+
8
+ <h5>Blocks</h5>
9
+ <ul>
10
+ <% Caboose::BlockType.where(:block_type_category_id => @btc.id).order(:id).all.each do |bt| %>
11
+ <li><a href="/admin/block-types/<%= bt.id %>"><%= bt.description %></a></li>
12
+ <% end %>
13
+ </ul>
14
+ <br />
15
+
16
+ <a href="/admin/block-type-categories" class="caboose-btn">< Back</a>
17
+
18
+ <% content_for :caboose_css do %>
19
+ <style type='text/css'>
20
+
21
+ </style>
22
+ <% end %>
23
+ <% content_for :caboose_js do %>
24
+ <%= javascript_include_tag "caboose/model/all" %>
25
+ <script type="text/javascript">
26
+
27
+ $(document).ready(function() {
28
+ new ModelBinder({
29
+ name: 'BlockTypeCategory',
30
+ id: <%= @btc.id %>,
31
+ update_url: '/admin/block-type-categories/<%= @btc.id %>',
32
+ authenticity_token: '<%= form_authenticity_token %>',
33
+ attributes: [
34
+ { name: 'name' , nice_name: 'Name', type: 'text' , value: <%= raw Caboose.json(@btc.name) %>, width: 400 },
35
+ { name: 'parent_id' , nice_name: 'Parent', type: 'text' , value: <%= raw Caboose.json(@btc.parent_id) %>, width: 400 },
36
+ { name: 'sort_order' , nice_name: 'Sort Order', type: 'text' , value: <%= raw Caboose.json(@btc.sort_order) %>, width: 400 },
37
+ { name: 'show_in_sidebar' , nice_name: 'Show in Sidebar', type: 'checkbox' , value: <%= raw Caboose.json(@btc.show_in_sidebar) %>, width: 400 }
38
+ ]
39
+ });
40
+ });
41
+
42
+ </script>
43
+ <% end %>
@@ -0,0 +1,23 @@
1
+ <h1>Block Type Categories</h1>
2
+
3
+ <ul>
4
+ <% @btc.each do |btc| %>
5
+ <li>
6
+ <a href="/admin/block-type-categories/<%= btc.id %>"><%= btc.name %></a>
7
+ <ul>
8
+ <% btc.children.each do |btc2| %>
9
+ <li>
10
+ <a href="/admin/block-type-categories/<%= btc2.id %>"><%= btc2.name %></a>
11
+ <ul>
12
+ <% btc2.children.each do |btc3| %>
13
+ <li>
14
+ <a href="/admin/block-type-categories/<%= btc3.id %>"><%= btc3.name %></a>
15
+ </li>
16
+ <% end %>
17
+ </ul>
18
+ </li>
19
+ <% end %>
20
+ </ul>
21
+ </li>
22
+ <% end %>
23
+ </ul>
@@ -25,17 +25,17 @@ bt = @block_type
25
25
  <p><div id='blocktype_<%= bt.id %>_default' ></div></p>
26
26
  <p><div id='blocktype_<%= bt.id %>_width' ></div></p>
27
27
  <p><div id='blocktype_<%= bt.id %>_height' ></div></p>
28
- <p><div id='blocktype_<%= bt.id %>_fixed_placeholder' ></div></p>
28
+ <!-- <p><div id='blocktype_<%= bt.id %>_fixed_placeholder' ></div></p> -->
29
29
  <p><div id='blocktype_<%= bt.id %>_options_url' ></div></p>
30
30
  <p><div id='blocktype_<%= bt.id %>_options' ></div></p>
31
- <p><div id='blocktype_<%= bt.id %>_is_global' ></div></p>
31
+ <!-- <p><div id='blocktype_<%= bt.id %>_is_global' ></div></p> -->
32
32
  <p><div id='blocktype_<%= bt.id %>_use_render_function' ></div></p>
33
33
  <p><div id='blocktype_<%= bt.id %>_use_render_function_for_layout' ></div></p>
34
34
  <p><div id='blocktype_<%= bt.id %>_use_js_for_modal' ></div></p>
35
35
  <p><div id='blocktype_<%= bt.id %>_allow_child_blocks' ></div></p>
36
36
  <p><div id='blocktype_<%= bt.id %>_default_child_block_type_id' ></div></p>
37
- <p><div id='blocktype_<%= bt.id %>_default_constrain' ></div></p>
38
- <p><div id='blocktype_<%= bt.id %>_default_full_width' ></div></p>
37
+ <!-- <p><div id='blocktype_<%= bt.id %>_default_constrain' ></div></p>
38
+ <p><div id='blocktype_<%= bt.id %>_default_full_width' ></div></p> -->
39
39
  <p><div id='blocktype_<%= bt.id %>_default_included' ></div></p>
40
40
  <p>
41
41
 
@@ -100,7 +100,7 @@ $(document).ready(function() {
100
100
  { name: 'description' , sort: 'description' , show: true , bulk_edit: false, nice_name: 'Description' , type: 'text' , value: function(bt) { return bt.description; }, width: 400 },
101
101
  { name: 'field_type' , sort: 'field_type' , show: true , bulk_edit: false, nice_name: 'Field type' , type: 'select' , value: function(bt) { return bt.field_type; }, width: 400, options_url: '/admin/block-types/field-type-options' },
102
102
  { name: 'block_type_category_id' , sort: 'block_type_category_id' , show: false , bulk_edit: false, nice_name: 'Category' , type: 'select' , value: function(bt) { return bt.block_type_category_id; }, width: 400, options_url: '/admin/block-type-categories/tree-options' },
103
- { name: 'is_global' , sort: 'is_global' , show: false , bulk_edit: false, nice_name: 'Global' , type: 'checkbox' , value: function(bt) { return bt.is_global; }, text: function(bt) { return bt.is_global ? 'Yes' : 'No' }, width: 400 },
103
+ // { name: 'is_global' , sort: 'is_global' , show: false , bulk_edit: false, nice_name: 'Global' , type: 'checkbox' , value: function(bt) { return bt.is_global; }, text: function(bt) { return bt.is_global ? 'Yes' : 'No' }, width: 400 },
104
104
  { name: 'use_render_function' , sort: 'use_render_function' , show: true , bulk_edit: false, nice_name: 'Use Render Function' , type: 'checkbox' , value: function(bt) { return bt.use_render_function; }, text: function(bt) { return bt.use_render_function ? 'Yes' : 'No' }, width: 400 },
105
105
  { name: 'use_render_function_for_layout' , sort: 'use_render_function_for_layout' , show: true , bulk_edit: false, nice_name: 'Use Render Function for Modal' , type: 'checkbox' , value: function(bt) { return bt.use_render_function_for_layout; }, text: function(bt) { return bt.use_render_function_for_layout ? 'Yes' : 'No' }, width: 400 },
106
106
  { name: 'use_js_for_modal' , sort: 'use_js_for_modal' , show: true , bulk_edit: false, nice_name: 'Use JS for Modal' , type: 'checkbox' , value: function(bt) { return bt.use_js_for_modal; }, text: function(bt) { return bt.use_js_for_modal ? 'Yes' : 'No' }, width: 400 },
@@ -109,9 +109,9 @@ $(document).ready(function() {
109
109
  { name: 'default' , sort: 'default' , show: false , bulk_edit: false, nice_name: 'Default value' , type: 'text' , value: function(bt) { return bt.default; }, width: 400 },
110
110
  { name: 'width' , sort: 'width' , show: false , bulk_edit: false, nice_name: 'Width' , type: 'text' , value: function(bt) { return bt.width; }, width: 400 },
111
111
  { name: 'height' , sort: 'height' , show: false , bulk_edit: false, nice_name: 'Height' , type: 'text' , value: function(bt) { return bt.height; }, width: 400 },
112
- { name: 'fixed_placeholder' , sort: 'fixed_placeholder' , show: false , bulk_edit: false, nice_name: 'Fixed placeholder' , type: 'checkbox' , value: function(bt) { return bt.fixed_placeholder; }, text: function(bt) { return bt.fixed_placeholder ? 'Yes' : 'No' }, width: 400 },
113
- { name: 'default_constrain' , sort: 'default_constrain' , show: false , bulk_edit: false, nice_name: 'Constrain by Default' , type: 'checkbox' , value: function(bt) { return bt.default_constrain; }, text: function(bt) { return bt.default_constrain ? 'Yes' : 'No' }, width: 400 },
114
- { name: 'default_full_width' , sort: 'default_full_width' , show: false , bulk_edit: false, nice_name: 'Full Width by Default' , type: 'checkbox' , value: function(bt) { return bt.default_full_width; }, text: function(bt) { return bt.default_full_width ? 'Yes' : 'No' }, width: 400 },
112
+ // { name: 'fixed_placeholder' , sort: 'fixed_placeholder' , show: false , bulk_edit: false, nice_name: 'Fixed placeholder' , type: 'checkbox' , value: function(bt) { return bt.fixed_placeholder; }, text: function(bt) { return bt.fixed_placeholder ? 'Yes' : 'No' }, width: 400 },
113
+ // { name: 'default_constrain' , sort: 'default_constrain' , show: false , bulk_edit: false, nice_name: 'Constrain by Default' , type: 'checkbox' , value: function(bt) { return bt.default_constrain; }, text: function(bt) { return bt.default_constrain ? 'Yes' : 'No' }, width: 400 },
114
+ // { name: 'default_full_width' , sort: 'default_full_width' , show: false , bulk_edit: false, nice_name: 'Full Width by Default' , type: 'checkbox' , value: function(bt) { return bt.default_full_width; }, text: function(bt) { return bt.default_full_width ? 'Yes' : 'No' }, width: 400 },
115
115
  { name: 'options_url' , sort: 'options_url' , show: false , bulk_edit: false, nice_name: 'Options URL' , type: 'text' , value: function(bt) { return bt.options_url; }, width: 400 },
116
116
  { name: 'options_function' , sort: 'options_function' , show: false , bulk_edit: false, nice_name: 'Options Function' , type: 'textarea' , value: function(bt) { return bt.options_function; }, width: 400, height: 100 },
117
117
  { name: 'options' , sort: 'options' , show: false , bulk_edit: false, nice_name: 'Options' , type: 'textarea' , value: function(bt) { return bt.options; }, width: 400, height: 100 }
@@ -1,3 +1,3 @@
1
1
  <h1>Error</h1>
2
2
  <p class='note error'><%= @error %></p>
3
- <p><a href="/modal/login?logout=1&return_url=<%= @return_url %>">Login as a different user</a></p>
3
+ <p><a href="/login?logout=1&return_url=<%= @return_url %>">Login as a different user</a></p>
@@ -1,59 +1,46 @@
1
-
2
- <form action='/login/forgot-password' method='post' id='forgot_form'>
3
- <h1>Forgot Password</h1>
4
- <div id='content3'>
1
+ <div class="caboose-login-wrapper">
2
+ <div class="caboose-login-form-wrapper">
3
+ <h5>Forgot Password</h5>
5
4
  <p>Enter your username or email address and we'll send you a link that lets you reset your password.</p>
6
- <input type='hidden' name='return_url' value='<%= @return_url %>' />
7
- <input type='text' name='username' id='username' placeholder='Login or email' />
8
- <div id='message'></div>
9
- <p>
10
- <input type='button' id='btn_cancel' value='Cancel' onclick="parent.$.fn.colorbox.close();" />
11
- <input type='submit' id='btn_login' value='Help Me Remember' onclick='send_forgot_password_link(); return false;' />
12
- </p>
5
+ <form action="/login/forgot-password" method="POST" id="caboose-login-form">
6
+ <div class="field">
7
+ <label for="caboose-login-username">Username or Email Address</label>
8
+ <input type="text" name="username" id="caboose-login-username" />
9
+ </div>
10
+ <input type="hidden" name="return_url" value="<%= @return_url %>" />
11
+ <div class="caboose-links">
12
+ <% if @site.allow_self_registration %>
13
+ <a href="/register?return_url=<%= @return_url %>">Create an account</a>
14
+ <% end %>
15
+ <a href="/login?return_url=<%= @return_url %>" class="caboose-forgot-password">Back to login</a>
16
+ </div>
17
+ <input type="submit" class="btn" id="caboose-login-btn" value="Reset Password" onclick="caboose_user_forgot();return false;" />
18
+ </form>
19
+ <div id="caboose-login-message"></div>
13
20
  </div>
14
- </form>
21
+ </div>
15
22
 
16
- <% content_for :caboose_css do %>
17
- <style type="text/css">
18
- #modal_content input[type="checkbox"] { position: relative; }
19
- </style>
23
+ <% content_for :css do %>
24
+ <%= stylesheet_link_tag 'caboose/login' %>
20
25
  <% end %>
21
- <% content_for :caboose_js do %>
22
- <script type='text/javascript'>
23
-
24
- var modal = false;
25
- $(window).load(function() {
26
- modal = new CabooseModal(400);
27
- });
28
26
 
29
- function send_forgot_password_link()
27
+ <% content_for :js do %>
28
+ <script type="text/javascript">
29
+ function caboose_user_forgot()
30
30
  {
31
- modal.autosize("<p class='loading'>Retrieving info...</p>");
32
- $.ajax({
33
- url: '/login/forgot-password',
34
- type: 'post',
35
- data: $('#forgot_form').serialize(),
36
- success: function(resp) {
37
- if (resp.error) modal.autosize("<p class='note error'>" + resp.error + "</p>");
38
- if (resp.success)
39
- {
40
- //modal.autosize("<p class='note success'>" + resp.success + "</p>");
41
- var div = $('<div/>')
42
- .append($('<p/>').addClass('note success').html(resp.success))
43
- .append($('<p/>').append($('<input/>').attr('type', 'button').val('Close').click(function() { modal.close(); })));
44
- $('#content3').empty().append(div);
45
- modal.autosize();
46
- }
47
- //if (resp.redirect != false) <%= @modal ? "" : "parent." %>window.location = resp.redirect;
48
- //else parent.location.reload(true);
49
- },
50
- error: function() {
51
- modal.autosize("<p class='note error'>Error</p>");
52
- }
53
- });
31
+ $('#caboose-login-message').html("<p class='note loading'>Retrieving your account...</p>");
32
+ $.ajax({
33
+ url: '/login/forgot-password',
34
+ type: 'post',
35
+ data: $('#caboose-login-form').serialize(),
36
+ success: function(resp) {
37
+ if (resp.error) $('#caboose-login-message').html("<p class='note error'>" + resp.error + "</p>");
38
+ else if (resp.success) {
39
+ $('#caboose-login-form').slideUp();
40
+ $('#caboose-login-message').html("<p class='note success'>" + resp.success + "</p>");
41
+ }
42
+ }
43
+ });
54
44
  }
55
45
  </script>
56
- <% end %>
57
- <%= content_for :caboose_css do %>
58
- <%= stylesheet_link_tag "caboose/login", :media => "all" %>
59
- <% end %>
46
+ <% end %>
@@ -1,70 +1,47 @@
1
- <form action="/login" method="post" id="login-form">
2
- <div class="header">
3
- <% if @site.logo && !@site.logo.url.include?('placehold') %>
4
- <img src='<%= @site.logo.url(:thumb) %>' alt="<%= @site.description %>" />
5
- <% else %>
6
- <img src="/assets/caboose/caboose_logo.png" alt="Caboose">
7
- <h1>caboose</h1>
8
- <p>Coo Coo Ca Choo</p>
9
- <% end %>
10
- </div>
11
-
12
- <input type="hidden" name="return_url" value="<%= @return_url %>" />
13
- <input type="text" name="username" id="username" placeholder="Login or email" />
14
- <input type="password" name="password" id="password" placeholder="Password" />
15
-
16
- <label>
17
- <input type="checkbox" name="remember" id="remember" value="1" checked="true" /> Remember me
18
- </label>
19
-
20
- <ul id="login-options">
21
- <% if @site.allow_self_registration %><li><a href="/register?return_url=<%= @return_url %>" class='register'>Need to register?</a></li><% end %>
22
- <li><a href="/login/forgot-password?return_url=<%= @return_url %>" class='forgot'>Forgot your password?</a></li>
23
- </ul>
24
- <div style='clear: both;' id="message"></div>
25
- <p class="buttons">
26
- <input type="button" class="btn" value="Cancel" onclick="parent.$.fn.colorbox.close();" />
27
- <input type="submit" class="btn" value="Login" onclick='login(); return false;' />
28
- </p>
29
- </form>
1
+ <div class="caboose-login-wrapper">
2
+ <div class="caboose-login-form-wrapper">
3
+ <h5>User Login</h5>
4
+ <form action="/login" method="POST" id="caboose-login-form">
5
+ <div class="field">
6
+ <label for="caboose-login-username">Username or Email Address</label>
7
+ <input type="text" name="username" id="caboose-login-username" />
8
+ </div>
9
+ <div class="field">
10
+ <label for="caboose-login-password">Password</label>
11
+ <input type="password" name="password" id="caboose-login-password" />
12
+ </div>
13
+ <input type="hidden" name="return_url" value="<%= @return_url %>" />
14
+ <div class="caboose-links">
15
+ <% if @site.allow_self_registration %>
16
+ <a href="/register?return_url=<%= @return_url %>">Create an account</a>
17
+ <% end %>
18
+ <a href="/login/forgot-password?return_url=<%= @return_url %>">Forgot your password?</a>
19
+ </div>
20
+ <input type="submit" class="btn" id="caboose-login-btn" value="Login" onclick="caboose_user_login();return false;" />
21
+ </form>
22
+ <div id="caboose-login-message"></div>
23
+ </div>
24
+ </div>
30
25
 
31
- <%= content_for :caboose_css do %>
32
- <%= stylesheet_link_tag "caboose/login", media: "all" %>
33
- <style type="text/css">
34
- #modal_content input[type=checkbox] { position: relative; }
35
- </style>
26
+ <% content_for :css do %>
27
+ <%= stylesheet_link_tag 'caboose/login' %>
36
28
  <% end %>
37
29
 
38
- <% content_for :caboose_js do %>
30
+ <% content_for :js do %>
39
31
  <script type="text/javascript">
40
- var modal = false;
41
-
42
- $(window).load(function() {
43
- modal = new CabooseModal(400);
44
- });
45
-
46
- function login() {
47
- modal.autosize("<p class='loading'>Logging in...</p>");
48
-
49
- $.ajax({
50
- url: '/login',
51
- type: 'post',
52
- data: $('#login-form').serialize(),
53
- success: function(response) {
54
- if (response.error) modal.autosize("<p class='note error'>" + response.error + "</p>");
55
- else if (response.redirect != false)
56
- {
57
- if (response.modal)
58
- window.location = response.redirect;
59
- else
60
- parent.window.location = response.redirect;
61
- }
62
- else parent.location.reload(true);
63
- },
64
- error: function() {
65
- modal.autosize("<p class='note error'>Error</p>");
66
- }
67
- });
32
+ function caboose_user_login()
33
+ {
34
+ $('#caboose-login-message').html("<p class='note loading'>Logging in...</p>");
35
+ $.ajax({
36
+ url: '/login',
37
+ type: 'post',
38
+ data: $('#caboose-login-form').serialize(),
39
+ success: function(resp) {
40
+ if (resp.error) $('#caboose-login-message').html("<p class='note error'>" + resp.error + "</p>");
41
+ else if (resp.redirect != false) window.location = resp.redirect;
42
+ else window.location.reload(true);
43
+ }
44
+ });
68
45
  }
69
46
  </script>
70
- <% end %>
47
+ <% end %>
@@ -1,46 +1,46 @@
1
- <h1>Reset Password</h1>
1
+ <div class="caboose-login-wrapper">
2
+ <div class="caboose-login-form-wrapper">
3
+ <% if @user.nil? %>
4
+ <p class='note error'>The given reset ID is invalid.</p>
5
+ <% else %>
6
+ <h5>Reset Password</h5>
7
+ <p>Please enter a new password for your account.</p>
8
+ <form action="/login/reset-password" method="POST" id="caboose-reset-form">
9
+ <input type='hidden' name='id' id='id' value='<%= @reset_id %>' />
10
+ <div class="field">
11
+ <label for="caboose-register-password1">Password</label>
12
+ <input type="password" name="pass1" id="caboose-register-password1" />
13
+ </div>
14
+ <div class="field">
15
+ <label for="caboose-register-password2">Confirm Password</label>
16
+ <input type="password" name="pass2" id="caboose-register-password2" />
17
+ </div>
18
+ <input type="submit" class="btn" id="caboose-login-btn" value="Reset Password" onclick="caboose_user_reset();return false;" />
19
+ </form>
20
+ <div id="caboose-login-message"></div>
21
+ <% end %>
22
+ </div>
23
+ </div>
2
24
 
3
- <% if @user.nil? %>
4
- <p class='note error'>The given reset ID is invalid.</p>
5
- <p class='buttons'><input type='button' value='Close' onclick="parent.window.location='/';" /></p>
6
- <% else %>
7
- <form action='/login/reset-password' method='post' id='reset_password_form'>
8
- <input type='hidden' name='id' id='id' value='<%= @reset_id %>' />
9
- <table cellpadding='4' cellspacing='0' border='0'>
10
- <tr><td>New Password: </td><td><input type='password' name='pass1' id='pass1' style='width: 250px;' /></td></tr>
11
- <tr><td>Confirm: </td><td><input type='password' name='pass2' id='pass2' style='width: 250px;' /></td></tr>
12
- </table><br />
13
- <div id='message'></div>
14
- <p class='buttons'>
15
- <input type='submit' value='Reset Password' onclick='reset_password(); return false;' />
16
- <input type='button' value='Cancel' onclick="window.location='/';" />
17
- </p>
18
- </form>
25
+ <% content_for :css do %>
26
+ <%= stylesheet_link_tag 'caboose/login' %>
19
27
  <% end %>
20
28
 
21
- <%= content_for :caboose_js do %>
22
- <script type='text/javascript'>
23
-
24
- var modal = false;
25
- $(window).load(function() {
26
- modal = new CabooseModal(400);
27
- });
28
-
29
- <% if !@user.nil? %>
30
- function reset_password()
29
+ <% content_for :js do %>
30
+ <script type="text/javascript">
31
+ function caboose_user_reset()
31
32
  {
33
+ $('#caboose-login-message').html("<p class='note loading'>Resetting your password...</p>");
32
34
  $.ajax({
33
35
  url: '/login/reset-password',
34
36
  type: 'post',
35
- data: $('#reset_password_form').serialize(),
37
+ data: $('#caboose-reset-form').serialize(),
36
38
  success: function(resp) {
37
- if (resp.error) modal.autosize("<p class='note error'>" + resp.error + "</p>");
38
- if (resp.redirect) window.location = resp.redirect;
39
- }
39
+ if (resp.error) $('#caboose-login-message').html("<p class='note error'>" + resp.error + "</p>");
40
+ else if (resp.redirect)
41
+ window.location = resp.redirect;
42
+ }
40
43
  });
41
44
  }
42
- <% end %>
43
-
44
45
  </script>
45
- <% end %>
46
-
46
+ <% end %>
@@ -1,49 +1,56 @@
1
+ <div class="caboose-login-wrapper">
2
+ <div class="caboose-login-form-wrapper">
3
+ <h5>Create an Account</h5>
4
+ <form action="/register" method="POST" id="caboose-register-form">
5
+ <div class="field">
6
+ <label for="caboose-register-firstname">First Name</label>
7
+ <input type="text" name="first_name" id="caboose-register-firstname" />
8
+ </div>
9
+ <div class="field">
10
+ <label for="caboose-register-lastname">Last Name</label>
11
+ <input type="text" name="last_name" id="caboose-register-lastname" />
12
+ </div>
13
+ <div class="field">
14
+ <label for="caboose-register-email">Email Address</label>
15
+ <input type="email" name="email" id="caboose-register-email" />
16
+ </div>
17
+ <div class="field">
18
+ <label for="caboose-register-password1">Password</label>
19
+ <input type="password" name="pass1" id="caboose-register-password1" />
20
+ </div>
21
+ <div class="field">
22
+ <label for="caboose-register-password2">Confirm Password</label>
23
+ <input type="password" name="pass2" id="caboose-register-password2" />
24
+ </div>
25
+ <input type="hidden" name="return_url" value="<%= @return_url %>" />
26
+ <div class="caboose-links">
27
+ <a href="/login?return_url=<%= @return_url %>">Login to an existing account</a>
28
+ <a href="/login/forgot-password?return_url=<%= @return_url %>">Forgot your password?</a>
29
+ </div>
30
+ <input type="submit" class="btn" id="caboose-login-btn" value="Register" onclick="caboose_user_register();return false;" />
31
+ </form>
32
+ <div id="caboose-login-message"></div>
33
+ </div>
34
+ </div>
1
35
 
2
- <h1>Register</h1>
3
-
4
- <form action='/register' method='post' id='register_form'>
5
- <p class='other_options'>
6
- <a href='/login?return_url=<%= @return_url %>'>Already a member?</a>
7
- </p>
8
- <input type='hidden' name='return_url' value='<%= @return_url %>' />
9
- <input type='text' name='first_name' id='first_name' placeholder='First name' />
10
- <input type='text' name='last_name' id='last_name' placeholder='Last name' />
11
- <input type='text' name='email' id='email' placeholder='Email address' />
12
- <input type='text' name='phone' id='phone' placeholder='Phone number' />
13
- <input type='password' name='pass1' id='pass1' placeholder='Password' />
14
- <input type='password' name='pass2' id='pass2' placeholder='Confirm password' />
15
- <div id='message'></div>
16
- <p>
17
- <input type='button' id='btn_cancel' value='Cancel' onclick="parent.$.fn.colorbox.close();" />
18
- <input type='submit' id='btn_register' value='Register' onclick='register(); return false;' />
19
- </p>
20
- </form>
36
+ <% content_for :css do %>
37
+ <%= stylesheet_link_tag 'caboose/login' %>
38
+ <% end %>
21
39
 
22
- <% content_for :caboose_js do %>
23
- <script type='text/javascript'>
24
- var modal = new CabooseModal(400);
25
- function register()
40
+ <% content_for :js do %>
41
+ <script type="text/javascript">
42
+ function caboose_user_register()
26
43
  {
27
- modal.autosize("<p class='loading'>Registering...</p>");
28
- $.ajax({
29
- url: '/register',
30
- type: 'post',
31
- data: $('#register_form').serialize(),
32
- success: function(resp) {
33
- if (resp.error)
34
- modal.autosize("<p class='note error'>" + resp.error + "</p>");
35
- else if (resp.redirect != false)
36
- <%= @modal ? "" : "parent." %>window.location = resp.redirect;
37
- else
38
- parent.location.reload(true);
39
- },
40
- error: function() {
41
- modal.autosize("<p class='note error'>Error</p>");
42
- }
43
- });
44
+ $('#caboose-login-message').html("<p class='note loading'>Registering...</p>");
45
+ $.ajax({
46
+ url: '/register',
47
+ type: 'post',
48
+ data: $('#caboose-register-form').serialize(),
49
+ success: function(resp) {
50
+ if (resp.error) $('#caboose-login-message').html("<p class='note error'>" + resp.error + "</p>");
51
+ else if (resp.redirect != false) window.location = resp.redirect;
52
+ }
53
+ });
44
54
  }
45
55
  </script>
46
- <% end %>
47
- <%= content_for :caboose_css do %>
48
- <%= stylesheet_link_tag "caboose/register", :media => "all" %>
49
- <% end %>
56
+ <% end %>