Error in message-detail.html partial
Public and Closed checkboxes should now be working. Delete button in message-detail.html was accidentally left, removed. Removed cacheing from an-autocomplete. Message list now returns tags list also.
This commit is contained in:
parent
86b5beaa0d
commit
d5dcd392f7
|
@ -1,6 +1,6 @@
|
||||||
CACHE MANIFEST
|
CACHE MANIFEST
|
||||||
|
|
||||||
# version 2013-05-29.1
|
# version 2013-05-30.1
|
||||||
|
|
||||||
CACHE:
|
CACHE:
|
||||||
/partial/404.html
|
/partial/404.html
|
||||||
|
|
|
@ -1,21 +1,34 @@
|
||||||
<legend>Messages <a href="/Message" class="btn btn-success pull-right">Add <i class="icon-plus icon-white"></i></a>
|
<legend>Messages <a href="/Message" class="btn btn-success pull-right">Add <i class="icon-plus icon-white"></i></a>
|
||||||
</legend>
|
</legend>
|
||||||
<div class="widget-box">
|
<div class="widget-box">
|
||||||
<div class="widget-title">
|
<div class="widget-title">
|
||||||
|
<ul class="nav nav-tabs">
|
||||||
|
<li><a href="#">Open</a></li>
|
||||||
|
<li><a href="#">Closed</a></li>
|
||||||
|
<li><a href="#">All</a></li>
|
||||||
|
<li class="dropdown pull-right">
|
||||||
|
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Tags
|
||||||
|
<b class="caret"></b>
|
||||||
|
</a>
|
||||||
|
<ul class="dropdown-menu">
|
||||||
|
<li ng-repeat="(name, count) in tags"><a href="#">{{name}} x {{count}}</a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</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>
|
||||||
|
|
||||||
</div>
|
<p><a ng-click="openMessage(item)">{{item.Title}}</a></p>
|
||||||
<div class="widget-content nopadding">
|
<a class="btn btn-mini" ng-repeat="tag in item.Tags"> {{tag}}</a>
|
||||||
<table class="table table-bordered table-striped">
|
</td>
|
||||||
<tbody>
|
</tr>
|
||||||
<tr ng-repeat="item in info" >
|
</tbody>
|
||||||
<td><input type="checkbox" ng-model="item.selected"></td>
|
</div>
|
||||||
<td>
|
</div>
|
||||||
<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>
|
</table>
|
||||||
|
|
|
@ -25,10 +25,10 @@
|
||||||
ng-options="l.id as l.name for l in priorities"> </select>
|
ng-options="l.id as l.name for l in priorities"> </select>
|
||||||
|
|
||||||
<label class="checkbox inline">
|
<label class="checkbox inline">
|
||||||
<input type="checkbox" ng-model="account.Public"> Is Public
|
<input type="checkbox" ng-model="message.Public"> Is Public
|
||||||
</label>
|
</label>
|
||||||
<label class="checkbox inline">
|
<label class="checkbox inline">
|
||||||
<input type="checkbox" ng-model="account.Closed"> Is Closed
|
<input type="checkbox" ng-model="message.Closed"> Is Closed
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -59,9 +59,5 @@
|
||||||
</ul>
|
</ul>
|
||||||
<div class="form-actions">
|
<div class="form-actions">
|
||||||
<button class="btn btn-primary" ng-click="save()">Save</button>
|
<button class="btn btn-primary" ng-click="save()">Save</button>
|
||||||
<button class="btn btn-danger" ng-show="account.LedgerID" ng-confirm title="Delete Account"
|
|
||||||
action-text="Are you sure? This cannot be undone."
|
|
||||||
action-button-text="Delete" action-function="delete()"> Delete
|
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -5,32 +5,24 @@ overlord_directive.directive('ngAutocomplete', ['$q', '$parse', 'DeepLabel', fun
|
||||||
return {
|
return {
|
||||||
restrict: 'A',
|
restrict: 'A',
|
||||||
link: function (scope, element, attrs, ngModel) {
|
link: function (scope, element, attrs, ngModel) {
|
||||||
var labelsCache = {},
|
var mappedCache = {},
|
||||||
mappedCache = {},
|
|
||||||
labels = [],
|
labels = [],
|
||||||
mapped = {},
|
mapped = {},
|
||||||
deepLabel = DeepLabel;
|
deepLabel = DeepLabel;
|
||||||
element.typeahead({
|
element.typeahead({
|
||||||
source: function (query, process) {
|
source: function (query, process) {
|
||||||
if (query in labelsCache) {
|
var Entity = angular.injector(['overlord.service']).get(attrs.resource);
|
||||||
labels = labelsCache[query];
|
Entity.autocomplete({term: query, count: 20}, function (result) {
|
||||||
mapped = mappedCache[query];
|
labels = [];
|
||||||
process(labels);
|
mapped = {};
|
||||||
} else {
|
$.each(result, function (i, item) {
|
||||||
var Entity = angular.injector(['overlord.service']).get(attrs.resource);
|
var label = deepLabel(item, attrs.label);
|
||||||
Entity.autocomplete({term: query, count: 20}, function (result) {
|
mapped[label] = item
|
||||||
labels = [];
|
labels.push(label)
|
||||||
mapped = {};
|
})
|
||||||
$.each(result, function (i, item) {
|
mappedCache[query] = mapped;
|
||||||
var label = deepLabel(item, attrs.label);
|
process(labels)
|
||||||
mapped[label] = item
|
});
|
||||||
labels.push(label)
|
|
||||||
})
|
|
||||||
labelsCache[query] = labels;
|
|
||||||
mappedCache[query] = mapped;
|
|
||||||
process(labels)
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
minLength: 1,
|
minLength: 1,
|
||||||
items: 20,
|
items: 20,
|
||||||
|
@ -316,7 +308,7 @@ overlord_directive.directive('chosen', ['$parse', function ($parse) {
|
||||||
|
|
||||||
element.chosen({
|
element.chosen({
|
||||||
create_option: function (data) {
|
create_option: function (data) {
|
||||||
if (typeof createFunction !== 'undefined'){
|
if (typeof createFunction !== 'undefined') {
|
||||||
var fn = $parse(attrs['createFunction'] + '("' + data + '")');
|
var fn = $parse(attrs['createFunction'] + '("' + data + '")');
|
||||||
scope.$apply(function () {
|
scope.$apply(function () {
|
||||||
fn(scope);
|
fn(scope);
|
||||||
|
|
|
@ -157,7 +157,7 @@ overlord_service.factory('Account', ['$resource', function ($resource) {
|
||||||
overlord_service.factory('Message', ['$resource', function ($resource) {
|
overlord_service.factory('Message', ['$resource', function ($resource) {
|
||||||
return $resource('/api/Message/:id',
|
return $resource('/api/Message/:id',
|
||||||
{id:'@ThreadID'}, {
|
{id:'@ThreadID'}, {
|
||||||
query:{method:'GET', params:{list:true}, isArray:true}
|
query:{method:'GET', params:{list:true}}
|
||||||
});
|
});
|
||||||
}]);
|
}]);
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var HomeCtrl = ['$scope', '$location', 'messages', function ($scope, $location, messages) {
|
var HomeCtrl = ['$scope', '$location', 'messages', function ($scope, $location, messages) {
|
||||||
$scope.info = messages;
|
$scope.info = messages.Threads;
|
||||||
|
$scope.tags = messages.Tags
|
||||||
$scope.openMessage = function (item) {
|
$scope.openMessage = function (item) {
|
||||||
$location.path('/Message/' + item.ThreadID);
|
$location.path('/Message/' + item.ThreadID);
|
||||||
}
|
}
|
||||||
|
|
|
@ -94,19 +94,24 @@ def show_list(request):
|
||||||
if authenticated_userid(request) is None:
|
if authenticated_userid(request) is None:
|
||||||
list = list.filter(Thread.public == True)
|
list = list.filter(Thread.public == True)
|
||||||
list = list.order_by(Thread.priority).all()
|
list = list.order_by(Thread.priority).all()
|
||||||
|
tags = {}
|
||||||
threads = []
|
threads = []
|
||||||
for item in list:
|
for item in list:
|
||||||
thread = {'ThreadID': item.id, 'Title': item.title,
|
thread = {'ThreadID': item.id, 'Title': item.title,
|
||||||
'CreationDate': item.creation_date.strftime('%d-%b-%Y %H:%M'), 'User': item.user.name,
|
'CreationDate': item.creation_date.strftime('%d-%b-%Y %H:%M'), 'User': item.user.name,
|
||||||
'Priority': item.priority, 'Public': item.public, 'Tags': [], 'Posts': []}
|
'Priority': item.priority, 'Public': item.public, 'Tags': [], 'Posts': []}
|
||||||
threads.append(thread)
|
|
||||||
for tag in item.tags:
|
for tag in item.tags:
|
||||||
thread['Tags'].append(tag.name)
|
thread['Tags'].append(tag.name)
|
||||||
|
if not tag.name in tags:
|
||||||
|
tags[tag.name] = 1
|
||||||
|
else:
|
||||||
|
tags[tag.name] += 1
|
||||||
for post in item.posts:
|
for post in item.posts:
|
||||||
thread['Posts'].append({'PostID': post.id, 'Content': post.content, 'User': post.user.name,
|
thread['Posts'].append({'PostID': post.id, 'Content': post.content, 'User': post.user.name,
|
||||||
'Date': post.date.strftime('%d-%b-%Y %H:%M'),
|
'Date': post.date.strftime('%d-%b-%Y %H:%M'),
|
||||||
'CreationDate': post.creation_date.strftime('%d-%b-%Y %H:%M')})
|
'CreationDate': post.creation_date.strftime('%d-%b-%Y %H:%M')})
|
||||||
return threads
|
threads.append(thread)
|
||||||
|
return {'Tags': tags, 'Threads': threads}
|
||||||
|
|
||||||
|
|
||||||
def thread_info(id):
|
def thread_info(id):
|
||||||
|
|
Loading…
Reference in New Issue