usman 0.3.9 → 0.3.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +3 -3
  3. data/app/controllers/usman/admin_controller.rb +1 -18
  4. data/app/controllers/usman/api/v1/docs_controller.rb +53 -12
  5. data/app/controllers/usman/application_controller.rb +2 -0
  6. data/app/controllers/usman/features_controller.rb +4 -2
  7. data/app/controllers/usman/permissions_controller.rb +34 -3
  8. data/app/controllers/usman/resource_controller.rb +6 -1
  9. data/app/controllers/usman/user_roles_controller.rb +1 -0
  10. data/app/helpers/usman/authentication_helper.rb +102 -34
  11. data/app/models/feature.rb +2 -2
  12. data/app/models/permission.rb +11 -0
  13. data/app/models/user.rb +65 -0
  14. data/app/services/usman/sms_service.rb +91 -0
  15. data/app/views/layouts/kuppayam/_sidebar.html.erb +125 -72
  16. data/app/views/usman/dashboard/_index.html.erb +40 -0
  17. data/app/views/usman/dashboard/_super_admin_index.html.erb +22 -0
  18. data/app/views/usman/dashboard/index.html.erb +6 -128
  19. data/app/views/usman/features/_form.html.erb +1 -1
  20. data/app/views/usman/features/_index.html.erb +18 -8
  21. data/app/views/usman/features/_row.html.erb +14 -8
  22. data/app/views/usman/features/_show.html.erb +13 -10
  23. data/app/views/usman/features/index.html.erb +2 -2
  24. data/app/views/usman/permissions/_form.html.erb +2 -2
  25. data/app/views/usman/permissions/_index.html.erb +6 -5
  26. data/app/views/usman/permissions/_row.html.erb +6 -5
  27. data/app/views/usman/permissions/_show.html.erb +5 -5
  28. data/app/views/usman/permissions/index.html.erb +15 -17
  29. data/app/views/usman/registration_devices/_index.html.erb +11 -7
  30. data/app/views/usman/registration_devices/_row.html.erb +18 -18
  31. data/app/views/usman/registrations/_index.html.erb +17 -13
  32. data/app/views/usman/registrations/_row.html.erb +14 -10
  33. data/app/views/usman/roles/_index.html.erb +8 -4
  34. data/app/views/usman/roles/_row.html.erb +7 -5
  35. data/app/views/usman/roles/_show.html.erb +9 -5
  36. data/app/views/usman/roles/index.html.erb +3 -3
  37. data/app/views/usman/sessions/_permission_denied.js.erb +3 -0
  38. data/app/views/usman/user_roles/_index.html.erb +6 -0
  39. data/app/views/usman/user_roles/_row.html.erb +4 -0
  40. data/app/views/usman/users/_index.html.erb +19 -15
  41. data/app/views/usman/users/_row.html.erb +17 -15
  42. data/app/views/usman/users/_show.html.erb +5 -3
  43. data/app/views/usman/users/index.html.erb +3 -3
  44. data/config/locales/usman/authentication.ar.yml +5 -2
  45. data/config/locales/usman/authentication.en.yml +2 -2
  46. data/config/locales/usman/sms.en.yml +17 -0
  47. data/config/routes.rb +11 -12
  48. data/db/data/dummy/permissions.csv +1 -76
  49. data/db/data/dummy/users.csv +3 -6
  50. data/db/data/users.csv +3 -1
  51. data/db/master_data/features.csv +9 -0
  52. data/db/master_data/roles.csv +1 -0
  53. data/lib/tasks/usman/data.rake +15 -9
  54. data/lib/tasks/usman/master_data.rake +7 -3
  55. data/lib/usman/action_view/permissions_helper.rb +24 -0
  56. data/lib/usman/engine.rb +6 -0
  57. data/lib/usman/version.rb +1 -1
  58. data/lib/usman.rb +1 -0
  59. metadata +27 -12
  60. data/app/controllers/usman/api/v1/docs_base_controller.rb +0 -25
  61. data/app/views/kuppayam/api/docs/_navigation.html.erb +0 -67
  62. data/db/data/dummy/features.csv +0 -17
  63. data/db/data/dummy/roles.csv +0 -5
  64. data/db/data/features.csv +0 -17
  65. data/db/data/roles.csv +0 -5
@@ -3,19 +3,20 @@
3
3
  <div class="media <%= status_hash[@feature.status.to_sym] %>">
4
4
 
5
5
  <div class="pull-left pt-10 pr-10 pb-10" style="width:30%;">
6
- <%= edit_image(@feature,
7
- "feature_image.image.large.url",
8
- upload_image_link(@feature, :feature_image, nil ),
9
- remove_image_link(@feature, :feature_image, nil ),
10
- image_options: {assoc_name: :feature_image }) %>
6
+ <% if display_edit_links? %>
7
+ <%= edit_image(@feature,
8
+ "feature_image.image.large.url",
9
+ upload_image_link(@feature, :feature_image, nil ),
10
+ remove_image_link(@feature, :feature_image, nil ),
11
+ image_options: {assoc_name: :feature_image }) %>
12
+ <% else %>
13
+ <%= display_image(@user, "feature_image.image.large.url", class: "img-inline", alt: @feature.display_name) %>
14
+ <% end %>
11
15
  </div>
12
16
 
13
17
  <div class="pull-left ml-10" style="width:65%;">
14
-
15
18
  <h1><%= @feature.name %></h1>
16
-
17
19
  <span class="ml-5 mt-5 label label-<%= status_hash[@feature.status.to_sym] %>"><%= @feature.status.titleize %></span>
18
-
19
20
  <%= clear_tag %>
20
21
  </div>
21
22
 
@@ -36,6 +37,7 @@
36
37
  </table>
37
38
  </div>
38
39
 
40
+ <% if display_manage_links? %>
39
41
  <div>
40
42
  <%
41
43
  edit_link = edit_feature_url(id: @feature.id)
@@ -44,9 +46,10 @@
44
46
 
45
47
  <%= link_to raw("<i class=\"fa fa-close mr-5\"></i> <span>Cancel</span>"), "#", onclick: "closeGenericModal();", class: "btn btn-white pull-left" %>
46
48
 
47
- <%= link_to raw("<i class=\"fa fa-trash mr-5\"></i> <span>Delete</span>"), delete_link, method: :delete, :remote=>true, class: "btn btn-gray pull-right" %>
49
+ <%= link_to raw("<i class=\"fa fa-trash mr-5\"></i> <span>Delete</span>"), delete_link, method: :delete, :remote=>true, class: "btn btn-gray pull-right" if display_delete_links? %>
48
50
 
49
- <%= link_to raw("<i class=\"fa fa-edit mr-5\"></i> Edit"), edit_link, method: :get, :remote=>true, class: "btn btn-gray pull-right mr-10" %>
51
+ <%= link_to raw("<i class=\"fa fa-edit mr-5\"></i> Edit"), edit_link, method: :get, :remote=>true, class: "btn btn-gray pull-right mr-10" if display_edit_links? %>
50
52
  </div>
53
+ <% end %>
51
54
 
52
55
  <%= clear_tag %>
@@ -11,9 +11,9 @@
11
11
  <div class="row">
12
12
  <div class="col-md-6">
13
13
 
14
- <%= theme_button('Add a Feature', 'plus', new_feature_path(), classes: "pull-left", btn_type: "success") %>
14
+ <%= theme_button('Add a Feature', 'plus', new_feature_path(), classes: "pull-left mr-10", btn_type: "success") if @current_user.has_create_permission?(Feature) %>
15
15
 
16
- <%= theme_button('Refresh', 'refresh', features_path(), classes: "pull-left ml-10", btn_type: "white") %>
16
+ <%= theme_button('Refresh', 'refresh', features_path(), classes: "pull-left mr-10", btn_type: "white") %>
17
17
 
18
18
  <!-- Single button -->
19
19
  <div class="ml-10 btn-group hidden">
@@ -6,10 +6,10 @@
6
6
 
7
7
  <div class="form-inputs mb-30 mt-30">
8
8
 
9
- <% options = {assoc_collection: User.select("id, name").order("name ASC").all, required: true, editable: true, assoc_display_method: :name} %>
9
+ <% options = {assoc_collection: User.normal_users.select("id, name").order("name ASC").all, required: true, editable: true, assoc_display_method: :name} %>
10
10
  <%= theme_form_assoc_group(@permission, :user_id, **options) %>
11
11
 
12
- <% options = {assoc_collection: Feature.select("id, name").order("name ASC").all, required: true, editable: true, assoc_display_method: :name} %>
12
+ <% options = {assoc_collection: Feature.published.select("id, name").order("name ASC").all, required: true, editable: true, assoc_display_method: :display_name} %>
13
13
  <%= theme_form_assoc_group(@permission, :feature_id, **options) %>
14
14
 
15
15
  <div class="form-group ">
@@ -1,6 +1,5 @@
1
1
  <% features = Feature.published.all %>
2
2
 
3
-
4
3
  <div class="table-responsive">
5
4
  <table class="table table-hover members-table middle-align">
6
5
  <thead>
@@ -16,6 +15,7 @@
16
15
  </thead>
17
16
  <tbody>
18
17
  <% @permissions.each_with_index do |permission, i| %>
18
+
19
19
  <% edit_link = edit_permission_path(id: permission.id) %>
20
20
  <% delete_link = permission_path(id: permission.id) %>
21
21
 
@@ -23,7 +23,7 @@
23
23
 
24
24
  <td class="permission-name"><%= permission.user.try(:name) %></td>
25
25
 
26
- <td class="permission-name"><%= permission.feature.try(:name) %></td>
26
+ <td class="permission-name"><%= permission.feature.try(:display_name) %></td>
27
27
 
28
28
  <td class="permission-name" style="text-align: center"><%= permission.can_create ? raw("<i class='fa fa-check'></i>") : "-" %></td>
29
29
 
@@ -33,14 +33,15 @@
33
33
 
34
34
  <td class="permission-name" style="text-align: center"><%= permission.can_delete ? raw("<i class='fa fa-check'></i>") : "-" %></td>
35
35
 
36
-
36
+ <% if display_manage_links? %>
37
37
  <td class="action-links1" style="width:10%;text-align: center;">
38
38
 
39
- <%= link_to raw("<i class=\"linecons-pencil\"></i>"), edit_link, :remote=>true, class: "edit" %>
39
+ <%= link_to raw("<i class=\"linecons-pencil\"></i>"), edit_link, :remote=>true, class: "edit" if display_edit_links? %>
40
40
 
41
- <%= link_to raw("<i class=\"linecons-trash\"></i>"), delete_link, method: :delete, role: "menuitem", tabindex: "-1", data: { confirm: 'Are you sure?' }, :remote=>true, class: "delete" %>
41
+ <%= link_to raw("<i class=\"linecons-trash\"></i>"), delete_link, method: :delete, role: "menuitem", tabindex: "-1", data: { confirm: 'Are you sure?' }, :remote=>true, class: "delete" if display_delete_links? %>
42
42
 
43
43
  </td>
44
+ <% end %>
44
45
 
45
46
  </tr>
46
47
  <% end %>
@@ -2,10 +2,10 @@
2
2
  <% delete_link = permission_path(id: permission.id) %>
3
3
 
4
4
  <tr id="tr_permission_<%= permission.id %>">
5
-
5
+
6
6
  <td class="permission-name"><%= permission.user.try(:name) %></td>
7
7
 
8
- <td class="permission-name"><%= permission.feature.try(:name) %></td>
8
+ <td class="permission-name"><%= permission.feature.try(:display_name) %></td>
9
9
 
10
10
  <td class="permission-name" style="text-align: center"><%= permission.can_create ? raw("<i class='fa fa-check'></i>") : "-" %></td>
11
11
 
@@ -15,13 +15,14 @@
15
15
 
16
16
  <td class="permission-name" style="text-align: center"><%= permission.can_delete ? raw("<i class='fa fa-check'></i>") : "-" %></td>
17
17
 
18
-
18
+ <% if display_manage_links? %>
19
19
  <td class="action-links1" style="width:10%;text-align: center;">
20
20
 
21
- <%= link_to raw("<i class=\"linecons-pencil\"></i>"), edit_link, :remote=>true, class: "edit" %>
21
+ <%= link_to raw("<i class=\"linecons-pencil\"></i>"), edit_link, :remote=>true, class: "edit" if display_edit_links? %>
22
22
 
23
- <%= link_to raw("<i class=\"linecons-trash\"></i>"), delete_link, method: :delete, role: "menuitem", tabindex: "-1", data: { confirm: 'Are you sure?' }, :remote=>true, class: "delete" %>
23
+ <%= link_to raw("<i class=\"linecons-trash\"></i>"), delete_link, method: :delete, role: "menuitem", tabindex: "-1", data: { confirm: 'Are you sure?' }, :remote=>true, class: "delete" if display_delete_links? %>
24
24
 
25
25
  </td>
26
+ <% end %>
26
27
 
27
28
  </tr>
@@ -26,15 +26,15 @@
26
26
 
27
27
  <div>
28
28
  <%
29
- edit_link = edit_permission_url(id: @permission.id)
30
- delete_link = permission_url(id: @permission.id)
29
+ #edit_link = edit_permission_url(id: @permission.id)
30
+ #delete_link = permission_url(id: @permission.id)
31
31
  %>
32
32
 
33
- <%= link_to raw("<i class=\"fa fa-close mr-5\"></i> <span>Cancel</span>"), "#", onclick: "closeGenericModal();", class: "btn btn-white pull-left" %>
33
+ <%#= link_to raw("<i class=\"fa fa-close mr-5\"></i> <span>Cancel</span>"), "#", onclick: "closeGenericModal();", class: "btn btn-white pull-left" %>
34
34
 
35
- <%= link_to raw("<i class=\"fa fa-trash mr-5\"></i> <span>Delete</span>"), delete_link, method: :delete, :remote=>true, class: "btn btn-gray pull-right" %>
35
+ <%#= link_to raw("<i class=\"fa fa-trash mr-5\"></i> <span>Delete</span>"), delete_link, method: :delete, :remote=>true, class: "btn btn-gray pull-right" %>
36
36
 
37
- <%= link_to raw("<i class=\"fa fa-edit mr-5\"></i> Edit"), edit_link, method: :get, :remote=>true, class: "btn btn-gray pull-right mr-10" %>
37
+ <%#= link_to raw("<i class=\"fa fa-edit mr-5\"></i> Edit"), edit_link, method: :get, :remote=>true, class: "btn btn-gray pull-right mr-10" %>
38
38
  </div>
39
39
 
40
40
  <%= clear_tag %>
@@ -7,32 +7,30 @@
7
7
  <div class="tab-content">
8
8
  <div class="tab-pane active">
9
9
 
10
- <div id="div_permission_action_buttons">
10
+ <div id="div_permission_action_buttons">
11
11
  <div class="row">
12
12
  <div class="col-md-6">
13
13
 
14
- <%= theme_button('Add a Permission', 'plus', new_permission_path(), classes: "pull-left", btn_type: "success") %>
15
-
16
- <%= theme_button('Refresh', 'refresh', permissions_path(), classes: "pull-left ml-10", btn_type: "white") %>
17
-
18
- <!-- Single button -->
19
- <div class="ml-10 btn-group hidden">
20
- <button type="button" class="btn btn-white dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
21
- More Actions <span class="caret"></span>
22
- </button>
23
- <ul class="dropdown-menu">
24
- <li><a href="#">Import Users</a></li>
25
- <li><a href="#">Import History</a></li>
26
- <li role="separator" class="divider"></li>
27
- <li><a href="#">Export Users</a></li>
28
- </ul>
29
- </div>
14
+ <%= theme_button('Add a Permission', 'plus', new_permission_path(), classes: "pull-left mr-10", btn_type: "success") if @current_user.has_create_permission?(Permission) %>
30
15
 
16
+ <%= theme_button('Refresh', 'refresh', permissions_path(), classes: "pull-left mr-10", btn_type: "white") %>
31
17
  </div>
32
18
  <div class="col-md-6">
33
19
  <%= search_form_kuppayam(Permission, permissions_path, text: @filters[:query]) %>
34
20
  </div>
35
21
  </div>
22
+
23
+ <div class="row">
24
+ <div class="col-md-12">
25
+ <% @filter_ui_settings.each do |filter_name, options| %>
26
+ <% if options[:object_filter] == true %>
27
+ <%= report_object_filter(filter_name, options) %>
28
+ <% else %>
29
+ <%= report_filter(filter_name, options) %>
30
+ <% end %>
31
+ <% end %>
32
+ </div>
33
+ </div>
36
34
  </div>
37
35
  <%= clear_tag(10) %>
38
36
 
@@ -7,16 +7,16 @@
7
7
  <th>Status</th>
8
8
  <th>Device Name</th>
9
9
  <th>Device Type</th>
10
- <!-- <th style="text-align: center;" colspan="2">Actions</th> -->
10
+ <% if display_delete_links? %>
11
+ <th style="text-align: center;" colspan="2">Actions</th>
12
+ <% end %>
11
13
  </tr>
12
14
  </thead>
13
15
 
14
16
  <tbody>
15
17
  <% @devices.each_with_index do |device, i| %>
16
18
 
17
- <%# delete_link = registration_device_path(@registration, device) %>
18
-
19
- <tr id="tr_device_<%= device.id %>">
19
+ <tr id="tr_device_<%= device.id %>">
20
20
 
21
21
  <th scope="row" style="text-align: center;">
22
22
  <% if i < 0 %>
@@ -40,13 +40,17 @@
40
40
  <td class="device-name"><%= device.device_name %></td>
41
41
  <td class="device-name"><%= device.device_type %></td>
42
42
 
43
- <!-- <td class="action-links" style="width:10%"> -->
43
+ <% if display_delete_links? %>
44
+ <% delete_link = registration_device_path(@registration, device) %>
45
+ <td class="action-links" style="width:10%"> -->
44
46
 
45
- <%#= link_to raw("<i class=\"linecons-trash\"></i> Remove Role"), delete_link, method: :delete, device: "menuitem", tabindex: "-1", data: { confirm: 'Are you sure?' }, :remote=>true, class: "delete" %>
47
+ <%= link_to raw("<i class=\"linecons-trash\"></i> Remove Role"), delete_link, method: :delete, device: "menuitem", tabindex: "-1", data: { confirm: 'Are you sure?' }, :remote=>true, class: "delete" %>
46
48
 
47
- <!-- </td> -->
49
+ </td>
50
+ <% end %>
48
51
 
49
52
  </tr>
53
+
50
54
  <% end %>
51
55
  </tbody>
52
56
  </table>
@@ -1,8 +1,5 @@
1
- <% edit_link = edit_role_user_path(@role, user) %>
2
- <% delete_link = role_user_path(@role, user) %>
3
-
4
- <tr id="tr_user_<%= user.id %>">
5
-
1
+ <tr id="tr_device_<%= device.id %>">
2
+
6
3
  <th scope="row" style="text-align: center;">
7
4
  <% if i < 0 %>
8
5
  <i class="fa fa-check text-success"></i>
@@ -11,24 +8,27 @@
11
8
  <% end %>
12
9
  </th>
13
10
 
14
- <td class="user-image">
15
- <%= link_to(user_path(user), remote: true) do %>
16
- <%= display_image(user, "profile_picture.image.small.url", width: "120", height: "auto", class: "img-rectangle", alt: user.display_name) %>
17
- <% end %>
18
- </td>
19
-
20
- <td class="user-name"><%= user.display_name %></td>
21
-
22
- <td class="user-name">
23
- <% user.roles.collect(&:name).each do |r| %>
24
- <span class="ml-5 label label-primary"><%= r %></span>
11
+ <td class="device-name" style="font-weight:bold;"><%= link_to device.uuid, registration_device_path(registration_id: device.registration_id, id: device.id), remote: true %></td>
12
+ <td>
13
+ <% if device.pending? %>
14
+ <span class="ml-5 mt-5 label label-default">Pending</span>
15
+ <% elsif device.verified? %>
16
+ <span class="ml-5 mt-5 label label-success">Verified</span>
17
+ <% elsif device.blocked? %>
18
+ <span class="ml-5 mt-5 label label-danger">Blocked</span>
25
19
  <% end %>
26
20
  </td>
27
21
 
28
- <td class="action-links" style="width:10%">
22
+ <td class="device-name"><%= device.device_name %></td>
23
+ <td class="device-name"><%= device.device_type %></td>
24
+
25
+ <% if display_delete_links? %>
26
+ <% delete_link = registration_device_path(@registration, device) %>
27
+ <td class="action-links" style="width:10%"> -->
29
28
 
30
- <%= link_to raw("<i class=\"linecons-trash\"></i> Remove Role"), delete_link, method: :delete, user: "menuitem", tabindex: "-1", data: { confirm: 'Are you sure?' }, :remote=>true, class: "delete" %>
29
+ <%= link_to raw("<i class=\"linecons-trash\"></i> Remove Role"), delete_link, method: :delete, device: "menuitem", tabindex: "-1", data: { confirm: 'Are you sure?' }, :remote=>true, class: "delete" %>
31
30
 
32
31
  </td>
32
+ <% end %>
33
33
 
34
34
  </tr>
@@ -7,17 +7,16 @@
7
7
  <th style="text-align: left;width:15%;">Mobile</th>
8
8
  <th style="text-align: left;width:15%;">Location</th>
9
9
  <th>Status</th>
10
+ <% if display_manage_links? %>
10
11
  <th style="text-align: center;width:15%;">Actions</th>
12
+ <% end %>
11
13
  </tr>
12
14
  </thead>
13
15
 
14
16
  <tbody>
15
17
  <% @registrations.each_with_index do |registration, i| %>
16
18
 
17
- <%# edit_link = edit_registration_path(id: registration.id) %>
18
- <%# delete_link = registration_path(id: registration.id) %>
19
-
20
- <tr id="tr_registration_<%= registration.id %>">
19
+ <tr id="tr_registration_<%= registration.id %>">
21
20
 
22
21
  <th scope="row" style="text-align: center;">
23
22
  <% if i < 0 %>
@@ -47,26 +46,31 @@
47
46
  <% end %>
48
47
  </td>
49
48
 
49
+ <% if display_manage_links? %>
50
50
  <td class="action-links" style="width:15%">
51
51
 
52
52
  <!-- Mark as Pending -->
53
- <%= link_to raw("<i class=\"fa fa-circle mr-5\"></i> Mark as Pending"), update_status_registration_path(:id =>registration.id, :status =>'pending'), :method =>'PUT', :remote=>true, role: "menuitem", tabindex: "-1" unless registration.pending? %>
53
+ <%= link_to raw("<i class=\"fa fa-circle mr-5\"></i> Mark as Pending"), update_status_registration_path(:id =>registration.id, :status =>'pending'), :method =>'PUT', :remote=>true, role: "menuitem", tabindex: "-1" unless registration.pending? and display_edit_links? %>
54
54
 
55
55
  <!-- Verify -->
56
- <%= link_to raw("<i class=\"fa fa-circle-o mr-5\"></i> Verify"), update_status_registration_path(:id =>registration.id, :status =>'verified'), :method =>'PUT', :remote=>true, role: "menuitem", tabindex: "-1" unless registration.verified? %>
56
+ <%= link_to raw("<i class=\"fa fa-circle-o mr-5\"></i> Verify"), update_status_registration_path(:id =>registration.id, :status =>'verified'), :method =>'PUT', :remote=>true, role: "menuitem", tabindex: "-1" unless registration.verified? and display_edit_links? %>
57
57
 
58
58
  <!-- Suspend -->
59
- <%= link_to raw("<i class=\"fa fa-edit mr-5\"></i> Suspend"), update_status_registration_path(:id =>registration.id, :status =>'suspended'), :method =>'PUT', :remote=>true, role: "menuitem", tabindex: "-1" unless registration.suspended? %>
60
-
59
+ <%= link_to raw("<i class=\"fa fa-edit mr-5\"></i> Suspend"), update_status_registration_path(:id =>registration.id, :status =>'suspended'), :method =>'PUT', :remote=>true, role: "menuitem", tabindex: "-1" unless registration.suspended? and display_edit_links? %>
61
60
  </td>
62
-
63
- <!-- <td class="action-links" style="width:10%">
64
- <%#= link_to raw("<i class=\"linecons-pencil\"></i> Edit Registration"), edit_link, :remote=>true, class: "edit" if @current_user.super_admin? and registration.can_be_edited? %>
65
61
 
66
- <%#= link_to raw("<i class=\"linecons-trash\"></i> Delete"), delete_link, method: :delete, registration: "menuitem", tabindex: "-1", data: { confirm: 'Are you sure?' }, :remote=>true, class: "delete" if @current_user.super_admin? and registration.can_be_deleted? %>
67
- </td> -->
62
+ <%# edit_link = edit_registration_path(id: registration.id) %>
63
+ <% delete_link = registration_path(id: registration.id) %>
64
+
65
+ <td class="action-links" style="width:10%">
66
+ <%#= link_to raw("<i class=\"linecons-pencil\"></i> Edit Registration"), edit_link, :remote=>true, class: "edit" if registration.can_be_edited? and display_edit_links? %>
67
+
68
+ <%= link_to raw("<i class=\"linecons-trash\"></i> Delete"), delete_link, method: :delete, registration: "menuitem", tabindex: "-1", data: { confirm: 'Are you sure?' }, :remote=>true, class: "delete" if registration.can_be_deleted? and display_delete_links? %>
69
+ </td>
70
+ <% end %>
68
71
 
69
72
  </tr>
73
+
70
74
  <% end %>
71
75
  </tbody>
72
76
  </table>
@@ -28,23 +28,27 @@
28
28
  <% end %>
29
29
  </td>
30
30
 
31
+ <% if display_manage_links? %>
31
32
  <td class="action-links" style="width:15%">
32
33
 
33
34
  <!-- Mark as Pending -->
34
- <%= link_to raw("<i class=\"fa fa-circle mr-5\"></i> Mark as Pending"), update_status_registration_path(:id =>registration.id, :status =>'pending'), :method =>'PUT', :remote=>true, role: "menuitem", tabindex: "-1" unless registration.pending? %>
35
-
35
+ <%= link_to raw("<i class=\"fa fa-circle mr-5\"></i> Mark as Pending"), update_status_registration_path(:id =>registration.id, :status =>'pending'), :method =>'PUT', :remote=>true, role: "menuitem", tabindex: "-1" unless registration.pending? and display_edit_links? %>
36
+
36
37
  <!-- Verify -->
37
- <%= link_to raw("<i class=\"fa fa-circle-o mr-5\"></i> Verify"), update_status_registration_path(:id =>registration.id, :status =>'verified'), :method =>'PUT', :remote=>true, role: "menuitem", tabindex: "-1" unless registration.verified? %>
38
+ <%= link_to raw("<i class=\"fa fa-circle-o mr-5\"></i> Verify"), update_status_registration_path(:id =>registration.id, :status =>'verified'), :method =>'PUT', :remote=>true, role: "menuitem", tabindex: "-1" unless registration.verified? and display_edit_links? %>
38
39
 
39
40
  <!-- Suspend -->
40
- <%= link_to raw("<i class=\"fa fa-edit mr-5\"></i> Suspend"), update_status_registration_path(:id =>registration.id, :status =>'suspended'), :method =>'PUT', :remote=>true, role: "menuitem", tabindex: "-1" unless registration.suspended? %>
41
-
41
+ <%= link_to raw("<i class=\"fa fa-edit mr-5\"></i> Suspend"), update_status_registration_path(:id =>registration.id, :status =>'suspended'), :method =>'PUT', :remote=>true, role: "menuitem", tabindex: "-1" unless registration.suspended? and display_edit_links? %>
42
42
  </td>
43
-
44
- <!-- <td class="action-links" style="width:10%">
45
- <%#= link_to raw("<i class=\"linecons-pencil\"></i> Edit Registration"), edit_link, :remote=>true, class: "edit" if @current_user.super_admin? and registration.can_be_edited? %>
46
43
 
47
- <%#= link_to raw("<i class=\"linecons-trash\"></i> Delete"), delete_link, method: :delete, registration: "menuitem", tabindex: "-1", data: { confirm: 'Are you sure?' }, :remote=>true, class: "delete" if @current_user.super_admin? and registration.can_be_deleted? %>
48
- </td> -->
44
+ <%# edit_link = edit_registration_path(id: registration.id) %>
45
+ <% delete_link = registration_path(id: registration.id) %>
46
+
47
+ <td class="action-links" style="width:10%">
48
+ <%#= link_to raw("<i class=\"linecons-pencil\"></i> Edit Registration"), edit_link, :remote=>true, class: "edit" if registration.can_be_edited? and display_edit_links? %>
49
+
50
+ <%= link_to raw("<i class=\"linecons-trash\"></i> Delete"), delete_link, method: :delete, registration: "menuitem", tabindex: "-1", data: { confirm: 'Are you sure?' }, :remote=>true, class: "delete" if registration.can_be_deleted? and display_delete_links? %>
51
+ </td>
52
+ <% end %>
49
53
 
50
54
  </tr>
@@ -4,7 +4,9 @@
4
4
  <tr>
5
5
  <th style="text-align: center;width:60px">#</th>
6
6
  <th>Name</th>
7
+ <% if display_manage_links? %>
7
8
  <th style="text-align: center;">Actions</th>
9
+ <% end %>
8
10
  </tr>
9
11
  </thead>
10
12
 
@@ -26,13 +28,15 @@
26
28
 
27
29
  <td class="role-name"><%= link_to role.name, role_path(role), remote: true %></td>
28
30
 
29
- <td class="action-links" style="width:10%">
31
+ <% if display_manage_links? %>
30
32
 
31
- <%= link_to raw("<i class=\"linecons-pencil\"></i> Edit Role"), edit_link, :remote=>true, class: "edit" if @current_user.super_admin? and role.can_be_edited? %>
33
+ <td class="action-links" style="width:10%">
34
+ <%= link_to raw("<i class=\"linecons-pencil\"></i> Edit Role"), edit_link, :remote=>true, class: "edit" if role.can_be_edited? and display_edit_links? %>
32
35
 
33
- <%= link_to raw("<i class=\"linecons-trash\"></i> Delete"), delete_link, method: :delete, role: "menuitem", tabindex: "-1", data: { confirm: 'Are you sure?' }, :remote=>true, class: "delete" if @current_user.super_admin? and role.can_be_deleted? %>
36
+ <%= link_to raw("<i class=\"linecons-trash\"></i> Delete"), delete_link, method: :delete, role: "menuitem", tabindex: "-1", data: { confirm: 'Are you sure?' }, :remote=>true, class: "delete" if role.can_be_deleted? and display_delete_links? %>
37
+ </td>
34
38
 
35
- </td>
39
+ <% end %>
36
40
 
37
41
  </tr>
38
42
  <% end %>
@@ -13,12 +13,14 @@
13
13
 
14
14
  <td class="role-name"><%= link_to role.name, role_path(role), remote: true %></td>
15
15
 
16
- <td class="action-links" style="width:10%">
17
-
18
- <%= link_to raw("<i class=\"linecons-pencil\"></i> Edit Role"), edit_link, :remote=>true, class: "edit" if @current_user.super_admin? and role.can_be_edited? %>
19
-
20
- <%= link_to raw("<i class=\"linecons-trash\"></i> Delete"), delete_link, method: :delete, role: "menuitem", tabindex: "-1", data: { confirm: 'Are you sure?' }, :remote=>true, class: "delete" if @current_user.super_admin? and role.can_be_deleted? %>
16
+ <% if display_manage_links? %>
21
17
 
18
+ <td class="action-links" style="width:10%">
19
+ <%= link_to raw("<i class=\"linecons-pencil\"></i> Edit Role"), edit_link, :remote=>true, class: "edit" if role.can_be_edited? and display_edit_links? %>
20
+
21
+ <%= link_to raw("<i class=\"linecons-trash\"></i> Delete"), delete_link, method: :delete, role: "menuitem", tabindex: "-1", data: { confirm: 'Are you sure?' }, :remote=>true, class: "delete" if role.can_be_deleted? and display_delete_links? %>
22
22
  </td>
23
23
 
24
+ <% end %>
25
+
24
26
  </tr>
@@ -16,19 +16,23 @@
16
16
 
17
17
  </div>
18
18
 
19
+ <% if display_manage_links? %>
20
+
19
21
  <div class="col-md-3 col-sm-12 col-xs-12">
20
22
 
21
23
  <% edit_link = edit_role_path(id: @role.id) %>
22
24
  <% delete_link = role_path(id: @role.id) %>
23
25
 
24
- <%= link_to raw("<i class=\"linecons-pencil\"></i> Edit Role"), edit_link, :remote=>true, class: "btn btn-block btn-success" if @current_user.super_admin? and @role.can_be_edited? %>
26
+ <%= link_to raw("<i class=\"linecons-pencil\"></i> Edit Role"), edit_link, :remote=>true, class: "btn btn-block btn-success" if @current_user.super_admin? and @role.can_be_edited? and display_edit_links? %>
25
27
 
26
- <%= link_to raw("<i class=\"linecons-trash\"></i> Delete Role"), delete_link, method: :delete, role: "menuitem", tabindex: "-1", data: { confirm: 'Are you sure?' }, :remote=>true, class: "btn btn-block btn-danger btn-only-hover" if @current_user.super_admin? and @role.can_be_deleted? %>
28
+ <%= link_to raw("<i class=\"linecons-trash\"></i> Delete Role"), delete_link, method: :delete, role: "menuitem", tabindex: "-1", data: { confirm: 'Are you sure?' }, :remote=>true, class: "btn btn-block btn-danger btn-only-hover" if @current_user.super_admin? and @role.can_be_deleted? and display_delete_links? %>
27
29
 
28
30
  <div class="visible-sm visible-xs mb-50"></div>
29
31
 
30
32
  </div>
31
33
 
34
+ <% end %>
35
+
32
36
  </div>
33
37
 
34
38
  <%= clear_tag(50) %>
@@ -59,16 +63,16 @@
59
63
  <div id="div_user_action_buttons">
60
64
  <div class="row">
61
65
  <div class="col-md-6">
66
+ <%= theme_button('Add a User', 'plus', new_role_user_path(@role), classes: "pull-left mr-10", btn_type: "success") if @current_user.has_create_permission?(Role) %>
62
67
 
63
- <%= theme_button('Add a User', 'plus', new_role_user_path(@role), classes: "pull-left", btn_type: "success") %>
64
-
65
- <%= theme_button('Refresh', 'refresh', role_users_path(@role), classes: "pull-left ml-10", btn_type: "white") %>
68
+ <%= theme_button('Refresh', 'refresh', role_users_path(@role), classes: "pull-left mr-10", btn_type: "white") %>
66
69
  </div>
67
70
  <div class="col-md-6">
68
71
  <%= search_form_kuppayam(User, role_users_path(@role), text: "") %>
69
72
  </div>
70
73
  </div>
71
74
  </div>
75
+
72
76
  <%= clear_tag(10) %>
73
77
 
74
78
  <div id="div_user_index">
@@ -11,11 +11,11 @@
11
11
  <div class="row">
12
12
  <div class="col-md-6">
13
13
 
14
- <%= theme_button('Add a Role', 'plus', new_role_path(), classes: "pull-left", btn_type: "success") if @current_user.super_admin? %>
14
+ <%= theme_button('Add a Role', 'plus', new_role_path(), classes: "pull-left mr-10", btn_type: "success") if @current_user.has_create_permission?(Role) %>
15
15
 
16
- <%= theme_button('Refresh', 'refresh', roles_path(), classes: "pull-left ml-10", btn_type: "white") %>
16
+ <%= theme_button('Refresh', 'refresh', roles_path(), classes: "pull-left mr-10", btn_type: "white") %>
17
17
 
18
- <%= theme_button('Manage Users', 'nothing linecons-graduation-cap', users_path(), classes: "pull-left ml-10", btn_type: "white", remote: false) %>
18
+ <%= theme_button('Manage Users', 'nothing linecons-graduation-cap', users_path(), classes: "pull-left mr-10", btn_type: "white", remote: false) if @current_user.has_read_permission?(User) %>
19
19
 
20
20
  <!-- Single button -->
21
21
  <div class="ml-10 btn-group hidden">
@@ -0,0 +1,3 @@
1
+ var heading = "Permission Denied";
2
+ var bodyContent = "Permission Denied";
3
+ showGenericModal(heading, bodyContent);
@@ -6,7 +6,9 @@
6
6
  <th style="text-align: center;width:100px"><i class="fa fa-photo"></i></th>
7
7
  <th>Name</th>
8
8
  <th>Roles</th>
9
+ <% if display_delete_links? %>
9
10
  <th style="text-align: center;" colspan="2">Actions</th>
11
+ <% end %>
10
12
  </tr>
11
13
  </thead>
12
14
 
@@ -39,12 +41,16 @@
39
41
  <% end %>
40
42
  </td>
41
43
 
44
+ <% if display_delete_links? %>
45
+
42
46
  <td class="action-links" style="width:10%">
43
47
 
44
48
  <%= link_to raw("<i class=\"linecons-trash\"></i> Remove Role"), delete_link, method: :delete, user: "menuitem", tabindex: "-1", data: { confirm: 'Are you sure?' }, :remote=>true, class: "delete" %>
45
49
 
46
50
  </td>
47
51
 
52
+ <% end %>
53
+
48
54
  </tr>
49
55
  <% end %>
50
56
  </tbody>
@@ -25,10 +25,14 @@
25
25
  <% end %>
26
26
  </td>
27
27
 
28
+ <% if display_delete_links? %>
29
+
28
30
  <td class="action-links" style="width:10%">
29
31
 
30
32
  <%= link_to raw("<i class=\"linecons-trash\"></i> Remove Role"), delete_link, method: :delete, user: "menuitem", tabindex: "-1", data: { confirm: 'Are you sure?' }, :remote=>true, class: "delete" %>
31
33
 
32
34
  </td>
33
35
 
36
+ <% end %>
37
+
34
38
  </tr>