Skip to content

Commit

Permalink
KBP-118 #time 1.5d - Hq side design was done
Browse files Browse the repository at this point in the history
  • Loading branch information
hamdibayhan committed Dec 5, 2017
1 parent edcbf38 commit f9ef025
Show file tree
Hide file tree
Showing 63 changed files with 3,818 additions and 330 deletions.
2 changes: 1 addition & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,4 @@ Style/IndentHeredoc:
Naming/HeredocDelimiterNaming:
Exclude:
- 'spec/features/cli_help_spec.rb'
- 'spec/features/git_and_git_flow_spec.rb'
- 'spec/features/git_and_git_flow_spec.rb'
2 changes: 2 additions & 0 deletions lib/cybele/generators/app_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -266,11 +266,13 @@ def customize_app_files
return if @options[:skip_view_files]
say 'Customize app files', :green
build :customize_assets_files
build :customize_vendor_files
build :customize_helper_files
build :customize_view_files_with_option
build :generate_devise_views
build :configure_routes
build :customize_controller_files
build :add_devise_strong_parameter
build :add_devise_authenticate_admin
end

Expand Down
14 changes: 14 additions & 0 deletions lib/cybele/helpers/app_files/vendor_files.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# frozen_string_literal: true

module Cybele
module Helpers
module AppFiles
module VendorFiles
def customize_vendor_files
# View files with option
directory 'app_files/app/vendor', 'app/vendor'
end
end
end
end
end
3 changes: 3 additions & 0 deletions lib/cybele/helpers/app_files/view_gems.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ def add_required_view_gems

# Add fontawesome gem
append_file('Gemfile', template_content('app_files/fontawesome_Gemfile.erb'))

# Add jquery gem
append_file('Gemfile', template_content('app_files/jquery_Gemfile.erb'))
end
end
end
Expand Down
10 changes: 10 additions & 0 deletions lib/cybele/helpers/devise.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,16 @@ def add_devise_authenticate_admin
template_content('devise/devise_authenticate_admin.rb.erb'),
after: 'class Hq::ApplicationController < ApplicationController'
end

def add_devise_strong_parameter
inject_into_file 'app/controllers/application_controller.rb',
template_content('devise/devise_strong_parameter.rb.erb'),
after: 'protect_from_forgery with: :exception'

inject_into_file 'app/controllers/application_controller.rb',
template_content('devise/devise_before_action_strong_parameter.rb.erb'),
after: 'class ApplicationController < ActionController::Base'
end
end
end
end
2 changes: 2 additions & 0 deletions spec/features/new_default_project_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -239,12 +239,14 @@
it 'uses controller files' do
application_controller = content('app/controllers/application_controller.rb')
expect(application_controller).to match('class ApplicationController')
expect(application_controller).to match('configure_devise_permitted_parameters')

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

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

hq_audits_controller = content('app/controllers/hq/audits_controller.rb')
expect(hq_audits_controller).to match('class AuditsController')
Expand Down
85 changes: 83 additions & 2 deletions templates/app_files/app/assets/javascripts/hq/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,88 @@
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
// about supported directives.
//
//= require rails-ujs
//= require popper
//= require jquery
//= require jquery_ujs
//= require turbolinks
//= require bootstrap
//= require_tree .
//= require footable.min
//= require jquery.maskedinput.min
//= require trix
//= require jquery.datetimepicker
//= require nprogress

this.App = (function() {
function App() {}

App.ready = function() {
$('.changeable_select').on('change', function() {
var $hiden_area, values;
$hiden_area = $($('#hider-id').data('hiden-area'));
values = $('#hider-id').data('hiden-on').split(',');
if ($.inArray($(this).val(), values) !== -1) {
$hiden_area.addClass('hidden');
} else {
$hiden_area.removeClass('hidden');
}
});
};

return App;

})();

var ready = function(){
App.ready();

$('.table').footable();

$('.datetimepicker').datetimepicker({
format: $('.datetimepicker').data('format'),
step: 60,
lang: 'tr',
minDate: 0,
defaultTime: '12:00'
});

$(function () {
$('[data-toggle="tooltip"]').tooltip()
});

$("[data-mask]").each(function(index, element) {
var $element;
$element = $(element);
$element.mask($element.data('mask'));
});
$('form[data-turboform]').on('submit', function(e) {
Turbolinks.visit(this.action + (this.action.indexOf('?') === -1 ? '?' : '&') + $(this).serialize());
return false;
});
};

$(document).on('page:load', ready);

document.addEventListener("turbolinks:load", ready)

$(window).on('page:load', ready);

$(document).on('page:fetch', function() {
NProgress.start();
});

$(document).on('page:change', function() {
NProgress.done();
});

$(document).on('page:restore', function() {
NProgress.remove();
});

$(document).ajaxStart(function() {
NProgress.start();
});

$(document).ajaxComplete(function() {
NProgress.done();
});

92 changes: 92 additions & 0 deletions templates/app_files/app/assets/stylesheets/hq/_sidebar.css.sass
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
#sidebar
overflow: hidden
z-index: 3
.list-group
min-width: 400px
background-color: #343a40
min-height: 100vh
i
margin-right: 6px
.list-group-item
border-radius: 0
background-color: #343a40
color: #ccc
border-left: 0
border-right: 0
border-color: #2c2c2c
white-space: nowrap
&:not(.collapsed)
background-color: #222
.list-group
.list-group-item
padding: .75rem 1.25rem
&[aria-expanded="false"]::after
content: " \f0d7"
font-family: FontAwesome
display: inline
text-align: right
padding-left: 5px
&[aria-expanded="true"]
background-color: #222
&::after
content: " \f0da"
font-family: FontAwesome
display: inline
text-align: right
padding-left: 5px
.collapse .list-group-item, .collapsing .list-group-item
padding-left: 20px
.collapse >
.collapse .list-group-item, .collapsing .list-group-item
padding-left: 1.25rem
.collapse > .collapse .list-group-item
padding-left: 40px


@media (max-width: 768px)
#sidebar
min-width: 35px
max-width: 40px
overflow-y: auto
overflow-x: visible
transition: all 0.25s ease
transform: translateX(-45px)
position: fixed
&.show
transform: translateX(0)
&::-webkit-scrollbar
width: 0px
overflow: visible
.list-group
min-width: 40px
overflow: visible
.collapse.show, .collapsing
position: relative
z-index: 1
width: 190px
top: 0
> .list-group-item
text-align: center
padding: .75rem .75rem
&[aria-expanded="true"]::after, &[aria-expanded="false"]::after
display: none
/* overlay sub levels on small screens
/* hide caret icons of top level when collapsed
.collapse.show
visibility: visible

.collapsing
visibility: visible
height: 0
-webkit-transition-property: height, visibility
transition-property: height, visibility
-webkit-transition-timing-function: ease-out
transition-timing-function: ease-out
&.width
-webkit-transition-property: width, visibility
transition-property: width, visibility
width: 0
height: 100%
-webkit-transition-timing-function: ease-out
transition-timing-function: ease-out
35 changes: 35 additions & 0 deletions templates/app_files/app/assets/stylesheets/hq/application.css.sass
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,38 @@
*= require_self
@import "bootstrap"
@import "sidebar"
@import "footable.bootstrap.min"

body
main
@media (max-width: 767px)
margin-left: 2.45rem
.users
.active
color: green !important
.passive
background-color: rgba(230, 161, 161, 0.37) !important

.table
tbody
.action
a
margin: 0.5px

.filters
a
margin: 1px 1px
form
input
min-width: 115px

#toolbar
a
margin-bottom: 12px

#admin-devise-page
.card
margin-top: 70px
width: 30rem

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

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

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# frozen_string_literal: true

module Hq
class ApplicationController < ApplicationController
class ApplicationController < ::ApplicationController
before_action :authenticate_admin!
before_action :set_audit_user
layout 'hq/application'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

module Hq
class AuditsController < Hq::ApplicationController
class AuditsController < ApplicationController
add_breadcrumb I18n.t('activerecord.models.audits'), :hq_audits_path

def index
Expand Down
2 changes: 1 addition & 1 deletion templates/app_files/app/controllers/hq/users_controller.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

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

Expand Down
10 changes: 10 additions & 0 deletions templates/app_files/app/vendor/assets/javascripts/footable.min.js

Large diffs are not rendered by default.

Loading

0 comments on commit f9ef025

Please sign in to comment.