pbw 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/generators/pbw/rules/capability/USAGE +10 -0
- data/lib/generators/pbw/rules/capability/capability_generator.rb +11 -0
- data/lib/generators/pbw/rules/capability/templates/index.erb +6 -0
- data/lib/generators/pbw/rules/capability/templates/model.coffee +14 -0
- data/lib/generators/pbw/rules/capability/templates/router.coffee +31 -0
- data/lib/generators/pbw/rules/capability/templates/templates/edit.jst +21 -0
- data/lib/generators/pbw/rules/capability/templates/templates/index.jst +17 -0
- data/lib/generators/pbw/rules/capability/templates/templates/model.jst +8 -0
- data/lib/generators/pbw/rules/capability/templates/templates/new.jst +21 -0
- data/lib/generators/pbw/rules/capability/templates/templates/show.jst +14 -0
- data/lib/generators/pbw/rules/capability/templates/views/edit_view.coffee +24 -0
- data/lib/generators/pbw/rules/capability/templates/views/index_view.coffee +20 -0
- data/lib/generators/pbw/rules/capability/templates/views/model_view.coffee +19 -0
- data/lib/generators/pbw/rules/capability/templates/views/new_view.coffee +37 -0
- data/lib/generators/pbw/rules/capability/templates/views/show_view.coffee +8 -0
- data/lib/generators/pbw/rules/command/USAGE +4 -3
- data/lib/generators/pbw/rules/command/command_generator.rb +29 -1
- data/lib/generators/pbw/rules/command/templates/command.rb +18 -0
- data/lib/generators/pbw/rules/command/templates/index.erb +6 -0
- data/lib/generators/pbw/rules/command/templates/model.coffee +13 -0
- data/lib/generators/pbw/rules/command/templates/templates/edit.jst +17 -0
- data/lib/generators/pbw/rules/command/templates/templates/index.jst +16 -0
- data/lib/generators/pbw/rules/command/templates/templates/model.jst +7 -0
- data/lib/generators/pbw/rules/command/templates/templates/new.jst +17 -0
- data/lib/generators/pbw/rules/command/templates/templates/show.jst +9 -0
- data/lib/generators/pbw/rules/command/templates/views/edit_view.coffee +24 -0
- data/lib/generators/pbw/rules/command/templates/views/index_view.coffee +20 -0
- data/lib/generators/pbw/rules/command/templates/views/model_view.coffee +19 -0
- data/lib/generators/pbw/rules/command/templates/views/new_view.coffee +37 -0
- data/lib/generators/pbw/rules/command/templates/views/show_view.coffee +8 -0
- data/lib/generators/pbw/rules/constraint/USAGE +5 -3
- data/lib/generators/pbw/rules/constraint/constraint_generator.rb +10 -2
- data/lib/generators/pbw/rules/constraint/templates/index.erb +6 -0
- data/lib/generators/pbw/rules/constraint/templates/model.coffee +14 -0
- data/lib/generators/pbw/rules/constraint/templates/router.coffee +31 -0
- data/lib/generators/pbw/rules/constraint/templates/templates/edit.jst +21 -0
- data/lib/generators/pbw/rules/constraint/templates/templates/index.jst +17 -0
- data/lib/generators/pbw/rules/constraint/templates/templates/model.jst +8 -0
- data/lib/generators/pbw/rules/constraint/templates/templates/new.jst +21 -0
- data/lib/generators/pbw/rules/constraint/templates/templates/show.jst +14 -0
- data/lib/generators/pbw/rules/constraint/templates/views/edit_view.coffee +24 -0
- data/lib/generators/pbw/rules/constraint/templates/views/index_view.coffee +20 -0
- data/lib/generators/pbw/rules/constraint/templates/views/model_view.coffee +19 -0
- data/lib/generators/pbw/rules/constraint/templates/views/new_view.coffee +37 -0
- data/lib/generators/pbw/rules/constraint/templates/views/show_view.coffee +8 -0
- data/lib/generators/pbw/rules/process/USAGE +5 -3
- data/lib/generators/pbw/rules/process/process_generator.rb +10 -2
- data/lib/generators/pbw/rules/process/templates/index.erb +6 -0
- data/lib/generators/pbw/rules/process/templates/model.coffee +14 -0
- data/lib/generators/pbw/rules/process/templates/router.coffee +31 -0
- data/lib/generators/pbw/rules/process/templates/templates/edit.jst +21 -0
- data/lib/generators/pbw/rules/process/templates/templates/index.jst +17 -0
- data/lib/generators/pbw/rules/process/templates/templates/model.jst +8 -0
- data/lib/generators/pbw/rules/process/templates/templates/new.jst +21 -0
- data/lib/generators/pbw/rules/process/templates/templates/show.jst +14 -0
- data/lib/generators/pbw/rules/process/templates/views/edit_view.coffee +24 -0
- data/lib/generators/pbw/rules/process/templates/views/index_view.coffee +20 -0
- data/lib/generators/pbw/rules/process/templates/views/model_view.coffee +19 -0
- data/lib/generators/pbw/rules/process/templates/views/new_view.coffee +37 -0
- data/lib/generators/pbw/rules/process/templates/views/show_view.coffee +8 -0
- data/lib/generators/pbw/rules/rules.rb +4 -0
- data/lib/generators/pbw/rules/trigger/USAGE +5 -3
- data/lib/generators/pbw/rules/trigger/templates/index.erb +6 -0
- data/lib/generators/pbw/rules/trigger/templates/model.coffee +14 -0
- data/lib/generators/pbw/rules/trigger/templates/router.coffee +31 -0
- data/lib/generators/pbw/rules/trigger/templates/templates/edit.jst +21 -0
- data/lib/generators/pbw/rules/trigger/templates/templates/index.jst +17 -0
- data/lib/generators/pbw/rules/trigger/templates/templates/model.jst +8 -0
- data/lib/generators/pbw/rules/trigger/templates/templates/new.jst +21 -0
- data/lib/generators/pbw/rules/trigger/templates/templates/show.jst +14 -0
- data/lib/generators/pbw/rules/trigger/templates/views/edit_view.coffee +24 -0
- data/lib/generators/pbw/rules/trigger/templates/views/index_view.coffee +20 -0
- data/lib/generators/pbw/rules/trigger/templates/views/model_view.coffee +19 -0
- data/lib/generators/pbw/rules/trigger/templates/views/new_view.coffee +37 -0
- data/lib/generators/pbw/rules/trigger/templates/views/show_view.coffee +8 -0
- data/lib/generators/pbw/rules/trigger/trigger_generator.rb +10 -2
- data/lib/pbw/version.rb +1 -1
- metadata +69 -3
- data/lib/generators/pbw/rules/ability/USAGE +0 -8
- data/lib/generators/pbw/rules/ability/ability_generator.rb +0 -3
@@ -0,0 +1,21 @@
|
|
1
|
+
<h1>New <%= singular_table_name %></h1>
|
2
|
+
|
3
|
+
<form id="new-<%= singular_table_name %>" name="<%= singular_table_name %>">
|
4
|
+
<div class="field">
|
5
|
+
<label for="name">Name:</label>
|
6
|
+
<input type="text" name="name" id="name" value="<%%= name %>" >
|
7
|
+
</div>
|
8
|
+
<% attributes.each do |attribute| -%>
|
9
|
+
<div class="field">
|
10
|
+
<label for="<%= attribute.name %>"> <%= attribute.human_name %>:</label>
|
11
|
+
<input type="text" name="<%= attribute.name %>" id="<%= attribute.name %>" value="<%%= <%= attribute.name %> %>" >
|
12
|
+
</div>
|
13
|
+
|
14
|
+
<% end -%>
|
15
|
+
<div class="actions">
|
16
|
+
<input type="submit" value="Create <%= human_name %>" />
|
17
|
+
</div>
|
18
|
+
|
19
|
+
</form>
|
20
|
+
|
21
|
+
<a href="#/">Back</a>
|
@@ -0,0 +1,24 @@
|
|
1
|
+
<%= view_namespace %> ||= {}
|
2
|
+
|
3
|
+
class <%= view_namespace %>.EditView extends Backbone.View
|
4
|
+
template: JST["<%= jst 'edit' %>"]
|
5
|
+
|
6
|
+
events:
|
7
|
+
"submit #edit-<%= singular_name %>": "update"
|
8
|
+
|
9
|
+
update: (e) ->
|
10
|
+
e.preventDefault()
|
11
|
+
e.stopPropagation()
|
12
|
+
|
13
|
+
@model.save(null,
|
14
|
+
success: (<%= singular_name %>) =>
|
15
|
+
@model = <%= singular_name %>
|
16
|
+
window.location.hash = "/#{@model.id}"
|
17
|
+
)
|
18
|
+
|
19
|
+
render: ->
|
20
|
+
@$el.html(@template(@model.toJSON() ))
|
21
|
+
|
22
|
+
this.$("form").backboneLink(@model)
|
23
|
+
|
24
|
+
return this
|
@@ -0,0 +1,20 @@
|
|
1
|
+
<%= view_namespace %> ||= {}
|
2
|
+
|
3
|
+
class <%= view_namespace %>.IndexView extends Backbone.View
|
4
|
+
template: JST["<%= jst 'index' %>"]
|
5
|
+
|
6
|
+
initialize: () ->
|
7
|
+
@options.<%= plural_model_name %>.bind('reset', @addAll)
|
8
|
+
|
9
|
+
addAll: () =>
|
10
|
+
@options.<%= plural_model_name %>.each(@addOne)
|
11
|
+
|
12
|
+
addOne: (<%= singular_model_name %>) =>
|
13
|
+
view = new <%= view_namespace %>.<%= singular_name.camelize %>View({model : <%= singular_model_name %>})
|
14
|
+
@$("tbody").append(view.render().el)
|
15
|
+
|
16
|
+
render: =>
|
17
|
+
@$el.html(@template(<%= plural_model_name %>: @options.<%= plural_model_name %>.toJSON() ))
|
18
|
+
@addAll()
|
19
|
+
|
20
|
+
return this
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<%= view_namespace %> ||= {}
|
2
|
+
|
3
|
+
class <%= view_namespace %>.<%= singular_name.camelize %>View extends Backbone.View
|
4
|
+
template: JST["<%= jst singular_name %>"]
|
5
|
+
|
6
|
+
events:
|
7
|
+
"click .destroy" : "destroy"
|
8
|
+
|
9
|
+
tagName: "tr"
|
10
|
+
|
11
|
+
destroy: () ->
|
12
|
+
@model.destroy()
|
13
|
+
this.remove()
|
14
|
+
|
15
|
+
return false
|
16
|
+
|
17
|
+
render: ->
|
18
|
+
@$el.html(@template(@model.toJSON() ))
|
19
|
+
return this
|
@@ -0,0 +1,37 @@
|
|
1
|
+
<%= view_namespace %> ||= {}
|
2
|
+
|
3
|
+
class <%= view_namespace %>.NewView extends Backbone.View
|
4
|
+
template: JST["<%= jst 'new' %>"]
|
5
|
+
|
6
|
+
events:
|
7
|
+
"submit #new-<%= singular_name %>": "save"
|
8
|
+
|
9
|
+
constructor: (options) ->
|
10
|
+
super(options)
|
11
|
+
@model = new @collection.model()
|
12
|
+
|
13
|
+
@model.bind("change:errors", () =>
|
14
|
+
this.render()
|
15
|
+
)
|
16
|
+
|
17
|
+
save: (e) ->
|
18
|
+
e.preventDefault()
|
19
|
+
e.stopPropagation()
|
20
|
+
|
21
|
+
@model.unset("errors")
|
22
|
+
|
23
|
+
@collection.create(@model.toJSON(),
|
24
|
+
success: (<%= singular_name %>) =>
|
25
|
+
@model = <%= singular_name %>
|
26
|
+
window.location.hash = "/#{@model.id}"
|
27
|
+
|
28
|
+
error: (<%= singular_name %>, jqXHR) =>
|
29
|
+
@model.set({errors: $.parseJSON(jqXHR.responseText)})
|
30
|
+
)
|
31
|
+
|
32
|
+
render: ->
|
33
|
+
@$el.html(@template(@model.toJSON() ))
|
34
|
+
|
35
|
+
this.$("form").backboneLink(@model)
|
36
|
+
|
37
|
+
return this
|
@@ -1,3 +1,11 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
require 'generators/pbw/scaffold_generator'
|
2
|
+
require 'generators/pbw/rules/rules'
|
3
|
+
|
4
|
+
class Pbw::Rules::TriggerGenerator < Pbw::Generators::ScaffoldGenerator
|
5
|
+
source_root File.expand_path('../templates', __FILE__)
|
6
|
+
|
7
|
+
protected
|
8
|
+
def base_model_class
|
9
|
+
"Pbw::Trigger"
|
10
|
+
end
|
3
11
|
end
|
data/lib/pbw/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pbw
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Seyed P. Razavi
|
@@ -256,14 +256,80 @@ files:
|
|
256
256
|
- lib/generators/pbw/item/USAGE
|
257
257
|
- lib/generators/pbw/model_generator.rb
|
258
258
|
- lib/generators/pbw/resource_helpers.rb
|
259
|
-
- lib/generators/pbw/rules/
|
260
|
-
- lib/generators/pbw/rules/
|
259
|
+
- lib/generators/pbw/rules/capability/capability_generator.rb
|
260
|
+
- lib/generators/pbw/rules/capability/templates/index.erb
|
261
|
+
- lib/generators/pbw/rules/capability/templates/model.coffee
|
262
|
+
- lib/generators/pbw/rules/capability/templates/router.coffee
|
263
|
+
- lib/generators/pbw/rules/capability/templates/templates/edit.jst
|
264
|
+
- lib/generators/pbw/rules/capability/templates/templates/index.jst
|
265
|
+
- lib/generators/pbw/rules/capability/templates/templates/model.jst
|
266
|
+
- lib/generators/pbw/rules/capability/templates/templates/new.jst
|
267
|
+
- lib/generators/pbw/rules/capability/templates/templates/show.jst
|
268
|
+
- lib/generators/pbw/rules/capability/templates/views/edit_view.coffee
|
269
|
+
- lib/generators/pbw/rules/capability/templates/views/index_view.coffee
|
270
|
+
- lib/generators/pbw/rules/capability/templates/views/model_view.coffee
|
271
|
+
- lib/generators/pbw/rules/capability/templates/views/new_view.coffee
|
272
|
+
- lib/generators/pbw/rules/capability/templates/views/show_view.coffee
|
273
|
+
- lib/generators/pbw/rules/capability/USAGE
|
261
274
|
- lib/generators/pbw/rules/command/command_generator.rb
|
275
|
+
- lib/generators/pbw/rules/command/templates/command.rb
|
276
|
+
- lib/generators/pbw/rules/command/templates/index.erb
|
277
|
+
- lib/generators/pbw/rules/command/templates/model.coffee
|
278
|
+
- lib/generators/pbw/rules/command/templates/templates/edit.jst
|
279
|
+
- lib/generators/pbw/rules/command/templates/templates/index.jst
|
280
|
+
- lib/generators/pbw/rules/command/templates/templates/model.jst
|
281
|
+
- lib/generators/pbw/rules/command/templates/templates/new.jst
|
282
|
+
- lib/generators/pbw/rules/command/templates/templates/show.jst
|
283
|
+
- lib/generators/pbw/rules/command/templates/views/edit_view.coffee
|
284
|
+
- lib/generators/pbw/rules/command/templates/views/index_view.coffee
|
285
|
+
- lib/generators/pbw/rules/command/templates/views/model_view.coffee
|
286
|
+
- lib/generators/pbw/rules/command/templates/views/new_view.coffee
|
287
|
+
- lib/generators/pbw/rules/command/templates/views/show_view.coffee
|
262
288
|
- lib/generators/pbw/rules/command/USAGE
|
263
289
|
- lib/generators/pbw/rules/constraint/constraint_generator.rb
|
290
|
+
- lib/generators/pbw/rules/constraint/templates/index.erb
|
291
|
+
- lib/generators/pbw/rules/constraint/templates/model.coffee
|
292
|
+
- lib/generators/pbw/rules/constraint/templates/router.coffee
|
293
|
+
- lib/generators/pbw/rules/constraint/templates/templates/edit.jst
|
294
|
+
- lib/generators/pbw/rules/constraint/templates/templates/index.jst
|
295
|
+
- lib/generators/pbw/rules/constraint/templates/templates/model.jst
|
296
|
+
- lib/generators/pbw/rules/constraint/templates/templates/new.jst
|
297
|
+
- lib/generators/pbw/rules/constraint/templates/templates/show.jst
|
298
|
+
- lib/generators/pbw/rules/constraint/templates/views/edit_view.coffee
|
299
|
+
- lib/generators/pbw/rules/constraint/templates/views/index_view.coffee
|
300
|
+
- lib/generators/pbw/rules/constraint/templates/views/model_view.coffee
|
301
|
+
- lib/generators/pbw/rules/constraint/templates/views/new_view.coffee
|
302
|
+
- lib/generators/pbw/rules/constraint/templates/views/show_view.coffee
|
264
303
|
- lib/generators/pbw/rules/constraint/USAGE
|
265
304
|
- lib/generators/pbw/rules/process/process_generator.rb
|
305
|
+
- lib/generators/pbw/rules/process/templates/index.erb
|
306
|
+
- lib/generators/pbw/rules/process/templates/model.coffee
|
307
|
+
- lib/generators/pbw/rules/process/templates/router.coffee
|
308
|
+
- lib/generators/pbw/rules/process/templates/templates/edit.jst
|
309
|
+
- lib/generators/pbw/rules/process/templates/templates/index.jst
|
310
|
+
- lib/generators/pbw/rules/process/templates/templates/model.jst
|
311
|
+
- lib/generators/pbw/rules/process/templates/templates/new.jst
|
312
|
+
- lib/generators/pbw/rules/process/templates/templates/show.jst
|
313
|
+
- lib/generators/pbw/rules/process/templates/views/edit_view.coffee
|
314
|
+
- lib/generators/pbw/rules/process/templates/views/index_view.coffee
|
315
|
+
- lib/generators/pbw/rules/process/templates/views/model_view.coffee
|
316
|
+
- lib/generators/pbw/rules/process/templates/views/new_view.coffee
|
317
|
+
- lib/generators/pbw/rules/process/templates/views/show_view.coffee
|
266
318
|
- lib/generators/pbw/rules/process/USAGE
|
319
|
+
- lib/generators/pbw/rules/rules.rb
|
320
|
+
- lib/generators/pbw/rules/trigger/templates/index.erb
|
321
|
+
- lib/generators/pbw/rules/trigger/templates/model.coffee
|
322
|
+
- lib/generators/pbw/rules/trigger/templates/router.coffee
|
323
|
+
- lib/generators/pbw/rules/trigger/templates/templates/edit.jst
|
324
|
+
- lib/generators/pbw/rules/trigger/templates/templates/index.jst
|
325
|
+
- lib/generators/pbw/rules/trigger/templates/templates/model.jst
|
326
|
+
- lib/generators/pbw/rules/trigger/templates/templates/new.jst
|
327
|
+
- lib/generators/pbw/rules/trigger/templates/templates/show.jst
|
328
|
+
- lib/generators/pbw/rules/trigger/templates/views/edit_view.coffee
|
329
|
+
- lib/generators/pbw/rules/trigger/templates/views/index_view.coffee
|
330
|
+
- lib/generators/pbw/rules/trigger/templates/views/model_view.coffee
|
331
|
+
- lib/generators/pbw/rules/trigger/templates/views/new_view.coffee
|
332
|
+
- lib/generators/pbw/rules/trigger/templates/views/show_view.coffee
|
267
333
|
- lib/generators/pbw/rules/trigger/trigger_generator.rb
|
268
334
|
- lib/generators/pbw/rules/trigger/USAGE
|
269
335
|
- lib/generators/pbw/scaffold_generator.rb
|