comfortable_mexican_sofa 1.6.31 → 1.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (220) hide show
  1. data/.travis.yml +7 -2
  2. data/Gemfile +11 -2
  3. data/README.md +2 -3
  4. data/Rakefile +18 -0
  5. data/VERSION +1 -0
  6. data/app/assets/images/comfortable_mexican_sofa/bootstrap/glyphicons-halflings-white.png +0 -0
  7. data/app/assets/images/comfortable_mexican_sofa/bootstrap/glyphicons-halflings.png +0 -0
  8. data/app/assets/images/comfortable_mexican_sofa/{icon_regular.gif → icon_file.gif} +0 -0
  9. data/app/assets/images/comfortable_mexican_sofa/icon_page.gif +0 -0
  10. data/app/assets/images/comfortable_mexican_sofa/icon_site.gif +0 -0
  11. data/app/assets/javascripts/comfortable_mexican_sofa/application.js +61 -93
  12. data/app/assets/javascripts/comfortable_mexican_sofa/lib/bootstrap-datetimepicker.js +21 -0
  13. data/app/assets/javascripts/comfortable_mexican_sofa/lib/bootstrap-wysihtml5.js +492 -0
  14. data/app/assets/javascripts/comfortable_mexican_sofa/lib/bootstrap.js +6 -0
  15. data/app/assets/javascripts/comfortable_mexican_sofa/lib/codemirror.js +10 -0
  16. data/app/assets/javascripts/comfortable_mexican_sofa/lib/wysihtml5.js +261 -0
  17. data/app/assets/stylesheets/comfortable_mexican_sofa/application.css.sass +9 -0
  18. data/app/assets/stylesheets/comfortable_mexican_sofa/base.css.sass +328 -0
  19. data/app/assets/stylesheets/comfortable_mexican_sofa/base_overrides.css.sass +6 -0
  20. data/app/assets/stylesheets/comfortable_mexican_sofa/bootstrap_overrides.css.sass +43 -0
  21. data/app/assets/stylesheets/comfortable_mexican_sofa/codemirror_overrides.css.sass +27 -0
  22. data/app/assets/stylesheets/comfortable_mexican_sofa/lib/bootstrap-datetimepicker.css +9 -0
  23. data/app/assets/stylesheets/comfortable_mexican_sofa/lib/bootstrap-wysihtml5.css +102 -0
  24. data/app/assets/stylesheets/comfortable_mexican_sofa/lib/bootstrap.css +9 -0
  25. data/app/assets/stylesheets/comfortable_mexican_sofa/lib/codemirror.css +240 -0
  26. data/app/assets/stylesheets/comfortable_mexican_sofa/wysihtml5_overrides.css.sass +5 -0
  27. data/app/controllers/cms_admin/files_controller.rb +3 -3
  28. data/app/controllers/cms_admin/layouts_controller.rb +3 -3
  29. data/app/controllers/cms_admin/pages_controller.rb +3 -3
  30. data/app/controllers/cms_admin/revisions_controller.rb +1 -1
  31. data/app/controllers/cms_admin/sites_controller.rb +3 -3
  32. data/app/controllers/cms_admin/snippets_controller.rb +3 -3
  33. data/app/models/cms/file.rb +5 -3
  34. data/app/models/cms/page.rb +1 -14
  35. data/app/models/cms/site.rb +2 -2
  36. data/app/views/cms_admin/categories/_categories.html.haml +3 -0
  37. data/app/views/cms_admin/categories/_edit.html.haml +6 -0
  38. data/app/views/cms_admin/categories/_form.html.haml +8 -0
  39. data/app/views/cms_admin/categories/_index.html.haml +24 -0
  40. data/app/views/cms_admin/categories/_show.html.haml +13 -0
  41. data/app/views/cms_admin/categories/create.js.erb +3 -3
  42. data/app/views/cms_admin/categories/update.js.erb +1 -1
  43. data/app/views/cms_admin/files/_file.html.haml +14 -0
  44. data/app/views/cms_admin/files/_form.html.haml +13 -0
  45. data/app/views/cms_admin/files/_index.html.haml +12 -0
  46. data/app/views/cms_admin/files/_page_form.html.haml +9 -0
  47. data/app/views/cms_admin/files/create.js.erb +1 -1
  48. data/app/views/cms_admin/files/edit.html.haml +5 -0
  49. data/app/views/cms_admin/files/index.html.haml +26 -0
  50. data/app/views/cms_admin/files/new.html.haml +5 -0
  51. data/app/views/cms_admin/layouts/_form.html.haml +17 -0
  52. data/app/views/cms_admin/layouts/_index_branch.html.haml +23 -0
  53. data/app/views/cms_admin/layouts/edit.html.haml +9 -0
  54. data/app/views/cms_admin/layouts/index.html.haml +9 -0
  55. data/app/views/cms_admin/layouts/new.html.haml +5 -0
  56. data/app/views/cms_admin/pages/_form.html.haml +35 -0
  57. data/app/views/cms_admin/pages/_form_blocks.html.haml +28 -0
  58. data/app/views/cms_admin/pages/_index_branch.html.haml +35 -0
  59. data/app/views/cms_admin/pages/edit.html.haml +9 -0
  60. data/app/views/cms_admin/pages/form_blocks.js.erb +2 -3
  61. data/app/views/cms_admin/pages/index.html.haml +11 -0
  62. data/app/views/cms_admin/pages/new.html.haml +5 -0
  63. data/app/views/cms_admin/revisions/show.html.haml +28 -0
  64. data/app/views/cms_admin/sites/_form.html.haml +10 -0
  65. data/app/views/cms_admin/sites/_mirrors.html.haml +17 -0
  66. data/app/views/cms_admin/sites/edit.html.haml +5 -0
  67. data/app/views/cms_admin/sites/index.html.haml +24 -0
  68. data/app/views/cms_admin/sites/new.html.haml +5 -0
  69. data/app/views/cms_admin/snippets/_form.html.haml +11 -0
  70. data/app/views/cms_admin/snippets/edit.html.haml +9 -0
  71. data/app/views/cms_admin/snippets/index.html.haml +28 -0
  72. data/app/views/cms_admin/snippets/new.html.haml +5 -0
  73. data/app/views/layouts/cms_admin.html.haml +4 -0
  74. data/app/views/layouts/cms_admin/_body.html.haml +16 -0
  75. data/app/views/layouts/cms_admin/_center.html.haml +7 -0
  76. data/app/views/layouts/cms_admin/_head.html.haml +13 -0
  77. data/app/views/layouts/cms_admin/_left.html.haml +10 -0
  78. data/app/views/layouts/cms_admin/_right.html.haml +1 -0
  79. data/comfortable_mexican_sofa.gemspec +323 -21
  80. data/config/application.rb +22 -14
  81. data/config/environments/development.rb +16 -2
  82. data/config/environments/production.rb +22 -7
  83. data/config/environments/test.rb +6 -6
  84. data/config/initializers/comfortable_mexican_sofa.rb +1 -1
  85. data/db/migrate/01_create_cms.rb +1 -1
  86. data/doc/preview.png +0 -0
  87. data/lib/comfortable_mexican_sofa.rb +0 -5
  88. data/lib/comfortable_mexican_sofa/configuration.rb +1 -1
  89. data/lib/comfortable_mexican_sofa/engine.rb +8 -2
  90. data/lib/comfortable_mexican_sofa/extensions/rails.rb +2 -2
  91. data/lib/comfortable_mexican_sofa/form_builder.rb +27 -82
  92. data/lib/comfortable_mexican_sofa/tag.rb +1 -1
  93. data/lib/comfortable_mexican_sofa/tags/page_markdown.rb +22 -0
  94. data/lib/comfortable_mexican_sofa/version.rb +6 -2
  95. data/lib/comfortable_mexican_sofa/view_methods.rb +5 -8
  96. data/test/functional/cms_admin/files_controller_test.rb +4 -4
  97. data/test/functional/cms_admin/layouts_controller_test.rb +3 -3
  98. data/test/functional/cms_admin/pages_controller_test.rb +20 -12
  99. data/test/functional/cms_admin/revisions_controller_test.rb +3 -3
  100. data/test/functional/cms_admin/sites_controller_test.rb +3 -3
  101. data/test/functional/cms_admin/snippets_controller_test.rb +3 -3
  102. data/test/functional/cms_content_controller_test.rb +1 -1
  103. data/test/gemfiles/Gemfile.rails.3.1 +10 -4
  104. data/test/gemfiles/Gemfile.rails.3.2 +10 -4
  105. data/test/gemfiles/Gemfile.rails.4.0 +16 -0
  106. data/test/test_helper.rb +1 -16
  107. data/test/unit/configuration_test.rb +1 -3
  108. data/test/unit/models/page_test.rb +1 -19
  109. data/test/unit/models/site_test.rb +1 -5
  110. data/test/unit/tags/page_file_test.rb +6 -5
  111. data/test/unit/tags/page_files_test.rb +5 -3
  112. data/test/unit/tags/page_markdown_test.rb +48 -0
  113. metadata +195 -131
  114. checksums.yaml +0 -7
  115. data/.gitignore +0 -14
  116. data/app/assets/images/comfortable_mexican_sofa/elrte/elrte-toolbar.png +0 -0
  117. data/app/assets/images/comfortable_mexican_sofa/elrte/google-maps.png +0 -0
  118. data/app/assets/images/comfortable_mexican_sofa/elrte/iframe.png +0 -0
  119. data/app/assets/images/comfortable_mexican_sofa/elrte/media-director.png +0 -0
  120. data/app/assets/images/comfortable_mexican_sofa/elrte/media-flash.png +0 -0
  121. data/app/assets/images/comfortable_mexican_sofa/elrte/media-quicktime.png +0 -0
  122. data/app/assets/images/comfortable_mexican_sofa/elrte/media-realaudio.png +0 -0
  123. data/app/assets/images/comfortable_mexican_sofa/elrte/media-rutube.png +0 -0
  124. data/app/assets/images/comfortable_mexican_sofa/elrte/media-vimeo.png +0 -0
  125. data/app/assets/images/comfortable_mexican_sofa/elrte/media-winmedia.png +0 -0
  126. data/app/assets/images/comfortable_mexican_sofa/elrte/media-youtube.png +0 -0
  127. data/app/assets/images/comfortable_mexican_sofa/elrte/outline-div.png +0 -0
  128. data/app/assets/images/comfortable_mexican_sofa/elrte/outline-p.png +0 -0
  129. data/app/assets/images/comfortable_mexican_sofa/elrte/pagebreak.gif +0 -0
  130. data/app/assets/images/comfortable_mexican_sofa/elrte/pixel.gif +0 -0
  131. data/app/assets/images/comfortable_mexican_sofa/elrte/smileys/evilgrin.png +0 -0
  132. data/app/assets/images/comfortable_mexican_sofa/elrte/smileys/grin.png +0 -0
  133. data/app/assets/images/comfortable_mexican_sofa/elrte/smileys/happy.png +0 -0
  134. data/app/assets/images/comfortable_mexican_sofa/elrte/smileys/smile.png +0 -0
  135. data/app/assets/images/comfortable_mexican_sofa/elrte/smileys/surprised.png +0 -0
  136. data/app/assets/images/comfortable_mexican_sofa/elrte/smileys/tongue.png +0 -0
  137. data/app/assets/images/comfortable_mexican_sofa/elrte/smileys/unhappy.png +0 -0
  138. data/app/assets/images/comfortable_mexican_sofa/elrte/smileys/waii.png +0 -0
  139. data/app/assets/images/comfortable_mexican_sofa/elrte/smileys/wink.png +0 -0
  140. data/app/assets/images/comfortable_mexican_sofa/jquery_ui/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  141. data/app/assets/images/comfortable_mexican_sofa/jquery_ui/ui-bg_flat_75_ffffff_40x100.png +0 -0
  142. data/app/assets/images/comfortable_mexican_sofa/jquery_ui/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  143. data/app/assets/images/comfortable_mexican_sofa/jquery_ui/ui-bg_glass_65_ffffff_1x400.png +0 -0
  144. data/app/assets/images/comfortable_mexican_sofa/jquery_ui/ui-bg_glass_75_dadada_1x400.png +0 -0
  145. data/app/assets/images/comfortable_mexican_sofa/jquery_ui/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  146. data/app/assets/images/comfortable_mexican_sofa/jquery_ui/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  147. data/app/assets/images/comfortable_mexican_sofa/jquery_ui/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  148. data/app/assets/images/comfortable_mexican_sofa/jquery_ui/ui-bg_inset-soft_95_fef1ec_1x100.png +0 -0
  149. data/app/assets/images/comfortable_mexican_sofa/jquery_ui/ui-icons_222222_256x240.png +0 -0
  150. data/app/assets/images/comfortable_mexican_sofa/jquery_ui/ui-icons_2e83ff_256x240.png +0 -0
  151. data/app/assets/images/comfortable_mexican_sofa/jquery_ui/ui-icons_454545_256x240.png +0 -0
  152. data/app/assets/images/comfortable_mexican_sofa/jquery_ui/ui-icons_888888_256x240.png +0 -0
  153. data/app/assets/images/comfortable_mexican_sofa/jquery_ui/ui-icons_cd0a0a_256x240.png +0 -0
  154. data/app/assets/images/comfortable_mexican_sofa/x.png +0 -0
  155. data/app/assets/javascripts/comfortable_mexican_sofa/codemirror/codemirror.js +0 -1
  156. data/app/assets/javascripts/comfortable_mexican_sofa/elrte/elrte.codemirror.js +0 -36
  157. data/app/assets/javascripts/comfortable_mexican_sofa/elrte/elrte.js +0 -267
  158. data/app/assets/javascripts/comfortable_mexican_sofa/elrte/elrte.sofa_image.js +0 -69
  159. data/app/assets/javascripts/comfortable_mexican_sofa/elrte/elrte.sofa_link.js +0 -58
  160. data/app/assets/javascripts/comfortable_mexican_sofa/jquery.js +0 -4
  161. data/app/assets/javascripts/comfortable_mexican_sofa/jquery_ui.js +0 -791
  162. data/app/assets/javascripts/comfortable_mexican_sofa/jquery_ui_timepicker.js +0 -12
  163. data/app/assets/javascripts/comfortable_mexican_sofa/rails.js +0 -315
  164. data/app/assets/stylesheets/comfortable_mexican_sofa/application.css +0 -13
  165. data/app/assets/stylesheets/comfortable_mexican_sofa/codemirror.css +0 -121
  166. data/app/assets/stylesheets/comfortable_mexican_sofa/content.css +0 -271
  167. data/app/assets/stylesheets/comfortable_mexican_sofa/dialogs.css +0 -45
  168. data/app/assets/stylesheets/comfortable_mexican_sofa/elrte.css +0 -173
  169. data/app/assets/stylesheets/comfortable_mexican_sofa/files.css +0 -82
  170. data/app/assets/stylesheets/comfortable_mexican_sofa/form.css +0 -232
  171. data/app/assets/stylesheets/comfortable_mexican_sofa/jquery_ui.css +0 -568
  172. data/app/assets/stylesheets/comfortable_mexican_sofa/reset.css +0 -1
  173. data/app/assets/stylesheets/comfortable_mexican_sofa/structure.css +0 -157
  174. data/app/assets/stylesheets/comfortable_mexican_sofa/typography.css +0 -39
  175. data/app/assets/stylesheets/comfortable_mexican_sofa/widgets.css +0 -29
  176. data/app/controllers/cms_admin/dialogs_controller.rb +0 -13
  177. data/app/views/cms_admin/categories/_categories.html.erb +0 -6
  178. data/app/views/cms_admin/categories/_edit.html.erb +0 -7
  179. data/app/views/cms_admin/categories/_form.html.erb +0 -12
  180. data/app/views/cms_admin/categories/_index.html.erb +0 -31
  181. data/app/views/cms_admin/categories/_show.html.erb +0 -16
  182. data/app/views/cms_admin/dialogs/image.html.erb +0 -7
  183. data/app/views/cms_admin/dialogs/link.html.erb +0 -5
  184. data/app/views/cms_admin/files/_file.html.erb +0 -18
  185. data/app/views/cms_admin/files/_form.html.erb +0 -16
  186. data/app/views/cms_admin/files/_index.html.erb +0 -16
  187. data/app/views/cms_admin/files/_page_form.html.erb +0 -12
  188. data/app/views/cms_admin/files/edit.html.erb +0 -5
  189. data/app/views/cms_admin/files/index.html.erb +0 -29
  190. data/app/views/cms_admin/files/new.html.erb +0 -5
  191. data/app/views/cms_admin/layouts/_form.html.erb +0 -20
  192. data/app/views/cms_admin/layouts/_index_branch.html.erb +0 -27
  193. data/app/views/cms_admin/layouts/edit.html.erb +0 -11
  194. data/app/views/cms_admin/layouts/index.html.erb +0 -10
  195. data/app/views/cms_admin/layouts/new.html.erb +0 -5
  196. data/app/views/cms_admin/pages/_form.html.erb +0 -39
  197. data/app/views/cms_admin/pages/_form_blocks.html.erb +0 -41
  198. data/app/views/cms_admin/pages/_index_branch.html.erb +0 -43
  199. data/app/views/cms_admin/pages/edit.html.erb +0 -11
  200. data/app/views/cms_admin/pages/index.html.erb +0 -12
  201. data/app/views/cms_admin/pages/new.html.erb +0 -5
  202. data/app/views/cms_admin/revisions/show.html.erb +0 -36
  203. data/app/views/cms_admin/sites/_form.html.erb +0 -10
  204. data/app/views/cms_admin/sites/_mirrors.html.erb +0 -20
  205. data/app/views/cms_admin/sites/edit.html.erb +0 -5
  206. data/app/views/cms_admin/sites/index.html.erb +0 -23
  207. data/app/views/cms_admin/sites/new.html.erb +0 -5
  208. data/app/views/cms_admin/snippets/_form.html.erb +0 -13
  209. data/app/views/cms_admin/snippets/edit.html.erb +0 -10
  210. data/app/views/cms_admin/snippets/index.html.erb +0 -33
  211. data/app/views/cms_admin/snippets/new.html.erb +0 -5
  212. data/app/views/layouts/cms_admin.html.erb +0 -5
  213. data/app/views/layouts/cms_admin/_body.html.erb +0 -23
  214. data/app/views/layouts/cms_admin/_center.html.erb +0 -6
  215. data/app/views/layouts/cms_admin/_head.html.erb +0 -43
  216. data/app/views/layouts/cms_admin/_left.html.erb +0 -10
  217. data/app/views/layouts/cms_admin/_right.html.erb +0 -1
  218. data/test/functional/cms_admin/dialogs_controller_test.rb +0 -24
  219. data/test/gemfiles/Gemfile.rails.3.0 +0 -10
  220. data/test/unit/form_builder_test.rb +0 -69
@@ -1,12 +0,0 @@
1
- /*!
2
- * jQuery timepicker addon
3
- * By: Trent Richardson [http://trentrichardson.com]
4
- * Version 0.9.6
5
- * Last Modified: 07/20/2011
6
- *
7
- * Copyright 2011 Trent Richardson
8
- * Dual licensed under the MIT and GPL licenses.
9
- * http://trentrichardson.com/Impromptu/GPL-LICENSE.txt
10
- * http://trentrichardson.com/Impromptu/MIT-LICENSE.txt
11
- */
12
- (function($){function extendRemove(a,b){$.extend(a,b);for(var c in b)if(b[c]===null||b[c]===undefined)a[c]=b[c];return a}function Timepicker(){this.regional=[];this.regional[""]={currentText:"Now",closeText:"Done",ampm:false,timeFormat:"hh:mm tt",timeSuffix:"",timeOnlyTitle:"Choose Time",timeText:"Time",hourText:"Hour",minuteText:"Minute",secondText:"Second",timezoneText:"Time Zone"};this._defaults={showButtonPanel:true,timeOnly:false,showHour:true,showMinute:true,showSecond:false,showTimezone:false,showTime:true,stepHour:.05,stepMinute:.05,stepSecond:.05,hour:0,minute:0,second:0,timezone:"+0000",hourMin:0,minuteMin:0,secondMin:0,hourMax:23,minuteMax:59,secondMax:59,minDateTime:null,maxDateTime:null,hourGrid:0,minuteGrid:0,secondGrid:0,alwaysSetTime:true,separator:" ",altFieldTimeOnly:true,showTimepicker:true,timezoneList:["-1100","-1000","-0900","-0800","-0700","-0600","-0500","-0400","-0300","-0200","-0100","+0000","+0100","+0200","+0300","+0400","+0500","+0600","+0700","+0800","+0900","+1000","+1100","+1200"]};$.extend(this._defaults,this.regional[""])}$.extend($.ui,{timepicker:{version:"0.9.6"}});$.extend(Timepicker.prototype,{$input:null,$altInput:null,$timeObj:null,inst:null,hour_slider:null,minute_slider:null,second_slider:null,timezone_select:null,hour:0,minute:0,second:0,timezone:"+0000",hourMinOriginal:null,minuteMinOriginal:null,secondMinOriginal:null,hourMaxOriginal:null,minuteMaxOriginal:null,secondMaxOriginal:null,ampm:"",formattedDate:"",formattedTime:"",formattedDateTime:"",timezoneList:["-1100","-1000","-0900","-0800","-0700","-0600","-0500","-0400","-0300","-0200","-0100","+0000","+0100","+0200","+0300","+0400","+0500","+0600","+0700","+0800","+0900","+1000","+1100","+1200"],setDefaults:function(a){extendRemove(this._defaults,a||{});return this},_newInst:function($input,o){var tp_inst=new Timepicker,inlineSettings={};for(var attrName in this._defaults){var attrValue=$input.attr("time:"+attrName);if(attrValue){try{inlineSettings[attrName]=eval(attrValue)}catch(err){inlineSettings[attrName]=attrValue}}}tp_inst._defaults=$.extend({},this._defaults,inlineSettings,o,{beforeShow:function(a,b){if($.isFunction(o.beforeShow))o.beforeShow(a,b,tp_inst)},onChangeMonthYear:function(a,b,c){tp_inst._updateDateTime(c);if($.isFunction(o.onChangeMonthYear))o.onChangeMonthYear.call($input[0],a,b,c,tp_inst)},onClose:function(a,b){if(tp_inst.timeDefined===true&&$input.val()!="")tp_inst._updateDateTime(b);if($.isFunction(o.onClose))o.onClose.call($input[0],a,b,tp_inst)},timepicker:tp_inst});tp_inst.hour=tp_inst._defaults.hour;tp_inst.minute=tp_inst._defaults.minute;tp_inst.second=tp_inst._defaults.second;tp_inst.ampm="";tp_inst.$input=$input;if(o.altField)tp_inst.$altInput=$(o.altField).css({cursor:"pointer"}).focus(function(){$input.trigger("focus")});if(tp_inst._defaults.minDate!==undefined&&tp_inst._defaults.minDate instanceof Date)tp_inst._defaults.minDateTime=new Date(tp_inst._defaults.minDate.getTime());if(tp_inst._defaults.minDateTime!==undefined&&tp_inst._defaults.minDateTime instanceof Date)tp_inst._defaults.minDate=new Date(tp_inst._defaults.minDateTime.getTime());if(tp_inst._defaults.maxDate!==undefined&&tp_inst._defaults.maxDate instanceof Date)tp_inst._defaults.maxDateTime=new Date(tp_inst._defaults.maxDate.getTime());if(tp_inst._defaults.maxDateTime!==undefined&&tp_inst._defaults.maxDateTime instanceof Date)tp_inst._defaults.maxDate=new Date(tp_inst._defaults.maxDateTime.getTime());return tp_inst},_addTimePicker:function(a){var b=this.$altInput&&this._defaults.altFieldTimeOnly?this.$input.val()+" "+this.$altInput.val():this.$input.val();this.timeDefined=this._parseTime(b);this._limitMinMaxDateTime(a,false);this._injectTimePicker()},_parseTime:function(a,b){var c=this._defaults.timeFormat.toString().replace(/h{1,2}/ig,"(\\d?\\d)").replace(/m{1,2}/ig,"(\\d?\\d)").replace(/s{1,2}/ig,"(\\d?\\d)").replace(/t{1,2}/ig,"(am|pm|a|p)?").replace(/z{1}/ig,"((\\+|-)\\d\\d\\d\\d)?").replace(/\s/g,"\\s?")+this._defaults.timeSuffix+"$",d=this._getFormatPositions(),e;if(!this.inst)this.inst=$.datepicker._getInst(this.$input[0]);if(b||!this._defaults.timeOnly){var f=$.datepicker._get(this.inst,"dateFormat");var g=new RegExp("[.*+?|()\\[\\]{}\\\\]","g");c=".{"+f.length+",}"+this._defaults.separator.replace(g,"\\$&")+c}e=a.match(new RegExp(c,"i"));if(e){if(d.t!==-1)this.ampm=(e[d.t]===undefined||e[d.t].length===0?"":e[d.t].charAt(0).toUpperCase()=="A"?"AM":"PM").toUpperCase();if(d.h!==-1){if(this.ampm=="AM"&&e[d.h]=="12")this.hour=0;else if(this.ampm=="PM"&&e[d.h]!="12")this.hour=(parseFloat(e[d.h])+12).toFixed(0);else this.hour=Number(e[d.h])}if(d.m!==-1)this.minute=Number(e[d.m]);if(d.s!==-1)this.second=Number(e[d.s]);if(d.z!==-1)this.timezone=e[d.z];return true}return false},_getFormatPositions:function(){var a=this._defaults.timeFormat.toLowerCase().match(/(h{1,2}|m{1,2}|s{1,2}|t{1,2}|z)/g),b={h:-1,m:-1,s:-1,t:-1,z:-1};if(a)for(var c=0;c<a.length;c++)if(b[a[c].toString().charAt(0)]==-1)b[a[c].toString().charAt(0)]=c+1;return b},_injectTimePicker:function(){var a=this.inst.dpDiv,b=this._defaults,c=this,d=(b.hourMax-b.hourMax%b.stepHour).toFixed(0),e=(b.minuteMax-b.minuteMax%b.stepMinute).toFixed(0),f=(b.secondMax-b.secondMax%b.stepSecond).toFixed(0),g=this.inst.id.toString().replace(/([^A-Za-z0-9_])/g,"");if(a.find("div#ui-timepicker-div-"+g).length===0&&b.showTimepicker){var h=' style="display:none;"',i='<div class="ui-timepicker-div" id="ui-timepicker-div-'+g+'"><dl>'+'<dt class="ui_tpicker_time_label" id="ui_tpicker_time_label_'+g+'"'+(b.showTime?"":h)+">"+b.timeText+"</dt>"+'<dd class="ui_tpicker_time" id="ui_tpicker_time_'+g+'"'+(b.showTime?"":h)+"></dd>"+'<dt class="ui_tpicker_hour_label" id="ui_tpicker_hour_label_'+g+'"'+(b.showHour?"":h)+">"+b.hourText+"</dt>",j=0,k=0,l=0,m;if(b.showHour&&b.hourGrid>0){i+='<dd class="ui_tpicker_hour">'+'<div id="ui_tpicker_hour_'+g+'"'+(b.showHour?"":h)+"></div>"+'<div style="padding-left: 1px"><table class="ui-tpicker-grid-label"><tr>';for(var n=b.hourMin;n<=d;n+=b.hourGrid){j++;var o=b.ampm&&n>12?n-12:n;if(o<10)o="0"+o;if(b.ampm){if(n==0)o=12+"a";else if(n<12)o+="a";else o+="p"}i+="<td>"+o+"</td>"}i+="</tr></table></div>"+"</dd>"}else i+='<dd class="ui_tpicker_hour" id="ui_tpicker_hour_'+g+'"'+(b.showHour?"":h)+"></dd>";i+='<dt class="ui_tpicker_minute_label" id="ui_tpicker_minute_label_'+g+'"'+(b.showMinute?"":h)+">"+b.minuteText+"</dt>";if(b.showMinute&&b.minuteGrid>0){i+='<dd class="ui_tpicker_minute ui_tpicker_minute_'+b.minuteGrid+'">'+'<div id="ui_tpicker_minute_'+g+'"'+(b.showMinute?"":h)+"></div>"+'<div style="padding-left: 1px"><table class="ui-tpicker-grid-label"><tr>';for(var p=b.minuteMin;p<=e;p+=b.minuteGrid){k++;i+="<td>"+(p<10?"0":"")+p+"</td>"}i+="</tr></table></div>"+"</dd>"}else i+='<dd class="ui_tpicker_minute" id="ui_tpicker_minute_'+g+'"'+(b.showMinute?"":h)+"></dd>";i+='<dt class="ui_tpicker_second_label" id="ui_tpicker_second_label_'+g+'"'+(b.showSecond?"":h)+">"+b.secondText+"</dt>";if(b.showSecond&&b.secondGrid>0){i+='<dd class="ui_tpicker_second ui_tpicker_second_'+b.secondGrid+'">'+'<div id="ui_tpicker_second_'+g+'"'+(b.showSecond?"":h)+"></div>"+'<div style="padding-left: 1px"><table><tr>';for(var q=b.secondMin;q<=f;q+=b.secondGrid){l++;i+="<td>"+(q<10?"0":"")+q+"</td>"}i+="</tr></table></div>"+"</dd>"}else i+='<dd class="ui_tpicker_second" id="ui_tpicker_second_'+g+'"'+(b.showSecond?"":h)+"></dd>";i+='<dt class="ui_tpicker_timezone_label" id="ui_tpicker_timezone_label_'+g+'"'+(b.showTimezone?"":h)+">"+b.timezoneText+"</dt>";i+='<dd class="ui_tpicker_timezone" id="ui_tpicker_timezone_'+g+'"'+(b.showTimezone?"":h)+"></dd>";i+="</dl></div>";$tp=$(i);if(b.timeOnly===true){$tp.prepend('<div class="ui-widget-header ui-helper-clearfix ui-corner-all">'+'<div class="ui-datepicker-title">'+b.timeOnlyTitle+"</div>"+"</div>");a.find(".ui-datepicker-header, .ui-datepicker-calendar").hide()}this.hour_slider=$tp.find("#ui_tpicker_hour_"+g).slider({orientation:"horizontal",value:this.hour,min:b.hourMin,max:d,step:b.stepHour,slide:function(a,b){c.hour_slider.slider("option","value",b.value);c._onTimeChange()}});this.minute_slider=$tp.find("#ui_tpicker_minute_"+g).slider({orientation:"horizontal",value:this.minute,min:b.minuteMin,max:e,step:b.stepMinute,slide:function(a,b){c.minute_slider.slider("option","value",b.value);c._onTimeChange()}});this.second_slider=$tp.find("#ui_tpicker_second_"+g).slider({orientation:"horizontal",value:this.second,min:b.secondMin,max:f,step:b.stepSecond,slide:function(a,b){c.second_slider.slider("option","value",b.value);c._onTimeChange()}});this.timezone_select=$tp.find("#ui_tpicker_timezone_"+g).append("<select></select>").find("select");$.fn.append.apply(this.timezone_select,$.map(b.timezoneList,function(a,b){return $("<option />").val(typeof a=="object"?a.value:a).text(typeof a=="object"?a.label:a)}));this.timezone_select.val(typeof this.timezone!="undefined"&&this.timezone!=null&&this.timezone!=""?this.timezone:b.timezone);this.timezone_select.change(function(){c._onTimeChange()});if(b.showHour&&b.hourGrid>0){m=100*j*b.hourGrid/(d-b.hourMin);$tp.find(".ui_tpicker_hour table").css({width:m+"%",marginLeft:m/(-2*j)+"%",borderCollapse:"collapse"}).find("td").each(function(a){$(this).click(function(){var a=$(this).html();if(b.ampm){var d=a.substring(2).toLowerCase(),e=parseInt(a.substring(0,2),10);if(d=="a"){if(e==12)a=0;else a=e}else if(e==12)a=12;else a=e+12}c.hour_slider.slider("option","value",a);c._onTimeChange();c._onSelectHandler()}).css({cursor:"pointer",width:100/j+"%",textAlign:"center",overflow:"hidden"})})}if(b.showMinute&&b.minuteGrid>0){m=100*k*b.minuteGrid/(e-b.minuteMin);$tp.find(".ui_tpicker_minute table").css({width:m+"%",marginLeft:m/(-2*k)+"%",borderCollapse:"collapse"}).find("td").each(function(a){$(this).click(function(){c.minute_slider.slider("option","value",$(this).html());c._onTimeChange();c._onSelectHandler()}).css({cursor:"pointer",width:100/k+"%",textAlign:"center",overflow:"hidden"})})}if(b.showSecond&&b.secondGrid>0){$tp.find(".ui_tpicker_second table").css({width:m+"%",marginLeft:m/(-2*l)+"%",borderCollapse:"collapse"}).find("td").each(function(a){$(this).click(function(){c.second_slider.slider("option","value",$(this).html());c._onTimeChange();c._onSelectHandler()}).css({cursor:"pointer",width:100/l+"%",textAlign:"center",overflow:"hidden"})})}var r=a.find(".ui-datepicker-buttonpane");if(r.length)r.before($tp);else a.append($tp);this.$timeObj=$tp.find("#ui_tpicker_time_"+g);if(this.inst!==null){var s=this.timeDefined;this._onTimeChange();this.timeDefined=s}var t=function(){c._onSelectHandler()};this.hour_slider.bind("slidestop",t);this.minute_slider.bind("slidestop",t);this.second_slider.bind("slidestop",t)}},_limitMinMaxDateTime:function(a,b){var c=this._defaults,d=new Date(a.selectedYear,a.selectedMonth,a.selectedDay);if(!this._defaults.showTimepicker)return;if($.datepicker._get(a,"minDateTime")!==null&&d){var e=$.datepicker._get(a,"minDateTime"),f=new Date(e.getFullYear(),e.getMonth(),e.getDate(),0,0,0,0);if(this.hourMinOriginal===null||this.minuteMinOriginal===null||this.secondMinOriginal===null){this.hourMinOriginal=c.hourMin;this.minuteMinOriginal=c.minuteMin;this.secondMinOriginal=c.secondMin}if(a.settings.timeOnly||f.getTime()==d.getTime()){this._defaults.hourMin=e.getHours();if(this.hour<=this._defaults.hourMin){this.hour=this._defaults.hourMin;this._defaults.minuteMin=e.getMinutes();if(this.minute<=this._defaults.minuteMin){this.minute=this._defaults.minuteMin;this._defaults.secondMin=e.getSeconds()}else{if(this.second<this._defaults.secondMin)this.second=this._defaults.secondMin;this._defaults.secondMin=this.secondMinOriginal}}else{this._defaults.minuteMin=this.minuteMinOriginal;this._defaults.secondMin=this.secondMinOriginal}}else{this._defaults.hourMin=this.hourMinOriginal;this._defaults.minuteMin=this.minuteMinOriginal;this._defaults.secondMin=this.secondMinOriginal}}if($.datepicker._get(a,"maxDateTime")!==null&&d){var g=$.datepicker._get(a,"maxDateTime"),h=new Date(g.getFullYear(),g.getMonth(),g.getDate(),0,0,0,0);if(this.hourMaxOriginal===null||this.minuteMaxOriginal===null||this.secondMaxOriginal===null){this.hourMaxOriginal=c.hourMax;this.minuteMaxOriginal=c.minuteMax;this.secondMaxOriginal=c.secondMax}if(a.settings.timeOnly||h.getTime()==d.getTime()){this._defaults.hourMax=g.getHours();if(this.hour>=this._defaults.hourMax){this.hour=this._defaults.hourMax;this._defaults.minuteMax=g.getMinutes();if(this.minute>=this._defaults.minuteMax){this.minute=this._defaults.minuteMax;this._defaults.secondMax=g.getSeconds()}else{if(this.second>this._defaults.secondMax)this.second=this._defaults.secondMax;this._defaults.secondMax=this.secondMaxOriginal}}else{this._defaults.minuteMax=this.minuteMaxOriginal;this._defaults.secondMax=this.secondMaxOriginal}}else{this._defaults.hourMax=this.hourMaxOriginal;this._defaults.minuteMax=this.minuteMaxOriginal;this._defaults.secondMax=this.secondMaxOriginal}}if(b!==undefined&&b===true){var i=(this._defaults.hourMax-this._defaults.hourMax%this._defaults.stepHour).toFixed(0),j=(this._defaults.minuteMax-this._defaults.minuteMax%this._defaults.stepMinute).toFixed(0),k=(this._defaults.secondMax-this._defaults.secondMax%this._defaults.stepSecond).toFixed(0);if(this.hour_slider)this.hour_slider.slider("option",{min:this._defaults.hourMin,max:i}).slider("value",this.hour);if(this.minute_slider)this.minute_slider.slider("option",{min:this._defaults.minuteMin,max:j}).slider("value",this.minute);if(this.second_slider)this.second_slider.slider("option",{min:this._defaults.secondMin,max:k}).slider("value",this.second)}},_onTimeChange:function(){var a=this.hour_slider?this.hour_slider.slider("value"):false,b=this.minute_slider?this.minute_slider.slider("value"):false,c=this.second_slider?this.second_slider.slider("value"):false,d=this.timezone_select?this.timezone_select.val():false;if(typeof a=="object")a=false;if(typeof b=="object")b=false;if(typeof c=="object")c=false;if(typeof d=="object")d=false;if(a!==false)a=parseInt(a,10);if(b!==false)b=parseInt(b,10);if(c!==false)c=parseInt(c,10);var e=a<12?"AM":"PM";var f=a!=this.hour||b!=this.minute||c!=this.second||this.ampm.length>0&&this.ampm!=e||d!=this.timezone;if(f){if(a!==false)this.hour=a;if(b!==false)this.minute=b;if(c!==false)this.second=c;if(d!==false)this.timezone=d;if(!this.inst)this.inst=$.datepicker._getInst(this.$input[0]);this._limitMinMaxDateTime(this.inst,true)}if(this._defaults.ampm)this.ampm=e;this._formatTime();if(this.$timeObj)this.$timeObj.text(this.formattedTime+this._defaults.timeSuffix);this.timeDefined=true;if(f)this._updateDateTime()},_onSelectHandler:function(){var a=this._defaults["onSelect"];var b=this.$input?this.$input[0]:null;if(a&&b){a.apply(b,[this.formattedDateTime,this])}},_formatTime:function(a,b,c){if(c==undefined)c=this._defaults.ampm;a=a||{hour:this.hour,minute:this.minute,second:this.second,ampm:this.ampm,timezone:this.timezone};var d=b||this._defaults.timeFormat.toString();if(c){var e=a.ampm=="AM"?a.hour:a.hour%12;e=Number(e)===0?12:e;d=d.toString().replace(/hh/g,(e<10?"0":"")+e).replace(/h/g,e).replace(/mm/g,(a.minute<10?"0":"")+a.minute).replace(/m/g,a.minute).replace(/ss/g,(a.second<10?"0":"")+a.second).replace(/s/g,a.second).replace(/TT/g,a.ampm.toUpperCase()).replace(/Tt/g,a.ampm.toUpperCase()).replace(/tT/g,a.ampm.toLowerCase()).replace(/tt/g,a.ampm.toLowerCase()).replace(/T/g,a.ampm.charAt(0).toUpperCase()).replace(/t/g,a.ampm.charAt(0).toLowerCase()).replace(/z/g,a.timezone)}else{d=d.toString().replace(/hh/g,(a.hour<10?"0":"")+a.hour).replace(/h/g,a.hour).replace(/mm/g,(a.minute<10?"0":"")+a.minute).replace(/m/g,a.minute).replace(/ss/g,(a.second<10?"0":"")+a.second).replace(/s/g,a.second).replace(/z/g,a.timezone);d=$.trim(d.replace(/t/gi,""))}if(arguments.length)return d;else this.formattedTime=d},_updateDateTime:function(a){a=this.inst||a,dt=new Date(a.selectedYear,a.selectedMonth,a.selectedDay),dateFmt=$.datepicker._get(a,"dateFormat"),formatCfg=$.datepicker._getFormatConfig(a),timeAvailable=dt!==null&&this.timeDefined;this.formattedDate=$.datepicker.formatDate(dateFmt,dt===null?new Date:dt,formatCfg);var b=this.formattedDate;if(a.lastVal!==undefined&&a.lastVal.length>0&&this.$input.val().length===0)return;if(this._defaults.timeOnly===true){b=this.formattedTime}else if(this._defaults.timeOnly!==true&&(this._defaults.alwaysSetTime||timeAvailable)){b+=this._defaults.separator+this.formattedTime+this._defaults.timeSuffix}this.formattedDateTime=b;if(!this._defaults.showTimepicker){this.$input.val(this.formattedDate)}else if(this.$altInput&&this._defaults.altFieldTimeOnly===true){this.$altInput.val(this.formattedTime);this.$input.val(this.formattedDate)}else if(this.$altInput){this.$altInput.val(b);this.$input.val(b)}else{this.$input.val(b)}this.$input.trigger("change")}});$.fn.extend({timepicker:function(a){a=a||{};var b=arguments;if(typeof a=="object")b[0]=$.extend(a,{timeOnly:true});return $(this).each(function(){$.fn.datetimepicker.apply($(this),b)})},datetimepicker:function(a){a=a||{};var b=this,c=arguments;if(typeof a=="string"){if(a=="getDate")return $.fn.datepicker.apply($(this[0]),c);else return this.each(function(){var a=$(this);a.datepicker.apply(a,c)})}else return this.each(function(){var b=$(this);b.datepicker($.timepicker._newInst(b,a)._defaults)})}});$.datepicker._base_selectDate=$.datepicker._selectDate;$.datepicker._selectDate=function(a,b){var c=this._getInst($(a)[0]),d=this._get(c,"timepicker");if(d){d._limitMinMaxDateTime(c,true);c.inline=c.stay_open=true;this._base_selectDate(a,b+d._defaults.separator+d.formattedTime+d._defaults.timeSuffix);c.inline=c.stay_open=false;this._notifyChange(c);this._updateDatepicker(c)}else this._base_selectDate(a,b)};$.datepicker._base_updateDatepicker=$.datepicker._updateDatepicker;$.datepicker._updateDatepicker=function(a){var b=a.input[0];if($.datepicker._curInst&&$.datepicker._curInst!=a&&$.datepicker._datepickerShowing&&$.datepicker._lastInput!=b){return}if(typeof a.stay_open!=="boolean"||a.stay_open===false){this._base_updateDatepicker(a);var c=this._get(a,"timepicker");if(c)c._addTimePicker(a)}};$.datepicker._base_doKeyPress=$.datepicker._doKeyPress;$.datepicker._doKeyPress=function(a){var b=$.datepicker._getInst(a.target),c=$.datepicker._get(b,"timepicker");if(c){if($.datepicker._get(b,"constrainInput")){var d=c._defaults.ampm,e=$.datepicker._possibleChars($.datepicker._get(b,"dateFormat")),f=c._defaults.timeFormat.toString().replace(/[hms]/g,"").replace(/TT/g,d?"APM":"").replace(/Tt/g,d?"AaPpMm":"").replace(/tT/g,d?"AaPpMm":"").replace(/T/g,d?"AP":"").replace(/tt/g,d?"apm":"").replace(/t/g,d?"ap":"")+" "+c._defaults.separator+c._defaults.timeSuffix+(c._defaults.showTimezone?c._defaults.timezoneList.join(""):"")+e,g=String.fromCharCode(a.charCode===undefined?a.keyCode:a.charCode);return a.ctrlKey||g<" "||!e||f.indexOf(g)>-1}}return $.datepicker._base_doKeyPress(a)};$.datepicker._base_doKeyUp=$.datepicker._doKeyUp;$.datepicker._doKeyUp=function(a){var b=$.datepicker._getInst(a.target),c=$.datepicker._get(b,"timepicker");if(c){if(c._defaults.timeOnly&&b.input.val()!=b.lastVal){try{$.datepicker._updateDatepicker(b)}catch(d){$.datepicker.log(d)}}}return $.datepicker._base_doKeyUp(a)};$.datepicker._base_gotoToday=$.datepicker._gotoToday;$.datepicker._gotoToday=function(a){this._base_gotoToday(a);this._setTime(this._getInst($(a)[0]),new Date)};$.datepicker._disableTimepickerDatepicker=function(a,b,c){var d=this._getInst(a),e=this._get(d,"timepicker");$(a).datepicker("getDate");if(e){e._defaults.showTimepicker=false;e._updateDateTime(d)}};$.datepicker._enableTimepickerDatepicker=function(a,b,c){var d=this._getInst(a),e=this._get(d,"timepicker");$(a).datepicker("getDate");if(e){e._defaults.showTimepicker=true;e._addTimePicker(d);e._updateDateTime(d)}};$.datepicker._setTime=function(a,b){var c=this._get(a,"timepicker");if(c){var d=c._defaults,e=b?b.getHours():d.hour,f=b?b.getMinutes():d.minute,g=b?b.getSeconds():d.second;if(e<d.hourMin||e>d.hourMax||f<d.minuteMin||f>d.minuteMax||g<d.secondMin||g>d.secondMax){e=d.hourMin;f=d.minuteMin;g=d.secondMin}c.hour=e;c.minute=f;c.second=g;if(c.hour_slider)c.hour_slider.slider("value",e);if(c.minute_slider)c.minute_slider.slider("value",f);if(c.second_slider)c.second_slider.slider("value",g);c._onTimeChange();c._updateDateTime(a)}};$.datepicker._setTimeDatepicker=function(a,b,c){var d=this._getInst(a),e=this._get(d,"timepicker");if(e){this._setDateFromField(d);var f;if(b){if(typeof b=="string"){e._parseTime(b,c);f=new Date;f.setHours(e.hour,e.minute,e.second)}else f=new Date(b.getTime());if(f.toString()=="Invalid Date")f=undefined;this._setTime(d,f)}}};$.datepicker._base_setDateDatepicker=$.datepicker._setDateDatepicker;$.datepicker._setDateDatepicker=function(a,b){var c=this._getInst(a),d=b instanceof Date?new Date(b.getTime()):b;this._updateDatepicker(c);this._base_setDateDatepicker.apply(this,arguments);this._setTimeDatepicker(a,d,true)};$.datepicker._base_getDateDatepicker=$.datepicker._getDateDatepicker;$.datepicker._getDateDatepicker=function(a,b){var c=this._getInst(a),d=this._get(c,"timepicker");if(d){this._setDateFromField(c,b);var e=this._getDate(c);if(e&&d._parseTime($(a).val(),d.timeOnly))e.setHours(d.hour,d.minute,d.second);return e}return this._base_getDateDatepicker(a,b)};$.datepicker._base_parseDate=$.datepicker.parseDate;$.datepicker.parseDate=function(a,b,c){var d;try{d=this._base_parseDate(a,b,c)}catch(e){d=this._base_parseDate(a,b.substring(0,b.length-(e.length-e.indexOf(":")-2)),c)}return d};$.datepicker._base_optionDatepicker=$.datepicker._optionDatepicker;$.datepicker._optionDatepicker=function(a,b,c){this._base_optionDatepicker(a,b,c);var d=this._getInst(a),e=this._get(d,"timepicker");if(e){if(b==="minDate"){if(e._defaults.minDate!==undefined&&e._defaults.minDate instanceof Date)e._defaults.minDateTime=new Date(c);if(e._defaults.minDateTime!==undefined&&e._defaults.minDateTime instanceof Date)e._defaults.minDate=new Date(e._defaults.minDateTime.getTime());e._limitMinMaxDateTime(d,true)}if(b==="maxDate"){if(e._defaults.maxDate!==undefined&&e._defaults.maxDate instanceof Date)e._defaults.maxDateTime=new Date(c);if(e._defaults.maxDateTime!==undefined&&e._defaults.maxDateTime instanceof Date)e._defaults.maxDate=new Date(e._defaults.maxDateTime.getTime());e._limitMinMaxDateTime(d,true)}}};$.timepicker=new Timepicker;$.timepicker.version="0.9.6"})(jQuery)
@@ -1,315 +0,0 @@
1
- /**
2
- * Unobtrusive scripting adapter for jQuery
3
- *
4
- * Requires jQuery 1.4.4 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($) {
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
- // Form elements bound by jquery-ujs
55
- formSubmitSelector: 'form',
56
-
57
- // Form input elements bound by jquery-ujs
58
- formInputClickSelector: 'form input[type=submit], form input[type=image], form button[type=submit], form button:not([type])',
59
-
60
- // Form input elements disabled during form submission
61
- disableSelector: 'input[data-disable-with], button[data-disable-with], textarea[data-disable-with]',
62
-
63
- // Form input elements re-enabled after form submission
64
- enableSelector: 'input[data-disable-with]:disabled, button[data-disable-with]:disabled, textarea[data-disable-with]:disabled',
65
-
66
- // Form required input elements
67
- requiredInputSelector: 'input[name][required]:not([disabled]),textarea[name][required]:not([disabled])',
68
-
69
- // Form file input elements
70
- fileInputSelector: 'input:file',
71
-
72
- // Make sure that every Ajax request sends the CSRF token
73
- CSRFProtection: function(xhr) {
74
- var token = $('meta[name="csrf-token"]').attr('content');
75
- if (token) xhr.setRequestHeader('X-CSRF-Token', token);
76
- },
77
-
78
- // Triggers an event on an element and returns false if the event result is false
79
- fire: function(obj, name, data) {
80
- var event = $.Event(name);
81
- obj.trigger(event, data);
82
- return event.result !== false;
83
- },
84
-
85
- // Default confirm dialog, may be overridden with custom confirm dialog in $.rails.confirm
86
- confirm: function(message) {
87
- return confirm(message);
88
- },
89
-
90
- // Default ajax function, may be overridden with custom function in $.rails.ajax
91
- ajax: function(options) {
92
- return $.ajax(options);
93
- },
94
-
95
- // Submits "remote" forms and links with ajax
96
- handleRemote: function(element) {
97
- var method, url, data,
98
- dataType = element.data('type') || ($.ajaxSettings && $.ajaxSettings.dataType);
99
-
100
- if (rails.fire(element, 'ajax:before')) {
101
-
102
- if (element.is('form')) {
103
- method = element.attr('method');
104
- url = element.attr('action');
105
- data = element.serializeArray();
106
- // memoized value from clicked submit button
107
- var button = element.data('ujs:submit-button');
108
- if (button) {
109
- data.push(button);
110
- element.data('ujs:submit-button', null);
111
- }
112
- } else {
113
- method = element.data('method');
114
- url = element.attr('href');
115
- data = element.data('params') || null;
116
- }
117
-
118
- rails.ajax({
119
- url: url, type: method || 'GET', data: data, dataType: dataType,
120
- // stopping the "ajax:beforeSend" event will cancel the ajax request
121
- beforeSend: function(xhr, settings) {
122
- if (settings.dataType === undefined) {
123
- xhr.setRequestHeader('accept', '*/*;q=0.5, ' + settings.accepts.script);
124
- }
125
- return rails.fire(element, 'ajax:beforeSend', [xhr, settings]);
126
- },
127
- success: function(data, status, xhr) {
128
- element.trigger('ajax:success', [data, status, xhr]);
129
- },
130
- complete: function(xhr, status) {
131
- element.trigger('ajax:complete', [xhr, status]);
132
- },
133
- error: function(xhr, status, error) {
134
- element.trigger('ajax:error', [xhr, status, error]);
135
- }
136
- });
137
- }
138
- },
139
-
140
- // Handles "data-method" on links such as:
141
- // <a href="/users/5" data-method="delete" rel="nofollow" data-confirm="Are you sure?">Delete</a>
142
- handleMethod: function(link) {
143
- var href = link.attr('href'),
144
- method = link.data('method'),
145
- csrf_token = $('meta[name=csrf-token]').attr('content'),
146
- csrf_param = $('meta[name=csrf-param]').attr('content'),
147
- form = $('<form method="post" action="' + href + '"></form>'),
148
- metadata_input = '<input name="_method" value="' + method + '" type="hidden" />';
149
-
150
- if (csrf_param !== undefined && csrf_token !== undefined) {
151
- metadata_input += '<input name="' + csrf_param + '" value="' + csrf_token + '" type="hidden" />';
152
- }
153
-
154
- form.hide().append(metadata_input).appendTo('body');
155
- form.submit();
156
- },
157
-
158
- /* Disables form elements:
159
- - Caches element value in 'ujs:enable-with' data store
160
- - Replaces element text with value of 'data-disable-with' attribute
161
- - Adds disabled=disabled attribute
162
- */
163
- disableFormElements: function(form) {
164
- form.find(rails.disableSelector).each(function() {
165
- var element = $(this), method = element.is('button') ? 'html' : 'val';
166
- element.data('ujs:enable-with', element[method]());
167
- element[method](element.data('disable-with'));
168
- element.attr('disabled', 'disabled');
169
- });
170
- },
171
-
172
- /* Re-enables disabled form elements:
173
- - Replaces element text with cached value from 'ujs:enable-with' data store (created in `disableFormElements`)
174
- - Removes disabled attribute
175
- */
176
- enableFormElements: function(form) {
177
- form.find(rails.enableSelector).each(function() {
178
- var element = $(this), method = element.is('button') ? 'html' : 'val';
179
- if (element.data('ujs:enable-with')) element[method](element.data('ujs:enable-with'));
180
- element.removeAttr('disabled');
181
- });
182
- },
183
-
184
- /* For 'data-confirm' attribute:
185
- - Fires `confirm` event
186
- - Shows the confirmation dialog
187
- - Fires the `confirm:complete` event
188
-
189
- Returns `true` if no function stops the chain and user chose yes; `false` otherwise.
190
- Attaching a handler to the element's `confirm` event that returns a `falsy` value cancels the confirmation dialog.
191
- Attaching a handler to the element's `confirm:complete` event that returns a `falsy` value makes this function
192
- return false. The `confirm:complete` event is fired whether or not the user answered true or false to the dialog.
193
- */
194
- allowAction: function(element) {
195
- var message = element.data('confirm'),
196
- answer = false, callback;
197
- if (!message) { return true; }
198
-
199
- if (rails.fire(element, 'confirm')) {
200
- answer = rails.confirm(message);
201
- callback = rails.fire(element, 'confirm:complete', [answer]);
202
- }
203
- return answer && callback;
204
- },
205
-
206
- // Helper function which checks for blank inputs in a form that match the specified CSS selector
207
- blankInputs: function(form, specifiedSelector, nonBlank) {
208
- var inputs = $(), input,
209
- selector = specifiedSelector || 'input,textarea';
210
- form.find(selector).each(function() {
211
- input = $(this);
212
- // Collect non-blank inputs if nonBlank option is true, otherwise, collect blank inputs
213
- if (nonBlank ? input.val() : !input.val()) {
214
- inputs = inputs.add(input);
215
- }
216
- });
217
- return inputs.length ? inputs : false;
218
- },
219
-
220
- // Helper function which checks for non-blank inputs in a form that match the specified CSS selector
221
- nonBlankInputs: function(form, specifiedSelector) {
222
- return rails.blankInputs(form, specifiedSelector, true); // true specifies nonBlank
223
- },
224
-
225
- // Helper function, needed to provide consistent behavior in IE
226
- stopEverything: function(e) {
227
- $(e.target).trigger('ujs:everythingStopped');
228
- e.stopImmediatePropagation();
229
- return false;
230
- },
231
-
232
- // find all the submit events directly bound to the form and
233
- // manually invoke them. If anyone returns false then stop the loop
234
- callFormSubmitBindings: function(form) {
235
- var events = form.data('events'), continuePropagation = true;
236
- if (events !== undefined && events['submit'] !== undefined) {
237
- $.each(events['submit'], function(i, obj){
238
- if (typeof obj.handler === 'function') return continuePropagation = obj.handler(obj.data);
239
- });
240
- }
241
- return continuePropagation;
242
- }
243
- };
244
-
245
- // ajaxPrefilter is a jQuery 1.5 feature
246
- if ('ajaxPrefilter' in $) {
247
- $.ajaxPrefilter(function(options, originalOptions, xhr){ rails.CSRFProtection(xhr); });
248
- } else {
249
- $(document).ajaxSend(function(e, xhr){ rails.CSRFProtection(xhr); });
250
- }
251
-
252
- $(rails.linkClickSelector).live('click.rails', function(e) {
253
- var link = $(this);
254
- if (!rails.allowAction(link)) return rails.stopEverything(e);
255
-
256
- if (link.data('remote') !== undefined) {
257
- rails.handleRemote(link);
258
- return false;
259
- } else if (link.data('method')) {
260
- rails.handleMethod(link);
261
- return false;
262
- }
263
- });
264
-
265
- $(rails.formSubmitSelector).live('submit.rails', function(e) {
266
- var form = $(this),
267
- remote = form.data('remote') !== undefined,
268
- blankRequiredInputs = rails.blankInputs(form, rails.requiredInputSelector),
269
- nonBlankFileInputs = rails.nonBlankInputs(form, rails.fileInputSelector);
270
-
271
- if (!rails.allowAction(form)) return rails.stopEverything(e);
272
-
273
- // skip other logic when required values are missing or file upload is present
274
- if (blankRequiredInputs && rails.fire(form, 'ajax:aborted:required', [blankRequiredInputs])) {
275
- return rails.stopEverything(e);
276
- }
277
-
278
- if (remote) {
279
- if (nonBlankFileInputs) {
280
- return rails.fire(form, 'ajax:aborted:file', [nonBlankFileInputs]);
281
- }
282
-
283
- // If browser does not support submit bubbling, then this live-binding will be called before direct
284
- // bindings. Therefore, we should directly call any direct bindings before remotely submitting form.
285
- if (!$.support.submitBubbles && rails.callFormSubmitBindings(form) === false) return rails.stopEverything(e);
286
-
287
- rails.handleRemote(form);
288
- return false;
289
- } else {
290
- // slight timeout so that the submit button gets properly serialized
291
- setTimeout(function(){ rails.disableFormElements(form); }, 13);
292
- }
293
- });
294
-
295
- $(rails.formInputClickSelector).live('click.rails', function(event) {
296
- var button = $(this);
297
-
298
- if (!rails.allowAction(button)) return rails.stopEverything(event);
299
-
300
- // register the pressed submit button
301
- var name = button.attr('name'),
302
- data = name ? {name:name, value:button.val()} : null;
303
-
304
- button.closest('form').data('ujs:submit-button', data);
305
- });
306
-
307
- $(rails.formSubmitSelector).live('ajax:beforeSend.rails', function(event) {
308
- if (this == event.target) rails.disableFormElements($(this));
309
- });
310
-
311
- $(rails.formSubmitSelector).live('ajax:complete.rails', function(event) {
312
- if (this == event.target) rails.enableFormElements($(this));
313
- });
314
-
315
- })( jQuery );
@@ -1,13 +0,0 @@
1
- /*
2
- = require comfortable_mexican_sofa/reset.css
3
- = require comfortable_mexican_sofa/typography.css
4
- = require comfortable_mexican_sofa/structure.css
5
- = require comfortable_mexican_sofa/form.css
6
- = require comfortable_mexican_sofa/content.css
7
- = require comfortable_mexican_sofa/files.css
8
- = require comfortable_mexican_sofa/codemirror.css
9
- = require comfortable_mexican_sofa/jquery_ui.css
10
- = require comfortable_mexican_sofa/widgets.css
11
- = require comfortable_mexican_sofa/dialogs.css
12
- = require comfortable_mexican_sofa/elrte.css
13
- */
@@ -1,121 +0,0 @@
1
- .CodeMirror {
2
- background-color: #fff;
3
- }
4
-
5
- /* -- elRTE adjustments -------------------------------------------------- */
6
- .el-rte .workzone .CodeMirror,
7
- .el-rte .workzone .CodeMirror .CodeMirror-scroll {
8
- height: 100%;
9
- }
10
-
11
- /* -- Defaults ----------------------------------------------------------- */
12
- .CodeMirror {
13
- line-height: 1em;
14
- font-family: monospace;
15
- }
16
-
17
- .CodeMirror-scroll {
18
- overflow: auto;
19
- height: 300px;
20
- /* This is needed to prevent an IE[67] bug where the scrolled content
21
- is visible outside of the scrolling box. */
22
- position: relative;
23
- }
24
-
25
- .CodeMirror-gutter {
26
- position: absolute; left: 0; top: 0;
27
- z-index: 10;
28
- background-color: #f7f7f7;
29
- border-right: 1px solid #eee;
30
- min-width: 2em;
31
- height: 100%;
32
- }
33
- .CodeMirror-gutter-text {
34
- color: #aaa;
35
- text-align: right;
36
- padding: .4em .2em .4em .4em;
37
- white-space: pre !important;
38
- }
39
- .CodeMirror-lines {
40
- padding: .4em;
41
- }
42
-
43
- .CodeMirror pre {
44
- -moz-border-radius: 0;
45
- -webkit-border-radius: 0;
46
- -o-border-radius: 0;
47
- border-radius: 0;
48
- border-width: 0; margin: 0; padding: 0; background: transparent;
49
- font-family: inherit;
50
- font-size: inherit;
51
- padding: 0; margin: 0;
52
- white-space: pre;
53
- word-wrap: normal;
54
- }
55
-
56
- .CodeMirror-wrap pre {
57
- word-wrap: break-word;
58
- white-space: pre-wrap;
59
- }
60
- .CodeMirror-wrap .CodeMirror-scroll {
61
- overflow-x: hidden;
62
- }
63
-
64
- .CodeMirror textarea {
65
- outline: none !important;
66
- }
67
-
68
- .CodeMirror pre.CodeMirror-cursor {
69
- z-index: 10;
70
- position: absolute;
71
- visibility: hidden;
72
- border-left: 1px solid black;
73
- border-right:none;
74
- width:0;
75
- }
76
- .CodeMirror pre.CodeMirror-cursor.CodeMirror-overwrite {}
77
- .CodeMirror-focused pre.CodeMirror-cursor {
78
- visibility: visible;
79
- }
80
-
81
- div.CodeMirror-selected { background: #d9d9d9; }
82
- .CodeMirror-focused div.CodeMirror-selected { background: #eee; }
83
-
84
- .CodeMirror-searching {
85
- background: #ffa;
86
- background: rgba(255, 255, 0, .4);
87
- }
88
-
89
- /* Default theme */
90
-
91
- .cm-s-default span.cm-keyword {color: #708;}
92
- .cm-s-default span.cm-atom {color: #219;}
93
- .cm-s-default span.cm-number {color: #164;}
94
- .cm-s-default span.cm-def {color: #00f;}
95
- .cm-s-default span.cm-variable {color: black;}
96
- .cm-s-default span.cm-variable-2 {color: #05a;}
97
- .cm-s-default span.cm-variable-3 {color: #085;}
98
- .cm-s-default span.cm-property {color: black;}
99
- .cm-s-default span.cm-operator {color: black;}
100
- .cm-s-default span.cm-comment {color: #a50;}
101
- .cm-s-default span.cm-string {color: #a11;}
102
- .cm-s-default span.cm-string-2 {color: #f50;}
103
- .cm-s-default span.cm-meta {color: #555;}
104
- .cm-s-default span.cm-error {color: #f00;}
105
- .cm-s-default span.cm-qualifier {color: #555;}
106
- .cm-s-default span.cm-builtin {color: #30a;}
107
- .cm-s-default span.cm-bracket {color: #cc7;}
108
- .cm-s-default span.cm-tag {color: #170;}
109
- .cm-s-default span.cm-attribute {color: #00c;}
110
- .cm-s-default span.cm-header {color: #a0a;}
111
- .cm-s-default span.cm-quote {color: #090;}
112
- .cm-s-default span.cm-hr {color: #999;}
113
- .cm-s-default span.cm-link {color: #00c;}
114
-
115
- span.cm-header, span.cm-strong {font-weight: bold;}
116
- span.cm-em {font-style: italic;}
117
- span.cm-emstrong {font-style: italic; font-weight: bold;}
118
- span.cm-link {text-decoration: underline;}
119
-
120
- div.CodeMirror span.CodeMirror-matchingbracket {color: #0f0;}
121
- div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;}