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
@@ -1,25 +1,25 @@
|
|
1
|
-
module AuxiliaryAddons
|
2
|
-
module JscriptHelper
|
3
|
-
# ::Rails.logger.error("...")
|
4
|
-
|
5
|
-
#
|
6
|
-
# Common JScript helpers
|
7
|
-
#
|
8
|
-
|
9
|
-
#
|
10
|
-
def set_focus_on_load(id)
|
11
|
-
if ::AuxiliaryAddons.options[:use_prototype]
|
12
|
-
javascript_tag("Event.observe(window, 'load', $('#{id}').focus());")
|
13
|
-
end
|
14
|
-
if ::AuxiliaryAddons.options[:use_jquery]
|
15
|
-
if ::AuxiliaryAddons.options[:use_jquery_no_conflict]
|
16
|
-
javascript_tag("jQuery(document).ready(function(){jQuery('##{id}').focus();});")
|
17
|
-
else
|
18
|
-
javascript_tag("$(document).ready(function(){$('##{id}').focus();});")
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
1
|
+
module AuxiliaryAddons
|
2
|
+
module JscriptHelper
|
3
|
+
# ::Rails.logger.error("...")
|
4
|
+
|
5
|
+
#
|
6
|
+
# Common JScript helpers
|
7
|
+
#
|
8
|
+
|
9
|
+
#
|
10
|
+
def set_focus_on_load(id)
|
11
|
+
if ::AuxiliaryAddons.options[:use_prototype]
|
12
|
+
javascript_tag("Event.observe(window, 'load', $('#{id}').focus());")
|
13
|
+
end
|
14
|
+
if ::AuxiliaryAddons.options[:use_jquery]
|
15
|
+
if ::AuxiliaryAddons.options[:use_jquery_no_conflict]
|
16
|
+
javascript_tag("jQuery(document).ready(function(){jQuery('##{id}').focus();});")
|
17
|
+
else
|
18
|
+
javascript_tag("$(document).ready(function(){$('##{id}').focus();});")
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
@@ -1,57 +1,57 @@
|
|
1
|
-
module AuxiliaryAddons
|
2
|
-
module ListHelper
|
3
|
-
# ::Rails.logger.error("...")
|
4
|
-
|
5
|
-
#
|
6
|
-
# Common pagin and sorting helpers
|
7
|
-
#
|
8
|
-
|
9
|
-
#
|
10
|
-
def checkable_field_header(options = {})
|
11
|
-
# Here is old implementation
|
12
|
-
# output = check_box_tag "ids[]", 0, false, {:id => "ids_", :onclick => "checkedAll('list',this.checked);"}
|
13
|
-
# output
|
14
|
-
check_box_tag "ids[]", 0, false, options
|
15
|
-
end
|
16
|
-
|
17
|
-
def sortable_field_header (header_name, field_name, form_name = nil)
|
18
|
-
url_params = Hash.new
|
19
|
-
if form_name.nil?
|
20
|
-
if @orderby == field_name
|
21
|
-
url_params[:orderby] = field_name + " desc"
|
22
|
-
else
|
23
|
-
url_params[:orderby] = field_name
|
24
|
-
end
|
25
|
-
else
|
26
|
-
if @orderby[form_name] == field_name
|
27
|
-
url_params["orderby[#{form_name}]"] = field_name + " desc"
|
28
|
-
else
|
29
|
-
url_params["orderby[#{form_name}]"] = field_name
|
30
|
-
end
|
31
|
-
@orderby.each do |form, sorter|
|
32
|
-
unless form.to_s == form_name.to_s
|
33
|
-
url_params["orderby[#{form}]"] = sorter
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
# sort links should preserve GET parameters
|
39
|
-
if request.get?
|
40
|
-
request.params.each do |key, value|
|
41
|
-
next if key == 'controller'
|
42
|
-
next if key == 'action'
|
43
|
-
next if key == 'orderby'
|
44
|
-
next if key.starts_with?('orderby[')
|
45
|
-
url_params[key] = value
|
46
|
-
end
|
47
|
-
end
|
48
|
-
url_params.delete("page")
|
49
|
-
|
50
|
-
output = link_to header_name, url_params
|
51
|
-
output += raw(" " + image_tag("arrows/arrow_down.png")) if @orderby == field_name
|
52
|
-
output += raw(" " + image_tag("arrows/arrow_up.png")) if @orderby == field_name + " desc"
|
53
|
-
output
|
54
|
-
end
|
55
|
-
|
56
|
-
end
|
1
|
+
module AuxiliaryAddons
|
2
|
+
module ListHelper
|
3
|
+
# ::Rails.logger.error("...")
|
4
|
+
|
5
|
+
#
|
6
|
+
# Common pagin and sorting helpers
|
7
|
+
#
|
8
|
+
|
9
|
+
#
|
10
|
+
def checkable_field_header(options = {})
|
11
|
+
# Here is old implementation
|
12
|
+
# output = check_box_tag "ids[]", 0, false, {:id => "ids_", :onclick => "checkedAll('list',this.checked);"}
|
13
|
+
# output
|
14
|
+
check_box_tag "ids[]", 0, false, options
|
15
|
+
end
|
16
|
+
|
17
|
+
def sortable_field_header (header_name, field_name, form_name = nil)
|
18
|
+
url_params = Hash.new
|
19
|
+
if form_name.nil?
|
20
|
+
if @orderby == field_name
|
21
|
+
url_params[:orderby] = field_name + " desc"
|
22
|
+
else
|
23
|
+
url_params[:orderby] = field_name
|
24
|
+
end
|
25
|
+
else
|
26
|
+
if @orderby[form_name] == field_name
|
27
|
+
url_params["orderby[#{form_name}]"] = field_name + " desc"
|
28
|
+
else
|
29
|
+
url_params["orderby[#{form_name}]"] = field_name
|
30
|
+
end
|
31
|
+
@orderby.each do |form, sorter|
|
32
|
+
unless form.to_s == form_name.to_s
|
33
|
+
url_params["orderby[#{form}]"] = sorter
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
# sort links should preserve GET parameters
|
39
|
+
if request.get?
|
40
|
+
request.params.each do |key, value|
|
41
|
+
next if key == 'controller'
|
42
|
+
next if key == 'action'
|
43
|
+
next if key == 'orderby'
|
44
|
+
next if key.starts_with?('orderby[')
|
45
|
+
url_params[key] = value
|
46
|
+
end
|
47
|
+
end
|
48
|
+
url_params.delete("page")
|
49
|
+
|
50
|
+
output = link_to header_name, url_params
|
51
|
+
output += raw(" " + image_tag("arrows/arrow_down.png")) if @orderby == field_name
|
52
|
+
output += raw(" " + image_tag("arrows/arrow_up.png")) if @orderby == field_name + " desc"
|
53
|
+
output
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
57
57
|
end
|
@@ -1,42 +1,42 @@
|
|
1
|
-
module AuxiliaryAddons
|
2
|
-
module RubyAddons
|
3
|
-
# ::Rails.logger.error("...")
|
4
|
-
|
5
|
-
# Check present of object
|
6
|
-
def is_object_here?(obj)
|
7
|
-
return false if obj.nil?
|
8
|
-
return true
|
9
|
-
end
|
10
|
-
|
11
|
-
# Check present not empty of string
|
12
|
-
def is_string_here?(str)
|
13
|
-
return false if str.nil?
|
14
|
-
return false if str.blank?
|
15
|
-
return true
|
16
|
-
end
|
17
|
-
|
18
|
-
# TODO: make paramters as hash articles
|
19
|
-
# Check present not empty of string
|
20
|
-
def is_array_items_here?(array1, array2, array3)
|
21
|
-
return true if array1.size() > 0
|
22
|
-
return true if array2.size() > 0
|
23
|
-
return true if array3.size() > 0
|
24
|
-
return false
|
25
|
-
end
|
26
|
-
|
27
|
-
# Convert params to arrary of ids
|
28
|
-
def cast_ids_to_i(params)
|
29
|
-
ids = []
|
30
|
-
ids << params["id"].to_i if !params["id"].nil?
|
31
|
-
if !params["ids"].nil?
|
32
|
-
params["ids"].each do |id|
|
33
|
-
next if id.to_i == 0 # Special case: all selected
|
34
|
-
ids << id.to_i
|
35
|
-
end
|
36
|
-
end
|
37
|
-
ids
|
38
|
-
end
|
39
|
-
|
40
|
-
|
41
|
-
end
|
1
|
+
module AuxiliaryAddons
|
2
|
+
module RubyAddons
|
3
|
+
# ::Rails.logger.error("...")
|
4
|
+
|
5
|
+
# Check present of object
|
6
|
+
def is_object_here?(obj)
|
7
|
+
return false if obj.nil?
|
8
|
+
return true
|
9
|
+
end
|
10
|
+
|
11
|
+
# Check present not empty of string
|
12
|
+
def is_string_here?(str)
|
13
|
+
return false if str.nil?
|
14
|
+
return false if str.blank?
|
15
|
+
return true
|
16
|
+
end
|
17
|
+
|
18
|
+
# TODO: make paramters as hash articles
|
19
|
+
# Check present not empty of string
|
20
|
+
def is_array_items_here?(array1, array2, array3)
|
21
|
+
return true if array1.size() > 0
|
22
|
+
return true if array2.size() > 0
|
23
|
+
return true if array3.size() > 0
|
24
|
+
return false
|
25
|
+
end
|
26
|
+
|
27
|
+
# Convert params to arrary of ids
|
28
|
+
def cast_ids_to_i(params)
|
29
|
+
ids = []
|
30
|
+
ids << params["id"].to_i if !params["id"].nil?
|
31
|
+
if !params["ids"].nil?
|
32
|
+
params["ids"].each do |id|
|
33
|
+
next if id.to_i == 0 # Special case: all selected
|
34
|
+
ids << id.to_i
|
35
|
+
end
|
36
|
+
end
|
37
|
+
ids
|
38
|
+
end
|
39
|
+
|
40
|
+
|
41
|
+
end
|
42
42
|
end
|
@@ -1,36 +1,36 @@
|
|
1
|
-
#
|
2
|
-
# See http://railscasts.com/episodes/193-tableless-model
|
3
|
-
#
|
4
|
-
class Tableless31Model < ActiveRecord::Base
|
5
|
-
|
6
|
-
def self.columns
|
7
|
-
@columns ||= [];
|
8
|
-
end
|
9
|
-
|
10
|
-
def self.column(name, sql_type = nil, default = nil, null = true)
|
11
|
-
columns << ActiveRecord::ConnectionAdapters::Column.new(name.to_s, default,
|
12
|
-
sql_type.to_s, null)
|
13
|
-
end
|
14
|
-
|
15
|
-
def self.columns_hash
|
16
|
-
@columns_hash ||= Hash[columns.map { |column| [column.name, column] }]
|
17
|
-
end
|
18
|
-
|
19
|
-
def self.column_names
|
20
|
-
@column_names ||= columns.map { |column| column.name }
|
21
|
-
end
|
22
|
-
|
23
|
-
def self.column_defaults
|
24
|
-
@column_defaults ||= columns.map { |column| [column.name, nil] }.inject({}) { |m, e| m[e[0]] = e[1]; m }
|
25
|
-
end
|
26
|
-
|
27
|
-
# Override the save method to prevent exceptions.
|
28
|
-
def save(validate = true)
|
29
|
-
validate ? valid? : true
|
30
|
-
end
|
31
|
-
|
32
|
-
def initialize(attributes = nil)
|
33
|
-
super(attributes)
|
34
|
-
end
|
35
|
-
|
36
|
-
end
|
1
|
+
#
|
2
|
+
# See http://railscasts.com/episodes/193-tableless-model
|
3
|
+
#
|
4
|
+
class Tableless31Model < ActiveRecord::Base
|
5
|
+
|
6
|
+
def self.columns
|
7
|
+
@columns ||= [];
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.column(name, sql_type = nil, default = nil, null = true)
|
11
|
+
columns << ActiveRecord::ConnectionAdapters::Column.new(name.to_s, default,
|
12
|
+
sql_type.to_s, null)
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.columns_hash
|
16
|
+
@columns_hash ||= Hash[columns.map { |column| [column.name, column] }]
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.column_names
|
20
|
+
@column_names ||= columns.map { |column| column.name }
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.column_defaults
|
24
|
+
@column_defaults ||= columns.map { |column| [column.name, nil] }.inject({}) { |m, e| m[e[0]] = e[1]; m }
|
25
|
+
end
|
26
|
+
|
27
|
+
# Override the save method to prevent exceptions.
|
28
|
+
def save(validate = true)
|
29
|
+
validate ? valid? : true
|
30
|
+
end
|
31
|
+
|
32
|
+
def initialize(attributes = nil)
|
33
|
+
super(attributes)
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
@@ -1,16 +1,16 @@
|
|
1
|
-
#
|
2
|
-
# See http://railscasts.com/episodes/193-tableless-model
|
3
|
-
#
|
4
|
-
class TablelessModel < ActiveRecord::Base
|
5
|
-
|
6
|
-
def self.columns() @columns ||= []; end
|
7
|
-
|
8
|
-
def self.column(name, sql_type = nil, default = nil, null = true)
|
9
|
-
columns << ActiveRecord::ConnectionAdapters::Column.new(name.to_s, default, sql_type.to_s, null)
|
10
|
-
end
|
11
|
-
|
12
|
-
def initialize(attributes = nil)
|
13
|
-
super(attributes)
|
14
|
-
end
|
15
|
-
|
16
|
-
end
|
1
|
+
#
|
2
|
+
# See http://railscasts.com/episodes/193-tableless-model
|
3
|
+
#
|
4
|
+
class TablelessModel < ActiveRecord::Base
|
5
|
+
|
6
|
+
def self.columns() @columns ||= []; end
|
7
|
+
|
8
|
+
def self.column(name, sql_type = nil, default = nil, null = true)
|
9
|
+
columns << ActiveRecord::ConnectionAdapters::Column.new(name.to_s, default, sql_type.to_s, null)
|
10
|
+
end
|
11
|
+
|
12
|
+
def initialize(attributes = nil)
|
13
|
+
super(attributes)
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
@@ -1,37 +1,37 @@
|
|
1
|
-
#
|
2
|
-
# See http://railscasts.com/episodes/219-active-model
|
3
|
-
#
|
4
|
-
class ValidateableModel
|
5
|
-
|
6
|
-
# Mixin validation
|
7
|
-
include ActiveModel::Validations
|
8
|
-
include ActiveModel::Conversion
|
9
|
-
extend ActiveModel::Naming
|
10
|
-
|
11
|
-
def self.attr_accessor(*vars)
|
12
|
-
@attributes ||= []
|
13
|
-
@attributes.concat( vars )
|
14
|
-
super
|
15
|
-
end
|
16
|
-
|
17
|
-
def self.attributes
|
18
|
-
@attributes
|
19
|
-
end
|
20
|
-
|
21
|
-
# Initializer
|
22
|
-
def initialize(attributes={})
|
23
|
-
attributes && attributes.each do |name, value|
|
24
|
-
send("#{name}=", value) if respond_to? name.to_sym
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
# Overload persisted?
|
29
|
-
def persisted?
|
30
|
-
false
|
31
|
-
end
|
32
|
-
|
33
|
-
# Inspect
|
34
|
-
def self.inspect
|
35
|
-
"#<#{ self.to_s} #{ self.attributes.collect{ |e| ":#{ e }" }.join(', ') }>"
|
36
|
-
end
|
37
|
-
end
|
1
|
+
#
|
2
|
+
# See http://railscasts.com/episodes/219-active-model
|
3
|
+
#
|
4
|
+
class ValidateableModel
|
5
|
+
|
6
|
+
# Mixin validation
|
7
|
+
include ActiveModel::Validations
|
8
|
+
include ActiveModel::Conversion
|
9
|
+
extend ActiveModel::Naming
|
10
|
+
|
11
|
+
def self.attr_accessor(*vars)
|
12
|
+
@attributes ||= []
|
13
|
+
@attributes.concat( vars )
|
14
|
+
super
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.attributes
|
18
|
+
@attributes
|
19
|
+
end
|
20
|
+
|
21
|
+
# Initializer
|
22
|
+
def initialize(attributes={})
|
23
|
+
attributes && attributes.each do |name, value|
|
24
|
+
send("#{name}=", value) if respond_to? name.to_sym
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
# Overload persisted?
|
29
|
+
def persisted?
|
30
|
+
false
|
31
|
+
end
|
32
|
+
|
33
|
+
# Inspect
|
34
|
+
def self.inspect
|
35
|
+
"#<#{ self.to_s} #{ self.attributes.collect{ |e| ":#{ e }" }.join(', ') }>"
|
36
|
+
end
|
37
|
+
end
|
data/roadmap
CHANGED
@@ -1,19 +1,19 @@
|
|
1
|
-
Introduction:
|
2
|
-
To see the latest list of the roadmap please visit the Roadmap 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 { Feature Request } [ AuxiliaryAddons ] / X / Add tests
|
18
|
-
0.5 { Feature Request } [ AuxiliaryAddons ] / X / Add RailsTie
|
19
|
-
|
1
|
+
Introduction:
|
2
|
+
To see the latest list of the roadmap please visit the Roadmap 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 { Feature Request } [ AuxiliaryAddons ] / X / Add tests
|
18
|
+
0.5 { Feature Request } [ AuxiliaryAddons ] / X / Add RailsTie
|
19
|
+
|