Loading correct location when searching
parent
75bc3b4b70
commit
1c90b535e4
|
@ -105,12 +105,8 @@ module.controller("SearchController", SearchController)
|
||||||
SearchBoxDirective = ($lightboxService, $navurls, $location)->
|
SearchBoxDirective = ($lightboxService, $navurls, $location)->
|
||||||
link = ($scope, $el, $attrs) ->
|
link = ($scope, $el, $attrs) ->
|
||||||
project = null
|
project = null
|
||||||
$scope.$on "search-box:show", (ctx, newProject)->
|
|
||||||
project = newProject
|
|
||||||
$lightboxService.open($el)
|
|
||||||
|
|
||||||
$el.on "click", ".button-green", (event) ->
|
submit = ->
|
||||||
event.preventDefault()
|
|
||||||
form = $el.find("form").checksley()
|
form = $el.find("form").checksley()
|
||||||
if not form.validate()
|
if not form.validate()
|
||||||
return
|
return
|
||||||
|
@ -125,6 +121,17 @@ SearchBoxDirective = ($lightboxService, $navurls, $location)->
|
||||||
$location.path(url)
|
$location.path(url)
|
||||||
$location.search("text",text).path(url)
|
$location.search("text",text).path(url)
|
||||||
|
|
||||||
|
$scope.$on "search-box:show", (ctx, newProject)->
|
||||||
|
project = newProject
|
||||||
|
$lightboxService.open($el)
|
||||||
|
|
||||||
|
$el.on "submit", (event) ->
|
||||||
|
submit()
|
||||||
|
|
||||||
|
$el.on "click", ".button-green", (event) ->
|
||||||
|
event.preventDefault()
|
||||||
|
submit()
|
||||||
|
|
||||||
return {link:link}
|
return {link:link}
|
||||||
|
|
||||||
|
|
||||||
|
@ -135,7 +142,7 @@ module.directive("tgSearchBox", ["lightboxService", "$tgNavUrls", "$tgLocation",
|
||||||
## Search Directive
|
## Search Directive
|
||||||
#############################################################################
|
#############################################################################
|
||||||
|
|
||||||
SearchDirective = ($log, $compile, $templatecache) ->
|
SearchDirective = ($log, $compile, $templatecache, $routeparams) ->
|
||||||
# linkFilters = ($scope, $el, $attrs, $ctrl) ->
|
# linkFilters = ($scope, $el, $attrs, $ctrl) ->
|
||||||
linkTable = ($scope, $el, $attrs, $ctrl) ->
|
linkTable = ($scope, $el, $attrs, $ctrl) ->
|
||||||
tabsDom = $el.find("section.search-filter")
|
tabsDom = $el.find("section.search-filter")
|
||||||
|
@ -215,13 +222,15 @@ SearchDirective = ($log, $compile, $templatecache) ->
|
||||||
renderTableContent(section)
|
renderTableContent(section)
|
||||||
markSectionTabActive(section)
|
markSectionTabActive(section)
|
||||||
|
|
||||||
|
|
||||||
link = ($scope, $el, $attrs) ->
|
link = ($scope, $el, $attrs) ->
|
||||||
$ctrl = $el.controller()
|
$ctrl = $el.controller()
|
||||||
# linkFilters($scope, $el, $attrs, $ctrl)
|
# linkFilters($scope, $el, $attrs, $ctrl)
|
||||||
linkTable($scope, $el, $attrs, $ctrl)
|
linkTable($scope, $el, $attrs, $ctrl)
|
||||||
|
|
||||||
|
$scope.$watch "projectId", (projectId) ->
|
||||||
|
$scope.searchTerm = $routeparams.text
|
||||||
|
|
||||||
return {link:link}
|
return {link:link}
|
||||||
|
|
||||||
|
|
||||||
module.directive("tgSearch", ["$log", "$compile", "$templateCache", SearchDirective])
|
module.directive("tgSearch", ["$log", "$compile", "$templateCache", "$routeParams", SearchDirective])
|
||||||
|
|
|
@ -3,5 +3,6 @@ a.close(href="", title="close")
|
||||||
form
|
form
|
||||||
h2.title Search
|
h2.title Search
|
||||||
input(type="text", name="text", id="search-text", placeholder="What are you looking for?", data-required="true")
|
input(type="text", name="text", id="search-text", placeholder="What are you looking for?", data-required="true")
|
||||||
|
input.hidden(type="submit")
|
||||||
a.button.button-green(href="", title="Accept")
|
a.button.button-green(href="", title="Accept")
|
||||||
span Search
|
span Search
|
||||||
|
|
Loading…
Reference in New Issue