spiderfw 0.6.27 → 0.6.28

Sign up to get free protection for your applications and to get access to all the features.
Files changed (179) hide show
  1. data/CHANGELOG +4 -0
  2. data/VERSION +1 -1
  3. data/apps/core/admin/admin.rb +6 -2
  4. data/apps/core/admin/controllers/admin_controller.rb +10 -3
  5. data/apps/core/admin/controllers/app_admin_controller.rb +15 -0
  6. data/apps/core/admin/public/css/sass/admin.css +29 -33
  7. data/apps/core/admin/public/css/sass/grid.css +14 -0
  8. data/apps/core/admin/public/sass/admin.scss +3 -2
  9. data/apps/core/admin/views/admin.layout.shtml +1 -0
  10. data/apps/core/auth/controllers/mixins/auth_helper.rb +15 -5
  11. data/apps/core/components/assets.rb +60 -41
  12. data/apps/core/components/public/js/jquery/jquery-1.8.3.js +9472 -0
  13. data/apps/core/components/public/js/jquery/jquery-ui-1.8.11/ui/jquery.ui.core.js +1 -1
  14. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/css/Aristo/images/button_bg.png +0 -0
  15. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/css/Aristo/images/datepicker.gif +0 -0
  16. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/css/Aristo/images/icon_sprite.png +0 -0
  17. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/css/Aristo/images/progress_bar.gif +0 -0
  18. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/css/Aristo/images/slider_h_bg.gif +0 -0
  19. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/css/Aristo/images/slider_handles.png +0 -0
  20. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/css/Aristo/images/slider_v_bg.gif +0 -0
  21. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/css/Aristo/images/tab_bg.gif +0 -0
  22. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/css/Aristo/images/the_gradient.gif +0 -0
  23. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/css/Aristo/images/ui-anim_basic_16x16.gif +0 -0
  24. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/css/Aristo/images/ui-bg_diagonals-thick_18_b81900_40x40.png +0 -0
  25. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/css/Aristo/images/ui-bg_diagonals-thick_20_666666_40x40.png +0 -0
  26. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/css/Aristo/images/ui-bg_flat_10_000000_40x100.png +0 -0
  27. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/css/Aristo/images/ui-bg_glass_100_f6f6f6_1x400.png +0 -0
  28. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/css/Aristo/images/ui-bg_glass_100_fdf5ce_1x400.png +0 -0
  29. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/css/Aristo/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  30. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/css/Aristo/images/ui-bg_gloss-wave_35_f6a828_500x100.png +0 -0
  31. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/css/Aristo/images/ui-bg_highlight-soft_100_eeeeee_1x100.png +0 -0
  32. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/css/Aristo/images/ui-bg_highlight-soft_75_ffe45c_1x100.png +0 -0
  33. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/css/Aristo/images/ui-icons_222222_256x240.png +0 -0
  34. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/css/Aristo/images/ui-icons_228ef1_256x240.png +0 -0
  35. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/css/Aristo/images/ui-icons_ef8c08_256x240.png +0 -0
  36. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/css/Aristo/images/ui-icons_ffd27a_256x240.png +0 -0
  37. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/css/Aristo/images/ui-icons_ffffff_256x240.png +0 -0
  38. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/css/Aristo/jquery-ui.custom.css +528 -0
  39. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-af.js +23 -0
  40. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-ar-DZ.js +23 -0
  41. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-ar.js +23 -0
  42. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-az.js +23 -0
  43. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-be.js +23 -0
  44. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-bg.js +24 -0
  45. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-bs.js +23 -0
  46. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-ca.js +23 -0
  47. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-cs.js +23 -0
  48. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-cy-GB.js +23 -0
  49. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-da.js +23 -0
  50. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-de.js +23 -0
  51. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-el.js +23 -0
  52. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-en-AU.js +23 -0
  53. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-en-GB.js +23 -0
  54. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-en-NZ.js +23 -0
  55. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-eo.js +23 -0
  56. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-es.js +23 -0
  57. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-et.js +23 -0
  58. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-eu.js +23 -0
  59. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-fa.js +59 -0
  60. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-fi.js +23 -0
  61. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-fo.js +23 -0
  62. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-fr-CA.js +23 -0
  63. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-fr-CH.js +23 -0
  64. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-fr.js +25 -0
  65. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-gl.js +23 -0
  66. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-he.js +23 -0
  67. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-hi.js +23 -0
  68. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-hr.js +23 -0
  69. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-hu.js +23 -0
  70. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-hy.js +23 -0
  71. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-id.js +23 -0
  72. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-is.js +23 -0
  73. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-it.js +23 -0
  74. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-ja.js +23 -0
  75. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-ka.js +21 -0
  76. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-kk.js +23 -0
  77. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-km.js +23 -0
  78. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-ko.js +23 -0
  79. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-ky.js +24 -0
  80. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-lb.js +23 -0
  81. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-lt.js +23 -0
  82. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-lv.js +23 -0
  83. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-mk.js +23 -0
  84. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-ml.js +23 -0
  85. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-ms.js +23 -0
  86. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-nb.js +22 -0
  87. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-nl-BE.js +23 -0
  88. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-nl.js +23 -0
  89. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-nn.js +22 -0
  90. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-no.js +23 -0
  91. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-pl.js +23 -0
  92. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-pt-BR.js +23 -0
  93. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-pt.js +22 -0
  94. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-rm.js +21 -0
  95. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-ro.js +26 -0
  96. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-ru.js +23 -0
  97. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-sk.js +23 -0
  98. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-sl.js +24 -0
  99. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-sq.js +23 -0
  100. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-sr-SR.js +23 -0
  101. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-sr.js +23 -0
  102. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-sv.js +23 -0
  103. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-ta.js +23 -0
  104. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-th.js +23 -0
  105. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-tj.js +23 -0
  106. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-tr.js +23 -0
  107. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-uk.js +24 -0
  108. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-vi.js +23 -0
  109. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-zh-CN.js +23 -0
  110. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-zh-HK.js +23 -0
  111. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-zh-TW.js +23 -0
  112. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.accordion.js +571 -0
  113. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.autocomplete.js +614 -0
  114. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.button.js +419 -0
  115. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.core.js +324 -0
  116. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.datepicker.js +2044 -0
  117. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.dialog.js +767 -0
  118. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.draggable.js +941 -0
  119. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.droppable.js +364 -0
  120. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.effect-blind.js +82 -0
  121. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.effect-bounce.js +113 -0
  122. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.effect-clip.js +67 -0
  123. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.effect-drop.js +65 -0
  124. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.effect-explode.js +97 -0
  125. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.effect-fade.js +30 -0
  126. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.effect-fold.js +76 -0
  127. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.effect-highlight.js +50 -0
  128. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.effect-pulsate.js +63 -0
  129. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.effect-scale.js +318 -0
  130. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.effect-shake.js +74 -0
  131. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.effect-slide.js +64 -0
  132. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.effect-transfer.js +47 -0
  133. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.effect.js +1259 -0
  134. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.menu.js +621 -0
  135. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.mouse.js +169 -0
  136. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.position.js +497 -0
  137. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.progressbar.js +145 -0
  138. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.resizable.js +963 -0
  139. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.selectable.js +269 -0
  140. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.slider.js +641 -0
  141. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.sortable.js +1236 -0
  142. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.spinner.js +492 -0
  143. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.tabs.js +846 -0
  144. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.tooltip.js +400 -0
  145. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.widget.js +521 -0
  146. data/apps/core/components/public/js/jquery/plugins/bsmselect/js/jquery.bsmselect.js +3 -1
  147. data/apps/core/components/public/js/plugins/sortable.js +5 -5
  148. data/apps/core/components/widgets/month_calendar/month_calendar.shtml +1 -1
  149. data/apps/core/components/widgets/table/table.rb +18 -5
  150. data/apps/core/forms/public/date_time.js +3 -0
  151. data/apps/core/forms/widgets/form/form.rb +1 -1
  152. data/apps/core/forms/widgets/inputs/date_time/date_time.rb +5 -0
  153. data/apps/core/forms/widgets/inputs/file_input/file_input.rb +1 -1
  154. data/apps/core/forms/widgets/inputs/select/select.rb +11 -16
  155. data/apps/messenger/config/options.rb +5 -5
  156. data/apps/messenger/controllers/messenger_admin_controller.rb +1 -1
  157. data/apps/messenger/controllers/messenger_controller.rb +1 -1
  158. data/apps/messenger/lib/backends/mobyt.rb +1 -1
  159. data/apps/messenger/messenger.rb +4 -2
  160. data/apps/messenger/views/admin/index.shtml +1 -1
  161. data/lib/spiderfw/controller/dispatcher.rb +5 -5
  162. data/lib/spiderfw/controller/mixins/visual.rb +10 -8
  163. data/lib/spiderfw/http/http.rb +1 -1
  164. data/lib/spiderfw/model/base_model.rb +2 -2
  165. data/lib/spiderfw/model/mappers/db_mapper.rb +4 -2
  166. data/lib/spiderfw/model/mixins/tree.rb +4 -5
  167. data/lib/spiderfw/model/model.rb +2 -1
  168. data/lib/spiderfw/model/storage/db/adapters/mysql.rb +18 -20
  169. data/lib/spiderfw/model/storage/db/adapters/oracle.rb +1 -1
  170. data/lib/spiderfw/spider.rb +5 -1
  171. data/lib/spiderfw/templates/blocks/layout_assets.rb +5 -2
  172. data/lib/spiderfw/templates/layout.rb +7 -3
  173. data/lib/spiderfw/templates/template.rb +8 -1
  174. data/lib/spiderfw/utils/monkey/date_time.rb +7 -5
  175. data/lib/spiderfw/utils/monkey/module.rb +12 -0
  176. metadata +373 -157
  177. data/lib/spiderfw/model/storage/db/connectors/mysql.rb +0 -16
  178. data/lib/spiderfw/model/storage/db/connectors/mysql2.rb +0 -9
  179. /data/apps/core/admin/public/img/{icons-s845a69dd9f.png → icons-s8b18557db6.png} +0 -0
@@ -0,0 +1,419 @@
1
+ /*!
2
+ * jQuery UI Button @VERSION
3
+ * http://jqueryui.com
4
+ *
5
+ * Copyright 2012 jQuery Foundation and other contributors
6
+ * Released under the MIT license.
7
+ * http://jquery.org/license
8
+ *
9
+ * http://api.jqueryui.com/button/
10
+ *
11
+ * Depends:
12
+ * jquery.ui.core.js
13
+ * jquery.ui.widget.js
14
+ */
15
+ (function( $, undefined ) {
16
+
17
+ var lastActive, startXPos, startYPos, clickDragged,
18
+ baseClasses = "ui-button ui-widget ui-state-default ui-corner-all",
19
+ stateClasses = "ui-state-hover ui-state-active ",
20
+ typeClasses = "ui-button-icons-only ui-button-icon-only ui-button-text-icons ui-button-text-icon-primary ui-button-text-icon-secondary ui-button-text-only",
21
+ formResetHandler = function() {
22
+ var buttons = $( this ).find( ":ui-button" );
23
+ setTimeout(function() {
24
+ buttons.button( "refresh" );
25
+ }, 1 );
26
+ },
27
+ radioGroup = function( radio ) {
28
+ var name = radio.name,
29
+ form = radio.form,
30
+ radios = $( [] );
31
+ if ( name ) {
32
+ name = name.replace( /'/g, "\\'" );
33
+ if ( form ) {
34
+ radios = $( form ).find( "[name='" + name + "']" );
35
+ } else {
36
+ radios = $( "[name='" + name + "']", radio.ownerDocument )
37
+ .filter(function() {
38
+ return !this.form;
39
+ });
40
+ }
41
+ }
42
+ return radios;
43
+ };
44
+
45
+ $.widget( "ui.button", {
46
+ version: "@VERSION",
47
+ defaultElement: "<button>",
48
+ options: {
49
+ disabled: null,
50
+ text: true,
51
+ label: null,
52
+ icons: {
53
+ primary: null,
54
+ secondary: null
55
+ }
56
+ },
57
+ _create: function() {
58
+ this.element.closest( "form" )
59
+ .unbind( "reset" + this.eventNamespace )
60
+ .bind( "reset" + this.eventNamespace, formResetHandler );
61
+
62
+ if ( typeof this.options.disabled !== "boolean" ) {
63
+ this.options.disabled = !!this.element.prop( "disabled" );
64
+ } else {
65
+ this.element.prop( "disabled", this.options.disabled );
66
+ }
67
+
68
+ this._determineButtonType();
69
+ this.hasTitle = !!this.buttonElement.attr( "title" );
70
+
71
+ var that = this,
72
+ options = this.options,
73
+ toggleButton = this.type === "checkbox" || this.type === "radio",
74
+ activeClass = !toggleButton ? "ui-state-active" : "",
75
+ focusClass = "ui-state-focus";
76
+
77
+ if ( options.label === null ) {
78
+ options.label = (this.type === "input" ? this.buttonElement.val() : this.buttonElement.html());
79
+ }
80
+
81
+ this._hoverable( this.buttonElement );
82
+
83
+ this.buttonElement
84
+ .addClass( baseClasses )
85
+ .attr( "role", "button" )
86
+ .bind( "mouseenter" + this.eventNamespace, function() {
87
+ if ( options.disabled ) {
88
+ return;
89
+ }
90
+ if ( this === lastActive ) {
91
+ $( this ).addClass( "ui-state-active" );
92
+ }
93
+ })
94
+ .bind( "mouseleave" + this.eventNamespace, function() {
95
+ if ( options.disabled ) {
96
+ return;
97
+ }
98
+ $( this ).removeClass( activeClass );
99
+ })
100
+ .bind( "click" + this.eventNamespace, function( event ) {
101
+ if ( options.disabled ) {
102
+ event.preventDefault();
103
+ event.stopImmediatePropagation();
104
+ }
105
+ });
106
+
107
+ this.element
108
+ .bind( "focus" + this.eventNamespace, function() {
109
+ // no need to check disabled, focus won't be triggered anyway
110
+ that.buttonElement.addClass( focusClass );
111
+ })
112
+ .bind( "blur" + this.eventNamespace, function() {
113
+ that.buttonElement.removeClass( focusClass );
114
+ });
115
+
116
+ if ( toggleButton ) {
117
+ this.element.bind( "change" + this.eventNamespace, function() {
118
+ if ( clickDragged ) {
119
+ return;
120
+ }
121
+ that.refresh();
122
+ });
123
+ // if mouse moves between mousedown and mouseup (drag) set clickDragged flag
124
+ // prevents issue where button state changes but checkbox/radio checked state
125
+ // does not in Firefox (see ticket #6970)
126
+ this.buttonElement
127
+ .bind( "mousedown" + this.eventNamespace, function( event ) {
128
+ if ( options.disabled ) {
129
+ return;
130
+ }
131
+ clickDragged = false;
132
+ startXPos = event.pageX;
133
+ startYPos = event.pageY;
134
+ })
135
+ .bind( "mouseup" + this.eventNamespace, function( event ) {
136
+ if ( options.disabled ) {
137
+ return;
138
+ }
139
+ if ( startXPos !== event.pageX || startYPos !== event.pageY ) {
140
+ clickDragged = true;
141
+ }
142
+ });
143
+ }
144
+
145
+ if ( this.type === "checkbox" ) {
146
+ this.buttonElement.bind( "click" + this.eventNamespace, function() {
147
+ if ( options.disabled || clickDragged ) {
148
+ return false;
149
+ }
150
+ });
151
+ } else if ( this.type === "radio" ) {
152
+ this.buttonElement.bind( "click" + this.eventNamespace, function() {
153
+ if ( options.disabled || clickDragged ) {
154
+ return false;
155
+ }
156
+ $( this ).addClass( "ui-state-active" );
157
+ that.buttonElement.attr( "aria-pressed", "true" );
158
+
159
+ var radio = that.element[ 0 ];
160
+ radioGroup( radio )
161
+ .not( radio )
162
+ .map(function() {
163
+ return $( this ).button( "widget" )[ 0 ];
164
+ })
165
+ .removeClass( "ui-state-active" )
166
+ .attr( "aria-pressed", "false" );
167
+ });
168
+ } else {
169
+ this.buttonElement
170
+ .bind( "mousedown" + this.eventNamespace, function() {
171
+ if ( options.disabled ) {
172
+ return false;
173
+ }
174
+ $( this ).addClass( "ui-state-active" );
175
+ lastActive = this;
176
+ that.document.one( "mouseup", function() {
177
+ lastActive = null;
178
+ });
179
+ })
180
+ .bind( "mouseup" + this.eventNamespace, function() {
181
+ if ( options.disabled ) {
182
+ return false;
183
+ }
184
+ $( this ).removeClass( "ui-state-active" );
185
+ })
186
+ .bind( "keydown" + this.eventNamespace, function(event) {
187
+ if ( options.disabled ) {
188
+ return false;
189
+ }
190
+ if ( event.keyCode === $.ui.keyCode.SPACE || event.keyCode === $.ui.keyCode.ENTER ) {
191
+ $( this ).addClass( "ui-state-active" );
192
+ }
193
+ })
194
+ // see #8559, we bind to blur here in case the button element loses
195
+ // focus between keydown and keyup, it would be left in an "active" state
196
+ .bind( "keyup" + this.eventNamespace + " blur" + this.eventNamespace, function() {
197
+ $( this ).removeClass( "ui-state-active" );
198
+ });
199
+
200
+ if ( this.buttonElement.is("a") ) {
201
+ this.buttonElement.keyup(function(event) {
202
+ if ( event.keyCode === $.ui.keyCode.SPACE ) {
203
+ // TODO pass through original event correctly (just as 2nd argument doesn't work)
204
+ $( this ).click();
205
+ }
206
+ });
207
+ }
208
+ }
209
+
210
+ // TODO: pull out $.Widget's handling for the disabled option into
211
+ // $.Widget.prototype._setOptionDisabled so it's easy to proxy and can
212
+ // be overridden by individual plugins
213
+ this._setOption( "disabled", options.disabled );
214
+ this._resetButton();
215
+ },
216
+
217
+ _determineButtonType: function() {
218
+ var ancestor, labelSelector, checked;
219
+
220
+ if ( this.element.is("[type=checkbox]") ) {
221
+ this.type = "checkbox";
222
+ } else if ( this.element.is("[type=radio]") ) {
223
+ this.type = "radio";
224
+ } else if ( this.element.is("input") ) {
225
+ this.type = "input";
226
+ } else {
227
+ this.type = "button";
228
+ }
229
+
230
+ if ( this.type === "checkbox" || this.type === "radio" ) {
231
+ // we don't search against the document in case the element
232
+ // is disconnected from the DOM
233
+ ancestor = this.element.parents().last();
234
+ labelSelector = "label[for='" + this.element.attr("id") + "']";
235
+ this.buttonElement = ancestor.find( labelSelector );
236
+ if ( !this.buttonElement.length ) {
237
+ ancestor = ancestor.length ? ancestor.siblings() : this.element.siblings();
238
+ this.buttonElement = ancestor.filter( labelSelector );
239
+ if ( !this.buttonElement.length ) {
240
+ this.buttonElement = ancestor.find( labelSelector );
241
+ }
242
+ }
243
+ this.element.addClass( "ui-helper-hidden-accessible" );
244
+
245
+ checked = this.element.is( ":checked" );
246
+ if ( checked ) {
247
+ this.buttonElement.addClass( "ui-state-active" );
248
+ }
249
+ this.buttonElement.prop( "aria-pressed", checked );
250
+ } else {
251
+ this.buttonElement = this.element;
252
+ }
253
+ },
254
+
255
+ widget: function() {
256
+ return this.buttonElement;
257
+ },
258
+
259
+ _destroy: function() {
260
+ this.element
261
+ .removeClass( "ui-helper-hidden-accessible" );
262
+ this.buttonElement
263
+ .removeClass( baseClasses + " " + stateClasses + " " + typeClasses )
264
+ .removeAttr( "role" )
265
+ .removeAttr( "aria-pressed" )
266
+ .html( this.buttonElement.find(".ui-button-text").html() );
267
+
268
+ if ( !this.hasTitle ) {
269
+ this.buttonElement.removeAttr( "title" );
270
+ }
271
+ },
272
+
273
+ _setOption: function( key, value ) {
274
+ this._super( key, value );
275
+ if ( key === "disabled" ) {
276
+ if ( value ) {
277
+ this.element.prop( "disabled", true );
278
+ } else {
279
+ this.element.prop( "disabled", false );
280
+ }
281
+ return;
282
+ }
283
+ this._resetButton();
284
+ },
285
+
286
+ refresh: function() {
287
+ //See #8237 & #8828
288
+ var isDisabled = this.element.is( "input, button" ) ? this.element.is( ":disabled" ) : this.element.hasClass( "ui-button-disabled" );
289
+
290
+ if ( isDisabled !== this.options.disabled ) {
291
+ this._setOption( "disabled", isDisabled );
292
+ }
293
+ if ( this.type === "radio" ) {
294
+ radioGroup( this.element[0] ).each(function() {
295
+ if ( $( this ).is( ":checked" ) ) {
296
+ $( this ).button( "widget" )
297
+ .addClass( "ui-state-active" )
298
+ .attr( "aria-pressed", "true" );
299
+ } else {
300
+ $( this ).button( "widget" )
301
+ .removeClass( "ui-state-active" )
302
+ .attr( "aria-pressed", "false" );
303
+ }
304
+ });
305
+ } else if ( this.type === "checkbox" ) {
306
+ if ( this.element.is( ":checked" ) ) {
307
+ this.buttonElement
308
+ .addClass( "ui-state-active" )
309
+ .attr( "aria-pressed", "true" );
310
+ } else {
311
+ this.buttonElement
312
+ .removeClass( "ui-state-active" )
313
+ .attr( "aria-pressed", "false" );
314
+ }
315
+ }
316
+ },
317
+
318
+ _resetButton: function() {
319
+ if ( this.type === "input" ) {
320
+ if ( this.options.label ) {
321
+ this.element.val( this.options.label );
322
+ }
323
+ return;
324
+ }
325
+ var buttonElement = this.buttonElement.removeClass( typeClasses ),
326
+ buttonText = $( "<span></span>", this.document[0] )
327
+ .addClass( "ui-button-text" )
328
+ .html( this.options.label )
329
+ .appendTo( buttonElement.empty() )
330
+ .text(),
331
+ icons = this.options.icons,
332
+ multipleIcons = icons.primary && icons.secondary,
333
+ buttonClasses = [];
334
+
335
+ if ( icons.primary || icons.secondary ) {
336
+ if ( this.options.text ) {
337
+ buttonClasses.push( "ui-button-text-icon" + ( multipleIcons ? "s" : ( icons.primary ? "-primary" : "-secondary" ) ) );
338
+ }
339
+
340
+ if ( icons.primary ) {
341
+ buttonElement.prepend( "<span class='ui-button-icon-primary ui-icon " + icons.primary + "'></span>" );
342
+ }
343
+
344
+ if ( icons.secondary ) {
345
+ buttonElement.append( "<span class='ui-button-icon-secondary ui-icon " + icons.secondary + "'></span>" );
346
+ }
347
+
348
+ if ( !this.options.text ) {
349
+ buttonClasses.push( multipleIcons ? "ui-button-icons-only" : "ui-button-icon-only" );
350
+
351
+ if ( !this.hasTitle ) {
352
+ buttonElement.attr( "title", $.trim( buttonText ) );
353
+ }
354
+ }
355
+ } else {
356
+ buttonClasses.push( "ui-button-text-only" );
357
+ }
358
+ buttonElement.addClass( buttonClasses.join( " " ) );
359
+ }
360
+ });
361
+
362
+ $.widget( "ui.buttonset", {
363
+ version: "@VERSION",
364
+ options: {
365
+ items: "button, input[type=button], input[type=submit], input[type=reset], input[type=checkbox], input[type=radio], a, :data(ui-button)"
366
+ },
367
+
368
+ _create: function() {
369
+ this.element.addClass( "ui-buttonset" );
370
+ },
371
+
372
+ _init: function() {
373
+ this.refresh();
374
+ },
375
+
376
+ _setOption: function( key, value ) {
377
+ if ( key === "disabled" ) {
378
+ this.buttons.button( "option", key, value );
379
+ }
380
+
381
+ this._super( key, value );
382
+ },
383
+
384
+ refresh: function() {
385
+ var rtl = this.element.css( "direction" ) === "rtl";
386
+
387
+ this.buttons = this.element.find( this.options.items )
388
+ .filter( ":ui-button" )
389
+ .button( "refresh" )
390
+ .end()
391
+ .not( ":ui-button" )
392
+ .button()
393
+ .end()
394
+ .map(function() {
395
+ return $( this ).button( "widget" )[ 0 ];
396
+ })
397
+ .removeClass( "ui-corner-all ui-corner-left ui-corner-right" )
398
+ .filter( ":first" )
399
+ .addClass( rtl ? "ui-corner-right" : "ui-corner-left" )
400
+ .end()
401
+ .filter( ":last" )
402
+ .addClass( rtl ? "ui-corner-left" : "ui-corner-right" )
403
+ .end()
404
+ .end();
405
+ },
406
+
407
+ _destroy: function() {
408
+ this.element.removeClass( "ui-buttonset" );
409
+ this.buttons
410
+ .map(function() {
411
+ return $( this ).button( "widget" )[ 0 ];
412
+ })
413
+ .removeClass( "ui-corner-left ui-corner-right" )
414
+ .end()
415
+ .button( "destroy" );
416
+ }
417
+ });
418
+
419
+ }( jQuery ) );