mdd 3.0.17 → 3.0.18

Sign up to get free protection for your applications and to get access to all the features.
@@ -30,6 +30,12 @@
30
30
  select: function( event, ui ) {
31
31
  $(this).val('');
32
32
  $('<%= ul %>').append( "<li><span>" + ui.item.label + '</span><input type="hidden" value="' + ui.item.value + '" id="<%= dom_element_id %>_' + ui.item.value + '" name="<%= dom_element_id %>[' + ui.item.value + ']" /><a href="#" class="<%= dom_element_id %>_remove_autocomplete">(X)</a></li>' );
33
+
34
+ // call the callback function if exists
35
+ if(typeof <%= "#{dom_element_id}_on_autocomplete_select" %> == 'function') {
36
+ <%= "#{dom_element_id}_on_autocomplete_select" %>(event, ui);
37
+ }
38
+
33
39
  return false;
34
40
  }
35
41
  });
@@ -0,0 +1,31 @@
1
+ # encoding: UTF-8
2
+ require 'active_support/core_ext'
3
+
4
+ class String
5
+
6
+ # Remove as letras acentuadas
7
+ #
8
+ # Exemplo:
9
+ # String.remover_acentos('texto está com acentuação') ==> 'texto esta com acentuacao'
10
+ def self.remover_acentos(texto)
11
+ return texto if texto.blank?
12
+ texto = texto.gsub(/(á|à|ã|â|ä)/, 'a').gsub(/(é|è|ê|ë)/, 'e').gsub(/(í|ì|î|ï)/, 'i').gsub(/(ó|ò|õ|ô|ö)/, 'o').gsub(/(ú|ù|û|ü)/, 'u')
13
+ texto = texto.gsub(/(Á|À|Ã|Â|Ä)/, 'A').gsub(/(É|È|Ê|Ë)/, 'E').gsub(/(Í|Ì|Î|Ï)/, 'I').gsub(/(Ó|Ò|Õ|Ô|Ö)/, 'O').gsub(/(Ú|Ù|Û|Ü)/, 'U')
14
+ texto = texto.gsub(/ñ/, 'n').gsub(/Ñ/, 'N')
15
+ texto = texto.gsub(/ç/, 'c').gsub(/Ç/, 'C')
16
+ texto
17
+ end
18
+
19
+ # Remove as letras acentuadas
20
+ #
21
+ # Exemplo:
22
+ # 'texto está com acentuação'.remover_acentos ==> 'texto esta com acentuacao'
23
+ def remover_acentos
24
+ String.remover_acentos(self)
25
+ end
26
+
27
+ def to_alias
28
+ self.remover_acentos.gsub(/ /, '_').underscore.to_sym
29
+ end
30
+
31
+ end
data/lib/mdd.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  require 'rails/engine'
3
+ require 'extensions/string'
3
4
 
4
5
  module MDD
5
6
  class MDD < Rails::Engine
data/lib/mdwa/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  module MDWA
3
- VERSION = "3.0.17"
3
+ VERSION = "3.0.18"
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.17
4
+ version: 3.0.18
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-10-02 00:00:00.000000000 Z
12
+ date: 2012-10-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -164,6 +164,7 @@ files:
164
164
  - app/views/template/mdwa/_login_text.html.erb
165
165
  - app/views/template/mdwa/_notice.html.erb
166
166
  - lib/.DS_Store
167
+ - lib/extensions/string.rb
167
168
  - lib/generators/.DS_Store
168
169
  - lib/generators/mdwa/.DS_Store
169
170
  - lib/generators/mdwa/association/USAGE
@@ -482,7 +483,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
482
483
  version: '0'
483
484
  segments:
484
485
  - 0
485
- hash: -2587475407026122451
486
+ hash: 3486372585220701683
486
487
  required_rubygems_version: !ruby/object:Gem::Requirement
487
488
  none: false
488
489
  requirements:
@@ -491,7 +492,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
491
492
  version: '0'
492
493
  segments:
493
494
  - 0
494
- hash: -2587475407026122451
495
+ hash: 3486372585220701683
495
496
  requirements: []
496
497
  rubyforge_project: mdd
497
498
  rubygems_version: 1.8.24