web_admin 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (264) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +11 -0
  3. data/.rspec +2 -0
  4. data/.ruby-version +1 -0
  5. data/Gemfile +32 -0
  6. data/Gemfile.lock +335 -0
  7. data/MIT-LICENSE +20 -0
  8. data/README.rdoc +3 -0
  9. data/Rakefile +22 -0
  10. data/app/assets/images/web_admin/.keep +0 -0
  11. data/app/assets/images/web_admin/avatar.jpg +0 -0
  12. data/app/assets/images/web_admin/first_icon.png +0 -0
  13. data/app/assets/images/web_admin/render-1-thumb.jpg +0 -0
  14. data/app/assets/images/web_admin/render-1.jpg +0 -0
  15. data/app/assets/images/web_admin/render-2-thumb.jpg +0 -0
  16. data/app/assets/images/web_admin/render-2.jpg +0 -0
  17. data/app/assets/images/web_admin/render-3-thumb.jpg +0 -0
  18. data/app/assets/images/web_admin/render-3.jpg +0 -0
  19. data/app/assets/images/web_admin/render-4-thumb.jpg +0 -0
  20. data/app/assets/images/web_admin/render-4.jpg +0 -0
  21. data/app/assets/images/web_admin/responsive.png +0 -0
  22. data/app/assets/javascripts/web_admin/app.data.js +336 -0
  23. data/app/assets/javascripts/web_admin/app.js +172 -0
  24. data/app/assets/javascripts/web_admin/app.plugin.js +220 -0
  25. data/app/assets/javascripts/web_admin/application.js +20 -0
  26. data/app/assets/javascripts/web_admin/bootstrap-filestyle.min.js +1 -0
  27. data/app/assets/javascripts/web_admin/bootstrap.js +1951 -0
  28. data/app/assets/javascripts/web_admin/charts/easypiechart/jquery.easy-pie-chart.js +184 -0
  29. data/app/assets/javascripts/web_admin/charts/sparkline/jquery.sparkline.min.js +5 -0
  30. data/app/assets/javascripts/web_admin/combodate/combodate.js +453 -0
  31. data/app/assets/javascripts/web_admin/combodate/moment.min.js +6 -0
  32. data/app/assets/javascripts/web_admin/data/datagrid.json +1900 -0
  33. data/app/assets/javascripts/web_admin/data/datatable.json +401 -0
  34. data/app/assets/javascripts/web_admin/datatables/jquery.dataTables.min.js +155 -0
  35. data/app/assets/javascripts/web_admin/datepicker/bootstrap-datepicker.js +474 -0
  36. data/app/assets/javascripts/web_admin/datepicker.js +3 -0
  37. data/app/assets/javascripts/web_admin/fuelux/fuelux.js +1645 -0
  38. data/app/assets/javascripts/web_admin/fullcalendar/fullcalendar.min.js +7 -0
  39. data/app/assets/javascripts/web_admin/grid/gallery.js +14 -0
  40. data/app/assets/javascripts/web_admin/grid/jquery.grid-a-licious.min.js +15 -0
  41. data/app/assets/javascripts/web_admin/grid/masonry.pkgd.min.js +9 -0
  42. data/app/assets/javascripts/web_admin/ie/excanvas.js +924 -0
  43. data/app/assets/javascripts/web_admin/ie/html5.js +9 -0
  44. data/app/assets/javascripts/web_admin/ie/respond.min.js +6 -0
  45. data/app/assets/javascripts/web_admin/jquery-ui-1.10.3.custom.min.js +6 -0
  46. data/app/assets/javascripts/web_admin/jquery.datetimepicker.js +1851 -0
  47. data/app/assets/javascripts/web_admin/jquery.ui.touch-punch.min.js +11 -0
  48. data/app/assets/javascripts/web_admin/parsley/parsley.min.js +35 -0
  49. data/app/assets/javascripts/web_admin/prettyphoto/default/default_thumb.png +0 -0
  50. data/app/assets/javascripts/web_admin/prettyphoto/default/loader.gif +0 -0
  51. data/app/assets/javascripts/web_admin/prettyphoto/default/sprite.png +0 -0
  52. data/app/assets/javascripts/web_admin/prettyphoto/default/sprite_next.png +0 -0
  53. data/app/assets/javascripts/web_admin/prettyphoto/default/sprite_prev.png +0 -0
  54. data/app/assets/javascripts/web_admin/prettyphoto/default/sprite_x.png +0 -0
  55. data/app/assets/javascripts/web_admin/prettyphoto/default/sprite_y.png +0 -0
  56. data/app/assets/javascripts/web_admin/prettyphoto/jquery.prettyPhoto.js +7 -0
  57. data/app/assets/javascripts/web_admin/prettyphoto/prettyPhoto.css +170 -0
  58. data/app/assets/javascripts/web_admin/select2/select2.css +652 -0
  59. data/app/assets/javascripts/web_admin/select2/select2.min.js +22 -0
  60. data/app/assets/javascripts/web_admin/slider/bootstrap-slider.js +388 -0
  61. data/app/assets/javascripts/web_admin/underscore-min.js +7 -0
  62. data/app/assets/javascripts/web_admin/underscore-min.map +1 -0
  63. data/app/assets/javascripts/web_admin/upload_image.js +39 -0
  64. data/app/assets/stylesheets/web_admin/application.css +15 -0
  65. data/app/assets/stylesheets/web_admin/bootstrap.css +5784 -0
  66. data/app/assets/stylesheets/web_admin/font-awesome.min.css +4 -0
  67. data/app/assets/stylesheets/web_admin/font.css +18 -0
  68. data/app/assets/stylesheets/web_admin/fonts/FontAwesome.otf +0 -0
  69. data/app/assets/stylesheets/web_admin/fonts/fontawesome-webfont.eot +0 -0
  70. data/app/assets/stylesheets/web_admin/fonts/fontawesome-webfont.svg +414 -0
  71. data/app/assets/stylesheets/web_admin/fonts/fontawesome-webfont.ttf +0 -0
  72. data/app/assets/stylesheets/web_admin/fonts/fontawesome-webfont.woff +0 -0
  73. data/app/assets/stylesheets/web_admin/fonts/glyphicons-halflings-regular.eot +0 -0
  74. data/app/assets/stylesheets/web_admin/fonts/glyphicons-halflings-regular.svg +229 -0
  75. data/app/assets/stylesheets/web_admin/fonts/glyphicons-halflings-regular.ttf +0 -0
  76. data/app/assets/stylesheets/web_admin/fonts/glyphicons-halflings-regular.woff +0 -0
  77. data/app/assets/stylesheets/web_admin/fonts/opensans/opensans-bold-webfont.woff +0 -0
  78. data/app/assets/stylesheets/web_admin/fonts/opensans/opensans-light-webfont.woff +0 -0
  79. data/app/assets/stylesheets/web_admin/fonts/opensans/opensans-webfont.woff +0 -0
  80. data/app/assets/stylesheets/web_admin/landing.css +272 -0
  81. data/app/assets/stylesheets/web_admin/plugin.css +1132 -0
  82. data/app/assets/stylesheets/web_admin/style.css +613 -0
  83. data/app/assets/stylesheets/web_admin/style2.css +21 -0
  84. data/app/controllers/web_admin/albums_controller.rb +8 -0
  85. data/app/controllers/web_admin/application_controller.rb +10 -0
  86. data/app/controllers/web_admin/crud_controller.rb +61 -0
  87. data/app/controllers/web_admin/events_controller.rb +9 -0
  88. data/app/controllers/web_admin/images_controller.rb +8 -0
  89. data/app/controllers/web_admin/institutionals_controller.rb +8 -0
  90. data/app/controllers/web_admin/main_controller.rb +7 -0
  91. data/app/controllers/web_admin/posts_controller.rb +19 -0
  92. data/app/controllers/web_admin/users_controller.rb +15 -0
  93. data/app/controllers/web_admin/videos_controller.rb +8 -0
  94. data/app/enumerations/web_admin/permission_type.rb +5 -0
  95. data/app/enumerations/web_admin/user_type.rb +6 -0
  96. data/app/helpers/web_admin/application_helper.rb +20 -0
  97. data/app/models/ability.rb +14 -0
  98. data/app/models/ckeditor/asset.rb +7 -0
  99. data/app/models/ckeditor/attachment_file.rb +7 -0
  100. data/app/models/ckeditor/picture.rb +7 -0
  101. data/app/models/web_admin/album.rb +13 -0
  102. data/app/models/web_admin/event.rb +20 -0
  103. data/app/models/web_admin/image.rb +10 -0
  104. data/app/models/web_admin/institutional.rb +11 -0
  105. data/app/models/web_admin/permission.rb +9 -0
  106. data/app/models/web_admin/post.rb +14 -0
  107. data/app/models/web_admin/user.rb +25 -0
  108. data/app/models/web_admin/video.rb +17 -0
  109. data/app/uploaders/ckeditor_attachment_file_uploader.rb +36 -0
  110. data/app/uploaders/ckeditor_picture_uploader.rb +47 -0
  111. data/app/uploaders/web_admin/image_post_uploader.rb +55 -0
  112. data/app/uploaders/web_admin/image_uploader.rb +52 -0
  113. data/app/views/devise/confirmations/new.html.erb +12 -0
  114. data/app/views/devise/mailer/confirmation_instructions.html.erb +5 -0
  115. data/app/views/devise/mailer/reset_password_instructions.html.erb +8 -0
  116. data/app/views/devise/mailer/unlock_instructions.html.erb +7 -0
  117. data/app/views/devise/passwords/edit.html.erb +16 -0
  118. data/app/views/devise/passwords/new.html.erb +12 -0
  119. data/app/views/devise/registrations/edit.html.erb +29 -0
  120. data/app/views/devise/registrations/new.html.erb +18 -0
  121. data/app/views/devise/sessions/new.html.erb +16 -0
  122. data/app/views/devise/shared/_links.html.erb +25 -0
  123. data/app/views/devise/unlocks/new.html.erb +12 -0
  124. data/app/views/layouts/web_admin/devise.html.erb +42 -0
  125. data/app/views/shared/403.html +57 -0
  126. data/app/views/shared/_header.html.erb +16 -0
  127. data/app/views/shared/_navbar.html.erb +23 -0
  128. data/app/views/shared/_notice.html.erb +12 -0
  129. data/app/views/web_admin/albums/_form.html.erb +23 -0
  130. data/app/views/web_admin/albums/edit.html.erb +4 -0
  131. data/app/views/web_admin/albums/index.html.erb +39 -0
  132. data/app/views/web_admin/albums/new.html.erb +4 -0
  133. data/app/views/web_admin/albums/show.html.erb +4 -0
  134. data/app/views/web_admin/events/_form.html.erb +37 -0
  135. data/app/views/web_admin/events/edit.html.erb +4 -0
  136. data/app/views/web_admin/events/index.html.erb +39 -0
  137. data/app/views/web_admin/events/new.html.erb +4 -0
  138. data/app/views/web_admin/images/_form.html.erb +23 -0
  139. data/app/views/web_admin/images/_images.html.erb +10 -0
  140. data/app/views/web_admin/images/create.js.erb +2 -0
  141. data/app/views/web_admin/images/update.js.erb +2 -0
  142. data/app/views/web_admin/institutionals/_form.html.erb +22 -0
  143. data/app/views/web_admin/institutionals/edit.html.erb +4 -0
  144. data/app/views/web_admin/institutionals/index.html.erb +35 -0
  145. data/app/views/web_admin/institutionals/new.html.erb +4 -0
  146. data/app/views/web_admin/layouts/application.html.erb +77 -0
  147. data/app/views/web_admin/main/index.html.erb +1 -0
  148. data/app/views/web_admin/posts/_form.html.erb +27 -0
  149. data/app/views/web_admin/posts/edit.html.erb +4 -0
  150. data/app/views/web_admin/posts/index.html.erb +37 -0
  151. data/app/views/web_admin/posts/new.html.erb +4 -0
  152. data/app/views/web_admin/users/_form.html.erb +49 -0
  153. data/app/views/web_admin/users/edit.html.erb +4 -0
  154. data/app/views/web_admin/users/index.html.erb +35 -0
  155. data/app/views/web_admin/users/new.html.erb +4 -0
  156. data/app/views/web_admin/videos/_form.html.erb +22 -0
  157. data/app/views/web_admin/videos/edit.html.erb +4 -0
  158. data/app/views/web_admin/videos/index.html.erb +37 -0
  159. data/app/views/web_admin/videos/new.html.erb +4 -0
  160. data/bin/rails +12 -0
  161. data/config/initializers/ckeditor.rb +39 -0
  162. data/config/initializers/devise.rb +261 -0
  163. data/config/initializers/enumerate_it.rb +1 -0
  164. data/config/initializers/simple_form.rb +145 -0
  165. data/config/initializers/simple_form_bootstrap.rb +46 -0
  166. data/config/locales/buttons.yml +3 -0
  167. data/config/locales/controllers.yml +9 -0
  168. data/config/locales/devise.en.yml +62 -0
  169. data/config/locales/devise.pt.yml +62 -0
  170. data/config/locales/models.yml +54 -0
  171. data/config/locales/rails.yml +219 -0
  172. data/config/locales/responders.yml +10 -0
  173. data/config/locales/simple_form.en.yml +26 -0
  174. data/config/routes.rb +13 -0
  175. data/db/migrate/20141023223026_devise_create_admin_web_users.rb +42 -0
  176. data/db/migrate/20141023223656_create_admin_web_posts.rb +15 -0
  177. data/db/migrate/20141026181117_create_ckeditor_assets.rb +26 -0
  178. data/db/migrate/20141028020102_create_admin_web_institutionals.rb +10 -0
  179. data/db/migrate/20141028135201_create_admin_web_videos.rb +10 -0
  180. data/db/migrate/20141114020551_create_admin_web_albums.rb +12 -0
  181. data/db/migrate/20141117183405_create_admin_web_images.rb +11 -0
  182. data/db/migrate/20141130203155_add_user_type_to_users.rb +5 -0
  183. data/db/migrate/20141224221959_create_admin_web_events.rb +18 -0
  184. data/db/migrate/20150130140502_create_admin_web_permissions.rb +13 -0
  185. data/db/migrate/20150510191213_rename_tables.rb +12 -0
  186. data/lib/application_responder.rb +12 -0
  187. data/lib/tasks/web_admin_tasks.rake +4 -0
  188. data/lib/templates/erb/scaffold/_form.html.erb +13 -0
  189. data/lib/web_admin/engine.rb +15 -0
  190. data/lib/web_admin/version.rb +3 -0
  191. data/lib/web_admin.rb +18 -0
  192. data/spec/factories/admin_web_users.rb +24 -0
  193. data/spec/features/admin_web/albums_spec.rb +74 -0
  194. data/spec/features/admin_web/event_spec.rb +85 -0
  195. data/spec/features/admin_web/institutionals_spec.rb +47 -0
  196. data/spec/features/admin_web/login_spec.rb +18 -0
  197. data/spec/features/admin_web/permissions_spec.rb +40 -0
  198. data/spec/features/admin_web/posts_spec.rb +55 -0
  199. data/spec/features/admin_web/users_spec.rb +73 -0
  200. data/spec/features/admin_web/videos_spec.rb +51 -0
  201. data/spec/fixtures/p3-single.jpg +0 -0
  202. data/spec/models/admin_web/album_spec.rb +20 -0
  203. data/spec/models/admin_web/event_spec.rb +42 -0
  204. data/spec/models/admin_web/image_spec.rb +14 -0
  205. data/spec/models/admin_web/institutional_spec.rb +19 -0
  206. data/spec/models/admin_web/permission_spec.rb +14 -0
  207. data/spec/models/admin_web/post_spec.rb +25 -0
  208. data/spec/models/admin_web/user_spec.rb +18 -0
  209. data/spec/models/admin_web/video_spec.rb +26 -0
  210. data/spec/rails_helper.rb +52 -0
  211. data/spec/spec_helper.rb +85 -0
  212. data/spec/support/capybara.rb +53 -0
  213. data/spec/support/database_cleaner.rb +25 -0
  214. data/spec/support/devise.rb +5 -0
  215. data/spec/support/factory_girl.rb +4 -0
  216. data/spec/support/helpers.rb +82 -0
  217. data/spec/support/shared_connection.rb +10 -0
  218. data/spec/test_app/README.rdoc +28 -0
  219. data/spec/test_app/Rakefile +6 -0
  220. data/spec/test_app/app/assets/images/.keep +0 -0
  221. data/spec/test_app/app/assets/javascripts/application.js +13 -0
  222. data/spec/test_app/app/assets/stylesheets/application.css +15 -0
  223. data/spec/test_app/app/controllers/application_controller.rb +5 -0
  224. data/spec/test_app/app/controllers/concerns/.keep +0 -0
  225. data/spec/test_app/app/helpers/application_helper.rb +2 -0
  226. data/spec/test_app/app/mailers/.keep +0 -0
  227. data/spec/test_app/app/models/.keep +0 -0
  228. data/spec/test_app/app/models/concerns/.keep +0 -0
  229. data/spec/test_app/app/views/layouts/application.html.erb +14 -0
  230. data/spec/test_app/bin/bundle +3 -0
  231. data/spec/test_app/bin/rails +4 -0
  232. data/spec/test_app/bin/rake +4 -0
  233. data/spec/test_app/config/application.rb +29 -0
  234. data/spec/test_app/config/boot.rb +5 -0
  235. data/spec/test_app/config/database.yml +85 -0
  236. data/spec/test_app/config/environment.rb +5 -0
  237. data/spec/test_app/config/environments/development.rb +37 -0
  238. data/spec/test_app/config/environments/production.rb +78 -0
  239. data/spec/test_app/config/environments/test.rb +39 -0
  240. data/spec/test_app/config/initializers/assets.rb +8 -0
  241. data/spec/test_app/config/initializers/backtrace_silencers.rb +7 -0
  242. data/spec/test_app/config/initializers/cookies_serializer.rb +3 -0
  243. data/spec/test_app/config/initializers/filter_parameter_logging.rb +4 -0
  244. data/spec/test_app/config/initializers/inflections.rb +16 -0
  245. data/spec/test_app/config/initializers/mime_types.rb +4 -0
  246. data/spec/test_app/config/initializers/session_store.rb +3 -0
  247. data/spec/test_app/config/initializers/wrap_parameters.rb +14 -0
  248. data/spec/test_app/config/locales/en.yml +23 -0
  249. data/spec/test_app/config/routes.rb +4 -0
  250. data/spec/test_app/config/secrets.yml +22 -0
  251. data/spec/test_app/config.ru +4 -0
  252. data/spec/test_app/db/schema.rb +121 -0
  253. data/spec/test_app/lib/assets/.keep +0 -0
  254. data/spec/test_app/log/.keep +0 -0
  255. data/spec/test_app/public/404.html +67 -0
  256. data/spec/test_app/public/422.html +67 -0
  257. data/spec/test_app/public/500.html +66 -0
  258. data/spec/test_app/public/favicon.ico +0 -0
  259. data/spec/test_app/spec/factories/admin_web_albums.rb +7 -0
  260. data/spec/test_app/spec/factories/admin_web_users.rb +24 -0
  261. data/spec/test_app/spec/factories/permissions.rb +36 -0
  262. data/web_admin.gemspec +38 -0
  263. data/wercker.yml +16 -0
  264. metadata +530 -0
@@ -0,0 +1,220 @@
1
+ Date.now = Date.now || function() { return +new Date; };
2
+
3
+ !function ($) {
4
+
5
+ $(function(){
6
+
7
+ var isRgbaSupport = function(){
8
+ var value = 'rgba(1,1,1,0.5)',
9
+ el = document.createElement('p'),
10
+ result = false;
11
+ try {
12
+ el.style.color = value;
13
+ result = /^rgba/.test(el.style.color);
14
+ } catch(e) {}
15
+ el = null;
16
+ return result;
17
+ };
18
+
19
+ var toRgba = function(str, alpha){
20
+ var patt = /^#([\da-fA-F]{2})([\da-fA-F]{2})([\da-fA-F]{2})$/;
21
+ var matches = patt.exec(str);
22
+ return "rgba("+parseInt(matches[1], 16)+","+parseInt(matches[2], 16)+","+parseInt(matches[3], 16)+","+alpha+")";
23
+ };
24
+
25
+ // chart js
26
+ var generateSparkline = function($re){
27
+ $(".sparkline").each(function(){
28
+ var $data = $(this).data();
29
+ if($re && !$data.resize) return;
30
+ if($data.type == 'bar'){
31
+ !$data.barColor && ($data.barColor = "#3fcf7f");
32
+ !$data.barSpacing && ($data.barSpacing = 2);
33
+ $(this).next('.axis').find('li').css('width',$data.barWidth+'px').css('margin-right',$data.barSpacing+'px');
34
+ };
35
+
36
+ ($data.type == 'pie') && $data.sliceColors && ($data.sliceColors = eval($data.sliceColors));
37
+
38
+ // $data.fillColor && ($data.fillColor.indexOf("#") !== -1) && isRgbaSupport() && ($data.fillColor = toRgba($data.fillColor, 0.5));
39
+ $data.spotColor = $data.minSpotColor = $data.maxSpotColor = $data.highlightSpotColor = $data.lineColor;
40
+ $(this).sparkline( $data.data || "html", $data);
41
+
42
+ if($(this).data("compositeData")){
43
+ var $cdata = {};
44
+ $cdata.composite = true;
45
+ $cdata.spotRadius = $data.spotRadius;
46
+ $cdata.lineColor = $data.compositeLineColor || '#a3e2fe';
47
+ $cdata.fillColor = $data.compositeFillColor || '#e3f6ff';
48
+ $cdata.highlightLineColor = $data.highlightLineColor;
49
+ $cdata.spotColor = $cdata.minSpotColor = $cdata.maxSpotColor = $cdata.highlightSpotColor = $cdata.lineColor;
50
+ isRgbaSupport() && ($cdata.fillColor = toRgba($cdata.fillColor, 0.5));
51
+ $(this).sparkline($(this).data("compositeData"),$cdata);
52
+ };
53
+ if($data.type == 'line'){
54
+ $(this).next('.axis').addClass('axis-full');
55
+ };
56
+ });
57
+ };
58
+
59
+ var sparkResize;
60
+ $(window).resize(function(e) {
61
+ clearTimeout(sparkResize);
62
+ sparkResize = setTimeout(function(){generateSparkline(true)}, 500);
63
+ });
64
+ generateSparkline(false);
65
+
66
+ // easypie
67
+ var updatePie = function($that) {
68
+ var $this = $that,
69
+ $text = $('span', $this),
70
+ $oldValue = $text.html(),
71
+ $newValue = Math.round(100*Math.random());
72
+
73
+ $this.data('easyPieChart').update($newValue);
74
+
75
+ $({v: $oldValue}).animate({v: $newValue}, {
76
+ duration: 1000,
77
+ easing:'swing',
78
+ step: function() {
79
+ $text.text(Math.ceil(this.v));
80
+ }
81
+ });
82
+ };
83
+
84
+ $('.easypiechart').each(function(){
85
+ var $barColor = $(this).data("barColor") || function($percent) {
86
+ $percent /= 100;
87
+ return "rgb(" + Math.round(255 * (1-$percent)) + ", " + Math.round(255 * $percent) + ", 125)";
88
+ },
89
+ $trackColor = $(this).data("trackColor") || "#c8d2db",
90
+ $scaleColor = $(this).data("scaleColor"),
91
+ $lineWidth = $(this).data("lineWidth") || 12,
92
+ $size = $(this).data("size") || 130,
93
+ $animate = $(this).data("animate") || 1000;
94
+
95
+ $(this).easyPieChart({
96
+ barColor: $barColor,
97
+ trackColor: $trackColor,
98
+ scaleColor: $scaleColor,
99
+ lineCap: 'butt',
100
+ lineWidth: $lineWidth,
101
+ size: $size,
102
+ animate: $animate,
103
+ onStop: function(){
104
+ var $this = this.$el;
105
+ $this.data("loop") && setTimeout(function(){ $this.data("loop") && updatePie($this) }, 2000);
106
+ }
107
+ });
108
+ });
109
+
110
+ $(document).on('click', '[data-toggle^="class:pie"]', function (e) {
111
+ e && e.preventDefault();
112
+ var $btn = $(e.target), $loop = $('[data-loop]').data('loop'), $target;
113
+ !$btn.data('toggle') && ($btn = $btn.closest('[data-toggle^="class"]'));
114
+ $target = $btn.data('target');
115
+ !$target && ($target = $btn.closest('[data-loop]'));
116
+ $target.data('loop', !$loop);
117
+ !$loop && updatePie($('[data-loop]'));
118
+ });
119
+
120
+ // combodate
121
+ $(".combodate").each(function(){
122
+ $(this).combodate();
123
+ $(this).next('.combodate').find('select').addClass('form-control');
124
+ });
125
+ // datepicker
126
+ $(".datepicker").each(function(){ $(this).datepicker();});
127
+ // dropfile
128
+ $('.dropfile').each(function(){
129
+ var $dropbox = $(this);
130
+ if (typeof window.FileReader === 'undefined') {
131
+ $('small',this).html('File API & FileReader API not supported').addClass('text-danger');
132
+ return;
133
+ }
134
+
135
+ this.ondragover = function () {$dropbox.addClass('hover'); return false; };
136
+ this.ondragend = function () {$dropbox.removeClass('hover'); return false; };
137
+ this.ondrop = function (e) {
138
+ e.preventDefault();
139
+ $dropbox.removeClass('hover').html('');
140
+ var file = e.dataTransfer.files[0],
141
+ reader = new FileReader();
142
+ reader.onload = function (event) {
143
+ $dropbox.append($('<img>').attr('src', event.target.result));
144
+ };
145
+ reader.readAsDataURL(file);
146
+ return false;
147
+ };
148
+ });
149
+
150
+ // fuelux pillbox
151
+ var addPill = function($input){
152
+ var $text = $input.val(), $pills = $input.closest('.pillbox'), $repeat = false, $repeatPill;
153
+ if($text == "") return;
154
+ $("li", $pills).text(function(i,v){
155
+ if(v == $text){
156
+ $repeatPill = $(this);
157
+ $repeat = true;
158
+ }
159
+ });
160
+ if($repeat) {
161
+ $repeatPill.fadeOut().fadeIn();
162
+ return;
163
+ };
164
+ $item = $('<li class="label bg-default">'+$text+'</li> ');
165
+ $item.insertBefore($input);
166
+ $input.val('');
167
+ $pills.trigger('change', $item);
168
+ };
169
+
170
+ $('.pillbox input').on('blur', function() {
171
+ addPill($(this));
172
+ });
173
+
174
+ $('.pillbox input').on('keypress', function(e) {
175
+ if(e.which == 13) {
176
+ e.preventDefault();
177
+ addPill($(this));
178
+ }
179
+ });
180
+
181
+ // slider
182
+ $('.slider').each(function(){
183
+ $(this).slider();
184
+ });
185
+
186
+ // wizard
187
+ $(document).on('click', '[data-wizard]', function (e) {
188
+ var $this = $(this), href;
189
+ var $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, ''));
190
+ var option = $this.data('wizard');
191
+ var item = $target.wizard('selectedItem');
192
+ var $step = $(this).closest('.step-content').find('.step-pane:eq(' + (item.step-1) + ')');
193
+ if( $step.find('input, select, textarea').data('required') && !$step.find('input, select, textarea').parsley( 'validate' ) ){
194
+ return false;
195
+ }else{
196
+ $target.wizard(option);
197
+ var activeStep = (option=="next") ? (item.step+1) : (item.step-1);
198
+ var prev = ($(this).hasClass('btn-prev') && $(this)) || $(this).prev();
199
+ prev.attr('disabled', (activeStep == 1) ? true : false);
200
+ }
201
+ });
202
+
203
+ // portlet
204
+ $('.portlet').each(function(){
205
+ $(".portlet").sortable({
206
+ connectWith: '.portlet',
207
+ iframeFix: false,
208
+ items: '.portlet-item',
209
+ opacity: 0.8,
210
+ helper: 'original',
211
+ revert: true,
212
+ forceHelperSize: true,
213
+ placeholder: 'sortable-box-placeholder round-all',
214
+ forcePlaceholderSize: true,
215
+ tolerance: 'pointer'
216
+ });
217
+ });
218
+
219
+ });
220
+ }(window.jQuery);
@@ -0,0 +1,20 @@
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
+ // compiled file.
9
+ //
10
+ // Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
11
+ // about supported directives.
12
+ //
13
+ //= require jquery
14
+ //= require jquery_ujs
15
+ //= require jquery-fileupload/basic
16
+ //= require jquery-fileupload/vendor/tmpl
17
+ //= require ckeditor/init
18
+ //= require_tree .
19
+
20
+ $(":file").filestyle({icon: false, buttonText: "Selecione o(s) arquivo(s)"});
@@ -0,0 +1 @@
1
+ (function(c){var b=function(d,e){this.options=e;this.$elementFilestyle=[];this.$element=c(d)};b.prototype={clear:function(){this.$element.val("");this.$elementFilestyle.find(":text").val("");this.$elementFilestyle.find(".badge").remove()},destroy:function(){this.$element.removeAttr("style").removeData("filestyle").val("");this.$elementFilestyle.remove()},disabled:function(d){if(d===true){if(!this.options.disabled){this.$element.attr("disabled","true");this.$elementFilestyle.find("label").attr("disabled","true");this.options.disabled=true}}else{if(d===false){if(this.options.disabled){this.$element.removeAttr("disabled");this.$elementFilestyle.find("label").removeAttr("disabled");this.options.disabled=false}}else{return this.options.disabled}}},buttonBefore:function(d){if(d===true){if(!this.options.buttonBefore){this.options.buttonBefore=true;if(this.options.input){this.$elementFilestyle.remove();this.constructor();this.pushNameFiles()}}}else{if(d===false){if(this.options.buttonBefore){this.options.buttonBefore=false;if(this.options.input){this.$elementFilestyle.remove();this.constructor();this.pushNameFiles()}}}else{return this.options.buttonBefore}}},icon:function(d){if(d===true){if(!this.options.icon){this.options.icon=true;this.$elementFilestyle.find("label").prepend(this.htmlIcon())}}else{if(d===false){if(this.options.icon){this.options.icon=false;this.$elementFilestyle.find(".glyphicon").remove()}}else{return this.options.icon}}},input:function(e){if(e===true){if(!this.options.input){this.options.input=true;if(this.options.buttonBefore){this.$elementFilestyle.append(this.htmlInput())}else{this.$elementFilestyle.prepend(this.htmlInput())}this.$elementFilestyle.find(".badge").remove();this.pushNameFiles();this.$elementFilestyle.find(".group-span-filestyle").addClass("input-group-btn")}}else{if(e===false){if(this.options.input){this.options.input=false;this.$elementFilestyle.find(":text").remove();var d=this.pushNameFiles();if(d.length>0&&this.options.badge){this.$elementFilestyle.find("label").append(' <span class="badge">'+d.length+"</span>")}this.$elementFilestyle.find(".group-span-filestyle").removeClass("input-group-btn")}}else{return this.options.input}}},size:function(d){if(d!==undefined){var f=this.$elementFilestyle.find("label"),e=this.$elementFilestyle.find("input");f.removeClass("btn-lg btn-sm");e.removeClass("input-lg input-sm");if(d!="nr"){f.addClass("btn-"+d);e.addClass("input-"+d)}}else{return this.options.size}},buttonText:function(d){if(d!==undefined){this.options.buttonText=d;this.$elementFilestyle.find("label span").html(this.options.buttonText)}else{return this.options.buttonText}},buttonName:function(d){if(d!==undefined){this.options.buttonName=d;this.$elementFilestyle.find("label").attr({"class":"btn "+this.options.buttonName})}else{return this.options.buttonName}},iconName:function(d){if(d!==undefined){this.$elementFilestyle.find(".glyphicon").attr({"class":".glyphicon "+this.options.iconName})}else{return this.options.iconName}},htmlIcon:function(){if(this.options.icon){return'<span class="glyphicon '+this.options.iconName+'"></span> '}else{return""}},htmlInput:function(){if(this.options.input){return'<input type="text" class="form-control '+(this.options.size=="nr"?"":"input-"+this.options.size)+'" disabled> '}else{return""}},pushNameFiles:function(){var d="",f=[];if(this.$element[0].files===undefined){f[0]={name:this.$element[0]&&this.$element[0].value}}else{f=this.$element[0].files}for(var e=0;e<f.length;e++){d+=f[e].name.split("\\").pop()+", "}if(d!==""){this.$elementFilestyle.find(":text").val(d.replace(/\, $/g,""))}else{this.$elementFilestyle.find(":text").val("")}return f},constructor:function(){var h=this,f="",g=h.$element.attr("id"),d=[],i="",e;if(g===""||!g){g="filestyle-"+c(".bootstrap-filestyle").length;h.$element.attr({id:g})}i='<span class="group-span-filestyle '+(h.options.input?"input-group-btn":"")+'"><label for="'+g+'" class="btn '+h.options.buttonName+" "+(h.options.size=="nr"?"":"btn-"+h.options.size)+'" '+(h.options.disabled?'disabled="true"':"")+">"+h.htmlIcon()+h.options.buttonText+"</label></span>";f=h.options.buttonBefore?i+h.htmlInput():h.htmlInput()+i;h.$elementFilestyle=c('<div class="bootstrap-filestyle input-group">'+f+"</div>");h.$elementFilestyle.find(".group-span-filestyle").attr("tabindex","0").keypress(function(j){if(j.keyCode===13||j.charCode===32){h.$elementFilestyle.find("label").click();return false}});h.$element.css({position:"absolute",clip:"rect(0px 0px 0px 0px)"}).attr("tabindex","-1").after(h.$elementFilestyle);if(h.options.disabled){h.$element.attr("disabled","true")}h.$element.change(function(){var j=h.pushNameFiles();if(h.options.input==false&&h.options.badge){if(h.$elementFilestyle.find(".badge").length==0){h.$elementFilestyle.find("label").append(' <span class="badge">'+j.length+"</span>")}else{if(j.length==0){h.$elementFilestyle.find(".badge").remove()}else{h.$elementFilestyle.find(".badge").html(j.length)}}}else{h.$elementFilestyle.find(".badge").remove()}});if(window.navigator.userAgent.search(/firefox/i)>-1){h.$elementFilestyle.find("label").click(function(){h.$element.click();return false})}}};var a=c.fn.filestyle;c.fn.filestyle=function(e,d){var f="",g=this.each(function(){if(c(this).attr("type")==="file"){var j=c(this),h=j.data("filestyle"),i=c.extend({},c.fn.filestyle.defaults,e,typeof e==="object"&&e);if(!h){j.data("filestyle",(h=new b(this,i)));h.constructor()}if(typeof e==="string"){f=h[e](d)}}});if(typeof f!==undefined){return f}else{return g}};c.fn.filestyle.defaults={buttonText:"Choose file",iconName:"glyphicon-folder-open",buttonName:"btn-default",size:"nr",input:true,badge:true,icon:true,buttonBefore:false,disabled:false};c.fn.filestyle.noConflict=function(){c.fn.filestyle=a;return this};c(function(){c(".filestyle").each(function(){var e=c(this),d={input:e.attr("data-input")==="false"?false:true,icon:e.attr("data-icon")==="false"?false:true,buttonBefore:e.attr("data-buttonBefore")==="true"?true:false,disabled:e.attr("data-disabled")==="true"?true:false,size:e.attr("data-size"),buttonText:e.attr("data-buttonText"),buttonName:e.attr("data-buttonName"),iconName:e.attr("data-iconName"),badge:e.attr("data-badge")==="false"?false:true};e.filestyle(d)})})})(window.jQuery);