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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 50d873e8b6bba3f5f08288918c8100c5546b9057
4
- data.tar.gz: daadd24a362d3186dfebb7f5dcb394472f0260c2
3
+ metadata.gz: 77d69497d933e4e7d8b92513aef1b785d67fdee0
4
+ data.tar.gz: 379864ece8c927552575a6bda6b161172492a805
5
5
  SHA512:
6
- metadata.gz: 2482155bf98292c20eb8a57b25f90f5d3a530543a548e0e4b8a5e7cae11b23f685e9e892e9e82a339ee782e4768450aaabc3b6da0d76c137d60d1c4d67da3de0
7
- data.tar.gz: 3b054e98e9dd8d2f4bc2de4ae5f07dc98985d5ba8ed1dc4bb40030fa957a3e1b89619ddb82cd1a5fe6109c3d4e0aac1ea8d07c6ca360c8d27d045a70a3b6f7be
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
- spud.admin.banner_sets = new function(){
4
+ (function(){
5
5
 
6
- var self = this;
7
- var bannerSetEditId = false;
6
+ var bannerSetEditId = false;
8
7
 
9
- this.init = function(){
10
- $('.spud_banner_sets_add_new').on('click', self.clickedAddNewBannerSet);
11
- $('.spud_admin_banner_sets_list').on('click', '.spud_banner_sets_edit', self.clickedEditBannerSet);
12
- $('.spud_admin_banner_sets_list').on('click', '.spud_banner_sets_delete', self.clickedDeleteBannerSet);
13
- $('.modal-body').on('submit', '.spud_banner_set_form', self.submittedBannerSetForm);
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
- self.clickedAddNewBannerSet = function(e){
17
- e.preventDefault();
18
- bannerSetEditId = false;
19
- $.ajax({
20
- url: $(this).attr('href'),
21
- dataType: 'html',
22
- success: function(html, textStatus, jqXHR){
23
- displayModalDialogWithOptions({
24
- title: 'New Banner Set',
25
- html: html
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
- self.clickedDeleteBannerSet = function(e){
47
- e.preventDefault();
48
- if(window.confirm('Are you sure?')){
49
- var el = $(this);
50
- $.ajax({
51
- url: el.attr('href'),
52
- type: 'post',
53
- data: {'_method':'delete'},
54
- complete: function(jqXHR, textStatus){
55
- var parent = el.parents('li');
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
- self.submittedBannerSetForm = function(e){
68
- e.preventDefault();
69
- var form = $(this);
47
+ var clickedDeleteBannerSet = function(e){
48
+ e.preventDefault();
49
+ if(window.confirm('Are you sure?')){
50
+ var el = $(this);
70
51
  $.ajax({
71
- url: form.attr('action'),
72
- data: form.serialize(),
52
+ url: el.attr('href'),
73
53
  type: 'post',
74
- dataType: 'html',
75
- success: self.savedBannerSetSuccess,
76
- error: self.savedBannerSetError
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
- self.savedBannerSetSuccess = function(html){
81
- if(bannerSetEditId){
82
- var item = $('.spud_admin_banner_sets_list_item[data-id="'+bannerSetEditId+'"]');
83
- item.replaceWith(html);
84
- }
85
- else{
86
- $('.spud_admin_banner_sets_list').append(html);
87
- }
88
- hideModalDialog();
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
- self.savedBannerSetError = function(jqXHR, textStatus, errorThrown){
92
- if(jqXHR.status == 422){
93
- var html = jqXHR.responseText;
94
- $('.spud_banner_set_form').replaceWith(html);
95
- }
96
- else{
97
- if(window.console){
98
- console.error('Oh Snap:', arguments);
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
- spud.admin.banners = new function(){
4
+ (function(){
5
5
 
6
- var self = this;
7
- var html5upload = false;
8
- var bannerEditId = false;
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', self.clickedAddNewBanner);
18
- $('.admin-banner-set-items-container').on('click', '.admin-banner-set-item-edit', self.clickedEditBanner);
19
- $('.admin-banner-set-items-container').on('click', '.admin-banner-set-item-delete', self.clickedDeleteBanner);
20
- $('.modal-body').on('submit', '.spud_banner_form', self.submittedBannerForm);
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: self.sortedBanners,
22
+ stop: sortedBanners,
24
23
  helper: fixHelper
25
24
  });
26
-
27
- /*
28
- * Workaround for bug when using Bootstrap 2 + Tinymce 4 that prevents the creation of hyperlinks while
29
- * running in a modal dialog
30
- *
31
- * See: http://stackoverflow.com/questions/18111582/tinymce-4-links-plugin-modal-in-not-editable
32
- *
33
- * NOTE: REMOVE THIS CODE WHEN UPGRADING TO BOOTSTRAP 3
34
- */
35
- $(document).on('focusin', function(e) {
36
- if($(e.target).closest(".mce-window").length){
37
- e.stopImmediatePropagation();
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
- self.clickedEditBanner = function(e){
67
- e.preventDefault();
68
- spud.admin.editor.unload();
69
- bannerEditId = parseInt($(this).parents('.admin-banner-set-item').attr('data-id'), 10);
70
- $.ajax({
71
- url: $(this).attr('href'),
72
- dataType: 'html',
73
- success: function(html, textStatus, jqXHR){
74
- spud.admin.modal.displayWithOptions({
75
- title: 'Edit Banner',
76
- html: html
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
- self.onFileUploadProgress = function(e){
143
- var percent = Math.round(e.loaded * 100 / e.total);
144
- var progress = $('.spud_banner_upload_progress');
145
- progress.find('.bar').css({width: percent + '%'});
146
- if(percent == 100){
147
- progress.addClass('progress-success');
148
- }
149
- };
150
-
151
- self.onFileUploadComplete = function(e){
152
- switch(this.status){
153
- case 200:
154
- self.onLegacyUploadComplete(e.target.response);
155
- break;
156
- case 422:
157
- self.onLegacyUploadError(e.target.response);
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
- self.onFileUploadAbort = function(e){
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
- // Non-html5 upload
173
- self.onLegacyUploadComplete = function(html){
174
- if(bannerEditId){
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
- $('.admin-banner-set-items-container').append(html);
107
+ fd.append('spud_banner[rich_text]', '');
180
108
  }
181
- spud.admin.modal.hide();
182
- };
183
109
 
184
- self.onLegacyUploadError = function(html){
185
- $('.spud_banner_form').replaceWith(html);
186
- initForm();
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
- self.sortedBanners = function(e, ui){
190
- var ids = [];
191
- $('.admin-banner-set-item').each(function(){
192
- ids.push($(this).attr('data-id'));
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
- $.ajax({
195
- url: '/admin/banners/sort',
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
- .spud_banner_upload_progress{
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 :li, :class => 'spud_admin_banner_sets_list_item', 'data-id' => banner_set.id do %>
2
- <%= banner_set.name %>
3
- <span class="spud_admin_banner_sets_list_item_actions">
4
- <%= link_to 'Manage Banners', admin_banner_set_path(banner_set), :class => 'btn btn-small' %>
5
- <%= link_to 'Edit Configuration', edit_admin_banner_set_path(banner_set), :class => 'btn btn-small spud_banner_sets_edit' %>
6
- <%= link_to 'Delete', admin_banner_set_path(banner_set), :class => 'btn btn-small btn-danger spud_banner_sets_delete' %>
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 spud_banner_set_form'} do |f| %>
1
+ <%= form_for @banner_set, :url => path, :html => {:class => 'form-horizontal admin-banner-set-form'} do |f| %>
2
2
 
3
- <%= error_messages_for(f.object) %>
3
+ <%= tb_form_errors(f.object) %>
4
4
 
5
5
  <fieldset>
6
- <div class="control-group">
7
- <%= f.label :name, "Name",:class => "control-label" %>
8
- <div class="controls">
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="control-group">
13
- <%= f.label :width, "Width", :class => "control-label" %>
14
- <div class="controls">
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="control-group">
19
- <%= f.label :height, "Height", :class => "control-label" %>
20
- <div class="controls">
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="control-group">
25
- <%= f.label :cropped, "Cropped", :class => "control-label" %>
26
- <div class="controls">
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="control-group">
31
- <%= f.label :has_rich_text, "Allow Rich Text", :class => "control-label" %>
32
- <div class="controls">
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
- <ul class="spud_admin_banner_sets_list">
7
- <%= render :partial => 'banner_set', :collection => @banner_sets %>
8
- </ul>
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
- <table class="table table-striped">
6
- <thead>
7
- <tr>
8
- <th>Banner</th>
9
- <th>Start Date</th>
10
- <th>End Date</th>
11
- <% if !@banner_set.has_rich_text %>
12
- <th>Links to</th>
13
- <% end %>
14
- </tr>
15
- </thead>
16
- <tbody class="admin-banner-set-items-container">
17
- <%= render :partial => 'admin/banners/banner', :collection => @banner_set.banners %>
18
- </tbody>
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>&nbsp;</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="admin-banner-set-item-nowrap">
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="admin-banner-set-item-nowrap">
24
- <%= link_to 'Edit', edit_admin_banner_path(banner), :class => 'admin-banner-set-item-edit btn btn-mini' %>
25
- <%= link_to 'Delete', admin_banner_path(banner), :class => 'admin-banner-set-item-delete btn btn-mini btn-danger' %>
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 => 'spud_banner_form', :target => 'spud_banners_upload_target'} do |f| %>
1
+ <%= form_for @banner, :url => path, :builder => TbCore::FormBuilder, :html => {:class => 'admin-banner-form', :target => 'admin-banner-upload-target'} do |f| %>
2
2
 
3
- <%= error_messages_for(f.object) %>
3
+ <%= tb_form_errors(f.object) %>
4
4
 
5
- <fieldset>
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="control-group">
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 => 'spud_banner_rich_text' %>
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="control-group">
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="control-group">
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="control-group">
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="control-group">
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="control-group">
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="control-group">
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 spud_banner_upload_progress">
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="spud_banners_upload_target" name="spud_banners_upload_target" style="display:none;"></iframe>
67
+ <iframe id="admin-banner-upload-target" name="admin-banner-upload-target" style="display:none;"></iframe>
@@ -1,5 +1,5 @@
1
1
  module Spud
2
2
  module Banners
3
- VERSION = "1.1.6"
3
+ VERSION = "1.2.0.beta1"
4
4
  end
5
5
  end
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.1.6
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: 2015-01-08 00:00:00.000000000 Z
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.0'
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.0'
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.5
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.5
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: '0'
290
+ version: 1.3.1
291
291
  requirements: []
292
292
  rubyforge_project:
293
- rubygems_version: 2.4.5
293
+ rubygems_version: 2.4.2
294
294
  signing_key:
295
295
  specification_version: 4
296
296
  summary: Twice Baked Banners