image.tpl.html 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <div class="modal-header">
  2. <h3 class="modal-title">图片</h3>
  3. </div>
  4. <div class="modal-body">
  5. <tabset>
  6. <tab heading="图片搜索">
  7. <form class="form-inline">
  8. <div class="form-group">
  9. <label for="search-keyword">关键词:</label>
  10. <input type="text" class="form-control" ng-model="data.searchKeyword2" id="search-keyword" placeholder="请输入搜索的关键词">
  11. </div>
  12. <button class="btn btn-primary" ng-click="searchImage()">百度一下</button>
  13. </form>
  14. <div class="search-result" id="search-result">
  15. <ul>
  16. <li ng-repeat="image in list" id="{{ 'img-item' + $index }}" ng-class="{'selected' : isSelected}" ng-click="selectImage($event)">
  17. <img id="{{ 'img-' + $index }}" ng-src="{{ image.src || '' }}" alt="{{ image.title }}" onerror="this.parentNode.removeChild(this)" />
  18. <span>{{ image.title }}</span>
  19. </li>
  20. </ul>
  21. </div>
  22. </tab>
  23. <tab heading="外链图片">
  24. <form>
  25. <div class="form-group" ng-class="{true: 'has-success', false: 'has-error'}[urlPassed]">
  26. <label for="image-url">链接地址:</label>
  27. <input type="text"
  28. class="form-control"
  29. ng-model="data.url"
  30. ng-blur="urlPassed = data.R_URL.test(data.url)"
  31. ng-focus="this.value = data.url"
  32. ng-keydown="shortCut($event)"
  33. id="image-url"
  34. placeholder="必填:以 http(s):// 开头">
  35. </div>
  36. <div class="form-group" ng-class="{'has-success' : titlePassed}">
  37. <label for="image-title">提示文本:</label>
  38. <input type="text" class="form-control" ng-model="data.title" ng-blur="titlePassed = true" id="image-title" placeholder="选填:鼠标在图片上悬停时提示的文本">
  39. </div>
  40. <div class="form-group">
  41. <label for="image-preview">图片预览:</label>
  42. <img class="image-preview" id="image-preview" ng-src="{{ data.url }}" alt="{{ data.title }}"/>
  43. </div>
  44. </form>
  45. </tab>
  46. <tab heading="上传图片" active="true">
  47. <form>
  48. <div class="form-group">
  49. <!-- 这里不能用 ng-change -->
  50. <input type="file" name="upload-image" id="upload-image" class="upload-image" accept=".jpg,.JPG,jpeg,JPEG,.png,.PNG,.gif,.GIF" onchange="angular.element(this).scope().uploadImage()"/>
  51. <label for="upload-image" class="btn btn-primary"><span>选择文件&hellip;</span></label>
  52. </div>
  53. <div class="form-group" ng-class="{'has-success' : titlePassed}">
  54. <label for="image-title">提示文本:</label>
  55. <input type="text" class="form-control" ng-model="data.title" ng-blur="titlePassed = true" id="image-title" placeholder="选填:鼠标在图片上悬停时提示的文本">
  56. </div>
  57. <div class="form-group">
  58. <label for="image-preview">图片预览:</label>
  59. <img class="image-preview" id="image-preview" ng-src="{{ data.url }}" title="{{ data.title }}" alt="{{ data.title }}"/>
  60. </div>
  61. </form>
  62. </tab>
  63. </tabset>
  64. </div>
  65. <div class="modal-footer">
  66. <button class="btn btn-primary" ng-click="ok()">确定</button>
  67. <button class="btn btn-warning" ng-click="cancel()">取消</button>
  68. </div>