Refactoring global search
parent
6a33072944
commit
a0a4a3a8df
|
@ -182,7 +182,7 @@ SearchDirective = ($log, $compile, $templatecache, $routeparams, $location, $ana
|
|||
applyAutoTab = true
|
||||
activeSectionName = "userstories"
|
||||
tabsDom = $el.find(".search-filter")
|
||||
lastSearchResults = null
|
||||
currentSearchResults = null
|
||||
|
||||
getActiveSection = (data) ->
|
||||
maxVal = 0
|
||||
|
@ -248,9 +248,9 @@ SearchDirective = ($log, $compile, $templatecache, $routeparams, $location, $ana
|
|||
$el.find(".search-result-table").html(element)
|
||||
|
||||
$scope.$watch "searchResults", (data) ->
|
||||
lastSearchResults = data
|
||||
currentSearchResults = data
|
||||
|
||||
return if !lastSearchResults
|
||||
return if !currentSearchResults
|
||||
|
||||
activeSection = getActiveSection(data)
|
||||
|
||||
|
@ -268,7 +268,7 @@ SearchDirective = ($log, $compile, $templatecache, $routeparams, $location, $ana
|
|||
target = angular.element(event.currentTarget)
|
||||
|
||||
sectionName = target.parent().data("name")
|
||||
sectionData = if !lastSearchResults then [] else lastSearchResults[sectionName]
|
||||
sectionData = if !currentSearchResults then [] else currentSearchResults[sectionName]
|
||||
|
||||
section = {
|
||||
name: sectionName,
|
||||
|
|
|
@ -75,8 +75,7 @@ section.issues-table.basic-table(ng-class="{empty: !issues.length}")
|
|||
|
||||
div.modified-field(
|
||||
title="{{ issue.modified_date|momentFormat:'DD MMM YYYY HH:mm' }}"
|
||||
)
|
||||
{{ issue.modified_date|momentFormat:'DD MMM YYYY'}}
|
||||
) {{ issue.modified_date|momentFormat:'DD MMM YYYY'}}
|
||||
|
||||
div.assigned-field(tg-issue-assigned-to-inline-edition="issue")
|
||||
div.issue-assignedto(title="{{'ISSUES.TABLE.TITLE_ACTION_ASSIGNED_TO' | translate}}")
|
||||
|
|
|
@ -1,104 +0,0 @@
|
|||
section.search-result-table
|
||||
|
||||
script(type="text/ng-template", id="search-issues")
|
||||
div.search-result-table-container(ng-class="{'hidden': !issues.length}", tg-bind-scope)
|
||||
div.search-result-table-header
|
||||
div.row.title
|
||||
div.ref(translate="COMMON.FIELDS.REF")
|
||||
div.user-stories(translate="SEARCH.FILTER_ISSUES")
|
||||
div.status(translate="COMMON.FIELDS.STATUS")
|
||||
div.assigned-to(translate="COMMON.FIELDS.ASSIGNED_TO")
|
||||
div.search-result-table-body
|
||||
div.row.table-main(ng-repeat="issue in issues track by issue.id")
|
||||
div.ref(tg-bo-ref="issue.ref")
|
||||
div.user-stories
|
||||
div.user-story-name
|
||||
a(href="", tg-nav="project-issues-detail:project=project.slug,ref=issue.ref",
|
||||
tg-bind-html="issue.subject | emojify")
|
||||
div.status(tg-listitem-issue-status="issue")
|
||||
div.assigned-to(tg-listitem-assignedto="issue")
|
||||
|
||||
div.empty-large(ng-class="{'hidden': issues.length}")
|
||||
include ../components/empty-search-results
|
||||
|
||||
script(type="text/ng-template", id="search-epics")
|
||||
div.search-result-table-container(ng-class="{'hidden': !epics.length}", tg-bind-scope)
|
||||
div.search-result-table-header
|
||||
div.row.title
|
||||
div.ref(translate="COMMON.FIELDS.REF")
|
||||
div.user-stories(translate="SEARCH.FILTER_EPICS")
|
||||
div.status(translate="COMMON.FIELDS.STATUS")
|
||||
div.search-result-table-body
|
||||
div.row.table-main(ng-repeat="epic in epics track by epic.id")
|
||||
div.ref(tg-bo-ref="epic.ref")
|
||||
div.user-stories
|
||||
div.user-story-name
|
||||
a(href="", tg-nav="project-epics-detail:project=project.slug,ref=epic.ref",
|
||||
tg-bind-html="epic.subject | emojify")
|
||||
div.status(tg-listitem-epic-status="epic")
|
||||
|
||||
div.empty-search-results(ng-class="{'hidden': epics.length}")
|
||||
include ../components/empty-search-results
|
||||
|
||||
|
||||
script(type="text/ng-template", id="search-userstories")
|
||||
div.search-result-table-container(ng-class="{'hidden': !userstories.length}", tg-bind-scope)
|
||||
div.search-result-table-header
|
||||
div.row.title
|
||||
div.ref(translate="COMMON.FIELDS.REF")
|
||||
div.user-stories(translate="SEARCH.FILTER_USER_STORIES")
|
||||
div.sprint(translate="COMMON.FIELDS.SPRINT")
|
||||
div.status(translate="COMMON.FIELDS.STATUS")
|
||||
div.points(translate="COMMON.FIELDS.POINTS")
|
||||
div.search-result-table-body
|
||||
div.row.table-main(ng-repeat="us in userstories track by us.id")
|
||||
div.ref(tg-bo-ref="us.ref")
|
||||
div.user-stories
|
||||
div.user-story-name
|
||||
a(href="", tg-nav="project-userstories-detail:project=project.slug,ref=us.ref",
|
||||
tg-bind-html="us.subject | emojify")
|
||||
div.sprint
|
||||
div.sprint-link
|
||||
a(href="", tg-nav="project-taskboard:project=project.slug,sprint=us.milestone_slug",
|
||||
tg-bo-bind="us.milestone_name")
|
||||
div.status(tg-listitem-us-status="us")
|
||||
div.points(tg-bo-bind="us.total_points")
|
||||
|
||||
div.empty-large(ng-class="{'hidden': userstories.length}")
|
||||
include ../components/empty-search-results
|
||||
|
||||
script(type="text/ng-template", id="search-tasks")
|
||||
div.search-result-table-container(ng-class="{'hidden': !tasks.length}", tg-bind-scope)
|
||||
div.search-result-table-header
|
||||
div.row.title
|
||||
div.ref(translate="COMMON.FIELDS.REF")
|
||||
div.user-stories(translate="SEARCH.FILTER_TASKS")
|
||||
div.status(translate="COMMON.FIELDS.STATUS")
|
||||
div.assigned-to(translate="COMMON.FIELDS.ASSIGNED_TO")
|
||||
div.search-result-table-body
|
||||
div.row.table-main(ng-repeat="task in tasks track by task.id")
|
||||
div.ref(tg-bo-ref="task.ref")
|
||||
div.user-stories
|
||||
div.user-story-name
|
||||
a(href="", tg-nav="project-tasks-detail:project=project.slug,ref=task.ref",
|
||||
tg-bind-html="task.subject | emojify")
|
||||
div.status(tg-listitem-task-status="task")
|
||||
div.assigned-to(tg-listitem-assignedto="task")
|
||||
|
||||
div.empty-large(ng-class="{'hidden': tasks.length}")
|
||||
include ../components/empty-search-results
|
||||
|
||||
script(type="text/ng-template", id="search-wikipages")
|
||||
div.search-result-table-container(ng-class="{'hidden': !wikipages.length}", tg-bind-scope)
|
||||
div.search-result-table-header
|
||||
div.row.title
|
||||
div.user-stories(translate="SEARCH.FILTER_WIKI")
|
||||
div.search-result-table-body
|
||||
div.row.table-main(ng-repeat="wikipage in wikipages track by wikipage.id")
|
||||
div.user-stories
|
||||
div.user-story-name
|
||||
a(href="", tg-nav="project-wiki-page:project=project.slug,slug=wikipage.slug",
|
||||
tg-bo-bind="wikipage.slug")
|
||||
|
||||
div.empty-large(ng-class="{'hidden': wikipages.length}")
|
||||
include ../components/empty-search-results
|
|
@ -0,0 +1,19 @@
|
|||
div.search-result-table-container(ng-class="{'hidden': !epics.length}", tg-bind-scope)
|
||||
div.search-result-table-header
|
||||
div.row.title
|
||||
div.user-stories(translate="SEARCH.FILTER_EPICS")
|
||||
div.status(translate="COMMON.FIELDS.STATUS")
|
||||
div.search-result-table-body
|
||||
div.row.table-main(ng-repeat="epic in epics track by epic.id")
|
||||
div.user-stories
|
||||
div.user-story-name
|
||||
a(
|
||||
href=""
|
||||
tg-nav="project-epics-detail:project=project.slug,ref=epic.ref"
|
||||
)
|
||||
span.ref(tg-bo-ref="epic.ref")
|
||||
span {{ epic.subject | emojify }}
|
||||
div.status(tg-listitem-epic-status="epic")
|
||||
|
||||
div.empty-large(ng-class="{'hidden': epics.length}")
|
||||
include ./empty-search-results
|
|
@ -0,0 +1,21 @@
|
|||
div.search-result-table-container(ng-class="{'hidden': !issues.length}", tg-bind-scope)
|
||||
div.search-result-table-header
|
||||
div.row.title
|
||||
div.user-stories(translate="SEARCH.FILTER_ISSUES")
|
||||
div.status(translate="COMMON.FIELDS.STATUS")
|
||||
div.assigned-to(translate="COMMON.FIELDS.ASSIGNED_TO")
|
||||
div.search-result-table-body
|
||||
div.row.table-main(ng-repeat="issue in issues track by issue.id")
|
||||
div.user-stories
|
||||
div.user-story-name
|
||||
a(
|
||||
href="",
|
||||
tg-nav="project-issues-detail:project=project.slug,ref=issue.ref"
|
||||
)
|
||||
span.ref(tg-bo-ref="issue.ref")
|
||||
span {{ issue.subject | emojify }}
|
||||
div.status(tg-listitem-issue-status="issue")
|
||||
div.assigned-to(tg-listitem-assignedto="issue")
|
||||
|
||||
div.empty-large(ng-class="{'hidden': issues.length}")
|
||||
include ./empty-search-results
|
|
@ -0,0 +1,21 @@
|
|||
div.search-result-table-container(ng-class="{'hidden': !tasks.length}", tg-bind-scope)
|
||||
div.search-result-table-header
|
||||
div.row.title
|
||||
div.user-stories(translate="SEARCH.FILTER_TASKS")
|
||||
div.status(translate="COMMON.FIELDS.STATUS")
|
||||
div.assigned-to(translate="COMMON.FIELDS.ASSIGNED_TO")
|
||||
div.search-result-table-body
|
||||
div.row.table-main(ng-repeat="task in tasks track by task.id")
|
||||
div.user-stories
|
||||
div.user-story-name
|
||||
a(
|
||||
href="",
|
||||
tg-nav="project-tasks-detail:project=project.slug,ref=task.ref"
|
||||
)
|
||||
span.ref(tg-bo-ref="task.ref")
|
||||
span {{ task.subject | emojify }}
|
||||
div.status(tg-listitem-task-status="task")
|
||||
div.assigned-to(tg-listitem-assignedto="task")
|
||||
|
||||
div.empty-large(ng-class="{'hidden': tasks.length}")
|
||||
include ./empty-search-results
|
|
@ -0,0 +1,26 @@
|
|||
div.search-result-table-container(ng-class="{'hidden': !userstories.length}", tg-bind-scope)
|
||||
div.search-result-table-header
|
||||
div.row.title
|
||||
div.user-stories(translate="SEARCH.FILTER_USER_STORIES")
|
||||
div.sprint(translate="COMMON.FIELDS.SPRINT")
|
||||
div.status(translate="COMMON.FIELDS.STATUS")
|
||||
div.points(translate="COMMON.FIELDS.POINTS")
|
||||
div.search-result-table-body
|
||||
div.row.table-main(ng-repeat="us in userstories track by us.id")
|
||||
div.user-stories
|
||||
div.user-story-name
|
||||
a(
|
||||
href=""
|
||||
tg-nav="project-userstories-detail:project=project.slug,ref=us.ref"
|
||||
)
|
||||
span.ref(tg-bo-ref="us.ref")
|
||||
span {{ us.subject | emojify }}
|
||||
div.sprint
|
||||
div.sprint-link
|
||||
a(href="", tg-nav="project-taskboard:project=project.slug,sprint=us.milestone_slug",
|
||||
tg-bo-bind="us.milestone_name")
|
||||
div.status(tg-listitem-us-status="us")
|
||||
div.points(tg-bo-bind="us.total_points")
|
||||
|
||||
div.empty-large(ng-class="{'hidden': userstories.length}")
|
||||
include ./empty-search-results
|
|
@ -0,0 +1,13 @@
|
|||
div.search-result-table-container(ng-class="{'hidden': !wikipages.length}", tg-bind-scope)
|
||||
div.search-result-table-header
|
||||
div.row.title
|
||||
div.user-stories(translate="SEARCH.FILTER_WIKI")
|
||||
div.search-result-table-body
|
||||
div.row.table-main(ng-repeat="wikipage in wikipages track by wikipage.id")
|
||||
div.user-stories
|
||||
div.user-story-name
|
||||
a(href="", tg-nav="project-wiki-page:project=project.slug,slug=wikipage.slug",
|
||||
tg-bo-bind="wikipage.slug")
|
||||
|
||||
div.empty-large(ng-class="{'hidden': wikipages.length}")
|
||||
include ./empty-search-results
|
|
@ -0,0 +1,16 @@
|
|||
section.search-result-table
|
||||
|
||||
script(type="text/ng-template", id="search-issues")
|
||||
include ./search-result-table-issues
|
||||
|
||||
script(type="text/ng-template", id="search-epics")
|
||||
include ./search-result-table-epics
|
||||
|
||||
script(type="text/ng-template", id="search-userstories")
|
||||
include ./search-result-table-us
|
||||
|
||||
script(type="text/ng-template", id="search-tasks")
|
||||
include ./search-result-table-tasks
|
||||
|
||||
script(type="text/ng-template", id="search-wikipages")
|
||||
include ./search-result-table-wiki
|
|
@ -10,4 +10,4 @@ div.wrapper(tg-search, ng-controller="SearchController as ctrl",
|
|||
section.main.search-result
|
||||
include ../includes/components/mainTitle
|
||||
include ../includes/modules/search-filter
|
||||
include ../includes/modules/search-result-table
|
||||
include ../includes/modules/search-results/search-result-table
|
||||
|
|
|
@ -7,26 +7,25 @@
|
|||
padding: .5rem;
|
||||
|
||||
.ref {
|
||||
flex-basis: 30px;
|
||||
flex-grow: 1;
|
||||
padding: 0 1rem;
|
||||
margin-right: .5rem;
|
||||
}
|
||||
.user-stories {
|
||||
flex-basis: 300px;
|
||||
flex-grow: 10;
|
||||
flex-shrink: 1;
|
||||
overflow: hidden;
|
||||
padding-right: 1rem;
|
||||
width: 100%;
|
||||
}
|
||||
.status,
|
||||
.points,
|
||||
.sprint {
|
||||
flex-basis: 150px;
|
||||
flex: 0 0 150px;
|
||||
flex-grow: 0;
|
||||
max-width: 150px;
|
||||
padding: 0 1rem;
|
||||
text-align: center;
|
||||
}
|
||||
.assigned-to {
|
||||
flex-basis: 150px;
|
||||
flex-grow: 0;
|
||||
flex: 0 0 150px;
|
||||
max-width: 150px;
|
||||
padding: 0 1rem;
|
||||
}
|
||||
}
|
||||
|
@ -42,7 +41,7 @@
|
|||
}
|
||||
span {
|
||||
display: inline-block;
|
||||
max-width: 70%;
|
||||
max-width: 100%;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
|
|
Loading…
Reference in New Issue