angular-smart-search 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 98c570f756f33bc7318eddd400bf9ca156fa8699
4
- data.tar.gz: c091854d1356759f86c45ae54d1c44665ba730d7
3
+ metadata.gz: de4a050a3086471deb86de73b38446373d4d085d
4
+ data.tar.gz: 098e28d748c9b93843ec08adcaee774bcc9ddb46
5
5
  SHA512:
6
- metadata.gz: 8b5b605c23e57e67143d53b8426bcbb85685760c7777b9ba86e5f74356df8dc572322a69ddb20a0c90ff4baca34466feb3b918ceed0c064c56e576cfa895c5e6
7
- data.tar.gz: eea4b5b51d135db8e1216200a74ee49e50a8b58b230fdf8c5027b47ebbc87889febf59845b539e7ccfa911488c15f6c54c0fa8ec1b9a0c4d14d5ffe05041b49d
6
+ metadata.gz: 6a9460f23144b2fdd2e4a6e46b14cdb750b193434d6fcfaa8604016c37baa52c1afebfbd063c518a4080de9d4e1901bed2bdb2912e4e940efcb5f34b9696c565
7
+ data.tar.gz: e00404550e829b3a068cf9bab7392ad011d3713a1bd71dbfaebcbb9d9639db0369b91d4128116f14f475bd3212dd35ce816bb5ac89306baa694bf8aa4123ed87
@@ -1,16 +1,16 @@
1
1
  // author: Samuel Mueller
2
- // version: 0.0.1
2
+ // version: 0.0.2
3
3
  // license: MIT
4
4
  // homepage: http://github.com/ssmm/angular-smart-search
5
5
  (function() {
6
- var padding, template;
6
+ var padding;
7
7
 
8
8
  padding = 30;
9
9
 
10
10
  angular.module("angular-smart-search", []);
11
11
 
12
12
  angular.module("angular-smart-search").directive("smartSearch", [
13
- "$http", "searchQueryFactory", function($http, searchQueryFactory) {
13
+ "$http", "searchQueryFactory", "templateFactory", function($http, searchQueryFactory, templateFactory) {
14
14
  var QueryState;
15
15
 
16
16
  QueryState = function() {
@@ -27,7 +27,7 @@
27
27
  restrict: "A",
28
28
  scope: true,
29
29
  replace: true,
30
- template: template,
30
+ template: templateFactory(),
31
31
  compile: function(element, attributes, transclude) {
32
32
  var id_field;
33
33
 
@@ -102,75 +102,6 @@
102
102
  }
103
103
  ]);
104
104
 
105
- template = '\
106
- <div>\
107
- <!-- input section you see initially -->\
108
- <div class="input-prepend input-append">\
109
- <!-- gray display section -->\
110
- <span class="add-on" style="min-width: 200px;">\
111
- <!-- result if found -->\
112
- <span ng-show="queryState.is(\'successful\')">\
113
- <i class="ubs-icon-small-suitability"></i>\
114
- {{result.displayText}}\
115
- </span>\
116
- <!-- query states -->\
117
- <span ng-show="queryState.is(\'changed\')">\
118
- <em>{{queryState.query.format.name}} detected</em>\
119
- </span>\
120
- <span ng-show="queryState.is(\'pending\')">\
121
- <em>searching...</em>\
122
- </span>\
123
- <span ng-show="queryState.is(\'unsuccessful\')">\
124
- <em>Not found</em>\
125
- </span>\
126
- <span ng-show="queryState.is(\'invalid-format\')">\
127
- <em>Invalid format</em>\
128
- </span>\
129
- <span ng-show="queryState.is(\'error\')">\
130
- <em>Error</em>\
131
- </span>\
132
- </span>\
133
- <!-- quick query field -->\
134
- <input ng-change="outerQueryChanged(quickQuery)" ng-model="quickQuery" queryfield="" style="width: 100px;" type="text">\
135
- <!-- button that triggers detail search overlay -->\
136
- <button class="btn btn-ubs-dark" ng-click="show()">\
137
- <i class="ubs-icon-small-search ubs-icon-small-white"></i>\
138
- </button>\
139
- </div>\
140
- <!-- detail search overlay, initially hidden -->\
141
- <div class="uw-overlay shadow" ng-mouseleave="hide()" overlay="">\
142
- <div class="row-fluid">\
143
- <div class="span12">\
144
- <div class="input-append">\
145
- <input detail-queryfield="" ng-model="detailQuery" type="text">\
146
- <button class="btn btn-ubs-dark" ng-click="search(detailQuery)">\
147
- <i class="ubs-icon-small-search ubs-icon-small-white"></i>\
148
- </button>\
149
- </div>\
150
- </div>\
151
- </div>\
152
- <div class="horizontal-space"></div>\
153
- <div class="row-fluid">\
154
- <div class="span12">\
155
- <table at-table="" class="table table-bordered table-hover" fill-last-page="" pagination="wildPagination">\
156
- <thead></thead>\
157
- <tbody>\
158
- <tr ng-mouseover="hover(item)">\
159
- <td at-implicit="" attribute="id" class="sortable 50px"></td>\
160
- <td at-implicit="" attribute="displayText" class="sortable 280px" title="Result"></td>\
161
- <td class="50px" title="-">\
162
- <button class="btn btn-mini btn-ubs-blue" ng-click="pick(item)">pick</button>\
163
- </td>\
164
- </tr>\
165
- </tbody>\
166
- </table>\
167
- <at-pagination instance="wildPagination" items-per-page="3" list="resultList"></at-pagination>\
168
- </div>\
169
- </div>\
170
- </div>\
171
- </div>\
172
- ';
173
-
174
105
  angular.module("angular-smart-search").provider("searchQueryFactory", [
175
106
  function() {
176
107
  var Query, detectFormat, formats;
@@ -216,4 +147,37 @@
216
147
  }
217
148
  ]);
218
149
 
150
+ angular.module("angular-smart-search").factory("templateFactory", [
151
+ "markupStore", function(markupStore) {
152
+ return function() {
153
+ return " <div> <!-- input section you see initially --> <div class='input-prepend input-append'> <!-- gray display section --> <span class='add-on' style='min-width: 200px;'> <!-- result if found --> <span ng-show='queryState.is(\"successful\")'> <i class='" + (markupStore.successIconClass()) + "'></i> {{result.displayText}} </span> <!-- query states --> <span ng-show='queryState.is(\"changed\")'> <em>{{queryState.query.format.name}} detected</em> </span> <span ng-show='queryState.is(\"pending\")'> <em>searching...</em> </span> <span ng-show='queryState.is(\"unsuccessful\")'> <em>Not found</em> </span> <span ng-show='queryState.is(\"invalid-format\")'> <em>Invalid format</em> </span> <span ng-show='queryState.is(\"error\")'> <em>Error</em> </span> </span> <!-- quick query field --> <input ng-change='outerQueryChanged(quickQuery)' ng-model='quickQuery' queryfield style='width: 100px;' type='text'> <!-- button that triggers detail search overlay --> <button class='btn' ng-click='show()'> <i class='" + (markupStore.searchIconClass()) + "'></i> </button> </div> <!-- detail search overlay, initially hidden --> <div class='uw-overlay shadow' ng-mouseleave='hide()' overlay> <div class='row-fluid'> <div class='span12'> <div class='input-append'> <input detail-queryfield ng-model='detailQuery' type='text'> <button class='btn' ng-click='search(detailQuery)'> <i class='" + (markupStore.searchIconClass()) + "'></i> </button> </div> </div> </div> <div class='horizontal-space'></div> <div class='row-fluid'> <div class='span12'> <table at-table class='table table-bordered table-hover' fill-last-page pagination='wildPagination'> <thead></thead> <tbody> <tr ng-mouseover='hover(item)'> <td at-implicit attribute='id' class='sortable 50px'></td> <td at-implicit attribute='displayText' class='sortable 280px' title='Result'></td> <td class='50px' title='-'> <button class='btn btn-mini' ng-click='pick(item)'>pick</button> </td> </tr> </tbody> </table> <at-pagination instance='wildPagination' items-per-page='3' list='resultList'></at-pagination> </div> </div> </div> </div> ";
154
+ };
155
+ }
156
+ ]);
157
+
158
+ angular.module("angular-smart-search").provider("markupStore", [
159
+ function() {
160
+ var searchIconClass, successIconClass;
161
+
162
+ successIconClass = "icon-ok";
163
+ searchIconClass = "icon-search";
164
+ this.setSuccessIconClass = function(attr) {
165
+ return successIconClass = attr;
166
+ };
167
+ this.setSearchIconClass = function(attr) {
168
+ return searchIconClass = attr;
169
+ };
170
+ return this.$get = function() {
171
+ return {
172
+ successIconClass: function() {
173
+ return successIconClass;
174
+ },
175
+ searchIconClass: function() {
176
+ return searchIconClass;
177
+ }
178
+ };
179
+ };
180
+ }
181
+ ]);
182
+
219
183
  }).call(this);
@@ -1,3 +1,3 @@
1
1
  module AngularSmartSearch
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: angular-smart-search
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Mueller