tb_banners 1.1.6 → 1.2.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.markdown +1 -6
- data/app/assets/javascripts/admin/banners/banner_sets.js +88 -86
- data/app/assets/javascripts/admin/banners/banners.js +159 -176
- data/app/assets/stylesheets/admin/banners/banner_sets.css +0 -23
- data/app/assets/stylesheets/admin/banners/banners.css.scss +2 -5
- data/app/views/admin/banner_sets/_banner_set.html.erb +8 -7
- data/app/views/admin/banner_sets/_form.html.erb +20 -20
- data/app/views/admin/banner_sets/index.html.erb +6 -4
- data/app/views/admin/banner_sets/show.html.erb +18 -14
- data/app/views/admin/banners/_banner.html.erb +4 -4
- data/app/views/admin/banners/_form.html.erb +13 -15
- data/lib/spud_banners/version.rb +1 -1
- metadata +13 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 77d69497d933e4e7d8b92513aef1b785d67fdee0
|
4
|
+
data.tar.gz: 379864ece8c927552575a6bda6b161172492a805
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d4c75394cc35e6c9e43816f31fe477a9ed2047cc20f77193d47fbf8ed7cf0189939e72199cc6a09f35a79221ee6929f155d04d8beb8b3eee0adc5ff112d273cc
|
7
|
+
data.tar.gz: 123e7574293cf224312fa1b5e080b73a0f18fe1914ad1991e1b57c3556f9e5509d9c78b4901df271278fc81111b4a73f0324b496031dd94db216cd9f5cd31b4d
|
data/README.markdown
CHANGED
@@ -48,12 +48,7 @@ A number of view helpers are provided for displaying banners in your templates.
|
|
48
48
|
|
49
49
|
`spud_banners_for_set(set_or_identifier, options)`
|
50
50
|
|
51
|
-
Accepts the banner set name as a String or Symbol and returns an html template. This helper also accepts a block argument for rendering custom html.
|
52
|
-
|
53
|
-
**Options:**
|
54
|
-
|
55
|
-
- `limit`: Limit how many banners you wish to render
|
56
|
-
- `background_image`: Pass `true` in order to render the banners as divs with css background images instead of image tags. Defaults to `false`. **This is required when rendering banners with rich text.**
|
51
|
+
Accepts the banner set name as a String or Symbol and returns an html template. Options hash accepts a `:limit` parameter for limiting the number of banners returned. This helper also accepts a block argument for rendering custom html.
|
57
52
|
|
58
53
|
```ruby
|
59
54
|
spud_banner_tag(banner)
|
@@ -1,102 +1,104 @@
|
|
1
1
|
// Place all the behaviors and hooks related to the matching controller here.
|
2
2
|
// All this logic will automatically be available in application.js.
|
3
3
|
|
4
|
-
|
4
|
+
(function(){
|
5
5
|
|
6
|
-
|
7
|
-
var bannerSetEditId = false;
|
6
|
+
var bannerSetEditId = false;
|
8
7
|
|
9
|
-
|
10
|
-
|
11
|
-
$('.
|
12
|
-
$('.
|
13
|
-
$('.
|
14
|
-
|
8
|
+
spud.admin.banner_sets = {
|
9
|
+
init: function(){
|
10
|
+
$('.spud_banner_sets_add_new').on('click', clickedAddNewBannerSet);
|
11
|
+
$('.admin-banner-sets-list').on('click', '.admin-banner-set-edit', clickedEditBannerSet);
|
12
|
+
$('.admin-banner-sets-list').on('click', '.admin-banner-set-delete', clickedDeleteBannerSet);
|
13
|
+
$('.modal-body').on('submit', '.admin-banner-set-form', submittedBannerSetForm);
|
14
|
+
}
|
15
|
+
};
|
15
16
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
self.clickedEditBannerSet = function(e){
|
32
|
-
e.preventDefault();
|
33
|
-
bannerSetEditId = parseInt($(this).parents('li').attr('data-id'), 10);
|
34
|
-
$.ajax({
|
35
|
-
url: $(this).attr('href'),
|
36
|
-
dataType: 'html',
|
37
|
-
success: function(html, textStatus, jqXHR){
|
38
|
-
displayModalDialogWithOptions({
|
39
|
-
title: 'Edit Banner Set',
|
40
|
-
html: html
|
41
|
-
});
|
42
|
-
}
|
43
|
-
});
|
44
|
-
};
|
17
|
+
var clickedAddNewBannerSet = function(e){
|
18
|
+
e.preventDefault();
|
19
|
+
bannerSetEditId = false;
|
20
|
+
$.ajax({
|
21
|
+
url: $(this).attr('href'),
|
22
|
+
dataType: 'html',
|
23
|
+
success: function(html, textStatus, jqXHR){
|
24
|
+
spud.admin.modal.displayWithOptions({
|
25
|
+
title: 'New Banner Set',
|
26
|
+
html: html
|
27
|
+
});
|
28
|
+
}
|
29
|
+
});
|
30
|
+
};
|
45
31
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
parent.fadeOut(200, function(){
|
57
|
-
parent.remove();
|
58
|
-
});
|
59
|
-
if(textStatus != 'success'){
|
60
|
-
console.warn('Something went wrong:', jqXHR);
|
61
|
-
}
|
62
|
-
}
|
32
|
+
var clickedEditBannerSet = function(e){
|
33
|
+
e.preventDefault();
|
34
|
+
bannerSetEditId = parseInt($(this).parents('tr').attr('data-id'), 10);
|
35
|
+
$.ajax({
|
36
|
+
url: $(this).attr('href'),
|
37
|
+
dataType: 'html',
|
38
|
+
success: function(html, textStatus, jqXHR){
|
39
|
+
spud.admin.modal.displayWithOptions({
|
40
|
+
title: 'Edit Banner Set',
|
41
|
+
html: html
|
63
42
|
});
|
64
43
|
}
|
65
|
-
};
|
44
|
+
});
|
45
|
+
};
|
66
46
|
|
67
|
-
|
68
|
-
|
69
|
-
|
47
|
+
var clickedDeleteBannerSet = function(e){
|
48
|
+
e.preventDefault();
|
49
|
+
if(window.confirm('Are you sure?')){
|
50
|
+
var el = $(this);
|
70
51
|
$.ajax({
|
71
|
-
url:
|
72
|
-
data: form.serialize(),
|
52
|
+
url: el.attr('href'),
|
73
53
|
type: 'post',
|
74
|
-
|
75
|
-
|
76
|
-
|
54
|
+
data: {'_method':'delete'},
|
55
|
+
complete: function(jqXHR, textStatus){
|
56
|
+
var parent = el.parents('tr');
|
57
|
+
parent.fadeOut(200, function(){
|
58
|
+
parent.remove();
|
59
|
+
});
|
60
|
+
if(textStatus != 'success'){
|
61
|
+
console.warn('Something went wrong:', jqXHR);
|
62
|
+
}
|
63
|
+
}
|
77
64
|
});
|
78
|
-
}
|
65
|
+
}
|
66
|
+
};
|
79
67
|
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
68
|
+
var submittedBannerSetForm = function(e){
|
69
|
+
e.preventDefault();
|
70
|
+
var form = $(this);
|
71
|
+
$.ajax({
|
72
|
+
url: form.attr('action'),
|
73
|
+
data: form.serialize(),
|
74
|
+
type: 'post',
|
75
|
+
dataType: 'html',
|
76
|
+
success: savedBannerSetSuccess,
|
77
|
+
error: savedBannerSetError
|
78
|
+
});
|
79
|
+
};
|
90
80
|
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
81
|
+
var savedBannerSetSuccess = function(html){
|
82
|
+
if(bannerSetEditId){
|
83
|
+
var item = $('.admin-banner-sets-list-item[data-id="'+bannerSetEditId+'"]');
|
84
|
+
item.replaceWith(html);
|
85
|
+
}
|
86
|
+
else{
|
87
|
+
$('.admin-banner-sets-list').append(html);
|
88
|
+
}
|
89
|
+
spud.admin.modal.hide();
|
90
|
+
};
|
91
|
+
|
92
|
+
var savedBannerSetError = function(jqXHR, textStatus, errorThrown){
|
93
|
+
if(jqXHR.status == 422){
|
94
|
+
var html = jqXHR.responseText;
|
95
|
+
$('.admin-banner-set-form').replaceWith(html);
|
96
|
+
}
|
97
|
+
else{
|
98
|
+
if(window.console){
|
99
|
+
console.error('Oh Snap:', arguments);
|
100
100
|
}
|
101
|
-
}
|
102
|
-
}
|
101
|
+
}
|
102
|
+
};
|
103
|
+
|
104
|
+
})();
|
@@ -1,53 +1,39 @@
|
|
1
1
|
// Place all the behaviors and hooks related to the matching controller here.
|
2
2
|
// All this logic will automatically be available in application.js.
|
3
3
|
|
4
|
-
|
4
|
+
(function(){
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
6
|
+
var html5upload = false;
|
7
|
+
var bannerEditId = false;
|
8
|
+
|
9
|
+
spud.admin.banners = {
|
9
10
|
|
10
11
|
// Index Page
|
11
12
|
/////////////
|
12
|
-
|
13
|
-
this.init = function(){
|
13
|
+
init: function(){
|
14
14
|
if(typeof(FormData) != 'undefined'){
|
15
15
|
html5upload = true;
|
16
16
|
}
|
17
|
-
$('.admin-banner-set-item-add').on('click',
|
18
|
-
$('.admin-banner-set-items-container').on('click', '.admin-banner-set-item-edit',
|
19
|
-
$('.admin-banner-set-items-container').on('click', '.admin-banner-set-item-delete',
|
20
|
-
$('.modal-body').on('submit', '.
|
21
|
-
|
17
|
+
$('.admin-banner-set-item-add').on('click', clickedAddNewBanner);
|
18
|
+
$('.admin-banner-set-items-container').on('click', '.admin-banner-set-item-edit', clickedEditBanner);
|
19
|
+
$('.admin-banner-set-items-container').on('click', '.admin-banner-set-item-delete', clickedDeleteBanner);
|
20
|
+
$('.modal-body').on('submit', '.admin-banner-form', submittedBannerForm);
|
22
21
|
$('.admin-banner-set-items-container').sortable({
|
23
|
-
stop:
|
22
|
+
stop: sortedBanners,
|
24
23
|
helper: fixHelper
|
25
24
|
});
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
}
|
39
|
-
});
|
40
|
-
};
|
41
|
-
|
42
|
-
// http://www.foliotek.com/devblog/make-table-rows-sortable-using-jquery-ui-sortable/
|
43
|
-
var fixHelper = function(e, ui) {
|
44
|
-
ui.children().each(function() {
|
45
|
-
$(this).width($(this).width());
|
46
|
-
});
|
47
|
-
return ui;
|
48
|
-
};
|
49
|
-
|
50
|
-
self.clickedAddNewBanner = function(e){
|
25
|
+
}
|
26
|
+
};
|
27
|
+
|
28
|
+
// http://www.foliotek.com/devblog/make-table-rows-sortable-using-jquery-ui-sortable/
|
29
|
+
var fixHelper = function(e, ui) {
|
30
|
+
ui.children().each(function() {
|
31
|
+
$(this).width($(this).width());
|
32
|
+
});
|
33
|
+
return ui;
|
34
|
+
};
|
35
|
+
|
36
|
+
var clickedAddNewBanner = function(e){
|
51
37
|
e.preventDefault();
|
52
38
|
bannerEditId = false;
|
53
39
|
$.ajax({
|
@@ -63,155 +49,152 @@ spud.admin.banners = new function(){
|
|
63
49
|
});
|
64
50
|
};
|
65
51
|
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
});
|
78
|
-
initForm();
|
79
|
-
}
|
80
|
-
});
|
81
|
-
};
|
82
|
-
|
83
|
-
self.clickedDeleteBanner = function(e){
|
84
|
-
e.preventDefault();
|
85
|
-
var el = $(this);
|
86
|
-
$.ajax({
|
87
|
-
url: el.attr('href'),
|
88
|
-
type: 'post',
|
89
|
-
data: {'_method':'delete'},
|
90
|
-
complete: function(jqXHR, textStatus){
|
91
|
-
var parent = el.parents('.admin-banner-set-item');
|
92
|
-
parent.fadeOut(200, function(){
|
93
|
-
parent.remove();
|
94
|
-
});
|
95
|
-
if(textStatus != 'success'){
|
96
|
-
console.warn('Something went wrong:', jqXHR);
|
97
|
-
}
|
98
|
-
}
|
99
|
-
});
|
100
|
-
};
|
101
|
-
|
102
|
-
self.submittedBannerForm = function(e){
|
103
|
-
if(html5upload){
|
104
|
-
e.preventDefault();
|
105
|
-
|
106
|
-
var form = $(this);
|
107
|
-
var fd = new FormData();
|
108
|
-
|
109
|
-
$('input[type=text], input[type=hidden], select').each(function(index, element){
|
110
|
-
var input = $(element);
|
111
|
-
var name = input.attr('name');
|
112
|
-
var value = input.val();
|
113
|
-
fd.append(name, value);
|
52
|
+
var clickedEditBanner = function(e){
|
53
|
+
e.preventDefault();
|
54
|
+
spud.admin.editor.unload();
|
55
|
+
bannerEditId = parseInt($(this).parents('.admin-banner-set-item').attr('data-id'), 10);
|
56
|
+
$.ajax({
|
57
|
+
url: $(this).attr('href'),
|
58
|
+
dataType: 'html',
|
59
|
+
success: function(html, textStatus, jqXHR){
|
60
|
+
spud.admin.modal.displayWithOptions({
|
61
|
+
title: 'Edit Banner',
|
62
|
+
html: html
|
114
63
|
});
|
115
|
-
|
116
|
-
var richText = form.find('.spud_banner_rich_text');
|
117
|
-
if(richText.length > 0){
|
118
|
-
fd.append('spud_banner[rich_text]', richText.val());
|
119
|
-
}
|
120
|
-
else{
|
121
|
-
fd.append('spud_banner[rich_text]', '');
|
122
|
-
}
|
123
|
-
|
124
|
-
var file = form.find('#spud_banner_banner')[0].files[0];
|
125
|
-
if(file){
|
126
|
-
fd.append('spud_banner[banner]', file);
|
127
|
-
$('.spud_banner_upload_progress').show();
|
128
|
-
}
|
129
|
-
|
130
|
-
var xhr = new XMLHttpRequest();
|
131
|
-
xhr.upload.addEventListener('progress', self.onFileUploadProgress);
|
132
|
-
xhr.addEventListener('load', self.onFileUploadComplete);
|
133
|
-
xhr.addEventListener('error', self.onFileUploadError);
|
134
|
-
xhr.addEventListener('abort', self.onFileUploadAbort);
|
135
|
-
xhr.open('POST', form.attr('action'));
|
136
|
-
xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
|
137
|
-
xhr.send(fd);
|
138
|
-
return false;
|
64
|
+
initForm();
|
139
65
|
}
|
140
|
-
};
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
break;
|
159
|
-
default:
|
160
|
-
window.alert("Whoops! Something has gone wrong.");
|
66
|
+
});
|
67
|
+
};
|
68
|
+
|
69
|
+
var clickedDeleteBanner = function(e){
|
70
|
+
e.preventDefault();
|
71
|
+
var el = $(this);
|
72
|
+
$.ajax({
|
73
|
+
url: el.attr('href'),
|
74
|
+
type: 'post',
|
75
|
+
data: {'_method':'delete'},
|
76
|
+
complete: function(jqXHR, textStatus){
|
77
|
+
var parent = el.parents('.admin-banner-set-item');
|
78
|
+
parent.fadeOut(200, function(){
|
79
|
+
parent.remove();
|
80
|
+
});
|
81
|
+
if(textStatus != 'success'){
|
82
|
+
console.warn('Something went wrong:', jqXHR);
|
83
|
+
}
|
161
84
|
}
|
162
|
-
};
|
163
|
-
|
164
|
-
self.onFileUploadError = function(e){
|
85
|
+
});
|
86
|
+
};
|
165
87
|
|
166
|
-
|
167
|
-
|
168
|
-
|
88
|
+
var submittedBannerForm = function(e){
|
89
|
+
if(html5upload){
|
90
|
+
e.preventDefault();
|
169
91
|
|
170
|
-
|
92
|
+
var form = $(this);
|
93
|
+
var fd = new FormData();
|
94
|
+
|
95
|
+
$('input[type=text], input[type=hidden], select').each(function(index, element){
|
96
|
+
var input = $(element);
|
97
|
+
var name = input.attr('name');
|
98
|
+
var value = input.val();
|
99
|
+
fd.append(name, value);
|
100
|
+
});
|
171
101
|
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
var item = $('.admin-banner-set-item[data-id="'+bannerEditId+'"]');
|
176
|
-
item.replaceWith(html);
|
102
|
+
var richText = form.find('.admin-banner-rich-text');
|
103
|
+
if(richText.length > 0){
|
104
|
+
fd.append('spud_banner[rich_text]', richText.val());
|
177
105
|
}
|
178
106
|
else{
|
179
|
-
|
107
|
+
fd.append('spud_banner[rich_text]', '');
|
180
108
|
}
|
181
|
-
spud.admin.modal.hide();
|
182
|
-
};
|
183
109
|
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
110
|
+
var file = form.find('#spud_banner_banner')[0].files[0];
|
111
|
+
if(file){
|
112
|
+
fd.append('spud_banner[banner]', file);
|
113
|
+
$('.admin-banner-upload-progress').show();
|
114
|
+
}
|
188
115
|
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
116
|
+
var xhr = new XMLHttpRequest();
|
117
|
+
xhr.upload.addEventListener('progress', onFileUploadProgress);
|
118
|
+
xhr.addEventListener('load', onFileUploadComplete);
|
119
|
+
xhr.addEventListener('error', onFileUploadError);
|
120
|
+
xhr.addEventListener('abort', onFileUploadAbort);
|
121
|
+
xhr.open('POST', form.attr('action'));
|
122
|
+
xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
|
123
|
+
xhr.send(fd);
|
124
|
+
return false;
|
125
|
+
}
|
126
|
+
};
|
127
|
+
|
128
|
+
var onFileUploadProgress = function(e){
|
129
|
+
var percent = Math.round(e.loaded * 100 / e.total);
|
130
|
+
var progress = $('.admin-banner-upload-progress');
|
131
|
+
progress.find('.bar').css({width: percent + '%'});
|
132
|
+
if(percent == 100){
|
133
|
+
progress.addClass('progress-success');
|
134
|
+
}
|
135
|
+
};
|
136
|
+
|
137
|
+
var onFileUploadComplete = function(e){
|
138
|
+
switch(this.status){
|
139
|
+
case 200:
|
140
|
+
spud.admin.banners.onLegacyUploadComplete(e.target.response);
|
141
|
+
break;
|
142
|
+
case 422:
|
143
|
+
spud.admin.banners.onLegacyUploadError(e.target.response);
|
144
|
+
break;
|
145
|
+
default:
|
146
|
+
window.alert("Whoops! Something has gone wrong.");
|
147
|
+
}
|
148
|
+
};
|
149
|
+
|
150
|
+
var onFileUploadError = function(e){
|
151
|
+
|
152
|
+
};
|
153
|
+
|
154
|
+
var onFileUploadAbort = function(e){
|
155
|
+
|
156
|
+
};
|
157
|
+
|
158
|
+
// Non-html5 upload
|
159
|
+
spud.admin.banners.onLegacyUploadComplete = function(html){
|
160
|
+
if(bannerEditId){
|
161
|
+
var item = $('.admin-banner-set-item[data-id="'+bannerEditId+'"]');
|
162
|
+
item.replaceWith(html);
|
163
|
+
}
|
164
|
+
else{
|
165
|
+
$('.admin-banner-set-items-container').append(html);
|
166
|
+
}
|
167
|
+
spud.admin.modal.hide();
|
168
|
+
};
|
169
|
+
|
170
|
+
spud.admin.banners.onLegacyUploadError = function(html){
|
171
|
+
$('.admin-banner-form').replaceWith(html);
|
172
|
+
initForm();
|
173
|
+
};
|
174
|
+
|
175
|
+
var sortedBanners = function(e, ui){
|
176
|
+
var ids = [];
|
177
|
+
$('.admin-banner-set-item').each(function(){
|
178
|
+
ids.push($(this).attr('data-id'));
|
179
|
+
});
|
180
|
+
$.ajax({
|
181
|
+
url: '/admin/banners/sort',
|
182
|
+
type: 'post',
|
183
|
+
data: {spud_banner_ids:ids, _method:'put'}
|
184
|
+
});
|
185
|
+
};
|
186
|
+
|
187
|
+
var initForm = function(){
|
188
|
+
var richText = $('#admin-banner-rich-text');
|
189
|
+
if(richText){
|
190
|
+
tinymce.EditorManager.execCommand('mceRemoveEditor', true, 'admin-banner-rich-text');
|
191
|
+
spud.admin.editor.init({
|
192
|
+
selector: '#admin-banner-rich-text',
|
193
|
+
buttons: ['bold','italic','underline','formatselect','|','bullist','numlist','|','link','unlink','anchor', '|', 'code'],
|
194
|
+
height: 300,
|
195
|
+
width: 500
|
193
196
|
});
|
194
|
-
|
195
|
-
|
196
|
-
type: 'post',
|
197
|
-
data: {spud_banner_ids:ids, _method:'put'}
|
198
|
-
});
|
199
|
-
};
|
200
|
-
|
201
|
-
// Form Page
|
202
|
-
////////////
|
203
|
-
|
204
|
-
var initForm = function(){
|
205
|
-
var richText = $('#spud_banner_rich_text');
|
206
|
-
if(richText){
|
207
|
-
tinymce.EditorManager.execCommand('mceRemoveEditor', true, 'spud_banner_rich_text');
|
208
|
-
spud.admin.editor.init({
|
209
|
-
selector: '#spud_banner_rich_text',
|
210
|
-
buttons: ['bold','italic','underline','formatselect','|','bullist','numlist','|','link','unlink','anchor', '|', 'code'],
|
211
|
-
height: 300,
|
212
|
-
width: 500
|
213
|
-
});
|
214
|
-
}
|
215
|
-
};
|
197
|
+
}
|
198
|
+
};
|
216
199
|
|
217
|
-
}();
|
200
|
+
})();
|
@@ -2,26 +2,3 @@
|
|
2
2
|
Place all the styles related to the matching controller here.
|
3
3
|
They will automatically be included in application.css.
|
4
4
|
*/
|
5
|
-
|
6
|
-
.spud_admin_banner_sets_list{
|
7
|
-
margin: 0;
|
8
|
-
padding: 0;
|
9
|
-
border: 1px solid #eee;
|
10
|
-
min-height: 40px;
|
11
|
-
}
|
12
|
-
.spud_admin_banner_sets_list_item{
|
13
|
-
clear: both;
|
14
|
-
overflow: hidden;
|
15
|
-
padding: 10px;
|
16
|
-
}
|
17
|
-
.spud_admin_banner_sets_list_item:nth-child(2n) {
|
18
|
-
background: #F1F1F1;
|
19
|
-
}
|
20
|
-
.spud_admin_banner_sets_list_item:hover{
|
21
|
-
background: #FFEDDF;
|
22
|
-
-webkit-transition: background 0.1s ease-in;
|
23
|
-
-moz-transition: background 0.1s ease-in;
|
24
|
-
}
|
25
|
-
.spud_admin_banner_sets_list_item_actions{
|
26
|
-
float: right;
|
27
|
-
}
|
@@ -12,16 +12,13 @@
|
|
12
12
|
.admin-banner-set-item img{
|
13
13
|
display: block;
|
14
14
|
}
|
15
|
-
.admin-banner-set-item-nowrap{
|
16
|
-
white-space: nowrap;
|
17
|
-
}
|
18
15
|
|
19
16
|
// Banner Form
|
20
|
-
.
|
17
|
+
.admin-banner-upload-progress{
|
21
18
|
display: none;
|
22
19
|
}
|
23
20
|
.controls-banner-date-selects{
|
24
21
|
select{
|
25
22
|
width: 100px;
|
26
23
|
}
|
27
|
-
}
|
24
|
+
}
|
@@ -1,8 +1,9 @@
|
|
1
|
-
<%= content_tag :
|
2
|
-
|
3
|
-
<
|
4
|
-
<%= link_to 'Manage Banners', admin_banner_set_path(banner_set), :class => 'btn btn-
|
5
|
-
<%= link_to 'Edit Configuration', edit_admin_banner_set_path(banner_set), :class => 'btn btn-
|
6
|
-
<%= link_to 'Delete', admin_banner_set_path(banner_set), :class => 'btn btn-
|
1
|
+
<%= content_tag :tr, :class => 'admin-banner-sets-list-item', 'data-id' => banner_set.id do %>
|
2
|
+
<td><%= banner_set.name %></td>
|
3
|
+
<td class="table-actions">
|
4
|
+
<%= link_to 'Manage Banners', admin_banner_set_path(banner_set), :class => 'btn btn-default btn-sm' %>
|
5
|
+
<%= link_to 'Edit Configuration', edit_admin_banner_set_path(banner_set), :class => 'btn btn-default btn-sm admin-banner-set-edit' %>
|
6
|
+
<%= link_to 'Delete', admin_banner_set_path(banner_set), :class => 'btn btn-default btn-sm btn-danger admin-banner-set-delete' %>
|
7
|
+
</td>
|
7
8
|
</span>
|
8
|
-
<% end %>
|
9
|
+
<% end %>
|
@@ -1,35 +1,35 @@
|
|
1
|
-
<%= form_for @banner_set, :url => path, :html => {:class => 'form-horizontal
|
1
|
+
<%= form_for @banner_set, :url => path, :html => {:class => 'form-horizontal admin-banner-set-form'} do |f| %>
|
2
2
|
|
3
|
-
<%=
|
3
|
+
<%= tb_form_errors(f.object) %>
|
4
4
|
|
5
5
|
<fieldset>
|
6
|
-
<div class="
|
7
|
-
<%= f.label :name, "Name",:class => "control-label" %>
|
8
|
-
<div class="
|
9
|
-
<%= f.text_field :name %>
|
6
|
+
<div class="form-group">
|
7
|
+
<%= f.label :name, "Name",:class => "col-lg-2 control-label" %>
|
8
|
+
<div class="col-lg-10">
|
9
|
+
<%= f.text_field :name, :class=>'form-control' %>
|
10
10
|
</div>
|
11
11
|
</div>
|
12
|
-
<div class="
|
13
|
-
<%= f.label :width, "Width", :class => "control-label" %>
|
14
|
-
<div class="
|
15
|
-
<%= f.text_field :width %>
|
12
|
+
<div class="form-group">
|
13
|
+
<%= f.label :width, "Width", :class => "col-lg-2 control-label" %>
|
14
|
+
<div class="col-lg-10">
|
15
|
+
<%= f.text_field :width, :class=>'form-control' %>
|
16
16
|
</div>
|
17
17
|
</div>
|
18
|
-
<div class="
|
19
|
-
<%= f.label :height, "Height", :class => "control-label" %>
|
20
|
-
<div class="
|
21
|
-
<%= f.text_field :height %>
|
18
|
+
<div class="form-group">
|
19
|
+
<%= f.label :height, "Height", :class => "col-lg-2 control-label" %>
|
20
|
+
<div class="col-lg-10">
|
21
|
+
<%= f.text_field :height, :class=>'form-control' %>
|
22
22
|
</div>
|
23
23
|
</div>
|
24
|
-
<div class="
|
25
|
-
<%= f.label :cropped, "Cropped", :class => "control-label" %>
|
26
|
-
<div class="
|
24
|
+
<div class="form-group">
|
25
|
+
<%= f.label :cropped, "Cropped", :class => "col-lg-2 control-label" %>
|
26
|
+
<div class="col-lg-10">
|
27
27
|
<%= f.check_box :cropped %>
|
28
28
|
</div>
|
29
29
|
</div>
|
30
|
-
<div class="
|
31
|
-
<%= f.label :has_rich_text, "Allow Rich Text", :class => "control-label" %>
|
32
|
-
<div class="
|
30
|
+
<div class="form-group">
|
31
|
+
<%= f.label :has_rich_text, "Allow Rich Text", :class => "col-lg-2 control-label" %>
|
32
|
+
<div class="col-lg-10">
|
33
33
|
<%= f.check_box :has_rich_text %>
|
34
34
|
</div>
|
35
35
|
</div>
|
@@ -3,10 +3,12 @@
|
|
3
3
|
<% end %>
|
4
4
|
|
5
5
|
<% content_for :detail do %>
|
6
|
-
<
|
7
|
-
|
8
|
-
|
6
|
+
<div class="table-responsive">
|
7
|
+
<table class="table table-striped table-hover admin-banner-sets-list">
|
8
|
+
<%= render :partial => 'banner_set', :collection => @banner_sets %>
|
9
|
+
</table>
|
10
|
+
</div>
|
9
11
|
<script>
|
10
12
|
$(document).ready(spud.admin.banner_sets.init);
|
11
13
|
</script>
|
12
|
-
<% end %>
|
14
|
+
<% end %>
|
@@ -2,20 +2,24 @@
|
|
2
2
|
<%= link_to 'Upload Banner', new_admin_banner_set_banner_path(@banner_set), :class => 'btn btn-primary admin-banner-set-item-add' %>
|
3
3
|
<% end %>
|
4
4
|
|
5
|
-
<
|
6
|
-
<
|
7
|
-
<
|
8
|
-
<
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
5
|
+
<div class="table-responsive">
|
6
|
+
<table class="table table-striped table-hover">
|
7
|
+
<thead>
|
8
|
+
<tr>
|
9
|
+
<th>Banner</th>
|
10
|
+
<th>Start Date</th>
|
11
|
+
<th>End Date</th>
|
12
|
+
<% if !@banner_set.has_rich_text %>
|
13
|
+
<th>Links to</th>
|
14
|
+
<% end %>
|
15
|
+
<th> </th>
|
16
|
+
</tr>
|
17
|
+
</thead>
|
18
|
+
<tbody class="admin-banner-set-items-container">
|
19
|
+
<%= render :partial => 'admin/banners/banner', :collection => @banner_set.banners %>
|
20
|
+
</tbody>
|
21
|
+
</table>
|
22
|
+
</div>
|
19
23
|
|
20
24
|
<script>
|
21
25
|
$(document).ready(spud.admin.banners.init);
|
@@ -5,7 +5,7 @@
|
|
5
5
|
<% end %>
|
6
6
|
</td>
|
7
7
|
<td><%= banner.start_date.try(:strftime, '%m/%d/%Y') %></td>
|
8
|
-
<td class="
|
8
|
+
<td class="table-actions">
|
9
9
|
<%= banner.end_date.try(:strftime, '%m/%d/%Y') %>
|
10
10
|
<% if banner.is_expired? %>
|
11
11
|
<span class="label">Expired</span>
|
@@ -20,8 +20,8 @@
|
|
20
20
|
<% end %>
|
21
21
|
</td>
|
22
22
|
<% end %>
|
23
|
-
<td class="
|
24
|
-
<%= link_to 'Edit', edit_admin_banner_path(banner), :class => 'admin-banner-set-item-edit btn btn-
|
25
|
-
<%= link_to 'Delete', admin_banner_path(banner), :class => 'admin-banner-set-item-delete btn btn-
|
23
|
+
<td class="table-actions">
|
24
|
+
<%= link_to 'Edit', edit_admin_banner_path(banner), :class => 'admin-banner-set-item-edit btn btn-sm btn-default' %>
|
25
|
+
<%= link_to 'Delete', admin_banner_path(banner), :class => 'admin-banner-set-item-delete btn btn-sm btn-danger' %>
|
26
26
|
</td>
|
27
27
|
<% end %>
|
@@ -1,29 +1,28 @@
|
|
1
|
-
<%= form_for @banner, :url => path, :html => {:class => '
|
1
|
+
<%= form_for @banner, :url => path, :builder => TbCore::FormBuilder, :html => {:class => 'admin-banner-form', :target => 'admin-banner-upload-target'} do |f| %>
|
2
2
|
|
3
|
-
<%=
|
3
|
+
<%= tb_form_errors(f.object) %>
|
4
4
|
|
5
|
-
|
6
|
-
<div class="control-group">
|
5
|
+
<div class="form-group">
|
7
6
|
<%= f.label :banner, 'Banner', :class => 'control-label' %>
|
8
7
|
<div class="controls">
|
9
8
|
<%= f.file_field :banner %>
|
10
9
|
</div>
|
11
10
|
</div>
|
12
11
|
<% if @banner.owner.has_rich_text? %>
|
13
|
-
<div class="
|
12
|
+
<div class="form-group">
|
14
13
|
<%= f.label :rich_text, 'Rich Text', :class => 'control-label' %>
|
15
14
|
<div class="controls">
|
16
|
-
<%= f.text_area :rich_text, :class => '
|
15
|
+
<%= f.text_area :rich_text, :id => 'admin-banner-rich-text', :class => 'admin-banner-rich-text' %>
|
17
16
|
</div>
|
18
17
|
</div>
|
19
18
|
<% else %>
|
20
|
-
<div class="
|
19
|
+
<div class="form-group">
|
21
20
|
<%= f.label :link_to, 'Link to', :class => 'control-label' %>
|
22
21
|
<div class="controls">
|
23
22
|
<%= f.text_field :link_to %>
|
24
23
|
</div>
|
25
24
|
</div>
|
26
|
-
<div class="
|
25
|
+
<div class="form-group">
|
27
26
|
<%= f.label :link_target, 'Open Link in', :class => 'control-label' %>
|
28
27
|
<div class="controls">
|
29
28
|
<%= f.select :link_target, options_for_select([
|
@@ -32,38 +31,37 @@
|
|
32
31
|
], @banner.link_target) %>
|
33
32
|
</div>
|
34
33
|
</div>
|
35
|
-
<div class="
|
34
|
+
<div class="form-group">
|
36
35
|
<%= f.label :title, 'Image Title', :class => 'control-label' %>
|
37
36
|
<div class="controls">
|
38
37
|
<%= f.text_field :title %>
|
39
38
|
</div>
|
40
39
|
</div>
|
41
|
-
<div class="
|
40
|
+
<div class="form-group">
|
42
41
|
<%= f.label :alt, 'Alt Text', :class => 'control-label' %>
|
43
42
|
<div class="controls">
|
44
43
|
<%= f.text_field :alt %>
|
45
44
|
</div>
|
46
45
|
</div>
|
47
46
|
<% end %>
|
48
|
-
<div class="
|
47
|
+
<div class="form-group">
|
49
48
|
<%= f.label :start_date, 'Start Date', :class => 'control-label' %>
|
50
49
|
<div class="controls controls-banner-date-selects">
|
51
50
|
<%= f.date_select :start_date, :start_year => Date.today.year %>
|
52
51
|
</div>
|
53
52
|
</div>
|
54
|
-
<div class="
|
53
|
+
<div class="form-group">
|
55
54
|
<%= f.label :end_date, 'End Date', :class => 'control-label' %>
|
56
55
|
<div class="controls controls-banner-date-selects">
|
57
56
|
<%= f.date_select :end_date, :include_blank => true, :start_year => Date.today.year %>
|
58
57
|
<span class="help-block">Leave blank to never expire</span>
|
59
58
|
</div>
|
60
59
|
</div>
|
61
|
-
</fieldset>
|
62
60
|
|
63
|
-
<div class="progress progress-striped active
|
61
|
+
<div class="progress progress-striped active admin-banner-upload-progress">
|
64
62
|
<div class="bar"></div>
|
65
63
|
</div>
|
66
64
|
|
67
65
|
<% end %>
|
68
66
|
|
69
|
-
<iframe id="
|
67
|
+
<iframe id="admin-banner-upload-target" name="admin-banner-upload-target" style="display:none;"></iframe>
|
data/lib/spud_banners/version.rb
CHANGED
metadata
CHANGED
@@ -1,43 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tb_banners
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0.beta1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Westlake
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-11-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '4.
|
19
|
+
version: '4.1'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '4.
|
26
|
+
version: '4.1'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: tb_core
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 1.2
|
33
|
+
version: '1.2'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 1.2
|
40
|
+
version: '1.2'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: paperclip
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -285,12 +285,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
285
285
|
version: '0'
|
286
286
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
287
287
|
requirements:
|
288
|
-
- - "
|
288
|
+
- - ">"
|
289
289
|
- !ruby/object:Gem::Version
|
290
|
-
version:
|
290
|
+
version: 1.3.1
|
291
291
|
requirements: []
|
292
292
|
rubyforge_project:
|
293
|
-
rubygems_version: 2.4.
|
293
|
+
rubygems_version: 2.4.2
|
294
294
|
signing_key:
|
295
295
|
specification_version: 4
|
296
296
|
summary: Twice Baked Banners
|