abstractor 2.1.2 → 4.0.0
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.
- checksums.yaml +8 -8
- data/README.md +9 -6
- data/app/assets/javascripts/abstractor/abstractor.js.coffee +115 -0
- data/app/assets/javascripts/abstractor/application.js +0 -8
- data/app/assets/stylesheets/abstractor/abstractor_abstractions.css +21 -1
- data/app/views/abstractor/abstractor_abstraction_groups/_form.html.haml +3 -3
- data/app/views/abstractor/abstractor_abstractions/_fields.html.haml +15 -5
- data/app/views/abstractor/abstractor_abstractions/_list.html.haml +9 -13
- data/app/views/abstractor/abstractor_abstractions/edit.html.haml +3 -3
- data/db/migrate/20140816005228_add_namespace_to_abstractor_subjects.rb +6 -0
- data/lib/abstractor/abstractable.rb +228 -87
- data/lib/abstractor/enum.rb +4 -0
- data/lib/abstractor/methods/controllers/abstractor_abstractions_controller.rb +7 -1
- data/lib/abstractor/methods/controllers/abstractor_suggestions_controller.rb +6 -2
- data/lib/abstractor/methods/models/abstractor_abstraction.rb +1 -1
- data/lib/abstractor/methods/models/abstractor_abstraction_group.rb +1 -1
- data/lib/abstractor/methods/models/abstractor_abstraction_group_member.rb +1 -1
- data/lib/abstractor/methods/models/abstractor_abstraction_schema.rb +1 -1
- data/lib/abstractor/methods/models/abstractor_abstraction_schema_object_value.rb +1 -1
- data/lib/abstractor/methods/models/abstractor_abstraction_schema_predicate_variant.rb +1 -1
- data/lib/abstractor/methods/models/abstractor_abstraction_schema_relation.rb +1 -1
- data/lib/abstractor/methods/models/abstractor_abstraction_source.rb +1 -1
- data/lib/abstractor/methods/models/abstractor_abstraction_source_type.rb +1 -1
- data/lib/abstractor/methods/models/abstractor_indirect_source.rb +1 -1
- data/lib/abstractor/methods/models/abstractor_object_type.rb +1 -1
- data/lib/abstractor/methods/models/abstractor_object_value.rb +1 -2
- data/lib/abstractor/methods/models/abstractor_object_value_variant.rb +1 -1
- data/lib/abstractor/methods/models/abstractor_relation_type.rb +2 -1
- data/lib/abstractor/methods/models/abstractor_rule_type.rb +1 -1
- data/lib/abstractor/methods/models/abstractor_subject.rb +22 -18
- data/lib/abstractor/methods/models/abstractor_subject_group.rb +1 -1
- data/lib/abstractor/methods/models/abstractor_subject_group_member.rb +1 -1
- data/lib/abstractor/methods/models/abstractor_subject_relation.rb +1 -1
- data/lib/abstractor/methods/models/abstractor_suggestion.rb +1 -1
- data/lib/abstractor/methods/models/abstractor_suggestion_object_value.rb +1 -1
- data/lib/abstractor/methods/models/abstractor_suggestion_source.rb +1 -1
- data/lib/abstractor/methods/models/abstractor_suggestion_status.rb +1 -1
- data/lib/abstractor/negation_detection.rb +1 -1
- data/lib/abstractor/setup.rb +18 -18
- data/lib/abstractor/version.rb +1 -1
- data/lib/generators/abstractor/install/install_generator.rb +1 -1
- metadata +54 -34
- data/app/assets/javascripts/abstractor/abstractor.js +0 -108
- data/app/assets/javascripts/abstractor/nested_attributes.js +0 -69
@@ -1,108 +0,0 @@
|
|
1
|
-
Abstractor = {};
|
2
|
-
|
3
|
-
Abstractor.AbstractionUI = function(){
|
4
|
-
$(document).on('click', '.abstractor_abstraction_value a.edit_link', function(e){
|
5
|
-
e.preventDefault();
|
6
|
-
parent_div = $(this).closest('.abstractor_abstraction');
|
7
|
-
parent_div.load($(this).attr('href'), function(){
|
8
|
-
parent_div.find('.combobox').combobox({watermark:'a value'});
|
9
|
-
parent_div.find('input[type="submit"], button, a.button').button();
|
10
|
-
$('.abstractor_datepicker').datepicker({
|
11
|
-
altFormat: 'yy-mm-dd',
|
12
|
-
dateFormat: 'yy-mm-dd',
|
13
|
-
changeMonth: true,
|
14
|
-
changeYear: true
|
15
|
-
});
|
16
|
-
});
|
17
|
-
parent_div.addClass('highlighted');
|
18
|
-
//parent_div.siblings('.abstractor_abstraction').block({ message: null, overlayCSS: { opacity: .2 }});
|
19
|
-
});
|
20
|
-
$(document).on('ajax:success', 'form.edit_abstractor_abstraction', function(e, data, status, xhr){
|
21
|
-
parent_div = $(this).closest('.abstractor_abstraction');
|
22
|
-
parent_div.html(xhr.responseText);
|
23
|
-
//parent_div.siblings('.abstractor_abstraction').unblock();
|
24
|
-
parent_div.removeClass('highlighted');
|
25
|
-
});
|
26
|
-
$(document).on('click', ".edit_abstractor_abstraction input[type='radio']", function(){
|
27
|
-
$(this).siblings("input[type='checkbox']").prop('checked',false);
|
28
|
-
});
|
29
|
-
$(document).on('click', ".edit_abstractor_abstraction input[type='checkbox']", function(){
|
30
|
-
$(this).siblings("input[type='checkbox']").prop('checked',false);
|
31
|
-
$(this).siblings("input[type='text']").prop('value','');
|
32
|
-
var autocompleters = $(this).siblings('select.combobox');
|
33
|
-
autocompleters.combobox('setValue', '');
|
34
|
-
autocompleters.change();
|
35
|
-
|
36
|
-
$.each($(this).siblings("input[type='radio']"), function(){
|
37
|
-
if ($(this).prop('value') === '') {
|
38
|
-
$(this).prop('checked',true);
|
39
|
-
} else {
|
40
|
-
$(this).prop('checked',false);
|
41
|
-
}
|
42
|
-
});
|
43
|
-
});
|
44
|
-
$(document).on('change', '.edit_abstractor_abstraction select.combobox', function () {
|
45
|
-
if ($(this).find('option:selected').prop('value').length){
|
46
|
-
$(this).siblings("input[type='checkbox']").prop('checked',false);
|
47
|
-
}
|
48
|
-
});
|
49
|
-
$(document).on('change', ".edit_abstractor_abstraction input[type='text']", function(){
|
50
|
-
$(this).siblings("input[type='checkbox']").prop('checked',false);
|
51
|
-
});
|
52
|
-
$(document.body).append('<div id="abstractor_abstraction_dialog_tooltip"></div>');
|
53
|
-
|
54
|
-
$(document).on('click','.abstractor_abstraction_source_tooltip_img', function (evt) {
|
55
|
-
var target = $(this).attr('rel'),
|
56
|
-
html = $(target).html(),
|
57
|
-
title = $(this).attr('title');
|
58
|
-
|
59
|
-
|
60
|
-
evt.preventDefault();
|
61
|
-
$('#abstractor_abstraction_dialog_tooltip').html(html);
|
62
|
-
$('#abstractor_abstraction_dialog_tooltip').dialog('option', 'title', title);
|
63
|
-
$('#abstractor_abstraction_dialog_tooltip').dialog('option', 'width', ($(window).width() * 0.80));
|
64
|
-
$('#abstractor_abstraction_dialog_tooltip').dialog('open');
|
65
|
-
});
|
66
|
-
|
67
|
-
$('#abstractor_abstraction_dialog_tooltip').dialog({
|
68
|
-
maxHeight: 400,
|
69
|
-
autoOpen: false,
|
70
|
-
width: 600,
|
71
|
-
zIndex: 40000,
|
72
|
-
dialogClass: "ui-dialog_abstractor"
|
73
|
-
});
|
74
|
-
|
75
|
-
$(document).on('change', 'select.indirect_source_list', function () {
|
76
|
-
var source_type = $(this).attr('rel'),
|
77
|
-
value = $(this).find('option:selected').prop('value');
|
78
|
-
$(this).siblings('.indirect_source_text').addClass('hidden');
|
79
|
-
$(this).siblings('.' + source_type + '_' + value).removeClass('hidden');
|
80
|
-
});
|
81
|
-
};
|
82
|
-
|
83
|
-
Abstractor.AbstractionSuggestionUI = function(){
|
84
|
-
$(document).on('change', '.abstractor_suggestion_status_selection', function() {
|
85
|
-
$(this).closest('form').submit();
|
86
|
-
});
|
87
|
-
|
88
|
-
$(document).on('ajax:success', 'form.edit_abstractor_suggestion', function(e, data, status, xhr){
|
89
|
-
$(this).closest('.abstractor_abstraction').html(xhr.responseText);
|
90
|
-
});
|
91
|
-
};
|
92
|
-
|
93
|
-
Abstractor.AbstractionGroupUI = function(){
|
94
|
-
$(document).on('ajax:success', '.abstractor_abstraction_group .delete_link', function(e, data, status, xhr){
|
95
|
-
parent_div = $(this).closest('.abstractor_abstraction_group');
|
96
|
-
parent_div.html(xhr.responseText);
|
97
|
-
});
|
98
|
-
|
99
|
-
$(document).on('ajax:success', '.abstractor_subject_groups_container .add_link', function(e, data, status, xhr){
|
100
|
-
parent_div = $(this).closest('.abstractor_subject_groups_container');
|
101
|
-
parent_div.find('.abstractor_subject_groups').append(xhr.responseText);
|
102
|
-
});
|
103
|
-
|
104
|
-
$(document).on('ajax:success', '.abstractor_abstraction_group .update_link', function(e, data, status, xhr){
|
105
|
-
parent_div = $(this).closest('.abstractor_abstraction_group');
|
106
|
-
parent_div.html(xhr.responseText);
|
107
|
-
});
|
108
|
-
};
|
@@ -1,69 +0,0 @@
|
|
1
|
-
NestedAttributes = function (config) {
|
2
|
-
var that = this,
|
3
|
-
defaultConfig = {
|
4
|
-
removeStyle: 'hide',
|
5
|
-
undeleteOnChange: false,
|
6
|
-
add: true,
|
7
|
-
remove: true
|
8
|
-
};
|
9
|
-
this.config = $.extend(defaultConfig, config);
|
10
|
-
|
11
|
-
if (this.config.undeleteOnChange) {
|
12
|
-
$(this.config.container).find("input, select, textarea").change(function () {
|
13
|
-
$(that.config.container).find('.delete_' + that.config.association).prev("input[type=hidden]").val("0");
|
14
|
-
});
|
15
|
-
}
|
16
|
-
|
17
|
-
$(this.config.container).find("input, select, textarea").focus(function () {
|
18
|
-
$(this).select();
|
19
|
-
});
|
20
|
-
|
21
|
-
if (this.config.remove) {
|
22
|
-
var link = $(this.config.container).find('.delete_' + this.config.association)
|
23
|
-
$(document).off('click', link.selector)
|
24
|
-
$(document).on('click', link.selector, function() {
|
25
|
-
that.remove_fields(this, that.config.removeStyle);
|
26
|
-
|
27
|
-
if (that.config.removeHandler) {
|
28
|
-
that.config.removeHandler.call(that.config.caller);
|
29
|
-
}
|
30
|
-
});
|
31
|
-
}
|
32
|
-
|
33
|
-
if (this.config.add) {
|
34
|
-
var link = $(this.config.container).find('.add_' + this.config.association)
|
35
|
-
$(document).off('click', link.selector)
|
36
|
-
$(document).on('click', link.selector, function() {
|
37
|
-
that.add_fields(this, that.config.association, that.config.content);
|
38
|
-
|
39
|
-
if (that.config.addHandler) {
|
40
|
-
that.config.addHandler.call(that.config.caller);
|
41
|
-
}
|
42
|
-
});
|
43
|
-
}
|
44
|
-
};
|
45
|
-
|
46
|
-
NestedAttributes.prototype = {
|
47
|
-
remove_fields: function (link, removeStyle) {
|
48
|
-
$(link).prev("input[type=hidden]").val("1");
|
49
|
-
if (removeStyle === 'hide' ) {
|
50
|
-
$(link).closest(".fields").hide();
|
51
|
-
$(link).closest(".fields").prev('.error').hide();
|
52
|
-
}
|
53
|
-
else if (removeStyle === 'clear' ) {
|
54
|
-
$(link).closest(".fields").find('input').clearFields();
|
55
|
-
$(link).closest(".fields").find('select').clearFields();
|
56
|
-
$(link).closest(".fields").find('textarea').clearFields();
|
57
|
-
}
|
58
|
-
},
|
59
|
-
|
60
|
-
add_fields: function(link, association, content) {
|
61
|
-
var new_id = new Date().getTime(),
|
62
|
-
regexp1 = new RegExp("new_" + association, "g"),
|
63
|
-
regexp2 = new RegExp("new_nested_record", "g");
|
64
|
-
|
65
|
-
content = content.replace(regexp1, new_id);
|
66
|
-
content = content.replace(regexp2, 'new_nested_record_' + new_id);
|
67
|
-
$(link).closest("." + association).find('.nested_records_' + association).append(content);
|
68
|
-
}
|
69
|
-
};
|