typus 3.1.0.rc18 → 3.1.0.rc19

Sign up to get free protection for your applications and to get access to all the features.
Files changed (138) hide show
  1. data/.gitignore +14 -11
  2. data/.travis.yml +12 -0
  3. data/CHANGELOG +253 -0
  4. data/Gemfile +69 -0
  5. data/Guardfile +11 -0
  6. data/README.md +14 -26
  7. data/Rakefile +24 -100
  8. data/app/assets/javascripts/typus/application.js +8 -2
  9. data/app/assets/javascripts/typus/custom.js +2 -0
  10. data/app/assets/javascripts/typus/jquery.application.js +14 -0
  11. data/app/assets/stylesheets/typus/application.css +18 -10
  12. data/app/assets/stylesheets/typus/content.css +0 -1
  13. data/app/assets/stylesheets/typus/custom.css +11 -0
  14. data/app/assets/stylesheets/typus/errors.css +1 -1
  15. data/app/assets/stylesheets/typus/forms.css +17 -5
  16. data/app/assets/stylesheets/typus/hacks.css +4 -0
  17. data/app/assets/stylesheets/typus/header.css +8 -2
  18. data/app/assets/stylesheets/typus/pagination.css +3 -3
  19. data/app/assets/stylesheets/typus/sidebar.css +4 -0
  20. data/app/assets/stylesheets/typus/tables.css +0 -1
  21. data/app/controllers/admin/account_controller.rb +1 -2
  22. data/app/controllers/admin/base_controller.rb +5 -2
  23. data/app/controllers/admin/dashboard_controller.rb +5 -0
  24. data/app/controllers/admin/resource_controller.rb +1 -2
  25. data/app/controllers/admin/resources_controller.rb +36 -51
  26. data/app/controllers/admin/session_controller.rb +2 -3
  27. data/app/helpers/admin/base_helper.rb +2 -5
  28. data/app/helpers/admin/resources/data_types/belongs_to_helper.rb +35 -27
  29. data/app/helpers/admin/resources/data_types/dragonfly_helper.rb +16 -3
  30. data/app/helpers/admin/resources/data_types/has_and_belongs_to_many_helper.rb +45 -13
  31. data/app/helpers/admin/resources/data_types/has_many_helper.rb +27 -19
  32. data/app/helpers/admin/resources/data_types/has_one_helper.rb +24 -11
  33. data/app/helpers/admin/resources/data_types/paperclip_helper.rb +1 -1
  34. data/app/helpers/admin/resources/data_types/string_helper.rb +1 -1
  35. data/app/helpers/admin/resources/data_types/text_helper.rb +1 -1
  36. data/app/helpers/admin/resources/data_types/transversal_helper.rb +1 -1
  37. data/app/helpers/admin/resources/data_types/tree_helper.rb +1 -1
  38. data/app/helpers/admin/resources/display_helper.rb +10 -9
  39. data/app/helpers/admin/resources/filters_helper.rb +3 -10
  40. data/app/helpers/admin/resources/form_helper.rb +12 -2
  41. data/app/helpers/admin/resources/list_helper.rb +13 -5
  42. data/app/helpers/admin/resources/relationships_helper.rb +0 -21
  43. data/app/helpers/admin/resources_helper.rb +3 -3
  44. data/app/mailers/admin/mailer.rb +9 -4
  45. data/app/views/admin/base/user_guide.html.erb +1 -1
  46. data/app/views/admin/dashboard/{show.html.erb → index.html.erb} +0 -0
  47. data/app/views/admin/dashboard/widgets/_applications.html.erb +32 -10
  48. data/app/views/admin/mailer/reset_password_instructions.html.erb +9 -0
  49. data/app/views/admin/mailer/reset_password_instructions.text.erb +9 -0
  50. data/app/views/admin/resources/edit.html.erb +3 -13
  51. data/app/views/admin/resources/index.html.erb +11 -4
  52. data/app/views/admin/resources/new.html.erb +2 -2
  53. data/app/views/admin/resources/show.html.erb +1 -1
  54. data/app/views/admin/shared/_head.html.erb +2 -2
  55. data/app/views/admin/templates/_belongs_to.html.erb +6 -9
  56. data/app/views/admin/templates/_dragonfly.html.erb +1 -1
  57. data/app/views/admin/templates/_dragonfly_form_preview.html.erb +21 -0
  58. data/app/views/admin/templates/_dragonfly_preview.html.erb +1 -1
  59. data/app/views/admin/templates/_has_and_belongs_to_many.html.erb +15 -0
  60. data/app/views/admin/templates/{_has_n.html.erb → _has_many.html.erb} +0 -0
  61. data/app/views/admin/templates/_password.html.erb +1 -1
  62. data/app/views/admin/templates/_selector.html.erb +1 -11
  63. data/app/views/admin/templates/_string.html.erb +2 -20
  64. data/app/views/admin/templates/_string_with_preview.html.erb +2 -3
  65. data/app/views/admin/templates/_text.html.erb +1 -8
  66. data/app/views/admin/templates/_text_with_ckeditor.html.erb +1 -1
  67. data/app/views/admin/templates/_text_with_ckeditor_and_assets.html.erb +12 -9
  68. data/app/views/helpers/admin/base/_apps.html.erb +12 -4
  69. data/app/views/helpers/admin/base/_login_info.html.erb +1 -1
  70. data/app/views/helpers/admin/resources/_filters.html.erb +2 -1
  71. data/app/views/helpers/admin/resources/_sidebar.html.erb +25 -41
  72. data/app/views/layouts/admin/base.html.erb +1 -1
  73. data/config/locales/typus.ca.yml +1 -1
  74. data/config/locales/typus.de.yml +40 -35
  75. data/config/locales/typus.el.yml +1 -1
  76. data/config/locales/typus.es.yml +1 -1
  77. data/config/locales/typus.fr.yml +1 -1
  78. data/config/locales/typus.hu.yml +1 -1
  79. data/config/locales/typus.it.yml +1 -1
  80. data/config/locales/typus.locale.models.yml.template +17 -0
  81. data/config/locales/typus.locale.yml.template +80 -0
  82. data/config/locales/typus.pt-BR.yml +1 -1
  83. data/config/locales/typus.pt-PT.yml +2 -2
  84. data/config/locales/typus.ru.yml +1 -1
  85. data/config/locales/typus.zh-CN.yml +1 -1
  86. data/config/routes.rb +5 -1
  87. data/lib/generators/templates/config/initializers/typus.rb +9 -0
  88. data/lib/generators/templates/config/typus/README +0 -6
  89. data/lib/support/active_record.rb +2 -10
  90. data/lib/support/string.rb +6 -1
  91. data/lib/typus.rb +49 -10
  92. data/lib/typus/authentication/base.rb +0 -4
  93. data/lib/typus/authentication/none_with_role.rb +15 -0
  94. data/lib/typus/configuration.rb +3 -7
  95. data/lib/typus/controller/ancestry.rb +1 -1
  96. data/lib/typus/controller/bulk.rb +6 -2
  97. data/lib/typus/controller/format.rb +38 -25
  98. data/lib/typus/orm/active_record/class_methods.rb +0 -1
  99. data/lib/typus/orm/active_record/search.rb +6 -2
  100. data/lib/typus/orm/base.rb +4 -3
  101. data/lib/typus/orm/mongoid.rb +4 -0
  102. data/lib/typus/orm/{mongo → mongoid}/class_methods.rb +4 -3
  103. data/lib/typus/resources.rb +9 -0
  104. data/lib/typus/version.rb +1 -1
  105. data/typus.gemspec +13 -13
  106. data/vendor/assets/chosen/chosen-sprite.png +0 -0
  107. data/vendor/assets/chosen/chosen.css +334 -0
  108. data/vendor/assets/chosen/chosen.jquery.min.js +10 -0
  109. data/vendor/assets/fancybox/jquery.fancybox-1.3.4.css +17 -17
  110. metadata +57 -131
  111. data/.gitmodules +0 -6
  112. data/app/assets/javascripts/typus.js +0 -8
  113. data/app/assets/stylesheets/typus.css +0 -20
  114. data/app/assets/stylesheets/typus/actions.css +0 -11
  115. data/app/views/admin/mailer/reset_password_link.text.erb +0 -9
  116. data/app/views/admin/templates/_belongs_to_with_autocomplete.html.erb +0 -26
  117. data/lib/typus/controller/associations.rb +0 -146
  118. data/lib/typus/controller/autocomplete.rb +0 -16
  119. data/vendor/assets/fancybox/jquery.easing-1.3.pack.js +0 -72
  120. data/vendor/assets/fancybox/jquery.fancybox-1.3.4.js +0 -1156
  121. data/vendor/assets/fancybox/jquery.mousewheel-3.0.4.pack.js +0 -14
  122. data/vendor/assets/formalize/css/_formalize.sass +0 -332
  123. data/vendor/assets/formalize/css/demo.css +0 -47
  124. data/vendor/assets/formalize/css/reset.css +0 -202
  125. data/vendor/assets/formalize/css/text.css +0 -81
  126. data/vendor/assets/formalize/js/dojo.formalize.js +0 -166
  127. data/vendor/assets/formalize/js/dojo.formalize.min.js +0 -1
  128. data/vendor/assets/formalize/js/extjs.formalize.js +0 -163
  129. data/vendor/assets/formalize/js/extjs.formalize.min.js +0 -1
  130. data/vendor/assets/formalize/js/jquery.formalize.js +0 -150
  131. data/vendor/assets/formalize/js/mootools.formalize.js +0 -155
  132. data/vendor/assets/formalize/js/mootools.formalize.min.js +0 -1
  133. data/vendor/assets/formalize/js/prototype.formalize.js +0 -163
  134. data/vendor/assets/formalize/js/prototype.formalize.min.js +0 -1
  135. data/vendor/assets/formalize/js/yui.formalize.js +0 -152
  136. data/vendor/assets/formalize/js/yui.formalize.min.js +0 -1
  137. data/vendor/assets/jquery-tokeninput/jquery.tokeninput.js +0 -736
  138. data/vendor/assets/jquery-tokeninput/token-input.css +0 -120
@@ -1,81 +0,0 @@
1
- /*
2
- 960 Grid System ~ Text CSS.
3
- Learn more ~ http://960.gs/
4
-
5
- Licensed under GPL and MIT.
6
- */
7
-
8
- /* `Basic HTML
9
- ----------------------------------------------------------------------------------------------------*/
10
-
11
- body {
12
- font: 13px/1.5 'Helvetica Neue', Arial, 'Liberation Sans', FreeSans, sans-serif;
13
- }
14
-
15
- hr {
16
- border: 0 #ccc solid;
17
- border-top-width: 1px;
18
- clear: both;
19
- height: 0;
20
- }
21
-
22
- /* `Headings
23
- ----------------------------------------------------------------------------------------------------*/
24
-
25
- h1 {
26
- font-size: 25px;
27
- }
28
-
29
- h2 {
30
- font-size: 23px;
31
- }
32
-
33
- h3 {
34
- font-size: 21px;
35
- }
36
-
37
- h4 {
38
- font-size: 19px;
39
- }
40
-
41
- h5 {
42
- font-size: 17px;
43
- }
44
-
45
- h6 {
46
- font-size: 15px;
47
- }
48
-
49
- /* `Spacing
50
- ----------------------------------------------------------------------------------------------------*/
51
-
52
- ol {
53
- list-style: decimal;
54
- }
55
-
56
- ul {
57
- list-style: disc;
58
- }
59
-
60
- li {
61
- margin-left: 30px;
62
- }
63
-
64
- p,
65
- dl,
66
- hr,
67
- h1,
68
- h2,
69
- h3,
70
- h4,
71
- h5,
72
- h6,
73
- ol,
74
- ul,
75
- pre,
76
- table,
77
- address,
78
- fieldset,
79
- figure {
80
- margin-bottom: 20px;
81
- }
@@ -1,166 +0,0 @@
1
- /*
2
- Formalize - version 1.1
3
-
4
- Note: This file depends on the Dojo library.
5
- */
6
-
7
- // Module pattern:
8
- // http://yuiblog.com/blog/2007/06/12/module-pattern
9
- var FORMALIZE = (function(window, document, undefined) {
10
- // Private constants.
11
- var PLACEHOLDER_SUPPORTED = 'placeholder' in document.createElement('input');
12
- var AUTOFOCUS_SUPPORTED = 'autofocus' in document.createElement('input');
13
- var IE6 = parseInt(dojo.isIE, 10) === 6;
14
- var IE7 = parseInt(dojo.isIE, 10) === 7;
15
-
16
- // Expose innards of FORMALIZE.
17
- return {
18
- // FORMALIZE.go
19
- go: function() {
20
- for (var i in FORMALIZE.init) {
21
- FORMALIZE.init[i]();
22
- }
23
- },
24
- // FORMALIZE.init
25
- init: {
26
- // FORMALIZE.init.full_input_size
27
- full_input_size: function() {
28
- if (!IE7 || !dojo.query('textarea, input.input_full').length) {
29
- return;
30
- }
31
-
32
- // This fixes width: 100% on <textarea> and class="input_full".
33
- // It ensures that form elements don't go wider than container.
34
- dojo.query('textarea, input.input_full').forEach(function(el) {
35
- var new_el = el.cloneNode(false);
36
- var span = document.createElement('span');
37
-
38
- span.className = 'input_full_wrap';
39
- span.appendChild(new_el);
40
- el.parentNode.replaceChild(span, el);
41
- });
42
- },
43
- // FORMALIZE.init.ie6_skin_inputs
44
- ie6_skin_inputs: function() {
45
- // Test for Internet Explorer 6.
46
- if (!IE6 || !dojo.query('input, select, textarea').length) {
47
- // Exit if the browser is not IE6,
48
- // or if no form elements exist.
49
- return;
50
- }
51
-
52
- // For <input type="submit" />, etc.
53
- var button_regex = /button|submit|reset/;
54
-
55
- // For <input type="text" />, etc.
56
- var type_regex = /date|datetime|datetime-local|email|month|number|password|range|search|tel|text|time|url|week/;
57
-
58
- dojo.query('input').forEach(function(el) {
59
- // Is it a button?
60
- if (el.getAttribute('type').match(button_regex)) {
61
- dojo.addClass(el, 'ie6_button');
62
-
63
- /* Is it disabled? */
64
- if (el.disabled) {
65
- dojo.addClass(el, 'ie6_button_disabled');
66
- }
67
- }
68
- // Or is it a textual input?
69
- else if (el.getAttribute('type').match(type_regex)) {
70
- dojo.addClass(el, 'ie6_input');
71
-
72
- /* Is it disabled? */
73
- if (el.disabled) {
74
- dojo.addClass(el, 'ie6_input_disabled');
75
- }
76
- }
77
- });
78
-
79
- dojo.query('textarea, select').forEach(function(el) {
80
- /* Is it disabled? */
81
- if (el.disabled) {
82
- dojo.addClass(el, 'ie6_input_disabled');
83
- }
84
- });
85
- },
86
- // FORMALIZE.init.autofocus
87
- autofocus: function() {
88
- if (AUTOFOCUS_SUPPORTED || !dojo.query('[autofocus]').length) {
89
- return;
90
- }
91
-
92
- dojo.query('[autofocus]')[0].focus();
93
- },
94
- // FORMALIZE.init.placeholder
95
- placeholder: function() {
96
- if (PLACEHOLDER_SUPPORTED || !dojo.query('[placeholder]').length) {
97
- // Exit if placeholder is supported natively,
98
- // or if page does not have any placeholder.
99
- return;
100
- }
101
-
102
- FORMALIZE.misc.add_placeholder();
103
-
104
- dojo.query('[placeholder]').forEach(function(el) {
105
- dojo.connect(el, 'onfocus', function() {
106
- var text = el.getAttribute('placeholder');
107
-
108
- if (el.value === text) {
109
- el.value = '';
110
- dojo.removeClass(el, 'placeholder_text');
111
- }
112
- });
113
-
114
- dojo.connect(el, 'onblur', function() {
115
- FORMALIZE.misc.add_placeholder();
116
- });
117
- });
118
-
119
- // Prevent <form> from accidentally
120
- // submitting the placeholder text.
121
- dojo.query('form').forEach(function(form) {
122
- dojo.connect(form, 'onsubmit', function() {
123
- dojo.query('[placeholder]', form).forEach(function(el) {
124
- var text = el.getAttribute('placeholder');
125
-
126
- if (el.value === text) {
127
- el.value = '';
128
- dojo.removeClass(el, 'placeholder_text');
129
- }
130
- });
131
- });
132
-
133
- dojo.connect(form, 'onreset', function() {
134
- setTimeout(FORMALIZE.misc.add_placeholder, 50);
135
- });
136
- });
137
- }
138
- },
139
- // FORMALIZE.misc
140
- misc: {
141
- // FORMALIZE.misc.add_placeholder
142
- add_placeholder: function() {
143
- if (PLACEHOLDER_SUPPORTED || !dojo.query('[placeholder]').length) {
144
- // Exit if placeholder is supported natively,
145
- // or if page does not have any placeholder.
146
- return;
147
- }
148
-
149
- dojo.query('[placeholder]').forEach(function(el) {
150
- var text = el.getAttribute('placeholder');
151
-
152
- if (!el.value || el.value === text) {
153
- el.value = text;
154
- dojo.addClass(el, 'placeholder_text');
155
- }
156
- });
157
- }
158
- }
159
- };
160
- // Alias window, document.
161
- })(this, this.document);
162
-
163
- // Automatically calls all functions in FORMALIZE.init
164
- dojo.addOnLoad(function() {
165
- FORMALIZE.go();
166
- });
@@ -1 +0,0 @@
1
- var FORMALIZE=function(a,b,c){var d="placeholder"in b.createElement("input"),e="autofocus"in b.createElement("input"),f=parseInt(dojo.isIE,10)===6,g=parseInt(dojo.isIE,10)===7;return{go:function(){for(var a in FORMALIZE.init)FORMALIZE.init[a]()},init:{full_input_size:function(){!!g&&!!dojo.query("textarea, input.input_full").length&&dojo.query("textarea, input.input_full").forEach(function(a){var c=a.cloneNode(!1),d=b.createElement("span");d.className="input_full_wrap",d.appendChild(c),a.parentNode.replaceChild(d,a)})},ie6_skin_inputs:function(){if(!!f&&!!dojo.query("input, select, textarea").length){var a=/button|submit|reset/,b=/date|datetime|datetime-local|email|month|number|password|range|search|tel|text|time|url|week/;dojo.query("input").forEach(function(c){c.getAttribute("type").match(a)?(dojo.addClass(c,"ie6_button"),c.disabled&&dojo.addClass(c,"ie6_button_disabled")):c.getAttribute("type").match(b)&&(dojo.addClass(c,"ie6_input"),c.disabled&&dojo.addClass(c,"ie6_input_disabled"))}),dojo.query("textarea, select").forEach(function(a){a.disabled&&dojo.addClass(a,"ie6_input_disabled")})}},autofocus:function(){!e&&!!dojo.query("[autofocus]").length&&dojo.query("[autofocus]")[0].focus()},placeholder:function(){!d&&!!dojo.query("[placeholder]").length&&(FORMALIZE.misc.add_placeholder(),dojo.query("[placeholder]").forEach(function(a){dojo.connect(a,"onfocus",function(){var b=a.getAttribute("placeholder");a.value===b&&(a.value="",dojo.removeClass(a,"placeholder_text"))}),dojo.connect(a,"onblur",function(){FORMALIZE.misc.add_placeholder()})}),dojo.query("form").forEach(function(a){dojo.connect(a,"onsubmit",function(){dojo.query("[placeholder]",a).forEach(function(a){var b=a.getAttribute("placeholder");a.value===b&&(a.value="",dojo.removeClass(a,"placeholder_text"))})}),dojo.connect(a,"onreset",function(){setTimeout(FORMALIZE.misc.add_placeholder,50)})}))}},misc:{add_placeholder:function(){!d&&!!dojo.query("[placeholder]").length&&dojo.query("[placeholder]").forEach(function(a){var b=a.getAttribute("placeholder");if(!a.value||a.value===b)a.value=b,dojo.addClass(a,"placeholder_text")})}}}}(this,this.document);dojo.addOnLoad(function(){FORMALIZE.go()})
@@ -1,163 +0,0 @@
1
- /*
2
- Formalize - version 1.1
3
-
4
- Note: This file depends on the ExtJS 3.x library.
5
- */
6
-
7
- // Module pattern:
8
- // http://yuiblog.com/blog/2007/06/12/module-pattern
9
- var FORMALIZE = (function(window, document, undefined) {
10
- // Private constants.
11
- var PLACEHOLDER_SUPPORTED = 'placeholder' in document.createElement('input');
12
- var AUTOFOCUS_SUPPORTED = 'autofocus' in document.createElement('input');
13
- var IE6 = Ext.isIE6;
14
- var IE7 = Ext.isIE7;
15
-
16
- // Expose innards of FORMALIZE.
17
- return {
18
- // FORMALIZE.go
19
- go: function() {
20
- for (var i in FORMALIZE.init) {
21
- FORMALIZE.init[i]();
22
- }
23
- },
24
- // FORMALIZE.init
25
- init: {
26
- // FORMALIZE.init.full_input_size
27
- full_input_size: function() {
28
- if (!IE7 || !Ext.query('textarea, input.input_full')) {
29
- return;
30
- }
31
-
32
- // This fixes width: 100% on <textarea> and class="input_full".
33
- // It ensures that form elements don't go wider than container.
34
- Ext.each(Ext.query('textarea, input.input_full'), function(el) {
35
- Ext.get(el).wrap('<span class="input_full_wrap"></span>');
36
- });
37
- },
38
- // FORMALIZE.init.ie6_skin_inputs
39
- ie6_skin_inputs: function() {
40
- // Test for Internet Explorer 6.
41
- if (!IE6 || !Ext.query('input, select, textarea')) {
42
- // Exit if the browser is not IE6,
43
- // or if no form elements exist.
44
- return;
45
- }
46
-
47
- // For <input type="submit" />, etc.
48
- var button_regex = /button|submit|reset/;
49
-
50
- // For <input type="text" />, etc.
51
- var type_regex = /date|datetime|datetime-local|email|month|number|password|range|search|tel|text|time|url|week/;
52
-
53
- Ext.each(Ext.query('input'), function(el) {
54
- // Is it a button?
55
- if (el.getAttribute('type').match(button_regex)) {
56
- Ext.get(el).addClass('ie6_button');
57
-
58
- /* Is it disabled? */
59
- if (el.disabled) {
60
- Ext.get(el).addClass('ie6_button_disabled');
61
- }
62
- }
63
- // Or is it a textual input?
64
- else if (el.getAttribute('type').match(type_regex)) {
65
- Ext.get(el).addClass('ie6_input');
66
-
67
- /* Is it disabled? */
68
- if (el.disabled) {
69
- Ext.get(el).addClass('ie6_input_disabled');
70
- }
71
- }
72
- });
73
-
74
- Ext.each(Ext.query('textarea, select'), function(el) {
75
- /* Is it disabled? */
76
- if (el.disabled) {
77
- Ext.get(el).addClass('ie6_input_disabled');
78
- }
79
- });
80
- },
81
- // FORMALIZE.init.autofocus
82
- autofocus: function() {
83
- if (AUTOFOCUS_SUPPORTED || !Ext.query('[autofocus]')) {
84
- return;
85
- }
86
-
87
- Ext.query('[autofocus]')[0].focus();
88
- },
89
- // FORMALIZE.init.placeholder
90
- placeholder: function() {
91
- if (PLACEHOLDER_SUPPORTED || !Ext.query('[placeholder]')) {
92
- // Exit if placeholder is supported natively,
93
- // or if page does not have any placeholder.
94
- return;
95
- }
96
-
97
- FORMALIZE.misc.add_placeholder();
98
-
99
- Ext.each(Ext.query('[placeholder]'), function(el) {
100
- var text = el.getAttribute('placeholder');
101
- var form = Ext.get(el).parent('form');
102
-
103
- function add_placeholder() {
104
- if (!el.value || el.value === text) {
105
- el.value = text;
106
- Ext.get(el).addClass('placeholder_text');
107
- }
108
- }
109
-
110
- Ext.get(el).on('focus', function() {
111
- if (el.value === text) {
112
- el.value = '';
113
- Ext.get(el).removeClass('placeholder_text');
114
- }
115
- });
116
-
117
- Ext.get(el).on('blur', function() {
118
- FORMALIZE.misc.add_placeholder();
119
- });
120
-
121
- // Prevent <form> from accidentally
122
- // submitting the placeholder text.
123
- form.on('submit', function() {
124
- if (el.value === text) {
125
- el.value = '';
126
- Ext.get(el).removeClass('placeholder_text');
127
- }
128
- });
129
-
130
- form.on('reset', function() {
131
- setTimeout(FORMALIZE.misc.add_placeholder, 50);
132
- });
133
- });
134
- }
135
- },
136
- // FORMALIZE.misc
137
- misc: {
138
- // FORMALIZE.misc.add_placeholder
139
- add_placeholder: function() {
140
- if (PLACEHOLDER_SUPPORTED || !Ext.query('[placeholder]')) {
141
- // Exit if placeholder is supported natively,
142
- // or if page does not have any placeholder.
143
- return;
144
- }
145
-
146
- Ext.each(Ext.query('[placeholder]'), function(el) {
147
- var text = el.getAttribute('placeholder');
148
-
149
- if (!el.value || el.value === text) {
150
- el.value = text;
151
- Ext.get(el).addClass('placeholder_text');
152
- }
153
- });
154
- }
155
- }
156
- };
157
- // Alias window, document.
158
- })(this, this.document);
159
-
160
- // Automatically calls all functions in FORMALIZE.init
161
- Ext.onReady(function() {
162
- FORMALIZE.go();
163
- });
@@ -1 +0,0 @@
1
- var FORMALIZE=function(a,b,c){var d="placeholder"in b.createElement("input"),e="autofocus"in b.createElement("input"),f=Ext.isIE6,g=Ext.isIE7;return{go:function(){for(var a in FORMALIZE.init)FORMALIZE.init[a]()},init:{full_input_size:function(){!!g&&!!Ext.query("textarea, input.input_full")&&Ext.each(Ext.query("textarea, input.input_full"),function(a){Ext.get(a).wrap('<span class="input_full_wrap"></span>')})},ie6_skin_inputs:function(){if(!!f&&!!Ext.query("input, select, textarea")){var a=/button|submit|reset/,b=/date|datetime|datetime-local|email|month|number|password|range|search|tel|text|time|url|week/;Ext.each(Ext.query("input"),function(c){c.getAttribute("type").match(a)?(Ext.get(c).addClass("ie6_button"),c.disabled&&Ext.get(c).addClass("ie6_button_disabled")):c.getAttribute("type").match(b)&&(Ext.get(c).addClass("ie6_input"),c.disabled&&Ext.get(c).addClass("ie6_input_disabled"))}),Ext.each(Ext.query("textarea, select"),function(a){a.disabled&&Ext.get(a).addClass("ie6_input_disabled")})}},autofocus:function(){!e&&!!Ext.query("[autofocus]")&&Ext.query("[autofocus]")[0].focus()},placeholder:function(){!d&&!!Ext.query("[placeholder]")&&(FORMALIZE.misc.add_placeholder(),Ext.each(Ext.query("[placeholder]"),function(a){function d(){if(!a.value||a.value===b)a.value=b,Ext.get(a).addClass("placeholder_text")}var b=a.getAttribute("placeholder"),c=Ext.get(a).parent("form");Ext.get(a).on("focus",function(){a.value===b&&(a.value="",Ext.get(a).removeClass("placeholder_text"))}),Ext.get(a).on("blur",function(){FORMALIZE.misc.add_placeholder()}),c.on("submit",function(){a.value===b&&(a.value="",Ext.get(a).removeClass("placeholder_text"))}),c.on("reset",function(){setTimeout(FORMALIZE.misc.add_placeholder,50)})}))}},misc:{add_placeholder:function(){!d&&!!Ext.query("[placeholder]")&&Ext.each(Ext.query("[placeholder]"),function(a){var b=a.getAttribute("placeholder");if(!a.value||a.value===b)a.value=b,Ext.get(a).addClass("placeholder_text")})}}}}(this,this.document);Ext.onReady(function(){FORMALIZE.go()})
@@ -1,150 +0,0 @@
1
- /*
2
- Formalize - version 1.1
3
-
4
- Note: This file depends on the jQuery library.
5
- */
6
-
7
- // Module pattern:
8
- // http://yuiblog.com/blog/2007/06/12/module-pattern
9
- var FORMALIZE = (function($, window, document, undefined) {
10
- // Private constants.
11
- var PLACEHOLDER_SUPPORTED = 'placeholder' in document.createElement('input');
12
- var AUTOFOCUS_SUPPORTED = 'autofocus' in document.createElement('input');
13
- var IE6 = !!($.browser.msie && parseInt($.browser.version, 10) === 6);
14
- var IE7 = !!($.browser.msie && parseInt($.browser.version, 10) === 7);
15
-
16
- // Expose innards of FORMALIZE.
17
- return {
18
- // FORMALIZE.go
19
- go: function() {
20
- for (var i in FORMALIZE.init) {
21
- FORMALIZE.init[i]();
22
- }
23
- },
24
- // FORMALIZE.init
25
- init: {
26
- // FORMALIZE.init.full_input_size
27
- full_input_size: function() {
28
- if (!IE7 || !$('textarea, input.input_full').length) {
29
- return;
30
- }
31
-
32
- // This fixes width: 100% on <textarea> and class="input_full".
33
- // It ensures that form elements don't go wider than container.
34
- $('textarea, input.input_full').wrap('<span class="input_full_wrap"></span>');
35
- },
36
- // FORMALIZE.init.ie6_skin_inputs
37
- ie6_skin_inputs: function() {
38
- // Test for Internet Explorer 6.
39
- if (!IE6 || !$('input, select, textarea').length) {
40
- // Exit if the browser is not IE6,
41
- // or if no form elements exist.
42
- return;
43
- }
44
-
45
- // For <input type="submit" />, etc.
46
- var button_regex = /button|submit|reset/;
47
-
48
- // For <input type="text" />, etc.
49
- var type_regex = /date|datetime|datetime-local|email|month|number|password|range|search|tel|text|time|url|week/;
50
-
51
- $('input').each(function() {
52
- var el = $(this);
53
-
54
- // Is it a button?
55
- if (this.getAttribute('type').match(button_regex)) {
56
- el.addClass('ie6_button');
57
-
58
- /* Is it disabled? */
59
- if (this.disabled) {
60
- el.addClass('ie6_button_disabled');
61
- }
62
- }
63
- // Or is it a textual input?
64
- else if (this.getAttribute('type').match(type_regex)) {
65
- el.addClass('ie6_input');
66
-
67
- /* Is it disabled? */
68
- if (this.disabled) {
69
- el.addClass('ie6_input_disabled');
70
- }
71
- }
72
- });
73
-
74
- $('textarea, select').each(function() {
75
- /* Is it disabled? */
76
- if (this.disabled) {
77
- $(this).addClass('ie6_input_disabled');
78
- }
79
- });
80
- },
81
- // FORMALIZE.init.autofocus
82
- autofocus: function() {
83
- if (AUTOFOCUS_SUPPORTED || !$(':input[autofocus]').length) {
84
- return;
85
- }
86
-
87
- $(':input[autofocus]:visible:first').focus();
88
- },
89
- // FORMALIZE.init.placeholder
90
- placeholder: function() {
91
- if (PLACEHOLDER_SUPPORTED || !$(':input[placeholder]').length) {
92
- // Exit if placeholder is supported natively,
93
- // or if page does not have any placeholder.
94
- return;
95
- }
96
-
97
- FORMALIZE.misc.add_placeholder();
98
-
99
- $(':input[placeholder]').each(function() {
100
- var el = $(this);
101
- var text = el.attr('placeholder');
102
-
103
- el.focus(function() {
104
- if (el.val() === text) {
105
- el.val('').removeClass('placeholder_text');
106
- }
107
- }).blur(function() {
108
- FORMALIZE.misc.add_placeholder();
109
- });
110
-
111
- // Prevent <form> from accidentally
112
- // submitting the placeholder text.
113
- el.closest('form').submit(function() {
114
- if (el.val() === text) {
115
- el.val('').removeClass('placeholder_text');
116
- }
117
- }).bind('reset', function() {
118
- setTimeout(FORMALIZE.misc.add_placeholder, 50);
119
- });
120
- });
121
- }
122
- },
123
- // FORMALIZE.misc
124
- misc: {
125
- // FORMALIZE.misc.add_placeholder
126
- add_placeholder: function() {
127
- if (PLACEHOLDER_SUPPORTED || !$(':input[placeholder]').length) {
128
- // Exit if placeholder is supported natively,
129
- // or if page does not have any placeholder.
130
- return;
131
- }
132
-
133
- $(':input[placeholder]').each(function() {
134
- var el = $(this);
135
- var text = el.attr('placeholder');
136
-
137
- if (!el.val() || el.val() === text) {
138
- el.val(text).addClass('placeholder_text');
139
- }
140
- });
141
- }
142
- }
143
- };
144
- // Alias jQuery, window, document.
145
- })(jQuery, this, this.document);
146
-
147
- // Automatically calls all functions in FORMALIZE.init
148
- jQuery(document).ready(function() {
149
- FORMALIZE.go();
150
- });