badge_create.tpl 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. <script>
  2. (function () {
  3. var designer = null;
  4. $(document).on('ready', function () {
  5. $('.help-badges').tooltip();
  6. $('.help-badges-img').tooltip();
  7. });
  8. $(document).on('ready', function () {
  9. $('#btn-open-designer').on('click', function (e) {
  10. e.preventDefault();
  11. var designerUrl = 'https://www.openbadges.me/designer.html?origin={{ _p.web }}';
  12. designerUrl = designerUrl + '&email={{ platformAdminEmail }}';
  13. designerUrl = designerUrl + '&close=true';
  14. designerUrl = designerUrl + '&hidePublish=true';
  15. var windowOptions = 'width=1200,height=680,location=0,menubar=0,status=0,toolbar=0';
  16. designer = window.open(designerUrl, '', windowOptions);
  17. });
  18. $('#image').on('change', function () {
  19. var self = this;
  20. if (self.files.length > 0) {
  21. var image = self.files[0];
  22. if (!image.type.match(/image.*/)) {
  23. return;
  24. }
  25. var fileReader = new FileReader();
  26. fileReader.onload = function (e) {
  27. $('#badge-preview').attr('src', e.target.result);
  28. $('#badge-container').removeClass('hide');
  29. };
  30. fileReader.readAsDataURL(image);
  31. }
  32. });
  33. });
  34. })();
  35. </script>
  36. <div class="col-md-12">
  37. <div class="openbadges-tabs">
  38. <ul class="nav nav-tabs">
  39. <li>
  40. <a href="{{ _p.web_main }}admin/skill_badge.php">{{ 'Home' | get_lang }}</a>
  41. </li>
  42. <li>
  43. <a href="{{ _p.web_main }}admin/skill_badge_list.php">{{ "CurrentBadges" | get_lang }}</a>
  44. </li>
  45. <li class="active">
  46. <a href="#">{{ 'Edit' | get_lang }}</a>
  47. </li>
  48. </ul>
  49. </div>
  50. <div class="tab-content">
  51. <div class="tab-pane active">
  52. <div class="openbadges-introduction">
  53. <div class="row">
  54. <div class="col-md-12">
  55. <div class="block-edit">
  56. <div class="block-title">{{ 'SkillInfo' | get_lang }}</div>
  57. </div>
  58. </div>
  59. </div>
  60. <div class="row">
  61. <div class="col-md-9">
  62. <form action="{{ _p.web_self_query_vars }}" class="form-horizontal" method="post" enctype="multipart/form-data">
  63. <fieldset>
  64. <div class="form-group">
  65. <label class="col-sm-2 control-label" for="name">{{ 'Name' | get_lang }}</label>
  66. <div class="col-sm-10">
  67. <input type="text" name="name" id="name" class="form-control" value="{{ skill.name }}">
  68. </div>
  69. </div>
  70. <div class="form-group">
  71. <label class="col-sm-2 control-label" for="name">{{ 'Description' | get_lang }}</label>
  72. <div class="col-sm-10">
  73. <textarea name="description" id="description" class="form-control" rows="4">{{ skill.description }}</textarea>
  74. </div>
  75. </div>
  76. <div class="form-group">
  77. <label class="col-sm-2 control-label" for="image">{{ 'Image' | get_lang }}</label>
  78. <div class="col-sm-10">
  79. <input data-placement="left" data-toggle="tooltip" title="{{ "BadgeMeasuresXPixelsInPNG" | get_lang }}" type="file" name="image" id="image" class="help-badges-img" accept="image/*">
  80. </div>
  81. </div>
  82. <div class="form-group">
  83. <label class="col-sm-2 control-label" for="criteria">{{ 'CriteriaToEarnTheBadge' | get_lang }}</label>
  84. <div class="col-sm-10">
  85. <textarea name="criteria" id="criteria" class="form-control" rows="10">{{ skill.criteria }}</textarea>
  86. </div>
  87. </div>
  88. </fieldset>
  89. <div class="form-group">
  90. <div class="col-sm-offset-2 col-sm-10">
  91. <button type="submit" class="btn btn-primary btn-large"><i class="fa fa-floppy-o"></i> {{ 'SaveBadge'| get_lang }}</button>
  92. </div>
  93. </div>
  94. </form>
  95. </div>
  96. <div class="col-md-3">
  97. <div class="create-openbadges">
  98. <button id="btn-open-designer" class="help-badges btn btn-primary btn-large btn-block" data-toggle="tooltip" data-placement="bottom" title="{{ 'DesignANewBadgeComment' | get_lang }}" type="button">
  99. <i class="fa fa-plus"></i> {{ 'DesignNewBadge' | get_lang }}
  100. </button>
  101. </div>
  102. <p class="openbadges-text">{{'BadgePreview' | get_lang }}</p>
  103. <div class="openbadges-img {{ skill.icon ? '' : 'hide' }}" id="badge-container">
  104. <img id="badge-preview" alt="{{ 'BadgePreview' | get_lang }}" src="{{ skill.icon ? skill.web_icon_path : '' }}">
  105. </div>
  106. </div>
  107. </div>
  108. </div>
  109. </div>
  110. </div>
  111. </div>