mdd 3.0.15 → 3.0.16

Sign up to get free protection for your applications and to get access to all the features.
@@ -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
- <%- unless options.no_comments %>
7
- # r.alias = '<%= @requirement.alias %>' # alias is the unique requirement name and it's created automatically, you can override with this argument.
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', 'Task', 'Milestone']
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', 'TeamMember']
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
- rake "db:migrate" if ask_question( "Run rake db:migrate?" )
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
 
@@ -6,4 +6,5 @@
6
6
  //= require jquery_ujs
7
7
  //= require_tree ../jquery
8
8
  //= require jquery_nested_form
9
- //= require_tree ./template
9
+ //= require_tree ./template
10
+ //= require_tree ../app
@@ -11,4 +11,5 @@
11
11
  *= require_tree ../jquery
12
12
  *= require ./template/backend
13
13
  *= require ./template/leftbar
14
+ *= require_tree ../app
14
15
  */
@@ -9,7 +9,7 @@ class User < ActiveRecord::Base
9
9
  has_and_belongs_to_many :permissions
10
10
 
11
11
  def has_permission?(permission)
12
- return !!self.permissions.find_by_name(permissao.to_s.camelize)
12
+ return !!self.permissions.find_by_name(permission.to_s.camelize)
13
13
  end
14
14
 
15
15
  end
@@ -11,6 +11,7 @@ en:
11
11
  logged_info_logout: "(Logout)"
12
12
  logged_info_edit_account: "My Account"
13
13
  cancel_button: "Cancel"
14
+ save_button: "Save"
14
15
  index_id: "ID"
15
16
  index_edit: "Edit"
16
17
  index_edit_label: "Edit"
@@ -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' if @model.attributes.select{|attr| attr.type.to_sym == :file}.count.zero?}}" if @entity.ajax %>) do |f| %>
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>
@@ -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
  #
@@ -6,7 +6,7 @@ module MDWA
6
6
 
7
7
  class EntityAttribute
8
8
 
9
- attr_accessor :entity, :name, :type, :default
9
+ attr_accessor :entity, :name, :type, :default, :style
10
10
 
11
11
  ACCEPTED_TYPES = MDWA::Generators::ModelAttribute::STATIC_TYPES
12
12
 
data/lib/mdwa/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  module MDWA
3
- VERSION = "3.0.15"
3
+ VERSION = "3.0.16"
4
4
  end
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.15
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-13 00:00:00.000000000 Z
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: 2156169632613244192
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: 2156169632613244192
494
+ hash: 2040248424844879994
495
495
  requirements: []
496
496
  rubyforge_project: mdd
497
497
  rubygems_version: 1.8.24