Merge and add tag descriptions for the latest image

This commit is contained in:
Joseph Schorr 2013-09-26 18:10:09 -04:00
commit 2e476625de
4 changed files with 44 additions and 11 deletions

View file

@ -144,9 +144,14 @@ def list_repository_tags(namespace_name, repository_name):
def get_tag_image(namespace_name, repository_name, tag_name):
joined = Image.select().join(RepositoryTag).join(Repository)
return joined.where(Repository.name == repository_name,
Repository.namespace == namespace_name,
RepositoryTag.name == tag_name).execute()[0]
fetched = list(joined.where(Repository.name == repository_name,
Repository.namespace == namespace_name,
RepositoryTag.name == tag_name))
if not fetched:
raise Image.DoesNotExist('Unable to find image for tag.')
return fetched[0]
def create_or_update_tag(namespace_name, repository_name, tag_name,

View file

@ -85,15 +85,15 @@ def get_repo_api(namespace, repository):
}
def repo_view(repository, tags = []):
tag_list = []
tag_dict = {}
for tag in tags:
tag_list.append(tag_view(tag))
tag_dict[tag.name] = tag_view(tag)
return {
'namespace': repository.namespace,
'name': repository.name,
'description': repository.description,
'tags': tag_list,
'tags': tag_dict,
'can_write': ModifyRepositoryPermission(repository.namespace, repository.name).can()
}

View file

@ -37,4 +37,20 @@ p.editable:hover .glyphicon {
width: 100%;
height: 150px;
border: 0px;
}
}
.repo .header {
margin-bottom: 10px;
}
.repo .description {
margin-bottom: 40px;
}
.repo dl.dl-horizontal dt {
width: 60px;
}
.repo dl.dl-horizontal dd {
margin-left: 80px;
}

View file

@ -2,7 +2,7 @@
No repository found
</div>
<div class="container" ng-show="repo">
<div class="container repo" ng-show="repo">
<!-- Repo Header -->
<div class="header">
<h3>
@ -11,7 +11,7 @@
</div>
<!-- Description -->
<p ng-class="'lead ' + (repo.can_write ? 'editable' : 'noteditable')" ng-click="editDescription()"><span class="content">{{repo.description}}</span><span class="glyphicon glyphicon-pencil"></span></p>
<p ng-class="'description lead ' + (repo.can_write ? 'editable' : 'noteditable')" ng-click="editDescription()"><span class="content">{{repo.description}}</span><span class="glyphicon glyphicon-pencil"></span></p>
<!-- Tab bar -->
<ul class="nav nav-tabs">
@ -31,9 +31,21 @@
<li><a href="javascript:void(0)">Image History</a></li>
</ul>
Loading...
<div id="current-image">
<dl class="dl-horizontal">
<dt>Created</dt>
<dd>{{ currentTag.image.created }}</dd>
<dt>ID</dt>
<dd>{{ currentTag.image.id }}</dd>
</dl>
<div ng-show="currentTag.image.comment">
<strong>Description:</strong>
<blockquote style="margin-top: 10px;">
{{ currentTag.image.comment || '' }}
</blockquote>
</div>
</div>
<!-- Modal edit for the description -->