marty 0.5.15 → 0.5.16
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +27 -0
- data/.rspec +3 -0
- data/.travis.yml +23 -0
- data/Gemfile +23 -0
- data/INDEPENDENCE_ISSUES.md +23 -0
- data/app/assets/images/marty/.gitkeep +0 -0
- data/app/components/marty/report_form.rb +9 -4
- data/gemini_deprecations.md +6 -0
- data/lib/marty/data_change.rb +99 -0
- data/lib/marty/data_conversion.rb +11 -3
- data/lib/marty/data_exporter.rb +9 -0
- data/lib/marty/version.rb +1 -1
- data/marty.gemspec +35 -0
- data/script/rails +8 -0
- data/spec/controllers/application_controller_spec.rb +52 -0
- data/spec/controllers/job_controller_spec.rb +226 -0
- data/spec/controllers/rpc_controller_spec.rb +379 -0
- data/spec/controllers/rpc_import_spec.rb +45 -0
- data/spec/dummy/README.rdoc +261 -0
- data/spec/dummy/Rakefile +7 -0
- data/spec/dummy/app/assets/javascripts/application.js +15 -0
- data/spec/dummy/app/assets/stylesheets/application.css +13 -0
- data/spec/dummy/app/controllers/application_controller.rb +3 -0
- data/spec/dummy/app/controllers/components_controller.rb +7 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/mailers/.gitkeep +0 -0
- data/spec/dummy/app/models/.gitkeep +0 -0
- data/spec/dummy/app/models/gemini/amortization_type.rb +5 -0
- data/spec/dummy/app/models/gemini/bud_category.rb +7 -0
- data/spec/dummy/app/models/gemini/entity.rb +2 -0
- data/spec/dummy/app/models/gemini/extras/data_import.rb +5 -0
- data/spec/dummy/app/models/gemini/extras/settlement_import.rb +28 -0
- data/spec/dummy/app/models/gemini/fannie_bup.rb +29 -0
- data/spec/dummy/app/models/gemini/grouping.rb +8 -0
- data/spec/dummy/app/models/gemini/grouping_head_version.rb +14 -0
- data/spec/dummy/app/models/gemini/head.rb +7 -0
- data/spec/dummy/app/models/gemini/head_version.rb +14 -0
- data/spec/dummy/app/models/gemini/helper.rb +44 -0
- data/spec/dummy/app/models/gemini/loan_program.rb +11 -0
- data/spec/dummy/app/models/gemini/mortgage_type.rb +5 -0
- data/spec/dummy/app/models/gemini/simple.rb +6 -0
- data/spec/dummy/app/models/gemini/streamline_type.rb +16 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/config/application.rb +82 -0
- data/spec/dummy/config/boot.rb +10 -0
- data/spec/dummy/config/database.yml.example +10 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +35 -0
- data/spec/dummy/config/environments/production.rb +69 -0
- data/spec/dummy/config/environments/test.rb +39 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/delayed_job.rb +5 -0
- data/spec/dummy/config/initializers/inflections.rb +15 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/secret_token.rb +7 -0
- data/spec/dummy/config/initializers/session_store.rb +8 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +5 -0
- data/spec/dummy/config/routes.rb +12 -0
- data/spec/dummy/db/migrate/20140801000000_create_groupings.rb +11 -0
- data/spec/dummy/db/migrate/20150406171536_create_categories.rb +27 -0
- data/spec/dummy/db/migrate/20150408200916_create_loan_programs.rb +26 -0
- data/spec/dummy/db/migrate/20150408201429_create_types.rb +21 -0
- data/spec/dummy/db/migrate/20150420000001_create_heads.rb +14 -0
- data/spec/dummy/db/migrate/20150420000002_create_head_versions.rb +15 -0
- data/spec/dummy/db/migrate/20150420000003_create_grouping_head_versions.rb +12 -0
- data/spec/dummy/db/migrate/20151023000001_create_simple.rb +12 -0
- data/spec/dummy/db/seeds.rb +8 -0
- data/spec/dummy/delorean/blame_report.dl +171 -0
- data/spec/dummy/delorean/data_report.dl +105 -0
- data/spec/dummy/delorean/fields.dl +52 -0
- data/spec/dummy/delorean/styles.dl +134 -0
- data/spec/dummy/lib/assets/.gitkeep +0 -0
- data/spec/dummy/lib/class_list.rb +3 -0
- data/spec/dummy/log/.gitkeep +0 -0
- data/spec/dummy/public/404.html +26 -0
- data/spec/dummy/public/422.html +26 -0
- data/spec/dummy/public/500.html +25 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/public/icons/READ.txt +3 -0
- data/spec/dummy/public/icons/application_cascade.png +0 -0
- data/spec/dummy/public/icons/application_delete.png +0 -0
- data/spec/dummy/public/icons/application_put.png +0 -0
- data/spec/dummy/public/icons/application_view_detail.png +0 -0
- data/spec/dummy/public/icons/arrow_in.png +0 -0
- data/spec/dummy/public/icons/arrow_refresh.png +0 -0
- data/spec/dummy/public/icons/database_save.png +0 -0
- data/spec/dummy/public/icons/door_in.png +0 -0
- data/spec/dummy/public/icons/door_out.png +0 -0
- data/spec/dummy/public/icons/group.png +0 -0
- data/spec/dummy/public/icons/page_lightning.png +0 -0
- data/spec/dummy/public/icons/printer.png +0 -0
- data/spec/dummy/public/icons/report_disk.png +0 -0
- data/spec/dummy/public/icons/report_go.png +0 -0
- data/spec/dummy/public/icons/report_magnify.png +0 -0
- data/spec/dummy/public/icons/script.png +0 -0
- data/spec/dummy/public/icons/script_add.png +0 -0
- data/spec/dummy/public/icons/script_go.png +0 -0
- data/spec/dummy/public/icons/script_key.png +0 -0
- data/spec/dummy/public/icons/table_go.png +0 -0
- data/spec/dummy/public/icons/time.png +0 -0
- data/spec/dummy/public/icons/time_add.png +0 -0
- data/spec/dummy/public/icons/time_go.png +0 -0
- data/spec/dummy/public/icons/timeline_marker.png +0 -0
- data/spec/dummy/public/icons/user_add.png +0 -0
- data/spec/dummy/public/icons/user_delete.png +0 -0
- data/spec/dummy/public/icons/user_edit.png +0 -0
- data/spec/dummy/public/icons/wrench.png +0 -0
- data/spec/dummy/script/delayed_job +6 -0
- data/spec/dummy/script/rails +6 -0
- data/spec/features/javascripts/job_dashboard_live_search.js.coffee +8 -0
- data/spec/features/javascripts/login.js.coffee +8 -0
- data/spec/features/jobs_dashboard_netzke_spec.rb +24 -0
- data/spec/features/jobs_dashboard_spec.rb +49 -0
- data/spec/fixtures/scripts/load_tests/script1.dl +2 -0
- data/spec/fixtures/scripts/load_tests/script2.dl +2 -0
- data/spec/job_helper.rb +102 -0
- data/spec/lib/data_exporter_spec.rb +71 -0
- data/spec/lib/data_importer_spec.rb +461 -0
- data/spec/lib/xl_spec.rb +198 -0
- data/spec/lib/xl_styles_spec.rb +115 -0
- data/spec/models/api_auth_spec.rb +187 -0
- data/spec/models/posting_spec.rb +107 -0
- data/spec/models/promise_spec.rb +65 -0
- data/spec/models/script_spec.rb +187 -0
- data/spec/models/user_spec.rb +68 -0
- data/spec/requests/routes_spec.rb +12 -0
- data/spec/spec_helper.rb +61 -0
- data/spec/support/clean_db_helpers.rb +18 -0
- data/spec/support/delayed_job_helpers.rb +12 -0
- data/spec/support/user_helpers.rb +12 -0
- metadata +139 -89
- data/app/components/marty/auth_app.rb~ +0 -51
- data/app/components/marty/auth_app/javascripts/auth_app.js~ +0 -91
- data/app/components/marty/cm_form_panel.rb~ +0 -5
- data/app/components/marty/cm_grid_panel.rb~ +0 -35
- data/app/components/marty/data_import_view.rb~ +0 -142
- data/app/components/marty/extras/layout.rb~ +0 -46
- data/app/components/marty/live_search_grid_panel.rb~ +0 -49
- data/app/components/marty/main_auth_app.rb~ +0 -238
- data/app/components/marty/mcfly_grid_panel.rb~ +0 -80
- data/app/components/marty/new_posting_form.rb~ +0 -46
- data/app/components/marty/new_posting_window.rb~ +0 -21
- data/app/components/marty/pivot_grid.rb +0 -52
- data/app/components/marty/pivot_grid/endpoints.rb +0 -45
- data/app/components/marty/pivot_grid/javascripts/extensions.js +0 -150
- data/app/components/marty/pivot_grid/javascripts/pivot_grid.js +0 -86
- data/app/components/marty/pivot_grid/services.rb +0 -44
- data/app/components/marty/posting_grid.rb~ +0 -140
- data/app/components/marty/promise_view.rb~ +0 -157
- data/app/components/marty/promise_view/stylesheets/promise_view.css~ +0 -15
- data/app/components/marty/report_form.rb~ +0 -217
- data/app/components/marty/report_select.rb~ +0 -133
- data/app/components/marty/reporting.rb~ +0 -39
- data/app/components/marty/script_detail.rb~ +0 -430
- data/app/components/marty/script_form.rb~ +0 -233
- data/app/components/marty/script_form/javascripts/Ext.ux.form.field.CodeMirror.js~ +0 -909
- data/app/components/marty/script_grid.rb~ +0 -99
- data/app/components/marty/script_tester.rb~ +0 -213
- data/app/components/marty/scripting.rb~ +0 -124
- data/app/components/marty/select_report.rb~ +0 -143
- data/app/components/marty/simple_app.rb~ +0 -101
- data/app/components/marty/tag_grid.rb~ +0 -89
- data/app/components/marty/tree_panel.rb~ +0 -256
- data/app/components/marty/tree_panel/javascripts/tree_panel.js~ +0 -317
- data/app/components/marty/user_pivot.rb +0 -128
- data/app/components/marty/user_view.rb~ +0 -188
- data/app/controllers/marty/application_controller.rb~ +0 -133
- data/app/controllers/marty/components_controller.rb~ +0 -37
- data/app/controllers/marty/job_controller.rb~ +0 -28
- data/app/controllers/marty/rpc_controller.rb~ +0 -61
- data/app/helpers/marty/script_set.rb~ +0 -59
- data/app/models/marty/api_auth.rb~ +0 -48
- data/app/models/marty/data_change.rb~ +0 -141
- data/app/models/marty/enum.rb~ +0 -16
- data/app/models/marty/import_type.rb~ +0 -48
- data/app/models/marty/poop.rb~ +0 -169
- data/app/models/marty/posting.rb~ +0 -86
- data/app/models/marty/posting_type.rb~ +0 -21
- data/app/models/marty/promise.rb~ +0 -196
- data/app/models/marty/role.rb~ +0 -10
- data/app/models/marty/script.rb~ +0 -62
- data/app/models/marty/tag.rb~ +0 -91
- data/app/models/marty/user.rb~ +0 -148
- data/app/models/marty/user_role.rb~ +0 -13
- data/app/views/layouts/marty/application.html.erb~ +0 -11
- data/config/routes.rb~ +0 -10
- data/db/migrate/019_create_marty_postings.rb~ +0 -19
- data/db/migrate/095_create_marty_tags.rb~ +0 -19
- data/lib/marty.rb~ +0 -13
- data/lib/marty/content_handler.rb~ +0 -93
- data/lib/marty/data_exporter.rb~ +0 -137
- data/lib/marty/data_importer.rb~ +0 -114
- data/lib/marty/data_row_processor.rb~ +0 -206
- data/lib/marty/drop_folder_hook.rb~ +0 -17
- data/lib/marty/folder_hook.rb~ +0 -9
- data/lib/marty/lazy_column_loader.rb~ +0 -47
- data/lib/marty/mcfly_query.rb~ +0 -188
- data/lib/marty/migrations.rb~ +0 -65
- data/lib/marty/monkey.rb~ +0 -160
- data/lib/marty/permissions.rb~ +0 -69
- data/lib/marty/promise.rb~ +0 -41
- data/lib/marty/promise_job.rb~ +0 -121
- data/lib/marty/promise_proxy.rb~ +0 -69
- data/lib/marty/util.rb~ +0 -80
- data/lib/marty/version.rb~ +0 -3
- data/lib/marty/xl.rb~ +0 -526
- data/lib/pyxll/README.txt~ +0 -16
- data/lib/pyxll/gemini.py~ +0 -110
- data/lib/pyxll/pyxll.cfg~ +0 -12
@@ -1,91 +0,0 @@
|
|
1
|
-
{
|
2
|
-
onSignIn: function() {
|
3
|
-
var me = this;
|
4
|
-
this.signinWin = this.signinWin || Ext.create('Ext.Window', {
|
5
|
-
width: 300,
|
6
|
-
height: 150,
|
7
|
-
modal: true,
|
8
|
-
layout: 'fit',
|
9
|
-
|
10
|
-
submit: function() {
|
11
|
-
var form = this.items.first();
|
12
|
-
var values = form.getForm().getValues();
|
13
|
-
|
14
|
-
// calling the endpoint
|
15
|
-
me.signIn(values, function(res) {
|
16
|
-
if (res) {
|
17
|
-
this.signinWin.close();
|
18
|
-
Ext.Msg.show({
|
19
|
-
title: "Signed in",
|
20
|
-
msg: "Signed in successfully, reloading...",
|
21
|
-
icon: Ext.Msg.INFO,
|
22
|
-
closable: false
|
23
|
-
});
|
24
|
-
window.location.href = "/";
|
25
|
-
}
|
26
|
-
});
|
27
|
-
},
|
28
|
-
|
29
|
-
closeAction: 'hide',
|
30
|
-
title: "Sign in",
|
31
|
-
fbar: [
|
32
|
-
{
|
33
|
-
text: 'OK',
|
34
|
-
name: 'signin_submit',
|
35
|
-
handler: function() {
|
36
|
-
this.up('window').submit();
|
37
|
-
},
|
38
|
-
},
|
39
|
-
{
|
40
|
-
text:'Cancel',
|
41
|
-
handler: function() {
|
42
|
-
this.up('window').close();
|
43
|
-
},
|
44
|
-
},
|
45
|
-
],
|
46
|
-
|
47
|
-
items: {
|
48
|
-
xtype: 'form',
|
49
|
-
defaultType: 'textfield',
|
50
|
-
bodyPadding: '15px 0px 0px 10px',
|
51
|
-
defaults: {
|
52
|
-
listeners: {
|
53
|
-
specialkey: function (field, event) {
|
54
|
-
if (event.getKey() == event.ENTER) {
|
55
|
-
field.up('window').submit();
|
56
|
-
}
|
57
|
-
}
|
58
|
-
},
|
59
|
-
},
|
60
|
-
items: [
|
61
|
-
{
|
62
|
-
fieldLabel: 'Login',
|
63
|
-
name: 'login',
|
64
|
-
},
|
65
|
-
{
|
66
|
-
fieldLabel: 'Password',
|
67
|
-
name: 'password',
|
68
|
-
inputType: 'password',
|
69
|
-
}
|
70
|
-
]
|
71
|
-
}
|
72
|
-
});
|
73
|
-
|
74
|
-
this.signinWin.show();
|
75
|
-
this.signinWin.down('textfield').focus(false, 100);
|
76
|
-
},
|
77
|
-
|
78
|
-
onSignOut: function() {
|
79
|
-
this.signOut(null, function(success) {
|
80
|
-
if (success) {
|
81
|
-
Ext.Msg.show({
|
82
|
-
title: "Signed out",
|
83
|
-
msg: "Signed out, reloading the application...",
|
84
|
-
icon: Ext.Msg.INFO,
|
85
|
-
closable: false
|
86
|
-
});
|
87
|
-
window.location.href = "/";
|
88
|
-
}
|
89
|
-
})
|
90
|
-
}
|
91
|
-
}
|
@@ -1,35 +0,0 @@
|
|
1
|
-
require 'netzke-basepack'
|
2
|
-
require 'marty/permissions'
|
3
|
-
|
4
|
-
class Marty::CmGridPanel < Netzke::Basepack::Grid
|
5
|
-
extend ::Marty::Permissions
|
6
|
-
|
7
|
-
has_marty_permissions read: :any
|
8
|
-
|
9
|
-
js_configure do |c|
|
10
|
-
# For some reason the grid update function was removed in Netzke
|
11
|
-
# 0.10. So, add it here.
|
12
|
-
c.cm_update = <<-JS
|
13
|
-
function() {
|
14
|
-
this.store.load();
|
15
|
-
}
|
16
|
-
JS
|
17
|
-
end
|
18
|
-
|
19
|
-
def configure(c)
|
20
|
-
super
|
21
|
-
|
22
|
-
create = self.class.can_perform_action?(:create)
|
23
|
-
read = self.class.can_perform_action?(:read)
|
24
|
-
update = self.class.can_perform_action?(:update)
|
25
|
-
delete = self.class.can_perform_action?(:delete)
|
26
|
-
|
27
|
-
c.prohibit_create = !create
|
28
|
-
c.prohibit_read = !read
|
29
|
-
c.prohibit_update = !update
|
30
|
-
c.prohibit_delete = !delete
|
31
|
-
|
32
|
-
c.enable_edit_inline = update
|
33
|
-
c.enable_edit_in_form = update
|
34
|
-
end
|
35
|
-
end
|
@@ -1,142 +0,0 @@
|
|
1
|
-
class Marty::DataImportView < Marty::CmFormPanel
|
2
|
-
include Marty::Extras::Layout
|
3
|
-
|
4
|
-
action :apply do |a|
|
5
|
-
a.text = I18n.t("data_import_view.import")
|
6
|
-
a.tooltip = I18n.t("data_import_view.import")
|
7
|
-
a.icon = :database_go
|
8
|
-
end
|
9
|
-
|
10
|
-
js_configure do |c|
|
11
|
-
|
12
|
-
c.set_result = <<-JS
|
13
|
-
function(html) {
|
14
|
-
var result = this.netzkeGetComponent('result');
|
15
|
-
result.updateBodyHtml(html);
|
16
|
-
}
|
17
|
-
JS
|
18
|
-
|
19
|
-
c.init_component = <<-JS
|
20
|
-
function() {
|
21
|
-
var me = this;
|
22
|
-
me.callParent();
|
23
|
-
var form = me.getForm();
|
24
|
-
|
25
|
-
var comboname = form.findField('import_type');
|
26
|
-
var textname = form.findField('import_data');
|
27
|
-
var importbutton = me.actions["apply"].items[0];
|
28
|
-
|
29
|
-
comboname.on('select', function(combo, record) {
|
30
|
-
textname.setValue("");
|
31
|
-
me.netzkeGetComponent('result').updateBodyHtml('');
|
32
|
-
});
|
33
|
-
|
34
|
-
importbutton.on('click', function(t, e, ops) {
|
35
|
-
me.netzkeGetComponent('result').updateBodyHtml('');
|
36
|
-
});
|
37
|
-
}
|
38
|
-
JS
|
39
|
-
end
|
40
|
-
|
41
|
-
######################################################################
|
42
|
-
|
43
|
-
endpoint :netzke_submit do |params, this|
|
44
|
-
data = ActiveSupport::JSON.decode(params[:data])
|
45
|
-
|
46
|
-
import_data, import_type =
|
47
|
-
data["import_data"] || "", data["import_type"] || ""
|
48
|
-
|
49
|
-
return this.netzke_feedback("Must provide import data.") if
|
50
|
-
import_data.empty?
|
51
|
-
|
52
|
-
return this.netzke_feedback("Must provide import type") if
|
53
|
-
import_type.empty?
|
54
|
-
|
55
|
-
import_type_rec = Marty::ImportType.find_by_name(import_type)
|
56
|
-
|
57
|
-
return this.netzke_feedback("Import type #{import_type} not found") unless
|
58
|
-
import_type_rec
|
59
|
-
|
60
|
-
return this.netzke_feedback("Insufficient permissions to run " +
|
61
|
-
"the data import") unless
|
62
|
-
import_type_rec.allow_import?
|
63
|
-
|
64
|
-
klass = import_type_rec.get_model_class
|
65
|
-
cleaner_function = import_type_rec.cleaner_function
|
66
|
-
validation_function = import_type_rec.validation_function
|
67
|
-
|
68
|
-
begin
|
69
|
-
res = Marty::DataImporter.do_import_summary(klass,
|
70
|
-
import_data,
|
71
|
-
'infinity',
|
72
|
-
cleaner_function,
|
73
|
-
validation_function,
|
74
|
-
)
|
75
|
-
|
76
|
-
result = res.map { |k, v|
|
77
|
-
case k
|
78
|
-
when :clean then "#{v} record(s) cleaned."
|
79
|
-
when :same then "#{v} record(s) unchanged."
|
80
|
-
when :create then "#{v} record(s) created."
|
81
|
-
when :update then "#{v} record(s) updated."
|
82
|
-
when :blank then "#{v} empty lines."
|
83
|
-
end
|
84
|
-
}
|
85
|
-
|
86
|
-
this.set_result result.join("<br/>")
|
87
|
-
rescue Marty::DataImporterError => exc
|
88
|
-
result = [
|
89
|
-
"Import failed on line(s): #{exc.lines.join(', ')}",
|
90
|
-
"Error: #{exc.to_s}",
|
91
|
-
]
|
92
|
-
|
93
|
-
this.set_result '<font color="red">' + result.join("<br/>") + "</font>"
|
94
|
-
end
|
95
|
-
end
|
96
|
-
|
97
|
-
def configure(c)
|
98
|
-
super
|
99
|
-
|
100
|
-
c.title = I18n.t("data_import_view.import_data")
|
101
|
-
c.items =
|
102
|
-
[
|
103
|
-
fieldset(I18n.t("data_import_view.select"),
|
104
|
-
{
|
105
|
-
xtype: :combo,
|
106
|
-
name: "import_type",
|
107
|
-
store: Marty::ImportType.all.map(&:name).sort,
|
108
|
-
max_width: "350",
|
109
|
-
hide_label: true,
|
110
|
-
force_selection: true,
|
111
|
-
},
|
112
|
-
{
|
113
|
-
name: "import_data",
|
114
|
-
width: "100%",
|
115
|
-
height: 300,
|
116
|
-
xtype: :textareafield,
|
117
|
-
value: "",
|
118
|
-
auto_scroll: true,
|
119
|
-
hide_label: true,
|
120
|
-
spellcheck: false,
|
121
|
-
field_style: {
|
122
|
-
font_family: 'courier new',
|
123
|
-
font_size: '12px'
|
124
|
-
},
|
125
|
-
},
|
126
|
-
min_width: 700,
|
127
|
-
),
|
128
|
-
:result,
|
129
|
-
]
|
130
|
-
end
|
131
|
-
|
132
|
-
component :result do |c|
|
133
|
-
c.klass = Marty::CmPanel
|
134
|
-
c.title = I18n.t("data_import_view.results")
|
135
|
-
c.html = ""
|
136
|
-
c.flex = 1
|
137
|
-
c.min_height = 150
|
138
|
-
c.auto_scroll = true
|
139
|
-
end
|
140
|
-
end
|
141
|
-
|
142
|
-
DataImportView = Marty::DataImportView
|
@@ -1,46 +0,0 @@
|
|
1
|
-
module Marty
|
2
|
-
module Extras
|
3
|
-
module Layout
|
4
|
-
|
5
|
-
def hbox(*args)
|
6
|
-
params = args.pop
|
7
|
-
params.merge(layout: { type: :hbox, align: :stretch },
|
8
|
-
items: args,
|
9
|
-
)
|
10
|
-
end
|
11
|
-
|
12
|
-
def vbox(*args)
|
13
|
-
params = args.pop
|
14
|
-
params.merge(layout: { type: :vbox, align: :stretch },
|
15
|
-
items: args,
|
16
|
-
)
|
17
|
-
end
|
18
|
-
|
19
|
-
def fieldset(title, *args)
|
20
|
-
params = args.pop
|
21
|
-
params.merge(items: args,
|
22
|
-
xtype: 'fieldset',
|
23
|
-
defaults: { anchor: '100%' },
|
24
|
-
title: title,
|
25
|
-
)
|
26
|
-
end
|
27
|
-
|
28
|
-
def dispfield(params={})
|
29
|
-
{
|
30
|
-
attr_type: :displayfield,
|
31
|
-
hide_label: !params[:field_label],
|
32
|
-
read_only: true,
|
33
|
-
}.merge(params)
|
34
|
-
end
|
35
|
-
|
36
|
-
def vspacer(params={})
|
37
|
-
vbox({flex: 1, border: false}.merge(params))
|
38
|
-
end
|
39
|
-
|
40
|
-
def hspacer(params={})
|
41
|
-
hbox({flex: 1, border: false}.merge(params))
|
42
|
-
end
|
43
|
-
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
@@ -1,49 +0,0 @@
|
|
1
|
-
# The LiveSearchGridPanel provides a search field in the toolbar of
|
2
|
-
# the GridPanel. While the content of the search field is changeing,
|
3
|
-
# the data in the grid gets reloaded and the filter string is given to
|
4
|
-
# a scope on the configured model. The scope name by default is
|
5
|
-
# :live_search but it can be reconfigured by the configuration option
|
6
|
-
# :live_search_scope. NOTE: this is rewrite of the Netzke community
|
7
|
-
# pack component of the same name. We should submit this to the
|
8
|
-
# community.
|
9
|
-
#
|
10
|
-
# Options:
|
11
|
-
# * +live_search_scope+ - The scope name for filtering the results by
|
12
|
-
# the live search (default: :live_search)
|
13
|
-
#
|
14
|
-
|
15
|
-
class Marty::LiveSearchGridPanel < Marty::McflyGridPanel
|
16
|
-
js_configure do |c|
|
17
|
-
c.listen_fn = <<-JS
|
18
|
-
function(obj, search_text) {
|
19
|
-
var lg = this.ownerCt.ownerCt;
|
20
|
-
lg.getStore().getProxy().extraParams.live_search = search_text;
|
21
|
-
lg.getStore().load();
|
22
|
-
}
|
23
|
-
JS
|
24
|
-
|
25
|
-
c.tbar = ['->', {
|
26
|
-
name: 'live_search_text',
|
27
|
-
xtype: 'textfield',
|
28
|
-
enable_key_events: true,
|
29
|
-
ref: '../live_search_field',
|
30
|
-
empty_text: 'Search',
|
31
|
-
listeners: {
|
32
|
-
change: {
|
33
|
-
fn: c.listen_fn,
|
34
|
-
buffer: 100,
|
35
|
-
}
|
36
|
-
}
|
37
|
-
}]
|
38
|
-
end
|
39
|
-
|
40
|
-
def get_data(*args)
|
41
|
-
params = args.first
|
42
|
-
search_scope = config[:live_search_scope] || :live_search
|
43
|
-
data_class.send(search_scope, params && params[:live_search] || '').scoping do
|
44
|
-
super
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
end
|
49
|
-
|
@@ -1,238 +0,0 @@
|
|
1
|
-
require 'marty/permissions'
|
2
|
-
require 'marty/scripting'
|
3
|
-
require 'marty/reporting'
|
4
|
-
require 'marty/posting_window'
|
5
|
-
require 'marty/new_posting_window'
|
6
|
-
require 'marty/import_type_view'
|
7
|
-
require 'marty/data_import_view'
|
8
|
-
require 'marty/user_view'
|
9
|
-
require 'marty/promise_view'
|
10
|
-
require 'marty/api_auth_view'
|
11
|
-
|
12
|
-
class Marty::MainAuthApp < Marty::AuthApp
|
13
|
-
extend ::Marty::Permissions
|
14
|
-
|
15
|
-
# set of posting types user is allowed to post with
|
16
|
-
def self.has_posting_perm?
|
17
|
-
Marty::NewPostingForm.has_any_perm?
|
18
|
-
end
|
19
|
-
|
20
|
-
def self.has_data_import_perm?
|
21
|
-
self.class.has_admin_perm?
|
22
|
-
end
|
23
|
-
|
24
|
-
def self.has_scripting_perm?
|
25
|
-
self.class.has_admin_perm?
|
26
|
-
end
|
27
|
-
|
28
|
-
def sep
|
29
|
-
{ xtype: 'tbseparator' }
|
30
|
-
end
|
31
|
-
|
32
|
-
def icon_hack(name)
|
33
|
-
# There's a Netzke bug whereby, using icon names in hashes
|
34
|
-
# doesn't generate the proper URL.
|
35
|
-
"#{Netzke::Core.ext_uri}/../images/icons/#{name}.png"
|
36
|
-
end
|
37
|
-
|
38
|
-
def posting_menu
|
39
|
-
warped = Marty::Util.get_posting_time != Float::INFINITY
|
40
|
-
wtext = warped ? " [#{Marty::Util.get_posting.name}" : ''
|
41
|
-
|
42
|
-
{
|
43
|
-
text: I18n.t("postings") + wtext,
|
44
|
-
icon: icon_hack(:time),
|
45
|
-
style: (warped ? "background-color: lightGrey;" : ""),
|
46
|
-
menu: [
|
47
|
-
:new_posting,
|
48
|
-
:select_posting,
|
49
|
-
:select_now,
|
50
|
-
],
|
51
|
-
}
|
52
|
-
end
|
53
|
-
|
54
|
-
def system_menu
|
55
|
-
{
|
56
|
-
text: I18n.t("system"),
|
57
|
-
icon: icon_hack(:wrench),
|
58
|
-
style: "",
|
59
|
-
menu: [
|
60
|
-
:import_type_view,
|
61
|
-
:user_view,
|
62
|
-
:api_auth_view,
|
63
|
-
],
|
64
|
-
}
|
65
|
-
end
|
66
|
-
|
67
|
-
def applications_menu
|
68
|
-
{
|
69
|
-
text: I18n.t("applications"),
|
70
|
-
icon: icon_hack(:application_cascade),
|
71
|
-
menu: [
|
72
|
-
:reporting,
|
73
|
-
:scripting,
|
74
|
-
:data_import_view,
|
75
|
-
:promise_view,
|
76
|
-
],
|
77
|
-
}
|
78
|
-
end
|
79
|
-
|
80
|
-
def ident_menu
|
81
|
-
'<span style="color:#B32D15; font-size:150%; font-weight:bold;">' +
|
82
|
-
'Marty</span>'
|
83
|
-
end
|
84
|
-
|
85
|
-
def data_menus
|
86
|
-
[]
|
87
|
-
end
|
88
|
-
|
89
|
-
def menu
|
90
|
-
return super unless self.class.has_any_perm?
|
91
|
-
|
92
|
-
[ident_menu, sep] +
|
93
|
-
(self.class.has_admin_perm? ||
|
94
|
-
self.class.has_user_manager_perm? ? [system_menu, sep] : []) +
|
95
|
-
data_menus +
|
96
|
-
[
|
97
|
-
applications_menu, sep,
|
98
|
-
posting_menu, sep,
|
99
|
-
] + super
|
100
|
-
end
|
101
|
-
|
102
|
-
######################################################################
|
103
|
-
|
104
|
-
action :import_type_view do |a|
|
105
|
-
a.text = I18n.t("import_type")
|
106
|
-
a.handler = :netzke_load_component_by_action
|
107
|
-
a.disabled = !self.class.has_admin_perm?
|
108
|
-
a.icon = :table_go
|
109
|
-
end
|
110
|
-
|
111
|
-
action :scripting do |a|
|
112
|
-
a.text = I18n.t("scripting")
|
113
|
-
a.handler = :netzke_load_component_by_action
|
114
|
-
a.icon = :script
|
115
|
-
a.disabled = !self.class.has_any_perm?
|
116
|
-
end
|
117
|
-
|
118
|
-
action :reporting do |a|
|
119
|
-
a.text = I18n.t("reports")
|
120
|
-
a.handler = :netzke_load_component_by_action
|
121
|
-
a.icon = :page_lightning
|
122
|
-
a.disabled = !self.class.has_any_perm?
|
123
|
-
end
|
124
|
-
|
125
|
-
action :promise_view do |a|
|
126
|
-
a.text = I18n.t("jobs.promise_view")
|
127
|
-
a.handler = :netzke_load_component_by_action
|
128
|
-
a.icon = :report_magnify
|
129
|
-
a.disabled = !self.class.has_any_perm?
|
130
|
-
end
|
131
|
-
|
132
|
-
action :data_import_view do |a|
|
133
|
-
a.text = I18n.t("data_import_view.import_data")
|
134
|
-
a.handler = :netzke_load_component_by_action
|
135
|
-
a.icon = :database_go
|
136
|
-
a.disabled = Marty::Util.warped? || !self.class.has_data_import_perm?
|
137
|
-
end
|
138
|
-
|
139
|
-
action :user_view do |a|
|
140
|
-
a.text = I18n.t("user_view")
|
141
|
-
a.handler = :netzke_load_component_by_action
|
142
|
-
a.icon = :group
|
143
|
-
a.disabled = !self.class.has_admin_perm? &&
|
144
|
-
!self.class.has_user_manager_perm?
|
145
|
-
end
|
146
|
-
|
147
|
-
action :api_auth_view do |a|
|
148
|
-
a.text = I18n.t("api_auth_view", default: "API Authorization")
|
149
|
-
a.handler = :netzke_load_component_by_action
|
150
|
-
a.icon = :script_key
|
151
|
-
a.disabled = !self.class.has_admin_perm?
|
152
|
-
end
|
153
|
-
|
154
|
-
######################################################################
|
155
|
-
# Postings
|
156
|
-
|
157
|
-
action :new_posting do |a|
|
158
|
-
a.text = I18n.t('new_posting')
|
159
|
-
a.tooltip = I18n.t('new_posting')
|
160
|
-
a.icon = :time_add
|
161
|
-
a.disabled = Marty::Util.warped? || !self.class.has_posting_perm?
|
162
|
-
end
|
163
|
-
|
164
|
-
js_configure do |c|
|
165
|
-
c.on_new_posting = <<-JS
|
166
|
-
function(params) {
|
167
|
-
this.netzkeLoadComponent({
|
168
|
-
name: "new_posting_window",
|
169
|
-
callback: function(w) { w.show(); },
|
170
|
-
});
|
171
|
-
}
|
172
|
-
JS
|
173
|
-
|
174
|
-
c.on_select_posting = <<-JS
|
175
|
-
function(params) {
|
176
|
-
this.netzkeLoadComponent({
|
177
|
-
name: "posting_window",
|
178
|
-
callback: function(w) { w.show(); },
|
179
|
-
});
|
180
|
-
}
|
181
|
-
JS
|
182
|
-
|
183
|
-
c.on_reload = <<-JS
|
184
|
-
function(params) {
|
185
|
-
window.location.reload();
|
186
|
-
}
|
187
|
-
JS
|
188
|
-
|
189
|
-
c.on_select_now = <<-JS
|
190
|
-
function(params) {
|
191
|
-
this.serverSelectPosting({});
|
192
|
-
}
|
193
|
-
JS
|
194
|
-
end
|
195
|
-
|
196
|
-
action :select_posting do |a|
|
197
|
-
a.text = I18n.t('select_posting')
|
198
|
-
a.tooltip = I18n.t('select_posting')
|
199
|
-
a.icon = :timeline_marker
|
200
|
-
end
|
201
|
-
|
202
|
-
endpoint :server_select_posting do |params, this|
|
203
|
-
sid = params && params[0]
|
204
|
-
Marty::Util.set_posting_id(sid)
|
205
|
-
posting = sid && Marty::Posting.find(sid)
|
206
|
-
|
207
|
-
this.netzke_feedback "Selected '#{posting ? posting.name : 'NOW'}'"
|
208
|
-
this.on_reload 1
|
209
|
-
end
|
210
|
-
|
211
|
-
action :select_now do |a|
|
212
|
-
a.text = I18n.t('go_to_now')
|
213
|
-
a.icon = :arrow_in
|
214
|
-
a.disabled = Marty::Util.get_posting_time == Float::INFINITY
|
215
|
-
end
|
216
|
-
|
217
|
-
######################################################################
|
218
|
-
|
219
|
-
component :scripting do |c|
|
220
|
-
c.allow_edit = self.class.has_scripting_perm?
|
221
|
-
end
|
222
|
-
component :reporting
|
223
|
-
component :promise_view
|
224
|
-
component :posting_window
|
225
|
-
component :new_posting_window do |c|
|
226
|
-
c.disabled = Marty::Util.warped? || !self.class.has_posting_perm?
|
227
|
-
end
|
228
|
-
component :import_type_view
|
229
|
-
component :data_import_view do |c|
|
230
|
-
c.disabled = Marty::Util.warped? || !self.class.has_data_import_perm?
|
231
|
-
end
|
232
|
-
component :user_view
|
233
|
-
component :api_auth_view do |c|
|
234
|
-
c.disabled = Marty::Util.warped?
|
235
|
-
end
|
236
|
-
end
|
237
|
-
|
238
|
-
MainAuthApp = Marty::MainAuthApp
|