You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

130 lines
5.0 KiB

  1. {% extends "base.html" %}
  2. {% load static %}
  3. {% load widget_tweaks %}
  4. {% block content %}
  5. <div id="projects_root" v-cloak>
  6. <section class="hero project-image">
  7. <div class="container">
  8. <div class="columns">
  9. <div class="column is-12">
  10. <h1 class="title is-1 has-text-white">
  11. Hello, {{ user.get_username | title }}.
  12. </h1>
  13. <h2 class="subtitle is-4 has-text-white">
  14. I hope you are having a great day!
  15. </h2>
  16. {% if user.is_superuser %}
  17. <p>
  18. <a class="button is-medium is-primary" @click="isActive=!isActive">
  19. Create Project
  20. </a>
  21. </p>
  22. {% endif %}
  23. </div>
  24. </div>
  25. </div>
  26. </section>
  27. <div class="container">
  28. <div class="columns" style="margin-top:0">
  29. <div class="column is-3">
  30. <aside class="menu">
  31. <p class="menu-label">
  32. Categories
  33. </p>
  34. <ul class="menu-list">
  35. <li>
  36. <a v-bind:class="{active: selectedType == 'All' }" v-on:click="updateSelectedType('All')">All</a>
  37. </li>
  38. <li v-for="t in uniqueProjectTypes">
  39. <a v-bind:class="{active: t == selectedType }" v-on:click="updateSelectedType(t)">[[ t ]]</a>
  40. </li>
  41. </ul>
  42. </aside>
  43. </div>
  44. <div class="column is-9">
  45. <!-- Modal card for creating project. -->
  46. <div class="modal" :class="{ 'is-active': isActive }">
  47. <div class="modal-background"></div>
  48. <div class="modal-card">
  49. <header class="modal-card-head">
  50. <p class="modal-card-title">Create Project</p>
  51. <button class="delete" aria-label="close" @click="isActive=!isActive"></button>
  52. </header>
  53. <form method="post">
  54. {% csrf_token %}
  55. <section class="modal-card-body">
  56. {% for hidden_field in form.hidden_fields %} {{ hidden_field }} {% endfor %} {% for field in form.visible_fields %}
  57. <div class="field">
  58. {{ field.label_tag }}
  59. <div class="control">
  60. {% render_field field class="input select-height" %}
  61. </div>
  62. {% if field.help_text %}
  63. <small class="form-text text-muted">{{ field.help_text }}</small>
  64. {% endif %}
  65. </div>
  66. {% endfor %}
  67. </section>
  68. <footer class="modal-card-foot" style="background-color:#dbdbdb !important;padding:20px !important;">
  69. <button class="button is-primary">Create</button>
  70. <button class="button" @click="isActive=!isActive">Cancel</button>
  71. </footer>
  72. </form>
  73. </div>
  74. </div>
  75. <div class="columns features" v-for="projects in filteredProjects">
  76. <div class="column is-4" v-for="project in projects">
  77. <div class="card is-shady">
  78. <div class="card-image">
  79. <figure class="image is-4by3">
  80. <img v-bind:src="project.image" alt="Placeholder image">
  81. </figure>
  82. </div>
  83. <div class="card-content">
  84. <div class="content">
  85. <h4>
  86. <a v-bind:href="'/projects/' + project.id">[[ project.name ]]</a>
  87. </h4>
  88. <p>
  89. [[ project.description.slice(0, 50) ]]
  90. </p>
  91. </div>
  92. </div>
  93. {% if user.is_superuser %}
  94. <!-- Modal card for creating project. -->
  95. <div class="modal" :class="{ 'is-active': isDelete }">
  96. <div class="modal-background"></div>
  97. <div class="modal-card">
  98. <header class="modal-card-head">
  99. <p class="modal-card-title">Delete Project</p>
  100. <button class="delete" aria-label="close" @click="isDelete=!isDelete"></button>
  101. </header>
  102. <section class="modal-card-body">
  103. Are you sure you want to delete project?
  104. </section>
  105. <footer class="modal-card-foot" style="background-color:#dbdbdb !important;padding:20px !important;">
  106. <button class="button is-danger" @click="deleteProject(project)">Delete</button>
  107. <button class="button" @click="isDelete=!isDelete">Cancel</button>
  108. </footer>
  109. </div>
  110. </div>
  111. <div class="card-footer">
  112. <a v-bind:href="'/projects/' + project.id + '/docs'" class="card-footer-item">Edit</a>
  113. <a href="#1" class="card-footer-item has-text-danger" style="font-weight:700" @click="isDelete=!isDelete">Delete</a>
  114. </div>
  115. {% endif %}
  116. </div>
  117. </div>
  118. </div>
  119. </div>
  120. </div>
  121. </div>
  122. </div>
  123. {% endblock %}
  124. {% block footer %}
  125. <script src="{% static 'bundle/projects.js' %}"></script>
  126. {% endblock %}