Skip to content

Commit

Permalink
refacto(assets): refactoring of application sass and js
Browse files Browse the repository at this point in the history
  • Loading branch information
mberlanda committed Feb 9, 2018
1 parent 4ba8329 commit 4d6e7b5
Show file tree
Hide file tree
Showing 11 changed files with 74 additions and 85 deletions.
18 changes: 17 additions & 1 deletion app/assets/javascripts/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,21 @@
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
// about supported directives.
//
//= require_tree .
//= require jquery/dist/jquery
//= require jquery-ujs/src/rails
//= require bootstrap/dist/js/bootstrap
//= require jquery-backstretch
//= require waypoints/lib/jquery.waypoints
//= require jquery-timepicker/jquery.timepicker
//= require bootstrap-datepicker/js/bootstrap-datepicker
//= require bootstrap-datepicker/dist/locales/bootstrap-datepicker.it.min
//= require bootstrap-datepicker/dist/locales/bootstrap-datepicker.it.min
//= require multiselect/js/jquery.multi-select
//= require wowjs/dist/wow
//= require retinajs/dist/retina
//= require intro.js/intro
//= require datatables.min
//= require crud_datatables
//= require cookies_eu
//= require topnav
//= require nicEdit
2 changes: 1 addition & 1 deletion app/assets/javascripts/crud_datatables.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function initializeCrudTable(url,tableId, buttonsIdOrClass){
initializeCrudTable = (url,tableId, buttonsIdOrClass) => {
var crudTable = $(tableId).DataTable({
'buttons': ['copy', 'excel', 'pdf'],
'processing': true,
Expand Down
26 changes: 0 additions & 26 deletions app/assets/javascripts/node_modules.js

This file was deleted.

28 changes: 14 additions & 14 deletions app/assets/javascripts/topnav.js.erb
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
$().ready(function() {
$().ready(() => {

/*
Navigation
*/
// toggle "navbar-no-bg" class
$('.top-content .text').waypoint(function() {
/* Navigation */
$('.top-content .text').waypoint(() => {
$('nav').toggleClass('navbar-no-bg');
});

/*
Background slideshow
*/
/* Background slideshow */
$('.top-content').backstretch("<%= asset_path('background.jpg') %>");

$('#top-navbar-1').on('shown.bs.collapse', function(){
$('#top-navbar-1').on('shown.bs.collapse', () => {
$('.top-content').backstretch("resize");
});
$('#top-navbar-1').on('hidden.bs.collapse', function(){
$('#top-navbar-1').on('hidden.bs.collapse', () => {
$('.top-content').backstretch("resize");
});

/*
Wow
*/
/* Dropdowns */
$('.dropdown-toggle').dropdown();

/* Wow */
new WOW().init();

/* Placeholders */
$('input[type="text"], input[type="password"], textarea').each(() => {
$(this).val( $(this).attr('placeholder') );
});
});
23 changes: 23 additions & 0 deletions app/assets/stylesheets/application.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* This is a manifest file that'll be compiled into node_modules.css, which will include all the files
* listed below.
*
*/


@import 'sass_bootstrap';
@import 'sass_fontawesome';
@import 'sass_multiselect';

@import 'wowjs/css/libs/animate';
@import 'jquery-timepicker/jquery.timepicker';
@import 'bootstrap-datepicker/dist/css/bootstrap-datepicker.min';
@import 'intro.js/introjs';
@import 'intro.js/themes/introjs-modern';
@import 'css/datatables';
@import 'cookies_eu';

@import 'style';
@import 'navbar_styles';
@import 'share_buttons';
@import 'custom_style';
File renamed without changes.
39 changes: 0 additions & 39 deletions app/assets/stylesheets/node_modules.scss

This file was deleted.

11 changes: 11 additions & 0 deletions app/assets/stylesheets/sass_bootstrap.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
$bs-font-path: 'bootstrap/fonts';
@import 'bootstrap/dist/css/bootstrap.min';
@font-face {
font-family: 'Glyphicons Halflings';
src: asset-url('#{$bs-font-path}/glyphicons-halflings-regular.eot');
src: asset-url('#{$bs-font-path}/glyphicons-halflings-regular.eot?#iefix') format('embedded-opentype'),
asset-url('#{$bs-font-path}/glyphicons-halflings-regular.woff2') format('woff2'),
asset-url('#{$bs-font-path}/glyphicons-halflings-regular.woff') format('woff'),
asset-url('#{$bs-font-path}/glyphicons-halflings-regular.ttf') format('truetype'),
asset-url('#{$bs-font-path}/glyphicons-halflings-regular.svg#glyphicons_halflingsregular') format('svg');
};
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
$fa-font-path: "font-awesome/fonts";

@import 'font-awesome/scss/font-awesome';

@font-face {
font-family: 'FontAwesome';
src: asset-url('#{$fa-font-path}/fontawesome-webfont.eot');
Expand Down
6 changes: 6 additions & 0 deletions app/assets/stylesheets/sass_multiselect.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
$ms-img-path: 'multiselect/js/img';
@import 'multiselect/css/multi-select';
.ms-container{
background: transparent asset-url('#{$ms-img-path}/switch.png') no-repeat 50% 50%;
width: 370px;
}
4 changes: 2 additions & 2 deletions app/views/layouts/application.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
= render partial: 'layouts/metadata'

%link{ href: 'https://fonts.googleapis.com/css?family=Josefin+Sans:300,400|Roboto:300,400,500', rel: 'stylesheet' }/
= stylesheet_link_tag 'node_modules.css'
= stylesheet_link_tag 'application.css'

/ = stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true
/ = javascript_include_tag 'application', 'data-turbolinks-track' => true
Expand All @@ -14,7 +14,7 @@
= javascript_include_tag 'https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js'
= javascript_include_tag 'https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js'

= javascript_include_tag 'node_modules.js'
= javascript_include_tag 'application.js'

%link{ href: asset_path('favicon.ico'), rel: 'shortcut icon', type: 'image/x-icon' }/

Expand Down

0 comments on commit 4d6e7b5

Please sign in to comment.