mdd 3.0.15 → 3.0.16
Sign up to get free protection for your applications and to get access to all the features.
- data/app/helpers/mdwa_helper.rb +1 -1
- data/lib/generators/mdwa/entity/templates/entity.rb +7 -1
- data/lib/generators/mdwa/requirement/templates/requirement.rb +5 -5
- data/lib/generators/mdwa/sandbox/sandbox_generator.rb +19 -7
- data/lib/generators/mdwa/sandbox/templates/app/assets/javascripts/mdwa/system_manifest.js +2 -1
- data/lib/generators/mdwa/sandbox/templates/app/assets/stylesheets/mdwa/system_manifest.css +1 -0
- data/lib/generators/mdwa/sandbox/templates/app/models/user.rb +1 -1
- data/lib/generators/mdwa/sandbox/templates/config/locales/mdwa.en.yml +1 -0
- data/lib/generators/mdwa/templates/templates/scaffold/views/_form.html.erb +2 -2
- data/lib/generators/mdwa/templates/templates/scaffold/views/_list.html.erb +3 -3
- data/lib/mdwa/dsl/entity.rb +3 -1
- data/lib/mdwa/dsl/entity_association.rb +5 -1
- data/lib/mdwa/dsl/entity_attribute.rb +1 -1
- data/lib/mdwa/version.rb +1 -1
- metadata +4 -4
data/app/helpers/mdwa_helper.rb
CHANGED
@@ -11,7 +11,7 @@ module MdwaHelper
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def encode_results_to_autocomplete(results, field_name)
|
14
|
-
return results.collect{ |c| "{label: '#{c.send field_name}', value: '#{c.id}'}" }.join( ',' )
|
14
|
+
return results.collect{ |c| "{label: '#{c.send field_name}', value: '#{c.id}'}" }.join( ',' ).html_safe
|
15
15
|
end
|
16
16
|
|
17
17
|
def file_icon_path( file_name, size = 'medium' )
|
@@ -8,15 +8,20 @@ MDWA::DSL.entities.register "<%= name.singularize.camelize %>" do |e|
|
|
8
8
|
# "reset_password_sent_at", "remember_created_at", "sign_in_count", "current_sign_in_at", "last_sign_in_at",
|
9
9
|
# "current_sign_in_ip", "last_sign_in_ip", "created_at", "updated_at"
|
10
10
|
e.user = true
|
11
|
+
e.ajax = false # ajax works fine, but it can create errors in the "My Account" button.
|
12
|
+
e.resource = true
|
13
|
+
e.scaffold_name = 'a/<%= name.singularize.underscore %>' # mdwa sandbox specific code?
|
14
|
+
e.model_name = 'a/<%= name.singularize.underscore %>' # use specific model name? or different namespace?
|
11
15
|
<%- end -%>
|
12
16
|
|
13
17
|
<%- unless options.no_comments -%>
|
18
|
+
<%- if !options.user %>
|
14
19
|
# e.purpose = %q{To-do} # what does this entity do?
|
15
20
|
# e.resource = true # should it be stored like a resource?
|
16
21
|
# e.ajax = true # scaffold with ajax?
|
17
|
-
# e.user = false # is this entity a loggable user?
|
18
22
|
# e.scaffold_name = 'a/<%= name.singularize.underscore %>' # mdwa sandbox specific code?
|
19
23
|
# e.model_name = 'a/<%= name.singularize.underscore %>' # use specific model name? or different namespace?
|
24
|
+
<% end %>
|
20
25
|
|
21
26
|
##
|
22
27
|
## Define entity attributes
|
@@ -39,6 +44,7 @@ MDWA::DSL.entities.register "<%= name.singularize.camelize %>" do |e|
|
|
39
44
|
# a.composition = true
|
40
45
|
# a.description = 'This entity has a composite address.'
|
41
46
|
# a.skip_views = false
|
47
|
+
# a.style = :default
|
42
48
|
# end
|
43
49
|
|
44
50
|
##
|
@@ -3,19 +3,19 @@ require 'mdwa/dsl'
|
|
3
3
|
MDWA::DSL.requirements.register do |r|
|
4
4
|
|
5
5
|
r.summary = '<%= @summary %>'
|
6
|
-
|
7
|
-
|
8
|
-
# r.description = %q{Detailed description of the requirement.}
|
6
|
+
r.alias = '<%= @requirement.alias %>' # alias is the unique requirement name and it's created automatically, you can override it with this argument.
|
7
|
+
r.description = %q{Detailed description of the requirement.}
|
9
8
|
|
9
|
+
<%- unless options.no_comments %>
|
10
10
|
#
|
11
11
|
# Entities involved in this requirement.
|
12
12
|
# Use an array of entity names.
|
13
|
-
# r.entities = ['ProjectGroup', 'Project'
|
13
|
+
# r.entities = ['ProjectGroup', 'Project']
|
14
14
|
|
15
15
|
#
|
16
16
|
# Users involved in this requirement.
|
17
17
|
# Use an array of user names.
|
18
|
-
# r.users = ['Administrator'
|
18
|
+
# r.users = ['Administrator']
|
19
19
|
<% end %>
|
20
20
|
|
21
21
|
end
|
@@ -66,6 +66,7 @@ module Mdwa
|
|
66
66
|
if ask_question("Create javascripts?")
|
67
67
|
directory 'app/assets/javascripts/jquery', 'app/assets/javascripts/jquery'
|
68
68
|
directory 'app/assets/javascripts/mdwa/template', 'app/assets/javascripts/mdwa/template'
|
69
|
+
empty_directory 'app/assets/javascripts/app'
|
69
70
|
|
70
71
|
if ask_question("Create manifests?")
|
71
72
|
copy_file 'app/assets/javascripts/mdwa/login_manifest.js', 'app/assets/javascripts/mdwa/login_manifest.js'
|
@@ -80,6 +81,7 @@ module Mdwa
|
|
80
81
|
directory 'app/assets/stylesheets/jquery', 'app/assets/stylesheets/jquery'
|
81
82
|
directory 'app/assets/stylesheets/mdwa/template', 'app/assets/stylesheets/mdwa/template'
|
82
83
|
directory 'app/assets/stylesheets/mdwa/login', 'app/assets/stylesheets/mdwa/login'
|
84
|
+
empty_directory 'app/assets/stylesheets/app'
|
83
85
|
|
84
86
|
if ask_question("Create manifests?")
|
85
87
|
copy_file 'app/assets/stylesheets/mdwa/login_manifest.css', 'app/assets/stylesheets/mdwa/login_manifest.css'
|
@@ -124,6 +126,7 @@ module Mdwa
|
|
124
126
|
|
125
127
|
if ask_question("Generate views?")
|
126
128
|
copy_file 'app/views/template/_leftbar.html.erb', 'app/views/template/mdwa/_leftbar.html.erb'
|
129
|
+
empty_directory 'app/views/template/leftbar'
|
127
130
|
directory 'app/views/public', 'app/views/public'
|
128
131
|
directory 'app/views/a/administrators', 'app/views/a/administrators'
|
129
132
|
directory 'app/views/a/home', 'app/views/a/home'
|
@@ -176,14 +179,23 @@ module Mdwa
|
|
176
179
|
|
177
180
|
def migrations
|
178
181
|
if ask_question( "Generate migrations?" )
|
179
|
-
migration_template 'db/migrate/devise_create_users.rb', 'db/migrate/devise_create_users.rb'
|
180
|
-
sleep( 1.0 )
|
181
|
-
migration_template 'db/migrate/create_permissions.rb', 'db/migrate/create_permissions.rb'
|
182
|
-
sleep( 1.0 )
|
183
|
-
migration_template 'db/migrate/create_user_permissions.rb', 'db/migrate/create_user_permissions.rb'
|
184
|
-
sleep( 1.0 )
|
185
182
|
|
186
|
-
|
183
|
+
create_migrations = true
|
184
|
+
begin
|
185
|
+
create_migrations = false if User.table_exists?
|
186
|
+
rescue
|
187
|
+
end
|
188
|
+
|
189
|
+
if create_migrations
|
190
|
+
migration_template 'db/migrate/devise_create_users.rb', 'db/migrate/devise_create_users.rb'
|
191
|
+
sleep 1
|
192
|
+
migration_template 'db/migrate/create_permissions.rb', 'db/migrate/create_permissions.rb'
|
193
|
+
sleep 1
|
194
|
+
migration_template 'db/migrate/create_user_permissions.rb', 'db/migrate/create_user_permissions.rb'
|
195
|
+
sleep 1
|
196
|
+
|
197
|
+
rake "db:migrate" if ask_question( "Run rake db:migrate?" )
|
198
|
+
end
|
187
199
|
end
|
188
200
|
end
|
189
201
|
|
@@ -1,5 +1,5 @@
|
|
1
1
|
===entity_code===
|
2
|
-
<%%= <%= 'nested_' if @model.nested_many? %>form_for(<%= @model.to_route_object('@') %><%= ", :remote => true, :html => {:class => :mdwa_ajax #{',:multipart => true'
|
2
|
+
<%%= <%= 'nested_' if @model.nested_many? %>form_for(<%= @model.to_route_object('@') %><%= ", :remote => true, :html => {:class => :mdwa_ajax #{',:multipart => true' unless @model.attributes.select{|attr| attr.type.to_sym == :file}.count.zero?}}" if @entity.ajax %>) do |f| %>
|
3
3
|
|
4
4
|
<div id="mdwa_error">
|
5
5
|
<%%= render '/template/mdwa/crud_error', :object => @<%= @model.singular_name %> %>
|
@@ -17,7 +17,7 @@
|
|
17
17
|
<%- else -%>
|
18
18
|
<%%= link_to t('system.cancel_button'), '#', :class => :cancel %>
|
19
19
|
<%- end -%>
|
20
|
-
<%%= f.submit :class => :button %>
|
20
|
+
<%%= f.submit t('system.save_button'), :class => :button %>
|
21
21
|
</div>
|
22
22
|
|
23
23
|
<%% end %>
|
@@ -14,10 +14,10 @@
|
|
14
14
|
|
15
15
|
<%% @<%= @model.plural_name %>.each do |<%= @model.singular_name %>| %>
|
16
16
|
<tr class="<%%= cycle 'odd_line', 'even_line' %>" >
|
17
|
-
<td>
|
17
|
+
<td class="list_show">
|
18
18
|
<%%= link_to <%= @model.singular_name %>.id, <%= @model.object_name %>_path(<%= @model.singular_name %>) <%= ", :class => 'lightbox various fancybox.ajax'" if @entity.ajax %> %>
|
19
19
|
</td>
|
20
|
-
<td>
|
20
|
+
<td class="list_edit">
|
21
21
|
<%%= link_to t('system.index_edit_label'), edit_<%= @model.object_name %>_path(<%= @model.singular_name %>) <%= ", :class => 'lightbox various fancybox.ajax'" if @entity.ajax %> %>
|
22
22
|
</td>
|
23
23
|
<%- @model.attributes.select{|a| a.name != 'id' and a.name != 'created_at' and a.name != 'updated_at'}.each do |attr| -%>
|
@@ -47,7 +47,7 @@
|
|
47
47
|
<%- end -%>
|
48
48
|
</td>
|
49
49
|
<%- end -%>
|
50
|
-
<td>
|
50
|
+
<td class="list_remove">
|
51
51
|
<%%= link_to t('system.index_remove_label'), <%= @model.to_route_object %>, :method => :delete, <%= ':remote => true,' if @entity.ajax %> :data => {:confirm => t('system.index_confirm_deletion')} %>
|
52
52
|
</td>
|
53
53
|
</tr>
|
data/lib/mdwa/dsl/entity.rb
CHANGED
@@ -87,7 +87,7 @@ module MDWA
|
|
87
87
|
|
88
88
|
#
|
89
89
|
# Declares one attribute of the list using the block given.
|
90
|
-
def attribute(name, type)
|
90
|
+
def attribute(name, type, options = {})
|
91
91
|
if type.to_sym == :file
|
92
92
|
fields = ['_file_name','_content_type', '_file_size', '_updated_at']
|
93
93
|
fields.each do |f|
|
@@ -101,6 +101,8 @@ module MDWA
|
|
101
101
|
attr = EntityAttribute.new(self)
|
102
102
|
attr.name = name
|
103
103
|
attr.type = type
|
104
|
+
attr.default = options[:default] unless options[:default].blank?
|
105
|
+
attr.style = options[:style] unless options[:style].blank?
|
104
106
|
attr.raise_errors_if_invalid!
|
105
107
|
self.attributes[attr.name] = attr
|
106
108
|
end
|
@@ -5,7 +5,7 @@ module MDWA
|
|
5
5
|
class EntityAssociation
|
6
6
|
|
7
7
|
attr_accessor :source, :destination, :destination_view
|
8
|
-
attr_accessor :name, :type, :composition, :description, :skip_views
|
8
|
+
attr_accessor :name, :type, :composition, :description, :skip_views, :style
|
9
9
|
|
10
10
|
ACCEPTED_TYPES = [:one_to_many, :many_to_one, :one_to_one, :one_to_one_not_navigable, :many_to_many]
|
11
11
|
|
@@ -28,6 +28,10 @@ module MDWA
|
|
28
28
|
skip_views
|
29
29
|
end
|
30
30
|
|
31
|
+
def skip_views!
|
32
|
+
self.skip_views = true
|
33
|
+
end
|
34
|
+
|
31
35
|
#
|
32
36
|
# Return the mapped type for the code generation.
|
33
37
|
#
|
data/lib/mdwa/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mdd
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.16
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-09-
|
12
|
+
date: 2012-09-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -482,7 +482,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
482
482
|
version: '0'
|
483
483
|
segments:
|
484
484
|
- 0
|
485
|
-
hash:
|
485
|
+
hash: 2040248424844879994
|
486
486
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
487
487
|
none: false
|
488
488
|
requirements:
|
@@ -491,7 +491,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
491
491
|
version: '0'
|
492
492
|
segments:
|
493
493
|
- 0
|
494
|
-
hash:
|
494
|
+
hash: 2040248424844879994
|
495
495
|
requirements: []
|
496
496
|
rubyforge_project: mdd
|
497
497
|
rubygems_version: 1.8.24
|