usman 0.3.9 → 0.3.10
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 +3 -3
- data/app/controllers/usman/admin_controller.rb +1 -18
- data/app/controllers/usman/api/v1/docs_controller.rb +53 -12
- data/app/controllers/usman/application_controller.rb +2 -0
- data/app/controllers/usman/features_controller.rb +4 -2
- data/app/controllers/usman/permissions_controller.rb +34 -3
- data/app/controllers/usman/resource_controller.rb +6 -1
- data/app/controllers/usman/user_roles_controller.rb +1 -0
- data/app/helpers/usman/authentication_helper.rb +102 -34
- data/app/models/feature.rb +2 -2
- data/app/models/permission.rb +11 -0
- data/app/models/user.rb +65 -0
- data/app/services/usman/sms_service.rb +91 -0
- data/app/views/layouts/kuppayam/_sidebar.html.erb +125 -72
- data/app/views/usman/dashboard/_index.html.erb +40 -0
- data/app/views/usman/dashboard/_super_admin_index.html.erb +22 -0
- data/app/views/usman/dashboard/index.html.erb +6 -128
- data/app/views/usman/features/_form.html.erb +1 -1
- data/app/views/usman/features/_index.html.erb +18 -8
- data/app/views/usman/features/_row.html.erb +14 -8
- data/app/views/usman/features/_show.html.erb +13 -10
- data/app/views/usman/features/index.html.erb +2 -2
- data/app/views/usman/permissions/_form.html.erb +2 -2
- data/app/views/usman/permissions/_index.html.erb +6 -5
- data/app/views/usman/permissions/_row.html.erb +6 -5
- data/app/views/usman/permissions/_show.html.erb +5 -5
- data/app/views/usman/permissions/index.html.erb +15 -17
- data/app/views/usman/registration_devices/_index.html.erb +11 -7
- data/app/views/usman/registration_devices/_row.html.erb +18 -18
- data/app/views/usman/registrations/_index.html.erb +17 -13
- data/app/views/usman/registrations/_row.html.erb +14 -10
- data/app/views/usman/roles/_index.html.erb +8 -4
- data/app/views/usman/roles/_row.html.erb +7 -5
- data/app/views/usman/roles/_show.html.erb +9 -5
- data/app/views/usman/roles/index.html.erb +3 -3
- data/app/views/usman/sessions/_permission_denied.js.erb +3 -0
- data/app/views/usman/user_roles/_index.html.erb +6 -0
- data/app/views/usman/user_roles/_row.html.erb +4 -0
- data/app/views/usman/users/_index.html.erb +19 -15
- data/app/views/usman/users/_row.html.erb +17 -15
- data/app/views/usman/users/_show.html.erb +5 -3
- data/app/views/usman/users/index.html.erb +3 -3
- data/config/locales/usman/authentication.ar.yml +5 -2
- data/config/locales/usman/authentication.en.yml +2 -2
- data/config/locales/usman/sms.en.yml +17 -0
- data/config/routes.rb +11 -12
- data/db/data/dummy/permissions.csv +1 -76
- data/db/data/dummy/users.csv +3 -6
- data/db/data/users.csv +3 -1
- data/db/master_data/features.csv +9 -0
- data/db/master_data/roles.csv +1 -0
- data/lib/tasks/usman/data.rake +15 -9
- data/lib/tasks/usman/master_data.rake +7 -3
- data/lib/usman/action_view/permissions_helper.rb +24 -0
- data/lib/usman/engine.rb +6 -0
- data/lib/usman/version.rb +1 -1
- data/lib/usman.rb +1 -0
- metadata +27 -12
- data/app/controllers/usman/api/v1/docs_base_controller.rb +0 -25
- data/app/views/kuppayam/api/docs/_navigation.html.erb +0 -67
- data/db/data/dummy/features.csv +0 -17
- data/db/data/dummy/roles.csv +0 -5
- data/db/data/features.csv +0 -17
- data/db/data/roles.csv +0 -5
@@ -0,0 +1,91 @@
|
|
1
|
+
require 'aws-sdk-sns'
|
2
|
+
require 'yaml'
|
3
|
+
|
4
|
+
module Usman
|
5
|
+
class SmsService
|
6
|
+
|
7
|
+
attr_reader :dialing_prefix, :mobile_number, :message,
|
8
|
+
:error_heading, :error_message, :error_details,
|
9
|
+
:aws_credentials, :sns_client
|
10
|
+
|
11
|
+
|
12
|
+
def initialize(params)
|
13
|
+
@dialing_prefix = params[:dialing_prefix]
|
14
|
+
@mobile_number = params[:mobile_number]
|
15
|
+
@message = params[:message]
|
16
|
+
@aws_credentials = {}
|
17
|
+
|
18
|
+
# Initialize error variables
|
19
|
+
clear_errors
|
20
|
+
end
|
21
|
+
|
22
|
+
def get_config_file
|
23
|
+
'config/aws-secret.yml'
|
24
|
+
end
|
25
|
+
|
26
|
+
def get_aws_credentials
|
27
|
+
if File.exist?(get_config_file)
|
28
|
+
@aws_credentials = YAML.load_file(get_config_file)
|
29
|
+
unless @aws_credentials.is_a?(Hash) &&
|
30
|
+
@aws_credentials.has_key?("region") &&
|
31
|
+
@aws_credentials.has_key?("access_key_id") &&
|
32
|
+
@aws_credentials.has_key?("secret_access_key")
|
33
|
+
set_error("sms.credentials.invalid_format", errors)
|
34
|
+
return
|
35
|
+
end
|
36
|
+
begin
|
37
|
+
create_sns_client
|
38
|
+
rescue Aws::SNS::Errors::ServiceError
|
39
|
+
set_error("sms.credentials.invalid_credentials", errors)
|
40
|
+
return
|
41
|
+
rescue
|
42
|
+
set_error("sms.credentials.unexpected_error", errors)
|
43
|
+
return
|
44
|
+
end
|
45
|
+
else
|
46
|
+
set_error("sms.credentials.secret_file_not_found", errors)
|
47
|
+
return
|
48
|
+
end
|
49
|
+
@aws_credentials
|
50
|
+
end
|
51
|
+
|
52
|
+
def create_sns_client
|
53
|
+
@sns_client = Aws::SNS::Client.new(
|
54
|
+
region: @aws_credentials["region"],
|
55
|
+
access_key_id: @aws_credentials["access_key_id"],
|
56
|
+
secret_access_key: @aws_credentials["secret_access_key"]
|
57
|
+
)
|
58
|
+
end
|
59
|
+
|
60
|
+
def send_sms
|
61
|
+
# Get AWS Credentials to create an SNS Client
|
62
|
+
get_aws_credentials
|
63
|
+
|
64
|
+
if @error_heading.blank?
|
65
|
+
phone_number = "#{@dialing_prefix}#{@mobile_number}"
|
66
|
+
#@sns_client.publish(phone_number: phone_number, message: @message)
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
def set_error(key, hsh={})
|
71
|
+
@error_heading = I18n.t("#{key}.heading")
|
72
|
+
@error_message = I18n.t("#{key}.message")
|
73
|
+
@error_details = hsh if hsh.is_a?(Hash)
|
74
|
+
end
|
75
|
+
|
76
|
+
def clear_errors
|
77
|
+
@error_heading = nil
|
78
|
+
@error_message = nil
|
79
|
+
@error_details = {}
|
80
|
+
end
|
81
|
+
|
82
|
+
def errors
|
83
|
+
{
|
84
|
+
heading: @error_heading,
|
85
|
+
message: @error_message,
|
86
|
+
details: @error_details
|
87
|
+
}
|
88
|
+
end
|
89
|
+
|
90
|
+
end
|
91
|
+
end
|
@@ -1,114 +1,167 @@
|
|
1
|
+
<%
|
2
|
+
user_items = {
|
3
|
+
users: {
|
4
|
+
text: "Manage Users",
|
5
|
+
icon_class: "fa-user",
|
6
|
+
url: usman.users_url,
|
7
|
+
has_permission: @current_user.has_read_permission?(User)
|
8
|
+
},
|
9
|
+
registrations: {
|
10
|
+
text: "Manage Registrations",
|
11
|
+
icon_class: "fa-mobile",
|
12
|
+
url: usman.registrations_url,
|
13
|
+
has_permission: @current_user.has_read_permission?(Registration)
|
14
|
+
},
|
15
|
+
roles: {
|
16
|
+
text: "Manage Roles",
|
17
|
+
icon_class: "linecons-graduation-cap",
|
18
|
+
url: usman.roles_url,
|
19
|
+
has_permission: @current_user.has_read_permission?(Role)
|
20
|
+
},
|
21
|
+
permissions: {
|
22
|
+
text: "Manage Permissions",
|
23
|
+
icon_class: "fa-lock",
|
24
|
+
url: usman.permissions_url,
|
25
|
+
has_permission: @current_user.has_read_permission?(Permission)
|
26
|
+
}
|
27
|
+
}
|
28
|
+
%>
|
29
|
+
<%
|
30
|
+
configuration_items = {
|
31
|
+
features: {
|
32
|
+
text: "Manage Features",
|
33
|
+
icon_class: "linecons-diamond",
|
34
|
+
url: usman.features_url,
|
35
|
+
has_permission: @current_user.has_read_permission?(Feature)
|
36
|
+
}
|
37
|
+
}
|
38
|
+
%>
|
39
|
+
<%
|
40
|
+
pattana_items = {
|
41
|
+
countries: {
|
42
|
+
text: "Manage Countries",
|
43
|
+
icon_class: "fa-flag-checkered",
|
44
|
+
url: pattana.countries_url,
|
45
|
+
has_permission: @current_user.has_read_permission?(Country)
|
46
|
+
},
|
47
|
+
regions: {
|
48
|
+
text: "Manage Regions",
|
49
|
+
icon_class: "fa-globe",
|
50
|
+
url: pattana.regions_url,
|
51
|
+
has_permission: @current_user.has_read_permission?(Region)
|
52
|
+
},
|
53
|
+
cities: {
|
54
|
+
text: "Manage Cities",
|
55
|
+
icon_class: "fa-map-marker",
|
56
|
+
url: pattana.cities_url,
|
57
|
+
has_permission: @current_user.has_read_permission?(City)
|
58
|
+
},
|
59
|
+
|
60
|
+
}
|
61
|
+
%>
|
62
|
+
|
1
63
|
<div class="sidebar-menu toggle-others fixed collapsed">
|
2
64
|
|
3
65
|
<div class="sidebar-menu-inner">
|
4
66
|
|
5
67
|
<header class="logo-env">
|
6
|
-
|
7
68
|
<!-- logo -->
|
8
69
|
<div class="logo">
|
9
|
-
<a href="/" class="logo-expanded">
|
10
|
-
|
11
|
-
</a>
|
12
|
-
|
13
|
-
<a href="/" class="logo-collapsed">
|
14
|
-
<img src="/assets/logo-small.png" width="40" alt="" />
|
15
|
-
</a>
|
70
|
+
<a href="/" class="logo-expanded"><img src="/assets/logo.png" width="180" alt="" /></a>
|
71
|
+
<a href="/" class="logo-collapsed"><img src="/assets/logo-small.png" width="40" alt="" /></a>
|
16
72
|
</div>
|
17
73
|
|
18
74
|
<!-- This will toggle the mobile menu and will be visible only on mobile devices -->
|
19
75
|
<div class="mobile-menu-toggle visible-xs">
|
76
|
+
<!-- <a href="#" data-toggle="notifications-menu">
|
77
|
+
<i class="fa-bell-o"></i><span class="badge badge-success">7</span>
|
78
|
+
</a> -->
|
20
79
|
<a href="#" data-toggle="user-info-menu">
|
21
|
-
|
22
|
-
<span class="badge badge-success">7</span>
|
23
|
-
</a>
|
24
|
-
|
25
|
-
<a href="#" data-toggle="mobile-menu">
|
26
|
-
<i class="fa-bars"></i>
|
80
|
+
<%= display_image(@current_user, "profile_picture.image.small.url", width: "32", height: "auto", class: "img-circle img-inline userpic-32", alt: @current_user.display_name) %>
|
27
81
|
</a>
|
82
|
+
<a href="#" data-toggle="mobile-menu"><i class="fa-bars"></i></a>
|
28
83
|
</div>
|
29
|
-
|
30
84
|
</header>
|
31
85
|
|
32
|
-
|
33
|
-
|
34
|
-
<ul id="main-menu" class="main-menu">
|
35
|
-
|
36
|
-
<!-- add class "multiple-expanded" to allow multiple submenus to open -->
|
37
|
-
|
38
|
-
<!-- class "auto-inherit-active-class" will automatically add "active" class for parent elements who are marked already with class "active" -->
|
39
|
-
|
86
|
+
<!-- add class "multiple-expanded" to allow multiple submenus to open -->
|
87
|
+
<!-- class "auto-inherit-active-class" will automatically add "active" class for parent elements who are marked already with class "active" -->
|
88
|
+
<ul id="main-menu" class="main-menu multiple-expanded auto-inherit-active-class">
|
40
89
|
<!-- Admin Dashboard -->
|
41
90
|
<% if @current_user.super_admin? || @current_user.has_role?("Site Admin") %>
|
42
91
|
<li class="<%= nav_active?('admin/dashboard') ? 'active' : '' %>">
|
43
|
-
<%= link_to raw("<i class=\"linecons-desktop\"></i> <span class='title'>Dashboard</span>"), usman.
|
44
|
-
</li>
|
45
|
-
|
46
|
-
<li class="<%= nav_active?('admin/users') ? 'active' : '' %>">
|
47
|
-
|
48
|
-
<a href="#">
|
49
|
-
<i class="linecons-cog"></i>
|
50
|
-
<span class="title">Admin</span>
|
51
|
-
</a>
|
52
|
-
|
53
|
-
<ul>
|
54
|
-
<li class="<%= nav_class("admin/users") %>">
|
55
|
-
<%= link_to raw("<i class=\"fa-user\"></i> <span class='title'>Manage Users</span>"), usman.users_url %>
|
56
|
-
</li>
|
57
|
-
<li class="<%= nav_class("admin/registrations") %>">
|
58
|
-
<%= link_to raw("<i class=\"fa-mobile\"></i> <span class='title'>Manage Registrations</span>"), usman.registrations_url %>
|
59
|
-
</li>
|
60
|
-
</ul>
|
92
|
+
<%= link_to raw("<i class=\"linecons-desktop\"></i> <span class='title'>Dashboard</span>"), usman.dashboard_path %>
|
61
93
|
</li>
|
62
94
|
<% else %>
|
63
95
|
<li class="<%= nav_active?('profile/dashboard') ? 'active' : '' %>">
|
64
|
-
|
65
|
-
</li>
|
66
|
-
|
67
|
-
<li class="<%= nav_active?('profile/profile') ? 'active' : '' %>">
|
68
|
-
|
69
|
-
<a href="#">
|
70
|
-
<i class="linecons-user"></i>
|
71
|
-
<span class="title">My Account</span>
|
72
|
-
</a>
|
73
|
-
|
74
|
-
<ul>
|
75
|
-
<li class="<%= nav_class("profile/settings") %>">
|
76
|
-
<%= link_to raw("<i class=\"linecons-cog\"></i> <span class='title'>Settings</span>"), "#" %>
|
77
|
-
</li>
|
78
|
-
</ul>
|
96
|
+
<%= link_to raw("<i class=\"linecons-desktop\"></i> <span class='title'>Dashboard</span>"), usman.my_account_url %>
|
79
97
|
</li>
|
80
98
|
<% end %>
|
81
|
-
|
82
|
-
<% if @current_user.super_admin? %>
|
99
|
+
|
83
100
|
<li class="">
|
84
|
-
<a href="
|
85
|
-
<i class="
|
86
|
-
<span class="title">
|
101
|
+
<a href="#">
|
102
|
+
<i class="fa-group"></i>
|
103
|
+
<span class="title">Manage Users</span>
|
87
104
|
</a>
|
88
|
-
|
89
105
|
<ul>
|
106
|
+
<% user_items.each do |key, values| %>
|
107
|
+
<% next unless values[:has_permission] %>
|
90
108
|
<li class="">
|
91
|
-
<%= link_to raw("<i class=\"
|
109
|
+
<%= link_to raw("<i class=\"#{values[:icon_class]}\"></i> <span class='title'>#{values[:text]}</span>"), values[:url] %>
|
92
110
|
</li>
|
111
|
+
<% end %>
|
112
|
+
</ul>
|
113
|
+
</li>
|
93
114
|
|
115
|
+
<li class="">
|
116
|
+
<a href="#">
|
117
|
+
<i class="fa-cog"></i>
|
118
|
+
<span class="title">Configure</span>
|
119
|
+
</a>
|
120
|
+
<ul>
|
121
|
+
<% configuration_items.each do |key, values| %>
|
122
|
+
<% next unless values[:has_permission] %>
|
94
123
|
<li class="">
|
95
|
-
<%= link_to raw("<i class=\"
|
124
|
+
<%= link_to raw("<i class=\"#{values[:icon_class]}\"></i> <span class='title'>#{values[:text]}</span>"), values[:url] %>
|
96
125
|
</li>
|
126
|
+
<% end %>
|
127
|
+
</ul>
|
128
|
+
</li>
|
97
129
|
|
98
|
-
|
99
|
-
|
130
|
+
<li class="">
|
131
|
+
<a href="#">
|
132
|
+
<i class="fa-globe"></i>
|
133
|
+
<span class="title">Manage Location</span>
|
134
|
+
</a>
|
135
|
+
<ul>
|
136
|
+
<% pattana_items.each do |key, values| %>
|
137
|
+
<% next unless values[:has_permission] %>
|
138
|
+
<li class="">
|
139
|
+
<%= link_to raw("<i class=\"#{values[:icon_class]}\"></i> <span class='title'>#{values[:text]}</span>"), values[:url] %>
|
100
140
|
</li>
|
141
|
+
<% end %>
|
101
142
|
</ul>
|
143
|
+
</li>
|
102
144
|
|
145
|
+
<li class="<%= nav_active?('profile/profile') ? 'active' : '' %>">
|
146
|
+
<a href="#"><i class="linecons-user"></i><span class="title">My Account</span></a>
|
147
|
+
<ul>
|
148
|
+
<li class="<%= nav_class("profile/settings") %>">
|
149
|
+
<%= link_to raw("<i class=\"linecons-cog\"></i> <span class='title'>User Settings</span>"), "#" %>
|
150
|
+
</li>
|
151
|
+
</ul>
|
103
152
|
</li>
|
104
|
-
<% end %>
|
105
153
|
|
106
|
-
<!-- Documentation -->
|
154
|
+
<!-- API Documentation -->
|
107
155
|
<li class="<%= nav_active?('docs/index') ? 'active' : '' %>">
|
108
|
-
<a href="
|
109
|
-
|
110
|
-
|
111
|
-
|
156
|
+
<a href="#"><i class="fa-file-code-o"></i><span class="title">API Documentation</span></a>
|
157
|
+
<ul>
|
158
|
+
<li class="">
|
159
|
+
<a href="/docs/api/v1/register">
|
160
|
+
<i class="fa-group"></i>
|
161
|
+
<span class="title">Authentication APIs</span>
|
162
|
+
</a>
|
163
|
+
</li>
|
164
|
+
</ul>
|
112
165
|
</li>
|
113
166
|
|
114
167
|
</ul>
|
@@ -0,0 +1,40 @@
|
|
1
|
+
<%
|
2
|
+
usman_items = {
|
3
|
+
users: {
|
4
|
+
text: "Users",
|
5
|
+
icon_class: "fa-user",
|
6
|
+
url: usman.users_url,
|
7
|
+
has_permission: @current_user.has_read_permission?(User)
|
8
|
+
},
|
9
|
+
registrations: {
|
10
|
+
text: "Registrations",
|
11
|
+
icon_class: "fa-mobile",
|
12
|
+
url: usman.registrations_url,
|
13
|
+
has_permission: @current_user.has_read_permission?(Registration)
|
14
|
+
},
|
15
|
+
roles: {
|
16
|
+
text: "Roles",
|
17
|
+
icon_class: "linecons-graduation-cap",
|
18
|
+
url: usman.roles_url,
|
19
|
+
has_permission: @current_user.has_read_permission?(Role)
|
20
|
+
},
|
21
|
+
permissions: {
|
22
|
+
text: "Permissions",
|
23
|
+
icon_class: "fa-lock",
|
24
|
+
url: usman.permissions_url,
|
25
|
+
has_permission: @current_user.has_read_permission?(Permission)
|
26
|
+
},
|
27
|
+
}
|
28
|
+
%>
|
29
|
+
|
30
|
+
<% if (usman_items.map{|x, y| y[:has_permission] }).compact.uniq.any? %>
|
31
|
+
|
32
|
+
<h3 class="text-gray mt-50 mb-10">
|
33
|
+
Manage User <br>
|
34
|
+
<small class="text-muted">Manage Users, Role and much more...</small>
|
35
|
+
</h3>
|
36
|
+
<hr class="mb-30" style="border-top:1px solid #ddd;">
|
37
|
+
|
38
|
+
<%= render partial: "/layouts/dashboard/items", locals: { items: usman_items } %>
|
39
|
+
|
40
|
+
<% end %>
|
@@ -0,0 +1,22 @@
|
|
1
|
+
<%
|
2
|
+
super_admin_items = {
|
3
|
+
features: {
|
4
|
+
text: "Features",
|
5
|
+
icon_class: "linecons-diamond",
|
6
|
+
url: usman.features_url,
|
7
|
+
has_permission: @current_user.has_read_permission?(Feature)
|
8
|
+
}
|
9
|
+
}
|
10
|
+
%>
|
11
|
+
|
12
|
+
<% if (super_admin_items.map{|x, y| y[:has_permission] }).compact.uniq.any? %>
|
13
|
+
|
14
|
+
<h3 class="text-gray mt-50 mb-10">
|
15
|
+
Configurations <br>
|
16
|
+
<small class="text-muted">Configure Features & Other Settings </small>
|
17
|
+
</h3>
|
18
|
+
<hr class="mb-30" style="border-top:1px solid #ddd;">
|
19
|
+
|
20
|
+
<%= render partial: "/layouts/dashboard/items", locals: { items: super_admin_items } %>
|
21
|
+
|
22
|
+
<% end %>
|
@@ -1,137 +1,15 @@
|
|
1
|
-
|
2
|
-
items = {
|
3
|
-
users: {
|
4
|
-
counts: {
|
5
|
-
total: User.normal_users.count,
|
6
|
-
approved: User.normal_users.approved.count,
|
7
|
-
pending: User.normal_users.pending.count,
|
8
|
-
suspended: User.normal_users.suspended.count
|
9
|
-
},
|
10
|
-
text: "Users",
|
11
|
-
icon_class: "fa-user",
|
12
|
-
url: usman.users_url
|
13
|
-
},
|
14
|
-
registrations: {
|
15
|
-
counts: {
|
16
|
-
total: Registration.count,
|
17
|
-
pending: Registration.pending.count,
|
18
|
-
verified: Registration.verified.count
|
19
|
-
},
|
20
|
-
text: "Registrations",
|
21
|
-
icon_class: "fa-mobile",
|
22
|
-
url: usman.registrations_url
|
23
|
-
}
|
24
|
-
}
|
25
|
-
%>
|
1
|
+
<%= render partial: "index" %>
|
26
2
|
|
27
|
-
|
28
|
-
Admin <br>
|
29
|
-
<small class="text-muted">Manage Users and much more...</small>
|
30
|
-
</h3>
|
31
|
-
<hr class="mb-30" style="border-top:1px solid #ddd;">
|
3
|
+
<%= render partial: "super_admin_index" if @current_user.super_admin? %>
|
32
4
|
|
33
|
-
|
5
|
+
<%= render partial: "pattana/dashboard/index" %>
|
34
6
|
|
35
|
-
|
36
|
-
<div class="col-lg-4 col-md-4 col-sm-6 col-xs-12">
|
37
|
-
|
38
|
-
<div class="xe-widget xe-vertical-counter xe-vertical-counter-white" data-count=".num" data-from="0" data-to="128" data-duration="4">
|
39
|
-
<div class="xe-icon">
|
40
|
-
<i class="<%= values[:icon_class] %>"></i>
|
41
|
-
</div>
|
42
|
-
|
43
|
-
<div class="xe-label">
|
44
|
-
<strong class="num"><%= values[:text] %></strong>
|
45
|
-
</div>
|
7
|
+
<div style="border-top:1px solid #FFF;margin-top:50px;margin-bottom:70px;"></div>
|
46
8
|
|
47
|
-
|
48
|
-
<% values[:counts].each do |count_text, count_value| %>
|
49
|
-
<span><%= count_text.to_s.titleize %>: <strong><%= count_value %></strong></span>
|
50
|
-
<% end %>
|
51
|
-
</div>
|
52
|
-
|
53
|
-
<div class="xe-label">
|
54
|
-
<span><%= link_to("Manage", values[:url], class: "btn btn-sm btn-primary btn-block") %></span>
|
55
|
-
</div>
|
56
|
-
</div>
|
57
|
-
|
58
|
-
</div>
|
59
|
-
<% end %>
|
60
|
-
</div>
|
61
|
-
|
62
|
-
<% if @current_user.super_admin? %>
|
63
|
-
<%
|
64
|
-
items = {
|
65
|
-
features: {
|
66
|
-
counts: {
|
67
|
-
total: Feature.published.count
|
68
|
-
},
|
69
|
-
text: "Features",
|
70
|
-
icon_class: "linecons-diamond",
|
71
|
-
url: usman.features_url
|
72
|
-
},
|
73
|
-
roles: {
|
74
|
-
counts: {
|
75
|
-
total: Role.count
|
76
|
-
},
|
77
|
-
text: "Roles",
|
78
|
-
icon_class: "linecons-graduation-cap",
|
79
|
-
url: usman.roles_url
|
80
|
-
},
|
81
|
-
permissions: {
|
82
|
-
counts: {
|
83
|
-
total: Permission.count
|
84
|
-
},
|
85
|
-
text: "Permissions",
|
86
|
-
icon_class: "fa-lock",
|
87
|
-
url: usman.permissions_url
|
88
|
-
},
|
89
|
-
|
90
|
-
}
|
91
|
-
%>
|
92
|
-
|
93
|
-
<h3 class="text-gray mt-50 mb-10">
|
94
|
-
Super Admin <br>
|
95
|
-
<small class="text-muted">Manage Features, Permissions and other super admin modules</small>
|
96
|
-
</h3>
|
97
|
-
<hr class="mb-30" style="border-top:1px solid #ddd;">
|
98
|
-
|
99
|
-
<div class="row">
|
100
|
-
|
101
|
-
<% items.each do |key, values| %>
|
102
|
-
<div class="col-lg-4 col-md-4 col-sm-6 col-xs-12">
|
103
|
-
|
104
|
-
<div class="xe-widget xe-vertical-counter xe-vertical-counter-white" data-count=".num" data-from="0" data-to="128" data-duration="4">
|
105
|
-
<div class="xe-icon">
|
106
|
-
<i class="<%= values[:icon_class] %>"></i>
|
107
|
-
</div>
|
108
|
-
|
109
|
-
<div class="xe-label">
|
110
|
-
<strong class="num"><%= values[:text] %></strong>
|
111
|
-
</div>
|
112
|
-
|
113
|
-
<div class="xe-label" style="margin-top:10px; margin-bottom: 10px;height: 100px; overflow-y: auto;">
|
114
|
-
<% values[:counts].each do |count_text, count_value| %>
|
115
|
-
<span><%= count_text.to_s.titleize %>: <strong><%= count_value %></strong></span>
|
116
|
-
<% end %>
|
117
|
-
</div>
|
118
|
-
|
119
|
-
<div class="xe-label">
|
120
|
-
<span><%= link_to("Manage", values[:url], class: "btn btn-sm btn-primary btn-block") %></span>
|
121
|
-
</div>
|
122
|
-
</div>
|
123
|
-
|
124
|
-
</div>
|
125
|
-
<% end %>
|
126
|
-
|
127
|
-
</div>
|
128
|
-
<% end %>
|
129
|
-
|
130
|
-
|
131
|
-
<div class="dx-warning">
|
9
|
+
<div class="dx-warning mt-60">
|
132
10
|
<div>
|
133
11
|
<h2>Usman - API Documentation</h2>
|
134
12
|
<p>All APIs are documented with all cases and examples.</p>
|
135
13
|
<a class="btn btn-success" href="/docs/api/v1/register" target="_blank">Go to the API Documentation</a>
|
136
14
|
</div>
|
137
|
-
</div>
|
15
|
+
</div>
|
@@ -5,17 +5,17 @@
|
|
5
5
|
<th style="text-align: center;width:60px">#</th>
|
6
6
|
<th style="text-align: center;width:100px"><i class="fa fa-photo"></i></th>
|
7
7
|
<th>Name</th>
|
8
|
+
<th>Class Name</th>
|
8
9
|
<th style="width:100px;">Status</th>
|
10
|
+
<% if display_manage_links? %>
|
9
11
|
<th style="text-align: center;" colspan="2">Actions</th>
|
12
|
+
<% end %>
|
10
13
|
</tr>
|
11
14
|
</thead>
|
12
15
|
<tbody>
|
13
16
|
<% @features.each_with_index do |feature, i| %>
|
14
17
|
|
15
|
-
|
16
|
-
<% delete_link = feature_path(id: feature.id) %>
|
17
|
-
|
18
|
-
<tr id="tr_feature_<%= feature.id %>">
|
18
|
+
<tr id="tr_feature_<%= feature.id %>">
|
19
19
|
|
20
20
|
<th scope="row" style="text-align: center;">
|
21
21
|
<% if i < 0 %>
|
@@ -31,6 +31,7 @@
|
|
31
31
|
<% end %>
|
32
32
|
</td>
|
33
33
|
|
34
|
+
<td class="feature-name"><%= link_to feature.display_name, feature_path(feature), remote: true %></td>
|
34
35
|
<td class="feature-name"><%= link_to feature.name, feature_path(feature), remote: true %></td>
|
35
36
|
|
36
37
|
<td>
|
@@ -43,6 +44,11 @@
|
|
43
44
|
<% end %>
|
44
45
|
</td>
|
45
46
|
|
47
|
+
<% edit_link = edit_feature_path(id: feature.id) %>
|
48
|
+
<% delete_link = feature_path(id: feature.id) %>
|
49
|
+
|
50
|
+
<% if display_edit_links? %>
|
51
|
+
|
46
52
|
<td class="action-links" style="width:10%">
|
47
53
|
|
48
54
|
<% case feature.status %>
|
@@ -63,18 +69,22 @@
|
|
63
69
|
<!-- Approve -->
|
64
70
|
<%= link_to raw("<i class=\"fa fa-circle-o mr-5\"></i> Publish"), update_status_feature_path(:id =>feature.id, :status =>'published'), :method =>'PUT', :remote=>true, role: "menuitem", tabindex: "-1",:class=>"feature_status" %>
|
65
71
|
<% end %>
|
66
|
-
|
67
72
|
</td>
|
68
73
|
|
69
|
-
|
74
|
+
<% end %>
|
70
75
|
|
71
|
-
|
76
|
+
<% if display_manage_links? %>
|
72
77
|
|
73
|
-
|
78
|
+
<td class="action-links" style="width:10%">
|
79
|
+
<%= link_to raw("<i class=\"linecons-pencil\"></i> Edit Feature"), edit_link, :remote=>true, class: "edit" if display_edit_links? %>
|
74
80
|
|
81
|
+
<%= 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 display_delete_links? %>
|
75
82
|
</td>
|
76
83
|
|
84
|
+
<% end %>
|
85
|
+
|
77
86
|
</tr>
|
87
|
+
|
78
88
|
<% end %>
|
79
89
|
</tbody>
|
80
90
|
</table>
|
@@ -1,8 +1,5 @@
|
|
1
|
-
<% edit_link = edit_feature_path(id: feature.id) %>
|
2
|
-
<% delete_link = feature_path(id: feature.id) %>
|
3
|
-
|
4
1
|
<tr id="tr_feature_<%= feature.id %>">
|
5
|
-
|
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>
|
@@ -17,6 +14,7 @@
|
|
17
14
|
<% end %>
|
18
15
|
</td>
|
19
16
|
|
17
|
+
<td class="feature-name"><%= link_to feature.display_name, feature_path(feature), remote: true %></td>
|
20
18
|
<td class="feature-name"><%= link_to feature.name, feature_path(feature), remote: true %></td>
|
21
19
|
|
22
20
|
<td>
|
@@ -29,6 +27,11 @@
|
|
29
27
|
<% end %>
|
30
28
|
</td>
|
31
29
|
|
30
|
+
<% edit_link = edit_feature_path(id: feature.id) %>
|
31
|
+
<% delete_link = feature_path(id: feature.id) %>
|
32
|
+
|
33
|
+
<% if display_edit_links? %>
|
34
|
+
|
32
35
|
<td class="action-links" style="width:10%">
|
33
36
|
|
34
37
|
<% case feature.status %>
|
@@ -49,15 +52,18 @@
|
|
49
52
|
<!-- Approve -->
|
50
53
|
<%= link_to raw("<i class=\"fa fa-circle-o mr-5\"></i> Publish"), update_status_feature_path(:id =>feature.id, :status =>'published'), :method =>'PUT', :remote=>true, role: "menuitem", tabindex: "-1",:class=>"feature_status" %>
|
51
54
|
<% end %>
|
52
|
-
|
53
55
|
</td>
|
54
56
|
|
55
|
-
|
57
|
+
<% end %>
|
56
58
|
|
57
|
-
|
59
|
+
<% if display_manage_links? %>
|
58
60
|
|
59
|
-
|
61
|
+
<td class="action-links" style="width:10%">
|
62
|
+
<%= link_to raw("<i class=\"linecons-pencil\"></i> Edit Feature"), edit_link, :remote=>true, class: "edit" if display_edit_links? %>
|
60
63
|
|
64
|
+
<%= 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 display_delete_links? %>
|
61
65
|
</td>
|
62
66
|
|
67
|
+
<% end %>
|
68
|
+
|
63
69
|
</tr>
|