egov_utils 0.1.35 → 0.1.36

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
  SHA256:
3
- metadata.gz: 9c4dbda3371757f34c4093f2e58f05ba21c6750c567d27962577f6002aa894b6
4
- data.tar.gz: a43a27f761857247f2b001225dc2a8222a47e317d870fef7ace360ec0e3b682f
3
+ metadata.gz: 12177424f9e5b32b50bc77598353a6615cdcf2cc743b336b01e3c6c2d3dcd220
4
+ data.tar.gz: 47fbc3010fb1a9366236e4a857aff8f557d6cfee1ea7c8b1eb85ddf07c4222c9
5
5
  SHA512:
6
- metadata.gz: 68e8a489421ebaca129737565cc70f0c0f2a5c4a03bbc8a6b62c623f1ad425acf2e553127aaf03e90f81a320a055ce6499b71936d7207fa3a213108f19643f0a
7
- data.tar.gz: 57b1603c7b2f9e99a91deb4da0faa5f9d10c5e3a84d05b473221488d5267884530251dcf526b4d9cbca9a0c446a717856c6d12b8f5a357be3e961c119993aeec
6
+ metadata.gz: 644a5bfbf7f770bd60fd33c0d28a4a5b90c7fb79e40c343d2191aca3670d6bfe5408ba15cb80e0a2096b44a1e765b3f623d5b5d9b00434203d2228a9c9a53925
7
+ data.tar.gz: 356721469b453f6c011e324bf5084171b42a9b418b19256a3fde5f339c1cf780e03f14fd4686ef9057c71ea4442820535d8d0a070e05f9aada2e3e6350c91cd2
@@ -4,3 +4,7 @@
4
4
  @import 'egov_utils/select2-bootstrap';
5
5
 
6
6
  @import "cookies_eu";
7
+
8
+ .button_to {
9
+ display: inline-block;
10
+ }
@@ -5,6 +5,10 @@ module EgovUtils
5
5
 
6
6
  load_and_authorize_resource
7
7
 
8
+ def index
9
+ @groups = EgovUtils::Group.accessible_by(current_ability)
10
+ end
11
+
8
12
  def create
9
13
  respond_to do |format|
10
14
  if @group.save
@@ -6,10 +6,13 @@ module EgovUtils
6
6
 
7
7
  skip_before_action :require_login, only: [:new, :create, :confirm]
8
8
 
9
- load_and_authorize_resource only: :index
9
+ authorize_resource only: :index
10
+ load_and_authorize_resource only: :destroy
10
11
 
11
12
  def index
12
13
  providers
14
+ @users = EgovUtils::User.accessible_by(current_ability).order(:provider)
15
+ @groups = EgovUtils::Group.accessible_by(current_ability).order(:provider)
13
16
  end
14
17
 
15
18
  def new
@@ -39,6 +42,11 @@ module EgovUtils
39
42
  def show
40
43
  end
41
44
 
45
+ def destroy
46
+ @user.destroy
47
+ redirect_to users_path, notice: t('activerecord.successful.messages.destroyed', model: User.model_name.human)
48
+ end
49
+
42
50
  def approve
43
51
  @user = User.find_by(id: params[:id])
44
52
  render_404 and return unless @user || @user.active?
@@ -0,0 +1,20 @@
1
+ %table#groups.table
2
+ %thead
3
+ %tr
4
+ %th= EgovUtils::Group.human_attribute_name('name')
5
+ %th= EgovUtils::Group.human_attribute_name('provider')
6
+ %th= EgovUtils::Group.human_attribute_name('roles')
7
+ %tbody
8
+ - groups.each do |group|
9
+ %tr
10
+ %td= group.name
11
+ %td= group.provider
12
+ - if can?(:manage, group)
13
+ %td.roles{data: {roles: group.roles, id: group.id}}= group.roles.join(', ')
14
+ - else
15
+ %td
16
+
17
+ :javascript
18
+ $(function(){
19
+ $('#groups tbody').roles({ url: '#{roles_path(entity_class: 'EgovUtils::Group')}' });
20
+ });
@@ -0,0 +1,21 @@
1
+ %ul.nav.nav-tabs{role: 'tablist'}
2
+ %li.nav-item
3
+ = link_to(EgovUtils::User.model_name.human(count: :other), users_path, id: 'users_tab', class: 'nav-link', 'data-toggle'=>'tab', 'aria-controls'=>'users_container')
4
+ %li.nav-item
5
+ = link_to(EgovUtils::Group.model_name.human(count: :other), groups_path, id: 'groups_tab', class: 'nav-link active', 'data-toggle'=>'tab', 'aria-controls'=>'groups_container')
6
+
7
+ .tab-content
8
+ #users_container.tab-pane.fade{role: 'tabpanel', 'aria-labelledby'=>'users_tab'}
9
+ = render 'egov_utils/users/users_tab', users: @users
10
+ #groups_container.tab-pane.fade.show.active{role: 'tabpanel', 'aria-labelledby'=>'groups_tab'}
11
+ = render 'egov_utils/groups/groups_tab', groups: @groups
12
+ #create_container.tab-pane.fade{role: 'tabpanel', 'aria-labelledby'=>'create_tab'}
13
+ %h3= t('label_ldap')
14
+ = render 'egov_utils/users/ldap_search'
15
+ %h3= t('label_new')
16
+ = bootstrap_form_for(EgovUtils::User.new) do |f|
17
+ = render 'egov_utils/users/form', form: f
18
+
19
+ $.ajax('url').done(function(response){
20
+ $('#cast-2-rizeni-pred-soudem-prvniho-stupne').html(response);
21
+ });
@@ -0,0 +1,51 @@
1
+ = bootstrap_form_for(:search, url: search_users_path(format: :json), html: {id: 'user_search_form'}) do |f|
2
+ = f.text_field(:q, id: 'search_q', label: {text: t('label_search'), class: 'sr-only'}, placeholder: t('label_search'))
3
+ = f.submit t('label_search')
4
+
5
+ %table.table#users_results
6
+ %thead
7
+ %tr
8
+ %th= EgovUtils::User.human_attribute_name('login')
9
+ %th= EgovUtils::User.human_attribute_name('fullname')
10
+ %th= t(:label_actions)
11
+ %tbody
12
+ %table.table#groups_results
13
+ %thead
14
+ %tr
15
+ %th= EgovUtils::Group.human_attribute_name('name')
16
+ %th= t(:label_actions)
17
+ %tbody
18
+
19
+ :javascript
20
+ $('#user_search_form').on('submit', function(evt) {
21
+ evt.preventDefault();
22
+ $form = $(this);
23
+ $.ajax(this.action, {method: 'GET', data: {q: $('#search_q').val()}}).done(function(data, status, xhr){
24
+ $.each(['users', 'groups'], function(i, type) {
25
+ var tbl = $('#'+type+'_results tbody');
26
+ tbl.html('');
27
+ $.each(data[type], function(i, entity_data) {
28
+ var str, data_key, path, req_data;
29
+ if( type == 'users' ) {
30
+ str = '<td title="'+entity_data.dn.replace(/"/g, "&quot;")+'">'+entity_data.login+'</td><td>'+entity_data.firstname + ' ' + entity_data.lastname +'</td>';
31
+ req_data = {user: entity_data};
32
+ path = '#{users_path(format: :json)}';
33
+ } else {
34
+ str = '<td title="'+entity_data.dn.replace(/"/g, "&quot;")+'">'+entity_data.name+'</td>';
35
+ req_data = {group: entity_data};
36
+ path = '#{groups_path(format: :json)}';
37
+ }
38
+
39
+ $('<tr>' + str + '<td><button class="btn btn-primary add-button">Add</button></td></tr>').
40
+ appendTo(tbl).on('click', '.add-button', function(evt){
41
+ evt.preventDefault();
42
+ $(this).prop('disabled', true);
43
+ $.ajax(path, {method: 'POST', data: req_data}).done(function(addData, textStatus){
44
+ window.location.reload();
45
+ });
46
+ });
47
+ });
48
+ });
49
+ $form.find('input[type="submit"]').prop('disabled', false);
50
+ });
51
+ });
@@ -0,0 +1,25 @@
1
+ %table.table#users
2
+ %thead
3
+ %tr
4
+ %th= t('model_attributes.user.fullname')
5
+ %th= EgovUtils::User.human_attribute_name('roles')
6
+ %th= EgovUtils::User.human_attribute_name('provider')
7
+ %th= t('label_actions')
8
+ %tbody
9
+ - users.each do |user|
10
+ %tr
11
+ %td= user.fullname
12
+ %td= user.provider
13
+ - if can?(:manage, user)
14
+ %td.roles{data: {roles: user.roles, id: user.id}}= user.roles.join(', ')
15
+ - else
16
+ %td
17
+ %td
18
+ = button_to(t('label_delete'), user_path(user), method: :delete, class: 'btn btn-warning btn-sm')
19
+ - unless user.active?
20
+ = button_to(t('label_approve'), approve_user_path(user), class: 'btn btn-primary btn-sm')
21
+
22
+ :javascript
23
+ $(function(){
24
+ $('#users tbody').roles({ url: '#{roles_path(entity_class: 'EgovUtils::User')}' });
25
+ });
@@ -1,62 +1,26 @@
1
- = bootstrap_form_for(:search, url: search_users_path(format: :json), html: {id: 'user_search_form'}) do |f|
2
- = f.text_field(:q, id: 'search_q')
3
- = f.submit
1
+ %ul.nav.nav-tabs{role: 'tablist'}
2
+ %li.nav-item
3
+ = link_to(EgovUtils::User.model_name.human(count: :other), '#users_container', id: 'users_tab', class: 'nav-link active', 'data-toggle'=>'tab', 'aria-controls'=>'users_container')
4
+ %li.nav-item
5
+ = link_to(EgovUtils::Group.model_name.human(count: :other), '#groups_container', id: 'groups_tab', class: 'nav-link', 'data-toggle'=>'tab', 'aria-controls'=>'groups_container')
6
+ %li.nav-item.dropdown
7
+ %a.nav-link.dropdown-toggle{'data-toggle'=>'dropdown', 'href'=>'#', 'role'=>'button'}
8
+ = t('label_new')
9
+ .dropdown-menu
10
+ = link_to(t('label_new'), '#create', id: 'create_tab', class: 'dropdown-item', 'data-toggle'=>'tab', 'aria-controls'=>'create')
11
+ = link_to(t('label_ldap'), '#create_ldap', id: 'create_tab', class: 'dropdown-item', 'data-toggle'=>'tab', 'aria-controls'=>'create_ldap')
4
12
 
5
- %table.table#users_results
6
- %thead
7
- %tr
8
- %th= EgovUtils::User.human_attribute_name('login')
9
- %th= EgovUtils::User.human_attribute_name('fullname')
10
- %th= t(:label_actions)
11
- %tbody
12
- %table.table#groups_results
13
- %thead
14
- %tr
15
- %th= EgovUtils::Group.human_attribute_name('name')
16
- %th= t(:label_actions)
17
- %tbody
18
-
19
- %h5= EgovUtils::User.model_name.human(count: :other)
20
- %table.table#users
21
- %thead
22
- %tr
23
- %th= t('model_attributes.user.fullname')
24
- %th Akce
25
- %tbody
26
- - EgovUtils::User.all.each do |user|
27
- %tr
28
- %td= user.fullname
29
- %td
30
- - unless user.active?
31
- = button_to(t('label_approve'), approve_user_path(user), class: 'btn btn-primary btn-sm')
32
-
33
- :javascript
34
- $('#user_search_form').on('submit', function(evt) {
35
- evt.preventDefault();
36
- $form = $(this);
37
- $.ajax(this.action, {method: 'GET', data: {q: $('#search_q').val()}}).done(function(data, status, xhr){
38
- $.each(['users', 'groups'], function(i, type) {
39
- var tbl = $('#'+type+'_results tbody');
40
- tbl.html('');
41
- $.each(data[type], function(i, entity_data) {
42
- var str, data_key, path, req_data;
43
- if( type == 'users' ) {
44
- str = '<td title="'+entity_data.dn.replace(/"/g, "&quot;")+'">'+entity_data.login+'</td><td>'+entity_data.firstname + ' ' + entity_data.lastname +'</td>';
45
- req_data = {user: entity_data};
46
- path = '#{users_path(format: :json)}';
47
- } else {
48
- str = '<td title="'+entity_data.dn.replace(/"/g, "&quot;")+'">'+entity_data.name+'</td>';
49
- req_data = {group: entity_data};
50
- path = '#{groups_path(format: :json)}';
51
- }
52
-
53
- $('<tr>' + str + '<td><button class="btn btn-primary add-button">Add</button></td></tr>').
54
- appendTo(tbl).on('click', '.add-button', function(evt){
55
- evt.preventDefault();
56
- $.ajax(path, {method: 'POST', data: req_data});
57
- });
58
- });
59
- });
60
- $form.find('input[type="submit"]').prop('disabled', false);
61
- });
62
- });
13
+ .tab-content
14
+ #users_container.tab-pane.fade.show.active{role: 'tabpanel', 'aria-labelledby'=>'users_tab'}
15
+ = render 'egov_utils/users/users_tab', users: @users
16
+ #groups_container.tab-pane.fade{role: 'tabpanel', 'aria-labelledby'=>'groups_tab'}
17
+ = render 'egov_utils/groups/groups_tab', groups: @groups
18
+ #create_ldap.tab-pane.fade{role: 'tabpanel', 'aria-labelledby'=>'create_tab'}
19
+ %h3= t('label_ldap')
20
+ = render 'egov_utils/users/ldap_search'
21
+ #create.tab-pane.fade{role: 'tabpanel', 'aria-labelledby'=>'create_tab'}
22
+ %h3= t('label_new')
23
+ = bootstrap_form_for(EgovUtils::User.new) do |f|
24
+ = render 'egov_utils/users/form', form: f
25
+ .form-actions
26
+ = f.submit
@@ -21,7 +21,7 @@ cs:
21
21
  notice_account_pending: Váš účet čeká na schválení/ověření
22
22
  notice_account_locked: Váš účet byl uzamčen správcem aplikace
23
23
  notice_logout: Byl/a jste úspěšně odhlášen/a
24
- notice_signeup_with_mail: Registrace proběhla úspěšně, byl Vám odeslán potvrovací e-mail, prosím zkontrolujte svou poštu.
24
+ notice_signeup_with_mail: Registrace proběhla úspěšně, byl Vám odeslán potvrzovací e-mail, prosím zkontrolujte svou poštu.
25
25
  success_user_confirm: Váše e-mailová adresa byla potvrzena. Nyní se již můžete přihlásit.
26
26
 
27
27
  label_approve: Schválit
@@ -33,6 +33,10 @@ cs:
33
33
  label_signup: Registrovat
34
34
  label_validate_address: Zvalidovat
35
35
  label_save: Uložit
36
+ label_ldap: LDAP
37
+ label_search: Vyhledat
38
+ label_delete: Smazat
39
+ label_actions: Akce
36
40
 
37
41
  text_born_on_at: "Narozen %{date} v %{place}"
38
42
 
@@ -60,6 +64,9 @@ cs:
60
64
  firstname: Jméno
61
65
  lastname: Příjmení
62
66
  fullname: Jméno a příjmení
67
+ roles: Role
68
+ egov_utils/group:
69
+ roles: Role
63
70
  egov_utils/address:
64
71
  full_address: Adresa
65
72
  street: Ulice
@@ -109,6 +116,7 @@ cs:
109
116
  messages:
110
117
  created: "%{model} úspěšně vytvořen"
111
118
  updated: "%{model} úspěšně aktualizován"
119
+ destroyed: "%{model} úspěšně smazán"
112
120
 
113
121
  helpers:
114
122
  label:
@@ -1,3 +1,3 @@
1
1
  module EgovUtils
2
- VERSION = '0.1.35'
2
+ VERSION = '0.1.36'
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.35
4
+ version: 0.1.36
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-12-21 00:00:00.000000000 Z
11
+ date: 2018-01-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -400,12 +400,16 @@ files:
400
400
  - app/views/common/_grid.html.coffee
401
401
  - app/views/common/_modal.html.haml
402
402
  - app/views/egov_utils/addresses/_form.html.haml
403
+ - app/views/egov_utils/groups/_groups_tab.html.haml
404
+ - app/views/egov_utils/groups/index.html.haml
403
405
  - app/views/egov_utils/people/_form.html.haml
404
406
  - app/views/egov_utils/roles/index.html.haml
405
407
  - app/views/egov_utils/sessions/new.html.haml
406
408
  - app/views/egov_utils/user_mailer/confirmation_email.html.erb
407
409
  - app/views/egov_utils/user_mailer/confirmation_email.text.erb
408
410
  - app/views/egov_utils/users/_form.html.haml
411
+ - app/views/egov_utils/users/_ldap_search.html.haml
412
+ - app/views/egov_utils/users/_users_tab.html.haml
409
413
  - app/views/egov_utils/users/index.html.haml
410
414
  - app/views/egov_utils/users/new.html.haml
411
415
  - app/views/egov_utils/users/show.html.haml
@@ -574,7 +578,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
574
578
  version: '0'
575
579
  requirements: []
576
580
  rubyforge_project:
577
- rubygems_version: 2.7.3
581
+ rubygems_version: 2.7.4
578
582
  signing_key:
579
583
  specification_version: 4
580
584
  summary: The eGoverment utilities is set of functionalities to support basic eGoverment