1
1

project-settings-window.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. <template>
  2. <div class="project-settings-window">
  3. <h1>Project Settings</h1>
  4. <div class="content">
  5. <text-input placeholder="Name"
  6. :value="name"
  7. @input="nameF"
  8. :error="nameError"
  9. @clearError="nameError = false">
  10. Name
  11. </text-input>
  12. <textarea-input placeholder="Description"
  13. :value="description"
  14. @input="descriptionF"
  15. :error="descriptionError"
  16. @clearError="descriptionError = false">
  17. Description
  18. </textarea-input>
  19. <div class="text">Delete Project</div>
  20. <confirmed-button-input @click="deleteProject">
  21. <template v-slot:first>
  22. <button-input>
  23. Delete Project
  24. </button-input>
  25. </template>
  26. <template v-slot:second>
  27. <button-input type="error">
  28. Do you really want to delete this project? <br>
  29. This cannot be undone.
  30. </button-input>
  31. </template>
  32. </confirmed-button-input>
  33. </div>
  34. </div>
  35. </template>
  36. <script>
  37. import TextInput from "@/components/base/text-input";
  38. import TextareaInput from "@/components/base/textarea-input";
  39. import ConfirmedButtonInput from "@/components/base/confirmed-button-input";
  40. import ButtonInput from "@/components/base/button-input";
  41. export default {
  42. name: "project-settings-window",
  43. components: {ButtonInput, ConfirmedButtonInput, TextareaInput, TextInput},
  44. props: ['currentProject', 'socket'],
  45. data: function() {
  46. return {
  47. project: null,
  48. name: '',
  49. nameError: false,
  50. description: '',
  51. descriptionError: false
  52. }
  53. },
  54. computed: {
  55. path: function() {
  56. return '/projects/' + this.currentProject.id;
  57. }
  58. },
  59. methods: {
  60. nameF: function(value) {
  61. // TODO then / error
  62. this.socket.post(this.path, {
  63. name: value
  64. });
  65. },
  66. descriptionF: function(value) {
  67. // TODO then / error
  68. this.socket.post(this.path, {
  69. description: value
  70. });
  71. },
  72. deleteProject: function() {
  73. // TODO then / error
  74. this.socket.post(this.path, {
  75. delete: true
  76. });
  77. this.$emit('close', true);
  78. }
  79. },
  80. created: function() {
  81. this.name = this.currentProject.name;
  82. this.description = this.currentProject.description;
  83. }
  84. }
  85. </script>
  86. <style scoped>
  87. .project-settings-window {
  88. padding: 1rem;
  89. }
  90. h1 {
  91. margin: 0;
  92. font-family: "Roboto Condensed";
  93. text-overflow: ellipsis;
  94. width: 100%;
  95. white-space: nowrap;
  96. overflow: hidden;
  97. }
  98. .content {
  99. overflow: auto;
  100. flex-grow: 1;
  101. }
  102. .content > * {
  103. margin-bottom: 0.6rem;
  104. }
  105. .content > div.text {
  106. margin-bottom: 0.2rem;
  107. font-size: 80%;
  108. }
  109. /deep/ .content textarea {
  110. height: 4rem;
  111. }
  112. </style>