zfben_rails_assets 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (143) hide show
  1. data/.gitignore +1 -4
  2. data/Gemfile +11 -1
  3. data/README.rdoc +0 -8
  4. data/Rakefile +13 -0
  5. data/app/controllers/assets_controller.rb +32 -0
  6. data/app/helpers/assets_helper.rb +64 -0
  7. data/app/models/asset_format.rb +103 -0
  8. data/app/models/asset_format/css.rb +19 -0
  9. data/app/models/asset_format/js.rb +13 -0
  10. data/config/routes.rb +10 -0
  11. data/lib/{zfben_rails_assets/tasks.rb → tasks/tasks.rake} +0 -0
  12. data/lib/zfben_rails_assets.rb +3 -9
  13. data/test/assets_test.rb +145 -0
  14. data/{example → test/dummy}/Rakefile +2 -2
  15. data/test/dummy/app/assets/blank.css +1 -0
  16. data/test/dummy/app/assets/blank.js +1 -0
  17. data/test/dummy/app/assets/coffee.coffee +1 -0
  18. data/test/dummy/app/assets/import.css +1 -0
  19. data/test/dummy/app/assets/import.js +1 -0
  20. data/test/dummy/app/assets/import_404.css +1 -0
  21. data/test/dummy/app/assets/import_404.js +1 -0
  22. data/test/dummy/app/assets/import_iteration.css +1 -0
  23. data/test/dummy/app/assets/import_iteration.js +1 -0
  24. data/test/dummy/app/assets/import_twice.css +2 -0
  25. data/test/dummy/app/assets/import_twice.js +2 -0
  26. data/test/dummy/app/assets/sass.sass +2 -0
  27. data/test/dummy/app/assets/scss.scss +3 -0
  28. data/{example → test/dummy}/app/controllers/application_controller.rb +0 -0
  29. data/{example → test/dummy}/app/helpers/application_helper.rb +0 -0
  30. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  31. data/{example → test/dummy}/config.ru +1 -1
  32. data/test/dummy/config/application.rb +20 -0
  33. data/test/dummy/config/boot.rb +10 -0
  34. data/{example → test/dummy}/config/database.yml +0 -3
  35. data/{example → test/dummy}/config/environment.rb +1 -1
  36. data/{example → test/dummy}/config/environments/development.rb +4 -5
  37. data/{example → test/dummy}/config/environments/production.rb +13 -16
  38. data/{example → test/dummy}/config/environments/test.rb +2 -16
  39. data/{example → test/dummy}/config/initializers/backtrace_silencers.rb +0 -0
  40. data/{example → test/dummy}/config/initializers/inflections.rb +0 -0
  41. data/{example → test/dummy}/config/initializers/mime_types.rb +0 -0
  42. data/{example → test/dummy}/config/initializers/secret_token.rb +1 -1
  43. data/{example → test/dummy}/config/initializers/session_store.rb +2 -2
  44. data/{example → test/dummy}/config/locales/en.yml +1 -1
  45. data/test/dummy/config/routes.rb +58 -0
  46. data/{example → test/dummy}/public/404.html +0 -0
  47. data/{example → test/dummy}/public/422.html +0 -0
  48. data/{example → test/dummy}/public/500.html +0 -0
  49. data/{example → test/dummy}/public/favicon.ico +0 -0
  50. data/test/dummy/public/javascripts/application.js +2 -0
  51. data/test/dummy/public/javascripts/controls.js +965 -0
  52. data/test/dummy/public/javascripts/dragdrop.js +974 -0
  53. data/test/dummy/public/javascripts/effects.js +1123 -0
  54. data/test/dummy/public/javascripts/prototype.js +6001 -0
  55. data/test/dummy/public/javascripts/rails.js +202 -0
  56. data/{example/app/mailers → test/dummy/public/stylesheets}/.gitkeep +0 -0
  57. data/{example → test/dummy}/script/rails +0 -0
  58. data/test/dummy/tmp/assets/blank.css +1 -0
  59. data/test/dummy/tmp/assets/blank.js +1 -0
  60. data/test/dummy/tmp/assets/coffee.js +2 -0
  61. data/test/dummy/tmp/assets/import.css +4 -0
  62. data/test/dummy/tmp/assets/import.js +4 -0
  63. data/{example/app/models/.gitkeep → test/dummy/tmp/assets/import_404.css} +0 -0
  64. data/{example/db/development.sqlite3 → test/dummy/tmp/assets/import_404.js} +0 -0
  65. data/test/dummy/tmp/assets/import_iteration.css +11 -0
  66. data/test/dummy/tmp/assets/import_iteration.js +11 -0
  67. data/{example/lib/tasks/.gitkeep → test/dummy/tmp/assets/import_iteration.min.css} +0 -0
  68. data/{example/test/fixtures/.gitkeep → test/dummy/tmp/assets/import_iteration.min.js} +0 -0
  69. data/test/dummy/tmp/assets/import_twice.css +8 -0
  70. data/test/dummy/tmp/assets/import_twice.js +8 -0
  71. data/test/dummy/tmp/assets/sass.css +3 -0
  72. data/test/dummy/tmp/assets/scss.css +3 -0
  73. data/test/dummy/tmp/assets/simple.sass +3 -0
  74. data/test/test_helper.rb +10 -0
  75. data/zfben_rails_assets.gemspec +14 -4
  76. metadata +136 -133
  77. data/example/.gitignore +0 -7
  78. data/example/.sass-cache/686d48c4bb3405df08bdcc662a0722bb96d63df5/test.sassc +0 -0
  79. data/example/.sass-cache/7a5615116aa96cc45242210dec5b677975f46879/reset.sassc +0 -0
  80. data/example/Gemfile +0 -8
  81. data/example/README +0 -261
  82. data/example/app/assets/images/rails.png +0 -0
  83. data/example/app/assets/javascripts/application.js +0 -9
  84. data/example/app/assets/javascripts/test.js +0 -1
  85. data/example/app/assets/stylesheets/application.css +0 -7
  86. data/example/app/assets/stylesheets/test.css +0 -1
  87. data/example/app/controllers/test_controller.rb +0 -7
  88. data/example/app/views/test/index.haml +0 -12
  89. data/example/config/application.rb +0 -49
  90. data/example/config/boot.rb +0 -6
  91. data/example/config/initializers/wrap_parameters.rb +0 -12
  92. data/example/config/routes.rb +0 -3
  93. data/example/db/seeds.rb +0 -7
  94. data/example/doc/README_FOR_APP +0 -2
  95. data/example/public/robots.txt +0 -5
  96. data/example/test/functional/.gitkeep +0 -0
  97. data/example/test/integration/.gitkeep +0 -0
  98. data/example/test/performance/browsing_test.rb +0 -12
  99. data/example/test/test_helper.rb +0 -13
  100. data/example/test/unit/.gitkeep +0 -0
  101. data/example/vendor/assets/javascripts/zff.js +0 -0
  102. data/example/vendor/assets/javascripts/zff/core.js +0 -1
  103. data/example/vendor/assets/javascripts/zff/core/core.js +0 -57
  104. data/example/vendor/assets/javascripts/zff/lib/jquery/core.js +0 -8936
  105. data/example/vendor/assets/javascripts/zff/lib/jquery/grid.js +0 -467
  106. data/example/vendor/assets/javascripts/zff/lib/jquery/ui.js +0 -11631
  107. data/example/vendor/assets/javascripts/zff/lib/underscore/core.js +0 -807
  108. data/example/vendor/assets/javascripts/zff/spec.js +0 -2
  109. data/example/vendor/assets/javascripts/zff/spec/core.js +0 -38
  110. data/example/vendor/assets/javascripts/zff/spec/qunit.js +0 -1448
  111. data/example/vendor/assets/stylesheets/zff/lib/qunit.css +0 -225
  112. data/example/vendor/assets/stylesheets/zff/reset.sass +0 -1
  113. data/example/vendor/assets/stylesheets/zff/spec.css +0 -1
  114. data/example/vendor/plugins/.gitkeep +0 -0
  115. data/lib/zfben_rails_assets/Gemfile +0 -13
  116. data/lib/zfben_rails_assets/assets/javascripts/zff/core.js +0 -1
  117. data/lib/zfben_rails_assets/assets/javascripts/zff/core/0_config.js +0 -5
  118. data/lib/zfben_rails_assets/assets/javascripts/zff/core/1_jquery.js +0 -5
  119. data/lib/zfben_rails_assets/assets/javascripts/zff/core/2_load.js +0 -53
  120. data/lib/zfben_rails_assets/assets/javascripts/zff/lib/jquery/colorbox.js +0 -872
  121. data/lib/zfben_rails_assets/assets/javascripts/zff/lib/jquery/contextmenu.js +0 -144
  122. data/lib/zfben_rails_assets/assets/javascripts/zff/lib/jquery/core.js +0 -8936
  123. data/lib/zfben_rails_assets/assets/javascripts/zff/lib/jquery/grid.js +0 -2
  124. data/lib/zfben_rails_assets/assets/javascripts/zff/lib/jquery/grid/addons.js +0 -704
  125. data/lib/zfben_rails_assets/assets/javascripts/zff/lib/jquery/grid/core.js +0 -10913
  126. data/lib/zfben_rails_assets/assets/javascripts/zff/lib/jquery/grid/i18n/cn.js +0 -132
  127. data/lib/zfben_rails_assets/assets/javascripts/zff/lib/jquery/grid/i18n/en.js +0 -128
  128. data/lib/zfben_rails_assets/assets/javascripts/zff/lib/jquery/grid/postext.js +0 -64
  129. data/lib/zfben_rails_assets/assets/javascripts/zff/lib/jquery/grid/setcolumns.js +0 -126
  130. data/lib/zfben_rails_assets/assets/javascripts/zff/lib/jquery/qunit.js +0 -1448
  131. data/lib/zfben_rails_assets/assets/javascripts/zff/lib/jquery/searchFilter.js +0 -716
  132. data/lib/zfben_rails_assets/assets/javascripts/zff/lib/jquery/tablednd.js +0 -383
  133. data/lib/zfben_rails_assets/assets/javascripts/zff/lib/jquery/ui.js +0 -11631
  134. data/lib/zfben_rails_assets/assets/javascripts/zff/lib/jquery/ui/multiselect.js +0 -314
  135. data/lib/zfben_rails_assets/assets/javascripts/zff/lib/underscore/core.js +0 -807
  136. data/lib/zfben_rails_assets/assets/javascripts/zff/spec.js +0 -3
  137. data/lib/zfben_rails_assets/assets/javascripts/zff/spec/core.js +0 -38
  138. data/lib/zfben_rails_assets/assets/stylesheets/zff/lib/jquery/grid/grid.css +0 -140
  139. data/lib/zfben_rails_assets/assets/stylesheets/zff/lib/jquery/qunit/qunit.css +0 -225
  140. data/lib/zfben_rails_assets/assets/stylesheets/zff/lib/jquery/ui/multiselect.css +0 -30
  141. data/lib/zfben_rails_assets/assets/stylesheets/zff/reset.sass +0 -1
  142. data/lib/zfben_rails_assets/assets/stylesheets/zff/spec.css +0 -1
  143. data/lib/zfben_rails_assets/version.rb +0 -3
@@ -1,132 +0,0 @@
1
- ;(function($){
2
- /**
3
- * jqGrid Chinese Translation for v3.6
4
- * waiting 2010.01.18
5
- * http://waiting.javaeye.com/
6
- * Dual licensed under the MIT and GPL licenses:
7
- * http://www.opensource.org/licenses/mit-license.php
8
- * http://www.gnu.org/licenses/gpl.html
9
- *
10
- * update 2010.05.04
11
- * add double u3000 SPACE for search:odata to fix SEARCH box display err when narrow width from only use of eq/ne/cn/in/lt/gt operator under IE6/7
12
- **/
13
- $.jgrid = {
14
- defaults : {
15
- recordtext: "{0} - {1}\u3000共 {2} 条", // 共字前是全角空格
16
- emptyrecords: "无数据显示",
17
- loadtext: "读取中...",
18
- pgtext : " {0} 共 {1} 页"
19
- },
20
- search : {
21
- caption: "搜索...",
22
- Find: "查找",
23
- Reset: "重置",
24
- odata : ['等于\u3000\u3000', '不等\u3000\u3000', '小于\u3000\u3000', '小于等于','大于\u3000\u3000','大于等于',
25
- '开始于','不开始于','属于\u3000\u3000','不属于','结束于','不结束于','包含\u3000\u3000','不包含'],
26
- groupOps: [ { op: "AND", text: "所有" }, { op: "OR", text: "任一" } ],
27
- matchText: " 匹配",
28
- rulesText: " 规则"
29
- },
30
- edit : {
31
- addCaption: "添加记录",
32
- editCaption: "编辑记录",
33
- bSubmit: "提交",
34
- bCancel: "取消",
35
- bClose: "关闭",
36
- saveData: "数据已改变,是否保存?",
37
- bYes : "是",
38
- bNo : "否",
39
- bExit : "取消",
40
- msg: {
41
- required:"此字段必需",
42
- number:"请输入有效数字",
43
- minValue:"输值必须大于等于 ",
44
- maxValue:"输值必须小于等于 ",
45
- email: "这不是有效的e-mail地址",
46
- integer: "请输入有效整数",
47
- date: "请输入有效时间",
48
- url: "无效网址。前缀必须为 ('http://' 或 'https://')",
49
- nodefined : " 未定义!",
50
- novalue : " 需要返回值!",
51
- customarray : "自定义函数需要返回数组!",
52
- customfcheck : "Custom function should be present in case of custom checking!"
53
-
54
- }
55
- },
56
- view : {
57
- caption: "查看记录",
58
- bClose: "关闭"
59
- },
60
- del : {
61
- caption: "删除",
62
- msg: "删除所选记录?",
63
- bSubmit: "删除",
64
- bCancel: "取消"
65
- },
66
- nav : {
67
- edittext: "",
68
- edittitle: "编辑所选记录",
69
- addtext:"",
70
- addtitle: "添加新记录",
71
- deltext: "",
72
- deltitle: "删除所选记录",
73
- searchtext: "",
74
- searchtitle: "查找",
75
- refreshtext: "",
76
- refreshtitle: "刷新表格",
77
- alertcap: "注意",
78
- alerttext: "请选择记录",
79
- viewtext: "",
80
- viewtitle: "查看所选记录"
81
- },
82
- col : {
83
- caption: "选择列",
84
- bSubmit: "确定",
85
- bCancel: "取消"
86
- },
87
- errors : {
88
- errcap : "错误",
89
- nourl : "没有设置url",
90
- norecords: "没有要处理的记录",
91
- model : "colNames 和 colModel 长度不等!"
92
- },
93
- formatter : {
94
- integer : {thousandsSeparator: " ", defaultValue: '0'},
95
- number : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, defaultValue: '0.00'},
96
- currency : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0.00'},
97
- date : {
98
- dayNames: [
99
- "Sun", "Mon", "Tue", "Wed", "Thr", "Fri", "Sat",
100
- "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"
101
- ],
102
- monthNames: [
103
- "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec",
104
- "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"
105
- ],
106
- AmPm : ["am","pm","AM","PM"],
107
- S: function (j) {return j < 11 || j > 13 ? ['st', 'nd', 'rd', 'th'][Math.min((j - 1) % 10, 3)] : 'th'},
108
- srcformat: 'Y-m-d',
109
- newformat: 'm-d-Y',
110
- masks : {
111
- ISO8601Long:"Y-m-d H:i:s",
112
- ISO8601Short:"Y-m-d",
113
- ShortDate: "Y/j/n",
114
- LongDate: "l, F d, Y",
115
- FullDateTime: "l, F d, Y g:i:s A",
116
- MonthDay: "F d",
117
- ShortTime: "g:i A",
118
- LongTime: "g:i:s A",
119
- SortableDateTime: "Y-m-d\\TH:i:s",
120
- UniversalSortableDateTime: "Y-m-d H:i:sO",
121
- YearMonth: "F, Y"
122
- },
123
- reformatAfterEdit : false
124
- },
125
- baseLinkUrl: '',
126
- showAction: '',
127
- target: '',
128
- checkbox : {disabled:true},
129
- idName : 'id'
130
- }
131
- };
132
- })(jQuery);
@@ -1,128 +0,0 @@
1
- ;(function($){
2
- /**
3
- * jqGrid English Translation
4
- * Tony Tomov tony@trirand.com
5
- * http://trirand.com/blog/
6
- * Dual licensed under the MIT and GPL licenses:
7
- * http://www.opensource.org/licenses/mit-license.php
8
- * http://www.gnu.org/licenses/gpl.html
9
- **/
10
- $.jgrid = {
11
- defaults : {
12
- recordtext: "View {0} - {1} of {2}",
13
- emptyrecords: "No records to view",
14
- loadtext: "Loading...",
15
- pgtext : "Page {0} of {1}"
16
- },
17
- search : {
18
- caption: "Search...",
19
- Find: "Find",
20
- Reset: "Reset",
21
- odata : ['equal', 'not equal', 'less', 'less or equal','greater','greater or equal', 'begins with','does not begin with','is in','is not in','ends with','does not end with','contains','does not contain'],
22
- groupOps: [ { op: "AND", text: "all" }, { op: "OR", text: "any" } ],
23
- matchText: " match",
24
- rulesText: " rules"
25
- },
26
- edit : {
27
- addCaption: "Add Record",
28
- editCaption: "Edit Record",
29
- bSubmit: "Submit",
30
- bCancel: "Cancel",
31
- bClose: "Close",
32
- saveData: "Data has been changed! Save changes?",
33
- bYes : "Yes",
34
- bNo : "No",
35
- bExit : "Cancel",
36
- msg: {
37
- required:"Field is required",
38
- number:"Please, enter valid number",
39
- minValue:"value must be greater than or equal to ",
40
- maxValue:"value must be less than or equal to",
41
- email: "is not a valid e-mail",
42
- integer: "Please, enter valid integer value",
43
- date: "Please, enter valid date value",
44
- url: "is not a valid URL. Prefix required ('http://' or 'https://')",
45
- nodefined : " is not defined!",
46
- novalue : " return value is required!",
47
- customarray : "Custom function should return array!",
48
- customfcheck : "Custom function should be present in case of custom checking!"
49
-
50
- }
51
- },
52
- view : {
53
- caption: "View Record",
54
- bClose: "Close"
55
- },
56
- del : {
57
- caption: "Delete",
58
- msg: "Delete selected record(s)?",
59
- bSubmit: "Delete",
60
- bCancel: "Cancel"
61
- },
62
- nav : {
63
- edittext: "",
64
- edittitle: "Edit selected row",
65
- addtext:"",
66
- addtitle: "Add new row",
67
- deltext: "",
68
- deltitle: "Delete selected row",
69
- searchtext: "",
70
- searchtitle: "Find records",
71
- refreshtext: "",
72
- refreshtitle: "Reload Grid",
73
- alertcap: "Warning",
74
- alerttext: "Please, select row",
75
- viewtext: "",
76
- viewtitle: "View selected row"
77
- },
78
- col : {
79
- caption: "Select columns",
80
- bSubmit: "Ok",
81
- bCancel: "Cancel"
82
- },
83
- errors : {
84
- errcap : "Error",
85
- nourl : "No url is set",
86
- norecords: "No records to process",
87
- model : "Length of colNames <> colModel!"
88
- },
89
- formatter : {
90
- integer : {thousandsSeparator: " ", defaultValue: '0'},
91
- number : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, defaultValue: '0.00'},
92
- currency : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0.00'},
93
- date : {
94
- dayNames: [
95
- "Sun", "Mon", "Tue", "Wed", "Thr", "Fri", "Sat",
96
- "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"
97
- ],
98
- monthNames: [
99
- "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec",
100
- "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"
101
- ],
102
- AmPm : ["am","pm","AM","PM"],
103
- S: function (j) {return j < 11 || j > 13 ? ['st', 'nd', 'rd', 'th'][Math.min((j - 1) % 10, 3)] : 'th'},
104
- srcformat: 'Y-m-d',
105
- newformat: 'd/m/Y',
106
- masks : {
107
- ISO8601Long:"Y-m-d H:i:s",
108
- ISO8601Short:"Y-m-d",
109
- ShortDate: "n/j/Y",
110
- LongDate: "l, F d, Y",
111
- FullDateTime: "l, F d, Y g:i:s A",
112
- MonthDay: "F d",
113
- ShortTime: "g:i A",
114
- LongTime: "g:i:s A",
115
- SortableDateTime: "Y-m-d\\TH:i:s",
116
- UniversalSortableDateTime: "Y-m-d H:i:sO",
117
- YearMonth: "F, Y"
118
- },
119
- reformatAfterEdit : false
120
- },
121
- baseLinkUrl: '',
122
- showAction: '',
123
- target: '',
124
- checkbox : {disabled:true},
125
- idName : 'id'
126
- }
127
- };
128
- })(jQuery);
@@ -1,64 +0,0 @@
1
- ;(function($){
2
- /**
3
- * jqGrid extension
4
- * Paul Tiseo ptiseo@wasteconsultants.com
5
- *
6
- * Dual licensed under the MIT and GPL licenses:
7
- * http://www.opensource.org/licenses/mit-license.php
8
- * http://www.gnu.org/licenses/gpl-2.0.html
9
- **/
10
- $.jgrid.extend({
11
- getPostData : function(){
12
- var $t = this[0];
13
- if(!$t.grid) { return; }
14
- return $t.p.postData;
15
- },
16
- setPostData : function( newdata ) {
17
- var $t = this[0];
18
- if(!$t.grid) { return; }
19
- // check if newdata is correct type
20
- if ( typeof(newdata) === 'object' ) {
21
- $t.p.postData = newdata;
22
- }
23
- else {
24
- alert("Error: cannot add a non-object postData value. postData unchanged.");
25
- }
26
- },
27
- appendPostData : function( newdata ) {
28
- var $t = this[0];
29
- if(!$t.grid) { return; }
30
- // check if newdata is correct type
31
- if ( typeof(newdata) === 'object' ) {
32
- $.extend($t.p.postData, newdata);
33
- }
34
- else {
35
- alert("Error: cannot append a non-object postData value. postData unchanged.");
36
- }
37
- },
38
- setPostDataItem : function( key, val ) {
39
- var $t = this[0];
40
- if(!$t.grid) { return; }
41
- $t.p.postData[key] = val;
42
- },
43
- getPostDataItem : function( key ) {
44
- var $t = this[0];
45
- if(!$t.grid) { return; }
46
- return $t.p.postData[key];
47
- },
48
- removePostDataItem : function( key ) {
49
- var $t = this[0];
50
- if(!$t.grid) { return; }
51
- delete $t.p.postData[key];
52
- },
53
- getUserData : function(){
54
- var $t = this[0];
55
- if(!$t.grid) { return; }
56
- return $t.p.userData;
57
- },
58
- getUserDataItem : function( key ) {
59
- var $t = this[0];
60
- if(!$t.grid) { return; }
61
- return $t.p.userData[key];
62
- }
63
- });
64
- })(jQuery);
@@ -1,126 +0,0 @@
1
- ;(function($){
2
- /**
3
- * jqGrid extension for manipulating columns properties
4
- * Piotr Roznicki roznicki@o2.pl
5
- * http://www.roznicki.prv.pl
6
- * Dual licensed under the MIT and GPL licenses:
7
- * http://www.opensource.org/licenses/mit-license.php
8
- * http://www.gnu.org/licenses/gpl-2.0.html
9
- **/
10
- $.jgrid.extend({
11
- setColumns : function(p) {
12
- p = $.extend({
13
- top : 0,
14
- left: 0,
15
- width: 200,
16
- height: 'auto',
17
- dataheight: 'auto',
18
- modal: false,
19
- drag: true,
20
- beforeShowForm: null,
21
- afterShowForm: null,
22
- afterSubmitForm: null,
23
- closeOnEscape : true,
24
- ShrinkToFit : false,
25
- jqModal : false,
26
- saveicon: [true,"left","ui-icon-disk"],
27
- closeicon: [true,"left","ui-icon-close"],
28
- onClose : null,
29
- colnameview : true,
30
- closeAfterSubmit : true,
31
- updateAfterCheck : false,
32
- recreateForm : false
33
- }, $.jgrid.col, p ||{});
34
- return this.each(function(){
35
- var $t = this;
36
- if (!$t.grid ) { return; }
37
- var onBeforeShow = typeof p.beforeShowForm === 'function' ? true: false;
38
- var onAfterShow = typeof p.afterShowForm === 'function' ? true: false;
39
- var onAfterSubmit = typeof p.afterSubmitForm === 'function' ? true: false;
40
- var gID = $t.p.id,
41
- dtbl = "ColTbl_"+gID,
42
- IDs = {themodal:'colmod'+gID,modalhead:'colhd'+gID,modalcontent:'colcnt'+gID, scrollelm: dtbl};
43
- if(p.recreateForm===true && $("#"+IDs.themodal).html() != null) {
44
- $("#"+IDs.themodal).remove();
45
- }
46
- if ( $("#"+IDs.themodal).html() != null ) {
47
- if(onBeforeShow) { p.beforeShowForm($("#"+dtbl)); }
48
- $.jgrid.viewModal("#"+IDs.themodal,{gbox:"#gbox_"+gID,jqm:p.jqModal, jqM:false, modal:p.modal});
49
- if(onAfterShow) { p.afterShowForm($("#"+dtbl)); }
50
- } else {
51
- var dh = isNaN(p.dataheight) ? p.dataheight : p.dataheight+"px";
52
- var formdata = "<div id='"+dtbl+"' class='formdata' style='width:100%;overflow:auto;position:relative;height:"+dh+";'>";
53
- formdata += "<table class='ColTable' cellspacing='1' cellpading='2' border='0'><tbody>";
54
- for(i=0;i<this.p.colNames.length;i++){
55
- if(!$t.p.colModel[i].hidedlg) { // added from T. Tomov
56
- formdata += "<tr><td style='white-space: pre;'><input type='checkbox' style='margin-right:5px;' id='col_" + this.p.colModel[i].name + "' class='cbox' value='T' " +
57
- ((this.p.colModel[i].hidden===false)?"checked":"") + "/>" + "<label for='col_" + this.p.colModel[i].name + "'>" + this.p.colNames[i] + ((p.colnameview) ? " (" + this.p.colModel[i].name + ")" : "" )+ "</label></td></tr>";
58
- }
59
- }
60
- formdata += "</tbody></table></div>"
61
- var bS = !p.updateAfterCheck ? "<a href='javascript:void(0)' id='dData' class='fm-button ui-state-default ui-corner-all'>"+p.bSubmit+"</a>" : "",
62
- bC ="<a href='javascript:void(0)' id='eData' class='fm-button ui-state-default ui-corner-all'>"+p.bCancel+"</a>";
63
- formdata += "<table border='0' class='EditTable' id='"+dtbl+"_2'><tbody><tr style='display:block;height:3px;'><td></td></tr><tr><td class='DataTD ui-widget-content'></td></tr><tr><td class='ColButton EditButton'>"+bS+"&#160;"+bC+"</td></tr></tbody></table>";
64
- p.gbox = "#gbox_"+gID;
65
- $.jgrid.createModal(IDs,formdata,p,"#gview_"+$t.p.id,$("#gview_"+$t.p.id)[0]);
66
- if(p.saveicon[0]==true) {
67
- $("#dData","#"+dtbl+"_2").addClass(p.saveicon[1] == "right" ? 'fm-button-icon-right' : 'fm-button-icon-left')
68
- .append("<span class='ui-icon "+p.saveicon[2]+"'></span>");
69
- }
70
- if(p.closeicon[0]==true) {
71
- $("#eData","#"+dtbl+"_2").addClass(p.closeicon[1] == "right" ? 'fm-button-icon-right' : 'fm-button-icon-left')
72
- .append("<span class='ui-icon "+p.closeicon[2]+"'></span>");
73
- }
74
- if(!p.updateAfterCheck) {
75
- $("#dData","#"+dtbl+"_2").click(function(e){
76
- for(i=0;i<$t.p.colModel.length;i++){
77
- if(!$t.p.colModel[i].hidedlg) { // added from T. Tomov
78
- var nm = $t.p.colModel[i].name.replace(/\./g, "\\.");
79
- if($("#col_" + nm,"#"+dtbl).attr("checked")) {
80
- $($t).jqGrid("showCol",$t.p.colModel[i].name);
81
- $("#col_" + nm,"#"+dtbl).attr("defaultChecked",true); // Added from T. Tomov IE BUG
82
- } else {
83
- $($t).jqGrid("hideCol",$t.p.colModel[i].name);
84
- $("#col_" + nm,"#"+dtbl).attr("defaultChecked",""); // Added from T. Tomov IE BUG
85
- }
86
- }
87
- }
88
- if(p.ShrinkToFit===true) {
89
- $($t).jqGrid("setGridWidth",$t.grid.width-0.001,true);
90
- }
91
- if(p.closeAfterSubmit) $.jgrid.hideModal("#"+IDs.themodal,{gb:"#gbox_"+gID,jqm:p.jqModal, onClose: p.onClose});
92
- if (onAfterSubmit) { p.afterSubmitForm($("#"+dtbl)); }
93
- return false;
94
- });
95
- } else {
96
- $(":input","#"+dtbl).click(function(e){
97
- var cn = this.id.substr(4);
98
- if(cn){
99
- if(this.checked) {
100
- $($t).jqGrid("showCol",cn);
101
- } else {
102
- $($t).jqGrid("hideCol",cn);
103
- }
104
- if(p.ShrinkToFit===true) {
105
- $($t).jqGrid("setGridWidth",$t.grid.width-0.001,true);
106
- }
107
- }
108
- return this;
109
- });
110
- }
111
- $("#eData", "#"+dtbl+"_2").click(function(e){
112
- $.jgrid.hideModal("#"+IDs.themodal,{gb:"#gbox_"+gID,jqm:p.jqModal, onClose: p.onClose});
113
- return false;
114
- });
115
- $("#dData, #eData","#"+dtbl+"_2").hover(
116
- function(){$(this).addClass('ui-state-hover');},
117
- function(){$(this).removeClass('ui-state-hover');}
118
- );
119
- if(onBeforeShow) { p.beforeShowForm($("#"+dtbl)); }
120
- $.jgrid.viewModal("#"+IDs.themodal,{gbox:"#gbox_"+gID,jqm:p.jqModal, jqM: true, modal:p.modal});
121
- if(onAfterShow) { p.afterShowForm($("#"+dtbl)); }
122
- }
123
- });
124
- }
125
- });
126
- })(jQuery);