Advertisement
Guest User

Untitled

a guest
May 24th, 2016
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.17 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3.  
  4. <head>
  5. <link rel="import" href="https://rawgit.com/Polymer/polymer/v1.2.2/polymer.html" />
  6. <script src="https://elements.polymer-project.org/bower_components/webcomponentsjs/webcomponents-lite.js"></script>
  7. <link rel="import" href="https://elements.polymer-project.org/bower_components/iron-elements/iron-elements.html">
  8.  
  9. <link rel="import" href="http://www.polymer-project.org/1.0/components/paper-input/paper-input.html">
  10. <link rel="import" href="http://www.polymer-project.org/1.0/components/paper-dropdown-menu/paper-dropdown-menu.html">
  11. <style>
  12. .taller {
  13. height: 120px;
  14. }
  15.  
  16. [vertical-align="top"] ul {
  17. margin-top: 0;
  18. }
  19.  
  20. [vertical-align="bottom"] ul {
  21. margin-bottom: 0;
  22. }
  23.  
  24. button,
  25. paper-button {
  26. border: 1px solid #ccc;
  27. background-color: #eee;
  28. /*padding: 1em;*/
  29. border-radius: 3px;
  30. cursor: pointer;
  31. }
  32.  
  33. button:focus {
  34. outline: none;
  35. border-color: blue;
  36. }
  37. </style>
  38. </head>
  39.  
  40. <body>
  41. <dom-module id="employee-list">
  42. <template>
  43. <input type="text" id="searchEmp" placeholder="Search For employee" />
  44. <br/>
  45. <select>
  46. <option value="">Select Department</option>
  47. <option value="digital engamenet">Digital Engagement</option>
  48. <option value="shared research">Shared Research</option>
  49. <option value="research">Research</option>
  50. </select>
  51. <br/>
  52. <button onclick="javascript:searchData()">Search</button>
  53. <br/>
  54. <br/>
  55. <paper-listbox>
  56. <template is="dom-repeat" items="{{items}}">
  57. <div class="row">
  58. <div class="col-sm-12" style="font-size:15px;font-family:'Open Sans'">
  59. {{item.name}} - {{item.dept}}
  60. </div>
  61. <hr />
  62. </div>
  63. </template>
  64. </paper-listbox>
  65. <!-- would like this result show on another page on click of search -->
  66. <div class="search-result">
  67. <h3>Result</h3>
  68. <div id="result"></div>
  69. </div>
  70. </template>
  71. <script>
  72. Polymer({
  73. is: 'employee-list',
  74. properties: {
  75. items: {
  76. type: Array
  77. }
  78. },
  79. ready: function() {
  80. this.items = [{
  81. 'name': 'Jack',
  82. 'dept': 'Digital Engagement'
  83. }, {
  84. 'name': 'Buba',
  85. 'dept': 'Research'
  86. }, {
  87. 'name': 'Kashif',
  88. 'dept': 'Shared Research'
  89. }];
  90. }
  91.  
  92. });
  93. var items = [{
  94. 'name': 'Jack',
  95. 'dept': 'Digital Engagement'
  96. }, {
  97. 'name': 'Buba',
  98. 'dept': 'Research'
  99. }, {
  100. 'name': 'Kashif',
  101. 'dept': 'Shared Research'
  102. }];
  103.  
  104. function searchData() {
  105. var inputVal = document.getElementById('searchEmp').value.toLowerCase(),
  106. i, len, data, prop, matches = [],
  107. val;
  108.  
  109. for (i = 0, len = items.length; i < len; i++) {
  110. data = items[i];
  111. for (prop in data) {
  112. if (data.hasOwnProperty(prop)) {
  113. val = data[prop];
  114. if (typeof val !== 'undefined' && val.toLowerCase && val.toLowerCase().indexOf(inputVal) >= 0) {
  115. // this data matches
  116. matches.push(data);
  117. break;
  118. }
  119. }
  120. }
  121. }
  122. showMatches(matches);
  123. }
  124.  
  125. function showMatches(matches) {
  126. var elem = document.getElementById('result'),
  127. i, len, content = '';
  128. if (typeof matches === 'undefined' || !matches.length) {
  129. elem.innerHTML = '<i>No results found</i>';
  130. return;
  131. }
  132. for (i = 0, len = matches.length; i < len; i++) {
  133. content += '<div><b>Name:</b>' + matches[i].name + '</div>';
  134. }
  135. elem.innerHTML = content;
  136. }
  137. </script>
  138. </dom-module>
  139. <employee-list></employee-list>
  140. </body>
  141.  
  142. </html>
  143.  
  144. <!DOCTYPE html>
  145. <html>
  146.  
  147. <head>
  148. <link rel="import" href="https://rawgit.com/Polymer/polymer/v1.2.2/polymer.html" />
  149. <script src="https://elements.polymer-project.org/bower_components/webcomponentsjs/webcomponents-lite.js"></script>
  150. <link rel="import" href="https://elements.polymer-project.org/bower_components/iron-elements/iron-elements.html">
  151.  
  152. <link rel="import" href="http://www.polymer-project.org/1.0/components/paper-input/paper-input.html">
  153. <link rel="import" href="http://www.polymer-project.org/1.0/components/paper-dropdown-menu/paper-dropdown-menu.html">
  154. <style>
  155. .taller {
  156. height: 120px;
  157. }
  158.  
  159. [vertical-align="top"] ul {
  160. margin-top: 0;
  161. }
  162.  
  163. [vertical-align="bottom"] ul {
  164. margin-bottom: 0;
  165. }
  166.  
  167. button,
  168. paper-button {
  169. border: 1px solid #ccc;
  170. background-color: #eee;
  171. /*padding: 1em;*/
  172. border-radius: 3px;
  173. cursor: pointer;
  174. }
  175.  
  176. button:focus {
  177. outline: none;
  178. border-color: blue;
  179. }
  180. </style>
  181. </head>
  182.  
  183. <body>
  184. <dom-module id="employee-list">
  185. <template>
  186. <input type="text" id="searchEmp" placeholder="Search For employee" />
  187. <br/>
  188. <select>
  189. <option value="">Select Department</option>
  190. <option value="digital engamenet">Digital Engagement</option>
  191. <option value="shared research">Shared Research</option>
  192. <option value="research">Research</option>
  193. </select>
  194. <br/>
  195. <button onclick="javascript:searchData()">Search</button>
  196. </template>
  197. <div class="research-result">
  198. <div class="layout">
  199. <div class="layout__item u-1/4">
  200. <h3>Result</h3>
  201. </div>
  202. </div>
  203. </div>
  204. <div id="notFound" class="searchResult">
  205. <div class="layout">
  206. <div class="layout__item u-1">
  207. <p>No applicable NDA found for "{{filterValue}}"</p>
  208. </div>
  209. <div class="layout__item u-1/6">
  210. <a href="/rm-new-nda">
  211. <input type="button" id="create-new-nda" class="btn btn--primary" value="Request New NDA" />
  212. </a>
  213. </div>
  214. </div>
  215. </div>
  216. <div id="found" class="searchResult">
  217. <div class="layout">
  218. <div class="layout__item u-1">
  219. <p>Applicable NDA found for "{{filterValue}}". New NDA not required.</p>
  220. </div>
  221. </div>
  222. </div>
  223. </dom-module>
  224. </body>
  225.  
  226. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement