chaltron 0.1.2 → 0.1.3
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 +4 -4
- data/README.md +22 -12
- data/Rakefile +3 -0
- data/app/assets/javascripts/chaltron/datatables.js.coffee +13 -16
- data/app/assets/javascripts/chaltron/datatables.js.coffee~ +106 -0
- data/app/assets/javascripts/chaltron.js +4 -4
- data/app/assets/javascripts/chaltron.js~ +13 -0
- data/app/assets/javascripts/dataTables/dataTables.bootstrap.min.js +8 -0
- data/app/assets/javascripts/dataTables/extras/dataTables.responsive.min.js +19 -0
- data/app/assets/javascripts/dataTables/extras/dataTables.select.min.js +23 -0
- data/app/assets/javascripts/dataTables/jquery.dataTables.min.js +163 -0
- data/app/assets/stylesheets/chaltron.scss +4 -4
- data/app/assets/stylesheets/dataTables/dataTables.bootstrap.css +167 -0
- data/app/assets/stylesheets/dataTables/extras/responsive.bootstrap.css +106 -0
- data/app/assets/stylesheets/dataTables/extras/select.dataTables.css +100 -0
- data/app/helpers/chaltron/ldap_helper.rb +3 -3
- data/app/helpers/chaltron_helper.rb +15 -0
- data/config/locales/en.yml +1 -0
- data/config/locales/it.yml +1 -0
- data/lib/chaltron/engine.rb +0 -1
- data/lib/chaltron/ldap/person.rb +1 -1
- data/lib/chaltron/version.rb +1 -1
- data/lib/generators/chaltron/templates/app/views/layouts/_footer.html.erb +10 -0
- data/lib/generators/chaltron/templates/app/views/layouts/application.html.erb +1 -0
- data/lib/templates/erb/scaffold/index.html.erb +1 -16
- data/lib/templates/erb/scaffold/index.html.erb~ +28 -0
- metadata +13 -31
- data/app/assets/stylesheets/chaltron/datatables.scss +0 -14
- data/app/assets/stylesheets/chaltron/layout.scss~ +0 -68
- data/app/controllers/chaltron/omniauth_callbacks_controller.rb~ +0 -34
- data/app/controllers/chaltron/users_controller.rb~ +0 -94
- data/app/models/user.rb~ +0 -28
- data/app/views/chaltron/users/index.html.erb~ +0 -48
- data/app/views/devise/sessions/_new_ldap.html.erb~ +0 -31
- data/app/views/devise/sessions/_new_local.html.erb~ +0 -20
- data/app/views/locales/en.yml~ +0 -91
- data/app/views/locales/it.yml~ +0 -91
- data/config/initializers/devise.rb~ +0 -256
- data/lib/chaltron/controllers/helpers.rb~ +0 -61
- data/lib/chaltron/engine.rb~ +0 -47
- data/lib/chaltron/ldap/user.rb~ +0 -88
- data/lib/chaltron/version.rb~ +0 -3
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
table.dataTable tbody > tr.selected,
|
|
2
|
+
table.dataTable tbody > tr > .selected {
|
|
3
|
+
background-color: #B0BED9;
|
|
4
|
+
}
|
|
5
|
+
table.dataTable.stripe tbody > tr.odd.selected,
|
|
6
|
+
table.dataTable.stripe tbody > tr.odd > .selected, table.dataTable.display tbody > tr.odd.selected,
|
|
7
|
+
table.dataTable.display tbody > tr.odd > .selected {
|
|
8
|
+
background-color: #acbad4;
|
|
9
|
+
}
|
|
10
|
+
table.dataTable.hover tbody > tr.selected:hover,
|
|
11
|
+
table.dataTable.hover tbody > tr > .selected:hover, table.dataTable.display tbody > tr.selected:hover,
|
|
12
|
+
table.dataTable.display tbody > tr > .selected:hover {
|
|
13
|
+
background-color: #aab7d1;
|
|
14
|
+
}
|
|
15
|
+
table.dataTable.order-column tbody > tr.selected > .sorting_1,
|
|
16
|
+
table.dataTable.order-column tbody > tr.selected > .sorting_2,
|
|
17
|
+
table.dataTable.order-column tbody > tr.selected > .sorting_3,
|
|
18
|
+
table.dataTable.order-column tbody > tr > .selected, table.dataTable.display tbody > tr.selected > .sorting_1,
|
|
19
|
+
table.dataTable.display tbody > tr.selected > .sorting_2,
|
|
20
|
+
table.dataTable.display tbody > tr.selected > .sorting_3,
|
|
21
|
+
table.dataTable.display tbody > tr > .selected {
|
|
22
|
+
background-color: #acbad5;
|
|
23
|
+
}
|
|
24
|
+
table.dataTable.display tbody > tr.odd.selected > .sorting_1, table.dataTable.order-column.stripe tbody > tr.odd.selected > .sorting_1 {
|
|
25
|
+
background-color: #a6b4cd;
|
|
26
|
+
}
|
|
27
|
+
table.dataTable.display tbody > tr.odd.selected > .sorting_2, table.dataTable.order-column.stripe tbody > tr.odd.selected > .sorting_2 {
|
|
28
|
+
background-color: #a8b5cf;
|
|
29
|
+
}
|
|
30
|
+
table.dataTable.display tbody > tr.odd.selected > .sorting_3, table.dataTable.order-column.stripe tbody > tr.odd.selected > .sorting_3 {
|
|
31
|
+
background-color: #a9b7d1;
|
|
32
|
+
}
|
|
33
|
+
table.dataTable.display tbody > tr.even.selected > .sorting_1, table.dataTable.order-column.stripe tbody > tr.even.selected > .sorting_1 {
|
|
34
|
+
background-color: #acbad5;
|
|
35
|
+
}
|
|
36
|
+
table.dataTable.display tbody > tr.even.selected > .sorting_2, table.dataTable.order-column.stripe tbody > tr.even.selected > .sorting_2 {
|
|
37
|
+
background-color: #aebcd6;
|
|
38
|
+
}
|
|
39
|
+
table.dataTable.display tbody > tr.even.selected > .sorting_3, table.dataTable.order-column.stripe tbody > tr.even.selected > .sorting_3 {
|
|
40
|
+
background-color: #afbdd8;
|
|
41
|
+
}
|
|
42
|
+
table.dataTable.display tbody > tr.odd > .selected, table.dataTable.order-column.stripe tbody > tr.odd > .selected {
|
|
43
|
+
background-color: #a6b4cd;
|
|
44
|
+
}
|
|
45
|
+
table.dataTable.display tbody > tr.even > .selected, table.dataTable.order-column.stripe tbody > tr.even > .selected {
|
|
46
|
+
background-color: #acbad5;
|
|
47
|
+
}
|
|
48
|
+
table.dataTable.display tbody > tr.selected:hover > .sorting_1, table.dataTable.order-column.hover tbody > tr.selected:hover > .sorting_1 {
|
|
49
|
+
background-color: #a2aec7;
|
|
50
|
+
}
|
|
51
|
+
table.dataTable.display tbody > tr.selected:hover > .sorting_2, table.dataTable.order-column.hover tbody > tr.selected:hover > .sorting_2 {
|
|
52
|
+
background-color: #a3b0c9;
|
|
53
|
+
}
|
|
54
|
+
table.dataTable.display tbody > tr.selected:hover > .sorting_3, table.dataTable.order-column.hover tbody > tr.selected:hover > .sorting_3 {
|
|
55
|
+
background-color: #a5b2cb;
|
|
56
|
+
}
|
|
57
|
+
table.dataTable.display tbody > tr:hover > .selected,
|
|
58
|
+
table.dataTable.display tbody > tr > .selected:hover, table.dataTable.order-column.hover tbody > tr:hover > .selected,
|
|
59
|
+
table.dataTable.order-column.hover tbody > tr > .selected:hover {
|
|
60
|
+
background-color: #a2aec7;
|
|
61
|
+
}
|
|
62
|
+
table.dataTable td.select-checkbox {
|
|
63
|
+
position: relative;
|
|
64
|
+
}
|
|
65
|
+
table.dataTable td.select-checkbox:before, table.dataTable td.select-checkbox:after {
|
|
66
|
+
display: block;
|
|
67
|
+
position: absolute;
|
|
68
|
+
top: 1.2em;
|
|
69
|
+
left: 50%;
|
|
70
|
+
width: 12px;
|
|
71
|
+
height: 12px;
|
|
72
|
+
box-sizing: border-box;
|
|
73
|
+
}
|
|
74
|
+
table.dataTable td.select-checkbox:before {
|
|
75
|
+
content: ' ';
|
|
76
|
+
margin-top: -6px;
|
|
77
|
+
margin-left: -6px;
|
|
78
|
+
border: 1px solid black;
|
|
79
|
+
border-radius: 3px;
|
|
80
|
+
}
|
|
81
|
+
table.dataTable tr.selected td.select-checkbox:after {
|
|
82
|
+
content: '\2714';
|
|
83
|
+
margin-top: -11px;
|
|
84
|
+
margin-left: -4px;
|
|
85
|
+
text-align: center;
|
|
86
|
+
text-shadow: 1px 1px #B0BED9, -1px -1px #B0BED9, 1px -1px #B0BED9, -1px 1px #B0BED9;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
div.dataTables_wrapper span.select-info,
|
|
90
|
+
div.dataTables_wrapper span.select-item {
|
|
91
|
+
margin-left: 0.5em;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
@media screen and (max-width: 640px) {
|
|
95
|
+
div.dataTables_wrapper span.select-info,
|
|
96
|
+
div.dataTables_wrapper span.select-item {
|
|
97
|
+
margin-left: 0;
|
|
98
|
+
display: block;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
module Chaltron::LdapHelper
|
|
2
2
|
|
|
3
3
|
def display_entry_name(entry)
|
|
4
|
-
if
|
|
4
|
+
if User.exists?(username: entry.username)
|
|
5
5
|
(entry.name + ' ').html_safe +
|
|
6
|
-
tag_label(I18n.t('chaltron.users.
|
|
6
|
+
tag_label(I18n.t('chaltron.users.already_present'), :danger)
|
|
7
7
|
else
|
|
8
|
-
entry.
|
|
8
|
+
entry.name
|
|
9
9
|
end
|
|
10
10
|
end
|
|
11
11
|
|
|
@@ -44,8 +44,23 @@ module ChaltronHelper
|
|
|
44
44
|
badge_label(:label, *args)
|
|
45
45
|
end
|
|
46
46
|
|
|
47
|
+
#
|
|
48
|
+
# Get current revision
|
|
49
|
+
#
|
|
50
|
+
def revision
|
|
51
|
+
@revision || get_revision_number
|
|
52
|
+
end
|
|
53
|
+
|
|
47
54
|
private
|
|
48
55
|
|
|
56
|
+
def get_revision_number
|
|
57
|
+
version_file = "#{Rails.root}/REVISION"
|
|
58
|
+
if File.exists?(version_file)
|
|
59
|
+
v = IO.read(version_file).strip
|
|
60
|
+
v.blank?? nil : v
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
|
|
49
64
|
def badge_label(what, value, type = nil)
|
|
50
65
|
klass = [what]
|
|
51
66
|
klass << "#{what}-#{type}" if type.present?
|
data/config/locales/en.yml
CHANGED
data/config/locales/it.yml
CHANGED
data/lib/chaltron/engine.rb
CHANGED
data/lib/chaltron/ldap/person.rb
CHANGED
data/lib/chaltron/version.rb
CHANGED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<nav class='navbar navbar-inverse navbar-fixed-bottom'>
|
|
2
|
+
<div class='container-fluid'>
|
|
3
|
+
<%= content_tag :p, class: 'navbar-text' do %>
|
|
4
|
+
<%= icon('github') %>
|
|
5
|
+
Created with
|
|
6
|
+
<%= link_to 'chaltron', 'https://github.com/vicvega/chaltron', class: 'navbar-link' %>
|
|
7
|
+
<% end %>
|
|
8
|
+
<%= content_tag :p, revision, class: 'navbar-text pull-right' unless revision.nil? %>
|
|
9
|
+
</div>
|
|
10
|
+
</nav>
|
|
@@ -8,26 +8,11 @@
|
|
|
8
8
|
<thead>
|
|
9
9
|
<tr><% attributes.each do |attribute| %>
|
|
10
10
|
<th><%= attribute.name.humanize %></th><% end %>
|
|
11
|
-
<th></th>
|
|
12
11
|
</tr>
|
|
13
12
|
</thead>
|
|
14
13
|
<tbody>
|
|
15
14
|
<%%= content_tag_for(:tr, @<%= plural_table_name %>) do |<%= singular_table_name %>| %><% attributes.each do |attribute| %>
|
|
16
|
-
<td><%%= <%= singular_table_name %>.<%= attribute.name %> %></td><% end %>
|
|
17
|
-
<td>
|
|
18
|
-
<div class='btn-group btn-group-xs' role='group'>
|
|
19
|
-
<%%= link_to <%= singular_table_name %>, class: 'btn btn-default' do %>
|
|
20
|
-
<%%= icon('eye') %> Show
|
|
21
|
-
<%% end %>
|
|
22
|
-
<%%= link_to edit_<%= singular_table_name %>_path(<%= singular_table_name %>), class: 'btn btn-default' do %>
|
|
23
|
-
<%%= icon('edit') %> Edit
|
|
24
|
-
<%% end %>
|
|
25
|
-
<%%= link_to <%= singular_table_name %>, data: {confirm: 'Are you sure?'},
|
|
26
|
-
method: :delete, class: 'btn btn-danger' do %>
|
|
27
|
-
<%%= icon('trash') %> Delete
|
|
28
|
-
<%% end %>
|
|
29
|
-
</div>
|
|
30
|
-
</td>
|
|
15
|
+
<td><%%= link_to <%= singular_table_name %>.<%= attribute.name %>, <%= singular_table_name %> %></td><% end %>
|
|
31
16
|
<%% end -%>
|
|
32
17
|
</tbody>
|
|
33
18
|
<%% end %>
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<div class='container-fluid'>
|
|
2
|
+
<h3 class='page-header'><%= plural_table_name.titleize %></h3>
|
|
3
|
+
<div class='row'>
|
|
4
|
+
<div class='col-md-12'>
|
|
5
|
+
<div class='panel panel-default'>
|
|
6
|
+
<div class='panel-body'>
|
|
7
|
+
<%%= content_tag 'table', class: 'table table-striped datatable' do %>
|
|
8
|
+
<thead>
|
|
9
|
+
<tr><% attributes.each do |attribute| %>
|
|
10
|
+
<th><%= attribute.name.humanize %></th><% end %>
|
|
11
|
+
</tr>
|
|
12
|
+
</thead>
|
|
13
|
+
<tbody>
|
|
14
|
+
<%%= content_tag_for(:tr, @<%= plural_table_name %>) do |<%= singular_table_name %>| %><% attributes.each do |attribute| %>
|
|
15
|
+
<td><%%= link_to <%= singular_table_name %>.<%= attribute.name %>, <%= singular_table_name %> %></td><% end %>
|
|
16
|
+
<%% end -%>
|
|
17
|
+
</tbody>
|
|
18
|
+
<%% end %>
|
|
19
|
+
</div>
|
|
20
|
+
</div>
|
|
21
|
+
</div>
|
|
22
|
+
</div>
|
|
23
|
+
<hr>
|
|
24
|
+
<%%= link_to new_<%= singular_table_name %>_path, class: 'btn btn-primary btn-large' do %>
|
|
25
|
+
<%%= icon('plus') %> New
|
|
26
|
+
<%% end %>
|
|
27
|
+
|
|
28
|
+
</div>
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: chaltron
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- vicvega
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2015-
|
|
11
|
+
date: 2015-11-25 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rails
|
|
@@ -150,20 +150,6 @@ dependencies:
|
|
|
150
150
|
- - ">="
|
|
151
151
|
- !ruby/object:Gem::Version
|
|
152
152
|
version: '0'
|
|
153
|
-
- !ruby/object:Gem::Dependency
|
|
154
|
-
name: jquery-datatables-rails
|
|
155
|
-
requirement: !ruby/object:Gem::Requirement
|
|
156
|
-
requirements:
|
|
157
|
-
- - ">="
|
|
158
|
-
- !ruby/object:Gem::Version
|
|
159
|
-
version: '0'
|
|
160
|
-
type: :runtime
|
|
161
|
-
prerelease: false
|
|
162
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
163
|
-
requirements:
|
|
164
|
-
- - ">="
|
|
165
|
-
- !ruby/object:Gem::Version
|
|
166
|
-
version: '0'
|
|
167
153
|
- !ruby/object:Gem::Dependency
|
|
168
154
|
name: ajax-datatables-rails
|
|
169
155
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -377,22 +363,27 @@ files:
|
|
|
377
363
|
- app/assets/images/slide2.gif
|
|
378
364
|
- app/assets/images/slide3.gif
|
|
379
365
|
- app/assets/javascripts/chaltron.js
|
|
366
|
+
- app/assets/javascripts/chaltron.js~
|
|
380
367
|
- app/assets/javascripts/chaltron/datatables.js.coffee
|
|
368
|
+
- app/assets/javascripts/chaltron/datatables.js.coffee~
|
|
381
369
|
- app/assets/javascripts/chaltron/localization.js.coffee
|
|
382
370
|
- app/assets/javascripts/chaltron/main.js.coffee
|
|
371
|
+
- app/assets/javascripts/dataTables/dataTables.bootstrap.min.js
|
|
372
|
+
- app/assets/javascripts/dataTables/extras/dataTables.responsive.min.js
|
|
373
|
+
- app/assets/javascripts/dataTables/extras/dataTables.select.min.js
|
|
374
|
+
- app/assets/javascripts/dataTables/jquery.dataTables.min.js
|
|
383
375
|
- app/assets/javascripts/datetime-moment.js
|
|
384
376
|
- app/assets/stylesheets/chaltron.scss
|
|
385
|
-
- app/assets/stylesheets/chaltron/datatables.scss
|
|
386
377
|
- app/assets/stylesheets/chaltron/layout.scss
|
|
387
|
-
- app/assets/stylesheets/chaltron/layout.scss~
|
|
388
378
|
- app/assets/stylesheets/chaltron/mixins.scss
|
|
379
|
+
- app/assets/stylesheets/dataTables/dataTables.bootstrap.css
|
|
380
|
+
- app/assets/stylesheets/dataTables/extras/responsive.bootstrap.css
|
|
381
|
+
- app/assets/stylesheets/dataTables/extras/select.dataTables.css
|
|
389
382
|
- app/controllers/chaltron/ldap_controller.rb
|
|
390
383
|
- app/controllers/chaltron/logs_controller.rb
|
|
391
384
|
- app/controllers/chaltron/omniauth_callbacks_controller.rb
|
|
392
|
-
- app/controllers/chaltron/omniauth_callbacks_controller.rb~
|
|
393
385
|
- app/controllers/chaltron/sessions_controller.rb
|
|
394
386
|
- app/controllers/chaltron/users_controller.rb
|
|
395
|
-
- app/controllers/chaltron/users_controller.rb~
|
|
396
387
|
- app/datatables/log_datatable.rb
|
|
397
388
|
- app/helpers/chaltron/ldap_helper.rb
|
|
398
389
|
- app/helpers/chaltron/logs_helper.rb
|
|
@@ -403,7 +394,6 @@ files:
|
|
|
403
394
|
- app/models/locales/it.yml
|
|
404
395
|
- app/models/log.rb
|
|
405
396
|
- app/models/user.rb
|
|
406
|
-
- app/models/user.rb~
|
|
407
397
|
- app/views/chaltron/ldap/_entry.html.erb
|
|
408
398
|
- app/views/chaltron/ldap/multi_create.html.erb
|
|
409
399
|
- app/views/chaltron/ldap/multi_new.html.erb
|
|
@@ -416,7 +406,6 @@ files:
|
|
|
416
406
|
- app/views/chaltron/users/_user.html.erb
|
|
417
407
|
- app/views/chaltron/users/edit.html.erb
|
|
418
408
|
- app/views/chaltron/users/index.html.erb
|
|
419
|
-
- app/views/chaltron/users/index.html.erb~
|
|
420
409
|
- app/views/chaltron/users/new.html.erb
|
|
421
410
|
- app/views/chaltron/users/self_edit.html.erb
|
|
422
411
|
- app/views/chaltron/users/self_show.html.erb
|
|
@@ -426,17 +415,12 @@ files:
|
|
|
426
415
|
- app/views/devise/passwords/edit.html.erb
|
|
427
416
|
- app/views/devise/passwords/new.html.erb
|
|
428
417
|
- app/views/devise/sessions/_new_ldap.html.erb
|
|
429
|
-
- app/views/devise/sessions/_new_ldap.html.erb~
|
|
430
418
|
- app/views/devise/sessions/_new_local.html.erb
|
|
431
|
-
- app/views/devise/sessions/_new_local.html.erb~
|
|
432
419
|
- app/views/devise/sessions/new.html.erb
|
|
433
420
|
- app/views/locales/en.yml
|
|
434
|
-
- app/views/locales/en.yml~
|
|
435
421
|
- app/views/locales/it.yml
|
|
436
|
-
- app/views/locales/it.yml~
|
|
437
422
|
- config/chaltron_navigation.rb
|
|
438
423
|
- config/initializers/devise.rb
|
|
439
|
-
- config/initializers/devise.rb~
|
|
440
424
|
- config/locales/devise.en.yml
|
|
441
425
|
- config/locales/devise.it.yml
|
|
442
426
|
- config/locales/en.yml
|
|
@@ -452,15 +436,11 @@ files:
|
|
|
452
436
|
- lib/chaltron/banner.rb
|
|
453
437
|
- lib/chaltron/bootstrap_form.rb
|
|
454
438
|
- lib/chaltron/controllers/helpers.rb
|
|
455
|
-
- lib/chaltron/controllers/helpers.rb~
|
|
456
439
|
- lib/chaltron/engine.rb
|
|
457
|
-
- lib/chaltron/engine.rb~
|
|
458
440
|
- lib/chaltron/ldap/connection.rb
|
|
459
441
|
- lib/chaltron/ldap/person.rb
|
|
460
442
|
- lib/chaltron/ldap/user.rb
|
|
461
|
-
- lib/chaltron/ldap/user.rb~
|
|
462
443
|
- lib/chaltron/version.rb
|
|
463
|
-
- lib/chaltron/version.rb~
|
|
464
444
|
- lib/generators/chaltron/install_generator.rb
|
|
465
445
|
- lib/generators/chaltron/templates/app/assets/javascripts/home.js.coffee
|
|
466
446
|
- lib/generators/chaltron/templates/app/assets/stylesheets/home.scss
|
|
@@ -472,6 +452,7 @@ files:
|
|
|
472
452
|
- lib/generators/chaltron/templates/app/views/home/index.html.erb
|
|
473
453
|
- lib/generators/chaltron/templates/app/views/home/test.html.erb
|
|
474
454
|
- lib/generators/chaltron/templates/app/views/layouts/_flash.html.erb
|
|
455
|
+
- lib/generators/chaltron/templates/app/views/layouts/_footer.html.erb
|
|
475
456
|
- lib/generators/chaltron/templates/app/views/layouts/_navbar.html.erb
|
|
476
457
|
- lib/generators/chaltron/templates/app/views/layouts/application.html.erb
|
|
477
458
|
- lib/generators/chaltron/templates/config/initializers/ajax_datatables_rails.rb
|
|
@@ -481,6 +462,7 @@ files:
|
|
|
481
462
|
- lib/templates/erb/scaffold/_form.html.erb
|
|
482
463
|
- lib/templates/erb/scaffold/edit.html.erb
|
|
483
464
|
- lib/templates/erb/scaffold/index.html.erb
|
|
465
|
+
- lib/templates/erb/scaffold/index.html.erb~
|
|
484
466
|
- lib/templates/erb/scaffold/new.html.erb
|
|
485
467
|
- lib/templates/erb/scaffold/show.html.erb
|
|
486
468
|
homepage: https://github.com/vicvega/chaltron
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
table#ldap_create {
|
|
2
|
-
tr td:first-child {
|
|
3
|
-
text-align: center;
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
tr td:first-child:not(:only-of-type):before {
|
|
7
|
-
content: "\f096"; /* fa-square-o */
|
|
8
|
-
font-family: FontAwesome;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
tr.selected td:first-child:before {
|
|
12
|
-
content: "\f046"; /* fa-check-square-o */
|
|
13
|
-
}
|
|
14
|
-
}
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
body {
|
|
2
|
-
// background-color: #E1E1E1;
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
div#content {
|
|
6
|
-
margin-top: 40px;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Flash messages
|
|
11
|
-
*
|
|
12
|
-
*/
|
|
13
|
-
.flash-container {
|
|
14
|
-
cursor: pointer;
|
|
15
|
-
margin: 0;
|
|
16
|
-
text-align: center;
|
|
17
|
-
position: fixed;
|
|
18
|
-
top: 40px;
|
|
19
|
-
width: 100%;
|
|
20
|
-
opacity: 0.8;
|
|
21
|
-
z-index: 100;
|
|
22
|
-
.alert {
|
|
23
|
-
margin: 0;
|
|
24
|
-
border-radius: 0;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Login
|
|
30
|
-
*
|
|
31
|
-
*/
|
|
32
|
-
.login-box{
|
|
33
|
-
margin-top: 100px;
|
|
34
|
-
@include form-box(650px);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Navbar tabs
|
|
39
|
-
*
|
|
40
|
-
*/
|
|
41
|
-
.nav-tabs {
|
|
42
|
-
margin-bottom: 15px;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
#nprogress .spinner {
|
|
46
|
-
display: block;
|
|
47
|
-
position: fixed;
|
|
48
|
-
z-index: 1031;
|
|
49
|
-
top: 12px;
|
|
50
|
-
right: 5px;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* Scaffold
|
|
55
|
-
*
|
|
56
|
-
*/
|
|
57
|
-
.side-filters fieldset {
|
|
58
|
-
margin-bottom: 15px;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
.form-actions {
|
|
62
|
-
background-color: whitesmoke;
|
|
63
|
-
border-top: 1px solid #e5e5e5;
|
|
64
|
-
margin-bottom: 18px;
|
|
65
|
-
margin-top: 18px;
|
|
66
|
-
padding-bottom: 18px;
|
|
67
|
-
padding-top: 18px;
|
|
68
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
require 'chaltron/ldap/user'
|
|
2
|
-
|
|
3
|
-
module Chaltron
|
|
4
|
-
class OmniauthCallbacksController < Devise::OmniauthCallbacksController
|
|
5
|
-
|
|
6
|
-
default_log_category :login
|
|
7
|
-
|
|
8
|
-
def ldap
|
|
9
|
-
puts '##########################################'
|
|
10
|
-
puts oauth.inspect
|
|
11
|
-
puts '##########################################'
|
|
12
|
-
puts params.inspect
|
|
13
|
-
puts '##########################################'
|
|
14
|
-
# We only find ourselves here
|
|
15
|
-
# if the authentication to LDAP was successful.
|
|
16
|
-
user = Chaltron::LDAP::User.find_or_create(oauth, Chaltron.ldap_allow_all)
|
|
17
|
-
if user.nil?
|
|
18
|
-
redirect_to root_url, alert: I18n.t('chaltron.not_allowed_to_sign_in')
|
|
19
|
-
else
|
|
20
|
-
user.remember_me = params[:remember_me] if user.persisted?
|
|
21
|
-
flash[:notice] = I18n.t('devise.sessions.signed_in')
|
|
22
|
-
|
|
23
|
-
info I18n.t('chaltron.logs.login_via', user: user.display_name, provider: 'ldap')
|
|
24
|
-
sign_in_and_redirect(user)
|
|
25
|
-
end
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
private
|
|
29
|
-
|
|
30
|
-
def oauth
|
|
31
|
-
@oauth ||= request.env['omniauth.auth']
|
|
32
|
-
end
|
|
33
|
-
end
|
|
34
|
-
end
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
class Chaltron::UsersController < ApplicationController
|
|
2
|
-
before_action :authenticate_user!
|
|
3
|
-
load_and_authorize_resource except: [:self_show, :self_edit, :self_update]
|
|
4
|
-
|
|
5
|
-
respond_to :html
|
|
6
|
-
default_log_category :user_admin
|
|
7
|
-
|
|
8
|
-
def index
|
|
9
|
-
|
|
10
|
-
puts 'USER controller index START'
|
|
11
|
-
|
|
12
|
-
@filters = params[:filters] || {}
|
|
13
|
-
|
|
14
|
-
# apply provider filter
|
|
15
|
-
@users = @users.where(provider: nil) if @filters[:provider] == 'local'
|
|
16
|
-
@users = @users.where(provider: :ldap) if @filters[:provider] == 'ldap'
|
|
17
|
-
# apply activity filter
|
|
18
|
-
@users = @users.where(sign_in_count: 0) if @filters[:activity] == 'no_login'
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
puts 'USER controller index STOP'
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
def show
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
def new
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
def edit
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
def self_show
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
def self_edit
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
def create
|
|
40
|
-
if @user.save
|
|
41
|
-
flash[:notice] = I18n.t('chaltron.users.created')
|
|
42
|
-
info I18n.t('chaltron.logs.users.created',
|
|
43
|
-
current: current_user.display_name, user: @user.display_name)
|
|
44
|
-
end
|
|
45
|
-
respond_with(@user)
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
def update
|
|
49
|
-
flash[:notice] = I18n.t('chaltron.users.updated') if @user.update(update_params)
|
|
50
|
-
respond_with(@user)
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
def self_update
|
|
54
|
-
user_params_with_pass = self_update_params.dup
|
|
55
|
-
if params[:user][:password].present?
|
|
56
|
-
user_params_with_pass.merge!(
|
|
57
|
-
password: params[:user][:password],
|
|
58
|
-
password_confirmation: params[:user][:password_confirmation],
|
|
59
|
-
)
|
|
60
|
-
end
|
|
61
|
-
if current_user.update(user_params_with_pass)
|
|
62
|
-
flash[:notice] = I18n.t('chaltron.users.self_updated')
|
|
63
|
-
render :self_show
|
|
64
|
-
else
|
|
65
|
-
render :self_edit
|
|
66
|
-
end
|
|
67
|
-
end
|
|
68
|
-
|
|
69
|
-
def destroy
|
|
70
|
-
if current_user == @user
|
|
71
|
-
redirect_to({ action: :index }, alert: I18n.t('chaltron.users.cannot_self_destroy'))
|
|
72
|
-
else
|
|
73
|
-
info I18n.t('chaltron.logs.users.destroyed',
|
|
74
|
-
current: current_user.display_name, user: @user.display_name)
|
|
75
|
-
@user.destroy
|
|
76
|
-
respond_with(@user)
|
|
77
|
-
end
|
|
78
|
-
end
|
|
79
|
-
|
|
80
|
-
private
|
|
81
|
-
def create_params
|
|
82
|
-
params.require(:user).permit(:username, :email, :fullname,
|
|
83
|
-
:password, :password_confirmation, roles: [])
|
|
84
|
-
end
|
|
85
|
-
|
|
86
|
-
def update_params
|
|
87
|
-
params.require(:user).permit(roles: [])
|
|
88
|
-
end
|
|
89
|
-
|
|
90
|
-
def self_update_params
|
|
91
|
-
params.require(:user).permit(:email, :fullname)
|
|
92
|
-
end
|
|
93
|
-
|
|
94
|
-
end
|
data/app/models/user.rb~
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
class User < ActiveRecord::Base
|
|
2
|
-
include Authorizable
|
|
3
|
-
# Include default devise modules. Others available are:
|
|
4
|
-
# :registerable, :confirmable, :lockable and :omniauthable
|
|
5
|
-
|
|
6
|
-
# Virtual attribute for authenticating by either username or email
|
|
7
|
-
attr_accessor :login
|
|
8
|
-
|
|
9
|
-
devise :database_authenticatable, :recoverable, :rememberable, :trackable, :validatable,
|
|
10
|
-
:timeoutable, :omniauthable
|
|
11
|
-
|
|
12
|
-
validates :username, presence: true, uniqueness: { scope: :provider, case_sensitive: false }
|
|
13
|
-
|
|
14
|
-
def display_name
|
|
15
|
-
fullname.presence || username
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
# Devise method overridden to allow sign in with email or username
|
|
19
|
-
def self.find_for_database_authentication(warden_conditions)
|
|
20
|
-
conditions = warden_conditions.dup
|
|
21
|
-
if login = conditions.delete(:login)
|
|
22
|
-
where(conditions).where(['lower(username) = :value OR lower(email) = :value', { value: login.downcase }]).first
|
|
23
|
-
else
|
|
24
|
-
where(conditions).first
|
|
25
|
-
end
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
end
|