usman 0.1.0
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 +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,7 @@
|
|
|
1
|
+
// Show the new form in the right box.
|
|
2
|
+
heading = "Add a Feature";
|
|
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,10 @@
|
|
|
1
|
+
<% if @feature.errors.blank? %>
|
|
2
|
+
<% status_hash = {approved: "success", pending: "default", suspeneded: "danger"} %>
|
|
3
|
+
$("#tr_feature_<%= @feature.id %>").replaceWith("<%= escape_javascript(render(:partial=>'/usman/admin/features/row', locals: {feature: @feature, i: -1})) %>")
|
|
4
|
+
// Close Modal
|
|
5
|
+
closeGenericModal();
|
|
6
|
+
<% else %>
|
|
7
|
+
// Populate Server Side Errors
|
|
8
|
+
errorMessages = <%= @feature.errors.full_messages.to_json.html_safe %>;
|
|
9
|
+
populateServerSideErrors('feature', errorMessages);
|
|
10
|
+
<% end %>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// Show the new form in the right box.
|
|
2
|
+
heading = "<%= raw @feature.name %>";
|
|
3
|
+
bodyContent = "<%= escape_javascript(render(:partial=>'/usman/admin/features/show')) %>";
|
|
4
|
+
closeGenericModal();
|
|
5
|
+
showGenericModal(heading, bodyContent);
|
|
6
|
+
|
|
7
|
+
// When the image upload form is submitted, the server response will appear in this iframe -->
|
|
8
|
+
var $div = $('<iframe id="iframe_feature" name="iframe_feature" width="100%" style="display:none"></iframe>').appendTo('body');
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<% if @feature.errors.blank? %>
|
|
2
|
+
$('#tr_feature_<%= @feature.id %>').replaceWith("<%= escape_javascript(render(:partial=>'/usman/admin/features/row', locals: {feature: @feature})) %>");
|
|
3
|
+
$("#tr_feature_<%= @feature.id %>").css("background-color", "#fffddd");
|
|
4
|
+
closeGenericModal();
|
|
5
|
+
<% else %>
|
|
6
|
+
// Show the form in the modal
|
|
7
|
+
heading = "Edit '<%= raw @feature.name_was %>'";
|
|
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,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 Permission</span>"), new_admin_permission_path, :class=>"btn btn-primary pull-left mb-5", :remote=>true %>
|
|
4
|
+
</div>
|
|
5
|
+
<div class="col-md-8">
|
|
6
|
+
<%= search_form_kuppayam(Permission, admin_permissions_path, text: @filters[:query]) %>
|
|
7
|
+
</div>
|
|
8
|
+
</div>
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
<%= form_for([:admin, @permission], :html => {:id=>"form_permission", :class=>"mb-0 form-horizontal", :role => "form", :method => (@permission.new_record? ? :post : :put), :remote=>true}) do |f| %>
|
|
2
|
+
|
|
3
|
+
<div id="permission_form_error">
|
|
4
|
+
<%= @permission.errors[:base].to_sentence %>
|
|
5
|
+
</div>
|
|
6
|
+
|
|
7
|
+
<div class="form-inputs mb-30 mt-30">
|
|
8
|
+
|
|
9
|
+
<% options = {assoc_collection: User.select("id, name").order("name ASC").all, required: true, editable: true, assoc_display_method: :name} %>
|
|
10
|
+
<%= theme_form_assoc_group(@permission, :user_id, **options) %>
|
|
11
|
+
|
|
12
|
+
<% options = {assoc_collection: Feature.select("id, name").order("name ASC").all, required: true, editable: true, assoc_display_method: :name} %>
|
|
13
|
+
<%= theme_form_assoc_group(@permission, :feature_id, **options) %>
|
|
14
|
+
|
|
15
|
+
<div class="form-group ">
|
|
16
|
+
<label class="col-md-4 control-label">
|
|
17
|
+
Permissions
|
|
18
|
+
<span class="text-color-red ml-10 mr-5 pull-right">*</span>
|
|
19
|
+
</label>
|
|
20
|
+
|
|
21
|
+
<div class="col-md-8">
|
|
22
|
+
|
|
23
|
+
<div class="row">
|
|
24
|
+
<div class="col-sm-3">
|
|
25
|
+
<span>
|
|
26
|
+
<% checked_hash = @permission.can_create ? {:checked => "checked"} : {} %>
|
|
27
|
+
<%= check_box_tag 'permission[can_create]', "1", @permission.can_create, checked_hash %>
|
|
28
|
+
</span>
|
|
29
|
+
<span style="ml-20">Create</span>
|
|
30
|
+
</div>
|
|
31
|
+
|
|
32
|
+
<div class="col-sm-3">
|
|
33
|
+
<span>
|
|
34
|
+
<% checked_hash = @permission.can_read ? {:checked => "checked"} : {} %>
|
|
35
|
+
<%= check_box_tag 'permission[can_read]', "1", @permission.can_read, checked_hash %>
|
|
36
|
+
</span>
|
|
37
|
+
<span style="ml-20">Read</span>
|
|
38
|
+
</div>
|
|
39
|
+
|
|
40
|
+
<div class="col-sm-3">
|
|
41
|
+
<span>
|
|
42
|
+
<% checked_hash = @permission.can_update ? {:checked => "checked"} : {} %>
|
|
43
|
+
<%= check_box_tag 'permission[can_update]', "1", @permission.can_update, checked_hash %>
|
|
44
|
+
</span>
|
|
45
|
+
<span style="ml-20">Update</span>
|
|
46
|
+
</div>
|
|
47
|
+
|
|
48
|
+
<div class="col-sm-3">
|
|
49
|
+
<span>
|
|
50
|
+
<% checked_hash = @permission.can_delete ? {:checked => "checked"} : {} %>
|
|
51
|
+
<%= check_box_tag 'permission[can_delete]', "1", @permission.can_delete, checked_hash %>
|
|
52
|
+
</span>
|
|
53
|
+
<span style="ml-20">Delete</span>
|
|
54
|
+
</div>
|
|
55
|
+
</div>
|
|
56
|
+
|
|
57
|
+
</div>
|
|
58
|
+
</div>
|
|
59
|
+
|
|
60
|
+
</div>
|
|
61
|
+
|
|
62
|
+
<div>
|
|
63
|
+
<%= link_to raw("<i class='fa fa-close mr-5'></i><span>Cancel</span>"), "#", onclick: "closeGenericModal();", class: "pull-left btn btn-white" %>
|
|
64
|
+
<%= submit_tag("Save", :class=>"btn btn-secondary pull-right") %>
|
|
65
|
+
</div>
|
|
66
|
+
<%= clear_tag(10) %>
|
|
67
|
+
</div>
|
|
68
|
+
|
|
69
|
+
<% end %>
|
|
70
|
+
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
<% features = Feature.published.all %>
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
<div class="table-responsive">
|
|
5
|
+
<table class="table table-hover members-table middle-align">
|
|
6
|
+
<thead>
|
|
7
|
+
<tr>
|
|
8
|
+
<th>User</th>
|
|
9
|
+
<th>Feature</th>
|
|
10
|
+
<th style="width:90px;text-align: center;">Create</th>
|
|
11
|
+
<th style="width:90px;text-align: center;">Read</th>
|
|
12
|
+
<th style="width:90px;text-align: center;">Update</th>
|
|
13
|
+
<th style="width:90px;text-align: center;">Delete</th>
|
|
14
|
+
<th style="width:10%;text-align: center;">Actions</th>
|
|
15
|
+
</tr>
|
|
16
|
+
</thead>
|
|
17
|
+
<tbody>
|
|
18
|
+
<% @permissions.each_with_index do |permission, i| %>
|
|
19
|
+
<% edit_link = edit_admin_permission_path(id: permission.id) %>
|
|
20
|
+
<% delete_link = admin_permission_path(id: permission.id) %>
|
|
21
|
+
|
|
22
|
+
<tr id="tr_permission_<%= permission.id %>">
|
|
23
|
+
|
|
24
|
+
<td class="permission-name"><%= permission.user.try(:name) %></td>
|
|
25
|
+
|
|
26
|
+
<td class="permission-name"><%= permission.feature.try(:name) %></td>
|
|
27
|
+
|
|
28
|
+
<td class="permission-name" style="text-align: center"><%= permission.can_create ? raw("<i class='fa fa-check'></i>") : "-" %></td>
|
|
29
|
+
|
|
30
|
+
<td class="permission-name" style="text-align: center"><%= permission.can_read ? raw("<i class='fa fa-check'></i>") : "-" %></td>
|
|
31
|
+
|
|
32
|
+
<td class="permission-name" style="text-align: center"><%= permission.can_update ? raw("<i class='fa fa-check'></i>") : "-" %></td>
|
|
33
|
+
|
|
34
|
+
<td class="permission-name" style="text-align: center"><%= permission.can_delete ? raw("<i class='fa fa-check'></i>") : "-" %></td>
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
<td class="action-links1" style="width:10%;text-align: center;">
|
|
38
|
+
|
|
39
|
+
<%= link_to raw("<i class=\"linecons-pencil\"></i>"), edit_link, :remote=>true, class: "edit" %>
|
|
40
|
+
|
|
41
|
+
<%= link_to raw("<i class=\"linecons-trash\"></i>"), delete_link, method: :delete, role: "menuitem", tabindex: "-1", data: { confirm: 'Are you sure?' }, :remote=>true, class: "delete" %>
|
|
42
|
+
|
|
43
|
+
</td>
|
|
44
|
+
|
|
45
|
+
</tr>
|
|
46
|
+
<% end %>
|
|
47
|
+
</tbody>
|
|
48
|
+
</table>
|
|
49
|
+
</div>
|
|
50
|
+
|
|
51
|
+
<div class="row">
|
|
52
|
+
<div class="col-sm-12">
|
|
53
|
+
<%= paginate_kuppayam(@permissions) %>
|
|
54
|
+
</div>
|
|
55
|
+
</div>
|
|
56
|
+
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<% edit_link = edit_admin_permission_path(id: permission.id) %>
|
|
2
|
+
<% delete_link = admin_permission_path(id: permission.id) %>
|
|
3
|
+
|
|
4
|
+
<tr id="tr_permission_<%= permission.id %>">
|
|
5
|
+
|
|
6
|
+
<td class="permission-name"><%= permission.user.try(:name) %></td>
|
|
7
|
+
|
|
8
|
+
<td class="permission-name"><%= permission.feature.try(:name) %></td>
|
|
9
|
+
|
|
10
|
+
<td class="permission-name" style="text-align: center"><%= permission.can_create ? raw("<i class='fa fa-check'></i>") : "-" %></td>
|
|
11
|
+
|
|
12
|
+
<td class="permission-name" style="text-align: center"><%= permission.can_read ? raw("<i class='fa fa-check'></i>") : "-" %></td>
|
|
13
|
+
|
|
14
|
+
<td class="permission-name" style="text-align: center"><%= permission.can_update ? raw("<i class='fa fa-check'></i>") : "-" %></td>
|
|
15
|
+
|
|
16
|
+
<td class="permission-name" style="text-align: center"><%= permission.can_delete ? raw("<i class='fa fa-check'></i>") : "-" %></td>
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
<td class="action-links1" style="width:10%;text-align: center;">
|
|
20
|
+
|
|
21
|
+
<%= link_to raw("<i class=\"linecons-pencil\"></i>"), edit_link, :remote=>true, class: "edit" %>
|
|
22
|
+
|
|
23
|
+
<%= link_to raw("<i class=\"linecons-trash\"></i>"), delete_link, method: :delete, role: "menuitem", tabindex: "-1", data: { confirm: 'Are you sure?' }, :remote=>true, class: "delete" %>
|
|
24
|
+
|
|
25
|
+
</td>
|
|
26
|
+
|
|
27
|
+
</tr>
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
<% status_hash = {published: "success", unpublished: "default", disabled: "danger"} %>
|
|
2
|
+
|
|
3
|
+
<div class="media <%= status_hash[@permission.status.to_sym] %>">
|
|
4
|
+
|
|
5
|
+
<div class="pull-left pt-10 pr-10 pb-10" style="width:30%;">
|
|
6
|
+
<%= edit_image(@permission, "permission_image.image.large.url", upload_image_link(@permission, :permission_image)) %>
|
|
7
|
+
</div>
|
|
8
|
+
|
|
9
|
+
<div class="pull-left ml-10" style="width:65%;">
|
|
10
|
+
|
|
11
|
+
<h1><%= @permission.name %></h1>
|
|
12
|
+
|
|
13
|
+
<span class="ml-5 mt-5 label label-<%= status_hash[@permission.status.to_sym] %>"><%= @permission.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><%= @permission.created_at.strftime("%m/%d/%Y - %H:%M:%S") if @permission.created_at %></td>
|
|
28
|
+
<th>Updated At</th><td><%= @permission.updated_at.strftime("%m/%d/%Y - %H:%M:%S") if @permission.updated_at %></td>
|
|
29
|
+
</tr>
|
|
30
|
+
|
|
31
|
+
</tbody>
|
|
32
|
+
</table>
|
|
33
|
+
</div>
|
|
34
|
+
|
|
35
|
+
<div>
|
|
36
|
+
<%
|
|
37
|
+
edit_link = edit_admin_permission_url(id: @permission.id)
|
|
38
|
+
delete_link = admin_permission_url(id: @permission.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,17 @@
|
|
|
1
|
+
<% if @permission.errors.blank? %>
|
|
2
|
+
closeGenericModal();
|
|
3
|
+
$("#tr_permission_<%= @permission.id %>").remove();
|
|
4
|
+
$('#div_permission_index table > tbody > tr:first').before("<%= escape_javascript(render(:partial=>'/usman/admin/permissions/row', locals: {permission: @permission})) %>")
|
|
5
|
+
$("#tr_permission_<%= @permission.id %>").css("background-color", "#fffddd");
|
|
6
|
+
<% else %>
|
|
7
|
+
// Show the form in the modal
|
|
8
|
+
heading = "Add a Permission";
|
|
9
|
+
bodyContent = "<%= escape_javascript(render(:partial=>'/usman/admin/permissions/form')) %>";
|
|
10
|
+
showGenericModal(heading, bodyContent);
|
|
11
|
+
var $div = $('<iframe id="iframe_permission" name="iframe_permission" width="100%" style="display:none"></iframe>').appendTo('body');
|
|
12
|
+
<%
|
|
13
|
+
text = "You have few errors. They have been highlighted."
|
|
14
|
+
error_message = content_tag(:div, text, class: "alert alert-danger")
|
|
15
|
+
%>
|
|
16
|
+
$("#permission_form_error").html("<%= escape_javascript(error_message) %>");
|
|
17
|
+
<% end %>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<% if @destroyed %>
|
|
2
|
+
closeGenericModal();
|
|
3
|
+
$('#div_permission_index').html("<%= escape_javascript(render(:partial=>'/usman/admin/permissions/index')) %>");
|
|
4
|
+
<% else %>
|
|
5
|
+
// Show the error in a modal
|
|
6
|
+
<%
|
|
7
|
+
text = Permission::DELETE_MESSAGE
|
|
8
|
+
error_message = content_tag(:div, text, class: 'alert alert-danger')
|
|
9
|
+
%>
|
|
10
|
+
heading = "Remove '<%= @permission.name %>'";
|
|
11
|
+
bodyContent = "<%= escape_javascript(error_message) %>";
|
|
12
|
+
showGenericModal(heading, bodyContent);
|
|
13
|
+
var $div = $('<iframe id="iframe_permission" name="iframe_permission" 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 Permission";
|
|
3
|
+
bodyContent = "<%= escape_javascript(render(:partial=>'/usman/admin/permissions/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_permission" name="iframe_permission" 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_permission_action_buttons">
|
|
11
|
+
<%= render :partial=>"usman/admin/permissions/action_buttons" %>
|
|
12
|
+
</div>
|
|
13
|
+
<%= clear_tag(10) %>
|
|
14
|
+
|
|
15
|
+
<div id="div_permission_index">
|
|
16
|
+
<%= render :partial=>"usman/admin/permissions/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 @permissions.any? %>
|
|
3
|
+
// Fill the right box with first enquiry details in the list
|
|
4
|
+
$('#div_permission_index').html("<%= escape_javascript(render(:partial=>'/usman/admin/permissions/index')) %>");
|
|
5
|
+
<% else %>
|
|
6
|
+
var noResultsText = "<%= escape_javascript(theme_panel_message(I18n.translate('forms.no_results')))%>";
|
|
7
|
+
$('#div_permission_index').html(noResultsText);
|
|
8
|
+
<% end %>
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// Show the new form in the right box.
|
|
2
|
+
heading = "Add a Permission";
|
|
3
|
+
bodyContent = "<%= escape_javascript(render(:partial=>'/usman/admin/permissions/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_permission" name="iframe_permission" width="100%" style="display:none"></iframe>').appendTo('body');
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<% if @permission.errors.blank? %>
|
|
2
|
+
<% status_hash = {approved: "success", pending: "default", suspeneded: "danger"} %>
|
|
3
|
+
$("#tr_permission_<%= @permission.id %>").replaceWith("<%= escape_javascript(render(:partial=>'/usman/admin/permissions/row', locals: {permission: @permission, i: -1})) %>")
|
|
4
|
+
// Close Modal
|
|
5
|
+
closeGenericModal();
|
|
6
|
+
<% else %>
|
|
7
|
+
// Populate Server Side Errors
|
|
8
|
+
errorMessages = <%= @permission.errors.full_messages.to_json.html_safe %>;
|
|
9
|
+
populateServerSideErrors('permission', errorMessages);
|
|
10
|
+
<% end %>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// Show the new form in the right box.
|
|
2
|
+
heading = "<%= raw @permission.name %>";
|
|
3
|
+
bodyContent = "<%= escape_javascript(render(:partial=>'/usman/admin/permissions/show')) %>";
|
|
4
|
+
closeGenericModal();
|
|
5
|
+
showGenericModal(heading, bodyContent);
|
|
6
|
+
|
|
7
|
+
// When the image upload form is submitted, the server response will appear in this iframe -->
|
|
8
|
+
var $div = $('<iframe id="iframe_permission" name="iframe_permission" width="100%" style="display:none"></iframe>').appendTo('body');
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<% if @permission.errors.blank? %>
|
|
2
|
+
$('#tr_permission_<%= @permission.id %>').replaceWith("<%= escape_javascript(render(:partial=>'/usman/admin/permissions/row', locals: {permission: @permission})) %>");
|
|
3
|
+
$("#tr_permission_<%= @permission.id %>").css("background-color", "#fffddd");
|
|
4
|
+
closeGenericModal();
|
|
5
|
+
<% else %>
|
|
6
|
+
// Show the form in the modal
|
|
7
|
+
heading = "Edit '<%= raw @permission.name_was %>'";
|
|
8
|
+
bodyContent = "<%= escape_javascript(render(:partial=>'/usman/admin/permissions/form')) %>";
|
|
9
|
+
showGenericModal(heading, bodyContent);
|
|
10
|
+
var $div = $('<iframe id="iframe_permission" name="iframe_permission" 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
|
+
$("#permission_form_error").html("<%= escape_javascript(error_message) %>");
|
|
16
|
+
<% end %>
|
|
@@ -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 User</span>"), new_admin_user_path, :class=>"btn btn-primary pull-left mb-5", :remote=>true %>
|
|
4
|
+
</div>
|
|
5
|
+
<div class="col-md-8">
|
|
6
|
+
<%= search_form_kuppayam(User, admin_users_path, text: @filters[:query]) %>
|
|
7
|
+
</div>
|
|
8
|
+
</div>
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
<%= form_for([:admin, @user], :html => {:id=>"form_user", :class=>"mb-0 form-horizontal", :role => "form", :method => (@user.new_record? ? :post : :put), :remote=>true}) do |f| %>
|
|
2
|
+
|
|
3
|
+
<div id="user_form_error">
|
|
4
|
+
<%= @user.errors[:base].to_sentence %>
|
|
5
|
+
</div>
|
|
6
|
+
|
|
7
|
+
<div class="form-inputs mb-30 mt-30">
|
|
8
|
+
|
|
9
|
+
<div class="row">
|
|
10
|
+
<div class="col-md-6 col-xs-12">
|
|
11
|
+
<%= theme_form_field(@user, :name) %>
|
|
12
|
+
<%= theme_form_field(@user, :username) %>
|
|
13
|
+
<%= theme_form_field(@user, :email) %>
|
|
14
|
+
<%= theme_form_field(@user, :designation, required: false) %>
|
|
15
|
+
</div>
|
|
16
|
+
|
|
17
|
+
<div class="col-md-6 col-xs-12">
|
|
18
|
+
<%= theme_form_field(@user, :phone, required: false) %>
|
|
19
|
+
<% if @user.new_record? %>
|
|
20
|
+
<%= theme_form_field(@user, :password, required: true, html_options: {type: :password}) %>
|
|
21
|
+
<%= theme_form_field(@user, :password_confirmation, required: true, html_options: {type: :password}, label: "Retype Password") %>
|
|
22
|
+
<% end %>
|
|
23
|
+
</div>
|
|
24
|
+
</div>
|
|
25
|
+
|
|
26
|
+
</div>
|
|
27
|
+
|
|
28
|
+
<div>
|
|
29
|
+
<%= link_to raw("<i class='fa fa-close mr-5'></i><span>Cancel</span>"), "#", onclick: "closeLargeModal();", class: "pull-left btn btn-white" %>
|
|
30
|
+
<%= submit_tag("Save", :class=>"btn btn-secondary pull-right") %>
|
|
31
|
+
</div>
|
|
32
|
+
<%= clear_tag(10) %>
|
|
33
|
+
</div>
|
|
34
|
+
|
|
35
|
+
<% end %>
|
|
36
|
+
|
|
@@ -0,0 +1,120 @@
|
|
|
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 class="hidden-xs hidden-sm">Username</th>
|
|
8
|
+
<th class="hidden-xs hidden-sm">Email</th>
|
|
9
|
+
<% if @current_user.is_super_admin? %>
|
|
10
|
+
<th class="hidden-xs hidden-sm">Role</th>
|
|
11
|
+
<% end %>
|
|
12
|
+
<th>Status</th>
|
|
13
|
+
<th style="text-align: center;" colspan="2">Actions</th>
|
|
14
|
+
</tr>
|
|
15
|
+
</thead>
|
|
16
|
+
<tbody>
|
|
17
|
+
<% @users.each_with_index do |user, i| %>
|
|
18
|
+
|
|
19
|
+
<% edit_link = edit_admin_user_path(id: user.id) %>
|
|
20
|
+
<% delete_link = admin_user_path(id: user.id) %>
|
|
21
|
+
|
|
22
|
+
<tr id="tr_user_<%= user.id %>">
|
|
23
|
+
|
|
24
|
+
<!-- <td class="user-cb">
|
|
25
|
+
<input type="checkbox" class="cbr" name="users[]" value="1" checked />
|
|
26
|
+
</td> -->
|
|
27
|
+
|
|
28
|
+
<!-- <th scope="row" style="text-align: center;">
|
|
29
|
+
<%# if i < 0 %>
|
|
30
|
+
<i class="fa fa-check text-success"></i>
|
|
31
|
+
<%# else %>
|
|
32
|
+
<%#= i + 1 + (@per_page.to_i * (@current_page.to_i - 1)) %>
|
|
33
|
+
<%# end %>
|
|
34
|
+
</th> -->
|
|
35
|
+
|
|
36
|
+
<td class="user-image">
|
|
37
|
+
<a href="#">
|
|
38
|
+
<%= display_image(user, "profile_picture.image.small.url", width: "32", height: "auto", class: "img-circle", alt: user.display_name) %>
|
|
39
|
+
</a>
|
|
40
|
+
</td>
|
|
41
|
+
|
|
42
|
+
<td class="user-name"><%= link_to user.name, admin_user_path(user), remote: true %></td>
|
|
43
|
+
|
|
44
|
+
<td class="hidden-xs hidden-sm"><%= link_to user.username, "#" %></td>
|
|
45
|
+
|
|
46
|
+
<td class="hidden-xs hidden-sm"><%= link_to user.email, "#", class: "email" %></td>
|
|
47
|
+
|
|
48
|
+
<% if @current_user.is_super_admin? %>
|
|
49
|
+
<td class="hidden-xs hidden-sm">
|
|
50
|
+
<% if user.super_admin %>
|
|
51
|
+
<span class="mr-10 mt-5 label label-warning">Super Admin</span>
|
|
52
|
+
<% else %>
|
|
53
|
+
<span class="mr-10 mt-5 label label-default">Normal</span>
|
|
54
|
+
<% end %>
|
|
55
|
+
</td>
|
|
56
|
+
<% end %>
|
|
57
|
+
|
|
58
|
+
<td>
|
|
59
|
+
<% if user.pending? %>
|
|
60
|
+
<span class="ml-5 mt-5 label label-default">Pending</span>
|
|
61
|
+
<% elsif user.approved? %>
|
|
62
|
+
<span class="ml-5 mt-5 label label-success">Approved</span>
|
|
63
|
+
<% elsif user.suspended? %>
|
|
64
|
+
<span class="ml-5 mt-5 label label-danger">Suspended</span>
|
|
65
|
+
<% end %>
|
|
66
|
+
</td>
|
|
67
|
+
|
|
68
|
+
<td class="action-links" style="width:15%">
|
|
69
|
+
|
|
70
|
+
<%= link_to raw("<i class=\"linecons-pencil\"></i> Edit User"), edit_link, :remote=>true, class: "edit" %>
|
|
71
|
+
|
|
72
|
+
<%= link_to raw("<i class=\"linecons-trash\"></i> Delete"), delete_link, method: :delete, role: "menuitem", tabindex: "-1", data: { confirm: 'Are you sure?' }, :remote=>true, class: "delete" if @current_user != user %>
|
|
73
|
+
|
|
74
|
+
<% if @current_user.super_admin? %>
|
|
75
|
+
<%= link_to raw("<i class=\"linecons-paper-plane\"></i> Masquerade"), masquerade_admin_user_path(user), method: :put, data: { confirm: "Are you sure? Do you really want to logout current session and login as #{user.name}?" } %>
|
|
76
|
+
<% end %>
|
|
77
|
+
|
|
78
|
+
</td>
|
|
79
|
+
|
|
80
|
+
<td class="action-links" style="width:15%">
|
|
81
|
+
|
|
82
|
+
<% if @current_user.super_admin? %>
|
|
83
|
+
<% if user.super_admin? %>
|
|
84
|
+
<!-- Remove Super Admin -->
|
|
85
|
+
<%= link_to raw("<i class=\"fa fa-remove mr-5\"></i> Remove Super Admin"), remove_super_admin_admin_user_path(id: user.id), method: :put, :remote=>true, role: "menuitem", tabindex: "-1" %>
|
|
86
|
+
<% else %>
|
|
87
|
+
<!-- Make Super Admin -->
|
|
88
|
+
<%= link_to raw("<i class=\"fa fa-plus-square mr-5\"></i> Make Super Admin"), make_super_admin_admin_user_path(id: user.id), method: :put, remote: true, role: "menuitem", tabindex: "-1" %>
|
|
89
|
+
<% end %>
|
|
90
|
+
<% end %>
|
|
91
|
+
|
|
92
|
+
<% case user.status %>
|
|
93
|
+
<% when "approved" %>
|
|
94
|
+
<!-- Pending -->
|
|
95
|
+
<%= link_to raw("<i class=\"fa fa-circle mr-5\"></i> Mark as Pending"), update_status_admin_user_path(:id =>user.id, :status =>'pending'), :method =>'PUT', :remote=>true, role: "menuitem", tabindex: "-1", :class=>"user_status" %>
|
|
96
|
+
|
|
97
|
+
<!-- Suspend -->
|
|
98
|
+
<%= link_to raw("<i class=\"fa fa-edit mr-5\"></i> Suspend"), update_status_admin_user_path(:id =>user.id, :status =>'suspended'), :method =>'PUT', :remote=>true, role: "menuitem", tabindex: "-1", :class=>"user_status" %>
|
|
99
|
+
<% when "pending" %>
|
|
100
|
+
<!-- Approve -->
|
|
101
|
+
<%= link_to raw("<i class=\"fa fa-circle-o mr-5\"></i> Approve"), update_status_admin_user_path(:id =>user.id, :status =>'approved'), :method =>'PUT', :remote=>true, role: "menuitem", tabindex: "-1", :class=>"user_status" %>
|
|
102
|
+
<% when "suspended" %>
|
|
103
|
+
<!-- Approve -->
|
|
104
|
+
<%= link_to raw("<i class=\"fa fa-circle-o mr-5\"></i> Approve"), update_status_admin_user_path(:id =>user.id, :status =>'approved'), :method =>'PUT', :remote=>true, role: "menuitem", tabindex: "-1",:class=>"user_status" %>
|
|
105
|
+
<% end %>
|
|
106
|
+
|
|
107
|
+
</td>
|
|
108
|
+
|
|
109
|
+
</tr>
|
|
110
|
+
<% end %>
|
|
111
|
+
</tbody>
|
|
112
|
+
</table>
|
|
113
|
+
</div>
|
|
114
|
+
|
|
115
|
+
<div class="row">
|
|
116
|
+
<div class="col-sm-12">
|
|
117
|
+
<%= paginate_kuppayam(@users) %>
|
|
118
|
+
</div>
|
|
119
|
+
</div>
|
|
120
|
+
|