auxiliary_addons 0.5.6 → 0.5.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/MIT-LICENSE +20 -20
- data/README +27 -27
- data/Rakefile +23 -23
- data/auxiliary_addons.gemspec +17 -17
- data/changelog +31 -28
- data/init.rb +2 -2
- data/install.rb +1 -1
- data/knownbugs +17 -17
- data/lib/auxiliary_addons.rb +45 -51
- data/lib/auxiliary_addons/html_helper.rb +47 -47
- data/lib/auxiliary_addons/jscript_helper.rb +25 -25
- data/lib/auxiliary_addons/list_helper.rb +56 -56
- data/lib/auxiliary_addons/ruby_addons.rb +41 -41
- data/lib/auxiliary_addons/tableless31_model.rb +36 -36
- data/lib/auxiliary_addons/tableless_model.rb +16 -16
- data/lib/auxiliary_addons/validateable_model.rb +37 -37
- data/roadmap +19 -19
- data/spec/lib/auxiliary_addons/error_helper_spec.rb +5 -5
- data/spec/lib/auxiliary_addons/filter_utils_spec.rb +5 -5
- data/spec/lib/auxiliary_addons/form_helper_spec.rb +5 -5
- data/spec/lib/auxiliary_addons/html_helper_spec.rb +6 -6
- data/spec/lib/auxiliary_addons/jscript_helper_spec.rb +5 -5
- data/spec/lib/auxiliary_addons/list_helper_spec.rb +5 -5
- data/spec/lib/auxiliary_addons/ruby_addons_spec.rb +6 -6
- data/spec/lib/auxiliary_addons/tableless_model_spec.rb +7 -7
- data/spec/lib/auxiliary_addons/validateable_model_spec.rb +7 -7
- data/spec/lib/auxiliary_addons_spec.rb +7 -7
- data/spec/spec.opts +2 -2
- data/spec/spec_helper.rb +23 -23
- data/tasks/auxiliary_addons_tasks.rake +4 -4
- data/uninstall.rb +1 -1
- metadata +22 -25
- data/lib/auxiliary_addons/error_helper.rb +0 -24
- data/lib/auxiliary_addons/filter_utils.rb +0 -43
- data/lib/auxiliary_addons/form_helper.rb +0 -139
data/MIT-LICENSE
CHANGED
@@ -1,20 +1,20 @@
|
|
1
|
-
Copyright (c) 2011 Artem Rufanov
|
2
|
-
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
-
a copy of this software and associated documentation files (the
|
5
|
-
"Software"), to deal in the Software without restriction, including
|
6
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
-
permit persons to whom the Software is furnished to do so, subject to
|
9
|
-
the following conditions:
|
10
|
-
|
11
|
-
The above copyright notice and this permission notice shall be
|
12
|
-
included in all copies or substantial portions of the Software.
|
13
|
-
|
14
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
1
|
+
Copyright (c) 2011 Artem Rufanov
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README
CHANGED
@@ -1,27 +1,27 @@
|
|
1
|
-
AuxiliaryAddons
|
2
|
-
===================
|
3
|
-
|
4
|
-
AuxiliaryAddons is a gem that contains basic helpers.
|
5
|
-
|
6
|
-
* The gem supports ruby 1.9.x & rails 3.x
|
7
|
-
* The gem supports ruby 1.8.7 & rails 2.5.x
|
8
|
-
* The gem allows ...
|
9
|
-
|
10
|
-
Quick Start
|
11
|
-
=======
|
12
|
-
In your Gemfile:
|
13
|
-
|
14
|
-
gem "auxiliary_addons", ">= 0.5.
|
15
|
-
|
16
|
-
Installation
|
17
|
-
=======
|
18
|
-
|
19
|
-
* Type 'gem install --local auxiliary_addons' with root account if you have installed RubyGems.
|
20
|
-
|
21
|
-
|
22
|
-
Example
|
23
|
-
=======
|
24
|
-
|
25
|
-
Example goes here.
|
26
|
-
|
27
|
-
Copyright (c) 2011 arufanov, released under the MIT license.
|
1
|
+
AuxiliaryAddons
|
2
|
+
===================
|
3
|
+
|
4
|
+
AuxiliaryAddons is a gem that contains basic helpers.
|
5
|
+
|
6
|
+
* The gem supports ruby 1.9.x & rails 3.x
|
7
|
+
* The gem supports ruby 1.8.7 & rails 2.5.x
|
8
|
+
* The gem allows ...
|
9
|
+
|
10
|
+
Quick Start
|
11
|
+
=======
|
12
|
+
In your Gemfile:
|
13
|
+
|
14
|
+
gem "auxiliary_addons", ">= 0.5.7"
|
15
|
+
|
16
|
+
Installation
|
17
|
+
=======
|
18
|
+
|
19
|
+
* Type 'gem install --local auxiliary_addons' with root account if you have installed RubyGems.
|
20
|
+
|
21
|
+
|
22
|
+
Example
|
23
|
+
=======
|
24
|
+
|
25
|
+
Example goes here.
|
26
|
+
|
27
|
+
Copyright (c) 2011 arufanov, released under the MIT license.
|
data/Rakefile
CHANGED
@@ -1,23 +1,23 @@
|
|
1
|
-
require 'rake'
|
2
|
-
require 'rake/testtask'
|
3
|
-
require 'rake/rdoctask'
|
4
|
-
|
5
|
-
desc 'Default: run unit tests.'
|
6
|
-
task :default => :test
|
7
|
-
|
8
|
-
desc 'Test the auxiliary_addons plugin.'
|
9
|
-
Rake::TestTask.new(:test) do |t|
|
10
|
-
t.libs << 'lib'
|
11
|
-
t.libs << 'test'
|
12
|
-
t.pattern = 'test/**/*_test.rb'
|
13
|
-
t.verbose = true
|
14
|
-
end
|
15
|
-
|
16
|
-
desc 'Generate documentation for the auxiliary_addons plugin.'
|
17
|
-
Rake::RDocTask.new(:rdoc) do |rdoc|
|
18
|
-
rdoc.rdoc_dir = 'rdoc'
|
19
|
-
rdoc.title = 'AuxiliaryAddons'
|
20
|
-
rdoc.options << '--line-numbers' << '--inline-source'
|
21
|
-
rdoc.rdoc_files.include('README')
|
22
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
23
|
-
end
|
1
|
+
require 'rake'
|
2
|
+
require 'rake/testtask'
|
3
|
+
require 'rake/rdoctask'
|
4
|
+
|
5
|
+
desc 'Default: run unit tests.'
|
6
|
+
task :default => :test
|
7
|
+
|
8
|
+
desc 'Test the auxiliary_addons plugin.'
|
9
|
+
Rake::TestTask.new(:test) do |t|
|
10
|
+
t.libs << 'lib'
|
11
|
+
t.libs << 'test'
|
12
|
+
t.pattern = 'test/**/*_test.rb'
|
13
|
+
t.verbose = true
|
14
|
+
end
|
15
|
+
|
16
|
+
desc 'Generate documentation for the auxiliary_addons plugin.'
|
17
|
+
Rake::RDocTask.new(:rdoc) do |rdoc|
|
18
|
+
rdoc.rdoc_dir = 'rdoc'
|
19
|
+
rdoc.title = 'AuxiliaryAddons'
|
20
|
+
rdoc.options << '--line-numbers' << '--inline-source'
|
21
|
+
rdoc.rdoc_files.include('README')
|
22
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
23
|
+
end
|
data/auxiliary_addons.gemspec
CHANGED
@@ -1,17 +1,17 @@
|
|
1
|
-
require 'date'
|
2
|
-
Gem::Specification.new do |s|
|
3
|
-
s.name = %q{auxiliary_addons}
|
4
|
-
s.version = "0.5.
|
5
|
-
s.date = Date.today.to_s
|
6
|
-
s.summary = %q{AuxiliaryAddons is a gem that contains basic helpers.}
|
7
|
-
s.description = %q{AuxiliaryAddons is a gem that contains basic helpers.}
|
8
|
-
s.author = %q{Artem Rufanov}
|
9
|
-
s.email = %q{developers@majoron.com}
|
10
|
-
s.homepage = %q{http://www.majoron.com/project/rbundle/auxiliary_addons}
|
11
|
-
s.files = Dir.glob('**/*') - Dir.glob('distrib/**/*') - Dir.glob('lib/api/**/*') - Dir.glob('doc/*.xpr')
|
12
|
-
s.bindir = 'bin'
|
13
|
-
s.executables = Dir.glob('bin/*').collect {|f| File.basename(f)}
|
14
|
-
s.require_paths << 'doc' << 'examples' << 'lib' << 'test'
|
15
|
-
s.has_rdoc = true
|
16
|
-
s.required_ruby_version = '>= 1.8.7'
|
17
|
-
end
|
1
|
+
require 'date'
|
2
|
+
Gem::Specification.new do |s|
|
3
|
+
s.name = %q{auxiliary_addons}
|
4
|
+
s.version = "0.5.7"
|
5
|
+
s.date = Date.today.to_s
|
6
|
+
s.summary = %q{AuxiliaryAddons is a gem that contains basic helpers.}
|
7
|
+
s.description = %q{AuxiliaryAddons is a gem that contains basic helpers.}
|
8
|
+
s.author = %q{Artem Rufanov}
|
9
|
+
s.email = %q{developers@majoron.com}
|
10
|
+
s.homepage = %q{http://www.majoron.com/project/rbundle/auxiliary_addons}
|
11
|
+
s.files = Dir.glob('**/*') - Dir.glob('distrib/**/*') - Dir.glob('lib/api/**/*') - Dir.glob('doc/*.xpr')
|
12
|
+
s.bindir = 'bin'
|
13
|
+
s.executables = Dir.glob('bin/*').collect {|f| File.basename(f)}
|
14
|
+
s.require_paths << 'doc' << 'examples' << 'lib' << 'test'
|
15
|
+
s.has_rdoc = true
|
16
|
+
s.required_ruby_version = '>= 1.8.7'
|
17
|
+
end
|
data/changelog
CHANGED
@@ -1,28 +1,31 @@
|
|
1
|
-
Introduction:
|
2
|
-
To see the latest list of the change log please visit the Change Log page at www.majoron.com.
|
3
|
-
|
4
|
-
Legend:
|
5
|
-
Follow notation is used at change log, roadmap and known bugs. Each bug begins with a version,
|
6
|
-
then follow category of the bug inside {}. It can be bug report, feature request and etc.
|
7
|
-
Then follow component inside []. After follow bug number at bug tracking system between // signs.
|
8
|
-
And then follow a short description of the bug.
|
9
|
-
|
10
|
-
Example:
|
11
|
-
For example bug: "1.0 { Feature Request } [ AntHill ] / 380 / STLport support required" means
|
12
|
-
that bug was created for 1.0 version of the AntHill component, bug is feature request with
|
13
|
-
380 number at bug tracking system. And bug requires STLPort support implementation.
|
14
|
-
|
15
|
-
Version 0.5
|
16
|
-
-----------
|
17
|
-
0.5 { Bug Report } [ AuxiliaryAddons ] / X /
|
18
|
-
0.5 { Bug Report } [ AuxiliaryAddons ] / X /
|
19
|
-
0.5 { Bug Report } [ AuxiliaryAddons ] / X /
|
20
|
-
0.5 { Bug Report } [ AuxiliaryAddons ] / X /
|
21
|
-
0.5 { Bug Report } [ AuxiliaryAddons ] / X /
|
22
|
-
0.5 { Bug Report } [ AuxiliaryAddons ] / X /
|
23
|
-
0.5 { Bug Report } [ AuxiliaryAddons ] / X /
|
24
|
-
0.5 { Bug Report } [ AuxiliaryAddons ] / X /
|
25
|
-
0.5 { Bug Report } [ AuxiliaryAddons ] / X /
|
26
|
-
0.5 { Bug Report } [ AuxiliaryAddons ] / X /
|
27
|
-
0.5 { Bug Report } [ AuxiliaryAddons ] / X /
|
28
|
-
0.5 { Bug Report } [ AuxiliaryAddons ] / X /
|
1
|
+
Introduction:
|
2
|
+
To see the latest list of the change log please visit the Change Log page at www.majoron.com.
|
3
|
+
|
4
|
+
Legend:
|
5
|
+
Follow notation is used at change log, roadmap and known bugs. Each bug begins with a version,
|
6
|
+
then follow category of the bug inside {}. It can be bug report, feature request and etc.
|
7
|
+
Then follow component inside []. After follow bug number at bug tracking system between // signs.
|
8
|
+
And then follow a short description of the bug.
|
9
|
+
|
10
|
+
Example:
|
11
|
+
For example bug: "1.0 { Feature Request } [ AntHill ] / 380 / STLport support required" means
|
12
|
+
that bug was created for 1.0 version of the AntHill component, bug is feature request with
|
13
|
+
380 number at bug tracking system. And bug requires STLPort support implementation.
|
14
|
+
|
15
|
+
Version 0.5
|
16
|
+
-----------
|
17
|
+
0.5 { Bug Report } [ AuxiliaryAddons ] / X / Remove filter utils
|
18
|
+
0.5 { Bug Report } [ AuxiliaryAddons ] / X / Remove error helpers
|
19
|
+
0.5 { Bug Report } [ AuxiliaryAddons ] / X / Remove form helpers
|
20
|
+
0.5 { Bug Report } [ AuxiliaryAddons ] / X / Add options to checkable_field_header
|
21
|
+
0.5 { Bug Report } [ AuxiliaryAddons ] / X / Add tableless31_model for Rails 3.1.x
|
22
|
+
0.5 { Bug Report } [ AuxiliaryAddons ] / X / Ruby 2.5.x support
|
23
|
+
0.5 { Bug Report } [ AuxiliaryAddons ] / X / Handle special case (all selected) at cast_ids_to_i function
|
24
|
+
0.5 { Bug Report } [ AuxiliaryAddons ] / X / Changelog, roadmap, knownbugs have been created
|
25
|
+
0.5 { Bug Report } [ AuxiliaryAddons ] / X / Add the @attributes to tableless module
|
26
|
+
0.5 { Bug Report } [ AuxiliaryAddons ] / X / Implement validateable_model and tablelessmodel
|
27
|
+
0.5 { Bug Report } [ AuxiliaryAddons ] / X / Fixed: DEPRECATION WARNING: Errors#on have been deprecated, use Errors#[] instead.
|
28
|
+
0.5 { Bug Report } [ AuxiliaryAddons ] / X / Renamed markers/arrow_(up|down).png to arrows/arrow_(up|down).png
|
29
|
+
0.5 { Bug Report } [ AuxiliaryAddons ] / X / Fixed problem with output += image_tag("img.png") bu using raw
|
30
|
+
0.5 { Bug Report } [ AuxiliaryAddons ] / X / Implemented set_focus_on_load based on prototype and jquery library
|
31
|
+
0.5 { Bug Report } [ AuxiliaryAddons ] / X / Implemented cast_ids_to_i function
|
data/init.rb
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
# Include hook code here
|
2
|
-
require 'auxiliary_addons'
|
1
|
+
# Include hook code here
|
2
|
+
require 'auxiliary_addons'
|
data/install.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
# Install hook code here
|
1
|
+
# Install hook code here
|
data/knownbugs
CHANGED
@@ -1,17 +1,17 @@
|
|
1
|
-
Introduction:
|
2
|
-
To see the latest list of the known bugs please visit the Known bugs page at www.majoron.com.
|
3
|
-
|
4
|
-
Legend:
|
5
|
-
Follow notation is used at change log, roadmap and known bugs. Each bug begins with a version,
|
6
|
-
then follow category of the bug inside {}. It can be bug report, feature request and etc.
|
7
|
-
Then follow component inside []. After follow bug number at bug tracking system between // signs.
|
8
|
-
And then follow a short description of the bug.
|
9
|
-
|
10
|
-
Example:
|
11
|
-
For example bug: "1.0 { Feature Request } [ AntHill ] / 380 / STLport support required" means
|
12
|
-
that bug was created for 1.0 version of the AntHill component, bug is feature request with
|
13
|
-
380 number at bug tracking system. And bug requires STLPort support implementation.
|
14
|
-
|
15
|
-
Version 0.5
|
16
|
-
-----------
|
17
|
-
0.5 { Bug Report } [ AuxiliaryAddons ] / X / There isn't known bugs
|
1
|
+
Introduction:
|
2
|
+
To see the latest list of the known bugs please visit the Known bugs page at www.majoron.com.
|
3
|
+
|
4
|
+
Legend:
|
5
|
+
Follow notation is used at change log, roadmap and known bugs. Each bug begins with a version,
|
6
|
+
then follow category of the bug inside {}. It can be bug report, feature request and etc.
|
7
|
+
Then follow component inside []. After follow bug number at bug tracking system between // signs.
|
8
|
+
And then follow a short description of the bug.
|
9
|
+
|
10
|
+
Example:
|
11
|
+
For example bug: "1.0 { Feature Request } [ AntHill ] / 380 / STLport support required" means
|
12
|
+
that bug was created for 1.0 version of the AntHill component, bug is feature request with
|
13
|
+
380 number at bug tracking system. And bug requires STLPort support implementation.
|
14
|
+
|
15
|
+
Version 0.5
|
16
|
+
-----------
|
17
|
+
0.5 { Bug Report } [ AuxiliaryAddons ] / X / There isn't known bugs
|
data/lib/auxiliary_addons.rb
CHANGED
@@ -1,51 +1,45 @@
|
|
1
|
-
# Include
|
2
|
-
require 'rubygems'
|
3
|
-
require 'active_support'
|
4
|
-
require 'auxiliary_addons/
|
5
|
-
require 'auxiliary_addons/
|
6
|
-
require 'auxiliary_addons/
|
7
|
-
require 'auxiliary_addons/
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
#
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
end
|
47
|
-
|
48
|
-
if defined? Rails
|
49
|
-
AuxiliaryAddons.enable_activerecord if defined? ActiveRecord
|
50
|
-
AuxiliaryAddons.enable_actionpack if defined? ActionController
|
51
|
-
end
|
1
|
+
# Include
|
2
|
+
require 'rubygems'
|
3
|
+
require 'active_support'
|
4
|
+
require 'auxiliary_addons/html_helper'
|
5
|
+
require 'auxiliary_addons/jscript_helper'
|
6
|
+
require 'auxiliary_addons/list_helper'
|
7
|
+
require 'auxiliary_addons/ruby_addons'
|
8
|
+
|
9
|
+
# Only for Rails 3.x
|
10
|
+
if Rails::VERSION::MAJOR >= 3
|
11
|
+
require 'auxiliary_addons/tableless_model'
|
12
|
+
require 'auxiliary_addons/tableless31_model'
|
13
|
+
require 'auxiliary_addons/validateable_model'
|
14
|
+
end
|
15
|
+
|
16
|
+
# =
|
17
|
+
#
|
18
|
+
module AuxiliaryAddons
|
19
|
+
|
20
|
+
# default options that can be overridden on the global level
|
21
|
+
@@options = {
|
22
|
+
:use_prototype => false, #
|
23
|
+
:use_jquery => true, #
|
24
|
+
:use_jquery_no_conflict => false, #
|
25
|
+
}
|
26
|
+
mattr_reader :options
|
27
|
+
|
28
|
+
def self.enable_activerecord
|
29
|
+
ActiveRecord::Base.send :include, AuxiliaryAddons::RubyAddons
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.enable_actionpack
|
33
|
+
ActionController::Base.send :include, AuxiliaryAddons::RubyAddons
|
34
|
+
|
35
|
+
ActionView::Base.send :include, AuxiliaryAddons::RubyAddons
|
36
|
+
ActionView::Base.send :include, AuxiliaryAddons::HtmlHelper
|
37
|
+
ActionView::Base.send :include, AuxiliaryAddons::JscriptHelper
|
38
|
+
ActionView::Base.send :include, AuxiliaryAddons::ListHelper
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
if defined? Rails
|
43
|
+
AuxiliaryAddons.enable_activerecord if defined? ActiveRecord
|
44
|
+
AuxiliaryAddons.enable_actionpack if defined? ActionController
|
45
|
+
end
|
@@ -1,48 +1,48 @@
|
|
1
|
-
module AuxiliaryAddons
|
2
|
-
module HtmlHelper
|
3
|
-
# ::Rails.logger.error("...")
|
4
|
-
|
5
|
-
#
|
6
|
-
# Common HTML helpers
|
7
|
-
#
|
8
|
-
|
9
|
-
#
|
10
|
-
def hash_to_string(params = {})
|
11
|
-
result = ""
|
12
|
-
params.each do |key, value|
|
13
|
-
blank = result.blank?
|
14
|
-
result += (key.to_s + "=" + value.to_s) if blank
|
15
|
-
result += ("&" + key.to_s + "=" + value.to_s) if !blank
|
16
|
-
end
|
17
|
-
|
18
|
-
# TODO: replace whitespaced and etc
|
19
|
-
result
|
20
|
-
end
|
21
|
-
|
22
|
-
#
|
23
|
-
def newlines_to_htmlbrs(str)
|
24
|
-
return str if (str.nil? || str.blank?)
|
25
|
-
str.gsub!(/\n/, '</br>')
|
26
|
-
end
|
27
|
-
|
28
|
-
#
|
29
|
-
def erase_spaces(str)
|
30
|
-
return str if (str.nil? || str.blank?)
|
31
|
-
str.gsub!(/\s/, '')
|
32
|
-
end
|
33
|
-
|
34
|
-
#
|
35
|
-
def unique_id(key)
|
36
|
-
@unique_ids = Hash.new() if @unique_ids.nil?
|
37
|
-
@unique_ids[key] = 0 if @unique_ids[key].nil?
|
38
|
-
@unique_ids[key] += 1
|
39
|
-
last_id(key)
|
40
|
-
end
|
41
|
-
|
42
|
-
#
|
43
|
-
def last_id(key)
|
44
|
-
key + "." + @unique_ids[key].to_s
|
45
|
-
end
|
46
|
-
|
47
|
-
end
|
1
|
+
module AuxiliaryAddons
|
2
|
+
module HtmlHelper
|
3
|
+
# ::Rails.logger.error("...")
|
4
|
+
|
5
|
+
#
|
6
|
+
# Common HTML helpers
|
7
|
+
#
|
8
|
+
|
9
|
+
#
|
10
|
+
def hash_to_string(params = {})
|
11
|
+
result = ""
|
12
|
+
params.each do |key, value|
|
13
|
+
blank = result.blank?
|
14
|
+
result += (key.to_s + "=" + value.to_s) if blank
|
15
|
+
result += ("&" + key.to_s + "=" + value.to_s) if !blank
|
16
|
+
end
|
17
|
+
|
18
|
+
# TODO: replace whitespaced and etc
|
19
|
+
result
|
20
|
+
end
|
21
|
+
|
22
|
+
#
|
23
|
+
def newlines_to_htmlbrs(str)
|
24
|
+
return str if (str.nil? || str.blank?)
|
25
|
+
str.gsub!(/\n/, '</br>')
|
26
|
+
end
|
27
|
+
|
28
|
+
#
|
29
|
+
def erase_spaces(str)
|
30
|
+
return str if (str.nil? || str.blank?)
|
31
|
+
str.gsub!(/\s/, '')
|
32
|
+
end
|
33
|
+
|
34
|
+
#
|
35
|
+
def unique_id(key)
|
36
|
+
@unique_ids = Hash.new() if @unique_ids.nil?
|
37
|
+
@unique_ids[key] = 0 if @unique_ids[key].nil?
|
38
|
+
@unique_ids[key] += 1
|
39
|
+
last_id(key)
|
40
|
+
end
|
41
|
+
|
42
|
+
#
|
43
|
+
def last_id(key)
|
44
|
+
key + "." + @unique_ids[key].to_s
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
48
48
|
end
|