egov_utils 0.1.1 → 0.1.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6d74f8b976917e6e27ddfecb2b91a24185dc64f4
4
- data.tar.gz: b5ce2d00d6f31e0b76f95dad6e416e2186628f1f
3
+ metadata.gz: 0f63fa0be85c1b24f142e25d3ba88b06aa28746c
4
+ data.tar.gz: f591df909e11cc230e68a12c51a2a8324db9dd9d
5
5
  SHA512:
6
- metadata.gz: bc8a67ce2ec2c32b531ee09dc582a67afd6006616b84db51cdb7d8a3d0b423f28b3dc9316400222c005721b1a1fd63a169e13a33eba208d858d7351cf60a68d4
7
- data.tar.gz: 06525e21828e994275fd08bd39073bd1cdf92528fdc9e6c8a767dc4d94a80cb023baa86024b9a10bad5eb5392ab17916ed3390544ba44dd1dd1fcd8367010283
6
+ metadata.gz: 54147634748dbca9e1c632fb0a7be76663a5b7295e14180d26d9eaa99926a4f953ee063132ad29da18b1e64c4c1edae46e25df6e193f181b728c571edbc05581
7
+ data.tar.gz: 36ef6a4509dd5173c9027c4585341a33701992bf1ba7df49fd4371de8baf8d6a401d0557e648bafc926d1e13de344bb45002dae4a3ad5d7c30c30f67efcf9ed1
@@ -0,0 +1,15 @@
1
+ module EgovUtils
2
+ class Fullname < AzaharaSchema::Attribute
3
+
4
+ def arel_field
5
+ Arel::Nodes::NamedFunction.new 'CONCAT', [EgovUtils::Person.arel_table[:lastname], Arel::Nodes::SqlLiteral.new('\' \'') , EgovUtils::Person.arel_table[:firstname]]
6
+ end
7
+
8
+ def build_json_options!(options)
9
+ options[:methods] ||= []
10
+ options[:methods] << 'fullname'
11
+ options
12
+ end
13
+
14
+ end
15
+ end
@@ -66,7 +66,7 @@ module EgovUtils
66
66
  def onthefly_creation_failed(user, provider_info={})
67
67
  logger.warn "Failed onthefly_creation for '#{user.login}' (provider '#{user.provider}') from #{request.remote_ip} at #{Time.now.utc}"
68
68
  flash[:error] = t(:notice_onthefly_failure)
69
- redirect_to redirect_path
69
+ redirect_to signin_path
70
70
  end
71
71
 
72
72
  def account_pending(user, redirect_path=signin_path)
@@ -1,9 +1,9 @@
1
1
  begin
2
2
  require_dependency "#{Rails.application.class.parent_name.underscore}/roles"
3
3
  rescue LoadError => e
4
- Rails.logger.warning "!! You have not defined roles."
5
- Rails.logger.warning "!! Please define it in lib/#{Rails.application.class.parent_name.underscore}/roles."
6
- Rails.logger.warning "!! EgovUtils roles management will not work without it."
4
+ Rails.logger.warn "!! You have not defined roles."
5
+ Rails.logger.warn "!! Please define it in lib/#{Rails.application.class.parent_name.underscore}/roles."
6
+ Rails.logger.warn "!! EgovUtils roles management will not work without it."
7
7
  end
8
8
 
9
9
  class Ability
@@ -1,6 +1,9 @@
1
1
  module EgovUtils
2
2
  class Person < ApplicationRecord
3
3
 
4
+ validates :firstname, :lastname, :birth_date, presence: true
5
+ validates :birth_date, uniqueness: { scope: [:firstname, :lastname] }
6
+
4
7
  def fullname
5
8
  firstname.to_s + ' ' + lastname.to_s
6
9
  end
@@ -0,0 +1,15 @@
1
+ module EgovUtils
2
+ class PersonSchema < AzaharaSchema::ModelSchema
3
+
4
+ def main_attribute_name
5
+ 'fullname'
6
+ end
7
+
8
+ def initialize_available_attributes
9
+ @available_attributes ||= []
10
+ @available_attributes << Fullname.new(model, 'fullname', 'string')
11
+ super
12
+ end
13
+
14
+ end
15
+ end
@@ -2,6 +2,7 @@ $ ->
2
2
  <%
3
3
  grid ||= schema.outputs.grid
4
4
  additional_params ||= {}
5
+ create_attributes ||= {}
5
6
  %>
6
7
 
7
8
  $('body').off 'egov:submitted'
@@ -11,7 +12,7 @@ $ ->
11
12
 
12
13
  <%# would be a bit cleaner to give the filled form to the shield grid create method, then send the form by ajax %>
13
14
  createRecord = (evt)->
14
- $.ajax('<%= new_polymorphic_path(schema.model, format: :js) %>')
15
+ $.ajax('<%= new_polymorphic_path(schema.model, create_attributes.merge(format: :js)) %>')
15
16
 
16
17
 
17
18
  editRecord = (index)->
@@ -10,9 +10,12 @@ cs:
10
10
  notice_logout: Byl/a jste úspěšně odhlášen/a
11
11
 
12
12
  label_approve: Schválit
13
+ label_new: Nový
14
+ label_edit: Upravit
13
15
 
14
16
  common_labels:
15
17
  new_record: "Nový %{model}"
18
+ notice_saved: "%{model} vytvořen"
16
19
 
17
20
 
18
21
 
@@ -169,6 +169,14 @@ module EgovUtils
169
169
  results
170
170
  end
171
171
 
172
+ def onthefly_register?
173
+ !!options['onthefly_register']
174
+ end
175
+
176
+ def register_members_only?
177
+ options['onthefly_register'] == 'members'
178
+ end
179
+
172
180
  private
173
181
  def with_timeout(&block)
174
182
  timeout = 20
@@ -192,14 +200,6 @@ module EgovUtils
192
200
  Net::LDAP.new options
193
201
  end
194
202
 
195
- def onthefly_register?
196
- !!options['onthefly_register']
197
- end
198
-
199
- def register_members_only?
200
- options['onthefly_register'] == 'members'
201
- end
202
-
203
203
  def get_user_attributes_from_ldap_entry(entry)
204
204
  {
205
205
  :dn => entry.dn,
@@ -1,3 +1,3 @@
1
1
  module EgovUtils
2
- VERSION = '0.1.1'
2
+ VERSION = '0.1.4'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: egov_utils
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ondřej Ezr
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-09-06 00:00:00.000000000 Z
11
+ date: 2017-09-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -178,20 +178,6 @@ dependencies:
178
178
  - - ">="
179
179
  - !ruby/object:Gem::Version
180
180
  version: '0'
181
- - !ruby/object:Gem::Dependency
182
- name: ladle
183
- requirement: !ruby/object:Gem::Requirement
184
- requirements:
185
- - - ">="
186
- - !ruby/object:Gem::Version
187
- version: '0'
188
- type: :development
189
- prerelease: false
190
- version_requirements: !ruby/object:Gem::Requirement
191
- requirements:
192
- - - ">="
193
- - !ruby/object:Gem::Version
194
- version: '0'
195
181
  description: We hope it will help create better systems for all the eGoverment. In
196
182
  Czech Republic and maybe further.
197
183
  email:
@@ -216,6 +202,7 @@ files:
216
202
  - app/assets/stylesheets/egov_utils/users.css
217
203
  - app/attributes/egov_utils/district.rb
218
204
  - app/attributes/egov_utils/full_address.rb
205
+ - app/attributes/egov_utils/fullname.rb
219
206
  - app/attributes/egov_utils/region.rb
220
207
  - app/controllers/egov_utils/addresses_controller.rb
221
208
  - app/controllers/egov_utils/application_controller.rb
@@ -240,6 +227,7 @@ files:
240
227
  - app/models/egov_utils/principal.rb
241
228
  - app/models/egov_utils/user.rb
242
229
  - app/schemas/egov_utils/address_schema.rb
230
+ - app/schemas/egov_utils/person_schema.rb
243
231
  - app/validators/email_validator.rb
244
232
  - app/validators/ico_validator.rb
245
233
  - app/views/common/_grid.html.coffee