usman 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +38 -0
- data/Rakefile +37 -0
- data/app/assets/config/usman_manifest.js +2 -0
- data/app/assets/javascripts/usman/application.js +13 -0
- data/app/assets/stylesheets/usman/application.css +15 -0
- data/app/controllers/usman/admin/base_controller.rb +24 -0
- data/app/controllers/usman/admin/dashboard_controller.rb +18 -0
- data/app/controllers/usman/admin/features_controller.rb +86 -0
- data/app/controllers/usman/admin/permissions_controller.rb +76 -0
- data/app/controllers/usman/admin/resource_controller.rb +11 -0
- data/app/controllers/usman/admin/users_controller.rb +117 -0
- data/app/controllers/usman/application_controller.rb +13 -0
- data/app/controllers/usman/sessions_controller.rb +84 -0
- data/app/helpers/usman/application_helper.rb +4 -0
- data/app/helpers/usman/authentication_helper.rb +120 -0
- data/app/jobs/usman/application_job.rb +4 -0
- data/app/mailers/usman/application_mailer.rb +6 -0
- data/app/models/feature.rb +112 -0
- data/app/models/image/base.rb +30 -0
- data/app/models/image/feature_image.rb +3 -0
- data/app/models/image/profile_picture.rb +3 -0
- data/app/models/permission.rb +28 -0
- data/app/models/user.rb +247 -0
- data/app/models/usman/application_record.rb +5 -0
- data/app/services/usman/authentication_service.rb +45 -0
- data/app/uploaders/feature_image_uploader.rb +14 -0
- data/app/uploaders/image_uploader.rb +90 -0
- data/app/uploaders/profile_picture_uploader.rb +14 -0
- data/app/views/layouts/kuppayam/_footer.html.erb +25 -0
- data/app/views/layouts/kuppayam/_header.html.erb +43 -0
- data/app/views/layouts/kuppayam/_navbar.html.erb +55 -0
- data/app/views/layouts/kuppayam/_sidebar.html.erb +78 -0
- data/app/views/usman/admin/dashboard/index.html.erb +52 -0
- data/app/views/usman/admin/features/_action_buttons.html.erb +11 -0
- data/app/views/usman/admin/features/_form.html.erb +19 -0
- data/app/views/usman/admin/features/_index.html.erb +79 -0
- data/app/views/usman/admin/features/_row.html.erb +55 -0
- data/app/views/usman/admin/features/_show.html.erb +48 -0
- data/app/views/usman/admin/features/create.js.erb +16 -0
- data/app/views/usman/admin/features/destroy.js.erb +16 -0
- data/app/views/usman/admin/features/edit.js.erb +7 -0
- data/app/views/usman/admin/features/index.html.erb +25 -0
- data/app/views/usman/admin/features/index.js.erb +8 -0
- data/app/views/usman/admin/features/new.js.erb +7 -0
- data/app/views/usman/admin/features/row.js.erb +10 -0
- data/app/views/usman/admin/features/show.js.erb +8 -0
- data/app/views/usman/admin/features/update.js.erb +16 -0
- data/app/views/usman/admin/permissions/_action_buttons.html.erb +11 -0
- data/app/views/usman/admin/permissions/_form.html.erb +70 -0
- data/app/views/usman/admin/permissions/_index.html.erb +56 -0
- data/app/views/usman/admin/permissions/_row.html.erb +27 -0
- data/app/views/usman/admin/permissions/_show.html.erb +48 -0
- data/app/views/usman/admin/permissions/create.js.erb +17 -0
- data/app/views/usman/admin/permissions/destroy.js.erb +16 -0
- data/app/views/usman/admin/permissions/edit.js.erb +7 -0
- data/app/views/usman/admin/permissions/index.html.erb +25 -0
- data/app/views/usman/admin/permissions/index.js.erb +8 -0
- data/app/views/usman/admin/permissions/new.js.erb +7 -0
- data/app/views/usman/admin/permissions/row.js.erb +10 -0
- data/app/views/usman/admin/permissions/show.js.erb +8 -0
- data/app/views/usman/admin/permissions/update.js.erb +16 -0
- data/app/views/usman/admin/users/_action_buttons.html.erb +11 -0
- data/app/views/usman/admin/users/_form.html.erb +36 -0
- data/app/views/usman/admin/users/_index.html.erb +120 -0
- data/app/views/usman/admin/users/_row.html.erb +92 -0
- data/app/views/usman/admin/users/_show.html.erb +132 -0
- data/app/views/usman/admin/users/create.js.erb +16 -0
- data/app/views/usman/admin/users/destroy.js.erb +16 -0
- data/app/views/usman/admin/users/edit.js.erb +7 -0
- data/app/views/usman/admin/users/index.html.erb +40 -0
- data/app/views/usman/admin/users/index.js.erb +8 -0
- data/app/views/usman/admin/users/new.js.erb +7 -0
- data/app/views/usman/admin/users/row.js.erb +10 -0
- data/app/views/usman/admin/users/show.js.erb +8 -0
- data/app/views/usman/admin/users/update.js.erb +16 -0
- data/app/views/usman/sessions/_form.html.erb +48 -0
- data/app/views/usman/sessions/_sign_in.js.erb +3 -0
- data/app/views/usman/sessions/sign_in.html.erb +63 -0
- data/config/locales/usman.en.yml +61 -0
- data/config/routes.rb +45 -0
- data/db/migrate/20131108102728_create_images.rb +12 -0
- data/db/migrate/20140402113213_create_users.rb +57 -0
- data/db/migrate/20140402113214_create_features.rb +24 -0
- data/lib/tasks/usman_tasks.rake +4 -0
- data/lib/usman/engine.rb +14 -0
- data/lib/usman/version.rb +3 -0
- data/lib/usman.rb +5 -0
- metadata +418 -0
@@ -0,0 +1,90 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
class ImageUploader < CarrierWave::Uploader::Base
|
4
|
+
|
5
|
+
# Include RMagick or MiniMagick support:
|
6
|
+
include CarrierWave::RMagick
|
7
|
+
# include CarrierWave::MiniMagick
|
8
|
+
|
9
|
+
# Choose what kind of storage to use for this uploader:
|
10
|
+
# storage Rails.env.production? ? :fog : :file
|
11
|
+
# storage :file
|
12
|
+
|
13
|
+
# Override the directory where uploaded files will be stored.
|
14
|
+
# This is a sensible default for uploaders that are meant to be mounted:
|
15
|
+
# def store_dir
|
16
|
+
# "uploads/#{Rails.env}/#{model.class.to_s.underscore}/#{model.id}"
|
17
|
+
# end
|
18
|
+
|
19
|
+
def cache_dir
|
20
|
+
Rails.root.join 'tmp/uploads'
|
21
|
+
end
|
22
|
+
|
23
|
+
#process :crop
|
24
|
+
|
25
|
+
# version :large do
|
26
|
+
# #process :crop
|
27
|
+
# #process :resize_to_fit => [60, 60]
|
28
|
+
# #process :resize_to_fill => [60, 60]
|
29
|
+
# #process :resize_to_limit => [250, 250]
|
30
|
+
# process :resize_to_fit => [250, 250]
|
31
|
+
# end
|
32
|
+
|
33
|
+
# version :medium do
|
34
|
+
# process :resize_to_fit => [120, 120]
|
35
|
+
# end
|
36
|
+
|
37
|
+
# version :small do
|
38
|
+
# process :resize_to_fit => [60, 60]
|
39
|
+
# end
|
40
|
+
|
41
|
+
# version :tiny do
|
42
|
+
# process :resize_to_fit => [25, 25]
|
43
|
+
# end
|
44
|
+
|
45
|
+
def crop
|
46
|
+
if model.crop_x.present?
|
47
|
+
resize_to_limit(540, 540)
|
48
|
+
manipulate! do |img|
|
49
|
+
x = model.crop_x.to_i
|
50
|
+
y = model.crop_y.to_i
|
51
|
+
w = model.crop_w.to_i
|
52
|
+
h = model.crop_h.to_i
|
53
|
+
img.crop!(x, y, w, h)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
# Provide a default URL as a default if there hasn't been a file uploaded:
|
59
|
+
# def default_url
|
60
|
+
# # For Rails 3.1+ asset pipeline compatibility:
|
61
|
+
# # ActionController::Base.helpers.asset_path("fallback/" + [version_name, "default.png"].compact.join('_'))
|
62
|
+
#
|
63
|
+
# "/images/fallback/" + [version_name, "default.png"].compact.join('_')
|
64
|
+
# end
|
65
|
+
|
66
|
+
# Process files as they are uploaded:
|
67
|
+
# process :scale => [200, 300]
|
68
|
+
#
|
69
|
+
# def scale(width, height)
|
70
|
+
# # do something
|
71
|
+
# end
|
72
|
+
|
73
|
+
# Create different versions of your uploaded files:
|
74
|
+
# version :thumb do
|
75
|
+
# process :scale => [50, 50]
|
76
|
+
# end
|
77
|
+
|
78
|
+
# Add a white list of extensions which are allowed to be uploaded.
|
79
|
+
# For images you might use something like this:
|
80
|
+
# def extension_white_list
|
81
|
+
# %w(jpg jpeg gif png)
|
82
|
+
# end
|
83
|
+
|
84
|
+
# Override the filename of the uploaded files:
|
85
|
+
# Avoid using model.id or version_name here, see uploader/store.rb for details.
|
86
|
+
# def filename
|
87
|
+
# "something.jpg" if original_filename
|
88
|
+
# end
|
89
|
+
|
90
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
class ProfilePictureUploader < ImageUploader
|
2
|
+
def store_dir
|
3
|
+
"uploads/profile_pictures/#{model.id}"
|
4
|
+
end
|
5
|
+
|
6
|
+
version :large do
|
7
|
+
process :resize_to_fill => [400, 400]
|
8
|
+
end
|
9
|
+
|
10
|
+
version :small do
|
11
|
+
process :resize_to_fill => [100, 100]
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
<footer class="main-footer sticky footer-type-1">
|
2
|
+
|
3
|
+
<div class="footer-inner">
|
4
|
+
|
5
|
+
<!-- Add your copyright text here -->
|
6
|
+
<div class="footer-text">
|
7
|
+
© 2017
|
8
|
+
<strong>Kuppayam</strong>
|
9
|
+
|
10
|
+
All rights reserved. <br>developed, maintained and hosted by <a href="http://rightsolutions.io" target="_blank" style="color:red">Right Solutions</a>
|
11
|
+
</div>
|
12
|
+
|
13
|
+
|
14
|
+
<!-- Go to Top Link, just add rel="go-top" to any link to add this functionality -->
|
15
|
+
<div class="go-up">
|
16
|
+
|
17
|
+
<a href="#" rel="go-top">
|
18
|
+
<i class="fa-angle-up"></i>
|
19
|
+
</a>
|
20
|
+
|
21
|
+
</div>
|
22
|
+
|
23
|
+
</div>
|
24
|
+
|
25
|
+
</footer>
|
@@ -0,0 +1,43 @@
|
|
1
|
+
<div class="top-bar">
|
2
|
+
<div class="top-bar-left">
|
3
|
+
<ul class="dropdown menu" data-dropdown-menu>
|
4
|
+
<li class="menu-text">Site Title</li>
|
5
|
+
<li>
|
6
|
+
<a href="#">One</a>
|
7
|
+
<ul class="menu vertical">
|
8
|
+
<li><a href="#">One</a></li>
|
9
|
+
<li><a href="#">Two</a></li>
|
10
|
+
<li><a href="#">Three</a></li>
|
11
|
+
</ul>
|
12
|
+
</li>
|
13
|
+
<li><a href="#">Two</a></li>
|
14
|
+
<li><a href="#">Three</a></li>
|
15
|
+
</ul>
|
16
|
+
</div>
|
17
|
+
<div class="top-bar-right">
|
18
|
+
<ul class="menu">
|
19
|
+
<li><input type="search" placeholder="Search"></li>
|
20
|
+
<li><button type="button" class="button">Search</button></li>
|
21
|
+
</ul>
|
22
|
+
</div>
|
23
|
+
</div>
|
24
|
+
|
25
|
+
<div class="header mb-40">
|
26
|
+
|
27
|
+
<div class="visible-xs pull-left mt-10">
|
28
|
+
<a href="#menu-toggle" class="btn btn-default" id="menu-toggle"><i class="fa fa-list"></i></a>
|
29
|
+
<%#= theme_button('', 'list', "#menu-toggle", btn_type: "default", id: "menu-toggle", classes: "") %>
|
30
|
+
</div>
|
31
|
+
|
32
|
+
<div class="pull-right mt-10">
|
33
|
+
<% if @current_user %>
|
34
|
+
<span style="color:#898989;">Welcome</span> <span style="color:#4b4b4b;"><%= @current_user.name %></span>
|
35
|
+
|
|
36
|
+
<%= link_to raw("Sign Out"), sign_out_path, method: :delete %>
|
37
|
+
<% else %>
|
38
|
+
<%= link_to raw("Sign In"), "#" %>
|
39
|
+
<% end %>
|
40
|
+
</div>
|
41
|
+
<div class="cl-10"></div>
|
42
|
+
</div>
|
43
|
+
|
@@ -0,0 +1,55 @@
|
|
1
|
+
<nav class="navbar user-info-navbar" role="navigation"><!-- User Info, Notifications and Menu Bar -->
|
2
|
+
|
3
|
+
<!-- Left links for user info navbar -->
|
4
|
+
<ul class="user-info-menu left-links list-inline list-unstyled">
|
5
|
+
|
6
|
+
<li class="hidden-sm hidden-xs">
|
7
|
+
<a href="#" data-toggle="sidebar">
|
8
|
+
<i class="fa-bars"></i>
|
9
|
+
</a>
|
10
|
+
</li>
|
11
|
+
|
12
|
+
</ul>
|
13
|
+
|
14
|
+
<!-- Right links for user info navbar -->
|
15
|
+
<ul class="user-info-menu right-links list-inline list-unstyled">
|
16
|
+
<li class="dropdown user-profile">
|
17
|
+
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
|
18
|
+
|
19
|
+
<%= 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) %>
|
20
|
+
|
21
|
+
<span>
|
22
|
+
<%= @current_user.display_name %>
|
23
|
+
<i class="fa-angle-down"></i>
|
24
|
+
</span>
|
25
|
+
|
26
|
+
</a>
|
27
|
+
|
28
|
+
<ul class="dropdown-menu user-profile-menu list-unstyled">
|
29
|
+
<li>
|
30
|
+
<a href="#settings">
|
31
|
+
<i class="fa-wrench"></i>
|
32
|
+
Settings
|
33
|
+
</a>
|
34
|
+
</li>
|
35
|
+
<li>
|
36
|
+
<a href="#profile">
|
37
|
+
<i class="fa-user"></i>
|
38
|
+
Profile
|
39
|
+
</a>
|
40
|
+
</li>
|
41
|
+
<li>
|
42
|
+
<a href="#help">
|
43
|
+
<i class="fa-info"></i>
|
44
|
+
Help
|
45
|
+
</a>
|
46
|
+
</li>
|
47
|
+
<li class="last">
|
48
|
+
<%= link_to raw("<i class='fa-lock'></i>Sign Out"), sign_out_path, method: :delete %>
|
49
|
+
</li>
|
50
|
+
</ul>
|
51
|
+
</li>
|
52
|
+
|
53
|
+
</ul>
|
54
|
+
|
55
|
+
</nav>
|
@@ -0,0 +1,78 @@
|
|
1
|
+
<div class="sidebar-menu toggle-others fixed collapsed">
|
2
|
+
|
3
|
+
<div class="sidebar-menu-inner">
|
4
|
+
|
5
|
+
<header class="logo-env">
|
6
|
+
|
7
|
+
<!-- logo -->
|
8
|
+
<div class="logo">
|
9
|
+
<a href="/" class="logo-expanded">
|
10
|
+
<img src="/assets/kuppayam/logo.png" width="180" alt="" />
|
11
|
+
</a>
|
12
|
+
|
13
|
+
<a href="/" class="logo-collapsed">
|
14
|
+
<img src="/assets/kuppayam/logo.png" width="40" alt="" />
|
15
|
+
</a>
|
16
|
+
</div>
|
17
|
+
|
18
|
+
<!-- This will toggle the mobile menu and will be visible only on mobile devices -->
|
19
|
+
<div class="mobile-menu-toggle visible-xs">
|
20
|
+
<a href="#" data-toggle="user-info-menu">
|
21
|
+
<i class="fa-bell-o"></i>
|
22
|
+
<span class="badge badge-success">7</span>
|
23
|
+
</a>
|
24
|
+
|
25
|
+
<a href="#" data-toggle="mobile-menu">
|
26
|
+
<i class="fa-bars"></i>
|
27
|
+
</a>
|
28
|
+
</div>
|
29
|
+
|
30
|
+
</header>
|
31
|
+
|
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
|
+
|
40
|
+
<li class="<%= nav_active?('admin/dashboard') ? 'active' : '' %>">
|
41
|
+
<%= link_to raw("<i class=\"linecons-desktop\"></i> <span class='title'>Dashboard</span>"), admin_dashboard_url %>
|
42
|
+
</li>
|
43
|
+
|
44
|
+
<li class="<%= nav_active?('admin/users') ? 'active' : '' %>">
|
45
|
+
|
46
|
+
<a href="#">
|
47
|
+
<i class="linecons-cog"></i>
|
48
|
+
<span class="title">Admin</span>
|
49
|
+
</a>
|
50
|
+
|
51
|
+
<ul>
|
52
|
+
<li class="<%= nav_class("admin/users") %>">
|
53
|
+
<%= link_to raw("<i class=\"linecons-user\"></i> <span class='title'>Manage Users</span>"), admin_users_url %>
|
54
|
+
</li>
|
55
|
+
|
56
|
+
<li class="<%= nav_class("admin/users") %>">
|
57
|
+
<%= link_to raw("<i class=\"linecons-lock\"></i> <span class='title'>Manage Permissions</span>"), admin_permissions_url %>
|
58
|
+
</li>
|
59
|
+
</ul>
|
60
|
+
|
61
|
+
</li>
|
62
|
+
|
63
|
+
<li class="">
|
64
|
+
<a href="/xenon/xenon-files/html/dashboard-1.html">
|
65
|
+
<i class="linecons-database"></i>
|
66
|
+
<span class="title">Master Data</span>
|
67
|
+
</a>
|
68
|
+
<ul>
|
69
|
+
<li class="">
|
70
|
+
<%= link_to raw("<i class=\"linecons-diamond\"></i> <span class='title'>Manage Features</span>"), admin_features_url %>
|
71
|
+
</li>
|
72
|
+
</ul>
|
73
|
+
</li>
|
74
|
+
</ul>
|
75
|
+
|
76
|
+
</div>
|
77
|
+
|
78
|
+
</div>
|
@@ -0,0 +1,52 @@
|
|
1
|
+
<div class="row">
|
2
|
+
|
3
|
+
<div class="col-sm-3">
|
4
|
+
<div class="xe-widget xe-counter" data-count=".num" data-from="0" data-to="99.9" data-suffix="%" data-duration="2">
|
5
|
+
<div class="xe-icon">
|
6
|
+
<i class="linecons-cloud"></i>
|
7
|
+
</div>
|
8
|
+
<div class="xe-label">
|
9
|
+
<strong class="num">99.9%</strong>
|
10
|
+
<span>Server Uptime</span>
|
11
|
+
</div>
|
12
|
+
</div>
|
13
|
+
</div>
|
14
|
+
|
15
|
+
<div class="col-sm-3">
|
16
|
+
<div class="xe-widget xe-counter xe-counter-red" data-count=".num" data-from="0" data-to="57" data-prefix="-," data-suffix="%" data-duration="5" data-easing="true" data-delay="1">
|
17
|
+
<div class="xe-icon">
|
18
|
+
<i class="linecons-lightbulb"></i>
|
19
|
+
</div>
|
20
|
+
<div class="xe-label">
|
21
|
+
<strong class="num"><%= time_ago_in_words(Dummy::BOOTED_AT) %></strong>
|
22
|
+
<span>Server Up Since</span>
|
23
|
+
</div>
|
24
|
+
</div>
|
25
|
+
</div>
|
26
|
+
|
27
|
+
<div class="col-sm-3">
|
28
|
+
<div class="xe-widget xe-counter xe-counter-blue" data-count=".num" data-from="1" data-to="117" data-suffix="k" data-duration="3" data-easing="false">
|
29
|
+
<div class="xe-icon">
|
30
|
+
<i class="linecons-user"></i>
|
31
|
+
</div>
|
32
|
+
<div class="xe-label">
|
33
|
+
<strong class="num"><%= User.approved.where("super_admin is FALSE").count %></strong>
|
34
|
+
<span>Total Users</span>
|
35
|
+
</div>
|
36
|
+
</div>
|
37
|
+
</div>
|
38
|
+
|
39
|
+
<div class="col-sm-3">
|
40
|
+
<div class="xe-widget xe-counter xe-counter-info" data-count=".num" data-from="1000" data-to="2470" data-duration="4" data-easing="true">
|
41
|
+
<div class="xe-icon">
|
42
|
+
<i class="linecons-diamond"></i>
|
43
|
+
</div>
|
44
|
+
<div class="xe-label">
|
45
|
+
<strong class="num"><%= Feature.published.count %></strong>
|
46
|
+
<span>Activated Features</span>
|
47
|
+
</div>
|
48
|
+
</div>
|
49
|
+
</div>
|
50
|
+
|
51
|
+
|
52
|
+
</div>
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<div class="row">
|
2
|
+
<div class="col-md-4">
|
3
|
+
<%= link_to raw("<i class='fa fa-plus mr-10'></i><span class='btn-text'> New Feature</span>"), new_admin_feature_path, :class=>"btn btn-primary pull-left mb-5", :remote=>true %>
|
4
|
+
</div>
|
5
|
+
<div class="col-md-8">
|
6
|
+
<%= search_form_kuppayam(Feature, admin_features_path, text: @filters[:query]) %>
|
7
|
+
</div>
|
8
|
+
</div>
|
9
|
+
|
10
|
+
|
11
|
+
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<%= form_for([:admin, @feature], :html => {:id=>"form_feature", :class=>"mb-0 form-horizontal", :role => "form", :method => (@feature.new_record? ? :post : :put), :remote=>true}) do |f| %>
|
2
|
+
|
3
|
+
<div id="feature_form_error">
|
4
|
+
<%= @feature.errors[:base].to_sentence %>
|
5
|
+
</div>
|
6
|
+
|
7
|
+
<div class="form-inputs mb-30 mt-30">
|
8
|
+
<%= theme_form_field(@feature, :name) %>
|
9
|
+
</div>
|
10
|
+
|
11
|
+
<div>
|
12
|
+
<%= link_to raw("<i class='fa fa-close mr-5'></i><span>Cancel</span>"), "#", onclick: "closeGenericModal();", class: "pull-left btn btn-white" %>
|
13
|
+
<%= submit_tag("Save", :class=>"btn btn-secondary pull-right") %>
|
14
|
+
</div>
|
15
|
+
<%= clear_tag(10) %>
|
16
|
+
</div>
|
17
|
+
|
18
|
+
<% end %>
|
19
|
+
|
@@ -0,0 +1,79 @@
|
|
1
|
+
<div class="table-responsive">
|
2
|
+
<table class="table table-hover members-table middle-align">
|
3
|
+
<thead>
|
4
|
+
<tr>
|
5
|
+
<th style="text-align: center;width:30px">#</th>
|
6
|
+
<th>Name</th>
|
7
|
+
<th style="width:100px;">Status</th>
|
8
|
+
<th style="text-align: center;" colspan="2">Actions</th>
|
9
|
+
</tr>
|
10
|
+
</thead>
|
11
|
+
<tbody>
|
12
|
+
<% @features.each_with_index do |feature, i| %>
|
13
|
+
|
14
|
+
<% edit_link = edit_admin_feature_path(id: feature.id) %>
|
15
|
+
<% delete_link = admin_feature_path(id: feature.id) %>
|
16
|
+
|
17
|
+
<tr id="tr_feature_<%= feature.id %>">
|
18
|
+
|
19
|
+
<td class="feature-image">
|
20
|
+
<a href="#">
|
21
|
+
<%= display_image(feature, "profile_picture.image.small.url", width: "32", height: "auto", class: "img-circle", alt: feature.display_name) %>
|
22
|
+
</a>
|
23
|
+
</td>
|
24
|
+
|
25
|
+
<td class="feature-name"><%= link_to feature.name, admin_feature_path(feature), remote: true %></td>
|
26
|
+
|
27
|
+
<td>
|
28
|
+
<% if feature.unpublished? %>
|
29
|
+
<span class="ml-5 mt-5 label label-default">Un-Published</span>
|
30
|
+
<% elsif feature.published? %>
|
31
|
+
<span class="ml-5 mt-5 label label-success">Published</span>
|
32
|
+
<% elsif feature.disabled? %>
|
33
|
+
<span class="ml-5 mt-5 label label-danger">Disabled</span>
|
34
|
+
<% end %>
|
35
|
+
</td>
|
36
|
+
|
37
|
+
<td class="action-links" style="width:10%">
|
38
|
+
|
39
|
+
<% case feature.status %>
|
40
|
+
<% when "published" %>
|
41
|
+
<!-- Un-Publish -->
|
42
|
+
<%= link_to raw("<i class=\"fa fa-circle mr-5\"></i> Un-Publish"), update_status_admin_feature_path(:id =>feature.id, :status =>'unpublished'), :method =>'PUT', :remote=>true, role: "menuitem", tabindex: "-1", :class=>"feature_status" %>
|
43
|
+
|
44
|
+
<!-- Disable -->
|
45
|
+
<%= link_to raw("<i class=\"fa fa-edit mr-5\"></i> Disable"), update_status_admin_feature_path(:id =>feature.id, :status =>'disabled'), :method =>'PUT', :remote=>true, role: "menuitem", tabindex: "-1", :class=>"feature_status" %>
|
46
|
+
<% when "unpublished" %>
|
47
|
+
<!-- Approve -->
|
48
|
+
<%= link_to raw("<i class=\"fa fa-circle-o mr-5\"></i> Publish"), update_status_admin_feature_path(:id =>feature.id, :status =>'published'), :method =>'PUT', :remote=>true, role: "menuitem", tabindex: "-1", :class=>"feature_status" %>
|
49
|
+
<!-- Disable -->
|
50
|
+
<%= link_to raw("<i class=\"fa fa-edit mr-5\"></i> Disable"), update_status_admin_feature_path(:id =>feature.id, :status =>'disabled'), :method =>'PUT', :remote=>true, role: "menuitem", tabindex: "-1", :class=>"feature_status" %>
|
51
|
+
<% when "disabled" %>
|
52
|
+
<!-- Un-Publish -->
|
53
|
+
<%= link_to raw("<i class=\"fa fa-circle mr-5\"></i> Un-Publish"), update_status_admin_feature_path(:id =>feature.id, :status =>'unpublished'), :method =>'PUT', :remote=>true, role: "menuitem", tabindex: "-1", :class=>"feature_status" %>
|
54
|
+
<!-- Approve -->
|
55
|
+
<%= link_to raw("<i class=\"fa fa-circle-o mr-5\"></i> Publish"), update_status_admin_feature_path(:id =>feature.id, :status =>'published'), :method =>'PUT', :remote=>true, role: "menuitem", tabindex: "-1",:class=>"feature_status" %>
|
56
|
+
<% end %>
|
57
|
+
|
58
|
+
</td>
|
59
|
+
|
60
|
+
<td class="action-links" style="width:10%">
|
61
|
+
|
62
|
+
<%= link_to raw("<i class=\"linecons-pencil\"></i> Edit Feature"), edit_link, :remote=>true, class: "edit" %>
|
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" %>
|
65
|
+
|
66
|
+
</td>
|
67
|
+
|
68
|
+
</tr>
|
69
|
+
<% end %>
|
70
|
+
</tbody>
|
71
|
+
</table>
|
72
|
+
</div>
|
73
|
+
|
74
|
+
<div class="row">
|
75
|
+
<div class="col-sm-12">
|
76
|
+
<%= paginate_kuppayam(@features) %>
|
77
|
+
</div>
|
78
|
+
</div>
|
79
|
+
|
@@ -0,0 +1,55 @@
|
|
1
|
+
<% edit_link = edit_admin_feature_path(id: feature.id) %>
|
2
|
+
<% delete_link = admin_feature_path(id: feature.id) %>
|
3
|
+
|
4
|
+
<tr id="tr_feature_<%= feature.id %>">
|
5
|
+
|
6
|
+
<td class="feature-image">
|
7
|
+
<a href="#">
|
8
|
+
<%= display_image(feature, "profile_picture.image.small.url", width: "32", height: "auto", class: "img-circle", alt: feature.display_name) %>
|
9
|
+
</a>
|
10
|
+
</td>
|
11
|
+
|
12
|
+
<td class="feature-name"><%= link_to feature.name, admin_feature_path(feature), remote: true %></td>
|
13
|
+
|
14
|
+
<td>
|
15
|
+
<% if feature.unpublished? %>
|
16
|
+
<span class="ml-5 mt-5 label label-default">Un-Published</span>
|
17
|
+
<% elsif feature.published? %>
|
18
|
+
<span class="ml-5 mt-5 label label-success">Published</span>
|
19
|
+
<% elsif feature.disabled? %>
|
20
|
+
<span class="ml-5 mt-5 label label-danger">Disabled</span>
|
21
|
+
<% end %>
|
22
|
+
</td>
|
23
|
+
|
24
|
+
<td class="action-links" style="width:10%">
|
25
|
+
|
26
|
+
<% case feature.status %>
|
27
|
+
<% when "published" %>
|
28
|
+
<!-- Un-Publish -->
|
29
|
+
<%= link_to raw("<i class=\"fa fa-circle mr-5\"></i> Un-Publish"), update_status_admin_feature_path(:id =>feature.id, :status =>'unpublished'), :method =>'PUT', :remote=>true, role: "menuitem", tabindex: "-1", :class=>"feature_status" %>
|
30
|
+
|
31
|
+
<!-- Disable -->
|
32
|
+
<%= link_to raw("<i class=\"fa fa-edit mr-5\"></i> Disable"), update_status_admin_feature_path(:id =>feature.id, :status =>'disabled'), :method =>'PUT', :remote=>true, role: "menuitem", tabindex: "-1", :class=>"feature_status" %>
|
33
|
+
<% when "unpublished" %>
|
34
|
+
<!-- Approve -->
|
35
|
+
<%= link_to raw("<i class=\"fa fa-circle-o mr-5\"></i> Publish"), update_status_admin_feature_path(:id =>feature.id, :status =>'published'), :method =>'PUT', :remote=>true, role: "menuitem", tabindex: "-1", :class=>"feature_status" %>
|
36
|
+
<!-- Disable -->
|
37
|
+
<%= link_to raw("<i class=\"fa fa-edit mr-5\"></i> Disable"), update_status_admin_feature_path(:id =>feature.id, :status =>'disabled'), :method =>'PUT', :remote=>true, role: "menuitem", tabindex: "-1", :class=>"feature_status" %>
|
38
|
+
<% when "disabled" %>
|
39
|
+
<!-- Un-Publish -->
|
40
|
+
<%= link_to raw("<i class=\"fa fa-circle mr-5\"></i> Un-Publish"), update_status_admin_feature_path(:id =>feature.id, :status =>'unpublished'), :method =>'PUT', :remote=>true, role: "menuitem", tabindex: "-1", :class=>"feature_status" %>
|
41
|
+
<!-- Approve -->
|
42
|
+
<%= link_to raw("<i class=\"fa fa-circle-o mr-5\"></i> Publish"), update_status_admin_feature_path(:id =>feature.id, :status =>'published'), :method =>'PUT', :remote=>true, role: "menuitem", tabindex: "-1",:class=>"feature_status" %>
|
43
|
+
<% end %>
|
44
|
+
|
45
|
+
</td>
|
46
|
+
|
47
|
+
<td class="action-links" style="width:10%">
|
48
|
+
|
49
|
+
<%= link_to raw("<i class=\"linecons-pencil\"></i> Edit Feature"), edit_link, :remote=>true, class: "edit" %>
|
50
|
+
|
51
|
+
<%= 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" %>
|
52
|
+
|
53
|
+
</td>
|
54
|
+
|
55
|
+
</tr>
|
@@ -0,0 +1,48 @@
|
|
1
|
+
<% status_hash = {published: "success", unpublished: "default", disabled: "danger"} %>
|
2
|
+
|
3
|
+
<div class="media <%= status_hash[@feature.status.to_sym] %>">
|
4
|
+
|
5
|
+
<div class="pull-left pt-10 pr-10 pb-10" style="width:30%;">
|
6
|
+
<%= edit_image(@feature, "feature_image.image.large.url", upload_image_link(@feature, :feature_image)) %>
|
7
|
+
</div>
|
8
|
+
|
9
|
+
<div class="pull-left ml-10" style="width:65%;">
|
10
|
+
|
11
|
+
<h1><%= @feature.name %></h1>
|
12
|
+
|
13
|
+
<span class="ml-5 mt-5 label label-<%= status_hash[@feature.status.to_sym] %>"><%= @feature.status.titleize %></span>
|
14
|
+
|
15
|
+
<%= clear_tag %>
|
16
|
+
</div>
|
17
|
+
|
18
|
+
</div>
|
19
|
+
|
20
|
+
<h4 class="mb-20">Technical Details</h4>
|
21
|
+
|
22
|
+
<div class="table-responsive mb-50">
|
23
|
+
<table class="table table-striped table-condensed table-bordered">
|
24
|
+
<tbody>
|
25
|
+
|
26
|
+
<tr>
|
27
|
+
<th>Created At</th><td><%= @feature.created_at.strftime("%m/%d/%Y - %H:%M:%S") if @feature.created_at %></td>
|
28
|
+
<th>Updated At</th><td><%= @feature.updated_at.strftime("%m/%d/%Y - %H:%M:%S") if @feature.updated_at %></td>
|
29
|
+
</tr>
|
30
|
+
|
31
|
+
</tbody>
|
32
|
+
</table>
|
33
|
+
</div>
|
34
|
+
|
35
|
+
<div>
|
36
|
+
<%
|
37
|
+
edit_link = edit_admin_feature_url(id: @feature.id)
|
38
|
+
delete_link = admin_feature_url(id: @feature.id)
|
39
|
+
%>
|
40
|
+
|
41
|
+
<%= link_to raw("<i class=\"fa fa-close mr-5\"></i> <span>Cancel</span>"), "#", onclick: "closeGenericModal();", class: "btn btn-white pull-left" %>
|
42
|
+
|
43
|
+
<%= 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" %>
|
44
|
+
|
45
|
+
<%= 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" %>
|
46
|
+
</div>
|
47
|
+
|
48
|
+
<%= clear_tag %>
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<% if @feature.errors.blank? %>
|
2
|
+
closeGenericModal();
|
3
|
+
$('#div_feature_index table > tbody > tr:first').before("<%= escape_javascript(render(:partial=>'/usman/admin/features/row', locals: {feature: @feature})) %>")
|
4
|
+
$("#tr_feature_<%= @feature.id %>").css("background-color", "#fffddd");
|
5
|
+
<% else %>
|
6
|
+
// Show the form in the modal
|
7
|
+
heading = "Add a Feature";
|
8
|
+
bodyContent = "<%= escape_javascript(render(:partial=>'/usman/admin/features/form')) %>";
|
9
|
+
showGenericModal(heading, bodyContent);
|
10
|
+
var $div = $('<iframe id="iframe_feature" name="iframe_feature" width="100%" style="display:none"></iframe>').appendTo('body');
|
11
|
+
<%
|
12
|
+
text = "You have few errors. They have been highlighted."
|
13
|
+
error_message = content_tag(:div, text, class: "alert alert-danger")
|
14
|
+
%>
|
15
|
+
$("#feature_form_error").html("<%= escape_javascript(error_message) %>");
|
16
|
+
<% end %>
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<% if @destroyed %>
|
2
|
+
closeGenericModal();
|
3
|
+
$('#div_feature_index').html("<%= escape_javascript(render(:partial=>'/usman/admin/features/index')) %>");
|
4
|
+
<% else %>
|
5
|
+
// Show the error in a modal
|
6
|
+
<%
|
7
|
+
text = Feature::DELETE_MESSAGE
|
8
|
+
error_message = content_tag(:div, text, class: 'alert alert-danger')
|
9
|
+
%>
|
10
|
+
heading = "Remove '<%= @feature.name %>'";
|
11
|
+
bodyContent = "<%= escape_javascript(error_message) %>";
|
12
|
+
showGenericModal(heading, bodyContent);
|
13
|
+
var $div = $('<iframe id="iframe_feature" name="iframe_feature" width="100%" style="display:none"></iframe>').appendTo('body');
|
14
|
+
<% end %>
|
15
|
+
|
16
|
+
|
@@ -0,0 +1,7 @@
|
|
1
|
+
// Show the new form in the right box.
|
2
|
+
heading = "Edit '<%= raw @feature.name_was %>'";
|
3
|
+
bodyContent = "<%= escape_javascript(render(:partial=>'/usman/admin/features/form')) %>";
|
4
|
+
showGenericModal(heading, bodyContent);
|
5
|
+
|
6
|
+
// When the image upload form is submitted, the server response will appear in this iframe -->
|
7
|
+
var $div = $('<iframe id="iframe_feature" name="iframe_feature" width="100%" style="display:none"></iframe>').appendTo('body');
|
@@ -0,0 +1,25 @@
|
|
1
|
+
<div class="row">
|
2
|
+
|
3
|
+
<div class="col-md-12">
|
4
|
+
|
5
|
+
<ul class="nav nav-tabs">
|
6
|
+
</ul>
|
7
|
+
<div class="tab-content">
|
8
|
+
<div class="tab-pane active">
|
9
|
+
|
10
|
+
<div id="div_feature_action_buttons">
|
11
|
+
<%= render :partial=>"usman/admin/features/action_buttons" %>
|
12
|
+
</div>
|
13
|
+
<%= clear_tag(10) %>
|
14
|
+
|
15
|
+
<div id="div_feature_index">
|
16
|
+
<%= render :partial=>"usman/admin/features/index" %>
|
17
|
+
</div>
|
18
|
+
<%= clear_tag(10) %>
|
19
|
+
|
20
|
+
</div>
|
21
|
+
</div>
|
22
|
+
|
23
|
+
</div>
|
24
|
+
|
25
|
+
</div>
|
@@ -0,0 +1,8 @@
|
|
1
|
+
closeGenericModal();
|
2
|
+
<% if @features.any? %>
|
3
|
+
// Fill the right box with first enquiry details in the list
|
4
|
+
$('#div_feature_index').html("<%= escape_javascript(render(:partial=>'/usman/admin/features/index')) %>");
|
5
|
+
<% else %>
|
6
|
+
var noResultsText = "<%= escape_javascript(theme_panel_message(I18n.translate('forms.no_results')))%>";
|
7
|
+
$('#div_feature_index').html(noResultsText);
|
8
|
+
<% end %>
|