Commit 57467599 authored by Ad Schellevis's avatar Ad Schellevis

* added public http directory for new mvc framework including css / js parts.

* initial implementation for base\menusystem.
* copied in some of the template parts from the legacy system after cleanup html code.
parent 9a73dd21
<!DOCTYPE html>
<html>
<head>
<title>Phalcon PHP Framework</title>
</head>
<body>
<?php echo $this->getContent(); ?>
</body>
</html>
<h1>Congratulations!</h1>
<p>You're now flying with Phalcon. Great things are about to happen!</p>
......@@ -49,7 +49,6 @@ class ControllerBase extends Controller
return new NativeArray(array(
"content" => $messages
));
}
/**
......@@ -67,11 +66,18 @@ class ControllerBase extends Controller
public function beforeExecuteRoute($dispatcher)
{
// use authentication of legacy OPNsense.
if ($this->session->has("Logged_In") == false) {
if ($this->session->has("Username") == false) {
$this->response->redirect("/", true);
}
// Execute before every found action
$this->view->setVar('lang', $this->getTranslator());
// link menu system to view, append /ui in uri because of rewrite
$menu = new Menu\MenuSystem();
$this->view->menuSystem = $menu->getItems("/ui".$this->router->getRewriteUri());
// prevent session lock
session_write_close();
}
/**
......
<menu>
<!-- Core menu system including legacy stuff -->
<System order="0" VisibleName="System" cssClass="glyphicon glyphicon-dashboard">
<Advanced url="/ui/test.php"/>
<CertManager/>
<Firmware/>
<GeneralSetup/>
<HighAvailSync/>
<Routing/>
<SetupWizard/>
<UserManager/>
</System>
<Interfaces order="1" cssClass="glyphicon glyphicon-wrench">
<WAN/>
<new/>
</Interfaces>
</menu>
\ No newline at end of file
<?php
/**
* Copyright (C) 2015 Deciso B.V.
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
* OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
namespace OPNsense\Base\Menu;
class MenuInitException extends \Exception
{
}
<?php
/**
* Copyright (C) 2015 Deciso B.V.
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
* OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
namespace OPNsense\Base\Menu;
/**
* Class MenuItem
* @package OPNsense\Core\Menu
*/
class MenuItem
{
/**
* named array of child items
* @var array
*/
private $children = array();
/**
* this items id (xml tag name)
* @var item|string
*/
private $id = "";
/**
* visible name, default same as id
* @var null|item
*/
private $visibleName = null;
/**
* sort order in the menu list
* @var int
*/
private $sortOrder = 0;
/**
* layout information, glyphicon
* @var string
*/
private $CssClass = "";
/**
* link to url location
* @var string
*/
private $Url = "";
/**
* parent node, used to mark active nodes
* @var null|MenuItem
*/
private $parent = null ;
/**
* is this node or any of the child nodes selected
* @var bool
*/
private $selected = false;
/**
* Find setter for property, ignore case
* @param string $name property name
* @return null|string method name
*/
private function getXmlPropertySetterName($name)
{
$class_methods = get_class_methods($this);
foreach ($class_methods as $method_name) {
if ("set".strtolower($name) == strtolower($method_name)) {
return $method_name;
}
}
return null;
}
/**
* construct new menu item
* @param string $id item id / tag name from xml
* @param null|MenuItem $parent parent node
*/
public function __construct($id, $parent = null)
{
$this->id = $id;
$this->visibleName = $id;
$this->parent = $parent;
}
/**
* getter for id field
* @return item|string
*/
public function getId()
{
return $this->id ;
}
/**
* set sort order
* @param $value order number
*/
public function setOrder($value)
{
$this->sortOrder = $value;
}
/**
* get sort order
* @return int
*/
public function getOrder()
{
return $this->sortOrder;
}
/**
* setter for visiblename field
* @param $value
*/
public function setVisibleName($value)
{
$this->visibleName = $value;
}
/**
* getter for visiblename field
* @return null|item
*/
public function getVisibleName()
{
return $this->visibleName;
}
/**
* setter for cssclass field
* @param $value
*/
public function setCssClass($value)
{
$this->CssClass = $value ;
}
/**
* getter for cssclass
* @return string
*/
public function getCssClass()
{
return $this->CssClass;
}
/**
* setter for url field
* @param $value
*/
public function setUrl($value)
{
$this->Url = $value;
}
/**
* getter for url field
* @return string
*/
public function getUrl()
{
return $this->Url;
}
/**
* @return bool is this item selected
*/
public function getSelected()
{
return $this->selected;
}
/**
* append node, reuses existing node if it's already there.
* @param $id item id
* @param array $properties named array property list, there should be setters for every option
* @return MenuItem
*/
public function append($id, $properties = array())
{
// items should be unique by id, search children for given id first
$newMenuItem = null;
$isNew = false;
foreach ($this->children as $nodeKey => $node) {
if ($node->getId() == $id) {
$newMenuItem = $node ;
}
}
if ($newMenuItem == null) {
// create new menu item
$newMenuItem = new MenuItem($id, $this);
$isNew = true;
}
// set attributes
foreach ($properties as $propname => $propvalue) {
$methodName = $newMenuItem->getXmlPropertySetterName($propname);
if ($methodName != null) {
$newMenuItem->$methodName((string)$propvalue);
}
}
if ($isNew) {
// new item, add to child list
$orderNum = sprintf("%05d", $newMenuItem->getOrder());
$this->children[$orderNum."_".$newMenuItem->id] = $newMenuItem;
}
return $newMenuItem;
}
/**
* add simple xml node
* @param $xmlNode
*/
public function addXmlNode($xmlNode)
{
// copy properties from xml node attributes
$properties = array();
foreach ($xmlNode->attributes() as $attrKey => $attrValue) {
$properties[$attrKey] = (string)$attrValue;
}
// add to this node
$newMenuItem = $this->append($xmlNode->getName(), $properties);
// when there are child nodes, add them to the new menu item
if ($xmlNode->count() >0) {
foreach ($xmlNode as $key => $node) {
$newMenuItem->addXmlNode($node);
}
}
}
/**
* set node and all subnodes selected
*/
public function select()
{
$this->selected = true ;
if ($this->parent != null) {
$this->parent->select();
}
}
/**
* set url and all it's parents selected
* @param string $url target url
*/
public function toggleSelected($url)
{
$this->selected = false ;
foreach ($this->children as $nodeId => $node) {
$node->toggleSelected($url);
if ($node->getUrl() != "") {
if (strlen($url) >= strlen($node->getUrl()) && $node->getUrl() == substr($url, strlen($url)-strlen($node->getUrl()))) {
$node->select();
}
}
}
}
/**
* Recursive method to retrieve a simple ordered structure of all menu items
* @return array named array containing menu items as simple objects to keep the api cleaner for our templates
*/
public function getChildren()
{
$result = array();
$properties = array();
// probe this object for available setters, so we know what to publish to the outside world.
$prop_exclude_list = array("getXmlPropertySetterName");
$class_methods = get_class_methods($this);
foreach ($class_methods as $method_name) {
if (substr($method_name, 0, 3) == "get" && in_array($method_name, $prop_exclude_list) == false) {
$properties[$method_name] = substr($method_name, 3);
}
}
// sort by order/id and map getters to array items
ksort($this->children);
foreach ($this->children as $key => $node) {
$result[$node->id] = new \stdClass();
foreach ($properties as $methodName => $propName) {
$result[$node->id]->{$propName} = $node->$methodName();
}
}
return $result;
}
}
<?php
/**
* Copyright (C) 2015 Deciso B.V.
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
* OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
namespace OPNsense\Base\Menu;
class MenuSystem
{
private $root = null ;
/**
* add menu structure to root
* @param string $filename menu xml filename
* @throws MenuInitException unloadable menu xml
*/
private function addXML($filename)
{
// load and validate menu xml
if (!file_exists($filename)) {
throw new MenuInitException('Menu xml '.$filename.' missing') ;
}
$menuXml = simplexml_load_file($filename);
if ($menuXml === false) {
throw new MenuInitException('Menu xml '.$filename.' not valid') ;
}
if ($menuXml->getName() != "menu") {
throw new MenuInitException('Menu xml '.$filename.' seems to be of wrong type') ;
}
// traverse items
foreach ($menuXml as $key => $node) {
$this->root->addXmlNode($node);
}
}
/**
* construct a new menu
* @throws MenuInitException
*/
public function __construct()
{
$this->root = new MenuItem("root");
$this->addXML(__DIR__."/Menu.xml");
}
/**
* return full menu system including selected items
* @param string $url current location
* @return array
*/
public function getItems($url)
{
$this->root->toggleSelected($url);
$menu = $this->root->getChildren();
return $menu;
}
}
......@@ -9,10 +9,7 @@ A simple input form for the "sample" model can be found <a href="page/">here </
To perform a call to the api, press this button : <br/>
fill in a message : <input type="text" value="" id="msg"> </br>
<input type="button" id="restcall" value="do REST call!"/>
<button class="btn btn-default" id="restcall" type="button">do REST call!</button>
<br/>
API call result : <div id="msgid"></div>
......
<aside id="navigation" class="page-side col-xs-12 col-sm-2 hidden-xs">
<div class="row">
<nav class="page-side-nav" role="navigation">
<div class="list-group" id="mainmenu">
{% for topMenuItem in menuSystem %}
<a href="#{{ topMenuItem.Id }}" class="list-group-item " data-toggle="collapse" data-parent="#mainmenu"><span class="{{ topMenuItem.CssClass }} __iconspacer"></span>{{ topMenuItem.VisibleName }}</a>
<div class="collapse {% if topMenuItem.Selected %} active-menu in {% endif %}" id="{{ topMenuItem.Id }}">
{% for subMenuItem in topMenuItem.Children %}
<a href="{{ subMenuItem.Url }}" class="list-group-item {% if subMenuItem.Selected %} active {% endif %}">{{ subMenuItem.VisibleName }}</a>
{% endfor %}
</div>
{% endfor %}
</div>
</nav>
</div>
</aside>
<!DOCTYPE html>
<html>
<!doctype html>
<!--[if IE 8 ]><html lang="en-US" class="ie ie8 lte9 lte8 no-js"><![endif]-->
<!--[if IE 9 ]><html lang="en-US" class="ie ie9 lte9 no-js"><![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--><html lang="en-US" class="no-js"><!--<![endif]-->
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="robots" content="index, follow, noodp, noydir" />
<meta name="keywords" content="" />
<meta name="description" content="" />
<meta name="copyright" content="" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
<title>{{title|default("OPNsense") }}</title>
<script type="text/javascript" src="/js/jquery-1.11.1.min.js"></script>
<link href="/ui/themes/opnsense/build/css/main.css" media="screen, projection" rel="stylesheet">
<!-- Stylesheet for fancy select/dropdown -->
<link rel="stylesheet" type="text/css" href="/ui/themes/opnsense/build/css/bootstrap-select.css">
<!-- Favicon -->
<link href="/ui/themes/opnsense/assets/images/favicon.png" rel="shortcut icon">
</head>
<body>
{{ content() }}
<header class="page-head">
<nav class="navbar navbar-default" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="/">
<img class="brand-logo" src="/ui/themes/opnsense/assets/images/default-logo.png" height="30" width="150"/>
<img class="brand-icon" src="/ui/themes/opnsense/assets/images/icon-logo.png" height="30" width="29"/>
</a>
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navigation">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<div class="collapse navbar-collapse">
<ul class="nav navbar-nav navbar-right">
<li id="menu_messages">
<a href="#">{{title|default("OPNsense") }}</a> </li>
<li></li><li></li><li></li>
<li><a href="/help.php?page=firewall_virtual_ip.php" target="_blank" title="Help for items on this page">Help</a></li>
<li class="active"><a href="/index.php?logout">Logout</a></li>
</ul>
</div>
</div>
</nav>
</header>
<main class="page-content col-sm-10 col-sm-push-2 ">
<!-- menu system -->
{{ partial("layout_partials/base_menu_system") }}
<div class="row">
<header class="page-content-head">
<div class="container-fluid">
<form action="/interfaces.php?if=wan" method="post"><input type='hidden' name='__csrf_magic' value="sid:5ae8a3730c849aff9d3f900337057450b27dd04d,1423522784" />
<ul class="list-inline">
<li class="__mb"><h1>Interfaces: WAN</h1></li>
<li class="btn-group-container">
<!-- <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#modal_widgets"><span class="glyphicon glyphicon-plus-sign __iconspacer"></span>Add widget</button> -->
</li>
</ul>
</form>
</div>
</header>
<section class="page-content-main">
<div class="container-fluid">
<section class="col-xs-12">
<div class="content-box">
{{ content() }}
</div>
</section>
</div>
</section>
</div>
<footer class="page-foot col-sm-push-2">
<div class="container-fluid">
<a target="_blank" href="https://www.opnsense.org/?gui22" class="redlnk">OPNsense</a> is &copy;2014 - 2015 by <a href="http://www.deciso.com" class="tblnk">Deciso B.V.</a> All Rights Reserved.
[<a href="/license.php" class="tblnk">view license</a>]
</div>
</footer>
</main>
<script type="text/javascript" src="/ui/js/jquery-1.11.2.min.js"></script>
<script type="text/javascript" src="/ui/js/bootstrap.min.js"></script>
<script type="text/javascript" src="/ui/themes/opnsense/build/js/bootstrap-select.min.js"></script>
</body>
</html>
AddDefaultCharset UTF-8
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ui/css/(.*) /css/$1 [PT,QSA]
RewriteRule ^ui/fonts/(.*) /fonts/$1 [PT,QSA]
RewriteRule ^ui/js/(.*) /js/$1 [PT,QSA]
RewriteRule ^ui/img/(.*) /img/$1 [PT,QSA]
RewriteRule ^ui/themes/(.*) /themes/$1 [PT,QSA]
RewriteRule ^api/(.*)$ api.php?_url=/$1 [QSA,L]
RewriteRule ^ui/(.*)$ index.php?_url=/$1 [QSA,L]
</IfModule>
\ No newline at end of file
<?php
error_reporting(E_ALL);
try {
/**
* Read the configuration
*/
$config = include __DIR__ . "/../app/config/config.php";
/**
* Read auto-loader
*/
include __DIR__ . "/../app/config/loader.php";
/**
* Read services
*/
include __DIR__ . "/../app/config/services_api.php";
/**
* Handle the request
*/
$application = new \Phalcon\Mvc\Application($di);
echo $application->handle()->getContent();
} catch (\Exception $e) {
echo $e->getMessage();
}
This source diff could not be displayed because it is too large. You can view the blob instead.
<?php
error_reporting(E_ALL);
try {
// Fix authentication for local testing
// session_start();
// $_SESSION["Username"]="admin";
// session_write_close();
/**
* Read the configuration
*/
$config = include __DIR__ . "/../app/config/config.php";
/**
* Read auto-loader
*/
include __DIR__ . "/../app/config/loader.php";
/**
* Read services
*/
include __DIR__ . "/../app/config/services.php";
/**
* Handle the request
*/
$application = new \Phalcon\Mvc\Application($di);
echo $application->handle()->getContent();
} catch (\Exception $e) {
echo $e->getMessage();
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
The MIT License (MIT)
Copyright (c) 2013-2014 bootstrap-select
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
@function twbs-font-path($path) {
@return font-url($path, true);
}
@function twbs-image-path($path) {
@return image-url($path, true);
}
// Mincer asset helper functions
//
// This must be imported into a .css.ejs.scss file.
// Then, <% %>-interpolations will be parsed as strings by Sass, and evaluated by EJS after Sass compilation.
@function twbs-font-path($path) {
// do something like following
// from "path/to/font.ext#suffix" to "<%- asset_path(path/to/font.ext)) + #suffix %>"
// from "path/to/font.ext?#suffix" to "<%- asset_path(path/to/font.ext)) + ?#suffix %>"
// or from "path/to/font.ext" just "<%- asset_path(path/to/font.ext)) %>"
@return "<%- asset_path('#{$path}'.replace(/[#?].*$/, '')) + '#{$path}'.replace(/(^[^#?]*)([#?]?.*$)/, '$2') %>";
}
@function twbs-image-path($file) {
@return "<%- asset_path('#{$file}') %>";
}
@function twbs-font-path($path) {
@return font-path($path);
}
@function twbs-image-path($path) {
@return image-path($path);
}
@import "variables";
// Mixins
.cursor-disabled() {
cursor: not-allowed;
}
// Rules
.bootstrap-select {
/*width: 220px\9; IE8 and below*/
//noinspection CssShorthandPropertyValue
width: 220px \0; /*IE9 and below*/
// The selectpicker button
> .btn {
width: 100%;
padding-right: 25px;
}
// Error display
.error & .btn {
border: 1px solid @color-red-error;
}
// Error display
.control-group.error & .dropdown-toggle {
border-color: @color-red-error;
}
&.fit-width {
width: auto !important;
}
&:not([class*="col-"]):not([class*="form-control"]):not(.input-group-btn) {
width: @width-default;
}
.btn:focus {
outline: thin dotted #333333 !important;
outline: 5px auto -webkit-focus-ring-color !important;
outline-offset: -2px;
}
}
.bootstrap-select.form-control {
margin-bottom: 0;
padding: 0;
border: none;
&:not([class*="col-"]) {
width: 100%;
}
}
// The selectpicker components
.bootstrap-select.btn-group {
&:not(.input-group-btn),
&[class*="col-"] {
float: none;
display: inline-block;
margin-left: 0;
}
// Forces the pull to the right, if necessary
&,
&[class*="col-"],
.row-fluid &[class*="col-"] {
&.dropdown-menu-right {
float: right;
}
}
.form-search &,
.form-inline &,
.form-horizontal &,
.form-group & {
margin-bottom: 0;
}
.form-group-lg &.form-control,
.form-group-sm &.form-control {
padding: 0;
}
// Set the width of the live search (and any other form control within an inline form)
// see https://github.com/silviomoreto/bootstrap-select/issues/685
.form-inline & .form-control {
width: 100%;
}
.input-append & {
margin-left: -1px;
}
.input-prepend & {
margin-right: -1px;
}
> .disabled {
.cursor-disabled();
&:focus {
outline: none !important;
}
}
// The selectpicker button
.btn {
.filter-option {
display: inline-block;
overflow: hidden;
width: 100%;
text-align: left;
}
.caret {
position: absolute;
top: 50%;
right: 12px;
margin-top: -2px;
vertical-align: middle;
}
}
&[class*="col-"] .btn {
width: 100%;
}
// The selectpicker dropdown
.dropdown-menu {
min-width: 100%;
z-index: @zindex-select-dropdown;
box-sizing: border-box;
&.inner {
position: static;
border: 0;
padding: 0;
margin: 0;
border-radius: 0;
box-shadow: none;
}
li {
position: relative;
&:not(.disabled) a:hover small,
&:not(.disabled) a:focus small,
&.active:not(.disabled) a small {
color: @color-blue-hover;
}
&.disabled a {
.cursor-disabled();
}
a {
cursor: pointer;
&.opt {
position: relative;
padding-left: 2.25em;
}
span.check-mark {
display: none;
}
span.text {
display: inline-block;
}
}
small {
padding-left: 0.5em;
}
}
.notify {
position: absolute;
bottom: 5px;
width: 96%;
margin: 0 2%;
min-height: 26px;
padding: 3px 5px;
background: rgb(245, 245, 245);
border: 1px solid rgb(227, 227, 227);
box-shadow: inset 0 1px 1px fade(rgb(0, 0, 0), 5%);
pointer-events: none;
opacity: 0.9;
box-sizing: border-box;
}
}
.no-results {
padding: 3px;
background: #f5f5f5;
margin: 0 5px;
}
&.fit-width .btn {
.filter-option {
position: static;
}
.caret {
position: static;
top: auto;
margin-top: -1px;
}
}
&.show-tick .dropdown-menu li {
&.selected a span.check-mark {
position: absolute;
display: inline-block;
right: 15px;
margin-top: 5px;
}
a span.text {
margin-right: 34px;
}
}
}
.bootstrap-select.show-menu-arrow {
&.open > .btn {
z-index: (@zindex-select-dropdown + 1);
}
.dropdown-toggle {
&:before {
content: '';
border-left: 7px solid transparent;
border-right: 7px solid transparent;
border-bottom-width: 7px;
border-bottom-style: solid;
border-bottom-color: @color-grey-arrow;
position: absolute;
bottom: -4px;
left: 9px;
display: none;
}
&:after {
content: '';
border-left: 6px solid transparent;
border-right: 6px solid transparent;
border-bottom: 6px solid white;
position: absolute;
bottom: -4px;
left: 10px;
display: none;
}
}
&.dropup .dropdown-toggle {
&:before {
bottom: auto;
top: -3px;
border-bottom: 0;
border-top-width: 7px;
border-top-style: solid;
border-top-color: @color-grey-arrow;
}
&:after {
bottom: auto;
top: -3px;
border-top: 6px solid white;
border-bottom: 0;
}
}
&.pull-right .dropdown-toggle {
&:before {
right: 12px;
left: auto;
}
&:after {
right: 13px;
left: auto;
}
}
&.open > .dropdown-toggle {
&:before,
&:after {
display: block;
}
}
}
.bs-searchbox,
.bs-actionsbox {
padding: 4px 8px;
}
.bs-actionsbox {
float: left;
width: 100%;
box-sizing: border-box;
& .btn-group button {
width: 50%;
}
}
.bs-searchbox {
& + .bs-actionsbox {
padding: 0 8px 4px;
}
& input.form-control {
margin-bottom: 0;
width: 100%;
}
}
.mobile-device {
position: absolute;
top: 0;
left: 0;
display: block !important;
width: 100%;
height: 100% !important;
opacity: 0;
}
@color-red-error: rgb(185, 74, 72);
@color-blue-hover: rgba(100, 177, 216, 0.4);
@color-grey-arrow: rgba(204, 204, 204, 0.2);
@width-default: 348px; // 3 960px-grid columns
@zindex-select-dropdown: 1035; // must be lower than a modal background (1040) but higher than the fixed navbar (1030)
//
// Alerts
// --------------------------------------------------
// Base styles
// -------------------------
.alert {
padding: $alert-padding;
margin-bottom: $line-height-computed;
border: 1px solid transparent;
border-radius: $alert-border-radius;
// Headings for larger alerts
h4 {
margin-top: 0;
// Specified for the h4 to prevent conflicts of changing $headings-color
color: inherit;
}
// Provide class for links that match alerts
.alert-link {
font-weight: $alert-link-font-weight;
}
// Improve alignment and spacing of inner content
> p,
> ul {
margin-bottom: 0;
}
> p + p {
margin-top: 5px;
}
}
// Dismissible alerts
//
// Expand the right padding and account for the close button's positioning.
.alert-dismissable, // The misspelled .alert-dismissable was deprecated in 3.2.0.
.alert-dismissible {
padding-right: ($alert-padding + 20);
// Adjust close link position
.close {
position: relative;
top: -2px;
right: -21px;
color: inherit;
}
}
// Alternate styles
//
// Generate contextual modifier classes for colorizing the alert.
.alert-success {
@include alert-variant($alert-success-bg, $alert-success-border, $alert-success-text);
}
.alert-info {
@include alert-variant($alert-info-bg, $alert-info-border, $alert-info-text);
}
.alert-warning {
@include alert-variant($alert-warning-bg, $alert-warning-border, $alert-warning-text);
}
.alert-danger {
@include alert-variant($alert-danger-bg, $alert-danger-border, $alert-danger-text);
}
// Alerts
@mixin alert-variant($background, $border, $text-color) {
background-color: $background;
border-color: $border;
color: darken($text-color, 20%);
hr {
border-top-color: darken($border, 5%);
}
.alert-link {
color: darken($text-color, 15%);
}
}
// Center-align a block level element
@mixin center-block() {
display: block;
margin-left: auto;
margin-right: auto;
}
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment