adminpanel 0.1.1 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (175) hide show
  1. data/.rspec +2 -2
  2. data/.ruby-version +1 -0
  3. data/.travis.yml +8 -8
  4. data/Gemfile +26 -24
  5. data/README.md +57 -57
  6. data/adminpanel.gemspec +41 -39
  7. data/app/assets/fonts/fontawesome-webfont.svg +254 -254
  8. data/app/assets/javascripts/adminpanel/bootstrap-datepicker.js +1159 -1159
  9. data/app/assets/javascripts/adminpanel/bootstrap-timepicker.js +803 -803
  10. data/app/assets/javascripts/adminpanel/bootstrap.js +2170 -2170
  11. data/app/assets/javascripts/adminpanel/{products.js → images_form.js} +13 -13
  12. data/app/assets/javascripts/adminpanel/imagesloaded.js +12 -12
  13. data/app/assets/javascripts/adminpanel/jquery.dataTables.min.js +155 -155
  14. data/app/assets/javascripts/adminpanel/jquery.facybox.js +395 -395
  15. data/app/assets/javascripts/adminpanel/jquery.masonry.min.js +9 -9
  16. data/app/assets/javascripts/adminpanel/jquery.slimscroll.min.js +13 -13
  17. data/app/assets/javascripts/adminpanel/medium-editor.js +702 -702
  18. data/app/assets/javascripts/adminpanel/realm.js +87 -87
  19. data/app/assets/javascripts/adminpanel/tables.js +126 -126
  20. data/app/assets/javascripts/application-admin.js +15 -15
  21. data/app/assets/stylesheets/adminpanel/_clearfix.css.scss +7 -7
  22. data/app/assets/stylesheets/adminpanel/alertify.css +241 -241
  23. data/app/assets/stylesheets/adminpanel/bootstrap.css +6103 -6103
  24. data/app/assets/stylesheets/adminpanel/colorpicker.css +6 -6
  25. data/app/assets/stylesheets/adminpanel/datepicker.css +9 -9
  26. data/app/assets/stylesheets/adminpanel/elfinder.min.css +59 -59
  27. data/app/assets/stylesheets/adminpanel/facybox.css +146 -146
  28. data/app/assets/stylesheets/adminpanel/font-awesome.min.css +33 -33
  29. data/app/assets/stylesheets/adminpanel/fullcalendar.css +618 -618
  30. data/app/assets/stylesheets/adminpanel/fullcalendar.print.css +61 -61
  31. data/app/assets/stylesheets/adminpanel/select2.css +524 -524
  32. data/app/assets/stylesheets/adminpanel/theme.css +1571 -1571
  33. data/app/assets/stylesheets/adminpanel/timepicker.css +82 -82
  34. data/app/assets/stylesheets/application-admin.css +13 -13
  35. data/app/controllers/adminpanel/application_controller.rb +32 -17
  36. data/app/controllers/adminpanel/galleries_controller.rb +80 -80
  37. data/app/controllers/adminpanel/sections_controller.rb +45 -45
  38. data/app/controllers/adminpanel/sessions_controller.rb +26 -26
  39. data/app/controllers/adminpanel/users_controller.rb +84 -84
  40. data/app/helpers/adminpanel/application_helper.rb +41 -51
  41. data/app/helpers/adminpanel/breadcrumbs_helper.rb +16 -0
  42. data/app/helpers/adminpanel/custom_form_builder.rb +248 -0
  43. data/app/helpers/adminpanel/images_helper.rb +9 -9
  44. data/app/helpers/adminpanel/rest_actions_helper.rb +47 -0
  45. data/app/helpers/adminpanel/router_helper.rb +33 -0
  46. data/app/helpers/adminpanel/sessions_helper.rb +25 -25
  47. data/app/models/adminpanel/gallery.rb +60 -60
  48. data/app/models/adminpanel/image.rb +14 -14
  49. data/app/models/adminpanel/section.rb +22 -22
  50. data/app/models/adminpanel/user.rb +35 -35
  51. data/app/uploaders/adminpanel/gallery_uploader.rb +55 -55
  52. data/app/uploaders/adminpanel/image_uploader.rb +57 -57
  53. data/app/views/adminpanel/galleries/_galleries_table.html.erb +14 -14
  54. data/app/views/adminpanel/galleries/create.html.erb +2 -2
  55. data/app/views/adminpanel/galleries/delete.html.erb +2 -2
  56. data/app/views/adminpanel/galleries/edit.html.erb +25 -25
  57. data/app/views/adminpanel/galleries/index.html.erb +51 -51
  58. data/app/views/adminpanel/galleries/new.html.erb +17 -17
  59. data/app/views/adminpanel/galleries/show.html.erb +17 -17
  60. data/app/views/adminpanel/galleries/update.html.erb +2 -2
  61. data/app/views/adminpanel/sections/_image_fields.html.erb +23 -23
  62. data/app/views/adminpanel/sections/_sections_table.html.erb +16 -16
  63. data/app/views/adminpanel/sections/create.html.erb +2 -2
  64. data/app/views/adminpanel/sections/destroy.html.erb +2 -2
  65. data/app/views/adminpanel/sections/edit.html.erb +41 -41
  66. data/app/views/adminpanel/sections/index.html.erb +44 -44
  67. data/app/views/adminpanel/sections/new.html.erb +26 -26
  68. data/app/views/adminpanel/sections/show.html.erb +30 -30
  69. data/app/views/adminpanel/sections/update.html.erb +2 -2
  70. data/app/views/adminpanel/sessions/new.html.erb +25 -25
  71. data/app/views/adminpanel/users/_user_form.html.erb +20 -20
  72. data/app/views/adminpanel/users/edit.html.erb +5 -5
  73. data/app/views/adminpanel/users/index.html.erb +49 -49
  74. data/app/views/adminpanel/users/new.html.erb +5 -5
  75. data/app/views/adminpanel/users/show.html.erb +20 -20
  76. data/app/views/layouts/_shim.html.erb +3 -3
  77. data/app/views/layouts/_side_menu.html.erb +49 -43
  78. data/app/views/layouts/_top_bar.html.erb +43 -43
  79. data/app/views/layouts/admin-login.html.erb +28 -28
  80. data/app/views/layouts/admin.html.erb +41 -39
  81. data/app/views/shared/_breadcrumb.html.erb +6 -6
  82. data/app/views/shared/_error_messages.html.erb +16 -16
  83. data/app/views/shared/_form_fields.html.erb +25 -0
  84. data/app/views/{adminpanel/products → shared}/_image_fields.html.erb +23 -23
  85. data/app/views/shared/_init_editor.html.erb +24 -0
  86. data/app/views/shared/edit.html.erb +28 -0
  87. data/app/views/shared/index.html.erb +94 -0
  88. data/app/views/shared/new.html.erb +28 -0
  89. data/app/views/shared/show.html.erb +63 -0
  90. data/config/locales/en.yml +5 -5
  91. data/config/locales/es.yml +127 -129
  92. data/config/routes.rb +24 -16
  93. data/lib/adminpanel.rb +9 -7
  94. data/lib/adminpanel/active_record_extension.rb +38 -0
  95. data/lib/adminpanel/engine.rb +5 -5
  96. data/lib/adminpanel/version.rb +3 -3
  97. data/lib/generators/adminpanel/initialize/initialize_generator.rb +17 -0
  98. data/lib/generators/adminpanel/{install/templates/migrations → initialize/templates}/create_adminpanel_tables.rb +45 -64
  99. data/lib/generators/adminpanel/resource/resource_generator.rb +105 -0
  100. data/lib/generators/adminpanel/resource/templates/controller.rb +4 -0
  101. data/lib/generators/adminpanel/resource/templates/migration.rb +9 -0
  102. data/lib/generators/adminpanel/resource/templates/resource.rb +19 -0
  103. data/spec/dummy/.gitignore +17 -17
  104. data/spec/dummy/README.rdoc +261 -261
  105. data/spec/dummy/Rakefile +7 -7
  106. data/{app/views/adminpanel/categories/show.html.erb → spec/dummy/app/adminpanel/products.rb} +0 -0
  107. data/spec/dummy/app/assets/javascripts/application.js +13 -13
  108. data/spec/dummy/app/assets/stylesheets/application.css +13 -13
  109. data/spec/dummy/app/controllers/adminpanel/.gitkeep +0 -0
  110. data/spec/dummy/app/controllers/application_controller.rb +3 -11
  111. data/spec/dummy/app/helpers/application_helper.rb +2 -2
  112. data/spec/dummy/app/views/layouts/application.html.erb +14 -14
  113. data/spec/dummy/config.ru +4 -4
  114. data/spec/dummy/config/application.rb +62 -62
  115. data/spec/dummy/config/boot.rb +9 -9
  116. data/spec/dummy/config/carrierwve.rb +5 -5
  117. data/spec/dummy/config/database.yml +24 -24
  118. data/spec/dummy/config/environment.rb +5 -5
  119. data/spec/dummy/config/environments/development.rb +41 -41
  120. data/spec/dummy/config/environments/production.rb +72 -72
  121. data/spec/dummy/config/environments/test.rb +41 -41
  122. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -7
  123. data/spec/dummy/config/initializers/inflections.rb +15 -15
  124. data/spec/dummy/config/initializers/mime_types.rb +5 -5
  125. data/spec/dummy/config/initializers/secret_token.rb +8 -8
  126. data/spec/dummy/config/initializers/session_store.rb +8 -8
  127. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -14
  128. data/spec/dummy/config/locales/en.yml +5 -5
  129. data/spec/dummy/config/routes.rb +4 -4
  130. data/spec/dummy/db/schema.rb +15 -15
  131. data/spec/dummy/public/404.html +26 -26
  132. data/spec/dummy/public/422.html +26 -26
  133. data/spec/dummy/public/500.html +25 -25
  134. data/spec/dummy/public/uploads/gallery/file/1/hipster.jpg +0 -0
  135. data/spec/dummy/public/uploads/gallery/file/1/thumb_hipster.jpg +0 -0
  136. data/spec/dummy/script/rails +6 -6
  137. data/spec/features/authentication_pages_spec.rb +43 -43
  138. data/spec/features/galleries_pages_spec.rb +124 -124
  139. data/spec/features/section_pages_spec.rb +37 -37
  140. data/spec/features/user_pages_spec.rb +48 -48
  141. data/spec/generators/initialize_spec.rb +9 -0
  142. data/spec/generators/resource_spec.rb +122 -0
  143. data/spec/models/gallery_spec.rb +21 -21
  144. data/spec/models/section_spec.rb +66 -66
  145. data/spec/models/user_spec.rb +105 -105
  146. data/spec/spec_helper.rb +32 -31
  147. data/spec/support/define_factory_models.rb +25 -36
  148. data/spec/support/helper_methods.rb +26 -26
  149. data/spec/support/submit_forms_without_button.rb +16 -16
  150. data/spec/support/test_database.rb +45 -58
  151. data/spec/uploaders/gallery_uploader_spec.rb +36 -30
  152. data/spec/uploaders/image_uploader_spec.rb +30 -29
  153. metadata +208 -64
  154. checksums.yaml +0 -7
  155. data/app/assets/javascripts/adminpanel/init_editor.js +0 -28
  156. data/app/controllers/adminpanel/categories_controller.rb +0 -41
  157. data/app/controllers/adminpanel/products_controller.rb +0 -88
  158. data/app/helpers/custom_form_builder.rb +0 -219
  159. data/app/models/adminpanel/category.rb +0 -7
  160. data/app/models/adminpanel/product.rb +0 -24
  161. data/app/views/adminpanel/categories/edit.html.erb +0 -18
  162. data/app/views/adminpanel/categories/index.html.erb +0 -55
  163. data/app/views/adminpanel/categories/new.html.erb +0 -18
  164. data/app/views/adminpanel/products/.DS_Store +0 -0
  165. data/app/views/adminpanel/products/_product_form.html.erb +0 -31
  166. data/app/views/adminpanel/products/edit.html.erb +0 -10
  167. data/app/views/adminpanel/products/index.html.erb +0 -51
  168. data/app/views/adminpanel/products/new.html.erb +0 -10
  169. data/app/views/adminpanel/products/show.html.erb +0 -61
  170. data/config/database.yml +0 -24
  171. data/lib/generators/adminpanel/install/install_generator.rb +0 -12
  172. data/spec/features/categories_pages_spec.rb +0 -44
  173. data/spec/features/product_pages_spec.rb +0 -64
  174. data/spec/models/category_spec.rb +0 -58
  175. data/spec/models/product_spec.rb +0 -51
@@ -1,87 +1,87 @@
1
-
2
- $(function() {
3
-
4
- // toggle arrow on menu items
5
- $('.accordion-heading .accordion-toggle').click(function(){
6
- $('.accordion-heading .accordion-toggle').not($(this)[0], '.accordion-heading .accordion-toggle.collapse').addClass('collapsed');
7
- });
8
-
9
-
10
- // show the overview boxes on the dashboard once they are loaded
11
- $('.overview_boxes .box_row').css('display', 'inline-block');
12
-
13
- // init tooltips on .tips class elements, text for the tooltip is in the data-title attribute on the element itself
14
- $('.tip').tooltip();
15
-
16
- // init popover on .pop class elements
17
- $('.pop').popover({
18
- title:$(this).data('title'),
19
- content:$(this).data('content'),
20
- placement:'top'
21
- });
22
-
23
- // prevent the top menu popover links to make the window scroll up because of href="#"
24
- $('.visible-desktop #messages, .visible-desktop #notifications').click(function(e){
25
- e.preventDefault();
26
- });
27
-
28
-
29
- // funtion to slide menu out from the left
30
- $('.slide_menu_left').click(function(e){
31
-
32
- e.preventDefault();
33
- if($(".nav-collapse.collapse").hasClass('open_left')){
34
- sidemenu_close();
35
- }else{
36
- sidemenu_open();
37
- $('.main_container').bind('click', function(){
38
- sidemenu_close();
39
- });
40
- // var handler = function() {
41
- // sidemenu_close();
42
- // };
43
- // $(window).bind('resize', handler);
44
- }
45
- });
46
-
47
-
48
- // collapse function for the widget
49
- $('.widget-buttons a.collapse').click(function(){
50
- if($(this).attr('data-collapsed') == 'false'){
51
- $(this).closest('.widget').find('.widget-body').slideUp();
52
- $(this).attr('data-collapsed', 'true').addClass('widget-hidden');
53
- }else{
54
- $(this).closest('.widget').find('.widget-body').slideDown();
55
- $(this).attr('data-collapsed', 'false').removeClass('widget-hidden');
56
- }
57
- });
58
-
59
- $('.datepicker-basic').datepicker();
60
- }); // end document reday
61
-
62
-
63
- //----- Side menu functions -----//
64
-
65
- // slide menu out of view
66
- function sidemenu_close(){
67
- $(".main_container").stop().animate({
68
- 'left': '0'
69
- }, 250, 'swing');
70
- $(".nav-collapse.collapse").stop().animate({
71
- 'left': '-150px'
72
- }, 250, 'swing').removeClass('open_left');
73
- $('.main_container').unbind('click');
74
- if(typeof handler != 'undefined'){
75
- $(window).unbind('resize', handler);
76
- }
77
- }
78
-
79
- // slide menu in
80
- function sidemenu_open(){
81
- $(".main_container").stop().animate({
82
- 'left': '150px'
83
- }, 250, 'swing');
84
- $(".nav-collapse.collapse").stop().animate({
85
- 'left': '0'
86
- }, 250, 'swing').addClass('open_left');
87
- }
1
+
2
+ $(function() {
3
+
4
+ // toggle arrow on menu items
5
+ $('.accordion-heading .accordion-toggle').click(function(){
6
+ $('.accordion-heading .accordion-toggle').not($(this)[0], '.accordion-heading .accordion-toggle.collapse').addClass('collapsed');
7
+ });
8
+
9
+
10
+ // show the overview boxes on the dashboard once they are loaded
11
+ $('.overview_boxes .box_row').css('display', 'inline-block');
12
+
13
+ // init tooltips on .tips class elements, text for the tooltip is in the data-title attribute on the element itself
14
+ $('.tip').tooltip();
15
+
16
+ // init popover on .pop class elements
17
+ $('.pop').popover({
18
+ title:$(this).data('title'),
19
+ content:$(this).data('content'),
20
+ placement:'top'
21
+ });
22
+
23
+ // prevent the top menu popover links to make the window scroll up because of href="#"
24
+ $('.visible-desktop #messages, .visible-desktop #notifications').click(function(e){
25
+ e.preventDefault();
26
+ });
27
+
28
+
29
+ // funtion to slide menu out from the left
30
+ $('.slide_menu_left').click(function(e){
31
+
32
+ e.preventDefault();
33
+ if($(".nav-collapse.collapse").hasClass('open_left')){
34
+ sidemenu_close();
35
+ }else{
36
+ sidemenu_open();
37
+ $('.main_container').bind('click', function(){
38
+ sidemenu_close();
39
+ });
40
+ // var handler = function() {
41
+ // sidemenu_close();
42
+ // };
43
+ // $(window).bind('resize', handler);
44
+ }
45
+ });
46
+
47
+
48
+ // collapse function for the widget
49
+ $('.widget-buttons a.collapse').click(function(){
50
+ if($(this).attr('data-collapsed') == 'false'){
51
+ $(this).closest('.widget').find('.widget-body').slideUp();
52
+ $(this).attr('data-collapsed', 'true').addClass('widget-hidden');
53
+ }else{
54
+ $(this).closest('.widget').find('.widget-body').slideDown();
55
+ $(this).attr('data-collapsed', 'false').removeClass('widget-hidden');
56
+ }
57
+ });
58
+
59
+ $('.datepicker-basic').datepicker();
60
+ }); // end document reday
61
+
62
+
63
+ //----- Side menu functions -----//
64
+
65
+ // slide menu out of view
66
+ function sidemenu_close(){
67
+ $(".main_container").stop().animate({
68
+ 'left': '0'
69
+ }, 250, 'swing');
70
+ $(".nav-collapse.collapse").stop().animate({
71
+ 'left': '-150px'
72
+ }, 250, 'swing').removeClass('open_left');
73
+ $('.main_container').unbind('click');
74
+ if(typeof handler != 'undefined'){
75
+ $(window).unbind('resize', handler);
76
+ }
77
+ }
78
+
79
+ // slide menu in
80
+ function sidemenu_open(){
81
+ $(".main_container").stop().animate({
82
+ 'left': '150px'
83
+ }, 250, 'swing');
84
+ $(".nav-collapse.collapse").stop().animate({
85
+ 'left': '0'
86
+ }, 250, 'swing').addClass('open_left');
87
+ }
@@ -1,126 +1,126 @@
1
- $.extend( $.fn.dataTableExt.oPagination, {
2
- "bootstrap": {
3
- "fnInit": function( oSettings, nPaging, fnDraw ) {
4
- var oLang = oSettings.oLanguage.oPaginate;
5
- var fnClickHandler = function ( e ) {
6
- e.preventDefault();
7
- if ( oSettings.oApi._fnPageChange(oSettings, e.data.action) ) {
8
- fnDraw( oSettings );
9
- }
10
- };
11
-
12
- $(nPaging).addClass('pagination').append(
13
- '<ul>'+
14
- '<li class="prev disabled"><a href="#">&larr; '+oLang.sPrevious+'</a></li>'+
15
- '<li class="next disabled"><a href="#">'+oLang.sNext+' &rarr; </a></li>'+
16
- '</ul>'
17
- );
18
- var els = $('a', nPaging);
19
- $(els[0]).bind( 'click.DT', { action: "previous" }, fnClickHandler );
20
- $(els[1]).bind( 'click.DT', { action: "next" }, fnClickHandler );
21
- },
22
-
23
- "fnUpdate": function ( oSettings, fnDraw ) {
24
- var iListLength = 5;
25
- var oPaging = oSettings.oInstance.fnPagingInfo();
26
- var an = oSettings.aanFeatures.p;
27
- var i, j, sClass, iStart, iEnd, iHalf=Math.floor(iListLength/2);
28
-
29
- if ( oPaging.iTotalPages < iListLength) {
30
- iStart = 1;
31
- iEnd = oPaging.iTotalPages;
32
- }
33
- else if ( oPaging.iPage <= iHalf ) {
34
- iStart = 1;
35
- iEnd = iListLength;
36
- } else if ( oPaging.iPage >= (oPaging.iTotalPages-iHalf) ) {
37
- iStart = oPaging.iTotalPages - iListLength + 1;
38
- iEnd = oPaging.iTotalPages;
39
- } else {
40
- iStart = oPaging.iPage - iHalf + 1;
41
- iEnd = iStart + iListLength - 1;
42
- }
43
-
44
- for ( i=0, iLen=an.length ; i<iLen ; i++ ) {
45
- // Remove the middle elements
46
- $('li:gt(0)', an[i]).filter(':not(:last)').remove();
47
-
48
- // Add the new list items and their event handlers
49
- for ( j=iStart ; j<=iEnd ; j++ ) {
50
- sClass = (j==oPaging.iPage+1) ? 'class="active"' : '';
51
- $('<li '+sClass+'><a href="#">'+j+'</a></li>')
52
- .insertBefore( $('li:last', an[i])[0] )
53
- .bind('click', function (e) {
54
- e.preventDefault();
55
- oSettings._iDisplayStart = (parseInt($('a', this).text(),10)-1) * oPaging.iLength;
56
- fnDraw( oSettings );
57
- } );
58
- }
59
-
60
- // Add / remove disabled classes from the static elements
61
- if ( oPaging.iPage === 0 ) {
62
- $('li:first', an[i]).addClass('disabled');
63
- } else {
64
- $('li:first', an[i]).removeClass('disabled');
65
- }
66
-
67
- if ( oPaging.iPage === oPaging.iTotalPages-1 || oPaging.iTotalPages === 0 ) {
68
- $('li:last', an[i]).addClass('disabled');
69
- } else {
70
- $('li:last', an[i]).removeClass('disabled');
71
- }
72
- }
73
- }
74
- }
75
- } );
76
- $.fn.dataTableExt.oApi.fnPagingInfo = function ( oSettings )
77
- {
78
- return {
79
- "iStart": oSettings._iDisplayStart,
80
- "iEnd": oSettings.fnDisplayEnd(),
81
- "iLength": oSettings._iDisplayLength,
82
- "iTotal": oSettings.fnRecordsTotal(),
83
- "iFilteredTotal": oSettings.fnRecordsDisplay(),
84
- "iPage": oSettings._iDisplayLength === -1 ?
85
- 0 : Math.ceil( oSettings._iDisplayStart / oSettings._iDisplayLength ),
86
- "iTotalPages": oSettings._iDisplayLength === -1 ?
87
- 0 : Math.ceil( oSettings.fnRecordsDisplay() / oSettings._iDisplayLength )
88
- };
89
- };
90
-
91
- jQuery.fn.dataTableExt.aTypes.push(
92
- function ( sData ) {
93
- return 'html';
94
- }
95
- );
96
-
97
- function SwitchCalendars(startCalendar, endCalendar, e) {
98
- var endCalendarDate = new Date(e.date),
99
- endCalendarInput = $('#end_date');
100
-
101
- startCalendar.datepicker('hide');
102
- endCalendarDate.setDate(endCalendarDate.getDate() + 1);
103
- endCalendar.datepicker('setStartDate', endCalendarDate);
104
- endCalendar.datepicker('update', endCalendarDate);
105
- endCalendar.focus();
106
- endCalendar.datepicker('show');
107
- }
108
-
109
- $(document).ready(function() {
110
- $('#information-table').dataTable( {
111
- "sDom": "<'row-fluid'<'span6'l><'span6'f>r>t<'row-fluid'<'span6'i><'span6'p>>",
112
- "sPaginationType": "bootstrap",
113
- "oLanguage": {
114
- "sLengthMenu": "Registros: _MENU_ ",
115
- "sZeroRecords": "No se encontro ningún registro que coincida con su búsqueda",
116
- "sInfo": "Mostrando registros del _START_ al _END_ (_TOTAL_ registros en total)",
117
- "sInfoEmpty": "No hay entradas para mostrar",
118
- "sInfoFiltered": "(_MAX_ registros fueron filtrados)",
119
- "sSearch": "Buscar:",
120
- "oPaginate" : {
121
- "sPrevious": "Anterior",
122
- "sNext": "Siguiente"
123
- }
124
- }
125
- });
126
- } );
1
+ $.extend( $.fn.dataTableExt.oPagination, {
2
+ "bootstrap": {
3
+ "fnInit": function( oSettings, nPaging, fnDraw ) {
4
+ var oLang = oSettings.oLanguage.oPaginate;
5
+ var fnClickHandler = function ( e ) {
6
+ e.preventDefault();
7
+ if ( oSettings.oApi._fnPageChange(oSettings, e.data.action) ) {
8
+ fnDraw( oSettings );
9
+ }
10
+ };
11
+
12
+ $(nPaging).addClass('pagination').append(
13
+ '<ul>'+
14
+ '<li class="prev disabled"><a href="#">&larr; '+oLang.sPrevious+'</a></li>'+
15
+ '<li class="next disabled"><a href="#">'+oLang.sNext+' &rarr; </a></li>'+
16
+ '</ul>'
17
+ );
18
+ var els = $('a', nPaging);
19
+ $(els[0]).bind( 'click.DT', { action: "previous" }, fnClickHandler );
20
+ $(els[1]).bind( 'click.DT', { action: "next" }, fnClickHandler );
21
+ },
22
+
23
+ "fnUpdate": function ( oSettings, fnDraw ) {
24
+ var iListLength = 5;
25
+ var oPaging = oSettings.oInstance.fnPagingInfo();
26
+ var an = oSettings.aanFeatures.p;
27
+ var i, j, sClass, iStart, iEnd, iHalf=Math.floor(iListLength/2);
28
+
29
+ if ( oPaging.iTotalPages < iListLength) {
30
+ iStart = 1;
31
+ iEnd = oPaging.iTotalPages;
32
+ }
33
+ else if ( oPaging.iPage <= iHalf ) {
34
+ iStart = 1;
35
+ iEnd = iListLength;
36
+ } else if ( oPaging.iPage >= (oPaging.iTotalPages-iHalf) ) {
37
+ iStart = oPaging.iTotalPages - iListLength + 1;
38
+ iEnd = oPaging.iTotalPages;
39
+ } else {
40
+ iStart = oPaging.iPage - iHalf + 1;
41
+ iEnd = iStart + iListLength - 1;
42
+ }
43
+
44
+ for ( i=0, iLen=an.length ; i<iLen ; i++ ) {
45
+ // Remove the middle elements
46
+ $('li:gt(0)', an[i]).filter(':not(:last)').remove();
47
+
48
+ // Add the new list items and their event handlers
49
+ for ( j=iStart ; j<=iEnd ; j++ ) {
50
+ sClass = (j==oPaging.iPage+1) ? 'class="active"' : '';
51
+ $('<li '+sClass+'><a href="#">'+j+'</a></li>')
52
+ .insertBefore( $('li:last', an[i])[0] )
53
+ .bind('click', function (e) {
54
+ e.preventDefault();
55
+ oSettings._iDisplayStart = (parseInt($('a', this).text(),10)-1) * oPaging.iLength;
56
+ fnDraw( oSettings );
57
+ } );
58
+ }
59
+
60
+ // Add / remove disabled classes from the static elements
61
+ if ( oPaging.iPage === 0 ) {
62
+ $('li:first', an[i]).addClass('disabled');
63
+ } else {
64
+ $('li:first', an[i]).removeClass('disabled');
65
+ }
66
+
67
+ if ( oPaging.iPage === oPaging.iTotalPages-1 || oPaging.iTotalPages === 0 ) {
68
+ $('li:last', an[i]).addClass('disabled');
69
+ } else {
70
+ $('li:last', an[i]).removeClass('disabled');
71
+ }
72
+ }
73
+ }
74
+ }
75
+ } );
76
+ $.fn.dataTableExt.oApi.fnPagingInfo = function ( oSettings )
77
+ {
78
+ return {
79
+ "iStart": oSettings._iDisplayStart,
80
+ "iEnd": oSettings.fnDisplayEnd(),
81
+ "iLength": oSettings._iDisplayLength,
82
+ "iTotal": oSettings.fnRecordsTotal(),
83
+ "iFilteredTotal": oSettings.fnRecordsDisplay(),
84
+ "iPage": oSettings._iDisplayLength === -1 ?
85
+ 0 : Math.ceil( oSettings._iDisplayStart / oSettings._iDisplayLength ),
86
+ "iTotalPages": oSettings._iDisplayLength === -1 ?
87
+ 0 : Math.ceil( oSettings.fnRecordsDisplay() / oSettings._iDisplayLength )
88
+ };
89
+ };
90
+
91
+ jQuery.fn.dataTableExt.aTypes.push(
92
+ function ( sData ) {
93
+ return 'html';
94
+ }
95
+ );
96
+
97
+ function SwitchCalendars(startCalendar, endCalendar, e) {
98
+ var endCalendarDate = new Date(e.date),
99
+ endCalendarInput = $('#end_date');
100
+
101
+ startCalendar.datepicker('hide');
102
+ endCalendarDate.setDate(endCalendarDate.getDate() + 1);
103
+ endCalendar.datepicker('setStartDate', endCalendarDate);
104
+ endCalendar.datepicker('update', endCalendarDate);
105
+ endCalendar.focus();
106
+ endCalendar.datepicker('show');
107
+ }
108
+
109
+ $(document).ready(function() {
110
+ $('#information-table').dataTable( {
111
+ "sDom": "<'row-fluid'<'span6'l><'span6'f>r>t<'row-fluid'<'span6'i><'span6'p>>",
112
+ "sPaginationType": "bootstrap",
113
+ "oLanguage": {
114
+ "sLengthMenu": "Registros: _MENU_ ",
115
+ "sZeroRecords": "No se encontro ningún registro que coincida con su búsqueda",
116
+ "sInfo": "Mostrando registros del _START_ al _END_ (_TOTAL_ registros en total)",
117
+ "sInfoEmpty": "No hay entradas para mostrar",
118
+ "sInfoFiltered": "(_MAX_ registros fueron filtrados)",
119
+ "sSearch": "Buscar:",
120
+ "oPaginate" : {
121
+ "sPrevious": "Anterior",
122
+ "sNext": "Siguiente"
123
+ }
124
+ }
125
+ });
126
+ } );
@@ -1,16 +1,16 @@
1
- // This is a manifest file that'll be compiled into application.js, which will include all the files
2
- // listed below.
3
- //
4
- // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
- // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
6
- //
7
- // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
- // the compiled file.
9
- //
10
- // WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
11
- // GO AFTER THE REQUIRES BELOW.
12
- //
13
- //= require jquery
14
- //= require jquery_ujs
15
- //= require adminpanel/bootstrap
1
+ // This is a manifest file that'll be compiled into application.js, which will include all the files
2
+ // listed below.
3
+ //
4
+ // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
+ // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
6
+ //
7
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
+ // the compiled file.
9
+ //
10
+ // WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
11
+ // GO AFTER THE REQUIRES BELOW.
12
+ //
13
+ //= require jquery
14
+ //= require jquery_ujs
15
+ //= require adminpanel/bootstrap
16
16
  //= require_tree ./adminpanel/.