Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

articlesedit.html 7.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. <div layout="column" ng-cloak class="md-inline-form" angular-busy="appUtils.cgBusy(itemType + '.edit')">
  2. <md-toolbar class="md-table-toolbar md-default" >
  3. <div class="md-toolbar-tools">
  4. <md-button ng-show="!isModal" class="md-icon-button" ng-click="cancel()" title="{{ 'common.back' | translate }}">
  5. <md-icon class="material-icons">arrow_back</md-icon>
  6. </md-button>
  7. <span>{{ isModal ? title : (itemType + '.name' | translate:{count:selected.length}) }}</span>
  8. <span class="has-changed-warning" ng-show="hasChanged()">
  9. <md-icon title="{{ 'common.unsavedChanged' | translate }}" class="material-icons">warning</md-icon>
  10. </span>
  11. <span flex></span>
  12. <md-button class="md-icon-button" ng-show="item.id != null && !isModal" ng-click="askRemoveOne(item)" title="{{ 'common.delete' | translate }}">
  13. <md-icon class="material-icons">delete</md-icon>
  14. </md-button>
  15. </div>
  16. </md-toolbar>
  17. <md-content layout-padding>
  18. <form name="editForm">
  19. <h4 class="md-title">{{ itemType + '.general' | translate }}</h4>
  20. <div layout-gt-sm="row">
  21. <md-input-container class="md-block" flex flex-gt-sm="15" ng-if="item.id != null">
  22. <label>{{ itemType + '.type' | translate }}</label>
  23. <input value="{{ itemType + '.types.' + item.type | translate }}" readonly>
  24. </md-input-container>
  25. <md-input-container class="md-block" flex flex-gt-sm="15" ng-if="item.id == null">
  26. <label>{{ itemType + '.type' | translate }}</label>
  27. <md-select ng-model="item.type" required>
  28. <md-option ng-repeat="type in appUtils.articleTypes" ng-value="type">{{ itemType + '.types.' + type | translate }}</md-option>
  29. </md-select>
  30. </md-input-container>
  31. <md-input-container class="md-block" flex-gt-sm>
  32. <label>{{ itemType + '.title' | translate }}</label>
  33. <input required ng-model="item.title" ng-readonly="item.id != null">
  34. </md-input-container>
  35. </div>
  36. <div layout-gt-sm="row">
  37. <md-input-container class="md-block" flex>
  38. <label>{{ itemType + '.pictureUrl' | translate }}</label>
  39. <input ng-model="item.pictureUrl" >
  40. </md-input-container>
  41. </div>
  42. <div layout="column" layout-align=" center">
  43. <img ng-src="{{item.pictureUrl}}" />
  44. </div>
  45. <div layout-gt-sm="row">
  46. <md-input-container class="md-block" flex>
  47. <label>{{ itemType + '.pictureCaption' | translate }}</label>
  48. <input ng-model="item.pictureCaption" >
  49. </md-input-container>
  50. </div>
  51. <div layout-gt-sm="row">
  52. <md-input-container class="md-block" flex-gt-sm>
  53. <label>{{ itemType + '.text' | translate }}</label>
  54. <textarea ng-model="item.text" required></textarea>
  55. </md-input-container>
  56. </div>
  57. <div layout="row" layout-align=" center">
  58. <h4 class="md-title">{{ itemType + '.fields.name' | translate }}</h4>
  59. <md-button class="md-icon-button no-margin" ng-click="addField()" title="{{ 'common.new' | translate }}">
  60. <md-icon class="material-icons">playlist_add</md-icon>
  61. </md-button>
  62. </div>
  63. <md-table-container ng-show="item.fields.length > 0">
  64. <table md-table>
  65. <thead md-head>
  66. <tr md-row>
  67. <th md-column>{{ itemType + '.fields.type' | translate }}</th>
  68. <th md-column>{{ itemType + '.fields.property' | translate }}</th>
  69. <th md-column>{{ itemType + '.fields.value' | translate }}</th>
  70. <th class="col-icon-1" md-column>{{ 'common.actions' | translate }}</th>
  71. </tr>
  72. </thead>
  73. <tbody md-body>
  74. <tr md-row ng-repeat="field in item.fields track by $index">
  75. <td md-cell>
  76. <md-input-container class="md-block md-input-small" flex>
  77. <md-select ng-model="field.type">
  78. <md-option ng-repeat="type in appUtils.articleFieldTypes" ng-value="type">{{ itemType + '.fields.types.' + type | translate }}</md-option>
  79. </md-select>
  80. </md-input-container>
  81. </td>
  82. <td md-cell>
  83. <md-input-container class="md-block md-input-small" flex>
  84. <md-input-container class="md-block md-input-small" flex>
  85. <md-select ng-model="field.property">
  86. <md-option ng-repeat="prop in appUtils.articleFieldProperties" ng-value="prop">{{ itemType + '.fields.properties.' + prop | translate }}</md-option>
  87. </md-select>
  88. </md-input-container>
  89. </md-input-container>
  90. </td>
  91. <td md-cell>
  92. <md-input-container class="md-block md-input-small" flex>
  93. <input ng-model="field.value" >
  94. </md-input-container>
  95. </td>
  96. <td class="col-icon-1" md-cell>
  97. <md-button class="md-icon-button" ng-click="removeListItem('fields', $index)" title="{{ 'common.delete' | translate }}">
  98. <md-icon class="material-icons">close</md-icon>
  99. </md-button>
  100. </td>
  101. </tr>
  102. </tbody>
  103. </table>
  104. </md-table-container>
  105. <div flex>
  106. <md-progress-linear ng-disabled="!running" md-mode="indeterminate"></md-progress-linear>
  107. </div>
  108. <div flex layout-gt-sm="row" layout-align=" center">
  109. <div layout="column">
  110. <span class="md-caption" ng-show="item.createdAt != null">{{ 'common.createdAt' | translate }} {{ item.createdAt | formatDateTime }}</span>
  111. <span class="md-caption" ng-show="item.updatedAt != null">{{ 'common.updatedAt' | translate }} {{ item.updatedAt | formatDateTime }}</span>
  112. </div>
  113. <span flex></span>
  114. <div>
  115. <md-button ng-show="isModal" class="md-raised" type="button" ng-click="cancel()">{{ 'common.cancel' | translate }}</md-button>
  116. <md-button class="md-raised md-primary" type="submit" ng-click="!editForm.$invalid && submit()">{{ 'common.save' | translate }}</md-button>
  117. </div>
  118. </div>
  119. <div ng-repeat="error in busy.errors(itemType + '.edit')" class="isa_error">
  120. <i class="fa fa-times-circle"></i>
  121. {{ error.data.message }}
  122. </div>
  123. </form>
  124. </md-content>
  125. </div>