usman 0.3.33 → 0.3.34
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 +5 -5
- data/app/controllers/usman/features_controller.rb +25 -3
- data/app/controllers/usman/permissions_controller.rb +1 -1
- data/app/controllers/usman/users_controller.rb +2 -2
- data/app/models/feature.rb +15 -3
- data/app/uploaders/profile_picture_uploader.rb +2 -2
- data/app/views/layouts/kuppayam/_sidebar.html.erb +1 -1
- data/app/views/usman/dashboard/_index.html.erb +1 -1
- data/app/views/usman/features/_form.html.erb +1 -1
- data/app/views/usman/features/_index.html.erb +13 -8
- data/app/views/usman/features/_permissions.html.erb +54 -0
- data/app/views/usman/features/_row.html.erb +4 -2
- data/app/views/usman/features/_show.html.erb +63 -18
- data/app/views/usman/features/index.html.erb +22 -15
- data/app/views/usman/features/update_permission.js.erb +6 -0
- data/app/views/usman/roles/_index.html.erb +5 -5
- data/app/views/usman/roles/_row.html.erb +4 -4
- data/app/views/usman/roles/_show.html.erb +32 -64
- data/app/views/usman/roles/index.html.erb +1 -1
- data/app/views/usman/user_roles/_index.html.erb +8 -8
- data/app/views/usman/users/_index.html.erb +22 -31
- data/app/views/usman/users/_row.html.erb +23 -29
- data/app/views/usman/users/_show.html.erb +114 -203
- data/config/routes.rb +1 -0
- data/lib/usman/version.rb +1 -1
- metadata +9 -7
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 188ee6ca9f27bceb8aa41bd8664d498116af4d26c774e3f2696ddc62e8b13267
|
|
4
|
+
data.tar.gz: e753877d730f3a44eed3a8cfa13536929a29c2b694b585391ea730aebfcde262
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 91d4e9a582615d692b2f13eb27de6a6a05c31f975ffb7d13daf4dfa6e2e6fabf22583657b6b789caa3ab5770b8b68ffe2b7402dff6a5162b24574504e10ba9c4
|
|
7
|
+
data.tar.gz: a3f993f2d8f67f0fd800d7c5c3e5cf6c7012a1830568a550e8c6e4c7645524898eac59d664c0de765d9daf4d7b62c535df03f947c5d4bed2a8e24d1c18bf0be6
|
|
@@ -2,6 +2,28 @@ module Usman
|
|
|
2
2
|
class FeaturesController < ResourceController
|
|
3
3
|
|
|
4
4
|
before_action :require_super_admin
|
|
5
|
+
|
|
6
|
+
def update_permission
|
|
7
|
+
@permission = Permission.find_by_id(params[:permission_id])
|
|
8
|
+
@user = User.find_by_id(params[:user_id])
|
|
9
|
+
if @permission
|
|
10
|
+
begin
|
|
11
|
+
@permission.toggle!(params[:permission_for])
|
|
12
|
+
@success = true
|
|
13
|
+
rescue
|
|
14
|
+
@success = false
|
|
15
|
+
end
|
|
16
|
+
else
|
|
17
|
+
@permission = Permission.new(user: @user, can_read: false, feature_id: params[:id])
|
|
18
|
+
@permission.assign_attributes(params[:permission_for] => true)
|
|
19
|
+
if @permission.valid?
|
|
20
|
+
@permission.save
|
|
21
|
+
@success = true
|
|
22
|
+
else
|
|
23
|
+
@success = false
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
5
27
|
|
|
6
28
|
private
|
|
7
29
|
|
|
@@ -61,10 +83,10 @@ module Usman
|
|
|
61
83
|
def resource_controller_configuration
|
|
62
84
|
{
|
|
63
85
|
page_title: "Features",
|
|
64
|
-
js_view_path: "/kuppayam/workflows/
|
|
86
|
+
js_view_path: "/kuppayam/workflows/peacock",
|
|
65
87
|
view_path: "/usman/features",
|
|
66
|
-
show_modal_after_create:
|
|
67
|
-
show_modal_after_update:
|
|
88
|
+
show_modal_after_create: true,
|
|
89
|
+
show_modal_after_update: true
|
|
68
90
|
}
|
|
69
91
|
end
|
|
70
92
|
|
|
@@ -73,7 +73,7 @@ module Usman
|
|
|
73
73
|
object_filter: true,
|
|
74
74
|
select_label: 'Select Feature',
|
|
75
75
|
current_value: @feature,
|
|
76
|
-
values: Feature.order(:name).all,
|
|
76
|
+
values: Feature.published.order(:name).all,
|
|
77
77
|
current_filters: @filters,
|
|
78
78
|
url_method_name: 'permissions_url',
|
|
79
79
|
filters_to_remove: [:feature],
|
|
@@ -128,10 +128,10 @@ module Usman
|
|
|
128
128
|
def breadcrumbs_configuration
|
|
129
129
|
{
|
|
130
130
|
heading: "Manage Users",
|
|
131
|
-
icon: "fa-
|
|
131
|
+
icon: "fa-group",
|
|
132
132
|
description: "Listing all Users",
|
|
133
133
|
links: [{name: "Home", link: breadcrumb_home_path, icon: 'fa-home'},
|
|
134
|
-
{name: "Manage Users", link: users_path, icon: 'fa-
|
|
134
|
+
{name: "Manage Users", link: users_path, icon: 'fa-group', active: true}]
|
|
135
135
|
}
|
|
136
136
|
end
|
|
137
137
|
|
data/app/models/feature.rb
CHANGED
|
@@ -1,15 +1,27 @@
|
|
|
1
1
|
class Feature < Usman::ApplicationRecord
|
|
2
2
|
|
|
3
|
+
# Constants
|
|
4
|
+
FEATURE_ICONS = {
|
|
5
|
+
"Dhatu::Product" => "fa-square",
|
|
6
|
+
"Dhatu::Service" => "fa-glass",
|
|
7
|
+
"Dhatu::Project" => "fa-rocket",
|
|
8
|
+
"Dhatu::BlogPost" => "fa-newspaper-o",
|
|
9
|
+
"Dhatu::Price" => "fa-dollar"
|
|
10
|
+
}
|
|
11
|
+
|
|
3
12
|
# Including the State Machine Methods
|
|
4
13
|
include Publishable
|
|
5
14
|
|
|
6
15
|
# Associations
|
|
7
16
|
has_many :permissions
|
|
8
17
|
has_many :users, through: :permissions
|
|
9
|
-
|
|
10
|
-
|
|
18
|
+
has_one :cover_image, :as => :imageable, :dependent => :destroy, :class_name => "Image::CoverImage"
|
|
19
|
+
|
|
11
20
|
# Validations
|
|
12
21
|
validates :name, presence: true, length: {minimum: 3, maximum: 250}
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
13
25
|
|
|
14
26
|
# ------------------
|
|
15
27
|
# Class Methods
|
|
@@ -20,7 +32,7 @@ class Feature < Usman::ApplicationRecord
|
|
|
20
32
|
# == Examples
|
|
21
33
|
# >>> feature.search(query)
|
|
22
34
|
# => ActiveRecord::Relation object
|
|
23
|
-
scope :search, lambda {|query| where("LOWER(name) LIKE LOWER('%#{query}%')")
|
|
35
|
+
scope :search, lambda {|query| where("LOWER(name) LIKE LOWER('%#{query.singularize}%')")
|
|
24
36
|
}
|
|
25
37
|
|
|
26
38
|
scope :categorisable, -> { where(categorisable: true) }
|
|
@@ -5,11 +5,11 @@ class ProfilePictureUploader < ImageUploader
|
|
|
5
5
|
end
|
|
6
6
|
|
|
7
7
|
version :large do
|
|
8
|
-
process :resize_to_fill => [
|
|
8
|
+
process :resize_to_fill => [800, 800]
|
|
9
9
|
end
|
|
10
10
|
|
|
11
11
|
version :small do
|
|
12
|
-
process :resize_to_fill => [
|
|
12
|
+
process :resize_to_fill => [200, 200]
|
|
13
13
|
end
|
|
14
14
|
|
|
15
15
|
end
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
|
|
12
12
|
<div>
|
|
13
13
|
<%= submit_tag("Save", :class=>"btn btn-primary pull-right ml-10") %>
|
|
14
|
-
<%= link_to raw("<i class='fa fa-close mr-5'></i><span>Cancel</span>"), "#", onclick: "
|
|
14
|
+
<%= link_to raw("<i class='fa fa-close mr-5'></i><span>Cancel</span>"), "#", onclick: "closeLargeModal();", class: "pull-right ml-10 btn btn-white" %>
|
|
15
15
|
</div>
|
|
16
16
|
<%= clear_tag(10) %>
|
|
17
17
|
</div>
|
|
@@ -2,13 +2,14 @@
|
|
|
2
2
|
<table class="table table-hover members-table middle-align">
|
|
3
3
|
<thead>
|
|
4
4
|
<tr>
|
|
5
|
-
<th style="text-align: center;width:60px">#</th>
|
|
5
|
+
<th style="text-align: center;width:60px" class="hidden-sm hidden-xs">#</th>
|
|
6
|
+
<th style="text-align: center;width:100px"><i class="fa fa-photo"></i></th>
|
|
6
7
|
<th>Name</th>
|
|
7
|
-
<th>Class Name</th>
|
|
8
|
-
<th>Categorisable</th>
|
|
9
|
-
<th style="width:100px;">Status</th>
|
|
8
|
+
<th class="hidden-sm hidden-xs">Class Name</th>
|
|
9
|
+
<th class="hidden-sm hidden-xs">Categorisable</th>
|
|
10
|
+
<th style="width:100px;" class="hidden-sm hidden-xs">Status</th>
|
|
10
11
|
<% if display_manage_links? %>
|
|
11
|
-
<th style="text-align: center;" colspan="2">Actions</th>
|
|
12
|
+
<th style="text-align: center;" colspan="2" class="hidden-sm hidden-xs">Actions</th>
|
|
12
13
|
<% end %>
|
|
13
14
|
</tr>
|
|
14
15
|
</thead>
|
|
@@ -17,19 +18,23 @@
|
|
|
17
18
|
|
|
18
19
|
<tr id="tr_feature_<%= feature.id %>">
|
|
19
20
|
|
|
20
|
-
<th scope="row" style="text-align: center;">
|
|
21
|
+
<th scope="row" style="text-align: center;" class="hidden-sm hidden-xs">
|
|
21
22
|
<% if i < 0 %>
|
|
22
23
|
<i class="fa fa-check text-success"></i>
|
|
23
24
|
<% else %>
|
|
24
25
|
<%= i + 1 + (@per_page.to_i * (@current_page.to_i - 1)) %>
|
|
25
26
|
<% end %>
|
|
26
27
|
</th>
|
|
28
|
+
|
|
29
|
+
<td class="display-image">
|
|
30
|
+
<%= display_thumbnail(feature, method_name: "cover_image.image.small_square.url", image_width: "50") %>
|
|
31
|
+
</td>
|
|
27
32
|
|
|
28
33
|
<td class="feature-name"><%= link_to feature.display_name, feature_path(feature), remote: true %></td>
|
|
29
34
|
|
|
30
|
-
<td class="feature-name"><%= link_to feature.name, feature_path(feature), remote: true %></td>
|
|
35
|
+
<td class="feature-name hidden-sm hidden-xs"><%= link_to feature.name, feature_path(feature), remote: true %></td>
|
|
31
36
|
|
|
32
|
-
<td><%= feature.display_categorisable %></td>
|
|
37
|
+
<td class="hidden-sm hidden-xs"><%= feature.display_categorisable %></td>
|
|
33
38
|
|
|
34
39
|
<td class="hidden-sm hidden-xs"><%= display_publishable_status(feature) %></td>
|
|
35
40
|
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
<%# @users = User.select("users.*,
|
|
2
|
+
p.id as permission_id,
|
|
3
|
+
p.feature_id as feature_id,
|
|
4
|
+
p.can_create as can_create_value,
|
|
5
|
+
p.can_read as can_read_value,
|
|
6
|
+
p.can_update as can_update_value,
|
|
7
|
+
p.can_delete as can_delete_value
|
|
8
|
+
").
|
|
9
|
+
joins("RIGHT JOIN permissions p on users.id = p.user_id").where("p.feature_id = ?", @feature.id).all %>
|
|
10
|
+
|
|
11
|
+
<% @users = User.normal_users.page(@current_page).per(@per_page) %>
|
|
12
|
+
|
|
13
|
+
<div class="table-responsive">
|
|
14
|
+
<table class="table table-hover members-table middle-align">
|
|
15
|
+
<thead>
|
|
16
|
+
<tr>
|
|
17
|
+
<th>User</th>
|
|
18
|
+
<th style="width:90px;text-align: center;">Create</th>
|
|
19
|
+
<th style="width:90px;text-align: center;">Read</th>
|
|
20
|
+
<th style="width:90px;text-align: center;">Update</th>
|
|
21
|
+
<th style="width:90px;text-align: center;">Delete</th>
|
|
22
|
+
</tr>
|
|
23
|
+
</thead>
|
|
24
|
+
<tbody>
|
|
25
|
+
<% @users.each_with_index do |user, i| %>
|
|
26
|
+
|
|
27
|
+
<% permission = user.permissions.where(feature_id: @feature.id).first || Permission.new(user_id: user.id, can_read: false) %>
|
|
28
|
+
|
|
29
|
+
<tr id="tr_user_<%= user.id %>">
|
|
30
|
+
|
|
31
|
+
<td class="permission-name"><%= user.display_name %></td>
|
|
32
|
+
|
|
33
|
+
<td class="permission-name" style="text-align: center">
|
|
34
|
+
<%= check_box_tag 'can_create_value', permission.can_create.to_s, permission.can_create?, class: 'iswitch iswitch-secondary checkbox permission-checkbox', :data => { :user_id => user.id, :permission_id => permission.id, :feature_id => @feature.id, permission_for: 'can_create' } %>
|
|
35
|
+
</td>
|
|
36
|
+
|
|
37
|
+
<td class="permission-name" style="text-align: center">
|
|
38
|
+
<%= check_box_tag 'can_read', permission.can_read.to_s, permission.can_read?, class: 'iswitch iswitch-secondary checkbox permission-checkbox', :data => { :user_id => user.id, :permission_id => permission.id, :feature_id => @feature.id, permission_for: 'can_read' } %>
|
|
39
|
+
</td>
|
|
40
|
+
|
|
41
|
+
<td class="permission-name" style="text-align: center">
|
|
42
|
+
<%= check_box_tag 'can_update', permission.can_update.to_s, permission.can_update?, class: 'iswitch iswitch-secondary checkbox permission-checkbox', :data => { :user_id => user.id, :permission_id => permission.id, :feature_id => @feature.id, permission_for: 'can_update' } %>
|
|
43
|
+
</td>
|
|
44
|
+
|
|
45
|
+
<td class="permission-name" style="text-align: center">
|
|
46
|
+
<%= check_box_tag 'can_delete', permission.can_delete.to_s, permission.can_delete?, class: 'iswitch iswitch-secondary checkbox permission-checkbox', :data => { :user_id => user.id, :permission_id => permission.id, :feature_id => @feature.id, permission_for: 'can_delete' } %>
|
|
47
|
+
</td>
|
|
48
|
+
|
|
49
|
+
</tr>
|
|
50
|
+
<% end %>
|
|
51
|
+
</tbody>
|
|
52
|
+
</table>
|
|
53
|
+
</div>
|
|
54
|
+
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
<tr id="tr_feature_<%= feature.id %>">
|
|
2
|
-
|
|
3
2
|
<th scope="row" style="text-align: center;">
|
|
4
3
|
<% if i < 0 %>
|
|
5
4
|
<i class="fa fa-check text-success"></i>
|
|
@@ -7,6 +6,10 @@
|
|
|
7
6
|
<%= i + 1 + (@per_page.to_i * (@current_page.to_i - 1)) %>
|
|
8
7
|
<% end %>
|
|
9
8
|
</th>
|
|
9
|
+
|
|
10
|
+
<td class="display-image">
|
|
11
|
+
<%= display_thumbnail(feature, method_name: "cover_image.image.small_square.url", image_width: "50") %>
|
|
12
|
+
</td>
|
|
10
13
|
|
|
11
14
|
<td class="feature-name"><%= link_to feature.display_name, feature_path(feature), remote: true %></td>
|
|
12
15
|
|
|
@@ -23,5 +26,4 @@
|
|
|
23
26
|
<%= display_manage_links(feature, @current_user) %>
|
|
24
27
|
</td>
|
|
25
28
|
<% end %>
|
|
26
|
-
|
|
27
29
|
</tr>
|
|
@@ -2,18 +2,19 @@
|
|
|
2
2
|
|
|
3
3
|
<div class="row">
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
"
|
|
9
|
-
upload_image_link(@feature, :
|
|
10
|
-
remove_image_link(@feature, :
|
|
11
|
-
image_options: {assoc_name: :
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
</div>
|
|
16
|
-
<div class="col-md-
|
|
5
|
+
<div class="col-md-3 col-sm-6 col-xs-12" style="border-right:1px solid #f1f1f1;">
|
|
6
|
+
<% if display_edit_links? %>
|
|
7
|
+
<%= edit_image(@feature,
|
|
8
|
+
"cover_image.image.small_square.url",
|
|
9
|
+
upload_image_link(@feature, :cover_image, nil ),
|
|
10
|
+
remove_image_link(@feature, :cover_image, nil ),
|
|
11
|
+
image_options: {assoc_name: :cover_image }) %>
|
|
12
|
+
<% else %>
|
|
13
|
+
<%= display_image(@feature, "feature_image.image.small_square.url", class: "img-inline", alt: @feature.display_name) %>
|
|
14
|
+
<% end %>
|
|
15
|
+
</div>
|
|
16
|
+
<div class="col-md-6 col-sm-6 col-xs-12" style="border-right:1px solid #f1f1f1;">
|
|
17
|
+
<div class="visible-sm visible-xs mt-30"></div>
|
|
17
18
|
<%= theme_panel_heading(@feature.display_name) %>
|
|
18
19
|
<%= theme_panel_sub_heading(@feature.name, "#") %>
|
|
19
20
|
<%= clear_tag(10) %>
|
|
@@ -24,12 +25,8 @@
|
|
|
24
25
|
<th>Categorisable</th><td><%= @feature.categorisable ? "Yes" : "No" %></td>
|
|
25
26
|
</tr>
|
|
26
27
|
<tr>
|
|
27
|
-
<th>
|
|
28
|
-
</tr>
|
|
29
|
-
<tr>
|
|
30
|
-
<th>Updated At</th><td><%= @feature.updated_at.strftime("%m/%d/%Y - %H:%M:%S") if @feature.updated_at %></td>
|
|
28
|
+
<th>Status</th><td><%= display_publishable_status(@feature) %></td>
|
|
31
29
|
</tr>
|
|
32
|
-
|
|
33
30
|
</tbody>
|
|
34
31
|
</table>
|
|
35
32
|
</div>
|
|
@@ -45,6 +42,54 @@
|
|
|
45
42
|
</div>
|
|
46
43
|
|
|
47
44
|
<%= clear_tag(30) %>
|
|
48
|
-
|
|
45
|
+
|
|
46
|
+
<div><strong class="fs-18">User Permissions</strong></div>
|
|
47
|
+
<hr>
|
|
48
|
+
|
|
49
|
+
<div id="div_user_action_buttons">
|
|
50
|
+
<div class="row">
|
|
51
|
+
<div class="col-md-6">
|
|
52
|
+
<%#= 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) %>
|
|
53
|
+
|
|
54
|
+
<%#= theme_button('Refresh', 'refresh', role_users_path(@role), classes: "pull-left mr-10", btn_type: "white") %>
|
|
55
|
+
</div>
|
|
56
|
+
<div class="col-md-6">
|
|
57
|
+
<%#= search_form_kuppayam(User, role_users_path(@role), text: "") %>
|
|
58
|
+
</div>
|
|
59
|
+
</div>
|
|
60
|
+
</div>
|
|
61
|
+
|
|
62
|
+
<%= clear_tag(10) %>
|
|
63
|
+
|
|
64
|
+
<div id="div_permissions_index">
|
|
65
|
+
<%= render :partial=>"permissions" %>
|
|
66
|
+
</div>
|
|
67
|
+
|
|
68
|
+
<%= clear_tag(30) %>
|
|
69
|
+
|
|
70
|
+
<% if @current_user.super_admin? %>
|
|
71
|
+
<div><strong class="fs-18">Technical Details</strong></div>
|
|
72
|
+
<hr>
|
|
73
|
+
<div class="table-responsive">
|
|
74
|
+
<table class="table table-striped table-condensed table-bordered mb-30">
|
|
75
|
+
<tbody>
|
|
76
|
+
|
|
77
|
+
<tr>
|
|
78
|
+
<th>ID</th><td><%= @feature.id %></td>
|
|
79
|
+
<th>Class Name</th><td><%= @feature.name %></td>
|
|
80
|
+
</tr>
|
|
81
|
+
|
|
82
|
+
<tr>
|
|
83
|
+
<th>Created At</th><td><%= @feature.created_at.strftime("%m/%d/%Y - %H:%M:%S") if @feature.created_at %></td>
|
|
84
|
+
<th>Updated At</th><td><%= @feature.updated_at.strftime("%m/%d/%Y - %H:%M:%S") if @feature.updated_at %></td>
|
|
85
|
+
</tr>
|
|
86
|
+
|
|
87
|
+
</tbody>
|
|
88
|
+
</table>
|
|
89
|
+
</div>
|
|
90
|
+
<% end %>
|
|
91
|
+
|
|
92
|
+
<%= clear_tag(10) %>
|
|
93
|
+
<%= link_to "Close", "#", onclick: "closeLargeModal();", class: "btn btn-primary pull-right" %>
|
|
49
94
|
<%= clear_tag(10) %>
|
|
50
95
|
</div>
|
|
@@ -14,20 +14,7 @@
|
|
|
14
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
16
|
<%= theme_button('Refresh', 'refresh', features_path(), classes: "pull-left mr-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>
|
|
30
|
-
|
|
17
|
+
|
|
31
18
|
</div>
|
|
32
19
|
<div class="col-md-6">
|
|
33
20
|
<%= search_form_kuppayam(Feature, features_path, text: @filters[:query]) %>
|
|
@@ -46,4 +33,24 @@
|
|
|
46
33
|
|
|
47
34
|
</div>
|
|
48
35
|
|
|
49
|
-
</div>
|
|
36
|
+
</div>
|
|
37
|
+
|
|
38
|
+
<script type="text/javascript">
|
|
39
|
+
$(document).on('change', 'input.permission-checkbox[type="checkbox"]', function(e) {
|
|
40
|
+
var userId = $(this).attr("data-user-id");
|
|
41
|
+
var permissionId = $(this).attr("data-permission-id");
|
|
42
|
+
var permissionFor = $(this).attr("data-permission-for");
|
|
43
|
+
var featureId = $(this).attr("data-feature-id");
|
|
44
|
+
$.ajax({
|
|
45
|
+
type: "PUT",
|
|
46
|
+
url: "/admin/features/"+ featureId +"/update_permission",
|
|
47
|
+
data: { user_id: userId, permission_for: permissionFor, permission_id: permissionId, value: $(this).val() },
|
|
48
|
+
success: function(response){
|
|
49
|
+
$(".post-votes-count").text("100");
|
|
50
|
+
},
|
|
51
|
+
error: function(response){
|
|
52
|
+
alert("Error:" + response);
|
|
53
|
+
}
|
|
54
|
+
})
|
|
55
|
+
});
|
|
56
|
+
</script>
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
<table class="table table-hover members-table middle-align">
|
|
3
3
|
<thead>
|
|
4
4
|
<tr>
|
|
5
|
-
<th style="
|
|
5
|
+
<th style=";width:60px" class="hidden-sm hidden-xs">#</th>
|
|
6
6
|
<th>Name</th>
|
|
7
7
|
<% if display_manage_links? %>
|
|
8
|
-
<th style="text-align: center;">Actions</th>
|
|
8
|
+
<th style="text-align: center;" class="hidden-sm hidden-xs">Actions</th>
|
|
9
9
|
<% end %>
|
|
10
|
-
</tr>
|
|
10
|
+
</tr>
|
|
11
11
|
</thead>
|
|
12
12
|
|
|
13
13
|
<tbody>
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
|
|
19
19
|
<tr id="tr_role_<%= role.id %>">
|
|
20
20
|
|
|
21
|
-
<th scope="row" style="
|
|
21
|
+
<th scope="row" style="" class="hidden-sm hidden-xs">
|
|
22
22
|
<% if i < 0 %>
|
|
23
23
|
<i class="fa fa-check text-success"></i>
|
|
24
24
|
<% else %>
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
|
|
31
31
|
<% if display_manage_links? %>
|
|
32
32
|
|
|
33
|
-
<td class="action-links" style="width:10%">
|
|
33
|
+
<td class="action-links hidden-xs hidden-sm" style="width:10%">
|
|
34
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? %>
|
|
35
35
|
|
|
36
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? %>
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
<% delete_link = role_path(id: role.id) %>
|
|
3
3
|
|
|
4
4
|
<tr id="tr_role_<%= role.id %>">
|
|
5
|
-
|
|
6
|
-
<th scope="row" style="
|
|
5
|
+
|
|
6
|
+
<th scope="row" style="" class="hidden-sm hidden-xs">
|
|
7
7
|
<% if i < 0 %>
|
|
8
8
|
<i class="fa fa-check text-success"></i>
|
|
9
9
|
<% else %>
|
|
@@ -15,9 +15,9 @@
|
|
|
15
15
|
|
|
16
16
|
<% if display_manage_links? %>
|
|
17
17
|
|
|
18
|
-
<td class="action-links" style="width:10%">
|
|
18
|
+
<td class="action-links hidden-xs hidden-sm" style="width:10%">
|
|
19
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
|
-
|
|
20
|
+
|
|
21
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
|
|
|
@@ -35,74 +35,42 @@
|
|
|
35
35
|
|
|
36
36
|
</div>
|
|
37
37
|
|
|
38
|
-
<%= clear_tag(
|
|
39
|
-
|
|
40
|
-
<ul class="nav nav-pills">
|
|
41
|
-
|
|
42
|
-
<li class="active">
|
|
43
|
-
<a href="#user_roles" data-toggle="tab" aria-expanded="false">
|
|
44
|
-
<span class="visible-xs"><i class="fa-database"></i></span>
|
|
45
|
-
<span class="hidden-xs">Users</span>
|
|
46
|
-
</a>
|
|
47
|
-
</li>
|
|
48
|
-
|
|
49
|
-
<li class="">
|
|
50
|
-
<a href="#technical_details" data-toggle="tab" aria-expanded="false">
|
|
51
|
-
<span class="visible-xs"><i class="fa-database"></i></span>
|
|
52
|
-
<span class="hidden-xs">Technical Details</span>
|
|
53
|
-
</a>
|
|
54
|
-
</li>
|
|
55
|
-
</ul>
|
|
56
|
-
|
|
57
|
-
<div class="tab-content">
|
|
58
|
-
|
|
59
|
-
<div class="tab-pane active" id="user_roles" style="border: 1px solid #000;min-height:200px;padding:20px;margin-bottom:20px;max-height: 400px;overflow-y: auto;">
|
|
60
|
-
|
|
61
|
-
<%= clear_tag(20) %>
|
|
62
|
-
|
|
63
|
-
<div id="div_user_action_buttons">
|
|
64
|
-
<div class="row">
|
|
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) %>
|
|
67
|
-
|
|
68
|
-
<%= theme_button('Refresh', 'refresh', role_users_path(@role), classes: "pull-left mr-10", btn_type: "white") %>
|
|
69
|
-
</div>
|
|
70
|
-
<div class="col-md-6">
|
|
71
|
-
<%= search_form_kuppayam(User, role_users_path(@role), text: "") %>
|
|
72
|
-
</div>
|
|
73
|
-
</div>
|
|
74
|
-
</div>
|
|
75
|
-
|
|
76
|
-
<%= clear_tag(10) %>
|
|
38
|
+
<%= clear_tag(30) %>
|
|
77
39
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
</div>
|
|
81
|
-
</div>
|
|
40
|
+
<div><strong class="fs-18">Users</strong></div>
|
|
41
|
+
<hr>
|
|
82
42
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
<div class="table-responsive">
|
|
88
|
-
<table class="table table-striped table-condensed table-bordered mb-30">
|
|
89
|
-
<tbody>
|
|
90
|
-
|
|
91
|
-
<tr>
|
|
92
|
-
<th>ID</th><td colspan="3"><%= @role.id %></td>
|
|
93
|
-
</tr>
|
|
94
|
-
|
|
95
|
-
<tr>
|
|
96
|
-
<th>Created At</th><td><%= @role.created_at.strftime("%m/%d/%Y - %H:%M:%S") if @role.created_at %></td>
|
|
97
|
-
<th>Updated At</th><td><%= @role.updated_at.strftime("%m/%d/%Y - %H:%M:%S") if @role.updated_at %></td>
|
|
98
|
-
</tr>
|
|
99
|
-
|
|
100
|
-
</tbody>
|
|
101
|
-
</table>
|
|
102
|
-
</div>
|
|
103
|
-
</div>
|
|
43
|
+
<div id="div_user_action_buttons">
|
|
44
|
+
<div class="row">
|
|
45
|
+
<div class="col-md-6">
|
|
46
|
+
<%= 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) %>
|
|
104
47
|
|
|
48
|
+
<%= theme_button('Refresh', 'refresh', role_users_path(@role), classes: "pull-left mr-10", btn_type: "white") %>
|
|
49
|
+
</div>
|
|
50
|
+
<div class="col-md-6">
|
|
51
|
+
<%= search_form_kuppayam(User, role_users_path(@role), text: "") %>
|
|
52
|
+
</div>
|
|
53
|
+
</div>
|
|
54
|
+
</div>
|
|
55
|
+
<%= clear_tag(10) %>
|
|
56
|
+
<div id="div_user_index">
|
|
57
|
+
<%= render :partial=>"usman/user_roles/index" %>
|
|
58
|
+
</div>
|
|
59
|
+
|
|
60
|
+
<% if @current_user.super_admin? %>
|
|
61
|
+
<%= clear_tag(30) %>
|
|
62
|
+
<div><strong class="fs-18">Technical Details</strong></div>
|
|
63
|
+
<hr>
|
|
64
|
+
<div class="table-responsive">
|
|
65
|
+
<table class="table table-striped table-condensed table-bordered mb-30">
|
|
66
|
+
<tbody>
|
|
67
|
+
<tr><th>ID</th><td colspan="3"><%= @role.id %></td></tr>
|
|
68
|
+
<tr><th>Created At</th><td><%= @role.created_at.strftime("%m/%d/%Y - %H:%M:%S") if @role.created_at %></td>
|
|
69
|
+
<tr><th>Updated At</th><td><%= @role.updated_at.strftime("%m/%d/%Y - %H:%M:%S") if @role.updated_at %></td></tr>
|
|
70
|
+
</tbody>
|
|
71
|
+
</table>
|
|
105
72
|
</div>
|
|
73
|
+
<% end %>
|
|
106
74
|
|
|
107
75
|
<%= link_to "Close", "#", onclick: "closeLargeModal();", class: "btn btn-primary pull-right" %>
|
|
108
76
|
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
|
|
16
16
|
<%= theme_button('Refresh', 'refresh', roles_path(), classes: "pull-left mr-10", btn_type: "white") %>
|
|
17
17
|
|
|
18
|
-
<%= theme_button('Manage Users', '
|
|
18
|
+
<%= theme_button('Manage Users', 'group', 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">
|