kea-rails 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.rdoc +3 -0
- data/Rakefile +34 -0
- data/app/assets/javascripts/kea/bindings/activity.js +24 -0
- data/app/assets/javascripts/kea/bindings/child_vm.js +32 -0
- data/app/assets/javascripts/kea/bindings/komplete.js +172 -0
- data/app/assets/javascripts/kea/bindings/sherlock.js +47 -0
- data/app/assets/javascripts/kea/bindings/sherlock_provider_search.js +57 -0
- data/app/assets/javascripts/kea/bindings/submit_button.js +33 -0
- data/app/assets/javascripts/kea/bindings/validation_state.js +38 -0
- data/app/assets/javascripts/kea/bindings/wait_for_vm.js +44 -0
- data/app/assets/javascripts/kea/extenders/equals.js +85 -0
- data/app/assets/javascripts/kea/extenders/external_validator.js +65 -0
- data/app/assets/javascripts/kea/extenders/min_length.js +39 -0
- data/app/assets/javascripts/kea/extenders/numeric_range.js +64 -0
- data/app/assets/javascripts/kea/extenders/required.js +39 -0
- data/app/assets/javascripts/kea/extenders/valid_date.js +32 -0
- data/app/assets/javascripts/kea/extenders/valid_time.js +41 -0
- data/app/assets/javascripts/kea/extenders/validator_base.js +75 -0
- data/app/assets/javascripts/kea/helpers/kea.activity_button.js +97 -0
- data/app/assets/javascripts/kea/helpers/kea.notify.js +46 -0
- data/app/assets/javascripts/kea/initializers/base.js +11 -0
- data/app/assets/javascripts/kea/kea.js +14 -0
- data/app/assets/javascripts/kea/kea_dependencies.js +20 -0
- data/app/assets/javascripts/kea/kea_init.js +24 -0
- data/app/assets/javascripts/kea/models/base.js +215 -0
- data/app/assets/javascripts/kea/overlay/child_vm_overlay.js +49 -0
- data/app/assets/javascripts/kea/overlay/overlay_control.js +87 -0
- data/app/assets/javascripts/kea/overlay/overlay_template.js +58 -0
- data/app/assets/javascripts/kea/services/base.js +227 -0
- data/app/assets/javascripts/kea/sherlock/base_provider.js +201 -0
- data/app/assets/javascripts/kea/viewmodels/base.js +150 -0
- data/app/assets/javascripts/kea/viewmodels/sherlock.js +230 -0
- data/app/assets/stylesheets/kea/kea.css.sass +16 -0
- data/app/helpers/kea/application_helper.rb +42 -0
- data/lib/generators/kea/install/USAGE +9 -0
- data/lib/generators/kea/install/install_generator.rb +197 -0
- data/lib/generators/kea/install/templates/_komplete.sass +17 -0
- data/lib/generators/kea/install/templates/_sherlock.sass +105 -0
- data/lib/generators/kea/install/templates/application.html.erb +38 -0
- data/lib/generators/kea/install/templates/global.js +7 -0
- data/lib/generators/kea/install/templates/init.js +18 -0
- data/lib/generators/kea/install/templates/main.js +18 -0
- data/lib/generators/kea/model/USAGE +7 -0
- data/lib/generators/kea/model/model_generator.rb +68 -0
- data/lib/generators/kea/model/templates/model.js.erb +96 -0
- data/lib/generators/kea/service/USAGE +7 -0
- data/lib/generators/kea/service/service_generator.rb +21 -0
- data/lib/generators/kea/service/templates/model.js.erb +58 -0
- data/lib/generators/kea/viewmodel/USAGE +6 -0
- data/lib/generators/kea/viewmodel/templates/viewmodel.js.erb +73 -0
- data/lib/generators/kea/viewmodel/viewmodel_generator.rb +21 -0
- data/lib/kea-rails/engine.rb +5 -0
- data/lib/kea-rails/version.rb +3 -0
- data/lib/kea-rails.rb +4 -0
- data/lib/tasks/kea_tasks.rake +4 -0
- metadata +115 -0
@@ -0,0 +1,73 @@
|
|
1
|
+
(function(app, ko) {
|
2
|
+
"use strict";
|
3
|
+
|
4
|
+
var viewmodel_name = '<%= name.camelize %>',
|
5
|
+
ViewmodelClass;
|
6
|
+
|
7
|
+
ViewmodelClass = function <%= name.camelize %>() {
|
8
|
+
kea.viewmodels.Parent.apply(this);
|
9
|
+
kea.viewmodels.Child.apply(this);
|
10
|
+
kea.viewmodels.Validatable.apply(this);
|
11
|
+
|
12
|
+
var that = this;
|
13
|
+
|
14
|
+
this._viewmodelName = function _viewmodelName() { return viewmodel_name; };
|
15
|
+
|
16
|
+
this.exit = ko.observable(false);
|
17
|
+
this.shouldExit = function shouldExit() {
|
18
|
+
var previous = that.exit();
|
19
|
+
|
20
|
+
that.reset();
|
21
|
+
that.exit(true);
|
22
|
+
if (previous) { that.exit.valueHasMutated(); }
|
23
|
+
};
|
24
|
+
|
25
|
+
// this.context = ko.observable();
|
26
|
+
// this.validatableName('context');
|
27
|
+
|
28
|
+
this.submitInProgress = ko.observable(false);
|
29
|
+
this.submitComplete = ko.observable(false);
|
30
|
+
|
31
|
+
// this.isSubmittable = ko.computed(function() {
|
32
|
+
// return !that.hasFieldsWithErrors() && !that.hasValidationsInProgress();
|
33
|
+
// }, this, {deferEvaluation: true});
|
34
|
+
|
35
|
+
this.ajaxInProgress = ko.observable(false);
|
36
|
+
this.ajaxDisabled = ko.observable(false);
|
37
|
+
this.submitComplete = ko.observable(false);
|
38
|
+
|
39
|
+
this.reset = function reset() {
|
40
|
+
that.submitComplete(false);
|
41
|
+
that.ajaxInProgress(false);
|
42
|
+
that.ajaxDisabled(false);
|
43
|
+
};
|
44
|
+
|
45
|
+
this.setup = function setup(context) {
|
46
|
+
this.reset();
|
47
|
+
|
48
|
+
// context.makeValidatable();
|
49
|
+
// that.context(context);
|
50
|
+
};
|
51
|
+
|
52
|
+
this.submit = function submit() {
|
53
|
+
that.context().validate();
|
54
|
+
|
55
|
+
// if (that.context().hasErrors() || that.submitInProgress() || !that.isSubmittable()) {
|
56
|
+
// return;
|
57
|
+
// }
|
58
|
+
|
59
|
+
that.submitInProgress(true);
|
60
|
+
|
61
|
+
// return that.context().update()
|
62
|
+
// .done(function(asset) {
|
63
|
+
// that.submitComplete(true);
|
64
|
+
// })
|
65
|
+
// .always(function() {
|
66
|
+
// that.submitInProgress(false);
|
67
|
+
// });
|
68
|
+
};
|
69
|
+
};
|
70
|
+
|
71
|
+
app.viewmodels[viewmodel_name] = ViewmodelClass;
|
72
|
+
|
73
|
+
})(window.app, ko);
|
@@ -0,0 +1,21 @@
|
|
1
|
+
class Kea::ViewmodelGenerator < Rails::Generators::NamedBase
|
2
|
+
source_root File.expand_path('../templates', __FILE__)
|
3
|
+
argument :namespace, type: :string, required: false, default: nil
|
4
|
+
|
5
|
+
def install_templates
|
6
|
+
template "viewmodel.js.erb", namespaced_path("app/assets/javascripts", "viewmodels/#{name.underscore}.js")
|
7
|
+
end
|
8
|
+
|
9
|
+
private
|
10
|
+
|
11
|
+
def namespaced_path(path, suffix = nil)
|
12
|
+
app_namespace = case namespace
|
13
|
+
when 'none', nil
|
14
|
+
nil
|
15
|
+
else
|
16
|
+
namespace.underscore
|
17
|
+
end
|
18
|
+
|
19
|
+
File.join [path, app_namespace, suffix].compact
|
20
|
+
end
|
21
|
+
end
|
data/lib/kea-rails.rb
ADDED
metadata
ADDED
@@ -0,0 +1,115 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: kea-rails
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Jan-Christian Foeh
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-01-31 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rails
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '4.1'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '4.1'
|
27
|
+
description: A collection of helpers for structuring Knockout.js applications
|
28
|
+
email:
|
29
|
+
- jan@programmanstalt.de
|
30
|
+
executables: []
|
31
|
+
extensions: []
|
32
|
+
extra_rdoc_files: []
|
33
|
+
files:
|
34
|
+
- MIT-LICENSE
|
35
|
+
- README.rdoc
|
36
|
+
- Rakefile
|
37
|
+
- app/assets/javascripts/kea/bindings/activity.js
|
38
|
+
- app/assets/javascripts/kea/bindings/child_vm.js
|
39
|
+
- app/assets/javascripts/kea/bindings/komplete.js
|
40
|
+
- app/assets/javascripts/kea/bindings/sherlock.js
|
41
|
+
- app/assets/javascripts/kea/bindings/sherlock_provider_search.js
|
42
|
+
- app/assets/javascripts/kea/bindings/submit_button.js
|
43
|
+
- app/assets/javascripts/kea/bindings/validation_state.js
|
44
|
+
- app/assets/javascripts/kea/bindings/wait_for_vm.js
|
45
|
+
- app/assets/javascripts/kea/extenders/equals.js
|
46
|
+
- app/assets/javascripts/kea/extenders/external_validator.js
|
47
|
+
- app/assets/javascripts/kea/extenders/min_length.js
|
48
|
+
- app/assets/javascripts/kea/extenders/numeric_range.js
|
49
|
+
- app/assets/javascripts/kea/extenders/required.js
|
50
|
+
- app/assets/javascripts/kea/extenders/valid_date.js
|
51
|
+
- app/assets/javascripts/kea/extenders/valid_time.js
|
52
|
+
- app/assets/javascripts/kea/extenders/validator_base.js
|
53
|
+
- app/assets/javascripts/kea/helpers/kea.activity_button.js
|
54
|
+
- app/assets/javascripts/kea/helpers/kea.notify.js
|
55
|
+
- app/assets/javascripts/kea/initializers/base.js
|
56
|
+
- app/assets/javascripts/kea/kea.js
|
57
|
+
- app/assets/javascripts/kea/kea_dependencies.js
|
58
|
+
- app/assets/javascripts/kea/kea_init.js
|
59
|
+
- app/assets/javascripts/kea/models/base.js
|
60
|
+
- app/assets/javascripts/kea/overlay/child_vm_overlay.js
|
61
|
+
- app/assets/javascripts/kea/overlay/overlay_control.js
|
62
|
+
- app/assets/javascripts/kea/overlay/overlay_template.js
|
63
|
+
- app/assets/javascripts/kea/services/base.js
|
64
|
+
- app/assets/javascripts/kea/sherlock/base_provider.js
|
65
|
+
- app/assets/javascripts/kea/viewmodels/base.js
|
66
|
+
- app/assets/javascripts/kea/viewmodels/sherlock.js
|
67
|
+
- app/assets/stylesheets/kea/kea.css.sass
|
68
|
+
- app/helpers/kea/application_helper.rb
|
69
|
+
- lib/generators/kea/install/USAGE
|
70
|
+
- lib/generators/kea/install/install_generator.rb
|
71
|
+
- lib/generators/kea/install/templates/_komplete.sass
|
72
|
+
- lib/generators/kea/install/templates/_sherlock.sass
|
73
|
+
- lib/generators/kea/install/templates/application.html.erb
|
74
|
+
- lib/generators/kea/install/templates/global.js
|
75
|
+
- lib/generators/kea/install/templates/init.js
|
76
|
+
- lib/generators/kea/install/templates/main.js
|
77
|
+
- lib/generators/kea/model/USAGE
|
78
|
+
- lib/generators/kea/model/model_generator.rb
|
79
|
+
- lib/generators/kea/model/templates/model.js.erb
|
80
|
+
- lib/generators/kea/service/USAGE
|
81
|
+
- lib/generators/kea/service/service_generator.rb
|
82
|
+
- lib/generators/kea/service/templates/model.js.erb
|
83
|
+
- lib/generators/kea/viewmodel/USAGE
|
84
|
+
- lib/generators/kea/viewmodel/templates/viewmodel.js.erb
|
85
|
+
- lib/generators/kea/viewmodel/viewmodel_generator.rb
|
86
|
+
- lib/kea-rails.rb
|
87
|
+
- lib/kea-rails/engine.rb
|
88
|
+
- lib/kea-rails/version.rb
|
89
|
+
- lib/tasks/kea_tasks.rake
|
90
|
+
homepage: http://www.programmanstalt.de
|
91
|
+
licenses:
|
92
|
+
- MIT
|
93
|
+
metadata: {}
|
94
|
+
post_install_message: "\n Installation\n -----------\n\n run\n\n rails g kea:install\n\n
|
95
|
+
\ for setup.\n "
|
96
|
+
rdoc_options: []
|
97
|
+
require_paths:
|
98
|
+
- lib
|
99
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
105
|
+
requirements:
|
106
|
+
- - ">="
|
107
|
+
- !ruby/object:Gem::Version
|
108
|
+
version: '0'
|
109
|
+
requirements: []
|
110
|
+
rubyforge_project:
|
111
|
+
rubygems_version: 2.4.5
|
112
|
+
signing_key:
|
113
|
+
specification_version: 4
|
114
|
+
summary: A collection of helpers for structuring Knockout.js applications
|
115
|
+
test_files: []
|