Skip to content

Commit

Permalink
Merge pull request #483 from godunno/bugfix/show-blankslate-when-sear…
Browse files Browse the repository at this point in the history
…ch-with-no-results

Show correct blankslate when searching medias with no results
  • Loading branch information
oddlyfunctional committed Mar 10, 2015
2 parents 13c20e3 + 2001e11 commit c9c3d6b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ MediasIndexCtrl = ($scope, Media, Utils, MediaSearcher)->

$scope.fetch()

$scope.showTutorial = -> !$scope.medias || ($scope.medias.length == 0 && $scope.media_search.q.$untouched)

# TODO: get the count from the server
$scope.countType = (list, type)->
return 0 unless list?
Expand Down
10 changes: 6 additions & 4 deletions app/assets/templates/teacher/medias/index.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ header.page-header.title
h1 Catálogo

.catalog-page
.blankslate ng-if="!medias || medias.length == 0"
.blankslate ng-if="showTutorial()"
.how-to
p Use estes ícones para adicionar links ou arquivos em suas tarefas.
p Tudo ficará organizado para você aqui no catálogo.
= image_tag("medias-blankslate.png")

.row ng-if="!!medias && medias.length > 0"
.row ng-show="!showTutorial()"
/.large-3.columns
/a.dropdown data-dropdown="search-type"
/.option.all ng-if="search.type == 'all'"
Expand Down Expand Up @@ -46,14 +46,16 @@ header.page-header.title
/| ({{countType(medias, 'file')}})
.large-12
form ng-submit="fetch()"
form name="media_search" ng-submit="fetch()"
.row.collapse
.large-12.search-wrapper
input type="text" ng-model="search.q" placeholder="Procure por assunto, palavra-chave ou tags"
input type="text" name="q" ng-model="search.q" placeholder="Procure por assunto, palavra-chave ou tags"
a.button.postfix.icon.icon-close ng-click="clearSearch()"
button.button.postfix.icon.icon-search

.row
h2 ng-if="medias.length == 0 && !showTutorial()"
| Nenhum resultado encontrado.
ul.medias.large-12
li.media ng-repeat="media in medias"
.vertical-bar
Expand Down

0 comments on commit c9c3d6b

Please sign in to comment.