sunrise-core 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (219) hide show
  1. data/Gemfile +1 -1
  2. data/README.rdoc +1 -1
  3. data/lib/generators/sunrise/templates/models/defaults/position_type.rb +2 -0
  4. data/lib/generators/sunrise/templates/models/defaults/role_type.rb +2 -0
  5. data/lib/generators/sunrise/templates/models/defaults/structure_type.rb +2 -0
  6. data/lib/sunrise/version.rb +1 -1
  7. data/spec/dummy/log/test.log +5332 -39751
  8. data/spec/dummy/script/rails +0 -0
  9. metadata +862 -1288
  10. data/spec/dummy/public/uploads/avatar/4/rails.png +0 -0
  11. data/spec/dummy/public/uploads/avatar/4/thumb_rails.png +0 -0
  12. data/spec/dummy/public/uploads/avatar/5/rails.png +0 -0
  13. data/spec/dummy/public/uploads/avatar/5/thumb_rails.png +0 -0
  14. data/spec/dummy/public/uploads/avatar/6/rails.png +0 -0
  15. data/spec/dummy/public/uploads/avatar/6/thumb_rails.png +0 -0
  16. data/spec/dummy/public/uploads/avatar/7/rails.png +0 -0
  17. data/spec/dummy/public/uploads/avatar/7/thumb_rails.png +0 -0
  18. data/spec/dummy/public/uploads/avatar/8/rails.png +0 -0
  19. data/spec/dummy/public/uploads/avatar/8/thumb_rails.png +0 -0
  20. data/spec/dummy/public/uploads/tmp/20110819-1743-19227-1016/silicon_valley.jpg +0 -0
  21. data/spec/dummy/public/uploads/tmp/20110819-1743-19227-1016/thumb_silicon_valley.jpg +0 -0
  22. data/spec/dummy/public/uploads/tmp/20110819-1744-19584-0221/silicon_valley.jpg +0 -0
  23. data/spec/dummy/public/uploads/tmp/20110819-1744-19584-0221/thumb_silicon_valley.jpg +0 -0
  24. data/spec/tmp/app/helpers/manage/assets_helper.rb +0 -2
  25. data/spec/tmp/app/helpers/manage/base_helper.rb +0 -83
  26. data/spec/tmp/app/helpers/manage/pages_helper.rb +0 -2
  27. data/spec/tmp/app/helpers/manage/settings_helper.rb +0 -2
  28. data/spec/tmp/app/helpers/manage/structures_helper.rb +0 -12
  29. data/spec/tmp/app/helpers/manage/users_helper.rb +0 -6
  30. data/spec/tmp/app/models/defaults/ability.rb +0 -39
  31. data/spec/tmp/app/models/defaults/asset.rb +0 -9
  32. data/spec/tmp/app/models/defaults/attachment_file.rb +0 -31
  33. data/spec/tmp/app/models/defaults/avatar.rb +0 -34
  34. data/spec/tmp/app/models/defaults/header.rb +0 -5
  35. data/spec/tmp/app/models/defaults/page.rb +0 -5
  36. data/spec/tmp/app/models/defaults/picture.rb +0 -31
  37. data/spec/tmp/app/models/defaults/position_type.rb +0 -7
  38. data/spec/tmp/app/models/defaults/role.rb +0 -20
  39. data/spec/tmp/app/models/defaults/role_type.rb +0 -8
  40. data/spec/tmp/app/models/defaults/structure.rb +0 -9
  41. data/spec/tmp/app/models/defaults/structure_type.rb +0 -9
  42. data/spec/tmp/app/models/defaults/user.rb +0 -47
  43. data/spec/tmp/app/uploaders/attachment_file_uploader.rb +0 -5
  44. data/spec/tmp/app/uploaders/avatar_uploader.rb +0 -13
  45. data/spec/tmp/app/uploaders/picture_uploader.rb +0 -17
  46. data/spec/tmp/app/views/layouts/application.html.erb +0 -35
  47. data/spec/tmp/app/views/pages/show.html.erb +0 -2
  48. data/spec/tmp/app/views/shared/_notice.html.erb +0 -17
  49. data/spec/tmp/config/application.rb +0 -47
  50. data/spec/tmp/config/application.yml.sample +0 -4
  51. data/spec/tmp/config/database.yml.sample +0 -34
  52. data/spec/tmp/config/initializers/sunrise.rb +0 -7
  53. data/spec/tmp/config/logrotate-config.sample +0 -9
  54. data/spec/tmp/config/nginx-config-passenger.sample +0 -60
  55. data/spec/tmp/config/routes.rb +0 -7
  56. data/spec/tmp/db/migrate/20110819144550_sunrise_create_users.rb +0 -29
  57. data/spec/tmp/db/migrate/20110819144650_sunrise_create_roles.rb +0 -16
  58. data/spec/tmp/db/migrate/20110819144750_sunrise_create_structures.rb +0 -27
  59. data/spec/tmp/db/migrate/20110819144850_sunrise_create_pages.rb +0 -17
  60. data/spec/tmp/db/migrate/20110819144950_sunrise_create_assets.rb +0 -28
  61. data/spec/tmp/db/migrate/20110819145050_sunrise_create_headers.rb +0 -20
  62. data/spec/tmp/db/seeds.rb +0 -25
  63. data/spec/tmp/public/images/alert.png +0 -0
  64. data/spec/tmp/public/images/cross_ico.png +0 -0
  65. data/spec/tmp/public/images/manage/add_post_bot.gif +0 -0
  66. data/spec/tmp/public/images/manage/add_post_top.gif +0 -0
  67. data/spec/tmp/public/images/manage/add_white_bot.gif +0 -0
  68. data/spec/tmp/public/images/manage/add_white_top.gif +0 -0
  69. data/spec/tmp/public/images/manage/arrow.png +0 -0
  70. data/spec/tmp/public/images/manage/back_but_lc.gif +0 -0
  71. data/spec/tmp/public/images/manage/back_but_rc.gif +0 -0
  72. data/spec/tmp/public/images/manage/bot_corn.gif +0 -0
  73. data/spec/tmp/public/images/manage/bot_duo_corn.gif +0 -0
  74. data/spec/tmp/public/images/manage/but_bg.png +0 -0
  75. data/spec/tmp/public/images/manage/but_block_lc.gif +0 -0
  76. data/spec/tmp/public/images/manage/but_block_rc.gif +0 -0
  77. data/spec/tmp/public/images/manage/but_freze_lc.gif +0 -0
  78. data/spec/tmp/public/images/manage/but_freze_rc.gif +0 -0
  79. data/spec/tmp/public/images/manage/but_gr.gif +0 -0
  80. data/spec/tmp/public/images/manage/but_gr_l.gif +0 -0
  81. data/spec/tmp/public/images/manage/but_gr_r.gif +0 -0
  82. data/spec/tmp/public/images/manage/but_search.gif +0 -0
  83. data/spec/tmp/public/images/manage/but_unfreze_lc.gif +0 -0
  84. data/spec/tmp/public/images/manage/but_unfreze_rc.gif +0 -0
  85. data/spec/tmp/public/images/manage/button_add_foto.gif +0 -0
  86. data/spec/tmp/public/images/manage/button_add_foto_ru.gif +0 -0
  87. data/spec/tmp/public/images/manage/button_add_foto_ua.gif +0 -0
  88. data/spec/tmp/public/images/manage/button_add_foto_uk.gif +0 -0
  89. data/spec/tmp/public/images/manage/cancelbutton.gif +0 -0
  90. data/spec/tmp/public/images/manage/dark_arr.gif +0 -0
  91. data/spec/tmp/public/images/manage/dark_arr_left.gif +0 -0
  92. data/spec/tmp/public/images/manage/dark_cross_ico.gif +0 -0
  93. data/spec/tmp/public/images/manage/dot.gif +0 -0
  94. data/spec/tmp/public/images/manage/duo_bg.gif +0 -0
  95. data/spec/tmp/public/images/manage/duo_bg_small.gif +0 -0
  96. data/spec/tmp/public/images/manage/duo_bg_small_blocked.gif +0 -0
  97. data/spec/tmp/public/images/manage/duo_bg_small_frozed.gif +0 -0
  98. data/spec/tmp/public/images/manage/duo_bg_small_notact.gif +0 -0
  99. data/spec/tmp/public/images/manage/duo_bot_small.gif +0 -0
  100. data/spec/tmp/public/images/manage/duo_bot_small_blocked.gif +0 -0
  101. data/spec/tmp/public/images/manage/duo_bot_small_frozed.gif +0 -0
  102. data/spec/tmp/public/images/manage/duo_bot_small_notact.gif +0 -0
  103. data/spec/tmp/public/images/manage/duo_top_small.gif +0 -0
  104. data/spec/tmp/public/images/manage/duo_top_small_blocked.gif +0 -0
  105. data/spec/tmp/public/images/manage/duo_top_small_frozed.gif +0 -0
  106. data/spec/tmp/public/images/manage/duo_top_small_notact.gif +0 -0
  107. data/spec/tmp/public/images/manage/edit_white_top.gif +0 -0
  108. data/spec/tmp/public/images/manage/empty.gif +0 -0
  109. data/spec/tmp/public/images/manage/filter_bot_bg.gif +0 -0
  110. data/spec/tmp/public/images/manage/filter_top_bg.gif +0 -0
  111. data/spec/tmp/public/images/manage/flag_en.gif +0 -0
  112. data/spec/tmp/public/images/manage/flag_en_nonact.gif +0 -0
  113. data/spec/tmp/public/images/manage/flag_ru.gif +0 -0
  114. data/spec/tmp/public/images/manage/flag_ru_nonact.gif +0 -0
  115. data/spec/tmp/public/images/manage/flag_ua.gif +0 -0
  116. data/spec/tmp/public/images/manage/flag_ua_nonact.gif +0 -0
  117. data/spec/tmp/public/images/manage/foto.jpg +0 -0
  118. data/spec/tmp/public/images/manage/ico_add.gif +0 -0
  119. data/spec/tmp/public/images/manage/ico_delete.gif +0 -0
  120. data/spec/tmp/public/images/manage/ico_down.gif +0 -0
  121. data/spec/tmp/public/images/manage/ico_edit.gif +0 -0
  122. data/spec/tmp/public/images/manage/ico_settings.gif +0 -0
  123. data/spec/tmp/public/images/manage/ico_up.gif +0 -0
  124. data/spec/tmp/public/images/manage/input_bg.gif +0 -0
  125. data/spec/tmp/public/images/manage/l_but_corn.gif +0 -0
  126. data/spec/tmp/public/images/manage/minimise_but.gif +0 -0
  127. data/spec/tmp/public/images/manage/mp3.png +0 -0
  128. data/spec/tmp/public/images/manage/page_arr_hover.png +0 -0
  129. data/spec/tmp/public/images/manage/page_next_arr.gif +0 -0
  130. data/spec/tmp/public/images/manage/page_num_hover.gif +0 -0
  131. data/spec/tmp/public/images/manage/page_prev_arr.gif +0 -0
  132. data/spec/tmp/public/images/manage/panel/l_but_corn.gif +0 -0
  133. data/spec/tmp/public/images/manage/panel/maximise_but.gif +0 -0
  134. data/spec/tmp/public/images/manage/panel/r_but_corn.gif +0 -0
  135. data/spec/tmp/public/images/manage/panel/top_menu_arr.gif +0 -0
  136. data/spec/tmp/public/images/manage/panel/user_pic.gif +0 -0
  137. data/spec/tmp/public/images/manage/preloader.gif +0 -0
  138. data/spec/tmp/public/images/manage/r_but_corn.gif +0 -0
  139. data/spec/tmp/public/images/manage/select_bg.gif +0 -0
  140. data/spec/tmp/public/images/manage/select_corn.gif +0 -0
  141. data/spec/tmp/public/images/manage/struct_corn_lg.gif +0 -0
  142. data/spec/tmp/public/images/manage/struct_corn_llg.gif +0 -0
  143. data/spec/tmp/public/images/manage/struct_corn_lw.gif +0 -0
  144. data/spec/tmp/public/images/manage/struct_corn_rg.gif +0 -0
  145. data/spec/tmp/public/images/manage/struct_corn_rlg.gif +0 -0
  146. data/spec/tmp/public/images/manage/struct_corn_rw.gif +0 -0
  147. data/spec/tmp/public/images/manage/tab_gl.gif +0 -0
  148. data/spec/tmp/public/images/manage/tab_gr.gif +0 -0
  149. data/spec/tmp/public/images/manage/tab_wl.gif +0 -0
  150. data/spec/tmp/public/images/manage/tab_wr.gif +0 -0
  151. data/spec/tmp/public/images/manage/top_corn.gif +0 -0
  152. data/spec/tmp/public/images/manage/top_duo_corn.gif +0 -0
  153. data/spec/tmp/public/images/manage/top_menu_arr.gif +0 -0
  154. data/spec/tmp/public/images/manage/transp_cross.png +0 -0
  155. data/spec/tmp/public/images/manage/upload_progress.gif +0 -0
  156. data/spec/tmp/public/images/manage/user_act_lc.gif +0 -0
  157. data/spec/tmp/public/images/manage/user_act_rc.gif +0 -0
  158. data/spec/tmp/public/images/manage/user_ico.gif +0 -0
  159. data/spec/tmp/public/images/manage/user_pic.gif +0 -0
  160. data/spec/tmp/public/images/manage/user_pic_small.gif +0 -0
  161. data/spec/tmp/public/images/manage/user_pic_thumb.gif +0 -0
  162. data/spec/tmp/public/javascripts/datepicker/jquery-ui-i18n.js +0 -1176
  163. data/spec/tmp/public/javascripts/datepicker/jquery.ui.datepicker-ru.js +0 -37
  164. data/spec/tmp/public/javascripts/datepicker/jquery.ui.datepicker-uk.js +0 -37
  165. data/spec/tmp/public/javascripts/jquery-ui-timepicker-addon.js +0 -911
  166. data/spec/tmp/public/javascripts/jquery.cookie.js +0 -97
  167. data/spec/tmp/public/javascripts/jquery.fancybox-1.3.4.pack.js +0 -46
  168. data/spec/tmp/public/javascripts/jquery.tmpl.min.js +0 -10
  169. data/spec/tmp/public/javascripts/manage-fileuploader.js +0 -182
  170. data/spec/tmp/public/javascripts/manage.js +0 -294
  171. data/spec/tmp/public/javascripts/preloader.js +0 -47
  172. data/spec/tmp/public/javascripts/rails.js +0 -331
  173. data/spec/tmp/public/stylesheets/alert.css +0 -26
  174. data/spec/tmp/public/stylesheets/application.css +0 -1
  175. data/spec/tmp/public/stylesheets/fancybox/images/blank.gif +0 -0
  176. data/spec/tmp/public/stylesheets/fancybox/images/fancy_close.png +0 -0
  177. data/spec/tmp/public/stylesheets/fancybox/images/fancy_loading.png +0 -0
  178. data/spec/tmp/public/stylesheets/fancybox/images/fancy_nav_left.png +0 -0
  179. data/spec/tmp/public/stylesheets/fancybox/images/fancy_nav_right.png +0 -0
  180. data/spec/tmp/public/stylesheets/fancybox/images/fancy_shadow_e.png +0 -0
  181. data/spec/tmp/public/stylesheets/fancybox/images/fancy_shadow_n.png +0 -0
  182. data/spec/tmp/public/stylesheets/fancybox/images/fancy_shadow_ne.png +0 -0
  183. data/spec/tmp/public/stylesheets/fancybox/images/fancy_shadow_nw.png +0 -0
  184. data/spec/tmp/public/stylesheets/fancybox/images/fancy_shadow_s.png +0 -0
  185. data/spec/tmp/public/stylesheets/fancybox/images/fancy_shadow_se.png +0 -0
  186. data/spec/tmp/public/stylesheets/fancybox/images/fancy_shadow_sw.png +0 -0
  187. data/spec/tmp/public/stylesheets/fancybox/images/fancy_shadow_w.png +0 -0
  188. data/spec/tmp/public/stylesheets/fancybox/images/fancy_title_left.png +0 -0
  189. data/spec/tmp/public/stylesheets/fancybox/images/fancy_title_main.png +0 -0
  190. data/spec/tmp/public/stylesheets/fancybox/images/fancy_title_over.png +0 -0
  191. data/spec/tmp/public/stylesheets/fancybox/images/fancy_title_right.png +0 -0
  192. data/spec/tmp/public/stylesheets/fancybox/images/fancybox-x.png +0 -0
  193. data/spec/tmp/public/stylesheets/fancybox/images/fancybox-y.png +0 -0
  194. data/spec/tmp/public/stylesheets/fancybox/images/fancybox.png +0 -0
  195. data/spec/tmp/public/stylesheets/fancybox/jquery.fancybox-1.3.4.css +0 -359
  196. data/spec/tmp/public/stylesheets/manage/buttons.css +0 -42
  197. data/spec/tmp/public/stylesheets/manage/ie.css +0 -16
  198. data/spec/tmp/public/stylesheets/manage/main.css +0 -1108
  199. data/spec/tmp/public/stylesheets/manage/panel.css +0 -126
  200. data/spec/tmp/public/stylesheets/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  201. data/spec/tmp/public/stylesheets/smoothness/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
  202. data/spec/tmp/public/stylesheets/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  203. data/spec/tmp/public/stylesheets/smoothness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  204. data/spec/tmp/public/stylesheets/smoothness/images/ui-bg_glass_75_dadada_1x400.png +0 -0
  205. data/spec/tmp/public/stylesheets/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  206. data/spec/tmp/public/stylesheets/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  207. data/spec/tmp/public/stylesheets/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  208. data/spec/tmp/public/stylesheets/smoothness/images/ui-icons_222222_256x240.png +0 -0
  209. data/spec/tmp/public/stylesheets/smoothness/images/ui-icons_2e83ff_256x240.png +0 -0
  210. data/spec/tmp/public/stylesheets/smoothness/images/ui-icons_454545_256x240.png +0 -0
  211. data/spec/tmp/public/stylesheets/smoothness/images/ui-icons_888888_256x240.png +0 -0
  212. data/spec/tmp/public/stylesheets/smoothness/images/ui-icons_cd0a0a_256x240.png +0 -0
  213. data/spec/tmp/public/stylesheets/smoothness/jquery-ui-1.8.13.custom.css +0 -578
  214. data/spec/tmp/spec/controllers/pages_controller_spec.rb +0 -22
  215. data/spec/tmp/spec/controllers/welcome_controller_spec.rb +0 -18
  216. data/spec/tmp/spec/factories/structure_factory.rb +0 -22
  217. data/spec/tmp/spec/factories/user_factory.rb +0 -60
  218. data/spec/tmp/spec/spec_helper.rb +0 -37
  219. data/spec/tmp/spec/support/helpers/controller_macros.rb +0 -51
@@ -1,47 +0,0 @@
1
- // Ajax Preloader
2
- var Preloader;
3
-
4
- if (Preloader == undefined) {
5
- Preloader = function(dom_id) {
6
- this.show(dom_id);
7
- };
8
- }
9
-
10
- Preloader.select = function(dom_id) {
11
- var element_id = (dom_id == null) ? 'preloader' : dom_id;
12
-
13
- if (this.element == null)
14
- {
15
- this.element = document.getElementById(element_id);
16
- }
17
- };
18
-
19
- Preloader.show = function(dom_id) {
20
- this.select(dom_id);
21
- if (this.element == null) return;
22
-
23
- this.draw();
24
- };
25
-
26
- Preloader.draw = function(){
27
- if (this.element == null) return;
28
-
29
- var client = window.innerHeight || document.documentElement.clientHeight;
30
- var top = window.pageYOffset || document.body.scrollTop || document.documentElement.scrollTop;
31
- var prefix = top + (client / 2);
32
-
33
- this.element.style.top = prefix + 'px';
34
- this.element.style.display = '';
35
- };
36
-
37
- Preloader.hide = function(dom_id){
38
- this.select(dom_id);
39
- if (this.element == null) return;
40
-
41
- this.element.style.display = 'none';
42
- this.element.style.top = '0px';
43
- };
44
-
45
- Preloader.is_enable = function(){
46
- return (document.getElementById('preloader') != null);
47
- };
@@ -1,331 +0,0 @@
1
- /**
2
- * Unobtrusive scripting adapter for jQuery
3
- *
4
- * Requires jQuery 1.6.0 or later.
5
- * https://github.com/rails/jquery-ujs
6
-
7
- * Uploading file using rails.js
8
- * =============================
9
- *
10
- * By default, browsers do not allow files to be uploaded via AJAX. As a result, if there are any non-blank file fields
11
- * in the remote form, this adapter aborts the AJAX submission and allows the form to submit through standard means.
12
- *
13
- * The `ajax:aborted:file` event allows you to bind your own handler to process the form submission however you wish.
14
- *
15
- * Ex:
16
- * $('form').live('ajax:aborted:file', function(event, elements){
17
- * // Implement own remote file-transfer handler here for non-blank file inputs passed in `elements`.
18
- * // Returning false in this handler tells rails.js to disallow standard form submission
19
- * return false;
20
- * });
21
- *
22
- * The `ajax:aborted:file` event is fired when a file-type input is detected with a non-blank value.
23
- *
24
- * Third-party tools can use this hook to detect when an AJAX file upload is attempted, and then use
25
- * techniques like the iframe method to upload the file instead.
26
- *
27
- * Required fields in rails.js
28
- * ===========================
29
- *
30
- * If any blank required inputs (required="required") are detected in the remote form, the whole form submission
31
- * is canceled. Note that this is unlike file inputs, which still allow standard (non-AJAX) form submission.
32
- *
33
- * The `ajax:aborted:required` event allows you to bind your own handler to inform the user of blank required inputs.
34
- *
35
- * !! Note that Opera does not fire the form's submit event if there are blank required inputs, so this event may never
36
- * get fired in Opera. This event is what causes other browsers to exhibit the same submit-aborting behavior.
37
- *
38
- * Ex:
39
- * $('form').live('ajax:aborted:required', function(event, elements){
40
- * // Returning false in this handler tells rails.js to submit the form anyway.
41
- * // The blank required inputs are passed to this function in `elements`.
42
- * return ! confirm("Would you like to submit the form with missing info?");
43
- * });
44
- */
45
-
46
- (function($, undefined) {
47
- // Shorthand to make it a little easier to call public rails functions from within rails.js
48
- var rails;
49
-
50
- $.rails = rails = {
51
- // Link elements bound by jquery-ujs
52
- linkClickSelector: 'a[data-confirm], a[data-method], a[data-remote]',
53
-
54
- // Select elements bound by jquery-ujs
55
- selectChangeSelector: 'select[data-remote]',
56
-
57
- // Form elements bound by jquery-ujs
58
- formSubmitSelector: 'form',
59
-
60
- // Form input elements bound by jquery-ujs
61
- formInputClickSelector: 'form input[type=submit], form input[type=image], form button[type=submit], form button:not([type])',
62
-
63
- // Form input elements disabled during form submission
64
- disableSelector: 'input[data-disable-with], button[data-disable-with], textarea[data-disable-with]',
65
-
66
- // Form input elements re-enabled after form submission
67
- enableSelector: 'input[data-disable-with]:disabled, button[data-disable-with]:disabled, textarea[data-disable-with]:disabled',
68
-
69
- // Form required input elements
70
- requiredInputSelector: 'input[name][required]:not([disabled]),textarea[name][required]:not([disabled])',
71
-
72
- // Form file input elements
73
- fileInputSelector: 'input:file',
74
-
75
- // Make sure that every Ajax request sends the CSRF token
76
- CSRFProtection: function(xhr) {
77
- var token = $('meta[name="csrf-token"]').attr('content');
78
- if (token) xhr.setRequestHeader('X-CSRF-Token', token);
79
- },
80
-
81
- // Triggers an event on an element and returns false if the event result is false
82
- fire: function(obj, name, data) {
83
- var event = $.Event(name);
84
- obj.trigger(event, data);
85
- return event.result !== false;
86
- },
87
-
88
- // Default confirm dialog, may be overridden with custom confirm dialog in $.rails.confirm
89
- confirm: function(message) {
90
- return confirm(message);
91
- },
92
-
93
- // Default ajax function, may be overridden with custom function in $.rails.ajax
94
- ajax: function(options) {
95
- return $.ajax(options);
96
- },
97
-
98
- // Submits "remote" forms and links with ajax
99
- handleRemote: function(element) {
100
- var method, url, data,
101
- crossDomain = element.data('cross-domain') || null,
102
- dataType = element.data('type') || ($.ajaxSettings && $.ajaxSettings.dataType);
103
-
104
- if (rails.fire(element, 'ajax:before')) {
105
-
106
- if (element.is('form')) {
107
- method = element.attr('method');
108
- url = element.attr('action');
109
- data = element.serializeArray();
110
- // memoized value from clicked submit button
111
- var button = element.data('ujs:submit-button');
112
- if (button) {
113
- data.push(button);
114
- element.data('ujs:submit-button', null);
115
- }
116
- } else if (element.is('select')) {
117
- method = element.data('method');
118
- url = element.data('url');
119
- data = element.serialize();
120
- if (element.data('params')) data = data + "&" + element.data('params');
121
- } else {
122
- method = element.data('method');
123
- url = element.attr('href');
124
- data = element.data('params') || null;
125
- }
126
-
127
- options = {
128
- type: method || 'GET', data: data, dataType: dataType, crossDomain: crossDomain,
129
- // stopping the "ajax:beforeSend" event will cancel the ajax request
130
- beforeSend: function(xhr, settings) {
131
- if (settings.dataType === undefined) {
132
- xhr.setRequestHeader('accept', '*/*;q=0.5, ' + settings.accepts.script);
133
- }
134
- return rails.fire(element, 'ajax:beforeSend', [xhr, settings]);
135
- },
136
- success: function(data, status, xhr) {
137
- element.trigger('ajax:success', [data, status, xhr]);
138
- },
139
- complete: function(xhr, status) {
140
- element.trigger('ajax:complete', [xhr, status]);
141
- },
142
- error: function(xhr, status, error) {
143
- element.trigger('ajax:error', [xhr, status, error]);
144
- }
145
- };
146
- // Do not pass url to `ajax` options if blank
147
- if (url) { $.extend(options, { url: url }); }
148
-
149
- rails.ajax(options);
150
- }
151
- },
152
-
153
- // Handles "data-method" on links such as:
154
- // <a href="/users/5" data-method="delete" rel="nofollow" data-confirm="Are you sure?">Delete</a>
155
- handleMethod: function(link) {
156
- var href = link.attr('href'),
157
- method = link.data('method'),
158
- csrf_token = $('meta[name=csrf-token]').attr('content'),
159
- csrf_param = $('meta[name=csrf-param]').attr('content'),
160
- form = $('<form method="post" action="' + href + '"></form>'),
161
- metadata_input = '<input name="_method" value="' + method + '" type="hidden" />';
162
-
163
- if (csrf_param !== undefined && csrf_token !== undefined) {
164
- metadata_input += '<input name="' + csrf_param + '" value="' + csrf_token + '" type="hidden" />';
165
- }
166
-
167
- form.hide().append(metadata_input).appendTo('body');
168
- form.submit();
169
- },
170
-
171
- /* Disables form elements:
172
- - Caches element value in 'ujs:enable-with' data store
173
- - Replaces element text with value of 'data-disable-with' attribute
174
- - Adds disabled=disabled attribute
175
- */
176
- disableFormElements: function(form) {
177
- form.find(rails.disableSelector).each(function() {
178
- var element = $(this), method = element.is('button') ? 'html' : 'val';
179
- element.data('ujs:enable-with', element[method]());
180
- element[method](element.data('disable-with'));
181
- element.attr('disabled', 'disabled');
182
- });
183
- },
184
-
185
- /* Re-enables disabled form elements:
186
- - Replaces element text with cached value from 'ujs:enable-with' data store (created in `disableFormElements`)
187
- - Removes disabled attribute
188
- */
189
- enableFormElements: function(form) {
190
- form.find(rails.enableSelector).each(function() {
191
- var element = $(this), method = element.is('button') ? 'html' : 'val';
192
- if (element.data('ujs:enable-with')) element[method](element.data('ujs:enable-with'));
193
- element.removeAttr('disabled');
194
- });
195
- },
196
-
197
- /* For 'data-confirm' attribute:
198
- - Fires `confirm` event
199
- - Shows the confirmation dialog
200
- - Fires the `confirm:complete` event
201
-
202
- Returns `true` if no function stops the chain and user chose yes; `false` otherwise.
203
- Attaching a handler to the element's `confirm` event that returns a `falsy` value cancels the confirmation dialog.
204
- Attaching a handler to the element's `confirm:complete` event that returns a `falsy` value makes this function
205
- return false. The `confirm:complete` event is fired whether or not the user answered true or false to the dialog.
206
- */
207
- allowAction: function(element) {
208
- var message = element.data('confirm'),
209
- answer = false, callback;
210
- if (!message) { return true; }
211
-
212
- if (rails.fire(element, 'confirm')) {
213
- answer = rails.confirm(message);
214
- callback = rails.fire(element, 'confirm:complete', [answer]);
215
- }
216
- return answer && callback;
217
- },
218
-
219
- // Helper function which checks for blank inputs in a form that match the specified CSS selector
220
- blankInputs: function(form, specifiedSelector, nonBlank) {
221
- var inputs = $(), input,
222
- selector = specifiedSelector || 'input,textarea';
223
- form.find(selector).each(function() {
224
- input = $(this);
225
- // Collect non-blank inputs if nonBlank option is true, otherwise, collect blank inputs
226
- if (nonBlank ? input.val() : !input.val()) {
227
- inputs = inputs.add(input);
228
- }
229
- });
230
- return inputs.length ? inputs : false;
231
- },
232
-
233
- // Helper function which checks for non-blank inputs in a form that match the specified CSS selector
234
- nonBlankInputs: function(form, specifiedSelector) {
235
- return rails.blankInputs(form, specifiedSelector, true); // true specifies nonBlank
236
- },
237
-
238
- // Helper function, needed to provide consistent behavior in IE
239
- stopEverything: function(e) {
240
- $(e.target).trigger('ujs:everythingStopped');
241
- e.stopImmediatePropagation();
242
- return false;
243
- },
244
-
245
- // find all the submit events directly bound to the form and
246
- // manually invoke them. If anyone returns false then stop the loop
247
- callFormSubmitBindings: function(form) {
248
- var events = form.data('events'), continuePropagation = true;
249
- if (events !== undefined && events['submit'] !== undefined) {
250
- $.each(events['submit'], function(i, obj){
251
- if (typeof obj.handler === 'function') return continuePropagation = obj.handler(obj.data);
252
- });
253
- }
254
- return continuePropagation;
255
- }
256
- };
257
-
258
- $.ajaxPrefilter(function(options, originalOptions, xhr){ if ( !options.crossDomain ) { rails.CSRFProtection(xhr); }});
259
-
260
- $(rails.linkClickSelector).live('click.rails', function(e) {
261
- var link = $(this);
262
- if (!rails.allowAction(link)) return rails.stopEverything(e);
263
-
264
- if (link.data('remote') !== undefined) {
265
- rails.handleRemote(link);
266
- return false;
267
- } else if (link.data('method')) {
268
- rails.handleMethod(link);
269
- return false;
270
- }
271
- });
272
-
273
- $(rails.selectChangeSelector).live('change.rails', function(e) {
274
- var link = $(this);
275
- if (!rails.allowAction(link)) return rails.stopEverything(e);
276
-
277
- rails.handleRemote(link);
278
- return false;
279
- });
280
-
281
- $(rails.formSubmitSelector).live('submit.rails', function(e) {
282
- var form = $(this),
283
- remote = form.data('remote') !== undefined,
284
- blankRequiredInputs = rails.blankInputs(form, rails.requiredInputSelector),
285
- nonBlankFileInputs = rails.nonBlankInputs(form, rails.fileInputSelector);
286
-
287
- if (!rails.allowAction(form)) return rails.stopEverything(e);
288
-
289
- // skip other logic when required values are missing or file upload is present
290
- if (blankRequiredInputs && form.attr("novalidate") == undefined && rails.fire(form, 'ajax:aborted:required', [blankRequiredInputs])) {
291
- return rails.stopEverything(e);
292
- }
293
-
294
- if (remote) {
295
- if (nonBlankFileInputs) {
296
- return rails.fire(form, 'ajax:aborted:file', [nonBlankFileInputs]);
297
- }
298
-
299
- // If browser does not support submit bubbling, then this live-binding will be called before direct
300
- // bindings. Therefore, we should directly call any direct bindings before remotely submitting form.
301
- if (!$.support.submitBubbles && rails.callFormSubmitBindings(form) === false) return rails.stopEverything(e);
302
-
303
- rails.handleRemote(form);
304
- return false;
305
- } else {
306
- // slight timeout so that the submit button gets properly serialized
307
- setTimeout(function(){ rails.disableFormElements(form); }, 13);
308
- }
309
- });
310
-
311
- $(rails.formInputClickSelector).live('click.rails', function(event) {
312
- var button = $(this);
313
-
314
- if (!rails.allowAction(button)) return rails.stopEverything(event);
315
-
316
- // register the pressed submit button
317
- var name = button.attr('name'),
318
- data = name ? {name:name, value:button.val()} : null;
319
-
320
- button.closest('form').data('ujs:submit-button', data);
321
- });
322
-
323
- $(rails.formSubmitSelector).live('ajax:beforeSend.rails', function(event) {
324
- if (this == event.target) rails.disableFormElements($(this));
325
- });
326
-
327
- $(rails.formSubmitSelector).live('ajax:complete.rails', function(event) {
328
- if (this == event.target) rails.enableFormElements($(this));
329
- });
330
-
331
- })( jQuery );
@@ -1,26 +0,0 @@
1
- .alert-container {
2
- display: block;
3
- left: 0;
4
- overflow: hidden;
5
- position: fixed;
6
- top: 0;
7
- width: 100%;
8
- z-index: 10000;
9
- }
10
- .alert {
11
- background: url(/images/alert.png) no-repeat scroll left bottom transparent;
12
- color: #FFFFFF;
13
- display: block;
14
- margin: 0 auto;
15
- padding: 15px 80px 20px 40px;
16
- position: relative;
17
- width: 790px;
18
- text-align: center;
19
- }
20
- .alert .close {
21
- display: block;
22
- position: absolute;
23
- right: 40px;
24
- top: 12px;
25
- z-index: 1000;
26
- }
@@ -1 +0,0 @@
1
- /* Aimbulance */