caboose-cms 0.2.4 → 0.2.5
Sign up to get free protection for your applications and to get access to all the features.
- data/app/assets/images/caboose/default_user_pic.png +0 -0
- data/app/assets/images/caboose/loading_green.gif +0 -0
- data/app/assets/javascripts/caboose/bound_input.js +198 -0
- data/app/assets/javascripts/caboose/modal.js +34 -0
- data/app/assets/javascripts/caboose/modal_integration.js +7 -38
- data/app/assets/javascripts/caboose/station.js +47 -193
- data/app/assets/stylesheets/caboose/bound_input.css +1 -0
- data/app/assets/stylesheets/caboose/modal.css +69 -2
- data/app/controllers/caboose/station_controller.rb +5 -1
- data/app/controllers/caboose/users_controller.rb +7 -1
- data/app/models/caboose/page_bar_generator.rb +1 -1
- data/app/models/caboose/user_plugin.rb +4 -2
- data/app/views/caboose/login/index.html.erb +24 -10
- data/app/views/caboose/register/index.html.erb +24 -10
- data/app/views/caboose/station/index.html.erb +19 -15
- data/app/views/caboose/users/edit.html.erb +73 -38
- data/app/views/caboose/users/edit_password.html.erb +34 -0
- data/app/views/caboose/users/index.html.erb +6 -9
- data/config/routes.rb +8 -8
- data/lib/caboose/version.rb +1 -1
- metadata +9 -7
- data/app/assets/javascripts/caboose/login.js +0 -25
- data/app/assets/javascripts/caboose/register.js +0 -29
- data/app/assets/javascripts/caboose/station_modal.js +0 -42
Binary file
|
Binary file
|
@@ -0,0 +1,198 @@
|
|
1
|
+
|
2
|
+
var Model = function(params) {
|
3
|
+
for (var thing in params)
|
4
|
+
this[thing] = params[thing];
|
5
|
+
};
|
6
|
+
|
7
|
+
Model.prototype = {
|
8
|
+
name: false,
|
9
|
+
id: false,
|
10
|
+
attributes: [],
|
11
|
+
attributes_clean: [],
|
12
|
+
update_url: false,
|
13
|
+
|
14
|
+
save: function(attrib, after) {
|
15
|
+
var this2 = this;
|
16
|
+
$.ajax({
|
17
|
+
url: this.update_url,
|
18
|
+
type: 'put',
|
19
|
+
data: attrib + '=' + this.attributes[attrib],
|
20
|
+
success: function(resp) {
|
21
|
+
if (resp.success)
|
22
|
+
{
|
23
|
+
this2.attributes_clean[attrib] = this2.attributes[attrib];
|
24
|
+
if (resp.attributes && resp.attributes[attrib])
|
25
|
+
{
|
26
|
+
this2.attributes[attrib] = resp.attributes[attrib];
|
27
|
+
this2.attributes_clean[attrib] = resp.attributes[attrib];
|
28
|
+
}
|
29
|
+
}
|
30
|
+
after(resp);
|
31
|
+
},
|
32
|
+
error: function() {
|
33
|
+
after(false);
|
34
|
+
}
|
35
|
+
});
|
36
|
+
}
|
37
|
+
};
|
38
|
+
|
39
|
+
/******************************************************************************/
|
40
|
+
|
41
|
+
var BoundControl = function(model, attribute, el) {
|
42
|
+
this.init(model, attribute, el);
|
43
|
+
};
|
44
|
+
|
45
|
+
BoundControl.prototype = {
|
46
|
+
el: false,
|
47
|
+
check: false,
|
48
|
+
message: false,
|
49
|
+
model: false,
|
50
|
+
attribute: false,
|
51
|
+
binder: false,
|
52
|
+
|
53
|
+
init: function(model, attribute, el) {
|
54
|
+
this.model = model;
|
55
|
+
this.attribute = attribute;
|
56
|
+
this.el = el ? el : model.name.toLowerCase() + '_' + model.id + '_' + attribute;
|
57
|
+
this.check = this.el + '_check';
|
58
|
+
this.message = this.el + '_message';
|
59
|
+
|
60
|
+
$('#'+this.el).wrap($('<div/>')
|
61
|
+
.attr('id', this.el + '_container')
|
62
|
+
.css('position', 'relative')
|
63
|
+
);
|
64
|
+
|
65
|
+
var this2 = this;
|
66
|
+
$('#'+this.el).on('focus', function() { this2.edit(); });
|
67
|
+
//$('#'+this.el).keydown(function() {
|
68
|
+
// if (this2.model.attributes[attribute] != this2.model.attributes_clean[attribute])
|
69
|
+
// this2.edit();
|
70
|
+
//});
|
71
|
+
},
|
72
|
+
|
73
|
+
view: function() {
|
74
|
+
if ($('#'+this.check).length) $('#'+this.check).remove();
|
75
|
+
if ($('#'+this.message).length) $('#'+this.message).remove();
|
76
|
+
$('#'+this.el).val(this.model.attributes[this.attribute]);
|
77
|
+
},
|
78
|
+
|
79
|
+
edit: function() {
|
80
|
+
this.binder.cancel_active();
|
81
|
+
this.binder.active_control = this;
|
82
|
+
|
83
|
+
var w = $('#'+this.el).outerWidth();
|
84
|
+
var h = $('#'+this.el).outerHeight();
|
85
|
+
var this2 = this;
|
86
|
+
$('#'+this.el+'_container').prepend($('<div/>')
|
87
|
+
.attr('id', this.el + '_check')
|
88
|
+
.addClass('bound_input_check')
|
89
|
+
.css('position', 'absolute')
|
90
|
+
.css('top', 0)
|
91
|
+
.css('left', w-2)
|
92
|
+
.css('width', h+2)
|
93
|
+
.css('overflow', 'hidden')
|
94
|
+
.append($('<a/>')
|
95
|
+
.html('✓')
|
96
|
+
.css('width', h)
|
97
|
+
.css('margin-left', -h)
|
98
|
+
.attr('href', '#')
|
99
|
+
.click(function(event) {
|
100
|
+
event.preventDefault();
|
101
|
+
this2.save();
|
102
|
+
})
|
103
|
+
)
|
104
|
+
);
|
105
|
+
$('#'+this.el+'_check a').animate({ 'margin-left': 0 }, 300);
|
106
|
+
},
|
107
|
+
|
108
|
+
save: function() {
|
109
|
+
$('#'+this.el+'_check a').addClass('loading');
|
110
|
+
this.model.attributes[this.attribute] = $('#'+this.el).val();
|
111
|
+
|
112
|
+
var this2 = this;
|
113
|
+
this.model.save(this.attribute, function(resp) {
|
114
|
+
$('#'+this2.el+'_check a').removeClass('loading');
|
115
|
+
if (resp.error) this2.error(resp.error);
|
116
|
+
else
|
117
|
+
{
|
118
|
+
this2.binder.active_control = this2;
|
119
|
+
//this2.view();
|
120
|
+
//if ($('#'+this.check).length) $('#'+this.check).remove();
|
121
|
+
//if ($('#'+this.message).length) $('#'+this.message).remove();
|
122
|
+
//$('#'+this.el).val(this.model.attributes[this.attribute]);
|
123
|
+
//$('#'+this2.el).focus();
|
124
|
+
}
|
125
|
+
});
|
126
|
+
},
|
127
|
+
|
128
|
+
cancel: function() {
|
129
|
+
this.model.attributes[this.attribute] = this.model.attributes_clean[this.attribute];
|
130
|
+
$('#'+this.el).val(this.model.attributes[this.attribute]);
|
131
|
+
|
132
|
+
if ($('#'+this.el+'_check a').length)
|
133
|
+
{
|
134
|
+
var this2 = this;
|
135
|
+
var h = $('#'+this.el).outerHeight();
|
136
|
+
$('#'+this.el+'_check a').animate({ 'margin-left': -h }, 300, function() {
|
137
|
+
this2.view();
|
138
|
+
});
|
139
|
+
}
|
140
|
+
else
|
141
|
+
this.view();
|
142
|
+
},
|
143
|
+
|
144
|
+
error: function(str) {
|
145
|
+
if (!$('#'+this.message).length)
|
146
|
+
$('#'+this.el+'_container').prepend($('<div/>').attr('id', this.message));
|
147
|
+
$('#'+this.message).html("<p class='note error'>" + str + "</p>");
|
148
|
+
}
|
149
|
+
};
|
150
|
+
|
151
|
+
/******************************************************************************/
|
152
|
+
|
153
|
+
var ModelBinder = function(params) { this.init(params); };
|
154
|
+
|
155
|
+
ModelBinder.prototype = {
|
156
|
+
model: false,
|
157
|
+
controls: [],
|
158
|
+
active_control: false,
|
159
|
+
|
160
|
+
init: function(params) {
|
161
|
+
this.model = new Model({
|
162
|
+
name: params['name'],
|
163
|
+
id: params['id'],
|
164
|
+
update_url: params['update_url'],
|
165
|
+
attributes: {},
|
166
|
+
attributes_clean: {}
|
167
|
+
});
|
168
|
+
|
169
|
+
var this2 = this;
|
170
|
+
$.each(params['attributes'], function(i, attrib) {
|
171
|
+
var el = (this2.model.name + '_' + this2.model.id + '_' + attrib).toLowerCase();
|
172
|
+
this2.model.attributes[attrib] = $('#'+el).val();
|
173
|
+
this2.model.attributes_clean[attrib] = $('#'+el).val();
|
174
|
+
var control = new BoundControl(this2.model, attrib);
|
175
|
+
control.binder = this2;
|
176
|
+
this2.controls.push();
|
177
|
+
});
|
178
|
+
|
179
|
+
$(document).keyup(function(e) {
|
180
|
+
if (e.keyCode == 27) this2.cancel_active(); // Escape
|
181
|
+
if (e.keyCode == 13) this2.save_active(); // Enter
|
182
|
+
});
|
183
|
+
},
|
184
|
+
|
185
|
+
cancel_active: function() {
|
186
|
+
if (!this.active_control)
|
187
|
+
return;
|
188
|
+
this.active_control.cancel();
|
189
|
+
this.active_control = false;
|
190
|
+
},
|
191
|
+
|
192
|
+
save_active: function() {
|
193
|
+
if (!this.active_control)
|
194
|
+
return;
|
195
|
+
this.active_control.save();
|
196
|
+
this.active_control = false;
|
197
|
+
},
|
198
|
+
};
|
@@ -12,3 +12,37 @@
|
|
12
12
|
//
|
13
13
|
//= require jquery
|
14
14
|
//= require jquery_ujs
|
15
|
+
|
16
|
+
var CabooseModal = function(w, h) {
|
17
|
+
if (!h)
|
18
|
+
{
|
19
|
+
$('#modal_content').css('width', w);
|
20
|
+
h = $('#modal_content').outerHeight(true);
|
21
|
+
}
|
22
|
+
if (parent.$.fn.colorbox)
|
23
|
+
this.resize(w, h);
|
24
|
+
};
|
25
|
+
|
26
|
+
CabooseModal.prototype = {
|
27
|
+
|
28
|
+
width: 0,
|
29
|
+
height: 0,
|
30
|
+
set_width: function(w) { this.width = w; this.colorbox(); },
|
31
|
+
set_height: function(h) { this.height = h; this.colorbox(); },
|
32
|
+
resize: function(w, h) { this.width = w; this.height = h; this.colorbox(); },
|
33
|
+
|
34
|
+
// Resizes the height of the modal based on the content height
|
35
|
+
autosize: function(msg) {
|
36
|
+
if (msg)
|
37
|
+
$('#message').html(msg);
|
38
|
+
this.height = $('#modal_content').outerHeight(true);
|
39
|
+
this.colorbox();
|
40
|
+
},
|
41
|
+
|
42
|
+
colorbox: function() {
|
43
|
+
parent.$.fn.colorbox.resize({
|
44
|
+
innerWidth: '' + this.width + 'px',
|
45
|
+
innerHeight: '' + this.height + 'px'
|
46
|
+
});
|
47
|
+
}
|
48
|
+
};
|
@@ -1,46 +1,12 @@
|
|
1
1
|
|
2
2
|
$(document).ready(function() {
|
3
|
-
$('#caboose_login').colorbox({
|
4
|
-
|
5
|
-
|
6
|
-
initialHeight: 200,
|
7
|
-
innerWidth: 400,
|
8
|
-
innerHeight: 200,
|
9
|
-
scrolling: false,
|
10
|
-
transition: 'fade',
|
11
|
-
closeButton: false,
|
12
|
-
onComplete: fix_colorbox,
|
13
|
-
opacity: 0.50
|
14
|
-
});
|
15
|
-
$('#caboose_register').colorbox({
|
16
|
-
iframe: true,
|
17
|
-
initialWidth: 400,
|
18
|
-
initialHeight: 324,
|
19
|
-
innerWidth: 400,
|
20
|
-
innerHeight: 324,
|
21
|
-
scrolling: false,
|
22
|
-
transition: 'fade',
|
23
|
-
closeButton: false,
|
24
|
-
onComplete: fix_colorbox,
|
25
|
-
opacity: 0.50
|
26
|
-
});
|
27
|
-
$.ajax({
|
28
|
-
url: '/station/plugin-count',
|
29
|
-
success: function (count) {
|
30
|
-
$('#caboose_station').colorbox({
|
31
|
-
iframe: true,
|
32
|
-
innerWidth: 200,
|
33
|
-
innerHeight: count * 50,
|
34
|
-
transition: 'fade',
|
35
|
-
closeButton: false,
|
36
|
-
onComplete: fix_colorbox,
|
37
|
-
opacity: 0.50
|
38
|
-
});
|
39
|
-
}
|
40
|
-
});
|
3
|
+
$('#caboose_login' ).colorbox({ iframe: true, initialWidth: 400, initialHeight: 200, innerWidth: 400, innerHeight: 200, scrolling: false, transition: 'fade', closeButton: false, onComplete: fix_colorbox, opacity: 0.50 });
|
4
|
+
$('#caboose_register' ).colorbox({ iframe: true, initialWidth: 400, initialHeight: 324, innerWidth: 400, innerHeight: 324, scrolling: false, transition: 'fade', closeButton: false, onComplete: fix_colorbox, opacity: 0.50 });
|
5
|
+
$('#caboose_station' ).colorbox({ iframe: true, initialWidth: 200, initialHeight: 50, innerWidth: 200, innerHeight: 50, scrolling: false, transition: 'fade', closeButton: false, onComplete: fix_colorbox, opacity: 0.50 });
|
41
6
|
});
|
42
7
|
|
43
8
|
function fix_colorbox() {
|
9
|
+
var padding = 21; // 21 is default
|
44
10
|
$("#cboxTopLeft" ).css('background', '#111');
|
45
11
|
$("#cboxTopRight" ).css('background', '#111');
|
46
12
|
$("#cboxBottomLeft" ).css('background', '#111');
|
@@ -50,6 +16,9 @@ function fix_colorbox() {
|
|
50
16
|
$("#cboxTopCenter" ).css('background', '#111');
|
51
17
|
$("#cboxBottomCenter" ).css('background', '#111');
|
52
18
|
$("#cboxClose" ).hide();
|
19
|
+
|
20
|
+
//var p = (padding-21)*2;
|
21
|
+
//$("#cboxWrapper" ).css('padding', '0 ' + p + ' ' + p + ' 0');
|
53
22
|
//$('#cboxLoadedContent').css('margin-bottom', 0);
|
54
23
|
//h = $('#cboxLoadedContent').height();
|
55
24
|
//$('#cboxLoadedContent').css('height', ''+(h+28)+'px');
|
@@ -1,204 +1,58 @@
|
|
1
1
|
|
2
|
-
var CabooseStation = function() {
|
2
|
+
var CabooseStation = function(m) {
|
3
|
+
this.modal = m;
|
4
|
+
this.init();
|
5
|
+
};
|
3
6
|
|
4
|
-
CabooseStation =
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
this.
|
14
|
-
$('
|
15
|
-
//alert(this.open_tabs);
|
16
|
-
|
17
|
-
if ($('#caboose_station_wrapper').hasClass('state_left'))
|
7
|
+
CabooseStation.prototype = {
|
8
|
+
|
9
|
+
modal: false,
|
10
|
+
|
11
|
+
init: function()
|
12
|
+
{
|
13
|
+
var this2 = this;
|
14
|
+
// Handle main nav items with subnav
|
15
|
+
$('#station > ul > li > a').click(function(event) {
|
16
|
+
li = $(this).parent();
|
17
|
+
if ($('ul', li).length > 0)
|
18
18
|
{
|
19
|
-
|
20
|
-
|
21
|
-
|
19
|
+
event.preventDefault();
|
20
|
+
id = li.attr('id').replace('nav_item_', '');
|
21
|
+
href = $(this).attr('href');
|
22
|
+
this2.subnav(id, href);
|
22
23
|
}
|
23
|
-
else if ($(
|
24
|
+
else if ($(this).attr('rel') != 'modal')
|
24
25
|
{
|
25
|
-
|
26
|
-
$(
|
27
|
-
this.state = 'right';
|
26
|
+
event.preventDefault();
|
27
|
+
parent.window.location = $(this).attr('href');
|
28
28
|
}
|
29
|
-
|
29
|
+
});
|
30
|
+
$('#station ul li ul li a').click(function(event) {
|
31
|
+
if ($(this).attr('rel') != 'modal')
|
30
32
|
{
|
31
|
-
$('#caboose_station_wrapper').css('right', 0);
|
32
|
-
$('#caboose_station_wrapper').css('width', 0);
|
33
|
-
$('#caboose_station_wrapper').show();
|
34
|
-
this.state = 'min';
|
35
|
-
}
|
36
|
-
},
|
37
|
-
|
38
|
-
attach_dom: function()
|
39
|
-
{
|
40
|
-
var this2 = this;
|
41
|
-
$('#caboose_station li ul.visible').each(function (i,ul) {
|
42
|
-
var id = $(this).parent().attr('id').replace('nav_item_', '');
|
43
|
-
this2.open_tabs[this2.open_tabs.length] = id;
|
44
|
-
});
|
45
|
-
|
46
|
-
$('#caboose_conductor').click(function(event) {
|
47
|
-
event.preventDefault();
|
48
|
-
this2.right();
|
49
|
-
});
|
50
|
-
$('#caboose_station ul.hidden').hide();
|
51
|
-
$('#caboose_station li a.top_level').click(function() {
|
52
|
-
ul = $(this).parent().children("ul.hidden:first");
|
53
|
-
var id = $(this).parent().attr('id').replace('nav_item_', '');
|
54
|
-
if (ul.length)
|
55
|
-
{
|
56
|
-
ul.slideDown(200).addClass('visible').removeClass('hidden');
|
57
|
-
this2.open_tabs[this2.open_tabs.length] = id;
|
58
|
-
}
|
59
|
-
else
|
60
|
-
{
|
61
|
-
ul = $(this).parent().children("ul:first");
|
62
|
-
ul.hide().addClass('hidden').removeClass('visible');
|
63
|
-
|
64
|
-
var index = this2.open_tabs.indexOf(id);
|
65
|
-
if (index > -1)
|
66
|
-
this2.open_tabs.splice(index, 1);
|
67
|
-
}
|
68
|
-
});
|
69
|
-
$('#caboose_station li ul a').each(function(i, a) {
|
70
|
-
var href = $(a).attr('href');
|
71
|
-
$(a).click(function(event) {
|
72
|
-
event.preventDefault();
|
73
|
-
this2.open_url(href);
|
74
|
-
})
|
75
|
-
});
|
76
|
-
$('#caboose_station a.close').click(function(event) {
|
77
|
-
event.preventDefault();
|
78
|
-
|
79
|
-
if (this2.state == 'left')
|
80
|
-
this2.close_url($(this).attr('href'));
|
81
|
-
else if (this2.state == 'right')
|
82
|
-
this2.min();
|
83
|
-
});
|
84
|
-
|
85
|
-
$('#caboose_station li.my_account a').click(function(event) {
|
86
33
|
event.preventDefault();
|
87
|
-
|
88
|
-
});
|
89
|
-
},
|
90
|
-
|
91
|
-
min: function(func_after)
|
92
|
-
{
|
93
|
-
if (this.state == 'min')
|
94
|
-
return;
|
95
|
-
if (!func_after)
|
96
|
-
func_after = function() {};
|
97
|
-
|
98
|
-
// Assume you never go from left to min
|
99
|
-
$('#caboose_station_wrapper').removeClass('state_left state_right').addClass('state_min');
|
100
|
-
$('#caboose_station_wrapper').animate({ width: 0 }, 300);
|
101
|
-
this.state = 'min';
|
102
|
-
},
|
103
|
-
|
104
|
-
left: function(func_after)
|
105
|
-
{
|
106
|
-
if (this.state == 'left')
|
107
|
-
return;
|
108
|
-
if (!func_after)
|
109
|
-
func_after = function() {};
|
110
|
-
|
111
|
-
// Assume you never go from min to left
|
112
|
-
$('#caboose_station_wrapper').removeClass('state_min state_right').addClass('state_left');
|
113
|
-
$('#caboose_station_wrapper').animate({ left: 0 }, 300, func_after);
|
114
|
-
this.state = 'left';
|
115
|
-
},
|
116
|
-
|
117
|
-
right: function(func_after)
|
118
|
-
{
|
119
|
-
if (this.state == 'right')
|
120
|
-
return;
|
121
|
-
if (!func_after)
|
122
|
-
func_after = function() {};
|
123
|
-
|
124
|
-
$('#caboose_station_wrapper').removeClass('state_min state_left').addClass('state_right');
|
125
|
-
if (this.state == 'left')
|
126
|
-
{
|
127
|
-
$('#caboose_station_wrapper').animate({ right: 0 }, 300, func_after);
|
34
|
+
parent.window.location = $(this).attr('href');
|
128
35
|
}
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
36
|
+
});
|
37
|
+
},
|
38
|
+
|
39
|
+
subnav: function(id, href)
|
40
|
+
{
|
41
|
+
this.modal.set_width(400);
|
135
42
|
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
return_url: window.location.pathname
|
147
|
-
},
|
148
|
-
success: function() {
|
149
|
-
if (this2.state == 'left')
|
150
|
-
{
|
151
|
-
window.location = url;
|
152
|
-
return;
|
153
|
-
}
|
154
|
-
|
155
|
-
var w = $(window).width() - $('#caboose_station').width();
|
156
|
-
var h = $(window).height();
|
157
|
-
|
158
|
-
$('#caboose_station_wrapper').after(
|
159
|
-
$('<div/>')
|
160
|
-
.attr('id', 'caboose_white')
|
161
|
-
.css({
|
162
|
-
position: 'absolute',
|
163
|
-
right: 0,
|
164
|
-
top: 0,
|
165
|
-
width: 0,
|
166
|
-
height: h,
|
167
|
-
background: 'url(/assets/loading.gif) 40px 40px no-repeat #fff'
|
168
|
-
})
|
169
|
-
);
|
170
|
-
$('#caboose_station_wrapper').removeClass('state_right').addClass('state_left');
|
171
|
-
$('#caboose_station_wrapper').animate({ left: 0 }, 300, function() { window.location = url; });
|
172
|
-
$('#caboose_white').animate({ width: '+=' + w }, 300);
|
173
|
-
}
|
174
|
-
});
|
175
|
-
},
|
43
|
+
$('#station > ul > li').each(function(i, li) {
|
44
|
+
id2 = $(li).attr('id').replace('nav_item_', '');
|
45
|
+
if (id == id2)
|
46
|
+
$(li).addClass('selected');
|
47
|
+
else
|
48
|
+
$(li).removeClass('selected');
|
49
|
+
});
|
50
|
+
// Show only the selected subnav
|
51
|
+
$('#station ul li ul').hide();
|
52
|
+
$('#station ul li#nav_item_' + id + ' ul').show();
|
176
53
|
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
url: '/admin/station',
|
183
|
-
type: 'put',
|
184
|
-
data: {
|
185
|
-
state: 'right',
|
186
|
-
open_tabs: this2.open_tabs,
|
187
|
-
return_url: false
|
188
|
-
},
|
189
|
-
success: function() {
|
190
|
-
var w = $(window).width() - $('#caboose_station').width();
|
191
|
-
$('#caboose_station_wrapper').removeClass('state_left').addClass('state_right');
|
192
|
-
$('#content_wrapper').animate({ marginLeft: '+=' + w }, 300);
|
193
|
-
$('#caboose_station_wrapper').animate({ left: w }, 300, function() { window.location = url; })
|
194
|
-
}
|
195
|
-
});
|
196
|
-
}
|
197
|
-
});
|
198
|
-
|
199
|
-
/******************************************************************************/
|
200
|
-
|
201
|
-
var caboose_station = false;
|
202
|
-
$(document).ready(function() {
|
203
|
-
caboose_station = new CabooseStation();
|
204
|
-
});
|
54
|
+
// Set the height of the selected subnav
|
55
|
+
var height = $('#station > ul').height();
|
56
|
+
$('#station ul li#nav_item_' + id + ' ul').height(height);
|
57
|
+
}
|
58
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
|
@@ -30,12 +30,14 @@ body {
|
|
30
30
|
|
31
31
|
#modal_content {
|
32
32
|
width: 100%;
|
33
|
+
padding: 0;
|
33
34
|
}
|
34
35
|
|
35
36
|
#modal_content h1 {
|
36
37
|
margin: 0 0 12px 0;
|
37
38
|
padding: 0;
|
38
|
-
font-weight: normal;
|
39
|
+
font-weight: normal;
|
40
|
+
background: #111111;
|
39
41
|
}
|
40
42
|
|
41
43
|
#modal_content a {
|
@@ -63,6 +65,71 @@ input {
|
|
63
65
|
-moz-border-radius: 2px;
|
64
66
|
-webkit-border-radius: 2px;
|
65
67
|
border-radius: 2px;
|
66
|
-
font-size: 20px;
|
67
68
|
padding: 4px 8px;
|
69
|
+
height: 34px;
|
70
|
+
font-size: 20px;
|
71
|
+
z-index: 20;
|
72
|
+
}
|
73
|
+
|
74
|
+
#modal_content .bound_input_check a,
|
75
|
+
#modal_content .bound_input_cancel a {
|
76
|
+
border: 1px solid #ccc;
|
77
|
+
-moz-border-radius: 2px;
|
78
|
+
-webkit-border-radius: 2px;
|
79
|
+
border-radius: 2px;
|
80
|
+
|
81
|
+
font-size: 28px;
|
82
|
+
text-align: center;
|
83
|
+
background: #00cc00;
|
84
|
+
color: #fff;
|
85
|
+
|
86
|
+
display: block;
|
87
|
+
padding: 4px 0;
|
88
|
+
height: 34px;
|
89
|
+
}
|
90
|
+
|
91
|
+
#modal_content .bound_input_check a.loading {
|
92
|
+
background-image: url(/assets/caboose/loading_green.gif);
|
93
|
+
background-color: #00cc00;
|
94
|
+
background-repeat: no-repeat;
|
95
|
+
background-position: 6px 5px;
|
96
|
+
color: rgba(255, 255, 255, 0.0);
|
97
|
+
}
|
98
|
+
|
99
|
+
#modal_content .search_form {
|
100
|
+
position: absolute;
|
101
|
+
top: 0;
|
102
|
+
right: 0;
|
103
|
+
}
|
104
|
+
|
105
|
+
#modal_content table.data th {
|
106
|
+
background: #222222;
|
107
|
+
border: #333 1px solid;
|
108
|
+
color: #fff;
|
109
|
+
}
|
110
|
+
|
111
|
+
#modal_content table.data td {
|
112
|
+
background: #111111;
|
113
|
+
border: #333 1px solid;
|
114
|
+
color: #fff;
|
115
|
+
}
|
116
|
+
|
117
|
+
/*******************************************************************************
|
118
|
+
Modeljs
|
119
|
+
*******************************************************************************/
|
120
|
+
|
121
|
+
#modal_content div.model_attribute_text {
|
122
|
+
color: #fff;
|
123
|
+
}
|
124
|
+
|
125
|
+
#modal_content .model_attribute {
|
126
|
+
background: none repeat scroll 0 0 transparent;
|
127
|
+
display: block;
|
128
|
+
padding: 2px 4px;
|
129
|
+
text-decoration: none;
|
130
|
+
}
|
131
|
+
|
132
|
+
#modal_content .clear {
|
133
|
+
clear: both;
|
134
|
+
line-height: 0;
|
68
135
|
}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
|
2
2
|
module Caboose
|
3
3
|
class UsersController < ApplicationController
|
4
|
-
layout 'caboose/
|
4
|
+
layout 'caboose/modal'
|
5
5
|
|
6
6
|
def before_action
|
7
7
|
@page = Page.page_with_uri('/admin')
|
@@ -39,6 +39,12 @@ module Caboose
|
|
39
39
|
@roles = Role.roles_with_user(@edituser.id)
|
40
40
|
end
|
41
41
|
|
42
|
+
# GET /admin/users/1/edit-password
|
43
|
+
def edit_password
|
44
|
+
return if !user_is_allowed('users', 'edit')
|
45
|
+
@edituser = User.find(params[:id])
|
46
|
+
end
|
47
|
+
|
42
48
|
# POST /admin/users
|
43
49
|
def create
|
44
50
|
return if !user_is_allowed('users', 'add')
|
@@ -133,7 +133,7 @@ module Caboose
|
|
133
133
|
# key = sort field, value = text to display
|
134
134
|
cols.each do |sort, text|
|
135
135
|
desc = @options['sort'] == sort ? (@options['desc'] ? 0 : 1) : 0
|
136
|
-
arrow = @options['sort'] == sort ? (@options['desc'] ? ' &uarr' : ' &darr') : ''
|
136
|
+
arrow = @options['sort'] == sort ? (@options['desc'] ? ' ↑' : ' ↓') : ''
|
137
137
|
link = @options['base_url'] + "?#{vars}&sort=#{sort}&desc=#{desc}"
|
138
138
|
str += "<th><a href='#{link}'>#{text}#{arrow}</a></th>\n"
|
139
139
|
end
|
@@ -12,13 +12,15 @@ class Caboose::UserPlugin < Caboose::CaboosePlugin
|
|
12
12
|
if (user.is_allowed('users', 'view'))
|
13
13
|
item['children'] << {
|
14
14
|
'href' => '/admin/users',
|
15
|
-
'text' => 'View All Users'
|
15
|
+
'text' => 'View All Users',
|
16
|
+
'modal' => true,
|
16
17
|
}
|
17
18
|
end
|
18
19
|
if (user.is_allowed('users', 'add'))
|
19
20
|
item['children'] << {
|
20
21
|
'href' => '/admin/users/new',
|
21
|
-
'text' => 'New User'
|
22
|
+
'text' => 'New User',
|
23
|
+
'modal' => true,
|
22
24
|
}
|
23
25
|
end
|
24
26
|
nav << item
|
@@ -1,12 +1,4 @@
|
|
1
1
|
|
2
|
-
<%= content_for :caboose_js do %>
|
3
|
-
<%= javascript_include_tag "caboose/login" %>
|
4
|
-
<% end %>
|
5
|
-
|
6
|
-
<%= content_for :caboose_css do %>
|
7
|
-
<%= stylesheet_link_tag "caboose/login", :media => "all" %>
|
8
|
-
<% end %>
|
9
|
-
|
10
2
|
<form action='/login' method='post' id='login_form'>
|
11
3
|
<p class='other_options'>
|
12
4
|
<a href='/register'>Need to register?</a>
|
@@ -24,7 +16,29 @@
|
|
24
16
|
|
25
17
|
<% content_for :caboose_js do %>
|
26
18
|
<script type='text/javascript'>
|
27
|
-
|
28
|
-
|
19
|
+
var modal = new CabooseModal(400);
|
20
|
+
function login()
|
21
|
+
{
|
22
|
+
modal.autosize("<p class='loading'>Logging in...</p>");
|
23
|
+
$.ajax({
|
24
|
+
url: '/login',
|
25
|
+
type: 'post',
|
26
|
+
data: $('#login_form').serialize(),
|
27
|
+
success: function(resp) {
|
28
|
+
if (resp.error)
|
29
|
+
modal.autosize("<p class='note error'>" + resp.error + "</p>");
|
30
|
+
else if (resp.redirect != false)
|
31
|
+
parent.window.location = resp.redirect;
|
32
|
+
else
|
33
|
+
parent.location.reload(true);
|
34
|
+
},
|
35
|
+
error: function() {
|
36
|
+
modal.autosize("<p class='note error'>Error</p>");
|
37
|
+
}
|
38
|
+
});
|
39
|
+
}
|
29
40
|
</script>
|
30
41
|
<% end %>
|
42
|
+
<%= content_for :caboose_css do %>
|
43
|
+
<%= stylesheet_link_tag "caboose/login", :media => "all" %>
|
44
|
+
<% end %>
|
@@ -1,12 +1,4 @@
|
|
1
1
|
|
2
|
-
<%= content_for :caboose_js do %>
|
3
|
-
<%= javascript_include_tag "caboose/register" %>
|
4
|
-
<% end %>
|
5
|
-
|
6
|
-
<%= content_for :caboose_css do %>
|
7
|
-
<%= stylesheet_link_tag "caboose/register", :media => "all" %>
|
8
|
-
<% end %>
|
9
|
-
|
10
2
|
<form action='/register' method='post' id='register_form'>
|
11
3
|
<p class='other_options'>
|
12
4
|
<a href='/login'>Already a member?</a>
|
@@ -26,7 +18,29 @@
|
|
26
18
|
|
27
19
|
<% content_for :caboose_js do %>
|
28
20
|
<script type='text/javascript'>
|
29
|
-
|
30
|
-
|
21
|
+
var modal = new CabooseModal(400);
|
22
|
+
function register()
|
23
|
+
{
|
24
|
+
modal.autosize("<p class='loading'>Registering...</p>");
|
25
|
+
$.ajax({
|
26
|
+
url: '/register',
|
27
|
+
type: 'post',
|
28
|
+
data: $('#register_form').serialize(),
|
29
|
+
success: function(resp) {
|
30
|
+
if (resp.error)
|
31
|
+
modal.autosize("<p class='note error'>" + resp.error + "</p>");
|
32
|
+
else if (resp.redirect != false)
|
33
|
+
window.location = resp.redirect;
|
34
|
+
else
|
35
|
+
parent.location.reload(true);
|
36
|
+
},
|
37
|
+
error: function() {
|
38
|
+
modal.autosize("<p class='note error'>Error</p>");
|
39
|
+
}
|
40
|
+
});
|
41
|
+
}
|
31
42
|
</script>
|
32
43
|
<% end %>
|
44
|
+
<%= content_for :caboose_css do %>
|
45
|
+
<%= stylesheet_link_tag "caboose/register", :media => "all" %>
|
46
|
+
<% end %>
|
@@ -1,34 +1,39 @@
|
|
1
|
+
<%
|
2
|
+
@nav = Caboose.plugin_hook('admin_nav', [], @user, @page)
|
3
|
+
return_url = session[:caboose_station_return_url].nil? ? '/' : session[:caboose_station_return_url]
|
4
|
+
return_url = '/' if return_url.starts_with?('/admin/') || return_url == '/admin'
|
5
|
+
%>
|
1
6
|
|
2
7
|
<%= content_for :caboose_js do %>
|
8
|
+
<%= javascript_include_tag "caboose/station" %>
|
3
9
|
<script type='text/javascript'>
|
4
|
-
var
|
10
|
+
var modal = false;
|
11
|
+
var station = false;
|
12
|
+
$(document).ready(function() {
|
13
|
+
modal = new CabooseModal(200);
|
14
|
+
station = new CabooseStation(modal);
|
15
|
+
});
|
5
16
|
</script>
|
6
|
-
<%= javascript_include_tag "caboose/station_modal" %>
|
7
17
|
<% end %>
|
8
18
|
<%= content_for :caboose_css do %>
|
9
19
|
<%= stylesheet_link_tag "caboose/station_modal", :media => "all" %>
|
10
20
|
<% end %>
|
11
21
|
|
12
|
-
<%
|
13
|
-
@nav = Caboose.plugin_hook('admin_nav', [], @user, @page)
|
14
|
-
return_url = session[:caboose_station_return_url].nil? ? '/' : session[:caboose_station_return_url]
|
15
|
-
return_url = '/' if return_url.starts_with?('/admin/') || return_url == '/admin'
|
16
|
-
%>
|
17
|
-
|
18
|
-
<% if (@user.nil? || @user == Caboose::User.logged_out_user) %>
|
19
|
-
<h2>Caboose Station</h2>
|
20
|
-
<a href='/login' class='login'>Login</a>
|
21
|
-
<% else %>
|
22
22
|
<div id='station'>
|
23
23
|
<ul>
|
24
|
+
<li id='nav_item_logout'><a href='/logout'><span class='icon'></span><span class='text'>Logout</span></a>
|
25
|
+
<li id='nav_item_myaccount'><a href='/my-account'><span class='icon'></span><span class='text'>My Account</span></a>
|
24
26
|
<% i = 0 %>
|
25
27
|
<% @nav.each do |item| %>
|
26
28
|
<% id = item['id'].nil? ? i.to_s : item['id'] %>
|
27
|
-
|
29
|
+
<% href = item['href'].nil? ? '#' : item['href'] %>
|
30
|
+
<% modal = item['modal'].nil? ? false : item['modal'] %>
|
31
|
+
<li id='nav_item_<%= id %>'><a href='<%= href %>'<%= raw (modal ? " rel='modal'" : "") %>><span class='icon'></span><span class='text'><%= item['text'] %></span></a>
|
28
32
|
<% if (!item['children'].nil? && item['children'].count > 0) %>
|
29
33
|
<ul style='display: none;'>
|
30
34
|
<% item['children'].each do |item2| %>
|
31
|
-
|
35
|
+
<% modal = item2['modal'].nil? ? false : item2['modal'] %>
|
36
|
+
<li><a href='<%= item2['href'] %>'<%= raw (modal ? " rel='modal'" : "") %>><%= item2['text'] %></a></li>
|
32
37
|
<% end %>
|
33
38
|
</ul>
|
34
39
|
<% end %>
|
@@ -37,4 +42,3 @@ return_url = '/' if return_url.starts_with?('/admin/') || return_url == '/admin'
|
|
37
42
|
<% end %>
|
38
43
|
</ul>
|
39
44
|
</div>
|
40
|
-
<% end %>
|
@@ -1,51 +1,86 @@
|
|
1
|
-
|
1
|
+
<%
|
2
|
+
gravatar_id = Digest::MD5.hexdigest(@edituser.email.downcase)
|
3
|
+
pic = "http://gravatar.com/avatar/#{gravatar_id}.png?s=150" #&d=/assets/caboose/default_user_pic.png"
|
4
|
+
%>
|
2
5
|
<h1>Edit User</h1>
|
3
|
-
<
|
6
|
+
<p id='gravatar'><img src='<%= pic %>' /><a href='http://gravatar.com'>Update on gravatar</a></p>
|
7
|
+
<p><input type='text' id='user_<%= @edituser.id %>_first_name' value="<%= @edituser.first_name %>" placeholder='First name' /></p>
|
8
|
+
<p><input type='text' id='user_<%= @edituser.id %>_last_name' value="<%= @edituser.last_name %>" placeholder='Last name' /></p>
|
9
|
+
<p><input type='text' id='user_<%= @edituser.id %>_username' value="<%= @edituser.username %>" placeholder='Username' /></p>
|
10
|
+
<p><input type='text' id='user_<%= @edituser.id %>_email' value="<%= @edituser.email %>" placeholder='Email' /></p>
|
11
|
+
<div id='message'></div>
|
12
|
+
<div id='controls'>
|
13
|
+
<input type='button' value='Back' onclick="window.location='/admin/users';" />
|
14
|
+
<input type='button' value='Reset Password' onclick="window.location='/admin/users/<%= @edituser.id %>/edit-password';" />
|
15
|
+
<input type='button' value='Delete User' onclick="deleteUser();" />
|
16
|
+
</div>
|
17
|
+
|
18
|
+
<% content_for :caboose_css do %>
|
19
|
+
<style type='text/css'>
|
20
|
+
#gravatar {
|
21
|
+
float: right;
|
22
|
+
width: 150px;
|
23
|
+
text-align: right;
|
24
|
+
margin: 0 4px 0 0;
|
25
|
+
padding: 0;
|
26
|
+
}
|
27
|
+
#gravatar img {
|
28
|
+
border: #fff 2px solid;
|
29
|
+
}
|
30
|
+
</style>
|
31
|
+
<% end %>
|
4
32
|
|
5
33
|
<% content_for :caboose_js do %>
|
6
|
-
<%= javascript_include_tag "caboose/
|
34
|
+
<%= javascript_include_tag "caboose/bound_input.js" %>
|
7
35
|
<script type="text/javascript">
|
8
36
|
|
37
|
+
var model = false;
|
9
38
|
$(document).ready(function() {
|
10
|
-
|
11
|
-
|
39
|
+
|
40
|
+
m = new ModelBinder({
|
12
41
|
name: 'User',
|
13
42
|
id: <%= @edituser.id %>,
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
{ name: 'last_name' , type: 'text', value: "<%= @edituser.last_name %>" },
|
20
|
-
{ name: 'username' , type: 'text', value: "<%= @edituser.username %>" },
|
21
|
-
{ name: 'email' , type: 'text', value: "<%= @edituser.email %>" },
|
22
|
-
{ name: 'password' , type: 'password' },
|
23
|
-
{
|
24
|
-
name: 'roles',
|
25
|
-
type: 'checkbox-multiple',
|
26
|
-
value: <%= @roles.collect{|r| r.id}.to_json %>,
|
27
|
-
text: "<%= @roles.collect{|r| r.name}.join(', ') %>",
|
28
|
-
empty_text: '[No roles]',
|
29
|
-
multiple: true,
|
30
|
-
loading_message: 'Getting roles...',
|
31
|
-
options_url: '/admin/roles/options'
|
32
|
-
},
|
33
|
-
{
|
34
|
-
name: 'pic',
|
35
|
-
type: 'image',
|
36
|
-
value: '',
|
37
|
-
update_url: '/admin/users/<%= @edituser.id %>/update-pic'
|
38
|
-
}
|
39
|
-
]
|
40
|
-
});
|
43
|
+
update_url: '/admin/users/<%= @edituser.id %>',
|
44
|
+
attributes: ['first_name', 'last_name', 'username', 'email']
|
45
|
+
});
|
46
|
+
|
47
|
+
modal = new CabooseModal(500);
|
41
48
|
});
|
42
49
|
|
43
|
-
|
44
|
-
|
50
|
+
// var user = new Model({
|
51
|
+
// form: 'Model.Form.User',
|
52
|
+
// finished_loading: function() {
|
53
|
+
// modal = new CabooseModal(500);
|
54
|
+
// },
|
55
|
+
// name: 'User',
|
56
|
+
// id: <%= @edituser.id %>,
|
57
|
+
// listing_url: 'get /admin/users',
|
58
|
+
// update_url: 'put /admin/users/<%= @edituser.id %>',
|
59
|
+
// delete_url: 'delete /admin/users/<%= @edituser.id %>',
|
60
|
+
// attributes: [
|
61
|
+
// { name: 'first_name' , type: 'text', value: "<%= @edituser.first_name %>", show_reminder: false },
|
62
|
+
// { name: 'last_name' , type: 'text', value: "<%= @edituser.last_name %>", show_reminder: false },
|
63
|
+
// { name: 'username' , type: 'text', value: "<%= @edituser.username %>", show_reminder: false },
|
64
|
+
// { name: 'email' , type: 'text', value: "<%= @edituser.email %>", show_reminder: false },
|
65
|
+
// { name: 'password' , type: 'password' },
|
66
|
+
// {
|
67
|
+
// name: 'roles',
|
68
|
+
// type: 'checkbox-multiple',
|
69
|
+
// value: <%= @roles.collect{|r| r.id}.to_json %>,
|
70
|
+
// text: "<%= @roles.collect{|r| r.name}.join(', ') %>",
|
71
|
+
// empty_text: '[No roles]',
|
72
|
+
// multiple: true,
|
73
|
+
// loading_message: 'Getting roles...',
|
74
|
+
// options_url: '/admin/roles/options'
|
75
|
+
// },
|
76
|
+
// {
|
77
|
+
// name: 'pic',
|
78
|
+
// type: 'image',
|
79
|
+
// value: '',
|
80
|
+
// update_url: '/admin/users/<%= @edituser.id %>/update-pic'
|
81
|
+
// }
|
82
|
+
// ]
|
83
|
+
// });
|
45
84
|
|
46
|
-
<% content_for :caboose_js do %>
|
47
|
-
<script type='text/javascript'>
|
48
|
-
if (parent.$.fn.colorbox)
|
49
|
-
parent.$.fn.colorbox.resize({ 'innerWidth': 600, 'innerHeight': 400 });
|
50
85
|
</script>
|
51
86
|
<% end %>
|
@@ -0,0 +1,34 @@
|
|
1
|
+
|
2
|
+
<h1>Reset Password for <%= "#{@edituser.first_name} #{@edituser.last_name}" %></h1>
|
3
|
+
<p><input type='password' name='password' id='password' value="" placeholder='Password' /></p>
|
4
|
+
<p><input type='password' name='password2' id='password2' value="" placeholder='Confirm password' /></p>
|
5
|
+
<div id='message'></div>
|
6
|
+
<div id='controls'>
|
7
|
+
<input type='button' value='Back' onclick="window.location='/admin/users/<%= @edituser.id %>/edit';" />
|
8
|
+
<input type='button' value='Update Password' onclick="udpatePassword();" />
|
9
|
+
</div>
|
10
|
+
|
11
|
+
<% content_for :caboose_js do %>
|
12
|
+
<script type="text/javascript">
|
13
|
+
var modal = false;
|
14
|
+
$(document).ready(function() {
|
15
|
+
modal = new CabooseModal(500);
|
16
|
+
});
|
17
|
+
|
18
|
+
function updatePassword()
|
19
|
+
{
|
20
|
+
$.ajax({
|
21
|
+
url: '/admin/users/update-password',
|
22
|
+
type: 'post',
|
23
|
+
success: function(resp) {
|
24
|
+
if (resp.success)
|
25
|
+
modal.autosize("<p class='note success'>" + resp.success + "</p>");
|
26
|
+
if (resp.error)
|
27
|
+
modal.autosize("<p class='note success'>" + resp.error + "</p>");
|
28
|
+
if (resp.redirect)
|
29
|
+
window.location = resp.redirect;
|
30
|
+
}
|
31
|
+
});
|
32
|
+
}
|
33
|
+
</script>
|
34
|
+
<% end %>
|
@@ -1,15 +1,10 @@
|
|
1
1
|
<h1>Users</h1>
|
2
2
|
|
3
|
-
<form action='/admin/users' method='get'>
|
4
|
-
<
|
5
|
-
<tr><td>First name: </td><td><input type='text' name='first_name' value='<%= @gen.params['first_name'] %>' style='width: 200px;' /></td></tr>
|
6
|
-
<tr><td>Last name: </td><td><input type='text' name='last_name' value='<%= @gen.params['last_name'] %>' style='width: 200px;' /></td></tr>
|
7
|
-
<tr><td>Username: </td><td><input type='text' name='username' value='<%= @gen.params['username'] %>' style='width: 200px;' /></td></tr>
|
8
|
-
</table><br />
|
9
|
-
<p><input type='submit' value='Search' /></p>
|
3
|
+
<form action='/admin/users' method='get' class='search_form'>
|
4
|
+
<input type='text' name='search' placeholder='Search' />
|
10
5
|
</form>
|
11
6
|
|
12
|
-
<table class='data'>
|
7
|
+
<table class='data' id='users_table'>
|
13
8
|
<tr>
|
14
9
|
<%= raw @gen.sortable_table_headings({
|
15
10
|
'first_name' => 'First Name',
|
@@ -33,6 +28,8 @@
|
|
33
28
|
|
34
29
|
<% content_for :caboose_js do %>
|
35
30
|
<script type='text/javascript'>
|
36
|
-
|
31
|
+
$(document).ready(function() {
|
32
|
+
var modal = new CabooseModal(500);
|
33
|
+
});
|
37
34
|
</script>
|
38
35
|
<% end %>
|
data/config/routes.rb
CHANGED
@@ -11,14 +11,14 @@ Caboose::Engine.routes.draw do
|
|
11
11
|
get "register" => "register#index"
|
12
12
|
post "register" => "register#register"
|
13
13
|
|
14
|
-
get "admin/users"
|
15
|
-
get "admin/users/options"
|
16
|
-
get "admin/users/new"
|
17
|
-
|
18
|
-
get "admin/users/:id/edit"
|
19
|
-
put "admin/users/:id"
|
20
|
-
post "admin/users"
|
21
|
-
delete "admin/users/:id"
|
14
|
+
get "admin/users" => "users#index"
|
15
|
+
get "admin/users/options" => "users#options"
|
16
|
+
get "admin/users/new" => "users#new"
|
17
|
+
get "admin/users/:id/edit-password" => "users#edit_password"
|
18
|
+
get "admin/users/:id/edit" => "users#edit"
|
19
|
+
put "admin/users/:id" => "users#update"
|
20
|
+
post "admin/users" => "users#create"
|
21
|
+
delete "admin/users/:id" => "users#destroy"
|
22
22
|
|
23
23
|
get "admin/roles" => "roles#index"
|
24
24
|
get "admin/roles/options" => "roles#options"
|
data/lib/caboose/version.rb
CHANGED
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.2.
|
4
|
+
version: 0.2.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-07-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -98,7 +98,7 @@ dependencies:
|
|
98
98
|
requirements:
|
99
99
|
- - '='
|
100
100
|
- !ruby/object:Gem::Version
|
101
|
-
version: 0.0.
|
101
|
+
version: 0.0.10
|
102
102
|
type: :runtime
|
103
103
|
prerelease: false
|
104
104
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -106,7 +106,7 @@ dependencies:
|
|
106
106
|
requirements:
|
107
107
|
- - '='
|
108
108
|
- !ruby/object:Gem::Version
|
109
|
-
version: 0.0.
|
109
|
+
version: 0.0.10
|
110
110
|
- !ruby/object:Gem::Dependency
|
111
111
|
name: tinymce-rails
|
112
112
|
requirement: !ruby/object:Gem::Requirement
|
@@ -166,20 +166,21 @@ files:
|
|
166
166
|
- app/assets/images/caboose/caboose_logo_small.png
|
167
167
|
- app/assets/images/caboose/caboose_nav.png
|
168
168
|
- app/assets/images/caboose/caboose_nav_black.png
|
169
|
+
- app/assets/images/caboose/default_user_pic.png
|
170
|
+
- app/assets/images/caboose/loading_green.gif
|
169
171
|
- app/assets/images/caboose/loading_small_white_on_black.gif
|
170
172
|
- app/assets/images/caboose/loading_white_on_black.gif
|
171
173
|
- app/assets/javascripts/caboose/admin.js
|
172
174
|
- app/assets/javascripts/caboose/application.js
|
173
|
-
- app/assets/javascripts/caboose/
|
175
|
+
- app/assets/javascripts/caboose/bound_input.js
|
174
176
|
- app/assets/javascripts/caboose/modal.js
|
175
177
|
- app/assets/javascripts/caboose/modal_integration.js
|
176
178
|
- app/assets/javascripts/caboose/model.form.page.js
|
177
179
|
- app/assets/javascripts/caboose/model.form.user.js
|
178
|
-
- app/assets/javascripts/caboose/register.js
|
179
180
|
- app/assets/javascripts/caboose/station.js
|
180
|
-
- app/assets/javascripts/caboose/station_modal.js
|
181
181
|
- app/assets/stylesheets/caboose/admin.css
|
182
182
|
- app/assets/stylesheets/caboose/application.css
|
183
|
+
- app/assets/stylesheets/caboose/bound_input.css
|
183
184
|
- app/assets/stylesheets/caboose/caboose.css
|
184
185
|
- app/assets/stylesheets/caboose/fonts/big_noodle_titling.ttf
|
185
186
|
- app/assets/stylesheets/caboose/fonts/big_noodle_titling_oblique.ttf
|
@@ -247,6 +248,7 @@ files:
|
|
247
248
|
- app/views/caboose/settings/new.html.erb
|
248
249
|
- app/views/caboose/station/index.html.erb
|
249
250
|
- app/views/caboose/users/edit.html.erb
|
251
|
+
- app/views/caboose/users/edit_password.html.erb
|
250
252
|
- app/views/caboose/users/index.html.erb
|
251
253
|
- app/views/caboose/users/new.html.erb
|
252
254
|
- app/views/caboose/users/update_pic.html.erb
|
@@ -1,25 +0,0 @@
|
|
1
|
-
|
2
|
-
function login()
|
3
|
-
{
|
4
|
-
$('#message').hide();
|
5
|
-
$('#message').html("<p class='loading'>Logging in...</p>");
|
6
|
-
$('#message').slideDown({ duration: 350 });
|
7
|
-
parent.$.fn.colorbox.resize({ height:"340px" })
|
8
|
-
|
9
|
-
$.ajax({
|
10
|
-
url: '/login',
|
11
|
-
type: 'post',
|
12
|
-
data: $('#login_form').serialize(),
|
13
|
-
success: function(resp) {
|
14
|
-
if (resp.error)
|
15
|
-
$('#message').html("<p class='note error'>" + resp.error + "</p>");
|
16
|
-
else if (resp.redirect != false)
|
17
|
-
parent.window.location = resp.redirect;
|
18
|
-
else
|
19
|
-
parent.location.reload(true);
|
20
|
-
},
|
21
|
-
error: function() {
|
22
|
-
$('#message').html("<p class='note error'>Error</p>");
|
23
|
-
}
|
24
|
-
});
|
25
|
-
}
|
@@ -1,29 +0,0 @@
|
|
1
|
-
|
2
|
-
function register()
|
3
|
-
{
|
4
|
-
resize_colorbox("<p class='loading'>Registering...</p>");
|
5
|
-
|
6
|
-
$.ajax({
|
7
|
-
url: '/register',
|
8
|
-
type: 'post',
|
9
|
-
data: $('#register_form').serialize(),
|
10
|
-
success: function(resp) {
|
11
|
-
if (resp.error)
|
12
|
-
resize_colorbox("<p class='note error'>" + resp.error + "</p>");
|
13
|
-
else if (resp.redirect != false)
|
14
|
-
window.location = resp.redirect;
|
15
|
-
else
|
16
|
-
parent.location.reload(true);
|
17
|
-
},
|
18
|
-
error: function() {
|
19
|
-
$('#message').html("<p class='note error'>Error</p>");
|
20
|
-
}
|
21
|
-
});
|
22
|
-
}
|
23
|
-
|
24
|
-
function resize_colorbox(html)
|
25
|
-
{
|
26
|
-
$('#message').html(html);
|
27
|
-
height = $('#modal_content').outerHeight(true);
|
28
|
-
parent.$.fn.colorbox.resize({ innerHeight: '' + height + 'px' })
|
29
|
-
}
|
@@ -1,42 +0,0 @@
|
|
1
|
-
|
2
|
-
$(document).ready(function() {
|
3
|
-
|
4
|
-
// Make the main nav open the subnav
|
5
|
-
$('#station > ul > li > a').each(function(i, a) {
|
6
|
-
var href = $(a).attr('href');
|
7
|
-
$(a).click(function(event) {
|
8
|
-
event.preventDefault();
|
9
|
-
id = $(this).parent().attr('id').replace('nav_item_', '');
|
10
|
-
caboose_subnav(id, href);
|
11
|
-
})
|
12
|
-
});
|
13
|
-
|
14
|
-
// Make the subnav links take over the entire page instead of just the iframe
|
15
|
-
$('#station ul li ul li a').each(function(i, a) {
|
16
|
-
var href = $(a).attr('href');
|
17
|
-
$(a).click(function(event) {
|
18
|
-
event.preventDefault();
|
19
|
-
parent.window.location = href;
|
20
|
-
})
|
21
|
-
});
|
22
|
-
|
23
|
-
});
|
24
|
-
|
25
|
-
function caboose_subnav(id, href)
|
26
|
-
{
|
27
|
-
parent.$.fn.colorbox.resize({ innerHeight: plugin_count * 50, innerWidth: '400px' });
|
28
|
-
|
29
|
-
$('#station > ul > li').each(function(i, li) {
|
30
|
-
id2 = $(li).attr('id').replace('nav_item_', '');
|
31
|
-
if (id == id2)
|
32
|
-
$(li).addClass('selected');
|
33
|
-
else
|
34
|
-
$(li).removeClass('selected');
|
35
|
-
});
|
36
|
-
|
37
|
-
$('#station ul li ul').hide();
|
38
|
-
$('#station ul li#nav_item_' + id + ' ul').show();
|
39
|
-
|
40
|
-
var height = $('#station > ul').height();
|
41
|
-
$('#station ul li#nav_item_' + id + ' ul').height(height);
|
42
|
-
}
|