Combine v1 and v2 projects into item.pug

This commit is contained in:
James Allen 2018-09-11 11:12:46 +01:00
parent 225d30ffd2
commit dd4b85b809
5 changed files with 54 additions and 70 deletions

View file

@ -1,5 +1,6 @@
td.selectProject
input.select-item(
ng-if="!project.isV1Project",
select-individual,
type="checkbox",
ng-disabled="shouldDisableCheckbox(project)",
@ -7,26 +8,45 @@ td.selectProject
stop-propagation="click"
aria-label=translate('select_project') + " '{{ project.name }}'"
)
td.projectName
a.projectName(
ng-href="{{projectLink(project)}}"
stop-propagation="click"
) {{project.name}}
span(
ng-controller="TagListController"
span.v1-badge(
ng-if="project.isV1Project",
aria-label=translate("v1_badge")
tooltip-template="'v1ProjectTooltipTemplate'"
tooltip-append-to-body="true"
)
.tag-label(
ng-repeat='tag in project.tags'
td.projectName
span(ng-if="project.isV1Project")
if settings.overleaf && settings.overleaf.host
button.btn.btn-link.projectName(
ng-click="openV1ImportModal(project)"
stop-propagation="click"
ng-show="project.accessLevel == 'owner'"
) {{project.name}}
a.projectName(
href=settings.overleaf.host + "/{{project.id}}"
target="_blank"
ng-hide="project.accessLevel == 'owner'"
) {{project.name}}
span(ng-if="!project.isV1Project")
a.projectName(
ng-href="{{projectLink(project)}}"
stop-propagation="click"
) {{project.name}}
span(
ng-controller="TagListController"
)
a.label.label-default.tag-label-name(
href,
ng-click="selectTag(tag)"
) {{tag.name}}
a.label.label-default.tag-label-remove(
href
ng-click="removeProjectFromTag(project, tag)"
) ×
.tag-label(
ng-repeat='tag in project.tags'
stop-propagation="click"
)
a.label.label-default.tag-label-name(
href,
ng-click="selectTag(tag)"
) {{tag.name}}
a.label.label-default.tag-label-remove(
href
ng-click="removeProjectFromTag(project, tag)"
) ×
td
span.owner {{userDisplayName(project.owner)}}
@ -41,13 +61,13 @@ td
td
span.last-modified(tooltip="{{project.lastUpdated | formatDate}}")
| {{project.lastUpdated | fromNowDate}}
span(ng-show='project.lastUpdatedBy')
span(ng-if='project.lastUpdatedBy')
|
| by {{userDisplayName(project.lastUpdatedBy)}}
td.text-right
div(
ng-if="!project.isTableActionInflight"
ng-if="!project.isTableActionInflight && !project.isV1Project"
)
button.btn.btn-link.action-btn(
tooltip=translate('copy'),

View file

@ -154,15 +154,7 @@
ng-repeat="project in visibleProjects | orderBy:predicate:reverse",
ng-controller="ProjectListItemController"
)
.row(
ng-if="!project.isV1Project"
select-row
)
include ./item
.row(
ng-if="project.isV1Project"
)
include ./v1-item
include ./item
tr(
ng-if="visibleProjects.length == 0",
ng-cloak

View file

@ -1,29 +0,0 @@
td
td.selectProject
span.v1-badge(
aria-label=translate("v1_badge")
tooltip-template="'v1ProjectTooltipTemplate'"
tooltip-append-to-body="true"
)
td.projectName
if settings.overleaf && settings.overleaf.host
button.btn.btn-link.projectName(
ng-click="openV1ImportModal(project)"
stop-propagation="click"
ng-show="project.accessLevel == 'owner'"
) {{project.name}}
a.projectName(
href=settings.overleaf.host + "/{{project.id}}"
target="_blank"
ng-hide="project.accessLevel == 'owner'"
) {{project.name}}
td
span.owner {{userDisplayName(project.owner)}}
td
span.last-modified(tooltip="{{project.lastUpdated | formatDate}}") {{project.lastUpdated | fromNowDate}}
td

View file

@ -13,7 +13,7 @@ define [
$scope.predicate = "lastUpdated"
$scope.nUntagged = 0
$scope.reverse = true
$scope.searchText =
$scope.searchText =
value : ""
$timeout () ->
@ -37,7 +37,7 @@ define [
angular.element($window).bind "resize", () ->
recalculateProjectListHeight()
$scope.$apply()
# Allow tags to be accessed on projects as well
projectsById = {}
for project in $scope.projects
@ -56,7 +56,7 @@ define [
tag.selected = true
else
tag.selected = false
$scope.changePredicate = (newPredicate)->
if $scope.predicate == newPredicate
$scope.reverse = !$scope.reverse
@ -145,7 +145,7 @@ define [
# We don't want hidden selections
project.selected = false
localStorage("project_list", JSON.stringify({
localStorage("project_list", JSON.stringify({
filter: $scope.filter,
selectedTagId: selectedTag?._id
}))
@ -461,7 +461,7 @@ define [
resolve:
project: () -> project
)
if storedUIOpts?.filter?
if storedUIOpts.filter == "tag" and storedUIOpts.selectedTagId?
markTagAsSelected(storedUIOpts.selectedTagId)
@ -486,7 +486,7 @@ define [
return project.source == 'token'
$scope.userDisplayName = (user) ->
if user._id == window.user_id
if user? and user._id == window.user_id
return "You"
else if user?
return [user.first_name, user.last_name].filter((n) -> n?).join(" ")
@ -535,11 +535,11 @@ define [
url: "/project/#{$scope.project.id}?forever=true"
headers:
"X-CSRF-Token": window.csrfToken
}).then () ->
}).then () ->
$scope.project.isTableActionInflight = false
$scope._removeProjectFromList $scope.project
for tag in $scope.tags
$scope._removeProjectIdsFromTagArray(tag, [ $scope.project.id ])
$scope.updateVisibleProjects()
.catch () ->
.catch () ->
$scope.project.isTableActionInflight = false

View file

@ -62,7 +62,7 @@
.small {
color: @sidebar-color;
}
}
}
.project-list-sidebar when (@is-overleaf) {
overflow-x: hidden;
@ -271,7 +271,7 @@ ul.structured-list {
li {
border-bottom: 1px solid @structured-list-border-color;
padding: (@line-height-computed / 4) 0;
&:last-child {
border-bottom: 0 none;
}
@ -294,7 +294,7 @@ ul.structured-list {
.header when (@is-overleaf = false) {
text-transform: uppercase;
}
.select-item, .select-all {
position: absolute;
left: @line-height-computed;
@ -355,7 +355,7 @@ table.project-list {
.owner when (@is-overleaf = false) {
margin-right: 0;
}
a.projectName {
a.projectName, button.projectName {
margin-right: @line-height-computed / 4;
padding: 0;
vertical-align: inherit;
@ -400,6 +400,7 @@ table.project-list {
.v1-badge {
margin-left: -4px;
margin-right: -4px;
}
.action-btn-row-header, .action-btn-row {
@ -595,7 +596,7 @@ table.project-list {
&:last-child {
margin-bottom: 0;
}
}
}
.announcement-header {
.page-header;
margin: 0;