ruby-extjs 1.0.1 → 2.0.1

Sign up to get free protection for your applications and to get access to all the features.
metadata CHANGED
@@ -1,46 +1,24 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-extjs
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 2.0.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
8
- - Maciel Sousa
8
+ - macielcr7
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-10 00:00:00.000000000 Z
12
+ date: 2012-12-11 00:00:00.000000000 Z
13
13
  dependencies: []
14
- description: Simples Gerador Arquivos MVC ExtJs4 para Ruby on Rails
15
- email: macielcr7@gmail.com
14
+ description: Write a gem description
15
+ email:
16
+ - macielcr7@gmail.com
16
17
  executables: []
17
18
  extensions: []
18
19
  extra_rdoc_files: []
19
- files:
20
- - lib/generators/sencha/sencha_generator.rb
21
- - lib/generators/sencha/templates/extjs/app.tpl
22
- - lib/generators/sencha/templates/extjs/controller/controller.tpl
23
- - lib/generators/sencha/templates/extjs/model/model.tpl
24
- - lib/generators/sencha/templates/extjs/store/store.tpl
25
- - lib/generators/sencha/templates/extjs/util/Controller.js
26
- - lib/generators/sencha/templates/extjs/util/Defined.js
27
- - lib/generators/sencha/templates/extjs/util/function.js
28
- - lib/generators/sencha/templates/extjs/util/List.js
29
- - lib/generators/sencha/templates/extjs/util/Notification.js
30
- - lib/generators/sencha/templates/extjs/util/Override.js
31
- - lib/generators/sencha/templates/extjs/util/Shortcut.js
32
- - lib/generators/sencha/templates/extjs/util/Store.js
33
- - lib/generators/sencha/templates/extjs/util/TabCloseMenu.js
34
- - lib/generators/sencha/templates/extjs/util/TextMask.js
35
- - lib/generators/sencha/templates/extjs/util/Util.js
36
- - lib/generators/sencha/templates/extjs/view/edit.tpl
37
- - lib/generators/sencha/templates/extjs/view/filtro.tpl
38
- - lib/generators/sencha/templates/extjs/view/list.tpl
39
- - lib/generators/sencha/USAGE
40
- - lib/ruby-extjs/version.rb
41
- - Gemfile
42
- - ruby-extjs.gemspec
43
- homepage:
20
+ files: []
21
+ homepage: ''
44
22
  licenses: []
45
23
  post_install_message:
46
24
  rdoc_options: []
@@ -63,5 +41,5 @@ rubyforge_project:
63
41
  rubygems_version: 1.8.24
64
42
  signing_key:
65
43
  specification_version: 3
66
- summary: Gerar Arquivos MVC ExtJs para Ruby
44
+ summary: Write a gem summary
67
45
  test_files: []
data/Gemfile DELETED
@@ -1,3 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- gem 'rails', '3.2.9'
@@ -1,65 +0,0 @@
1
- /**
2
- *
3
- * Modo de Usar
4
- *
5
- * Model
6
- * rails g ext_rails MacielSousa extjs model Contatos id:int
7
- * nome:string email:string telefone:string
8
- *
9
- * Controller
10
- * rails g ext_rails MacielSousa extjs controller Contatos ch:id
11
- * dr:nome cb:true
12
- *
13
- * Store
14
- * rails g ext_rails MacielSousa extjs store Contatos
15
- *
16
- * View
17
- * rails g ext_rails MacielSousa extjs view Contatos id:ch nome:no
18
- * email:ve telefone:m_fone
19
- *
20
- * App
21
- * rails g ext_rails MacielSousa extjs app
22
- *
23
- * Parametros
24
- * 1 - nameApp
25
- * 2 - senchaTipo
26
- * * extjs
27
- * * touch
28
- * 3 - generateTipo
29
- * * app
30
- * * controller
31
- * * model
32
- * * store
33
- * * view
34
- * 4 - modulo ~> Nome da tabela Ex.: Contato
35
- * 5 - options
36
- *
37
- * * generateTipo => App
38
- *
39
- * * generateTipo => Controller
40
- * ch:id dr:nome cb: true
41
- * Obs.:
42
- * ch -> Chave Primaria
43
- * dr -> Ex.: Deseja deletar: record.get('nome')?
44
- * cb -> se o modulo tera um storeCombo
45
- *
46
- * * generateTipo => Model
47
- * id:int nome:string email:string telefone:string
48
- *
49
- * * generateTipo => Store
50
- *
51
- * * generateTipo => View
52
- * id:ch nome:no email:ve telefone:m_fone
53
- *
54
- * Obs.:
55
- * key => nome do campo
56
- * values =>
57
- * no -> sem condincoes
58
- * ch -> chave primaria
59
- * ve -> valid Email
60
- * tp -> campo de senha
61
- * r_{modulo} -> combobox {modulo} => tabela referencia
62
- * m_{tipo} -> mascara {tipo} => fone,cep,cpf,cnpj,money
63
- *
64
- **/
65
-
@@ -1,201 +0,0 @@
1
- class SenchaGenerator < Rails::Generators::Base
2
- source_root File.expand_path('../templates', __FILE__)
3
-
4
- argument :nameApp , :type => :string, :default => "MacielSousa"
5
- argument :senchaTipo , :type => :string, :default => "extjs"
6
- argument :generateTipo , :type => :string, :required => false
7
- argument :modulo , :type => :string, :required => false
8
- argument :opcoes , :type => :hash , :required => false
9
-
10
-
11
- def generate_sencha
12
- @init ||= 0
13
- self.verifyArguments
14
- end
15
-
16
- def verifyArguments
17
- if @init == 0
18
- @init = 1
19
- if senchaTipo == 'extjs' #or senchaTipo == 'touch'
20
- if generateTipo === 'controller'
21
- if self.testController == true
22
- self.generate
23
- puts 'generate - Controller'
24
- end
25
-
26
- elsif generateTipo === 'model'
27
- if self.testModel == true
28
- self.generate
29
- puts 'generate - Model'
30
- end
31
-
32
- elsif generateTipo === 'store'
33
- if modulo != nil and generateTipo == 'store'
34
- self.generate
35
- puts 'generate - Store'
36
- else
37
- puts '[ERROR] Modulo Incorreto...'
38
- end
39
-
40
- elsif generateTipo === 'view'
41
- if self.testView == true
42
- self.generate
43
- puts 'generate - View'
44
- end
45
-
46
- elsif generateTipo === 'app'
47
- if modulo != nil and generateTipo == 'app'
48
- puts 'generate - App'
49
- end
50
- end
51
-
52
- else
53
- puts '[ERROR] SenchaTipo Incorreto...'
54
- end
55
- end
56
- end
57
-
58
- def testController
59
- if generateTipo != 'controller'
60
- return false
61
- end
62
- if opcoes != nil
63
- @Chave = false
64
- @DelRec = false
65
- @Combo = false
66
- opcoes.each do |o,v|
67
- if o=='ch'
68
- @Chave = true
69
- elsif o=='cb'
70
- @Combo = true
71
- elsif o=='dr'
72
- @DelRec = true
73
- end
74
- end
75
-
76
- if @Chave==false
77
- puts '[ERROR-Controller] chave Nao informada....'
78
- elsif @Combo==false
79
- puts '[ERROR-Controller] combobox Nao informada....'
80
- elsif @Combo==false
81
- puts '[ERROR-Controller] deleteRecord Nao informada....'
82
- else
83
- return true
84
- end
85
-
86
- else
87
- puts '[ERROR] Options Incorreto...'
88
- end
89
-
90
- return false
91
- end
92
-
93
- def testModel
94
- if generateTipo != 'model'
95
- return false
96
- end
97
- if opcoes != nil
98
- return true
99
- else
100
- puts '[ERROR-Model] Opcoes Incorreto...'
101
- end
102
-
103
- return false
104
- end
105
-
106
- def testView
107
- if generateTipo != 'view'
108
- return false
109
- end
110
- if opcoes != nil
111
- return true
112
- else
113
- puts '[ERROR-View] Opcoes Incorreto...'
114
- end
115
-
116
- return false
117
- end
118
-
119
- def typeList(tipo="", edit=false)
120
-
121
- @d = [true]
122
- @c = tipo.split('_')
123
- if @c.size == 2
124
- if @c[0] =='m'
125
- @d << 'mask'
126
- if @c[1] == 'cpf'
127
- @d << "Ext.util.Format.maskRenderer('999.999.999-99')"
128
- elsif @c[1]=='cep'
129
- @d << "Ext.util.Format.maskRenderer('99.999-999')"
130
- elsif @c[1]=='fone'
131
- @d << "Ext.util.Format.maskRenderer('(99) 9999-9999')"
132
- elsif @c[1]=='cnpj'
133
- @d << "Ext.util.Format.maskRenderer('99.999.999/9999-99')"
134
- elsif @c[1]=='money'
135
- @d << "Ext.util.Format.maskRenderer('R$ #9.999.990,00', true)"
136
- else
137
- @d = [false]
138
- end
139
- elsif @c[0] =='r'
140
- if edit == true
141
- @d << true
142
- @d << @c[1]
143
- else
144
- @d = [false]
145
- end
146
- else
147
- @d = [false]
148
- end
149
- else
150
- @d = [false]
151
- end
152
-
153
- return @d
154
- end
155
-
156
- def typeEdit(tipo="")
157
- @d = self.typeList(tipo, true)
158
-
159
- if @d[0] != true
160
- @d = [true]
161
- if tipo == 'ch'
162
- @d << 'chave'
163
- elsif tipo == 've'
164
- @d << 'valid_email'
165
- elsif tipo == 'tp'
166
- @d << 'type_pass'
167
- else
168
- @d = [false]
169
- end
170
- end
171
-
172
- return @d
173
- end
174
-
175
- def controllersApp
176
- @files = Dir.glob('public/app/controller/*.js')
177
- @arqs = []
178
-
179
- for file in @files
180
- @arqs << file.split('public/app/controller/')[1].split('.js')[0]
181
- end
182
-
183
- return @arqs
184
- end
185
-
186
- def generate
187
- if generateTipo == "view"
188
- template "#{senchaTipo}/#{generateTipo}/list.tpl" , "public/app/#{generateTipo}/#{modulo.downcase}/List.js"
189
- template "#{senchaTipo}/#{generateTipo}/edit.tpl" , "public/app/#{generateTipo}/#{modulo.downcase}/Edit.js"
190
- template "#{senchaTipo}/#{generateTipo}/filtro.tpl", "public/app/#{generateTipo}/#{modulo.downcase}/Filtro.js"
191
- elsif generateTipo == "app"
192
- template "#{senchaTipo}/app.tpl" , "public/app/app.js"
193
- if Dir.exists?("public/app/util") == false
194
- directory "#{senchaTipo}/util/", "public/app/util"
195
- end
196
- else
197
- template "#{senchaTipo}/#{generateTipo}/#{generateTipo}.tpl", "public/app/#{generateTipo}/#{modulo.capitalize}.js"
198
- end
199
- end
200
-
201
- end
@@ -1,39 +0,0 @@
1
- /**
2
- * @Autor: Maciel Sousa
3
- * @Email: macielcr7@gmail.com
4
- **/
5
- <%
6
- @ab = controllersApp
7
- @a = @ab.size
8
- @b = 1
9
- %>
10
- Ext.Loader.setConfig({
11
- enabled: true,
12
- paths: {
13
- '<%=nameApp.capitalize%>': 'app',
14
- 'Abstract': 'app'
15
- }
16
- });
17
-
18
- Ext.application({
19
- name: '<%=nameApp.capitalize%>',
20
- controllers: [<% @ab.each do |v| %>
21
- '<%=v%>'<% if @a != @b %>,<% @b = @b + 1 end %><% end %>
22
- ],
23
-
24
- autoCreateViewport: false,
25
-
26
- launch: function(){
27
- var me = this;
28
- Ext.widget('containerprincipal').show();
29
-
30
- Ext.get('loading').hide();
31
- Ext.get('loading-mask').setOpacity(0, true);
32
- setTimeout(function(){
33
- Ext.get('loading-mask').hide();
34
- },400);
35
-
36
- }
37
-
38
- });
39
-
@@ -1,31 +0,0 @@
1
- /**
2
- * @Autor: Maciel Sousa
3
- * @Email: macielcr7@gmail.com
4
- **/
5
-
6
- Ext.define('<%=nameApp%>.controller.<%=modulo.capitalize%>', {
7
- extend: 'Abstract.util.Controller',
8
-
9
- modulo : '<%=modulo%>',
10
- listmodulo : '<%=modulo%>list',
11
- addmodulo : 'add<%=modulo%>win',
12
- filtermodulo : 'filter<%=modulo%>win',
13
-
14
- deleteRecord : '<%=opcoes['dr']%>',
15
- chave : '<%=opcoes['ch']%>',
16
-
17
- models: [
18
- '<%=modulo.capitalize%>'
19
- ],
20
-
21
- stores: [
22
- '<%=modulo.capitalize%>'
23
- ],
24
-
25
- views: [
26
- '<%=modulo%>.List',
27
- '<%=modulo%>.Filtro',
28
- '<%=modulo%>.Edit'
29
- ]
30
-
31
- });
@@ -1,20 +0,0 @@
1
- /**
2
- * @Autor: Maciel Sousa
3
- * @Email: macielcr7@gmail.com
4
- **/
5
- <%
6
- @a = opcoes.size
7
- @b = 1
8
- %>
9
- Ext.define('<%=nameApp%>.model.<%=modulo.capitalize%>', {
10
- extend: 'Ext.data.Model',
11
- alias: 'model.<%=modulo.downcase %>',
12
-
13
- fields: [<% opcoes.each do |key, value| %>
14
- {
15
- name: "<%= key %>",
16
- type: "<%= value %>"
17
- }<% if @a != @b %>,<% @b = @b + 1 end %><% end %>
18
- ]
19
- });
20
-
@@ -1,12 +0,0 @@
1
- /**
2
- * @Autor: Maciel Sousa
3
- * @Email: macielcr7@gmail.com
4
- **/
5
-
6
- Ext.define('<%=nameApp%>.store.<%=modulo.capitalize%>', {
7
- extend: 'Abstract.util.Store',
8
-
9
- modulo : '<%=modulo.capitalize%>',
10
- model : '<%=nameApp%>.model.<%=modulo.capitalize%>'
11
-
12
- });
@@ -1,165 +0,0 @@
1
- /**
2
- * @Autor: Maciel Sousa
3
- * @Email: macielcr7@gmail.com
4
- **/
5
-
6
- Ext.define('Abstract.util.Controller', {
7
- extend: 'Ext.app.Controller',
8
- mixins: {
9
- controls: 'Abstract.util.Util'
10
- },
11
-
12
- modulo : false,
13
-
14
- addmodulo : false,
15
- listmodulo : false,
16
- filtermodulo : false,
17
-
18
- button_add : true,
19
- button_edit : true,
20
- button_del : true,
21
- button_filter : true,
22
- button_pdf : true,
23
-
24
- deleteRecord : false,
25
-
26
- constructor: function (config) {
27
- var me = this;
28
- /* refs */
29
- var refs = [];
30
- if(me.addmodulo){
31
- refs = Ext.Array.merge(refs, [
32
- {
33
- ref: 'addWin',
34
- selector: me.addmodulo
35
- },
36
- {
37
- ref: 'form',
38
- selector: me.addmodulo +' form'
39
- }
40
-
41
- ]);
42
- }
43
-
44
- if(me.listmodulo){
45
- refs = Ext.Array.merge(refs, [
46
- {
47
- ref: 'list',
48
- selector: me.listmodulo
49
- },
50
- {
51
- ref: 'filterBtn',
52
- selector: me.listmodulo + ' button[action=filtrar]'
53
- }
54
-
55
- ]);
56
- }
57
-
58
- if(me.filtermodulo){
59
- refs = Ext.Array.merge(refs, [
60
- {
61
- ref: 'filterWin',
62
- selector: me.filtermodulo
63
- },
64
- {
65
- ref: 'filterForm',
66
- selector: me.filtermodulo +' form'
67
- }
68
-
69
- ]);
70
- }
71
-
72
- me.refs = me.refs ? Ext.Array.merge(me.refs, refs) : refs;
73
-
74
- /* control */
75
- var control = {};
76
- if(me.listmodulo){
77
- control[me.listmodulo] = {
78
- afterrender: this.getPermissoes,
79
- render: this.gridLoad
80
- };
81
-
82
- if(me.button_filter){
83
- control[me.listmodulo + ' button[action=filtrar]'] = {
84
- click: this.btfilter
85
- };
86
- }
87
-
88
- if(me.button_add){
89
- control[me.listmodulo + ' button[action=adicionar]'] = {
90
- click: this.add
91
- };
92
- }
93
-
94
- if(me.button_edit){
95
- control[me.listmodulo + ' button[action=editar]'] = {
96
- click: this.btedit
97
- };
98
- }
99
-
100
- if(me.button_del){
101
- control[me.listmodulo + ' button[action=deletar]'] = {
102
- click: this.btdel
103
- };
104
- }
105
-
106
- if(me.button_pdf){
107
- control[me.listmodulo + ' button[action=gerar_pdf]'] = {
108
- click: this.gerarPdf
109
- };
110
- }
111
-
112
- }
113
-
114
- if(me.addmodulo){
115
- control[me.addmodulo +' button[action=salvar]'] = {
116
- click: this.update
117
- };
118
-
119
- control[me.addmodulo +' button[action=resetar]'] = {
120
- click: this.reset
121
- };
122
-
123
- control[me.addmodulo +' form fieldcontainer combobox'] = {
124
- change: this.enableButton,
125
- render: this.comboLoad
126
- };
127
-
128
- control[me.addmodulo +' form fieldcontainer button[action=reset_combo]'] = {
129
- click: this.resetCombo
130
- };
131
-
132
- control[me.addmodulo +' form fieldcontainer button[action=add_win]'] = {
133
- click: this.getAddWindow
134
- };
135
- }
136
-
137
- if(me.filtermodulo){
138
- control[me.filtermodulo +' form fieldcontainer combobox'] = {
139
- change: this.enableButton,
140
- render: this.comboLoad
141
- };
142
-
143
- control[me.filtermodulo +' button[action=resetar_filtro]'] = {
144
- click: this.resetFielter
145
- };
146
-
147
- control[me.filtermodulo +' button[action=filtrar_busca]'] = {
148
- click: this.setFielter
149
- };
150
-
151
- control[me.filtermodulo] = {
152
- show: this.filterSetFields
153
- };
154
- }
155
- me.controls = me.controls ? Ext.Object.merge(me.controls, control) : control;
156
-
157
- me.callParent(arguments);
158
- },
159
-
160
- init: function(app){
161
- this.control(this.controls);
162
- }
163
-
164
- });
165
-
@@ -1,79 +0,0 @@
1
-
2
- /**
3
- * Modifica��es no Button - Referente a field labelAlign-Top
4
- * */
5
-
6
- Ext.define('Ext.ButtonAdd', {
7
- extend: 'Ext.button.Button',
8
- alias: 'widget.buttonadd',
9
-
10
- height: 22,
11
- iconCls: 'bt_add',
12
- margins: '14 0 0 5',
13
-
14
- initComponent: function() {
15
- var me = this;
16
-
17
- me.callParent(arguments);
18
- }
19
-
20
- });
21
-
22
- /**
23
- * Modifica��es no Window - Medium
24
- * */
25
-
26
- Ext.define('Ext.WindowMedium', {
27
- extend: 'Ext.window.Window',
28
- alias: 'widget.windowmedium',
29
-
30
- width: 520,
31
-
32
- initComponent: function() {
33
- var me = this;
34
-
35
- me.callParent(arguments);
36
- }
37
-
38
- });
39
-
40
-
41
- /**
42
- * Modifica��es no Window - Big
43
- * */
44
-
45
- Ext.define('Ext.WindowBig', {
46
- extend: 'Ext.window.Window',
47
- alias: 'widget.windowbig',
48
-
49
- width: 780,
50
-
51
- initComponent: function() {
52
- var me = this;
53
-
54
- me.callParent(arguments);
55
- }
56
-
57
- });
58
-
59
-
60
- Ext.define('Ext.ContainerWin', {
61
- extend: 'Ext.window.Window',
62
- alias: 'widget.containerwin',
63
-
64
- height: 400,
65
- stateful: true,
66
- resizable: true,
67
- maximizable: true,
68
- width: 750,
69
- layout: {
70
- type: 'fit'
71
- },
72
-
73
- initComponent: function() {
74
- var me = this;
75
-
76
- me.callParent(arguments);
77
- }
78
-
79
- });