ux(less): began less / bootstrap less cleanup and restructuring

This commit is contained in:
Torkel Ödegaard 2016-02-14 18:02:53 +01:00
parent e32ee9f02e
commit 5274f93db7
37 changed files with 13 additions and 819 deletions

View File

@ -1,24 +0,0 @@
define([
'angular',
],
function (angular) {
'use strict';
var module = angular.module('grafana.controllers');
module.controller('AdminSettingsCtrl', function($scope, backendSrv) {
$scope.init = function() {
$scope.getUsers();
};
$scope.getUsers = function() {
backendSrv.get('/api/admin/settings').then(function(settings) {
$scope.settings = settings;
});
};
$scope.init();
});
});

View File

@ -8,8 +8,6 @@
* Designed and built with all the love in the world by @mdo and @fat.
*/
// Core variables and mixins
@import "variables.less"; // Modify this for custom colors, font-sizes, etc
@import "mixins.less";
// CSS Reset

View File

@ -203,114 +203,3 @@
.border-radius(6px 0 6px 6px);
}
}
// Inverted navbar
// -------------------------
.navbar-inverse {
.navbar-inner {
#gradient > .vertical(@navbarInverseBackgroundHighlight, @navbarInverseBackground);
border-color: @navbarInverseBorder;
}
.brand,
.nav > li > a {
color: @navbarInverseLinkColor;
text-shadow: 0 -1px 0 rgba(0,0,0,.25);
&:hover,
&:focus {
color: @navbarInverseLinkColorHover;
}
}
.brand {
color: @navbarInverseBrandColor;
}
.navbar-text {
color: @navbarInverseText;
}
.nav > li > a:focus,
.nav > li > a:hover {
background-color: @navbarInverseLinkBackgroundHover;
color: @navbarInverseLinkColorHover;
}
.nav .active > a,
.nav .active > a:hover,
.nav .active > a:focus {
color: @navbarInverseLinkColorActive;
background-color: @navbarInverseLinkBackgroundActive;
}
// Inline text links
.navbar-link {
color: @navbarInverseLinkColor;
&:hover,
&:focus {
color: @navbarInverseLinkColorHover;
}
}
// Dividers in navbar
.divider-vertical {
border-left-color: @navbarInverseBackground;
border-right-color: @navbarInverseBackgroundHighlight;
}
// Dropdowns
.nav li.dropdown.open > .dropdown-toggle,
.nav li.dropdown.active > .dropdown-toggle,
.nav li.dropdown.open.active > .dropdown-toggle {
background-color: @navbarInverseLinkBackgroundActive;
color: @navbarInverseLinkColorActive;
}
.nav li.dropdown > a:hover .caret,
.nav li.dropdown > a:focus .caret {
border-top-color: @navbarInverseLinkColorActive;
border-bottom-color: @navbarInverseLinkColorActive;
}
.nav li.dropdown > .dropdown-toggle .caret {
border-top-color: @navbarInverseLinkColor;
border-bottom-color: @navbarInverseLinkColor;
}
.nav li.dropdown.open > .dropdown-toggle .caret,
.nav li.dropdown.active > .dropdown-toggle .caret,
.nav li.dropdown.open.active > .dropdown-toggle .caret {
border-top-color: @navbarInverseLinkColorActive;
border-bottom-color: @navbarInverseLinkColorActive;
}
// Navbar search
.navbar-search {
.search-query {
color: @white;
background-color: @navbarInverseSearchBackground;
border-color: @navbarInverseSearchBorder;
.box-shadow(~"inset 0 1px 2px rgba(0,0,0,.1), 0 1px 0 rgba(255,255,255,.15)");
.transition(none);
.placeholder(@navbarInverseSearchPlaceholderColor);
// Focus states (we use .focused since IE7-8 and down doesn't support :focus)
&:focus,
&.focused {
padding: 5px 15px;
color: @grayDark;
text-shadow: 0 1px 0 @white;
background-color: @navbarInverseSearchBackgroundFocus;
border: 0;
.box-shadow(0 0 3px rgba(0,0,0,.15));
outline: 0;
}
}
}
// Navbar collapse button
.btn-navbar {
.buttonBackground(darken(@navbarInverseBackgroundHighlight, 5%), darken(@navbarInverseBackground, 5%));
}
}

View File

@ -18,25 +18,10 @@
// -------------------------
// Required since we compile the responsive stuff separately
@import "variables.less"; // Modify this for custom colors, font-sizes, etc
@import "mixins.less";
// RESPONSIVE CLASSES
// ------------------
@import "responsive-utilities.less";
// MEDIA QUERIES
// ------------------
// Large desktops
@import "responsive-1200px-min.less";
// Tablets to regular desktops
@import "responsive-768px-979px.less";
// Phones to portrait tablets and narrow desktops
@import "responsive-767px-max.less";

View File

@ -5,26 +5,6 @@
// TYPOGRAPHY
// -----------------------------------------------------
label, input, button, select, textarea,
.navbar .search-query:-moz-placeholder,
.navbar .search-query::-webkit-input-placeholder {
font-family: 'Droid Sans', sans-serif;
color: @gray;
}
blockquote {
border-left: 5px solid @grayDark;
&.pull-right {
border-right: 5px solid @grayDark;
}
}
// SCAFFOLDING
// -----------------------------------------------------
html {
height: 100%;
}
@ -93,54 +73,9 @@ hr {
text-shadow: none;
.placeholder(@gray);
}
&-inverse {
}
}
div.subnav {
margin: 0 1px;
background-color: @grayDarker;
background-image: none;
border: none;
border-bottom: 1px solid @grayDark;
.nav > li > a,
.nav > li:first-child > a,
.nav > li:first-child > a:hover {
padding: 11px 12px;
border: none;
background-color: @grayDarker;
color: @grayLight;
}
.nav > li > a:hover,
.nav > li.active > a,
.nav > li.active > a:hover,
.nav > li:first-child > a:hover {
padding: 11px 12px;
background: transparent;
border: none;
border-bottom: 1px solid @blue;
color: @white;
}
.nav li.nav-header {
text-shadow: none;
}
&-fixed {
top: @navbarHeight;
margin: 0;
}
}
// NAV
// -----------------------------------------------------
@ -172,131 +107,13 @@ div.subnav {
}
}
.nav-pills {
li > a:hover {
background-color: @blue;
color: @white;
}
li.disabled > a {
color: @textColor;
}
.open .dropdown-toggle {
background-color: #060606;
}
.dropdown-menu li > a:hover {
border: none;
}
}
.nav-list {
li > a {
text-shadow: none;
}
li > a:hover {
background-color: @blue;
color: @white;
}
.nav-header {
text-shadow: none;
}
.divider {
background-color: transparent;
border-bottom: 1px solid @grayDark;
}
}
.nav-stacked {
li > a {
border: 1px solid @grayDark !important;
}
li > a:hover,
li.active > a {
background-color: @blue;
color: @white;
}
}
.tabbable {
.nav-tabs,
.nav-tabs li.active > a {
border-color: @grayDark;
}
}
.breadcrumb {
background-color: transparent;
background-image: none;
border-width: 0;
.box-shadow(none);
font-size: 14px;
li {
text-shadow: none;
}
li > a {
color: @blue;
text-shadow: none;
}
}
.pagination {
ul {
.box-shadow(none);
}
ul > li > a:hover,
ul > .active > a,
ul > .active > span {
// color: @white;
}
ul > .disabled > a,
ul > .disabled > a:hover,
ul > .disabled > span,
ul > .disabled > span:hover {
background-color: rgba(0, 0, 0, 0.2);
}
}
.pager {
li > a,
li > span {
background-color: @bodyBackground;
border: none;
&:hover {
background-color: @blue;
}
}
.disabled a,
.disabled a:hover {
background-color: @bodyBackground;
}
}
// BUTTONS
// -----------------------------------------------------
.btn {
padding: 8px 12px;
margin-right:10px;
background-image: none;
// .box-shadow(0px 0px 8px @bodyBackground);
border: none;
.border-radius(0px);
text-shadow: none;

View File

@ -87,64 +87,12 @@ a.text-success:hover { color: darken(@green, 10%); }
.navbar-search .search-query {
line-height: normal;
}
&-inverse {
.brand,
.nav > li > a {
text-shadow: none;
}
.brand:hover,
.nav > .active > a,
.nav > .active > a:hover,
.nav > .active > a:focus {
background-color: @navbarInverseLinkBackgroundHover;
.box-shadow(none);
color: @white;
}
.navbar-search .search-query {
color: @grayDarker;
}
}
}
div.subnav {
margin: 0 1px;
background: @grayLight none;
.box-shadow(none);
border: none;
.border-radius(0);
.nav {
background-color: transparent;
}
.nav > li > a {
border-color: transparent;
}
.nav > .active > a,
.nav > .active > a:hover {
border-color: transparent;
background-color: @black;
color: @white;
.box-shadow(none);
}
&-fixed {
top: @navbarHeight + 1;
margin: 0;
}
}
// NAV
// -----------------------------------------------------
.nav {
.open .dropdown-toggle,
& > li.dropdown.open.active > a:hover {
color: @blue;
@ -187,121 +135,6 @@ div.subnav {
}
}
.nav-pills {
& > li > a {
//background-color: @grayLight;
.border-radius(0);
color: @black;
&:hover {
background-color: @black;
color: @white;
}
}
& > .disabled > a,
& > .disabled > a:hover {
background-color: @grayLighter;
color: @grayDark;
}
}
.nav-list {
& > li > a {
color: @grayDarker;
&:hover {
background-color: @blue;
color: @white;
text-shadow: none;
}
}
.nav-header {
color: @grayDarker;
}
.divider {
background-color: @gray;
border-bottom: none;
}
}
.pagination {
ul {
.box-shadow(none);
& > li > a,
& > li > span {
margin-right: 6px;
color: @grayDarker;
&:hover {
background-color: @grayDarker;
color: @white;
}
}
& > li:last-child > a,
& > li:last-child > span {
margin-right: 0;
}
& > .active > a,
& > .active > span {
color: @white;
}
& > .disabled > span,
& > .disabled > a,
& > .disabled > a:hover {
background-color: @grayLighter;
color: @grayDark;
}
}
}
.pager {
li > a,
li > span {
background-color: @grayLight;
border: none;
.border-radius(0);
color: @grayDarker;
&:hover {
background-color: @grayDarker;
color: @white;
}
}
.disabled > a,
.disabled > a:hover,
.disabled > span {
background-color: @grayLighter;
color: @grayDark;
}
}
.breadcrumb {
background-color: @grayLight;
li {
text-shadow: none;
}
.divider,
.active {
color: @grayDarker;
text-shadow: none;
}
}
// BUTTONS
// -----------------------------------------------------
@ -319,9 +152,6 @@ div.subnav {
}
}
.btn-inverse {
}
.btn-large {
padding: 14px 23px;
}

View File

@ -1,4 +1,5 @@
@import "responsive.less";
@import "variables.dark.less";
@import "bootstrap/responsive.less";
@gridColumnWidth: 70px;
@gridGutterWidth: 10px;
@ -68,7 +69,7 @@
display: none;
}
.page-container {
padding: 0 20px;
padding: 10px 20px;
}
}
@ -92,7 +93,6 @@
.dashnav-action-icons {
display: none;
}
.dashnav-back-to-dashboard {
display: block;
}

View File

@ -1,5 +1,5 @@
@import "bootstrap.less";
@import "variables.dark.less";
@import "bootstrap/bootstrap.less";
@import "bootswatch.dark.less";
@import "overrides.less";
@import "variables.dark.less";
@import "grafana.less";
@import "grafana.less";

View File

@ -1,5 +1,5 @@
@import "bootstrap.less";
@import "variables.light.less";
@import "bootstrap/bootstrap.less";
@import "bootswatch.light.less";
@import "overrides.less";
@import "variables.light.less";
@import "grafana.less";
@import "grafana.less";

View File

@ -1,301 +0,0 @@
//
// Variables
// --------------------------------------------------
// Global values
// --------------------------------------------------
// Grays
// -------------------------
@black: #000;
@grayDarker: #222;
@grayDark: #333;
@gray: #555;
@grayLight: #999;
@grayLighter: #eee;
@white: #fff;
// Accent colors
// -------------------------
@blue: #049cdb;
@blueDark: #0064cd;
@green: #46a546;
@red: #9d261d;
@yellow: #ffc40d;
@orange: #f89406;
@pink: #c3325f;
@purple: #7a43b6;
// Scaffolding
// -------------------------
@bodyBackground: @white;
@textColor: @grayDark;
// Links
// -------------------------
@linkColor: #08c;
@linkColorHover: darken(@linkColor, 15%);
// Typography
// -------------------------
@sansFontFamily: "Helvetica Neue", Helvetica, Arial, sans-serif;
@serifFontFamily: Georgia, "Times New Roman", Times, serif;
@monoFontFamily: Monaco, Menlo, Consolas, "Courier New", monospace;
@baseFontSize: 14px;
@baseFontFamily: @sansFontFamily;
@baseLineHeight: 20px;
@altFontFamily: @serifFontFamily;
@headingsFontFamily: inherit; // empty to use BS default, @baseFontFamily
@headingsFontWeight: bold; // instead of browser default, bold
@headingsColor: inherit; // empty to use BS default, @textColor
// Component sizing
// -------------------------
// Based on 14px font-size and 20px line-height
@fontSizeLarge: @baseFontSize * 1.25; // ~18px
@fontSizeSmall: @baseFontSize * 0.85; // ~12px
@fontSizeMini: @baseFontSize * 0.75; // ~11px
@paddingLarge: 11px 19px; // 44px
@paddingSmall: 2px 10px; // 26px
@paddingMini: 0 6px; // 22px
@baseBorderRadius: 4px;
@borderRadiusLarge: 6px;
@borderRadiusSmall: 3px;
// Tables
// -------------------------
@tableBackground: transparent; // overall background-color
@tableBackgroundAccent: #f9f9f9; // for striping
@tableBackgroundHover: #f5f5f5; // for hover
@tableBorder: #ddd; // table and cell border
// Buttons
// -------------------------
@btnBackground: @white;
@btnBackgroundHighlight: darken(@white, 10%);
@btnBorder: #ccc;
@btnPrimaryBackground: @linkColor;
@btnPrimaryBackgroundHighlight: spin(@btnPrimaryBackground, 20%);
@btnInfoBackground: #5bc0de;
@btnInfoBackgroundHighlight: #2f96b4;
@btnSuccessBackground: #62c462;
@btnSuccessBackgroundHighlight: #51a351;
@btnWarningBackground: lighten(@orange, 15%);
@btnWarningBackgroundHighlight: @orange;
@btnDangerBackground: #ee5f5b;
@btnDangerBackgroundHighlight: #bd362f;
@btnInverseBackground: #444;
@btnInverseBackgroundHighlight: @grayDarker;
// Forms
// -------------------------
@inputBackground: @white;
@inputBorder: #ccc;
@inputBorderRadius: @baseBorderRadius;
@inputDisabledBackground: @grayLighter;
@formActionsBackground: #f5f5f5;
@inputHeight: @baseLineHeight + 10px; // base line-height + 8px vertical padding + 2px top/bottom border
// Dropdowns
// -------------------------
@dropdownBackground: @white;
@dropdownBorder: rgba(0,0,0,.2);
@dropdownDividerTop: #e5e5e5;
@dropdownDividerBottom: @white;
@dropdownLinkColor: @grayDark;
@dropdownLinkColorHover: @white;
@dropdownLinkColorActive: @white;
@dropdownLinkBackgroundActive: @linkColor;
@dropdownLinkBackgroundHover: @dropdownLinkBackgroundActive;
// COMPONENT VARIABLES
// --------------------------------------------------
// Z-index master list
// -------------------------
// Used for a bird's eye view of components dependent on the z-axis
// Try to avoid customizing these :)
@zindexDropdown: 1000;
@zindexPopover: 1010;
@zindexTooltip: 1030;
@zindexFixedNavbar: 1030;
@zindexModalBackdrop: 1040;
@zindexModal: 1050;
// Sprite icons path
// -------------------------
@iconSpritePath: "../img/glyphicons-halflings.png";
@iconWhiteSpritePath: "../img/glyphicons-halflings-white.png";
// Input placeholder text color
// -------------------------
@placeholderText: @grayLight;
// Hr border color
// -------------------------
@hrBorder: @grayLighter;
// Horizontal forms & lists
// -------------------------
@horizontalComponentOffset: 180px;
// Wells
// -------------------------
@wellBackground: #f5f5f5;
// Navbar
// -------------------------
@navbarCollapseWidth: 979px;
@navbarCollapseDesktopWidth: @navbarCollapseWidth + 1;
@navbarHeight: 40px;
@navbarBackgroundHighlight: #ffffff;
@navbarBackground: darken(@navbarBackgroundHighlight, 5%);
@navbarBorder: darken(@navbarBackground, 12%);
@navbarText: #777;
@navbarLinkColor: #777;
@navbarLinkColorHover: @grayDark;
@navbarLinkColorActive: @gray;
@navbarLinkBackgroundHover: transparent;
@navbarLinkBackgroundActive: darken(@navbarBackground, 5%);
@navbarBrandColor: @navbarLinkColor;
// Inverted navbar
@navbarInverseBackground: #111111;
@navbarInverseBackgroundHighlight: #222222;
@navbarInverseBorder: #252525;
@navbarInverseText: @grayLight;
@navbarInverseLinkColor: @grayLight;
@navbarInverseLinkColorHover: @white;
@navbarInverseLinkColorActive: @navbarInverseLinkColorHover;
@navbarInverseLinkBackgroundHover: transparent;
@navbarInverseLinkBackgroundActive: @navbarInverseBackground;
@navbarInverseSearchBackground: lighten(@navbarInverseBackground, 25%);
@navbarInverseSearchBackgroundFocus: @white;
@navbarInverseSearchBorder: @navbarInverseBackground;
@navbarInverseSearchPlaceholderColor: #ccc;
@navbarInverseBrandColor: @navbarInverseLinkColor;
// Pagination
// -------------------------
@paginationBackground: #fff;
@paginationBorder: #ddd;
@paginationActiveBackground: #f5f5f5;
// Hero unit
// -------------------------
@heroUnitBackground: @grayLighter;
@heroUnitHeadingColor: inherit;
@heroUnitLeadColor: inherit;
// Form states and alerts
// -------------------------
@warningText: #c09853;
@warningBackground: #fcf8e3;
@warningBorder: darken(spin(@warningBackground, -10), 3%);
@errorText: #b94a48;
@errorBackground: #f2dede;
@errorBorder: darken(spin(@errorBackground, -10), 3%);
@successText: #468847;
@successBackground: #dff0d8;
@successBorder: darken(spin(@successBackground, -10), 5%);
@infoText: #3a87ad;
@infoBackground: #d9edf7;
@infoBorder: darken(spin(@infoBackground, -10), 7%);
// Tooltips and popovers
// -------------------------
@tooltipColor: #fff;
@tooltipBackground: #000;
@tooltipArrowWidth: 5px;
@tooltipArrowColor: @tooltipBackground;
@popoverBackground: #fff;
@popoverArrowWidth: 10px;
@popoverArrowColor: #fff;
@popoverTitleBackground: darken(@popoverBackground, 3%);
// Special enhancement for popovers
@popoverArrowOuterWidth: @popoverArrowWidth + 1;
@popoverArrowOuterColor: rgba(0,0,0,.25);
// GRID
// --------------------------------------------------
// Default 940px grid
// -------------------------
@gridColumns: 12;
@gridColumnWidth: 60px;
@gridGutterWidth: 20px;
@gridRowWidth: (@gridColumns * @gridColumnWidth) + (@gridGutterWidth * (@gridColumns - 1));
// 1200px min
@gridColumnWidth1200: 70px;
@gridGutterWidth1200: 30px;
@gridRowWidth1200: (@gridColumns * @gridColumnWidth1200) + (@gridGutterWidth1200 * (@gridColumns - 1));
// 768px-979px
@gridColumnWidth768: 42px;
@gridGutterWidth768: 20px;
@gridRowWidth768: (@gridColumns * @gridColumnWidth768) + (@gridGutterWidth768 * (@gridColumns - 1));
// Fluid grid
// -------------------------
@fluidGridColumnWidth: percentage(@gridColumnWidth/@gridRowWidth);
@fluidGridGutterWidth: percentage(@gridGutterWidth/@gridRowWidth);
// 1200px min
@fluidGridColumnWidth1200: percentage(@gridColumnWidth1200/@gridRowWidth1200);
@fluidGridGutterWidth1200: percentage(@gridGutterWidth1200/@gridRowWidth1200);
// 768px-979px
@fluidGridColumnWidth768: percentage(@gridColumnWidth768/@gridRowWidth768);
@fluidGridGutterWidth768: percentage(@gridGutterWidth768/@gridRowWidth768);

View File

@ -3,12 +3,12 @@ module.exports = function(config) {
return {
src:{
options: {
paths: ["<%= srcDir %>/vendor/bootstrap/less", "<%= srcDir %>/less"],
paths: ["<%= srcDir %>/less"],
yuicompress: true
},
files: {
"<%= genDir %>/css/bootstrap.dark.min.css": "<%= srcDir %>/less/bootstrap.dark.less",
"<%= genDir %>/css/bootstrap.light.min.css": "<%= srcDir %>/less/bootstrap.light.less",
"<%= genDir %>/css/bootstrap.dark.min.css": "<%= srcDir %>/less/grafana.dark.less",
"<%= genDir %>/css/bootstrap.light.min.css": "<%= srcDir %>/less/grafana.light.less",
"<%= genDir %>/css/bootstrap-responsive.min.css": "<%= srcDir %>/less/grafana-responsive.less"
}
}