Skip to content

Commit f9ef025

Browse files
author
hamdibayhan
committed
KBP-118 #time 1.5d - Hq side design was done
1 parent edcbf38 commit f9ef025

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+3818
-330
lines changed

.rubocop.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,4 @@ Style/IndentHeredoc:
4646
Naming/HeredocDelimiterNaming:
4747
Exclude:
4848
- 'spec/features/cli_help_spec.rb'
49-
- 'spec/features/git_and_git_flow_spec.rb'
49+
- 'spec/features/git_and_git_flow_spec.rb'

lib/cybele/generators/app_generator.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,11 +266,13 @@ def customize_app_files
266266
return if @options[:skip_view_files]
267267
say 'Customize app files', :green
268268
build :customize_assets_files
269+
build :customize_vendor_files
269270
build :customize_helper_files
270271
build :customize_view_files_with_option
271272
build :generate_devise_views
272273
build :configure_routes
273274
build :customize_controller_files
275+
build :add_devise_strong_parameter
274276
build :add_devise_authenticate_admin
275277
end
276278

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# frozen_string_literal: true
2+
3+
module Cybele
4+
module Helpers
5+
module AppFiles
6+
module VendorFiles
7+
def customize_vendor_files
8+
# View files with option
9+
directory 'app_files/app/vendor', 'app/vendor'
10+
end
11+
end
12+
end
13+
end
14+
end

lib/cybele/helpers/app_files/view_gems.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ def add_required_view_gems
1616

1717
# Add fontawesome gem
1818
append_file('Gemfile', template_content('app_files/fontawesome_Gemfile.erb'))
19+
20+
# Add jquery gem
21+
append_file('Gemfile', template_content('app_files/jquery_Gemfile.erb'))
1922
end
2023
end
2124
end

lib/cybele/helpers/devise.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,16 @@ def add_devise_authenticate_admin
2929
template_content('devise/devise_authenticate_admin.rb.erb'),
3030
after: 'class Hq::ApplicationController < ApplicationController'
3131
end
32+
33+
def add_devise_strong_parameter
34+
inject_into_file 'app/controllers/application_controller.rb',
35+
template_content('devise/devise_strong_parameter.rb.erb'),
36+
after: 'protect_from_forgery with: :exception'
37+
38+
inject_into_file 'app/controllers/application_controller.rb',
39+
template_content('devise/devise_before_action_strong_parameter.rb.erb'),
40+
after: 'class ApplicationController < ActionController::Base'
41+
end
3242
end
3343
end
3444
end

spec/features/new_default_project_spec.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,12 +239,14 @@
239239
it 'uses controller files' do
240240
application_controller = content('app/controllers/application_controller.rb')
241241
expect(application_controller).to match('class ApplicationController')
242+
expect(application_controller).to match('configure_devise_permitted_parameters')
242243

243244
hq_admins_controller = content('app/controllers/hq/admins_controller.rb')
244245
expect(hq_admins_controller).to match('class AdminsController')
245246

246247
hq_application_controller = content('app/controllers/hq/application_controller.rb')
247248
expect(hq_application_controller).to match('class ApplicationController')
249+
expect(hq_application_controller).to match('before_action :authenticate_admin!')
248250

249251
hq_audits_controller = content('app/controllers/hq/audits_controller.rb')
250252
expect(hq_audits_controller).to match('class AuditsController')

templates/app_files/app/assets/javascripts/hq/application.js

Lines changed: 83 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,88 @@
1010
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
1111
// about supported directives.
1212
//
13-
//= require rails-ujs
13+
//= require popper
14+
//= require jquery
15+
//= require jquery_ujs
1416
//= require turbolinks
1517
//= require bootstrap
16-
//= require_tree .
18+
//= require footable.min
19+
//= require jquery.maskedinput.min
20+
//= require trix
21+
//= require jquery.datetimepicker
22+
//= require nprogress
23+
24+
this.App = (function() {
25+
function App() {}
26+
27+
App.ready = function() {
28+
$('.changeable_select').on('change', function() {
29+
var $hiden_area, values;
30+
$hiden_area = $($('#hider-id').data('hiden-area'));
31+
values = $('#hider-id').data('hiden-on').split(',');
32+
if ($.inArray($(this).val(), values) !== -1) {
33+
$hiden_area.addClass('hidden');
34+
} else {
35+
$hiden_area.removeClass('hidden');
36+
}
37+
});
38+
};
39+
40+
return App;
41+
42+
})();
43+
44+
var ready = function(){
45+
App.ready();
46+
47+
$('.table').footable();
48+
49+
$('.datetimepicker').datetimepicker({
50+
format: $('.datetimepicker').data('format'),
51+
step: 60,
52+
lang: 'tr',
53+
minDate: 0,
54+
defaultTime: '12:00'
55+
});
56+
57+
$(function () {
58+
$('[data-toggle="tooltip"]').tooltip()
59+
});
60+
61+
$("[data-mask]").each(function(index, element) {
62+
var $element;
63+
$element = $(element);
64+
$element.mask($element.data('mask'));
65+
});
66+
$('form[data-turboform]').on('submit', function(e) {
67+
Turbolinks.visit(this.action + (this.action.indexOf('?') === -1 ? '?' : '&') + $(this).serialize());
68+
return false;
69+
});
70+
};
71+
72+
$(document).on('page:load', ready);
73+
74+
document.addEventListener("turbolinks:load", ready)
75+
76+
$(window).on('page:load', ready);
77+
78+
$(document).on('page:fetch', function() {
79+
NProgress.start();
80+
});
81+
82+
$(document).on('page:change', function() {
83+
NProgress.done();
84+
});
85+
86+
$(document).on('page:restore', function() {
87+
NProgress.remove();
88+
});
89+
90+
$(document).ajaxStart(function() {
91+
NProgress.start();
92+
});
93+
94+
$(document).ajaxComplete(function() {
95+
NProgress.done();
96+
});
97+
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
#sidebar
2+
overflow: hidden
3+
z-index: 3
4+
.list-group
5+
min-width: 400px
6+
background-color: #343a40
7+
min-height: 100vh
8+
i
9+
margin-right: 6px
10+
.list-group-item
11+
border-radius: 0
12+
background-color: #343a40
13+
color: #ccc
14+
border-left: 0
15+
border-right: 0
16+
border-color: #2c2c2c
17+
white-space: nowrap
18+
&:not(.collapsed)
19+
background-color: #222
20+
.list-group
21+
.list-group-item
22+
padding: .75rem 1.25rem
23+
&[aria-expanded="false"]::after
24+
content: " \f0d7"
25+
font-family: FontAwesome
26+
display: inline
27+
text-align: right
28+
padding-left: 5px
29+
&[aria-expanded="true"]
30+
background-color: #222
31+
&::after
32+
content: " \f0da"
33+
font-family: FontAwesome
34+
display: inline
35+
text-align: right
36+
padding-left: 5px
37+
.collapse .list-group-item, .collapsing .list-group-item
38+
padding-left: 20px
39+
.collapse >
40+
.collapse .list-group-item, .collapsing .list-group-item
41+
padding-left: 1.25rem
42+
.collapse > .collapse .list-group-item
43+
padding-left: 40px
44+
45+
46+
@media (max-width: 768px)
47+
#sidebar
48+
min-width: 35px
49+
max-width: 40px
50+
overflow-y: auto
51+
overflow-x: visible
52+
transition: all 0.25s ease
53+
transform: translateX(-45px)
54+
position: fixed
55+
&.show
56+
transform: translateX(0)
57+
&::-webkit-scrollbar
58+
width: 0px
59+
overflow: visible
60+
.list-group
61+
min-width: 40px
62+
overflow: visible
63+
.collapse.show, .collapsing
64+
position: relative
65+
z-index: 1
66+
width: 190px
67+
top: 0
68+
> .list-group-item
69+
text-align: center
70+
padding: .75rem .75rem
71+
&[aria-expanded="true"]::after, &[aria-expanded="false"]::after
72+
display: none
73+
/* overlay sub levels on small screens
74+
/* hide caret icons of top level when collapsed
75+
76+
.collapse.show
77+
visibility: visible
78+
79+
.collapsing
80+
visibility: visible
81+
height: 0
82+
-webkit-transition-property: height, visibility
83+
transition-property: height, visibility
84+
-webkit-transition-timing-function: ease-out
85+
transition-timing-function: ease-out
86+
&.width
87+
-webkit-transition-property: width, visibility
88+
transition-property: width, visibility
89+
width: 0
90+
height: 100%
91+
-webkit-transition-timing-function: ease-out
92+
transition-timing-function: ease-out

templates/app_files/app/assets/stylesheets/hq/application.css.sass

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,38 @@
1111
*= require_self
1212
1313
@import "bootstrap"
14+
@import "sidebar"
15+
@import "footable.bootstrap.min"
16+
17+
body
18+
main
19+
@media (max-width: 767px)
20+
margin-left: 2.45rem
21+
.users
22+
.active
23+
color: green !important
24+
.passive
25+
background-color: rgba(230, 161, 161, 0.37) !important
26+
27+
.table
28+
tbody
29+
.action
30+
a
31+
margin: 0.5px
32+
33+
.filters
34+
a
35+
margin: 1px 1px
36+
form
37+
input
38+
min-width: 115px
39+
40+
#toolbar
41+
a
42+
margin-bottom: 12px
43+
44+
#admin-devise-page
45+
.card
46+
margin-top: 70px
47+
width: 30rem
48+

templates/app_files/app/controllers/hq/admins_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# frozen_string_literal: true
22

33
module Hq
4-
class AdminsController < Hq::ApplicationController
4+
class AdminsController < ApplicationController
55
before_action :set_admin, only: %i[show edit update destroy toggle_is_active]
66
add_breadcrumb I18n.t('activerecord.models.admins'), :hq_admins_path
77

templates/app_files/app/controllers/hq/application_controller.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# frozen_string_literal: true
22

33
module Hq
4-
class ApplicationController < ApplicationController
4+
class ApplicationController < ::ApplicationController
5+
before_action :authenticate_admin!
56
before_action :set_audit_user
67
layout 'hq/application'
78

templates/app_files/app/controllers/hq/audits_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# frozen_string_literal: true
22

33
module Hq
4-
class AuditsController < Hq::ApplicationController
4+
class AuditsController < ApplicationController
55
add_breadcrumb I18n.t('activerecord.models.audits'), :hq_audits_path
66

77
def index

templates/app_files/app/controllers/hq/users_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# frozen_string_literal: true
22

33
module Hq
4-
class UsersController < Hq::ApplicationController
4+
class UsersController < ApplicationController
55
before_action :set_user, only: %i[show edit update destroy toggle_is_active]
66
add_breadcrumb I18n.t('activerecord.models.users'), :hq_users_path
77

templates/app_files/app/vendor/assets/javascripts/footable.min.js

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)