omassot 7 anni fa
parent
commit
200283eb7d
4 ha cambiato i file con 47 aggiunte e 2 eliminazioni
  1. 4 0
      main/static/css/custom.css
  2. 41 0
      main/static/js/custom.js
  3. 1 1
      main/templates/story_index.html
  4. 1 1
      main/views.py

+ 4 - 0
main/static/css/custom.css

@@ -170,6 +170,10 @@ select[multiple] option {
 
 /* Main Header */
 
+#header {
+	z-index: 1000 !important;
+}
+
 #header .right {
 	display: flex;
 	flex-direction: row;

+ 41 - 0
main/static/js/custom.js

@@ -63,6 +63,47 @@ $(document).ready( function () {
 		window.location.href = target;
 	});
 	
+	$('#new-story').on('click', function(event) {
+		
+		event.preventDefault();
+		
+		var filters = [];
+		var filtersbar = $('#stories > .filters-bar');
+		
+		filtersbar.children('select').each(function () {
+			if (this.value.length > 0) {
+				filters.push($(this).data('filter') + "=" + $(this).val());
+			}
+		});
+		
+		var url = $('#new-story').attr('href');
+		var target = url.split('?')[0];
+		if (filters.length > 0) {
+			target = target + '?' + filters.join('&');
+		}
+		window.location.href = target;
+	});
+	
+	var getUrlParameter = function getUrlParameter(sParam) {
+	    var sPageURL = window.location.search.substring(1),
+	        sURLVariables = sPageURL.split('&'),
+	        sParameterName,
+	        i;
+
+	    for (i = 0; i < sURLVariables.length; i++) {
+	        sParameterName = sURLVariables[i].split('=');
+
+	        if (sParameterName[0] === sParam) {
+	            return sParameterName[1] === undefined ? true : decodeURIComponent(sParameterName[1]);
+	        }
+	    }
+	};
+	
+	$('#id_epic').val([getUrlParameter('epic')])
+	$('#id_name').val([getUrlParameter('name')])
+	$('#id_weight').val([getUrlParameter('weight')])
+	$('#id_assignees').val([getUrlParameter('assignee')])
+	$('#id_sprints').val([getUrlParameter('sprint')])
 	
 	$(document).on('click', function(event) {
 	    if(!$(event.target).closest('#user-panel').length) {

+ 1 - 1
main/templates/story_index.html

@@ -15,7 +15,7 @@
 		<h2 class="flex-extend">Stories</h2>
 		<b style="margin-right: 20px;">Nombre: {{ count }}</b>
 		<b style="margin-right: 25px;">Poids: {{ total_weight }}</b>
-		<a class="button icon fa-plus tool-btn alt" href="{% url 'story_create' %}" title="Nouvelle Story">Nouvelle Story</a>
+		<a id="new-story" class="button icon fa-plus tool-btn alt" href="{% url 'story_create' %}" title="Nouvelle Story">Nouvelle Story</a>
 	</header>
 
 	<div id="stories">

+ 1 - 1
main/views.py

@@ -144,7 +144,7 @@ def story_create(request, epic_id=None):
     else:
         story = Story()
         if epic_id is not None:
-            story.epic = get_object_or_404(Epic, id=epic_id)
+            story.epic = get_object_or_404(Epic, id=epic_id)           
         story.author = User.objects.get(username=request.user)
         form = StoryForm(instance=story)