marty 1.0.5 → 1.0.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b3706e10b3963927d93e8fe86eb70aa4b78e05cb
4
- data.tar.gz: 9aaa8850f9ae36f04d4e1199f5514a6a20f1bba4
3
+ metadata.gz: 8f1288f6cc23a26347fad541903d5f7df4c62c2e
4
+ data.tar.gz: b70b8b6df1ce3eab6720bddeed11f622b17421d7
5
5
  SHA512:
6
- metadata.gz: 52d297b24f77a152fafbad2bd27af1b1053b31862b9262d611f427984184e344878194b73e9da811667df30a7e880a30cf51fe359218f1fa6c7ada97c567fa25
7
- data.tar.gz: fbe6d7c752d6adcd8c83657c983d18c05701d63bb99d0bb12f6af40469796d5f1bfc334957d8237b891f25203ec2b19e1294f7caef6dfbad65518780e88a9b49
6
+ metadata.gz: fb4e5bf0e6dea87587dd93ae9d0a7bc78e65a425d64b3b8ba41a408df519d3ccb4d036f3d74570ba8d674d8514a74e4bb88c1569309a7e41a6756e8482882cb9
7
+ data.tar.gz: 762ca965e66e6f65d15a9ad713a2614c75dd7cee37669a94851be394260d0f40425da78462cd326fc36107ffaadd371845e92bae0c9124635828b44f84446702
@@ -39,19 +39,14 @@ class Marty::AuthApp < Marty::SimpleApp
39
39
 
40
40
  endpoint :sign_in do |params|
41
41
  user = Marty::User.try_to_login(params[:login], params[:password])
42
- if user
43
- Netzke::Base.controller.set_user(user)
44
- client.netzke_set_result(true)
45
- true
46
- else
47
- client.netzke_set_result(false)
42
+ user ? Netzke::Base.controller.set_user(user) :
48
43
  client.netzke_notify("Wrong credentials")
49
- false
50
- end
44
+
45
+ !!user
51
46
  end
52
47
 
53
48
  endpoint :sign_out do
54
49
  Netzke::Base.controller.logout_user
55
- client.netzke_set_result(true)
50
+ true
56
51
  end
57
52
  end
@@ -55,6 +55,22 @@ module Marty
55
55
  },
56
56
  } + options
57
57
  end
58
+
59
+ ######################################################################
60
+ # PG ENUM field handling
61
+
62
+ def enum_column(c, klass)
63
+ editor_config = {
64
+ trigger_action: :all,
65
+ xtype: :combo,
66
+ store: klass::VALUES,
67
+ }
68
+ c.merge!(
69
+ column_config: { editor: editor_config },
70
+ field_config: editor_config,
71
+ type: :string,
72
+ )
73
+ end
58
74
  end
59
75
  end
60
76
  end
@@ -162,9 +162,8 @@ class Marty::ScriptForm < Marty::Form
162
162
 
163
163
  if script.save
164
164
  client.netzke_set_form_values(js_record_data)
165
- client.netzke_set_result(true)
166
165
  client.refresh_parent(script.name)
167
- return
166
+ return true
168
167
  end
169
168
 
170
169
  client.netzke_notify(model_adapter.errors_array(script).join("\n"))
@@ -1,4 +1,6 @@
1
1
  class Marty::ApplicationController < ActionController::Base
2
+ layout 'marty/application'
3
+
2
4
  protect_from_forgery
3
5
 
4
6
  # Marty's ApplicationController is based on Redmine's
@@ -0,0 +1,10 @@
1
+ module Marty::PgEnum
2
+ def [](index)
3
+ index = index.to_s
4
+
5
+ raise "no such #{self.name}: '#{index}'" unless
6
+ self::VALUES.include?(index)
7
+
8
+ index
9
+ end
10
+ end
@@ -68,6 +68,7 @@ class Marty::User < Marty::Base
68
68
  ldap = Net::LDAP.new(host: cf.host,
69
69
  port: cf.port,
70
70
  base: cf.base_dn,
71
+ encryption: cf.encryption,
71
72
  auth: {
72
73
  method: :simple,
73
74
  username: cf.domain + "\\" + login,
@@ -3,7 +3,7 @@
3
3
  <head>
4
4
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
5
5
  <title><%= Rails.application.class.parent %></title>
6
- <%= load_netzke theme: "classic" %>
6
+ <%= load_netzke theme: Rails.configuration.marty.extjs_theme %>
7
7
  <%= csrf_meta_tag %>
8
8
  </head>
9
9
  <body>
@@ -25,6 +25,7 @@ class Marty::DataConversion
25
25
  :float_array,
26
26
  :json,
27
27
  :jsonb,
28
+ :enum,
28
29
  ]
29
30
 
30
31
  def self.convert(v, type)
@@ -39,11 +40,11 @@ class Marty::DataConversion
39
40
  case type
40
41
  when :boolean
41
42
  case v.to_s.downcase
42
- when "true", "1", "y" then true
43
- when "false", "0", "n" then false
43
+ when "true", "1", "y", "t" then true
44
+ when "false", "0", "n", "f" then false
44
45
  else raise "unknown boolean: #{v.inspect}"
45
46
  end
46
- when :string, :text
47
+ when :string, :text, :enum
47
48
  v
48
49
  when :integer
49
50
  v.to_i
@@ -83,7 +84,7 @@ class Marty::DataConversion
83
84
  # key for regular (non-mcfly) AR models which don't have
84
85
  # MARTY_IMPORT_UNIQUENESS.
85
86
  klass.const_get(:MARTY_IMPORT_UNIQUENESS) rescue [
86
- klass.attribute_names.reject{|x| x=="id"}.first.to_sym]
87
+ klass.column_names.reject{|x| x=="id"}.first.to_sym]
87
88
  end
88
89
 
89
90
  @@associations = {}
data/lib/marty/monkey.rb CHANGED
@@ -151,3 +151,18 @@ module Netzke::Basepack::DataAdapters
151
151
 
152
152
  end
153
153
  end
154
+
155
+ ######################################################################
156
+
157
+ # Add pg_enum migration support -- FIXME: this doesn't belong here
158
+ module ActiveRecord
159
+ module ConnectionAdapters
160
+ class TableDefinition
161
+ def pg_enum(*args)
162
+ options = args.extract_options!
163
+ column_names = args
164
+ column_names.each { |name| column(name, name.to_s.pluralize, options) }
165
+ end
166
+ end
167
+ end
168
+ end
data/lib/marty/railtie.rb CHANGED
@@ -2,5 +2,6 @@ module Marty
2
2
  class Railtie < Rails::Railtie
3
3
  config.marty = ActiveSupport::OrderedOptions.new
4
4
  config.marty.default_posting_type = 'BASE'
5
+ config.marty.extjs_theme = 'classic'
5
6
  end
6
7
  end
data/lib/marty/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Marty
2
- VERSION = "1.0.5"
2
+ VERSION = "1.0.6"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: marty
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.5
4
+ version: 1.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Arman Bostani
@@ -14,7 +14,7 @@ authors:
14
14
  autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
- date: 2016-07-19 00:00:00.000000000 Z
17
+ date: 2016-08-24 00:00:00.000000000 Z
18
18
  dependencies:
19
19
  - !ruby/object:Gem::Dependency
20
20
  name: pg
@@ -389,6 +389,7 @@ files:
389
389
  - app/models/marty/grid_index_string.rb
390
390
  - app/models/marty/import_type.rb
391
391
  - app/models/marty/name_validator.rb
392
+ - app/models/marty/pg_enum.rb
392
393
  - app/models/marty/posting.rb
393
394
  - app/models/marty/posting_type.rb
394
395
  - app/models/marty/promise.rb