usman 0.1.6dev2 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/images/android-icon-144x144.png +0 -0
- data/app/assets/images/android-icon-192x192.png +0 -0
- data/app/assets/images/android-icon-36x36.png +0 -0
- data/app/assets/images/android-icon-48x48.png +0 -0
- data/app/assets/images/android-icon-72x72.png +0 -0
- data/app/assets/images/android-icon-96x96.png +0 -0
- data/app/assets/images/apple-icon-114x114.png +0 -0
- data/app/assets/images/apple-icon-120x120.png +0 -0
- data/app/assets/images/apple-icon-144x144.png +0 -0
- data/app/assets/images/apple-icon-152x152.png +0 -0
- data/app/assets/images/apple-icon-180x180.png +0 -0
- data/app/assets/images/apple-icon-57x57.png +0 -0
- data/app/assets/images/apple-icon-60x60.png +0 -0
- data/app/assets/images/apple-icon-72x72.png +0 -0
- data/app/assets/images/apple-icon-76x76.png +0 -0
- data/app/assets/images/apple-icon-precomposed.png +0 -0
- data/app/assets/images/apple-icon.png +0 -0
- data/app/assets/images/browserconfig.xml +2 -0
- data/app/assets/images/favicon-16x16.png +0 -0
- data/app/assets/images/favicon-32x32.png +0 -0
- data/app/assets/images/favicon-96x96.png +0 -0
- data/app/assets/images/favicon.ico +0 -0
- data/app/assets/images/logo-on-white.png +0 -0
- data/app/assets/images/logo-small.png +0 -0
- data/app/assets/images/logo.png +0 -0
- data/app/assets/images/manifest.json +41 -0
- data/app/assets/images/ms-icon-144x144.png +0 -0
- data/app/assets/images/ms-icon-150x150.png +0 -0
- data/app/assets/images/ms-icon-310x310.png +0 -0
- data/app/assets/images/ms-icon-70x70.png +0 -0
- data/app/assets/sketches/logo.sketch +0 -0
- data/app/controllers/api/v1/base_controller.rb +13 -0
- data/app/controllers/api/v1/registrations_controller.rb +41 -0
- data/app/controllers/usman/admin_controller.rb +26 -0
- data/app/controllers/usman/application_controller.rb +16 -0
- data/app/controllers/usman/dashboard_controller.rb +26 -0
- data/app/controllers/usman/features_controller.rb +83 -0
- data/app/controllers/usman/my_account_controller.rb +25 -0
- data/app/controllers/usman/permissions_controller.rb +85 -0
- data/app/controllers/usman/resource_controller.rb +21 -0
- data/app/controllers/usman/roles_controller.rb +68 -0
- data/app/controllers/usman/sessions_controller.rb +4 -1
- data/app/controllers/usman/user_roles_controller.rb +141 -0
- data/app/controllers/usman/users_controller.rb +133 -0
- data/app/helpers/usman/api_helper.rb +79 -0
- data/app/helpers/usman/authentication_helper.rb +21 -7
- data/app/models/device.rb +149 -0
- data/app/models/feature.rb +11 -7
- data/app/models/permission.rb +17 -13
- data/app/models/registration.rb +108 -0
- data/app/models/role.rb +11 -7
- data/app/models/user.rb +19 -13
- data/app/services/usman/mobile_registration_service.rb +127 -0
- data/app/views/layouts/kuppayam/_sidebar.html.erb +39 -19
- data/app/views/layouts/kuppayam/profile.html.erb +120 -0
- data/app/views/usman/dashboard/index.html.erb +118 -0
- data/app/views/usman/{admin/features → features}/_form.html.erb +1 -1
- data/app/views/usman/{admin/features → features}/_index.html.erb +10 -10
- data/app/views/usman/{admin/features → features}/_row.html.erb +10 -10
- data/app/views/usman/{admin/features → features}/_show.html.erb +2 -2
- data/app/views/usman/{admin/features → features}/index.html.erb +4 -4
- data/app/views/usman/my_account/index.html.erb +1 -0
- data/app/views/usman/{admin/permissions → permissions}/_form.html.erb +1 -1
- data/app/views/usman/{admin/permissions → permissions}/_index.html.erb +2 -2
- data/app/views/usman/{admin/permissions → permissions}/_row.html.erb +2 -2
- data/app/views/usman/{admin/permissions → permissions}/_show.html.erb +2 -2
- data/app/views/usman/{admin/permissions → permissions}/index.html.erb +4 -4
- data/app/views/usman/{admin/roles → roles}/_form.html.erb +1 -1
- data/app/views/usman/{admin/roles → roles}/_index.html.erb +3 -3
- data/app/views/usman/{admin/roles → roles}/_row.html.erb +3 -3
- data/app/views/usman/{admin/roles → roles}/_show.html.erb +6 -6
- data/app/views/usman/{admin/roles → roles}/index.html.erb +5 -5
- data/app/views/usman/sessions/_form.html.erb +1 -1
- data/app/views/usman/{admin/user_roles → user_roles}/_form.html.erb +1 -1
- data/app/views/usman/{admin/user_roles → user_roles}/_index.html.erb +2 -2
- data/app/views/usman/{admin/user_roles → user_roles}/_row.html.erb +3 -3
- data/app/views/usman/{admin/users → users}/_form.html.erb +1 -1
- data/app/views/usman/{admin/users → users}/_index.html.erb +9 -9
- data/app/views/usman/{admin/users → users}/_row.html.erb +9 -9
- data/app/views/usman/{admin/users → users}/_show.html.erb +8 -8
- data/app/views/usman/{admin/users → users}/index.html.erb +8 -8
- data/config/locales/usman/mobile_registration.ar.yml +14 -0
- data/config/locales/usman/mobile_registration.en.yml +14 -0
- data/config/routes.rb +25 -21
- data/db/master_data/roles.csv +2 -0
- data/db/migrate/{20170728095744_create_otp_registrations.rb → 20170819113217_create_registrations.rb} +4 -4
- data/db/migrate/20170819113218_add_registration_id_to_users.rb +7 -0
- data/db/migrate/20170819113219_create_devices.rb +41 -0
- data/lib/tasks/usman/data.rake +85 -0
- data/lib/tasks/usman/master_data.rake +44 -0
- data/lib/usman/engine.rb +2 -1
- data/lib/usman/version.rb +1 -1
- metadata +111 -52
- data/app/controllers/usman/admin/base_controller.rb +0 -46
- data/app/controllers/usman/admin/dashboard_controller.rb +0 -26
- data/app/controllers/usman/admin/features_controller.rb +0 -83
- data/app/controllers/usman/admin/permissions_controller.rb +0 -85
- data/app/controllers/usman/admin/resource_controller.rb +0 -17
- data/app/controllers/usman/admin/roles_controller.rb +0 -68
- data/app/controllers/usman/admin/user_roles_controller.rb +0 -142
- data/app/controllers/usman/admin/users_controller.rb +0 -133
- data/app/views/usman/admin/dashboard/index.html.erb +0 -51
- data/config/initializers/overide_kuppayam_controllers.rb +0 -74
- data/lib/tasks/usman/all.rake +0 -73
- /data/app/views/usman/{admin/permissions → permissions}/_action_buttons.html.erb +0 -0
- /data/config/locales/{kuppayam → usman}/authentication.ar.yml +0 -0
- /data/config/locales/{kuppayam → usman}/authentication.en.yml +0 -0
- /data/db/{import_data → data}/dummy/features.csv +0 -0
- /data/db/{import_data → data}/dummy/permissions.csv +0 -0
- /data/db/{import_data → data}/dummy/roles.csv +0 -0
- /data/db/{import_data → data}/dummy/users.csv +0 -0
- /data/db/{import_data → data}/features.csv +0 -0
- /data/db/{import_data → data}/permissions.csv +0 -0
- /data/db/{import_data → data}/roles.csv +0 -0
- /data/db/{import_data → data}/users.csv +0 -0
@@ -0,0 +1,108 @@
|
|
1
|
+
class Registration < ApplicationRecord
|
2
|
+
|
3
|
+
# Constants
|
4
|
+
PENDING = "pending"
|
5
|
+
VERIFIED = "verified"
|
6
|
+
|
7
|
+
STATUS = {
|
8
|
+
PENDING => "Pending",
|
9
|
+
VERIFIED => "Verified"
|
10
|
+
}
|
11
|
+
|
12
|
+
STATUS_REVERSE = {
|
13
|
+
"Pending" => PENDING,
|
14
|
+
"Verified" => VERIFIED
|
15
|
+
}
|
16
|
+
|
17
|
+
# Associations
|
18
|
+
has_one :user
|
19
|
+
belongs_to :country
|
20
|
+
belongs_to :city, optional: true
|
21
|
+
has_many :devices
|
22
|
+
|
23
|
+
# Validations
|
24
|
+
validates :dialing_prefix, presence: true, length: {minimum: 2, maximum: 4}
|
25
|
+
validates :mobile_number, presence: true, length: {minimum: 9, maximum: 11}
|
26
|
+
validates :status, :presence => true, :inclusion => {:in => STATUS.keys, :presence_of => :status, :message => "%{value} is not a valid status" }
|
27
|
+
|
28
|
+
# ------------------
|
29
|
+
# Class Methods
|
30
|
+
# ------------------
|
31
|
+
|
32
|
+
# return an active record relation object with the search query in its where clause
|
33
|
+
# Return the ActiveRecord::Relation object
|
34
|
+
# == Examples
|
35
|
+
# >>> registration.search(query)
|
36
|
+
# => ActiveRecord::Relation object
|
37
|
+
scope :search, lambda {|query| joins("INNER JOIN users on users.id = registrations.user_id").
|
38
|
+
where("LOWER(mobile_number) LIKE LOWER('%#{query}%') OR
|
39
|
+
LOWER(users.name) LIKE LOWER('%#{query}%')")}
|
40
|
+
scope :status, lambda { |status| where("LOWER(status)='#{status}'") }
|
41
|
+
|
42
|
+
scope :pending, -> { where(status: PENDING) }
|
43
|
+
scope :verified, -> { where(status: VERIFIED) }
|
44
|
+
|
45
|
+
# ------------------
|
46
|
+
# Instance Methods
|
47
|
+
# ------------------
|
48
|
+
|
49
|
+
# Status Methods
|
50
|
+
# --------------
|
51
|
+
|
52
|
+
# * Return true if the user is pending, else false.
|
53
|
+
# == Examples
|
54
|
+
# >>> registration.pending?
|
55
|
+
# => true
|
56
|
+
def pending?
|
57
|
+
(status == PENDING)
|
58
|
+
end
|
59
|
+
|
60
|
+
# * Return true if the user is not verified, else false.
|
61
|
+
# == Examples
|
62
|
+
# >>> registration.verified?
|
63
|
+
# => true
|
64
|
+
def verified?
|
65
|
+
(status == VERIFIED)
|
66
|
+
end
|
67
|
+
|
68
|
+
# change the status to :verified
|
69
|
+
# Return the status
|
70
|
+
# == Examples
|
71
|
+
# >>> registration.pending!
|
72
|
+
# => "pending"
|
73
|
+
def pending!
|
74
|
+
self.update_attribute(:status, PENDING)
|
75
|
+
end
|
76
|
+
|
77
|
+
# change the status to :verified
|
78
|
+
# Return the status
|
79
|
+
# == Examples
|
80
|
+
# >>> registration.verify!
|
81
|
+
# => "verified"
|
82
|
+
def verify!
|
83
|
+
self.update_attribute(:status, VERIFIED)
|
84
|
+
end
|
85
|
+
|
86
|
+
# Permission Methods
|
87
|
+
# ------------------
|
88
|
+
|
89
|
+
def can_be_edited?
|
90
|
+
pending?
|
91
|
+
end
|
92
|
+
|
93
|
+
def can_be_deleted?
|
94
|
+
pending?
|
95
|
+
end
|
96
|
+
|
97
|
+
# Other Methods
|
98
|
+
# -------------
|
99
|
+
|
100
|
+
# * Return mobile number with dialling prefix
|
101
|
+
# == Examples
|
102
|
+
# >>> registration.display_name
|
103
|
+
# => "+919880123456"
|
104
|
+
def display_name
|
105
|
+
"#{self.dialing_prefix} #{self.mobile_number}"
|
106
|
+
end
|
107
|
+
|
108
|
+
end
|
data/app/models/role.rb
CHANGED
@@ -18,20 +18,24 @@ class Role < Usman::ApplicationRecord
|
|
18
18
|
scope :search, lambda {|query| where("LOWER(roles.name) LIKE LOWER('%#{query}%')")
|
19
19
|
}
|
20
20
|
|
21
|
-
def self.save_row_data(
|
21
|
+
def self.save_row_data(hsh)
|
22
22
|
|
23
|
-
|
23
|
+
return if hsh[:name].blank?
|
24
24
|
|
25
|
-
|
26
|
-
|
27
|
-
role = Role.find_by_name(row[:name]) || Role.new
|
28
|
-
role.name = row[:name]
|
25
|
+
role = Role.find_by_name(hsh[:name]) || Role.new
|
26
|
+
role.name = hsh[:name]
|
29
27
|
|
30
28
|
# Initializing error hash for displaying all errors altogether
|
31
29
|
error_object = Kuppayam::Importer::ErrorHash.new
|
32
30
|
|
33
31
|
if role.valid?
|
34
|
-
|
32
|
+
begin
|
33
|
+
role.save!
|
34
|
+
rescue Exception => e
|
35
|
+
summary = "uncaught #{e} exception while handling connection: #{e.message}"
|
36
|
+
details = "Stack trace: #{e.backtrace.map {|l| " #{l}\n"}.join}"
|
37
|
+
error_object.errors << { summary: summary, details: details }
|
38
|
+
end
|
35
39
|
else
|
36
40
|
summary = "Error while saving role: #{role.name}"
|
37
41
|
details = "Error! #{role.errors.full_messages.to_sentence}"
|
data/app/models/user.rb
CHANGED
@@ -39,6 +39,8 @@ class User < Usman::ApplicationRecord
|
|
39
39
|
has_one :profile_picture, :as => :imageable, :dependent => :destroy, :class_name => "Image::ProfilePicture"
|
40
40
|
has_many :permissions
|
41
41
|
has_many :features, through: :permissions
|
42
|
+
has_many :devices
|
43
|
+
has_one :registration
|
42
44
|
has_and_belongs_to_many :roles
|
43
45
|
|
44
46
|
|
@@ -70,29 +72,33 @@ class User < Usman::ApplicationRecord
|
|
70
72
|
|
71
73
|
# Import Methods
|
72
74
|
|
73
|
-
def self.save_row_data(
|
75
|
+
def self.save_row_data(hsh)
|
74
76
|
|
75
|
-
|
77
|
+
return if hsh[:name].blank?
|
76
78
|
|
77
|
-
|
79
|
+
user = User.find_by_username(hsh[:username]) || User.new
|
80
|
+
user.name = hsh[:name]
|
81
|
+
user.username = hsh[:username]
|
82
|
+
user.designation = hsh[:designation]
|
83
|
+
user.email = hsh[:email]
|
84
|
+
user.phone = hsh[:phone]
|
78
85
|
|
79
|
-
user =
|
80
|
-
user.name = row[:name]
|
81
|
-
user.username = row[:username]
|
82
|
-
user.designation = row[:designation]
|
83
|
-
user.email = row[:email]
|
84
|
-
user.phone = row[:phone]
|
86
|
+
user.super_admin = ["true", "t","1","yes","y"].include?(hsh[:super_admin].to_s.downcase.strip)
|
85
87
|
|
86
|
-
user.
|
87
|
-
|
88
|
-
user.status = row[:status]
|
88
|
+
user.status = hsh[:status]
|
89
89
|
user.assign_default_password
|
90
90
|
|
91
91
|
# Initializing error hash for displaying all errors altogether
|
92
92
|
error_object = Kuppayam::Importer::ErrorHash.new
|
93
93
|
|
94
94
|
if user.valid?
|
95
|
-
|
95
|
+
begin
|
96
|
+
user.save!
|
97
|
+
rescue Exception => e
|
98
|
+
summary = "uncaught #{e} exception while handling connection: #{e.message}"
|
99
|
+
details = "Stack trace: #{e.backtrace.map {|l| " #{l}\n"}.join}"
|
100
|
+
error_object.errors << { summary: summary, details: details }
|
101
|
+
end
|
96
102
|
else
|
97
103
|
summary = "Error while saving user: #{user.name}"
|
98
104
|
details = "Error! #{user.errors.full_messages.to_sentence}"
|
@@ -0,0 +1,127 @@
|
|
1
|
+
module Usman
|
2
|
+
class MobileRegistrationService
|
3
|
+
|
4
|
+
attr_reader :dialing_prefix, :mobile_number,
|
5
|
+
:country, :city,
|
6
|
+
:error_heading, :error_message, :error_details,
|
7
|
+
:uuid, :device_token,
|
8
|
+
:device_name, :device_type,
|
9
|
+
:operating_system, :software_version,
|
10
|
+
:registration, :device, :remote_ip
|
11
|
+
|
12
|
+
def initialize(params)
|
13
|
+
@dialing_prefix = params[:dialing_prefix]
|
14
|
+
@mobile_number = params[:mobile_number]
|
15
|
+
|
16
|
+
@country = Country.find_by_id(params[:country_id])
|
17
|
+
@city = City.find_by_id(params[:city_id])
|
18
|
+
|
19
|
+
# Edge case to catch city selected that of a different country
|
20
|
+
@city = nil unless @city.country == @country if @city
|
21
|
+
|
22
|
+
@uuid = params[:uuid]
|
23
|
+
@device_token = params[:device_token]
|
24
|
+
@device_name = params[:device_name]
|
25
|
+
@device_type = params[:device_type]
|
26
|
+
@operating_system = params[:operating_system]
|
27
|
+
@software_version = params[:software_version]
|
28
|
+
|
29
|
+
@remote_ip = params[:remote_ip]
|
30
|
+
@error_message = nil
|
31
|
+
@error_details = {}
|
32
|
+
|
33
|
+
# @registration and @device will be initiated by the
|
34
|
+
# below method if the device is already registered
|
35
|
+
check_if_device_is_already_registered
|
36
|
+
|
37
|
+
register_new_device
|
38
|
+
|
39
|
+
# Validate the inputs
|
40
|
+
@registration.valid?
|
41
|
+
@device.valid?
|
42
|
+
|
43
|
+
if @registration.errors.any? or @device.errors.any?
|
44
|
+
errors = @registration.errors.to_hash.merge(@device.errors.to_hash)
|
45
|
+
set_error("mobile_registration.invalid_inputs", errors)
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
49
|
+
|
50
|
+
def check_if_device_is_already_registered
|
51
|
+
@registration = Registration.where("LOWER(mobile_number) = LOWER('#{@mobile_number}')").first
|
52
|
+
if @registration
|
53
|
+
@country = @registration.country unless @country
|
54
|
+
@city = @registration.city unless @city
|
55
|
+
end
|
56
|
+
@device = Device.where("LOWER(uuid) = LOWER('#{@uuid}')").first if @registration
|
57
|
+
end
|
58
|
+
|
59
|
+
def register_new_device
|
60
|
+
|
61
|
+
if @device && @device.blocked?
|
62
|
+
set_error("mobile_registration.device_blocked")
|
63
|
+
return
|
64
|
+
end
|
65
|
+
|
66
|
+
ActiveRecord::Base.transaction do
|
67
|
+
# Create a new registration if it doesn't exist
|
68
|
+
@registration = Registration.new unless @registration
|
69
|
+
@registration.country = @country
|
70
|
+
@registration.city = @city
|
71
|
+
@registration.dialing_prefix = @dialing_prefix
|
72
|
+
@registration.mobile_number = @mobile_number
|
73
|
+
|
74
|
+
# Create device entry if it doesn't exist
|
75
|
+
@device = Device.new unless @device
|
76
|
+
@device.registration = @registration
|
77
|
+
@device.user = @registration.user
|
78
|
+
@device.uuid = @uuid
|
79
|
+
@device.device_token = @device_token
|
80
|
+
@device.device_name = @device_name
|
81
|
+
@device.device_type = @device_type
|
82
|
+
@device.operating_system = @operating_system
|
83
|
+
@device.software_version = @software_version
|
84
|
+
|
85
|
+
@registration.valid?
|
86
|
+
@device.valid?
|
87
|
+
|
88
|
+
if @registration.errors.blank? && @device.errors.blank?
|
89
|
+
@registration.save
|
90
|
+
@device.save
|
91
|
+
generate_new_otp
|
92
|
+
else
|
93
|
+
raise ActiveRecord::Rollback
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
end
|
98
|
+
|
99
|
+
def generate_new_otp
|
100
|
+
@device.generate_otp
|
101
|
+
if send_otp
|
102
|
+
@device.update_attribute(:otp_sent_at, Time.now)
|
103
|
+
else
|
104
|
+
set_error("mobile_registration.otp_not_sent")
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
def send_otp
|
109
|
+
return true
|
110
|
+
end
|
111
|
+
|
112
|
+
def set_error(key, hsh={})
|
113
|
+
@error_heading = I18n.t("#{key}.heading")
|
114
|
+
@error_message = I18n.t("#{key}.message")
|
115
|
+
@error_details = hsh if hsh.is_a?(Hash)
|
116
|
+
end
|
117
|
+
|
118
|
+
def errors
|
119
|
+
{
|
120
|
+
heading: @error_heading,
|
121
|
+
message: @error_message,
|
122
|
+
details: @error_details
|
123
|
+
}
|
124
|
+
end
|
125
|
+
|
126
|
+
end
|
127
|
+
end
|
@@ -7,11 +7,11 @@
|
|
7
7
|
<!-- logo -->
|
8
8
|
<div class="logo">
|
9
9
|
<a href="/" class="logo-expanded">
|
10
|
-
<img src="/assets/
|
10
|
+
<img src="/assets/logo.png" width="180" alt="" />
|
11
11
|
</a>
|
12
12
|
|
13
13
|
<a href="/" class="logo-collapsed">
|
14
|
-
<img src="/assets/
|
14
|
+
<img src="/assets/logo-small.png" width="40" alt="" />
|
15
15
|
</a>
|
16
16
|
</div>
|
17
17
|
|
@@ -38,23 +38,43 @@
|
|
38
38
|
<!-- class "auto-inherit-active-class" will automatically add "active" class for parent elements who are marked already with class "active" -->
|
39
39
|
|
40
40
|
<!-- Admin Dashboard -->
|
41
|
-
|
42
|
-
|
43
|
-
|
41
|
+
<% if @current_user.super_admin? || @current_user.has_role?("Site Admin") %>
|
42
|
+
<li class="<%= nav_active?('admin/dashboard') ? 'active' : '' %>">
|
43
|
+
<%= link_to raw("<i class=\"linecons-desktop\"></i> <span class='title'>Dashboard</span>"), usman.dashboard_url %>
|
44
|
+
</li>
|
44
45
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
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>
|
51
52
|
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
53
|
+
<ul>
|
54
|
+
<li class="<%= nav_class("admin/users") %>">
|
55
|
+
<%= link_to raw("<i class=\"linecons-user\"></i> <span class='title'>Manage Users</span>"), usman.users_url %>
|
56
|
+
</li>
|
57
|
+
</ul>
|
58
|
+
</li>
|
59
|
+
<% else %>
|
60
|
+
<li class="<%= nav_active?('profile/dashboard') ? 'active' : '' %>">
|
61
|
+
<%= link_to raw("<i class=\"linecons-desktop\"></i> <span class='title'>Dashboard</span>"), usman.my_account_url %>
|
62
|
+
</li>
|
63
|
+
|
64
|
+
<li class="<%= nav_active?('profile/profile') ? 'active' : '' %>">
|
65
|
+
|
66
|
+
<a href="#">
|
67
|
+
<i class="linecons-user"></i>
|
68
|
+
<span class="title">My Account</span>
|
69
|
+
</a>
|
70
|
+
|
71
|
+
<ul>
|
72
|
+
<li class="<%= nav_class("profile/settings") %>">
|
73
|
+
<%= link_to raw("<i class=\"linecons-cog\"></i> <span class='title'>Settings</span>"), "#" %>
|
74
|
+
</li>
|
75
|
+
</ul>
|
76
|
+
</li>
|
77
|
+
<% end %>
|
58
78
|
|
59
79
|
<% if @current_user.super_admin? %>
|
60
80
|
<li class="">
|
@@ -65,11 +85,11 @@
|
|
65
85
|
|
66
86
|
<ul>
|
67
87
|
<li class="">
|
68
|
-
<%= link_to raw("<i class=\"linecons-diamond\"></i> <span class='title'>Manage Features</span>"), usman.
|
88
|
+
<%= link_to raw("<i class=\"linecons-diamond\"></i> <span class='title'>Manage Features</span>"), usman.features_url %>
|
69
89
|
</li>
|
70
90
|
|
71
91
|
<li class="<%= nav_class("admin/users") %>">
|
72
|
-
<%= link_to raw("<i class=\"linecons-lock\"></i> <span class='title'>Manage Permissions</span>"), usman.
|
92
|
+
<%= link_to raw("<i class=\"linecons-lock\"></i> <span class='title'>Manage Permissions</span>"), usman.permissions_url %>
|
73
93
|
</li>
|
74
94
|
</ul>
|
75
95
|
|
@@ -0,0 +1,120 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html lang="en">
|
3
|
+
<head>
|
4
|
+
<!-- Head -->
|
5
|
+
<%= render :partial=>"/layouts/kuppayam/head" -%>
|
6
|
+
</head>
|
7
|
+
|
8
|
+
<body class="page-body">
|
9
|
+
|
10
|
+
<!-- <div class="settings-pane" id="settings_pane">
|
11
|
+
<%#= render :partial=>"/layouts/kuppayam/settings_pane" -%>
|
12
|
+
</div> -->
|
13
|
+
|
14
|
+
<div class="page-container">
|
15
|
+
|
16
|
+
<!-- Sidebar Navigation -->
|
17
|
+
<%= render :partial=>"/layouts/kuppayam/sidebar" -%>
|
18
|
+
|
19
|
+
<div class="main-content">
|
20
|
+
|
21
|
+
<!-- Top Navigation -->
|
22
|
+
<%= render :partial=>"/layouts/kuppayam/navbar" -%>
|
23
|
+
|
24
|
+
<!-- Heading & Breadcrumbs -->
|
25
|
+
<%= render :partial=>"/layouts/kuppayam/heading" -%>
|
26
|
+
|
27
|
+
<%#* Show flash messages if controller has set any. -%>
|
28
|
+
<div id="div_flash_message" class="mt-10">
|
29
|
+
<%= flash_message(false) if defined?(flash) -%>
|
30
|
+
</div>
|
31
|
+
|
32
|
+
<%#* Page Content Starts here -%>
|
33
|
+
<div id="div_page_content_main">
|
34
|
+
<%= yield %>
|
35
|
+
</div>
|
36
|
+
|
37
|
+
<!-- Footer -->
|
38
|
+
<%= render :partial=>"/layouts/kuppayam/footer" -%>
|
39
|
+
|
40
|
+
</div>
|
41
|
+
|
42
|
+
</div>
|
43
|
+
|
44
|
+
<div id="div_modal_generic" class="modal" style="z-index: 1056;">
|
45
|
+
<div class="modal-dialog">
|
46
|
+
<div class="modal-content">
|
47
|
+
<div class="modal-header">
|
48
|
+
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
49
|
+
<h3 class="modal-title">Modal title</h3>
|
50
|
+
</div>
|
51
|
+
<div class="modal-body-main"></div>
|
52
|
+
</div><!-- /.modal-content -->
|
53
|
+
</div><!-- /.modal-dialog -->
|
54
|
+
</div><!-- /.modal -->
|
55
|
+
|
56
|
+
<div id="div_modal_large" class="modal">
|
57
|
+
<div class="modal-dialog modal-lg" style="width: 96%">
|
58
|
+
<div class="modal-content">
|
59
|
+
<div class="modal-header">
|
60
|
+
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
61
|
+
<h3 class="modal-title">Modal title</h3>
|
62
|
+
</div>
|
63
|
+
<div class="modal-body-main"></div>
|
64
|
+
</div><!-- /.modal-content -->
|
65
|
+
</div><!-- /.modal-dialog -->
|
66
|
+
</div><!-- /.modal -->
|
67
|
+
|
68
|
+
<div id="div_modal_message" class="modal fade">
|
69
|
+
<div class="modal-dialog">
|
70
|
+
<div class="modal-content">
|
71
|
+
<div class="modal-header">
|
72
|
+
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
73
|
+
<h3 class="modal-title">Modal title</h3>
|
74
|
+
</div>
|
75
|
+
<div class="modal-body">
|
76
|
+
<p>One fine body…</p>
|
77
|
+
</div>
|
78
|
+
<div class="modal-footer">
|
79
|
+
<button type="button" class="btn btn-primary" data-dismiss="modal">Close</button>
|
80
|
+
</div>
|
81
|
+
</div><!-- /.modal-content -->
|
82
|
+
</div><!-- /.modal-dialog -->
|
83
|
+
</div><!-- /.modal -->
|
84
|
+
|
85
|
+
<div id="div_modal_image_upload" class="modal" style="z-index: 1057;">
|
86
|
+
<div class="modal-dialog">
|
87
|
+
<div class="modal-content">
|
88
|
+
<div class="modal-header">
|
89
|
+
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
90
|
+
<h3 class="modal-title">Modal title</h3>
|
91
|
+
</div>
|
92
|
+
<div class="modal-body-main"></div>
|
93
|
+
</div><!-- /.modal-content -->
|
94
|
+
</div><!-- /.modal-dialog -->
|
95
|
+
</div><!-- /.modal -->
|
96
|
+
|
97
|
+
<script type="text/javascript">
|
98
|
+
$('.modal').on('shown.bs.modal', function(e){
|
99
|
+
$(this).modal('handleUpdate'); //Update backdrop on modal show
|
100
|
+
$(this).scrollTop(0); //reset modal to top position
|
101
|
+
});
|
102
|
+
</script>
|
103
|
+
|
104
|
+
<!-- Page Loading Overlay -->
|
105
|
+
<!-- <div class="page-loading-overlay">
|
106
|
+
<div class="loader-3"></div>
|
107
|
+
</div> -->
|
108
|
+
|
109
|
+
<%#* Loading Javascripts -%>
|
110
|
+
<%= javascript_include_tag @javascript_filename -%>
|
111
|
+
|
112
|
+
<%= yield :javascript_footer -%>
|
113
|
+
|
114
|
+
<iframe id="iframe_document" name="iframe_document" width="100%" style="display:none"></iframe>
|
115
|
+
|
116
|
+
<iframe id="iframe_image" name="iframe_image" width="100%" style="display:none"></iframe>
|
117
|
+
|
118
|
+
</body>
|
119
|
+
|
120
|
+
</html>
|
@@ -0,0 +1,118 @@
|
|
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
|
+
}
|
15
|
+
%>
|
16
|
+
|
17
|
+
<h3 class="text-gray mt-50 mb-10">
|
18
|
+
Admin <br>
|
19
|
+
<small class="text-muted">Manage Users and much more...</small>
|
20
|
+
</h3>
|
21
|
+
<hr class="mb-30" style="border-top:1px solid #ddd;">
|
22
|
+
|
23
|
+
<div class="row">
|
24
|
+
|
25
|
+
<% items.each do |key, values| %>
|
26
|
+
<div class="col-lg-4 col-md-4 col-sm-6 col-xs-12">
|
27
|
+
|
28
|
+
<div class="xe-widget xe-vertical-counter xe-vertical-counter-white" data-count=".num" data-from="0" data-to="128" data-duration="4">
|
29
|
+
<div class="xe-icon">
|
30
|
+
<i class="<%= values[:icon_class] %>"></i>
|
31
|
+
</div>
|
32
|
+
|
33
|
+
<div class="xe-label">
|
34
|
+
<strong class="num"><%= values[:text] %></strong>
|
35
|
+
</div>
|
36
|
+
|
37
|
+
<div class="xe-label" style="margin-top:10px; margin-bottom: 10px;height: 100px; overflow-y: auto;">
|
38
|
+
<% values[:counts].each do |count_text, count_value| %>
|
39
|
+
<span><%= count_text.to_s.titleize %>: <strong><%= count_value %></strong></span>
|
40
|
+
<% end %>
|
41
|
+
</div>
|
42
|
+
|
43
|
+
<div class="xe-label">
|
44
|
+
<span><%= link_to("Manage", values[:url], class: "btn btn-sm btn-primary btn-block") %></span>
|
45
|
+
</div>
|
46
|
+
</div>
|
47
|
+
|
48
|
+
</div>
|
49
|
+
<% end %>
|
50
|
+
</div>
|
51
|
+
|
52
|
+
<% if @current_user.super_admin? %>
|
53
|
+
<%
|
54
|
+
items = {
|
55
|
+
features: {
|
56
|
+
counts: {
|
57
|
+
total: Feature.published.count
|
58
|
+
},
|
59
|
+
text: "Features",
|
60
|
+
icon_class: "linecons-diamond",
|
61
|
+
url: usman.features_url
|
62
|
+
},
|
63
|
+
roles: {
|
64
|
+
counts: {
|
65
|
+
total: Role.count
|
66
|
+
},
|
67
|
+
text: "Roles",
|
68
|
+
icon_class: "linecons-graduation-cap",
|
69
|
+
url: usman.roles_url
|
70
|
+
},
|
71
|
+
permissions: {
|
72
|
+
counts: {
|
73
|
+
total: Permission.count
|
74
|
+
},
|
75
|
+
text: "Permissions",
|
76
|
+
icon_class: "fa-lock",
|
77
|
+
url: usman.permissions_url
|
78
|
+
},
|
79
|
+
|
80
|
+
}
|
81
|
+
%>
|
82
|
+
|
83
|
+
<h3 class="text-gray mt-50 mb-10">
|
84
|
+
Super Admin <br>
|
85
|
+
<small class="text-muted">Manage Features, Permissions and other super admin modules</small>
|
86
|
+
</h3>
|
87
|
+
<hr class="mb-30" style="border-top:1px solid #ddd;">
|
88
|
+
|
89
|
+
<div class="row">
|
90
|
+
|
91
|
+
<% items.each do |key, values| %>
|
92
|
+
<div class="col-lg-4 col-md-4 col-sm-6 col-xs-12">
|
93
|
+
|
94
|
+
<div class="xe-widget xe-vertical-counter xe-vertical-counter-white" data-count=".num" data-from="0" data-to="128" data-duration="4">
|
95
|
+
<div class="xe-icon">
|
96
|
+
<i class="<%= values[:icon_class] %>"></i>
|
97
|
+
</div>
|
98
|
+
|
99
|
+
<div class="xe-label">
|
100
|
+
<strong class="num"><%= values[:text] %></strong>
|
101
|
+
</div>
|
102
|
+
|
103
|
+
<div class="xe-label" style="margin-top:10px; margin-bottom: 10px;height: 100px; overflow-y: auto;">
|
104
|
+
<% values[:counts].each do |count_text, count_value| %>
|
105
|
+
<span><%= count_text.to_s.titleize %>: <strong><%= count_value %></strong></span>
|
106
|
+
<% end %>
|
107
|
+
</div>
|
108
|
+
|
109
|
+
<div class="xe-label">
|
110
|
+
<span><%= link_to("Manage", values[:url], class: "btn btn-sm btn-primary btn-block") %></span>
|
111
|
+
</div>
|
112
|
+
</div>
|
113
|
+
|
114
|
+
</div>
|
115
|
+
<% end %>
|
116
|
+
|
117
|
+
</div>
|
118
|
+
<% end %>
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<%= form_for([
|
1
|
+
<%= form_for([@feature], :html => {:id=>"form_feature", :class=>"mb-0 form-horizontal", :role => "form", :method => (@feature.new_record? ? :post : :put), :remote=>true}) do |f| %>
|
2
2
|
|
3
3
|
<div id="feature_form_error">
|
4
4
|
<%= @feature.errors[:base].to_sentence %>
|