caboose-cms 0.3.50 → 0.3.51

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- OTcxNDc2YWZmMzQ0MmUyMzExYjVkOTM1MDA2ZjcyZTI0YmJhNzMyNw==
4
+ NjExYWU5YWM2ZWUzZTIxODI3ZmE5Mzg4ZTcyZGEzNjQxMzE3MGRkZg==
5
5
  data.tar.gz: !binary |-
6
- MTQ5NzgwOTk3NmU1YjY3ZDg3MWIwZThiNDcxNmI5OTVkYjBhYWZlZA==
6
+ YThhZDViODBjMzMxYWZjNWExNTBlNTNiMjg0ZmFjYmQ1ZWQ5OGI5YQ==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- Yzg3MmRkMjc3YTY3OTliNGViYjVkZjU5ZjFjNDFlMDAxYWNlOTM2MDVlNzA2
10
- MTE1NjA5ZGViNGU0YTY3OTQ2NmY3YTZiNDEzZWEzZjg3OWRjYTBkNzFhYzQ3
11
- NDBiMmVmMzQ0NTNkOGRjYTg3ZWYyYWVkNTQ4ZjFjYWViZDNlYTc=
9
+ NzkxNGZiYWYyYTlhZDhmMTAyNTdhY2M3NDhkODM5ZTFlN2Q0OTBkYjRiZjJm
10
+ MzM1MWI3MDVjMmQwZDIyYjk0ZWM1MTdmM2FiM2U3MDJmY2NmNWQ1NTVhNWNm
11
+ N2Y2ZGFjYzdhNWNkNzUyNWI2NDBkMWQyNGZlMzFkZjNmZjNhNGM=
12
12
  data.tar.gz: !binary |-
13
- MWE0MTkwOWM4ZDE2OTgxNDFkYzQ3MWY0ZmUwOWY0MGI4OTM4Y2EwMTBiODJm
14
- NmM3OWRiM2RkNTRiMTU3OWQ2YTlkOTRmYTEyMzg0YmQ4M2Q4YTYxNzc4YzY4
15
- MjdjZTA1YmVkM2YyMGJjZjcxMzQxOGQzMWQ1NWVkYjcyZGY4NTg=
13
+ ZDgwNjM4ZjNjZDUzNGE5YmQyMmUzOTY3Zjc3OTk2YjliNDBhM2JjNGYxNmU4
14
+ YjhjZDk2NzY2MzEzMTY2NTUwMTQyNmIwYzBkZGU5MzMwY2YzMjJiY2MxZGUz
15
+ MjllMzAyNmRhYzRlMjI2MGZkNDExMzVkN2M3ODcxOGFjYmU5MGQ=
@@ -14,5 +14,5 @@
14
14
  //= require jquery_ujs
15
15
  //= require jquery.ui.all
16
16
  //= require colorbox-rails
17
+ //= require caboose/jquery.placeholder
17
18
  //= require caboose/modal_integration
18
- //= require caboose/placeholder
@@ -10,9 +10,11 @@
10
10
  // WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
11
11
  // GO AFTER THE REQUIRES BELOW.
12
12
  //
13
+ //= require_tree ../../templates
13
14
  //= require jquery
14
15
  //= require jquery_ujs
15
16
  //= require colorbox-rails
17
+ //= require caboose/jquery.detect
18
+ //= require caboose/jquery.placeholder
16
19
  //= require caboose/modal_integration
17
- //= require application
18
- //= require caboose/placeholder
20
+ //= require caboose/main
@@ -0,0 +1,7 @@
1
+ /**
2
+ * jQuery.browser.mobile (http://detectmobilebrowser.com/)
3
+ *
4
+ * jQuery.browser.mobile will be true if the browser is a mobile device
5
+ *
6
+ **/
7
+ (function(a){(jQuery.browser = jQuery.browser || {}).mobile = /(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0,4))})(navigator.userAgent||navigator.vendor||window.opera);
@@ -0,0 +1,126 @@
1
+ //
2
+ // Main
3
+ //
4
+ // :: Initialize
5
+ // :: Events
6
+ // :: Redirect
7
+ // :: Reload
8
+ // :: Login
9
+ // :: Logout
10
+ // :: Register
11
+
12
+ var Caboose = function() {
13
+ var self = this;
14
+
15
+ //
16
+ // Initialize
17
+ //
18
+
19
+ self.initialize = function() {
20
+ self.loggedIn = window.loggedIn || false;
21
+
22
+ $('a[href="/register"], [caboose=register]').click(function(event) {
23
+ event.preventDefault();
24
+ self.register( $(window).width() < 1024 );
25
+ });
26
+
27
+ $('a[href="/login"], [caboose=login]').click(function(event) {
28
+ event.preventDefault();
29
+ self.login( $(window).width() < 1024 );
30
+ });
31
+
32
+ $('a[href="/logout"], [caboose=logout]').click(function(event) {
33
+ event.preventDefault();
34
+ self.logout( $(window).width() < 1024 );
35
+ });
36
+ };
37
+
38
+ //
39
+ // Events
40
+ //
41
+
42
+ self.events = {};
43
+
44
+ self.events.trigger = function(event) {
45
+ $(Caboose.events).trigger(event);
46
+ };
47
+
48
+ self.events.on = function(event, callback) {
49
+ $(Caboose.events).on(event, callback);
50
+ };
51
+
52
+ //
53
+ // Redirect
54
+ //
55
+
56
+ self.redirect = function(url) {
57
+ if (!$.browser.mobile) {
58
+ window.location.href = url;
59
+ } else if ( (navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i)) ) {
60
+ location.replace(url);
61
+ } else if ($.browser.mobile) {
62
+ document.location = url;
63
+ }
64
+ };
65
+
66
+ //
67
+ // Reload
68
+ //
69
+
70
+ self.reload = function() {
71
+ self.redirect(window.location.href);
72
+ };
73
+
74
+ //
75
+ // Login
76
+ //
77
+
78
+ self.login = function() {
79
+ if ($.browser.mobile) window.location.href = '/login?return_url=' + window.location.pathname;
80
+
81
+ $.colorbox({
82
+ href: '/login?return_url=' + window.location.pathname,
83
+ iframe: true,
84
+ innerWidth: 200,
85
+ innerHeight: 50,
86
+ scrolling: false,
87
+ transition: 'fade',
88
+ closeButton: false,
89
+ opacity: 0.50
90
+ });
91
+ };
92
+
93
+ //
94
+ // Logout
95
+ //
96
+
97
+ self.logout = function() {
98
+ window.location = '/logout';
99
+ };
100
+
101
+ //
102
+ // Register
103
+ //
104
+
105
+ self.register = function(callback) {
106
+ if ($.browser.mobile) window.location.href = '/register?return_url=' + window.location.pathname;
107
+
108
+ $.colorbox({
109
+ href: '/register?return_url=' + window.location.pathname,
110
+ iframe: true,
111
+ innerWidth: 200,
112
+ innerHeight: 50,
113
+ scrolling: false,
114
+ transition: 'fade',
115
+ closeButton: false,
116
+ opacity: 0.50
117
+ });
118
+ };
119
+
120
+ // Init and return
121
+ $(document).ready(self.initialize);
122
+ return self;
123
+ };
124
+
125
+ // There can only be one
126
+ var Caboose = new Caboose();
@@ -10,9 +10,10 @@
10
10
  // WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
11
11
  // GO AFTER THE REQUIRES BELOW.
12
12
  //
13
+ //= require_tree ../../templates
13
14
  //= require jquery
14
15
  //= require jquery_ujs
15
16
  //= require colorbox-rails
17
+ //= require caboose/jquery.placeholder
18
+ //= require caboose/jquery.detect
16
19
  //= require caboose/modal_integration
17
- //= require caboose/placeholder
18
-
@@ -16,3 +16,13 @@
16
16
  */
17
17
 
18
18
  #cboxLoadedContent { margin-bottom: 0; }
19
+
20
+ #cboxTopLeft,
21
+ #cboxTopRight,
22
+ #cboxBottomLeft,
23
+ #cboxBottomRight,
24
+ #cboxMiddleLeft,
25
+ #cboxMiddleRight,
26
+ #cboxTopCenter,
27
+ #cboxBottomCenter,
28
+ #cboxClose { background: #111 !important; }
@@ -1,23 +1,46 @@
1
+ /**
2
+ * Login
3
+ */
1
4
 
2
- #login_form .other_options {
3
- position: absolute;
4
- top: -4px;
5
- right: 0;
5
+ #modal_content { margin: 0 auto; }
6
+
7
+ #login-form {
8
+ box-sizing: content-box;
9
+ max-width: 100%;
10
+ overflow: hidden;
11
+ padding: 12px 0;
12
+ position: relative;
13
+ width: 100%;
6
14
  }
7
15
 
8
- input#username,
9
- input#password {
10
- font-size: 18px;
11
- width: 95%;
12
- margin: 0 0 8px 0;
13
- padding: 7px;
16
+ @media all and (max-width: 400px) {
17
+ #login-form {
18
+ width: 400px;
19
+ margin: 0 auto;
20
+ }
14
21
  }
15
22
 
16
- input#btn_login {
17
- font-size: 18px;
23
+ #login-form #login-options {
24
+ margin: 0;
25
+ padding: 0;
26
+ position: absolute;
27
+ top: 12px;
28
+ right: 0;
18
29
  }
19
30
 
20
- input#btn_cancel {
21
- font-size: 18px;
31
+ #login-form input#username,
32
+ #login-form input#password {
33
+ font-size: 18px;
34
+ margin: 0 0 8px 0;
35
+ max-width: 100%;
36
+ padding: 7px;
37
+ width: 386px; /* 400 - 14:padding */
22
38
  }
23
39
 
40
+ #login-form label {
41
+ cursor: pointer;
42
+ display: block;
43
+ }
44
+
45
+ #login-form input[type=checkbox] { top: 8px; }
46
+ #login-form .btn { font-size: 18px; }
@@ -13,6 +13,8 @@
13
13
  *= require caboose/caboose
14
14
  */
15
15
 
16
+ html { width: 100%; }
17
+
16
18
  body {
17
19
  background: #111111;
18
20
  margin: 0;
@@ -29,6 +31,7 @@ body {
29
31
 
30
32
  #modal_content {
31
33
  width: 100%;
34
+ max-width: 100%;
32
35
  padding: 0;
33
36
  }
34
37
 
@@ -317,6 +320,16 @@ Message boxes
317
320
  color: #ffffff;
318
321
  }
319
322
 
323
+ #cboxTopLeft,
324
+ #cboxTopRight,
325
+ #cboxBottomLeft,
326
+ #cboxBottomRight,
327
+ #cboxMiddleLeft,
328
+ #cboxMiddleRight,
329
+ #cboxTopCenter,
330
+ #cboxBottomCenter,
331
+ #cboxClose { background: #111 !important; }
332
+
320
333
  /*******************************************************************************
321
334
  Page Bar Generator
322
335
  *******************************************************************************/
@@ -3,13 +3,16 @@ module Caboose
3
3
 
4
4
  protect_from_forgery
5
5
  before_filter :before_before_action
6
+ helper_method :logged_in?
7
+
6
8
  @find_page = true
7
9
 
8
10
  def before_before_action
9
11
 
10
- # Modify the built-in params array with URL params if necessary
12
+ # Modify the built-in params array with URL params if necessary
11
13
  parse_url_params if Caboose.use_url_params
12
-
14
+
15
+
13
16
  session['use_redirect_urls'] = true if session['use_redirect_urls'].nil?
14
17
 
15
18
  # Initialize AB Testing
@@ -18,11 +21,12 @@ module Caboose
18
21
  # Try to find the page
19
22
  @page = Page.new
20
23
  @crumb_trail = []
21
- @subnav = {}
24
+ @subnav = {}
22
25
  @actions = {}
23
26
  @tasks = {}
24
27
  @page_tasks = {}
25
- @is_real_page = false
28
+ @is_real_page = false
29
+
26
30
  if @find_page
27
31
  @page = Page.page_with_uri(request.fullpath)
28
32
  @crumb_trail = Caboose::Page.crumb_trail(@page)
@@ -30,10 +34,10 @@ module Caboose
30
34
 
31
35
  # Sets an instance variable of the logged in user
32
36
  @logged_in_user = logged_in_user
33
-
37
+
34
38
  before_action
35
39
  end
36
-
40
+
37
41
  # Parses any parameters in the URL and adds them to the params
38
42
  def parse_url_params
39
43
  return if !Caboose.use_url_params
@@ -6,7 +6,7 @@ module Caboose
6
6
  def index
7
7
  @return_url = params[:return_url].nil? ? "/" : params[:return_url]
8
8
  @modal = params[:modal].nil? ? false : params[:modal]
9
- redirect_to @return_url if logged_in?
9
+ redirect_to @return_url and return if logged_in?
10
10
  end
11
11
 
12
12
  # POST /login
@@ -2,6 +2,11 @@ module Caboose
2
2
  class ModalController < Caboose::ApplicationController
3
3
  layout 'caboose/application'
4
4
 
5
+ # GET /modal
6
+ def layout
7
+ render 'layouts/caboose/modal', layout: false
8
+ end
9
+
5
10
  # GET /modal/:url
6
11
  def index
7
12
  @url = "/#{params[:url]}"
@@ -57,6 +57,7 @@ module Caboose
57
57
  @options.each { |key, val| @options[key] = post_get[key].nil? ? val : post_get[key] }
58
58
  #@custom_url_vars = custom_url_vars if !custom_url_vars.nil?
59
59
  @use_url_params = @options['use_url_params'].nil? ? Caboose.use_url_params : @options['use_url_params']
60
+
60
61
  fix_desc
61
62
  set_item_count
62
63
  end
@@ -69,11 +70,13 @@ module Caboose
69
70
  m = @options['model'].constantize
70
71
  return m if @options['includes'].nil?
71
72
 
73
+ # See if any fields that we know have includes have values
72
74
  associations = []
73
75
  @options['includes'].each do |field, arr|
74
76
  next if @params[field].nil? || (@params[field].kind_of?(String) && @params[field].length == 0)
75
77
  associations << arr[0]
76
78
  end
79
+ # See if any fields in the sort option are listed in a table_name.column_name format
77
80
  if @options['sort']
78
81
  @options['sort'].split(',').each do |col|
79
82
  tbl_col = col.split('.')
@@ -84,6 +87,7 @@ module Caboose
84
87
  end
85
88
  end
86
89
  end
90
+ # See if any parameters are listed in a table_name.column_name format
87
91
  @params.each do |k,v|
88
92
  k.split('_concat_').each do |col,v2|
89
93
  tbl_col = col.split('.')
@@ -98,7 +102,8 @@ module Caboose
98
102
  return m
99
103
  end
100
104
 
101
- def table_name_of_association(assoc)
105
+ def table_name_of_association(assoc)
106
+ ap assoc
102
107
  return @options['model'].constantize.reflect_on_association(assoc.to_sym).class_name.constantize.table_name
103
108
  end
104
109
 
@@ -0,0 +1,57 @@
1
+ class Caboose::States
2
+ def self.all
3
+ return {
4
+ 'AL' => 'Alabama',
5
+ 'AK' => 'Alaska',
6
+ 'AZ' => 'Arizona',
7
+ 'AR' => 'Arkansas',
8
+ 'CA' => 'California',
9
+ 'CO' => 'Colorado',
10
+ 'CT' => 'Connecticut',
11
+ 'DE' => 'Delaware',
12
+ 'DC' => 'District of Columbia',
13
+ 'FL' => 'Florida',
14
+ 'GA' => 'Georgia',
15
+ 'HI' => 'Hawaii',
16
+ 'ID' => 'Idaho',
17
+ 'IL' => 'Illinois',
18
+ 'IN' => 'Indiana',
19
+ 'IA' => 'Iowa',
20
+ 'KS' => 'Kansas',
21
+ 'KY' => 'Kentucky',
22
+ 'LA' => 'Louisiana',
23
+ 'ME' => 'Maine',
24
+ 'MT' => 'Montana',
25
+ 'NE' => 'Nebraska',
26
+ 'NV' => 'Nevada',
27
+ 'NH' => 'New Hampshire',
28
+ 'NJ' => 'New Jersey',
29
+ 'NM' => 'New Mexico',
30
+ 'NY' => 'New York',
31
+ 'NC' => 'North Carolina',
32
+ 'ND' => 'North Dakota',
33
+ 'OH' => 'Ohio',
34
+ 'OK' => 'Oklahoma',
35
+ 'OR' => 'Oregon',
36
+ 'MD' => 'Maryland',
37
+ 'MA' => 'Massachusetts',
38
+ 'MI' => 'Michigan',
39
+ 'MN' => 'Minnesota',
40
+ 'MS' => 'Mississippi',
41
+ 'MO' => 'Missouri',
42
+ 'PA' => 'Pennsylvania',
43
+ 'RI' => 'Rhode Island',
44
+ 'SC' => 'South Carolina',
45
+ 'SD' => 'South Dakota',
46
+ 'TN' => 'Tennessee',
47
+ 'TX' => 'Texas',
48
+ 'UT' => 'Utah',
49
+ 'VT' => 'Vermont',
50
+ 'VA' => 'Virginia',
51
+ 'WA' => 'Washington',
52
+ 'WV' => 'West Virginia',
53
+ 'WI' => 'Wisconsin',
54
+ 'WY' => 'Wyoming'
55
+ }
56
+ end
57
+ end
@@ -1,57 +1,67 @@
1
-
2
- <form action='/login' method='post' id='login_form'>
3
- <h1>Login</h1>
4
- <input type='hidden' name='return_url' value='<%= @return_url %>' />
5
- <input type='text' name='username' id='username' placeholder='Login or email' />
6
- <input type='password' name='password' id='password' placeholder='Password' />
7
- <input type='checkbox' name='remember' id='remember' value='1' checked='true' /> Remember me
8
- <ul class='other_options'>
9
- <li><a href='/register?return_url=<%= @return_url %>'>Need to register?</a></li>
10
- <li><a href='/login/forgot-password?return_url=<%= @return_url %>'>Forgot your password?</a></li>
11
- </ul>
12
- <div id='message'></div>
13
- <p class='buttons'>
14
- <input type='button' id='btn_cancel' value='Cancel' onclick="parent.$.fn.colorbox.close();" />
15
- <input type='submit' id='btn_login' value='Login' onclick='login(); return false;' />
16
- </p>
1
+ <form action="/login" method="post" id="login-form">
2
+ <h1>Login</h1>
3
+
4
+ <input type="hidden" name="return_url" value="<%= @return_url %>" />
5
+ <input type="text" name="username" id="username" placeholder="Login or email" />
6
+ <input type="password" name="password" id="password" placeholder="Password" />
7
+
8
+ <label>
9
+ <input type="checkbox" name="remember" id="remember" value="1" checked="true" /> Remember me
10
+ </label>
11
+
12
+ <ul id="login-options">
13
+ <li><a href="/register?return_url=<%= @return_url %>">Need to register?</a></li>
14
+ <li><a href="/login/forgot-password?return_url=<%= @return_url %>">Forgot your password?</a></li>
15
+ </ul>
16
+
17
+ <div id="message"></div>
18
+
19
+ <p class="buttons">
20
+ <input type="button" class="btn" value="Cancel" onclick="parent.$.fn.colorbox.close();" />
21
+ <input type="submit" class="btn" value="Login" onclick='login(); return false;' />
22
+ </p>
17
23
  </form>
18
24
 
19
25
  <% content_for :caboose_css do %>
20
- <style type="text/css">
21
- #modal_content input[type="checkbox"] { position: relative; }
22
- </style>
26
+ <%= stylesheet_link_tag 'caboose/login' %>
27
+
28
+ <style type="text/css">
29
+ #modal_content input[type=checkbox] { position: relative; }
30
+ </style>
23
31
  <% end %>
24
- <% content_for :caboose_js do %>
25
- <script type='text/javascript'>
26
-
27
- var modal = false;
28
- $(window).load(function() {
29
- modal = new CabooseModal(400);
30
- });
31
32
 
32
- function login()
33
- {
34
- modal.autosize("<p class='loading'>Logging in...</p>");
35
- $.ajax({
36
- url: '/login',
37
- type: 'post',
38
- data: $('#login_form').serialize(),
39
- success: function(resp) {
40
- if (resp.error)
41
- modal.autosize("<p class='note error'>" + resp.error + "</p>");
42
- else if (resp.redirect != false)
43
- <%= @modal ? "" : "parent." %>window.location = resp.redirect;
44
- else
45
- parent.location.reload(true);
46
- },
47
- error: function() {
48
- modal.autosize("<p class='note error'>Error</p>");
33
+ <% content_for :caboose_js do %>
34
+ <script type="text/javascript">
35
+ var modal = false;
36
+
37
+ $(window).load(function() {
38
+ modal = new CabooseModal(400);
39
+ });
40
+
41
+ function login() {
42
+ modal.autosize("<p class='loading'>Logging in...</p>");
43
+
44
+ $.ajax({
45
+ url: '/login',
46
+ type: 'post',
47
+ data: $('#login-form').serialize(),
48
+ success: function(response) {
49
+ if (response.error) {
50
+ modal.autosize("<p class='note error'>" + response.error + "</p>");
51
+ } else if (response.redirect != false) {
52
+ <%= @modal ? "" : "parent." %>window.location = response.redirect;
53
+ } else {
54
+ parent.location.reload(true);
55
+ }
56
+ },
57
+ error: function() {
58
+ modal.autosize("<p class='note error'>Error</p>");
59
+ }
60
+ });
49
61
  }
50
- });
51
- }
52
-
53
- </script>
62
+ </script>
54
63
  <% end %>
64
+
55
65
  <%= content_for :caboose_css do %>
56
- <%= stylesheet_link_tag "caboose/login", :media => "all" %>
66
+ <%= stylesheet_link_tag "caboose/login", media: "all" %>
57
67
  <% end %>
@@ -1,21 +1,19 @@
1
1
 
2
2
  <%= content_for :js do %>
3
- <%= javascript_include_tag "caboose/application" %>
4
- <% Caboose::plugin_hook('global_js_assets', []).each do |file| %>
5
- <%= javascript_include_tag file %>
6
- <% end %>
7
- <%= yield :caboose_js %>
3
+ <script>window.loggedIn = <%= logged_in?.to_json %></script>
4
+ <%= javascript_include_tag(*Caboose::javascripts) %>
5
+ <%= yield :caboose_js %>
8
6
  <% end %>
9
7
 
10
8
  <%= content_for :css do %>
11
- <%= stylesheet_link_tag "caboose/application", :media => "all" %>
12
- <%= yield :caboose_css %>
9
+ <%= stylesheet_link_tag(*Caboose::stylesheets) %>
10
+ <%= yield :caboose_css %>
13
11
  <% end %>
14
12
 
15
13
  <% if (File.exists?("#{Rails.root}/app/views/layouts/layout_#{@page.id}.html.erb") || File.exists?("#{Rails.root}/app/views/layouts/layout_#{@page.id}.html.haml")) %>
16
- <%= render :file => "layouts/layout_#{@page.id}" %>
14
+ <%= render :file => "layouts/layout_#{@page.id}" %>
17
15
  <% elsif (!@page.layout.nil? && @page.layout.length > 0 && (File.exists?("#{Rails.root}/app/views/layouts/layout_#{@page.layout}.html.erb") || File.exists?("#{Rails.root}/app/views/layouts/layout_#{@page.layout}.html.haml"))) %>
18
- <%= render :file => "layouts/layout_#{@page.layout}" %>
16
+ <%= render :file => "layouts/layout_#{@page.layout}" %>
19
17
  <% else %>
20
- <%= render :file => "layouts/layout_default" %>
18
+ <%= render :file => "layouts/layout_default" %>
21
19
  <% end %>
@@ -9,6 +9,7 @@
9
9
  <% end %>
10
10
  <%= yield :caboose_css %>
11
11
  <%= csrf_meta_tags %>
12
+ <meta content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0' name='viewport' />
12
13
  </head>
13
14
  <body>
14
15
  <div id='modal_wrapper'>
@@ -5,7 +5,8 @@ Caboose::Engine.routes.draw do
5
5
  get "station" => "station#index"
6
6
  get "station/plugin-count" => "station#plugin_count"
7
7
 
8
- get "modal/:url" => "modal#index", :constraints => {:url => /.*/}
8
+ get "modal" => "modal#layout"
9
+ get "modal/:url" => "modal#index", :constraints => {:url => /.*/}
9
10
 
10
11
  get "login/forgot-password" => "login#forgot_password_form"
11
12
  post "login/forgot-password" => "login#send_reset_email"
@@ -45,5 +45,10 @@ module Caboose
45
45
  # Email settings
46
46
  mattr_accessor :email_from
47
47
  @@email_from = "webmaster@caboosecms.com"
48
-
48
+
49
+ # Define asset collections
50
+ mattr_accessor :javascripts, :stylesheets
51
+ @@javascripts = ['caboose/application']
52
+ @@stylesheets = ['caboose/application']
53
+
49
54
  end
@@ -1,3 +1,3 @@
1
1
  module Caboose
2
- VERSION = '0.3.50'
2
+ VERSION = '0.3.51'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: caboose-cms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.50
4
+ version: 0.3.51
5
5
  platform: ruby
6
6
  authors:
7
7
  - William Barry
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - ~>
25
25
  - !ruby/object:Gem::Version
26
26
  version: 3.2.13
27
+ - !ruby/object:Gem::Dependency
28
+ name: underscore-rails
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ! '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ! '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: jquery-rails
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -108,6 +122,20 @@ dependencies:
108
122
  - - ! '>='
109
123
  - !ruby/object:Gem::Version
110
124
  version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: awesome_print
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ! '>='
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :runtime
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ! '>='
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
111
139
  description: CMS built on rails with love.
112
140
  email:
113
141
  - william@nine.is
@@ -130,6 +158,9 @@ files:
130
158
  - app/assets/javascripts/caboose/admin_page_edit_content.js
131
159
  - app/assets/javascripts/caboose/admin_page_new_blocks.js
132
160
  - app/assets/javascripts/caboose/application.js
161
+ - app/assets/javascripts/caboose/jquery.detect.js
162
+ - app/assets/javascripts/caboose/jquery.placeholder.js
163
+ - app/assets/javascripts/caboose/main.js
133
164
  - app/assets/javascripts/caboose/modal.js
134
165
  - app/assets/javascripts/caboose/modal_integration.js
135
166
  - app/assets/javascripts/caboose/model/all.js
@@ -148,9 +179,9 @@ files:
148
179
  - app/assets/javascripts/caboose/model/model_binder.js
149
180
  - app/assets/javascripts/caboose/model.form.page.js
150
181
  - app/assets/javascripts/caboose/model.form.user.js
151
- - app/assets/javascripts/caboose/placeholder.js
152
182
  - app/assets/javascripts/caboose/shortcut.js
153
183
  - app/assets/javascripts/caboose/station.js
184
+ - app/assets/javascripts/caboose/testing.js
154
185
  - app/assets/javascripts/tinymce/plugins/caboose/plugin.js
155
186
  - app/assets/stylesheets/caboose/admin.css
156
187
  - app/assets/stylesheets/caboose/admin_page_edit_content.css
@@ -167,6 +198,7 @@ files:
167
198
  - app/assets/stylesheets/caboose/station_modal.css
168
199
  - app/assets/stylesheets/caboose/station_sidebar.css
169
200
  - app/assets/stylesheets/caboose/tinymce.css
201
+ - app/assets/templates/caboose/messages/error.jst.ejs
170
202
  - app/controllers/caboose/ab_options_controller.rb
171
203
  - app/controllers/caboose/ab_variants_controller.rb
172
204
  - app/controllers/caboose/admin_controller.rb
@@ -227,6 +259,7 @@ files:
227
259
  - app/models/caboose/role_permission.rb
228
260
  - app/models/caboose/schema.rb
229
261
  - app/models/caboose/setting.rb
262
+ - app/models/caboose/states.rb
230
263
  - app/models/caboose/std_class.rb
231
264
  - app/models/caboose/user.rb
232
265
  - app/models/caboose/utilities/schema.rb