Added new styles based and layout

Update home list style to use widgets from the unicorn theme.
Creation Date is now formatted using filter to show local time.
This commit is contained in:
Tanshu 2013-05-30 16:52:51 +05:30
parent 37acebca06
commit 86b5beaa0d
6 changed files with 214 additions and 48 deletions

View File

@ -61,4 +61,105 @@
font-size: 15px;
line-height: 1.7;
color: #333333;
}
}
.widget-box {
background: none repeat scroll 0 0 #F9F9F9;
border-top: 1px solid #CDCDCD;
border-left: 1px solid #CDCDCD;
border-right: 1px solid #CDCDCD;
clear: both;
margin-top: 16px;
margin-bottom: 16px;
position: relative;
}
/* widgets from unicorn theme from http://wbpreview.com/previews/WB0F35928/widgets.html */
.widget-title, .modal-header, .table th, div.dataTables_wrapper .ui-widget-header, .ui-dialog .ui-dialog-titlebar {
background-color: #efefef;
background-image: -webkit-gradient(linear, 0 0%, 0 100%, from(#fdfdfd), to(#eaeaea));
background-image: -webkit-linear-gradient(top, #fdfdfd 0%, #eaeaea 100%);
border-bottom: 1px solid #CDCDCD;
height: 36px;
}
.widget-title .nav-tabs {
border-bottom: 0 none;
}
.widget-title .nav-tabs li a {
border-bottom: medium none !important;
border-left: 1px solid #DDDDDD;
border-radius: 0 0 0 0;
border-right: 1px solid #DDDDDD;
border-top: medium none;
color: #999999;
margin: 0;
outline: medium none;
padding: 9px 10px 8px;
font-weight: bold;
text-shadow: 0 1px 0 #FFFFFF;
}
.widget-title .nav-tabs li:first-child a{
border-left: medium none !important;
}
.widget-title .nav-tabs li a:hover {
background-color: transparent !important;
border-color: #D6D6D6;
border-width: 0 1px;
color: #666666;
}
.widget-title .nav-tabs li.active a {
background-color: #F9F9F9 !important;
color: #444444;
}
.widget-title span.icon {
border-right: 1px solid #cdcdcd;
padding: 9px 10px 7px 11px;
float: left;
opacity: .7;
}
.widget-title h5 {
color: #666666;
text-shadow: 0 1px 0 #ffffff;
float: left;
font-size: 12px;
font-weight: bold;
padding: 12px;
line-height: 12px;
margin: 0;
}
.widget-title .buttons {
float: right;
margin: 8px 10px 0 0;
}
.widget-title .label {
padding: 3px 5px 2px;
float: right;
margin: 9px 15px 0 0;
box-shadow: 0 1px 2px rgba(0,0,0,0.3) inset, 0 1px 0 #ffffff;
}
.widget-content {
padding: 12px 15px;
border-bottom: 1px solid #cdcdcd;
}
.widget-box.widget-plain .widget-content {
padding: 12px 0 0;
}
.widget-box.collapsible .collapse.in .widget-content {
border-bottom: 1px solid #CDCDCD;
}
.nopadding {
padding: 0 !important;
}
.nopadding .table {
margin-bottom: 0;
}
.nopadding .table-bordered {
border: 0;
}
.user-info {
color: #666666;
font-size: 11px;
}

View File

@ -1,6 +1,6 @@
CACHE MANIFEST
# version 2013-05-28.1
# version 2013-05-29.1
CACHE:
/partial/404.html

View File

@ -1,12 +1,21 @@
<legend>Messages <a href="/Message" class="btn btn-success pull-right">Add <i class="icon-plus icon-white"></i></a>
</legend>
<table class="table table-condensed table-bordered table-striped">
<tbody>
<tr ng-repeat="item in info" ng-click="openMessage(item)">
<td>
{{item.Title}}
<span class="label label-important pull-right" ng-repeat="tag in item.Tags"> {{tag}}</span>
</td>
</tr>
</tbody>
<div class="widget-box">
<div class="widget-title">
</div>
<div class="widget-content nopadding">
<table class="table table-bordered table-striped">
<tbody>
<tr ng-repeat="item in info" >
<td><input type="checkbox" ng-model="item.selected"></td>
<td>
<span class="user-info">User: {{item.User}} at {{item.CreationDate | localTime}}</span>
<p><a ng-click="openMessage(item)">{{item.Title}}</a></p>
<a class="btn btn-mini" ng-repeat="tag in item.Tags"> {{tag}}</a>
</td>
</tr>
</tbody>
</div>
</div>
</table>

View File

@ -45,3 +45,59 @@ overlord_filter.filter('journalDebit', function () {
return list;
};
});
overlord_filter.filter('localTime', function () {
var months = {
Jan: 1,
Feb: 2,
Mar: 3,
Apr: 4,
May: 5,
Jun: 6,
Jul: 7,
Aug: 8,
Sep: 9,
Oct: 10,
Nov: 11,
Dec: 12
}
var months_reverse = {
1: 'Jan',
2: 'Feb',
3: 'Mar',
4: 'Apr',
5: 'May',
6: 'Jun',
7: 'Jul',
8: 'Aug',
9: 'Sep',
10: 'Oct',
11: 'Nov',
12: 'Dec'
}
function padNumber(input, length) {
if (typeof input == 'number'){
input = '' + input;
}
if (typeof length === 'undefined' || !length) {
length = 2;
}
while (input.length < length) {
input = '0' + input;
}
return input;
}
return function (input) {
var d = input.match(/(\w+)/g);
if (d.length !== 5) {
return input;
}
var date = new Date(parseInt(d[2]), months[d[1]] - 1, parseInt(d[0]), parseInt(d[3]), parseInt(d[4])).getTime();
date = new Date(date - (new Date().getTimezoneOffset() * 60000));
var output = padNumber(date.getDate()) + '-' + months_reverse[date.getMonth() + 1] + '-' + date.getFullYear() + ' ' + padNumber(date.getHours()) + ':' + padNumber(date.getMinutes());
return output;
};
});

View File

@ -14,18 +14,18 @@ var SalaryDeductionCtrl = ['$scope', '$location', 'voucher', function ($scope, $
function daysInMonthFunction(date) {
var months = {
Jan:1,
Feb:2,
Mar:3,
Apr:4,
May:5,
Jun:6,
Jul:7,
Aug:8,
Sep:9,
Oct:10,
Nov:11,
Dec:12
Jan: 1,
Feb: 2,
Mar: 3,
Apr: 4,
May: 5,
Jun: 6,
Jul: 7,
Aug: 8,
Sep: 9,
Oct: 10,
Nov: 11,
Dec: 12
}
if (!date.match(/^\d{2}-[\w]{3}-[\d]{4}$/g)) {
return;
@ -40,7 +40,7 @@ var SalaryDeductionCtrl = ['$scope', '$location', 'voucher', function ($scope, $
employer_rate = .0475;
var employee = (grossSalary > limit) ? 0 : Math.ceil(employee_rate * grossSalary * daysWorked / daysInMonth)
var employer = (grossSalary > limit) ? 0 : Math.ceil(employer_rate * grossSalary * daysWorked / daysInMonth)
return {ee:employee, er:employer, both:employee + employer};
return {ee: employee, er: employer, both: employee + employer};
}
function getPf(grossSalary, daysWorked, daysInMonth) {
@ -49,7 +49,7 @@ var SalaryDeductionCtrl = ['$scope', '$location', 'voucher', function ($scope, $
employer_rate = .12 + .011 + .005 + .0001;
var employee = (grossSalary > limit) ? 0 : Math.ceil(employee_rate * grossSalary * daysWorked / daysInMonth)
var employer = (grossSalary > limit) ? 0 : Math.ceil(employer_rate * grossSalary * daysWorked / daysInMonth)
return {ee:employee, er:employer, both:employee + employer};
return {ee: employee, er: employer, both: employee + employer};
}
$scope.add = function () {
@ -61,17 +61,17 @@ var SalaryDeductionCtrl = ['$scope', '$location', 'voucher', function ($scope, $
pf = getPf(grossSalary, daysWorked, daysInMonth);
if (typeof oldJournal !== 'undefined') {
$scope.toasts.push({Type:'Error', Message:'Employee has already been added!'});
$scope.toasts.push({Type: 'Error', Message: 'Employee has already been added!'});
} else {
this.voucher.SalaryDeductions.push(
{
Journal:{Ledger:$scope.employee},
GrossSalary:grossSalary,
DaysWorked:daysWorked,
EsiEmployee:esi.ee,
PfEmployee:pf.ee,
EsiEmployer:esi.er,
PfEmployer:pf.er
Journal: {Ledger: $scope.employee},
GrossSalary: grossSalary,
DaysWorked: daysWorked,
EsiEmployee: esi.ee,
PfEmployee: pf.ee,
EsiEmployer: esi.er,
PfEmployer: pf.er
}
)
;
@ -103,43 +103,43 @@ var SalaryDeductionCtrl = ['$scope', '$location', 'voucher', function ($scope, $
};
$scope.get = function (voucherid) {
$scope.voucher = Voucher.get({VoucherID:voucherid}, function (u, putResponseHeaders) {
$scope.toasts.push({Type:'Success', Message:''});
$scope.voucher = Voucher.get({VoucherID: voucherid}, function (u, putResponseHeaders) {
$scope.toasts.push({Type: 'Success', Message: ''});
}, function (data, status) {
$scope.toasts.push({Type:'Error', Message:data.data});
$scope.toasts.push({Type: 'Error', Message: data.data});
});
};
$scope.save = function () {
$scope.voucher.$save({type:'Salary Deduction'}, function (u, putResponseHeaders) {
$scope.toasts.push({Type:'Success', Message:''});
$scope.voucher.$save({type: 'Salary Deduction'}, function (u, putResponseHeaders) {
$scope.toasts.push({Type: 'Success', Message: ''});
$location.path('/SalaryDeduction/' + u.VoucherID);
}, function (data, status) {
$scope.toasts.push({Type:'Error', Message:data.data});
$scope.toasts.push({Type: 'Error', Message: data.data});
});
};
$scope.delete = function () {
$scope.voucher.$delete(function (u, putResponseHeaders) {
$scope.toasts.push({Type:'Success', Message:''});
$scope.toasts.push({Type: 'Success', Message: ''});
$location.path('/SalaryDeduction').replace();
}, function (data, status) {
$scope.toasts.push({Type:'Error', Message:data.data});
$scope.toasts.push({Type: 'Error', Message: data.data});
});
};
$scope.post = function () {
$scope.voucher.$post(function (u, putResponseHeaders) {
$scope.toasts.push({Type:'Success', Message:''});
$scope.toasts.push({Type: 'Success', Message: ''});
}, function (data, status) {
$scope.toasts.push({Type:'Error', Message:data.data});
$scope.toasts.push({Type: 'Error', Message: data.data});
});
};
}]
SalaryDeductionCtrl.resolve = {
voucher:['$q', '$route', 'Voucher', function ($q, $route, Voucher) {
voucher: ['$q', '$route', 'Voucher', function ($q, $route, Voucher) {
var deferred = $q.defer();
var id = $route.current.params.id;
@ -149,9 +149,9 @@ SalaryDeductionCtrl.resolve = {
};
if (typeof id === 'undefined') {
Voucher.get({type:'Salary Deduction'}, successCb);
Voucher.get({type: 'Salary Deduction'}, successCb);
} else {
Voucher.get({id:id}, successCb);
Voucher.get({id: id}, successCb);
}
return deferred.promise;
}]

View File

@ -97,8 +97,8 @@ def show_list(request):
threads = []
for item in list:
thread = {'ThreadID': item.id, 'Title': item.title,
'CreationDate': item.creation_date.strftime('%d-%b-%Y %H:%M'),
'User': item.user.name, 'Priority': item.priority, 'Public': item.public, 'Tags': [], 'Posts': []}
'CreationDate': item.creation_date.strftime('%d-%b-%Y %H:%M'), 'User': item.user.name,
'Priority': item.priority, 'Public': item.public, 'Tags': [], 'Posts': []}
threads.append(thread)
for tag in item.tags:
thread['Tags'].append(tag.name)