Merge branch 'master' of https://github.com/crunchbutton/crunchbutton
This commit is contained in:
commit
80bcde6522
30
cli/dbbackup.php
Executable file
30
cli/dbbackup.php
Executable file
@ -0,0 +1,30 @@
|
||||
#!/usr/local/bin/php
|
||||
<?php
|
||||
//local
|
||||
|
||||
$file = '../db/backup.sql';
|
||||
|
||||
error_reporting(E_ALL ^ (E_NOTICE | E_STRICT));
|
||||
ini_set('display_errors',true);
|
||||
|
||||
if (trim(`whoami`) == 'arzynik') {
|
||||
ini_set('mysqli.default_socket','/Applications/MAMP/tmp/mysql/mysql.sock');
|
||||
$dump = '/Applications/MAMP/Library/bin/mysqldump';
|
||||
} else {
|
||||
$dump = 'mysqldump';
|
||||
}
|
||||
|
||||
require_once('../include/crunchbutton.php');
|
||||
|
||||
$connect = c::config()->db->{c::app()->env()};
|
||||
|
||||
$cmd[] = 'rm '.$file;
|
||||
$cmd[] = $dump.' -q -u '.$connect->user.' -p'.$connect->pass.' '.$connect->db.' > '.$file;
|
||||
$cmd[] = 'sed "s/\`devin\`@\`%\`/\`root\`@\`localhost\`/g" '.$file.' > '.$file.'tmp';
|
||||
$cmd[] = 'mv '.$file.'tmp '.$file;
|
||||
|
||||
foreach ($cmd as $c) {
|
||||
echo $c;
|
||||
exec($c);
|
||||
}
|
||||
|
||||
3
cli/dbbackup.sh
Executable file
3
cli/dbbackup.sh
Executable file
@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
cd /home/cockpit.crunchbutton/cli && /home/cockpit.crunchbutton/cli/dbbackup.php -e=live
|
||||
mv /home/cockpit.crunchbutton/db/backup.sql /home/backup/latest.sql
|
||||
@ -13,14 +13,14 @@
|
||||
<user>***REMOVED***</user>
|
||||
<pass>***REMOVED***</pass>
|
||||
<db>crunchbutton</db>
|
||||
<host>localhost</host>
|
||||
<host>_DOMAIN_</host>
|
||||
<prefix></prefix>
|
||||
</live>
|
||||
<beta>
|
||||
<user>***REMOVED***</user>
|
||||
<pass>***REMOVED***</pass>
|
||||
<db>crunchbutton_dev</db>
|
||||
<host>localhost</host>
|
||||
<host>_DOMAIN_</host>
|
||||
<prefix></prefix>
|
||||
</beta>
|
||||
<local>
|
||||
|
||||
@ -24,6 +24,8 @@ class Controller_drivers extends Crunchbutton_Controller_Account {
|
||||
if ( c::admin()->permission()->check( [ 'global','drivers-all', 'drivers-page' ] ) ) {
|
||||
c::view()->page = 'drivers';
|
||||
c::view()->display( 'drivers/index' );
|
||||
} else {
|
||||
c::view()->display( 'home/index' );
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
class Controller_api_driverorders extends Crunchbutton_Controller_RestAccount {
|
||||
public function init() {
|
||||
// return a list of orders based on params. show none with no params
|
||||
|
||||
$exports = [];
|
||||
|
||||
$orders = Order::deliveryOrders(12); // last 12 hours
|
||||
|
||||
foreach ($orders as $order) {
|
||||
$exports[] = Model::toModel([
|
||||
'id_order' => $order->id_order,
|
||||
'lastStatus' => $order->deliveryLastStatus(),
|
||||
'name' => $order->name,
|
||||
'phone' => $order->phone,
|
||||
'date' => $order->date(),
|
||||
'restaurant' => $order->restaurant()->name,
|
||||
]);
|
||||
}
|
||||
|
||||
// if( !$justMineOrders || ( $justMineOrders && $order->lastStatus[ 'id_admin' ] == c::admin()->id_admin ) ){
|
||||
|
||||
usort($exports, function($a, $b) {
|
||||
if ($a->lastStatus['status'] == $b->lastStatus['status']) {
|
||||
return $a->id_order < $b->id_order;
|
||||
}
|
||||
return ($a->lastStatus['order'] > $b->lastStatus['order']);
|
||||
});
|
||||
|
||||
echo json_encode($exports);
|
||||
|
||||
}
|
||||
}
|
||||
@ -1,7 +0,0 @@
|
||||
<?php
|
||||
|
||||
class Controller_api_orders extends Crunchbutton_Controller_RestAccount {
|
||||
public function init() {
|
||||
// return a list of orders based on params. show none with no params
|
||||
}
|
||||
}
|
||||
@ -8,17 +8,14 @@ class Crunchbutton_Admin_Auth extends Cana_Model {
|
||||
|
||||
public static function localLogin($email, $password) {
|
||||
$password = self::passwordEncrypt($password);
|
||||
$query = sprintf('
|
||||
SELECT *
|
||||
FROM admin
|
||||
WHERE
|
||||
login="%s"
|
||||
AND pass="%s"
|
||||
AND active=1
|
||||
LIMIT 1',
|
||||
@mysql_real_escape_string($email),
|
||||
@mysql_real_escape_string($password)
|
||||
);
|
||||
$query = '
|
||||
SELECT *
|
||||
FROM admin
|
||||
WHERE
|
||||
login="'.c::db()->escape($email).'"
|
||||
AND pass="'.c::db()->escape($password).'"
|
||||
AND active=1
|
||||
LIMIT 1';
|
||||
|
||||
return Admin::q($query)->get(0);
|
||||
|
||||
|
||||
@ -35,6 +35,8 @@ class Crunchbutton_App extends Cana_App {
|
||||
case 'cockpit.crunchr.co':
|
||||
case 'cockpit._DOMAIN_':
|
||||
case 'cbtn.io':
|
||||
case 'cockpit.la':
|
||||
case 'dispatch.la':
|
||||
$env = 'live';
|
||||
break;
|
||||
case 'wenzel.beta.crunchr.co':
|
||||
@ -65,6 +67,8 @@ class Crunchbutton_App extends Cana_App {
|
||||
case '_DOMAIN_':
|
||||
case 'staging._DOMAIN_':
|
||||
case 'spicywithdelivery.com':
|
||||
case 'cockpit.la':
|
||||
case 'dispatch.la':
|
||||
$isStaging = true;
|
||||
$params['env'] = 'live';
|
||||
break;
|
||||
@ -110,6 +114,11 @@ class Crunchbutton_App extends Cana_App {
|
||||
$_SERVER['SERVER_NAME'] = '_DOMAIN_';
|
||||
$host_callback = 'staging.crunchr.co';
|
||||
break;
|
||||
case '/Users/arzynik/Sites/crunchbutton/include/library/Crunchbutton':
|
||||
$params['env'] = 'local';
|
||||
$_SERVER['SERVER_NAME'] = 'crunchbutton.localhost';
|
||||
$host_callback = 'crunchbutton.localhost';
|
||||
break;
|
||||
default:
|
||||
if (getenv('TRAVIS')) {
|
||||
$params['env'] = 'travis';
|
||||
@ -182,13 +191,11 @@ class Crunchbutton_App extends Cana_App {
|
||||
$config = $this->config();
|
||||
$config->site = Crunchbutton_Site::byDomain();
|
||||
|
||||
|
||||
|
||||
if ($config->site->name == 'redirect' && $config->site->theme) {
|
||||
header('Location: '.$config->site->theme.$_SERVER['REQUEST_URI']);
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
if ($config->site->name == 'Cockpit' || $config->site->name == 'Cockpit2') {
|
||||
array_unshift($GLOBALS['config']['libraries'], 'Cockpit');
|
||||
}
|
||||
@ -219,7 +226,7 @@ class Crunchbutton_App extends Cana_App {
|
||||
|
||||
$this->buildAuth($this->db());
|
||||
|
||||
if ($params['env'] != 'local' && $_SERVER['SERVER_NAME'] != 'dev.crunchr.co') {
|
||||
if ($params['env'] != 'local' && $_SERVER['SERVER_NAME'] != 'dev.crunchr.co' && $_SERVER['SERVER_NAME'] != 'cockpit.la') {
|
||||
$config->bundle = true;
|
||||
}
|
||||
|
||||
|
||||
@ -38,4 +38,5 @@
|
||||
|
||||
<!-- AngularJS Services -->
|
||||
<script src="/assets/cockpit/js/service.navigation.js?v=<?=Cana_Util::gitVersion()?>"></script>
|
||||
<script src="/assets/cockpit/js/service.account.js?v=<?=Cana_Util::gitVersion()?>"></script>
|
||||
<script src="/assets/cockpit/js/service.account.js?v=<?=Cana_Util::gitVersion()?>"></script>
|
||||
<script src="/assets/cockpit/js/service.driverorders.js?v=<?=Cana_Util::gitVersion()?>"></script>
|
||||
|
||||
49
include/views/default/cockpit2/frontend/drivers-orders.phtml
Normal file
49
include/views/default/cockpit2/frontend/drivers-orders.phtml
Normal file
@ -0,0 +1,49 @@
|
||||
<div class="top-pad"></div>
|
||||
|
||||
<div class="content-padding">
|
||||
<div class="dialog-message dialog-message-error">
|
||||
<u>In order to receive payment</u> for orders that you deliver, you <b>MUST</b> confirm all orders that you've delivered.
|
||||
Make sure your orders are confirmed and delivered!
|
||||
</div>
|
||||
|
||||
<div class="last-updated">Last Updated: <span class="last-updated-time">just now</span></div>
|
||||
|
||||
<div class="drivers-order-list">
|
||||
<div ng-if="orders">
|
||||
<div class="drivers-order-list-item" ng-repeat="order in driverorders" ng-class="order.lastStatus.status">
|
||||
<span class="text" ng-switch="order.lastStatus.status">
|
||||
<span ng-switch-when="delivered">Delivered by {{order.lastStatus.name}}</span>
|
||||
<span ng-switch-when="pickedup">Picked up by {{order.lastStatus.name}}</span>
|
||||
<span ng-switch-when="accepted">Accepted by {{order.lastStatus.name}}</span>
|
||||
<span ng-switch-default></span>
|
||||
</span>
|
||||
|
||||
<div class="order-list-action">
|
||||
<button class="button button-list-accept" ng-click="accept(order.id_order)" ng-show="order.lastStatus.status='new' || !order.lastStatus.status"> Accept </button>
|
||||
<button class="button button-list-pickedup" ng-click="pickup(order.id_order)" ng-show="order.status.id_admin==account.user.id_admin && order.lastStatus.status=='accepted'"> Picked up </button>
|
||||
<button class="button button-list-delivered" ng-click="delivered(order.id_order)" ng-show="order.status.id_admin==account.user.id_admin && order.lastStatus.status=='pickedup'"> Delivered </button>
|
||||
</div>
|
||||
|
||||
<div class="order-list-date">
|
||||
<div class="day">{{order.date.date | date:'M/d'}}</div>
|
||||
<div class="hour">{{order.date.date | date:'h/m'}}</div>
|
||||
<div class="ampm">{{order.date.date | date:'a'}}</div>
|
||||
</div>
|
||||
<div class="order-list-customer-info">
|
||||
<div class="restaurant" ng-click="viewOrder">
|
||||
{{order.restaurant}}
|
||||
</div>
|
||||
<div class="customer" ng-click="viewOrder">
|
||||
{{order.name}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="divider"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div ng-if="!orders">
|
||||
You currently have no orders to deliver.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@ -0,0 +1,4 @@
|
||||
<div class="top-pad"></div>
|
||||
|
||||
|
||||
shifts
|
||||
@ -1,7 +1,23 @@
|
||||
{{navigation.page}}
|
||||
<div class="snap-drawers static-nav-viewport loggedout-hideable" ng-controller="SideMenuCtrl">
|
||||
<div class="snap-drawer snap-drawer-left side-menu" id="side-menu">
|
||||
<ul>
|
||||
<li ng-click="navigation.link('/drivers/orders')" ng-class="{'nav-active': (navigation.page == 'drivers-orders')}">
|
||||
<table cellpadding="0" cellspacing="0" class="side-menu-wrap">
|
||||
<tr>
|
||||
<td class="side-menu-icon"><i class="fa fa-truck"></i></td>
|
||||
<td class="side-menu-label">Orders</a></td>
|
||||
</tr>
|
||||
</table>
|
||||
</li>
|
||||
<li ng-click="navigation.link('/drivers/shifts')" ng-class="{'nav-active': (navigation.page == 'drivers-shifts')}">
|
||||
<table cellpadding="0" cellspacing="0" class="side-menu-wrap">
|
||||
<tr>
|
||||
<td class="side-menu-icon"><i class="fa fa-calendar"></i></td>
|
||||
<td class="side-menu-label">Shifts</a></td>
|
||||
</tr>
|
||||
</table>
|
||||
</li>
|
||||
<? /*
|
||||
<li ng-click="navigation.link('/splash')" ng-class="{'nav-active': (navigation.page == 'home')}">
|
||||
<table cellpadding="0" cellspacing="0" class="side-menu-wrap">
|
||||
<tr>
|
||||
@ -66,10 +82,11 @@
|
||||
</tr>
|
||||
</table>
|
||||
</li>
|
||||
*/ ?>
|
||||
<li ng-click="account.logout()">
|
||||
<table cellpadding="0" cellspacing="0" class="side-menu-wrap">
|
||||
<tr>
|
||||
<td class="side-menu-icon"><i class="fa fa-wrench"></i></td>
|
||||
<td class="side-menu-icon"><i class="fa fa-frown-o"></i></td>
|
||||
<td class="side-menu-label">Sign Out</a></td>
|
||||
</tr>
|
||||
</table>
|
||||
@ -77,7 +94,13 @@
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
<div class="snap-drawer snap-drawer-right side-menu"></div>
|
||||
<div class="snap-drawer snap-drawer-right side-menu" id="side-menu-right">
|
||||
<div class="content-padding">
|
||||
<p>We will soon have a chat feature that goes to support here. Until then, text us at: <br><br><a href="tel:16467831444">(646) 783-1444</a>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="wrapper static-nav-viewport loggedout-hideable">
|
||||
@ -87,10 +110,27 @@
|
||||
<div class="nav nav-top">
|
||||
<div class="content">
|
||||
|
||||
<div title="Menu" class="menu side" ng-click="navigation.menu()"></div>
|
||||
<div title="Back" class="nav-back hide-before-init" ng-click="back()"></div>
|
||||
<div title="Menu" class="menu side hide-before-init" ng-click="navigation.menu()" ng-hide="hasBack"></div>
|
||||
<div title="Back" class="nav-back hide-before-init" ng-click="back()" ng-show="hasBack"></div>
|
||||
|
||||
<div class="notifications">
|
||||
<div class="notification notification-orders" ng-click="navigation.link('/drivers/orders')">
|
||||
<div class="badge" ng-show="newDriverOrders">{{newDriverOrders}}</div>
|
||||
<i class="fa fa-truck"></i>
|
||||
</div>
|
||||
<div class="notification notification-support" ng-click="navigation.menu('right')">
|
||||
<i class="fa fa-comment"></i>
|
||||
</div>
|
||||
<? /*
|
||||
<div class="notification notification-alerts" ng-click="navigation.link('/alerts')">
|
||||
<i class="fa fa-bell"></i>
|
||||
</div>
|
||||
*/ ?>
|
||||
</div>
|
||||
|
||||
<div class="logo">cockpit<span class="dot">.</span><span class="green">la</span></div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -112,31 +152,32 @@
|
||||
<div class="login-wrap" ng-controller="LoginCtrl" ng-class="{'logged-in': account.loggedin}" ng-hide="account.user.id_admin">
|
||||
<div class="login-content hide-before-init">
|
||||
<div class="logo">cockpit<span class="dot">.</span><span class="green">la</span></div>
|
||||
<div class="dialog-message dialog-message-error" ng-show="error">
|
||||
Invalid username or password
|
||||
|
||||
<div class="dialog-message dialog-message-error" ng-show="error">
|
||||
Invalid username or password
|
||||
</div>
|
||||
|
||||
<form ng-submit="login()">
|
||||
<div class="input-wrap">
|
||||
<span class="label">Username:</span>
|
||||
<span class="field"><input type="text" name="username" ng-model="username" autofocus="autofocus"></span>
|
||||
</div>
|
||||
|
||||
<form ng-submit="login()">
|
||||
<div class="input-wrap">
|
||||
<span class="label">Username:</span>
|
||||
<span class="field"><input type="text" name="username" ng-model="username" autofocus="autofocus"></span>
|
||||
</div>
|
||||
|
||||
<div class="input-wrap">
|
||||
<span class="label">Password:</span>
|
||||
<span class="field"><input type="password" name="password" ng-model="password"></span>
|
||||
</div>
|
||||
|
||||
<div class="button-pushable find-restaurants">
|
||||
<button class="button orange">
|
||||
Sign In
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<div class="info">
|
||||
Cockpit is Crunchbutton's tool of awesomeness. Looking for delivery food? Head over to <a href="http://crunchbutton.com">crunchbutton.com</a>
|
||||
<div class="input-wrap">
|
||||
<span class="label">Password:</span>
|
||||
<span class="field"><input type="password" name="password" ng-model="password"></span>
|
||||
</div>
|
||||
|
||||
<div class="button-pushable find-restaurants">
|
||||
<button class="button orange">
|
||||
Sign In
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<div class="info">
|
||||
Cockpit is Crunchbutton's tool of awesomeness. Looking for delivery food? Head over to <a href="http://crunchbutton.com">crunchbutton.com</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
46
stackscript/cockpit.sh
Normal file
46
stackscript/cockpit.sh
Normal file
@ -0,0 +1,46 @@
|
||||
#!/bin/bash
|
||||
# <udf name="machinename" label="Hostname" example="somedomain.com"/>
|
||||
# <udf name="mysqlrootpw" label="MySQL root password" example="password"/>
|
||||
# <udf name="sshport" label="Port for SSH" example="22" default="22"/>
|
||||
|
||||
source <ssinclude StackScriptID="8646">
|
||||
source <ssinclude StackScriptID="8649">
|
||||
|
||||
|
||||
function install_cockpit {
|
||||
apache_virtualhost $1
|
||||
|
||||
groupadd dev
|
||||
useradd -m -s /bin/bash -G dev deploy
|
||||
# echo "sup3rb4c0n" | passwd --stdin deploy
|
||||
|
||||
setup_github
|
||||
|
||||
chown deploy:dev /home
|
||||
rm -Rf /home/${1}
|
||||
|
||||
sudo -u deploy git clone git@github.com:crunchbutton/crunchbutton.git /home/${1}
|
||||
mkdir /home/${1}/logs /home/${1}/cache
|
||||
mkdir /home/${1}/cache/min /home/${1}/cache/thumb /home/${1}/data
|
||||
chmod -R 0777 /home/${1}/cache
|
||||
|
||||
}
|
||||
|
||||
# set basic shit
|
||||
set_hostname $MACHINENAME
|
||||
set_timezone
|
||||
|
||||
# update and install shit
|
||||
system_update
|
||||
|
||||
ssh_port $SSHPORT
|
||||
|
||||
apache_install
|
||||
apache_virtualhost $MACHINENAME
|
||||
# mysql_install $MYSQLROOTPW
|
||||
php_install
|
||||
install_basics
|
||||
install_cockpit $MACHINENAME
|
||||
|
||||
# restart it
|
||||
restart_services
|
||||
211
stackscript/lamp.sh
Normal file
211
stackscript/lamp.sh
Normal file
@ -0,0 +1,211 @@
|
||||
#!/bin/bash
|
||||
|
||||
# set the hostname
|
||||
function set_hostname {
|
||||
echo setting hostname to $1
|
||||
echo "HOSTNAME=$1" >> /etc/sysconfig/network
|
||||
hostname "$1"
|
||||
|
||||
# update /etc/hosts
|
||||
echo $(system_primary_ip) $(get_rdns_primary_ip) $(hostname) >> /etc/hosts
|
||||
}
|
||||
|
||||
|
||||
# set the timezone
|
||||
function set_timezone {
|
||||
echo setting the timezone to LA
|
||||
ln -sf /usr/share/zoneinfo/America/Los_Angeles /etc/localtime
|
||||
}
|
||||
|
||||
|
||||
# update from repos
|
||||
function system_update {
|
||||
yum -yq update
|
||||
}
|
||||
|
||||
|
||||
# returns the primary IP assigned to eth0
|
||||
function system_primary_ip {
|
||||
echo $(ifconfig eth0 | awk -F: '/inet addr:/ {print $2}' | awk '{ print $1 }')
|
||||
}
|
||||
|
||||
|
||||
# installs apache2 and set it to listen
|
||||
function apache_install {
|
||||
yum -yq install httpd
|
||||
|
||||
mkdir /etc/httpd/sites-available
|
||||
mkdir /etc/httpd/sites-enabled
|
||||
|
||||
# sed -i -e 's/^#NameVirtualHost \*:80$/NameVirtualHost *:80/' /etc/httpd/conf/httpd.conf
|
||||
|
||||
echo "Include sites-enabled/*" >> /etc/httpd/conf/httpd.conf
|
||||
echo "NameVirtualHost *:80" >> /etc/httpd/conf/httpd.conf
|
||||
echo "NameVirtualHost *:443" >> /etc/httpd/conf/httpd.conf
|
||||
echo "NameVirtualHost [::]:80" >> /etc/httpd/conf/httpd.conf
|
||||
echo "NameVirtualHost [::]:443" >> /etc/httpd/conf/httpd.conf
|
||||
|
||||
touch /tmp/restart-httpd
|
||||
}
|
||||
|
||||
|
||||
# adds a virtual host to sites avail/enabled
|
||||
function apache_virtualhost {
|
||||
# Configures a VirtualHost
|
||||
# $1 - required - the hostname of the virtualhost to create
|
||||
|
||||
if [ ! -n "$1" ]; then
|
||||
echo "apache_virtualhost() requires the hostname as the first argument"
|
||||
return 1;
|
||||
fi
|
||||
|
||||
if [ -e "/etc/httpd/sites-available/${1}.conf" ]; then
|
||||
echo /etc/httpd/sites-available/${1}.conf already exists
|
||||
return;
|
||||
fi
|
||||
|
||||
mkdir -p /home/$1/www /home/$1/logs
|
||||
|
||||
echo "<VirtualHost *:80>" > /etc/httpd/sites-available/${1}.conf
|
||||
echo " ServerName $1" >> /etc/httpd/sites-available/${1}.conf
|
||||
echo " DocumentRoot /home/$1/www/" >> /etc/httpd/sites-available/${1}.conf
|
||||
echo " <Directory /home/$1/www/>" >> /etc/httpd/sites-available/${1}.conf
|
||||
echo " AllowOverride All" >> /etc/httpd/sites-available/${1}.conf
|
||||
echo " </Directory>" >> /etc/httpd/sites-available/${1}.conf
|
||||
echo " ErrorLog /home/$1/logs/error.log" >> /etc/httpd/sites-available/${1}.conf
|
||||
echo " CustomLog /home/$1/logs/access.log combined" >> /etc/httpd/sites-available/${1}.conf
|
||||
echo "</VirtualHost>" >> /etc/httpd/sites-available/${1}.conf
|
||||
|
||||
ln -s /etc/httpd/sites-available/${1}.conf /etc/httpd/sites-enabled/${1}.conf
|
||||
|
||||
touch /tmp/restart-httpd
|
||||
}
|
||||
|
||||
|
||||
# install and configure mysql
|
||||
function mysql_install {
|
||||
# $1 - the mysql root password
|
||||
|
||||
if [ ! -n "$1" ]; then
|
||||
echo "mysql_install() requires the root pass as its first argument"
|
||||
return 1;
|
||||
fi
|
||||
|
||||
yum -yq install mysql-server
|
||||
|
||||
service mysqld start
|
||||
|
||||
echo "Sleeping while MySQL starts up for the first time..."
|
||||
sleep 20
|
||||
|
||||
# Remove anonymous users
|
||||
echo "DELETE FROM mysql.user WHERE User='';" | mysql -u root
|
||||
# Remove remote root
|
||||
echo "DELETE FROM mysql.user WHERE User='root' AND Host!='localhost';" | mysql -u root
|
||||
# Remove test db
|
||||
echo "DROP DATABASE test;" | mysql -u root
|
||||
# Set root password
|
||||
echo "UPDATE mysql.user SET Password=PASSWORD('$1') WHERE User='root';" | mysql -u root
|
||||
# Flush privs
|
||||
echo "FLUSH PRIVILEGES;" | mysql -u root
|
||||
|
||||
touch /tmp/restart-mysqld
|
||||
}
|
||||
|
||||
|
||||
# create a mysql db
|
||||
function mysql_create_database {
|
||||
# $1 - the mysql root password
|
||||
# $2 - the db name to create
|
||||
|
||||
if [ ! -n "$1" ]; then
|
||||
echo "mysql_create_database() requires the root pass as its first argument"
|
||||
return 1;
|
||||
fi
|
||||
if [ ! -n "$2" ]; then
|
||||
echo "mysql_create_database() requires the name of the database as the second argument"
|
||||
return 1;
|
||||
fi
|
||||
|
||||
echo "CREATE DATABASE $2;" | mysql -u root -p"$1"
|
||||
}
|
||||
|
||||
|
||||
# add a mysql user
|
||||
function mysql_create_user {
|
||||
# $1 - the mysql root password
|
||||
# $2 - the user to create
|
||||
# $3 - their password
|
||||
|
||||
if [ ! -n "$1" ]; then
|
||||
echo "mysql_create_user() requires the root pass as its first argument"
|
||||
return 1;
|
||||
fi
|
||||
if [ ! -n "$2" ]; then
|
||||
echo "mysql_create_user() requires username as the second argument"
|
||||
return 1;
|
||||
fi
|
||||
if [ ! -n "$3" ]; then
|
||||
echo "mysql_create_user() requires a password as the third argument"
|
||||
return 1;
|
||||
fi
|
||||
|
||||
echo "CREATE USER '$2'@'localhost' IDENTIFIED BY '$3';" | mysql -u root -p"$1"
|
||||
}
|
||||
|
||||
|
||||
# add a mysql users permissions
|
||||
function mysql_grant_user {
|
||||
# $1 - the mysql root password
|
||||
# $2 - the user to bestow privileges
|
||||
# $3 - the database
|
||||
|
||||
if [ ! -n "$1" ]; then
|
||||
echo "mysql_create_user() requires the root pass as its first argument"
|
||||
return 1;
|
||||
fi
|
||||
if [ ! -n "$2" ]; then
|
||||
echo "mysql_create_user() requires username as the second argument"
|
||||
return 1;
|
||||
fi
|
||||
if [ ! -n "$3" ]; then
|
||||
echo "mysql_create_user() requires a database as the third argument"
|
||||
return 1;
|
||||
fi
|
||||
|
||||
echo "GRANT ALL PRIVILEGES ON $3.* TO '$2'@'localhost';" | mysql -u root -p"$1"
|
||||
echo "FLUSH PRIVILEGES;" | mysql -u root -p"$1"
|
||||
|
||||
}
|
||||
|
||||
|
||||
# install php from a 3rd party repo
|
||||
function php_install {
|
||||
# yum -y remove php-common
|
||||
rpm -Uvh http://mirror.webtatic.com/yum/el6/latest.rpm
|
||||
yum -y install php55w php55w-opcache php55w-xml php55w-mysql php55w-mbstring php55w-mcrypt php55w-pear
|
||||
|
||||
sed -i -e 's/^short_open_tag = Off$/short_open_tag = On/' /etc/php.ini
|
||||
}
|
||||
|
||||
|
||||
|
||||
# restarts services that have a file in /tmp/needs-restart/
|
||||
function restart_services {
|
||||
for service in $(ls /tmp/restart-* | cut -d- -f2); do
|
||||
service $service restart
|
||||
rm -f /tmp/restart-$service
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
# installs my shit
|
||||
function install_basics {
|
||||
yum -yq install git wget
|
||||
}
|
||||
|
||||
|
||||
# changes sshs port
|
||||
function ssh_port {
|
||||
sed -i -e 's/^#Port 22$/Port $1/' /etc/ssh/sshd_config
|
||||
}
|
||||
68
stackscript/tune.sh
Normal file
68
stackscript/tune.sh
Normal file
@ -0,0 +1,68 @@
|
||||
|
||||
|
||||
|
||||
|
||||
function apache_tune {
|
||||
# Tunes Apache's memory to use the percentage of RAM you specify, defaulting to 40%
|
||||
# $1 - the percent of system memory to allocate towards Apache
|
||||
|
||||
if [ ! -n "$1" ];
|
||||
then PERCENT=40
|
||||
else PERCENT="$1"
|
||||
fi
|
||||
|
||||
yum -yq install httpd
|
||||
PERPROCMEM=10 # the amount of memory in MB each apache process is likely to utilize
|
||||
MEM=$(get_physical_memory)
|
||||
MAXCLIENTS=$((MEM*PERCENT/100/PERPROCMEM)) # calculate MaxClients
|
||||
MAXCLIENTS=${MAXCLIENTS/.*} # cast to an integer
|
||||
sed -i -e "s/\(^[ \t]*\(MaxClients\|ServerLimit\)[ \t]*\)[0-9]*/\1$MAXCLIENTS/" /etc/httpd/conf/httpd.conf
|
||||
|
||||
touch /tmp/restart-httpd
|
||||
}
|
||||
|
||||
function php_tune {
|
||||
# Tunes PHP to utilize up to nMB per process, 32 by default
|
||||
if [ ! -n "$1" ];
|
||||
then MEM="32"
|
||||
else MEM="${1}"
|
||||
fi
|
||||
|
||||
sed -i'-orig' "s/memory_limit = [0-9]\+M/memory_limit = ${MEM}M/" /etc/php.ini
|
||||
touch /tmp/restart-httpd
|
||||
}
|
||||
|
||||
function mysql_tune {
|
||||
# Tunes MySQL's memory usage to utilize the percentage of memory you specify, defaulting to 40%
|
||||
|
||||
# $1 - the percent of system memory to allocate towards MySQL
|
||||
|
||||
if [ ! -n "$1" ];
|
||||
then PERCENT=40
|
||||
else PERCENT="$1"
|
||||
fi
|
||||
|
||||
MEM=$(get_physical_memory)
|
||||
MYMEM=$((MEM*PERCENT/100)) # how much memory we'd like to tune mysql with
|
||||
MYMEMCHUNKS=$((MYMEM/4)) # how many 4MB chunks we have to play with
|
||||
|
||||
# mysql config options we want to set to the percentages in the second list, respectively
|
||||
OPTLIST=(key_buffer sort_buffer_size read_buffer_size read_rnd_buffer_size myisam_sort_buffer_size query_cache_size)
|
||||
DISTLIST=(75 1 1 1 5 15)
|
||||
|
||||
for opt in ${OPTLIST[@]}; do
|
||||
sed -i -e "/\[mysqld\]/,/\[.*\]/s/^$opt/#$opt/" /etc/my.cnf
|
||||
done
|
||||
|
||||
for i in ${!OPTLIST[*]}; do
|
||||
val=$(echo | awk "{print int((${DISTLIST[$i]} * $MYMEMCHUNKS/100))*4}")
|
||||
if [ $val -lt 4 ]
|
||||
then val=4
|
||||
fi
|
||||
config="${config}\n${OPTLIST[$i]} = ${val}M"
|
||||
done
|
||||
|
||||
sed -i -e "s/\(\[mysqld\]\)/\1\n$config\n/" /etc/my.cnf
|
||||
|
||||
touch /tmp/restart-mysqld
|
||||
}
|
||||
@ -41,6 +41,16 @@ NGApp.config(function($compileProvider){
|
||||
|
||||
NGApp.config(['$routeProvider', '$locationProvider', function($routeProvider, $locationProvider, RestaurantsService) {
|
||||
$routeProvider
|
||||
.when('/drivers/orders', {
|
||||
action: 'drivers-orders',
|
||||
controller: 'DriversOrdersCtrl',
|
||||
templateUrl: 'assets/view/drivers-orders.html'
|
||||
})
|
||||
.when('/drivers/shifts', {
|
||||
action: 'drivers-shifts',
|
||||
controller: 'DriversShiftsCtrl',
|
||||
templateUrl: 'assets/view/drivers-shifts.html'
|
||||
})
|
||||
.otherwise({
|
||||
action: 'home',
|
||||
controller: 'DefaultCtrl',
|
||||
@ -69,7 +79,7 @@ NGApp.controller('AppController', function ($scope, $route, $http, $routeParams,
|
||||
$rootScope.$on('userAuth', function(e, data) {
|
||||
$rootScope.$safeApply(function($scope) {
|
||||
App.snap.close();
|
||||
$rootScope.reload();
|
||||
$rootScope.reload();
|
||||
});
|
||||
});
|
||||
|
||||
@ -113,10 +123,13 @@ NGApp.controller('AppController', function ($scope, $route, $http, $routeParams,
|
||||
this.$apply(fn);
|
||||
}
|
||||
};
|
||||
|
||||
$rootScope.hasBack = false;
|
||||
|
||||
$scope.$on('$routeChangeSuccess', function ($currentRoute, $previousRoute) {
|
||||
// Store the actual page
|
||||
MainNavigationService.page = $route.current.action;
|
||||
console.log($route.current.action);
|
||||
App.rootScope.current = MainNavigationService.page;
|
||||
App.track('page', $route.current.action);
|
||||
|
||||
@ -190,11 +203,12 @@ App.go = function( url, transition ){
|
||||
}
|
||||
};
|
||||
|
||||
App.toggleMenu = function() {
|
||||
if (App.snap.state().state == 'left') {
|
||||
App.toggleMenu = function(side) {
|
||||
side = side || 'left';
|
||||
if (App.snap.state().state == side) {
|
||||
App.snap.close();
|
||||
} else {
|
||||
App.snap.open('left');
|
||||
App.snap.open(side);
|
||||
}
|
||||
};
|
||||
|
||||
@ -312,13 +326,13 @@ App.init = function(config) {
|
||||
|
||||
App.snap = new Snap({
|
||||
element: document.getElementById('snap-content'),
|
||||
menu: document.getElementById('side-menu'),
|
||||
menu: $('#side-menu, #side-menu-right'),
|
||||
menuDragDistance: 95,
|
||||
disable: 'right'
|
||||
disable: ''
|
||||
});
|
||||
|
||||
var snapperCheck = function() {
|
||||
if ($(window).width() <= 768) {
|
||||
if ($(window).width() <= 1024) {
|
||||
App.snap.enable();
|
||||
} else {
|
||||
App.snap.close();
|
||||
|
||||
@ -1,13 +1,17 @@
|
||||
NGApp.controller('DefaultCtrl', function ($scope, $http, $location) {
|
||||
NGApp.controller('DefaultCtrl', function ($scope, $http, $location, MainNavigationService, AccountService) {
|
||||
if (AccountService.user.id_admin) {
|
||||
MainNavigationService.link('/drivers/orders');
|
||||
}
|
||||
});
|
||||
|
||||
NGApp.controller('MainHeaderCtrl', function ( $scope, $rootScope) {
|
||||
|
||||
});
|
||||
|
||||
NGApp.controller( 'MainHeaderCtrl', function ( $scope, $rootScope) {
|
||||
|
||||
});
|
||||
|
||||
NGApp.controller( 'SideMenuCtrl', function () {
|
||||
|
||||
NGApp.controller('SideMenuCtrl', function ($scope) {
|
||||
$scope.setupPermissions = function() {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
NGApp.controller('LoginCtrl', function($scope, AccountService) {
|
||||
@ -18,4 +22,45 @@ NGApp.controller('LoginCtrl', function($scope, AccountService) {
|
||||
// })
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
NGApp.controller('DriversOrderCtrl', function ($http, $scope, $rootScope) {
|
||||
|
||||
});
|
||||
|
||||
|
||||
NGApp.controller('DriversOrdersCtrl', function ($http, $scope, $rootScope, DriverOrdersService) {
|
||||
|
||||
DriverOrdersService.loadOrders();
|
||||
|
||||
$scope.accept = function(id_order) {
|
||||
$rootScope.makebusy();
|
||||
$http.post(App.service + 'order/' + id_order + '/delivery-accept').success(function(json) {
|
||||
if (json.status) {
|
||||
$scope.loadOrders();
|
||||
} else {
|
||||
var name = json['delivery-status'].accepted.name ? ' by ' + json[ 'delivery-status' ].accepted.name : '';
|
||||
App.alert('Ops, error!\n It seems this order was already accepted' + name + '!' );
|
||||
$scope.loadOrders();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
$scope.pickedup = function(id_order) {
|
||||
$rootScope.makebusy();
|
||||
$http.post(App.service + 'order/' + id_order + '/delivery-pickedup').success(function() {
|
||||
$scope.loadOrders();
|
||||
});
|
||||
};
|
||||
|
||||
$scope.delivered = function(id_order) {
|
||||
$rootScope.makebusy();
|
||||
$http.post(App.service + 'order/' + id_order + '/delivery-delivered').success(function() {
|
||||
$scope.loadOrders();
|
||||
});
|
||||
};
|
||||
});
|
||||
|
||||
NGApp.controller('DriversShiftsCtrl', function ($http, $scope, $rootScope) {
|
||||
|
||||
});
|
||||
@ -1,5 +1,8 @@
|
||||
NGApp.factory('AccountService', function($http, $rootScope) {
|
||||
var service = {};
|
||||
var service = {
|
||||
permissions: {},
|
||||
user: null
|
||||
};
|
||||
|
||||
service.checkUser = function() {
|
||||
service.user = App.config.user;
|
||||
@ -29,6 +32,14 @@ NGApp.factory('AccountService', function($http, $rootScope) {
|
||||
$rootScope.$broadcast('userAuth');
|
||||
})
|
||||
};
|
||||
|
||||
$rootScope.$on('userAuth', function(e, data) {
|
||||
if (service.user.id_admin) {
|
||||
|
||||
} else {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
return service;
|
||||
});
|
||||
58
www/assets/cockpit/js/service.driverorders.js
Normal file
58
www/assets/cockpit/js/service.driverorders.js
Normal file
@ -0,0 +1,58 @@
|
||||
NGApp.factory('DriverOrdersService', function($http, $rootScope) {
|
||||
var service = {
|
||||
|
||||
};
|
||||
|
||||
service.loadOrders = function() {
|
||||
$http.get(App.service + 'driverorders').success(function(orders) {
|
||||
$rootScope.driverorders = orders;
|
||||
var newDriverOrders = 0;
|
||||
for (var x in orders) {
|
||||
if (orders[x].lastStatus.status = 'new') {
|
||||
newDriverOrders++;
|
||||
}
|
||||
}
|
||||
console.log(newDriverOrders);
|
||||
$rootScope.newDriverOrders = newDriverOrders;
|
||||
});
|
||||
};
|
||||
|
||||
service.checkUser = function() {
|
||||
service.user = App.config.user;
|
||||
App.config.user = null;
|
||||
};
|
||||
|
||||
service.login = function(user, pass, callback) {
|
||||
$http({
|
||||
method: 'POST',
|
||||
url: App.service + 'login',
|
||||
data: $.param({'username': user, 'password': pass}),
|
||||
headers: {'Content-Type': 'application/x-www-form-urlencoded'}
|
||||
}).success(function(data) {
|
||||
if (data && data.id_admin) {
|
||||
service.user = data;
|
||||
$rootScope.$broadcast('userAuth', service.user);
|
||||
callback(true);
|
||||
} else {
|
||||
callback(false);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
service.logout = function() {
|
||||
$http.get(App.service + 'logout').success(function() {
|
||||
service.user = {};
|
||||
$rootScope.$broadcast('userAuth');
|
||||
})
|
||||
};
|
||||
|
||||
$rootScope.$on('userAuth', function(e, data) {
|
||||
if (service.user.id_admin) {
|
||||
|
||||
} else {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
return service;
|
||||
});
|
||||
@ -101,7 +101,6 @@ html {
|
||||
.nav .content,
|
||||
.content-padding {
|
||||
/*max-width: 767px;*/
|
||||
max-width: 1024px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
}
|
||||
@ -135,11 +134,6 @@ html {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
@media screen and (min-width: 769px) {
|
||||
.logo {
|
||||
text-align: left;
|
||||
}
|
||||
}
|
||||
@media screen and (min-width: 1025px) {
|
||||
.nav-back {
|
||||
display: none;
|
||||
@ -235,7 +229,7 @@ p {
|
||||
font-size: 12px;
|
||||
}
|
||||
.top-pad {
|
||||
height: 90px;
|
||||
height: 67px;
|
||||
}
|
||||
}
|
||||
@media(max-width:499px) {
|
||||
@ -249,11 +243,8 @@ p {
|
||||
.nav-back {
|
||||
margin: 3px 0 0 6px;
|
||||
}
|
||||
.nav-cart {
|
||||
margin: 3px 10px 0 0;
|
||||
}
|
||||
.top-pad {
|
||||
height: 71px;
|
||||
height: 58px;
|
||||
}
|
||||
}
|
||||
.divider {
|
||||
@ -266,18 +257,16 @@ p {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* SNAPS */
|
||||
@media(min-width:769px) {
|
||||
.snap-drawers {
|
||||
display:none;
|
||||
}
|
||||
.nav-top {
|
||||
background: $navColor;
|
||||
background: rgba($navColor, .97);
|
||||
padding-top: 15px;
|
||||
border-bottom: 1px solid rgba(darken($navColor, 50%), .97);
|
||||
height: 4em;
|
||||
}
|
||||
|
||||
@media(max-width:768px) {
|
||||
|
||||
@media(max-width:1024px) {
|
||||
body {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
@ -286,9 +275,6 @@ p {
|
||||
left: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
.footer {
|
||||
display: none;
|
||||
}
|
||||
.snap-content-inner {
|
||||
position:absolute;
|
||||
top:0;
|
||||
@ -339,11 +325,9 @@ p {
|
||||
-ms-transition: width 0.3s ease;
|
||||
-o-transition: width 0.3s ease;
|
||||
transition: width 0.3s ease;
|
||||
|
||||
|
||||
}
|
||||
.snap-drawers {
|
||||
background: $sideBg;
|
||||
color:#eee;
|
||||
position:absolute;
|
||||
top:0;
|
||||
right:0;
|
||||
@ -353,70 +337,121 @@ p {
|
||||
height:auto;
|
||||
overflow:hidden;
|
||||
}
|
||||
.snap-drawer-left, .snap-drawer-right {
|
||||
left:0;
|
||||
z-index:1;
|
||||
}
|
||||
|
||||
|
||||
.snap-drawers {
|
||||
background: $sideBg;
|
||||
color:#eee;
|
||||
}
|
||||
|
||||
.snap-drawer-left {
|
||||
left:0;
|
||||
z-index:1;
|
||||
}
|
||||
.snap-drawer-right {
|
||||
right: 0;
|
||||
z-index:1;
|
||||
}
|
||||
.snapjs-left .snap-drawer-right,
|
||||
.snapjs-right .snap-drawer-left {
|
||||
display: none;
|
||||
}
|
||||
.snapjs-expand-left .snap-drawer-left,
|
||||
.snapjs-expand-right .snap-drawer-right {
|
||||
width: 100%;
|
||||
}
|
||||
.snap-drawer ul {
|
||||
padding:0;
|
||||
margin:0;
|
||||
list-style-type:none;
|
||||
}
|
||||
.snap-drawer li.nav-active .side-menu-wrap {
|
||||
background: $green;
|
||||
color: #fff;
|
||||
}
|
||||
.snap-drawer li {
|
||||
display:block;
|
||||
padding:8px 0 2px 0;
|
||||
text-decoration:none;
|
||||
color:$navLinkColor;
|
||||
text-indent:10px;
|
||||
cursor: pointer;
|
||||
}
|
||||
@-moz-document url-prefix() {
|
||||
.snap-content {
|
||||
transform:none;
|
||||
}
|
||||
.snapjs-left .snap-drawer-right,
|
||||
.snapjs-right .snap-drawer-left {
|
||||
}
|
||||
.snap-drawer .fa {
|
||||
font-size: 15px;
|
||||
}
|
||||
.side-menu-wrap {
|
||||
height: 28px;
|
||||
-moz-box-sizing: border-box;
|
||||
-webkit-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
width: 249px;
|
||||
margin-left: 8px;
|
||||
}
|
||||
.side-menu-label {
|
||||
vertical-align: top;
|
||||
line-height: 1.6em;
|
||||
font-size: 14px;
|
||||
font-family: Ruda, Open Sans, Helvetica, Arial, sans-serif;
|
||||
}
|
||||
|
||||
.side-menu-icon {
|
||||
line-height: 2.2em;
|
||||
width: 40px;
|
||||
margin-left: -20px;
|
||||
}
|
||||
|
||||
.side-menu-label, .side-menu-icon {
|
||||
padding: 12px 0 10px 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* SNAPS */
|
||||
@media(min-width:1025px) {
|
||||
.wrapper {
|
||||
float: left;
|
||||
}
|
||||
#side-menu-right {
|
||||
display: none;
|
||||
}
|
||||
.snapjs-expand-left .snap-drawer-left,
|
||||
.snapjs-expand-right .snap-drawer-right {
|
||||
width: 100%;
|
||||
}
|
||||
.snap-drawer ul {
|
||||
padding:0;
|
||||
margin:0;
|
||||
list-style-type:none;
|
||||
}
|
||||
.snap-drawer li:first-child {
|
||||
border-top:1px solid rgba(0,0,0,0.1);
|
||||
}
|
||||
.snap-drawer li {
|
||||
display:block;
|
||||
border-bottom:1px solid rgba(0,0,0,0.1);
|
||||
padding:8px 0 2px 0;
|
||||
text-decoration:none;
|
||||
color:$navLinkColor;
|
||||
text-indent:20px;
|
||||
cursor: pointer;
|
||||
}
|
||||
.snap-drawer li.nav-active:before {
|
||||
display: block;
|
||||
height: 38px;
|
||||
.snap-drawers {
|
||||
width: 225px;
|
||||
float: left;
|
||||
margin-top: -8px;
|
||||
width: 4px;
|
||||
content: " ";
|
||||
background: #f78155;
|
||||
height: 100%;
|
||||
bottom: 0;
|
||||
top: 0;
|
||||
position: absolute;
|
||||
}
|
||||
.snap-drawer p {
|
||||
opacity:0.5;
|
||||
padding:15px;
|
||||
font-size:12px;
|
||||
.snap-content-inner {
|
||||
margin-left: 235px;
|
||||
margin-right: 10px;
|
||||
}
|
||||
@-moz-document url-prefix() {
|
||||
.snap-content {
|
||||
transform:none;
|
||||
}
|
||||
.snap-drawer-left {
|
||||
margin-top: 65px;
|
||||
-webkit-transform: translateX(0) !important;
|
||||
}
|
||||
.snap-drawer .fa {
|
||||
font-size:25px;
|
||||
.nav-top {
|
||||
background: #22242a;
|
||||
border-bottom: none;
|
||||
}
|
||||
.side-menu-wrap {
|
||||
height: 28px;
|
||||
width: 208px;
|
||||
}
|
||||
.side-menu-wrap {
|
||||
margin-left: -20px;
|
||||
.menu {
|
||||
display: none;
|
||||
}
|
||||
.side-menu-label {
|
||||
margin-top: -10px;
|
||||
vertical-align: top;
|
||||
line-height: 1.6em;
|
||||
margin-bottom: 20px;
|
||||
font-size: 14px;
|
||||
.nav-top .logo {
|
||||
margin-left: 10px;
|
||||
}
|
||||
.logo {
|
||||
text-align: left;
|
||||
}
|
||||
}
|
||||
|
||||
@ -443,22 +478,11 @@ p {
|
||||
height: 1px;
|
||||
}
|
||||
|
||||
.side-menu-icon {
|
||||
width: 70px;
|
||||
}
|
||||
|
||||
.no-init .hide-before-init {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.nav-top {
|
||||
background: $navColor;
|
||||
background: rgba($navColor, .97);
|
||||
padding-top: 15px;
|
||||
border-bottom: 1px solid rgba(darken($navColor, 50%), .97);
|
||||
height: 4em;
|
||||
}
|
||||
|
||||
.login-wrap {
|
||||
background: $navColor;
|
||||
position: fixed;
|
||||
@ -619,7 +643,7 @@ input {
|
||||
margin-bottom: 1em;
|
||||
border-radius: 4px;
|
||||
font-size: 1.2em;
|
||||
line-height: 1.4em;
|
||||
line-height: 1.45em;
|
||||
padding: .7em .9em .5em .9em;
|
||||
}
|
||||
|
||||
@ -630,3 +654,44 @@ input {
|
||||
.dialog-message-success {
|
||||
background: #77c675;
|
||||
}
|
||||
|
||||
|
||||
.notifications {
|
||||
float: right;
|
||||
margin: 2px 10px 0 0;
|
||||
}
|
||||
|
||||
.notifications .notification {
|
||||
border: 1px solid #666666;
|
||||
border-radius: 4px;
|
||||
height: 27px;
|
||||
width: 27px;
|
||||
color: #666666;
|
||||
font-size: 16px;
|
||||
overflow: hidden;
|
||||
line-height: 1.7em;
|
||||
text-align: center;
|
||||
float: left;
|
||||
margin-right: 9px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.notifications .notification:last-child {
|
||||
margin-right: 1px;
|
||||
}
|
||||
|
||||
.notification .badge {
|
||||
background: #fe4e7f;
|
||||
border-radius: 14px;
|
||||
height: 16px;
|
||||
width: 16px;
|
||||
font-size: 10px;
|
||||
position: absolute;
|
||||
margin-top: -6px;
|
||||
margin-left: 17px;
|
||||
color: #fff;
|
||||
line-height: 17px;
|
||||
font-family: Ruda, Helvetica, Arial, sans-serif;
|
||||
font-weight: 900;
|
||||
overflow: hidden;
|
||||
}
|
||||
@ -736,7 +736,7 @@ App.init = function(config) {
|
||||
|
||||
App.snap = new Snap({
|
||||
element: document.getElementById('snap-content'),
|
||||
menu: document.getElementById('side-menu'),
|
||||
menu: $('#side-menu'),
|
||||
menuDragDistance: 95,
|
||||
disable: 'right'
|
||||
});
|
||||
|
||||
@ -186,7 +186,9 @@
|
||||
settings.element.style[cache.vendor+'Transition'] = '';
|
||||
// paralax menu
|
||||
if (settings.menu) {
|
||||
settings.menu.style[cache.vendor+'Transition'] = '';
|
||||
settings.menu.each(function() {
|
||||
this.style[cache.vendor+'Transition'] = '';
|
||||
});
|
||||
}
|
||||
|
||||
cache.translation = action.translate.get.matrix(4);
|
||||
@ -214,7 +216,9 @@
|
||||
|
||||
// paralax menu
|
||||
if (settings.menu) {
|
||||
settings.menu.style[cache.vendor+'Transition'] = 'all ' + settings.transitionSpeed + 's ' + settings.easing;
|
||||
settings.menu.each(function() {
|
||||
this.style[cache.vendor+'Transition'] = 'all ' + settings.transitionSpeed + 's ' + settings.easing;
|
||||
});
|
||||
}
|
||||
|
||||
cache.animatingInterval = setInterval(function() {
|
||||
@ -262,10 +266,24 @@
|
||||
|
||||
// paralax menu
|
||||
if (settings.menu) {
|
||||
var hideDistance = settings.menuDragDistance;
|
||||
var nn = ((n / settings.maxPosition) * hideDistance) - hideDistance;
|
||||
var theSideTranslate = 'translate3d(' + nn + 'px, 0,0)';
|
||||
settings.menu.style[cache.vendor+'Transform'] = theSideTranslate;
|
||||
var getTranslate = function(dir) {
|
||||
var hideDistance = settings.menuDragDistance;
|
||||
if (dir == 'left') {
|
||||
var dirDistance = -hideDistance;
|
||||
} else {
|
||||
var dirDistance = hideDistance;
|
||||
}
|
||||
var nn = ((n / settings.maxPosition) * hideDistance) + dirDistance;
|
||||
var theSideTranslate = 'translate3d(' + nn + 'px, 0,0)';
|
||||
return theSideTranslate;
|
||||
};
|
||||
if (settings.menu.get(0)) {
|
||||
settings.menu.get(0).style[cache.vendor+'Transform'] = getTranslate('left');
|
||||
}
|
||||
if (settings.menu.get(1)) {
|
||||
settings.menu.get(1).style[cache.vendor+'Transform'] = getTranslate('right');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
@ -321,7 +339,9 @@
|
||||
utils.dispatchEvent('start');
|
||||
settings.element.style[cache.vendor+'Transition'] = '';
|
||||
if (settings.menu) {
|
||||
settings.menu.style[cache.vendor+'Transition'] = '';
|
||||
settings.menu.each(function() {
|
||||
this.style[cache.vendor+'Transition'] = '';
|
||||
});
|
||||
}
|
||||
cache.isDragging = true;
|
||||
cache.hasIntent = null;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user