diff options
author | Mike Crute <mcrute@gmail.com> | 2010-07-10 23:53:54 -0400 |
---|---|---|
committer | Mike Crute <mcrute@gmail.com> | 2010-07-10 23:53:54 -0400 |
commit | 1093383ae03816387956b1c21e3799029fda0721 (patch) | |
tree | 2e48f27b0fd028925da1bef52250114ad7c48417 | |
parent | 8bfbe74dcd1a377461a944884965d60da35fa1a1 (diff) | |
download | snakeplan-1093383ae03816387956b1c21e3799029fda0721.tar.bz2 snakeplan-1093383ae03816387956b1c21e3799029fda0721.tar.xz snakeplan-1093383ae03816387956b1c21e3799029fda0721.zip |
Getting project add and update working.
-rw-r--r-- | snakeplan/projects/forms.py | 29 | ||||
-rw-r--r-- | snakeplan/projects/views/projects.py | 55 | ||||
-rw-r--r-- | snakeplan/templates/base.html | 3 | ||||
-rw-r--r-- | snakeplan/templates/media/css/screen.css | 53 | ||||
-rw-r--r-- | snakeplan/templates/projects/iteration_list.html | 2 | ||||
-rw-r--r-- | snakeplan/templates/projects/project_form.html | 14 | ||||
-rw-r--r-- | snakeplan/templates/projects/project_list.html | 3 |
7 files changed, 101 insertions, 58 deletions
diff --git a/snakeplan/projects/forms.py b/snakeplan/projects/forms.py deleted file mode 100644 index d74d9b1..0000000 --- a/snakeplan/projects/forms.py +++ /dev/null | |||
@@ -1,29 +0,0 @@ | |||
1 | # vim: set filencoding=utf8 | ||
2 | """ | ||
3 | SnakePlan Forms | ||
4 | |||
5 | @author: Mike Crute (mcrute@gmail.com) | ||
6 | @date: July 09, 2010 | ||
7 | """ | ||
8 | |||
9 | # Licensed under the Apache License, Version 2.0 (the "License"); | ||
10 | # you may not use this file except in compliance with the License. | ||
11 | # You may obtain a copy of the License at | ||
12 | # | ||
13 | # http://www.apache.org/licenses/LICENSE-2.0 | ||
14 | # | ||
15 | # Unless required by applicable law or agreed to in writing, software | ||
16 | # distributed under the License is distributed on an "AS IS" BASIS, | ||
17 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
18 | # See the License for the specific language governing permissions and | ||
19 | # limitations under the License. | ||
20 | |||
21 | from django.forms import ModelForm | ||
22 | |||
23 | import models as project_models | ||
24 | |||
25 | |||
26 | class ProjectForm(ModelForm): | ||
27 | |||
28 | class Meta: | ||
29 | model = project_models.Project | ||
diff --git a/snakeplan/projects/views/projects.py b/snakeplan/projects/views/projects.py index 8fb68c8..ca61cf5 100644 --- a/snakeplan/projects/views/projects.py +++ b/snakeplan/projects/views/projects.py | |||
@@ -1,34 +1,49 @@ | |||
1 | # vim: set filencoding=utf8 | ||
2 | """ | ||
3 | Project Views | ||
4 | |||
5 | @author: Mike Crute (mcrute@gmail.com) | ||
6 | @organization: SoftGroup Interactive, Inc. | ||
7 | @date: July 10, 2010 | ||
8 | """ | ||
9 | |||
10 | # Licensed under the Apache License, Version 2.0 (the "License"); | ||
11 | # you may not use this file except in compliance with the License. | ||
12 | # You may obtain a copy of the License at | ||
13 | # | ||
14 | # http://www.apache.org/licenses/LICENSE-2.0 | ||
15 | # | ||
16 | # Unless required by applicable law or agreed to in writing, software | ||
17 | # distributed under the License is distributed on an "AS IS" BASIS, | ||
18 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
19 | # See the License for the specific language governing permissions and | ||
20 | # limitations under the License. | ||
21 | |||
1 | from django.views.generic import list_detail, create_update | 22 | from django.views.generic import list_detail, create_update |
2 | from django.core.urlresolvers import reverse | 23 | from django.core.urlresolvers import reverse |
3 | 24 | ||
4 | from snakeplan.projects.models import Project | 25 | from ..models import Project, Iteration |
5 | from snakeplan.projects.models import Iteration | ||
6 | from snakeplan.projects.forms import ProjectForm | ||
7 | |||
8 | 26 | ||
9 | 27 | ||
10 | def index(request): | 28 | def index(request): |
11 | return list_detail.object_list( | 29 | return list_detail.object_list(request, |
12 | request=request, | 30 | queryset=Project.objects.order_by('-active', 'name').all()) |
13 | queryset=Project.objects.order_by('-active', 'name').all(), | ||
14 | allow_empty=True | ||
15 | ) | ||
16 | 31 | ||
17 | 32 | ||
18 | def project_iterations(request, project_id): | 33 | def project_iterations(request, project_id): |
19 | project = Project.objects.get(id=project_id) | 34 | project = Project.objects.get(id=project_id) |
20 | iterations = project.iteration_set.all() | ||
21 | 35 | ||
22 | return list_detail.object_list( | 36 | return list_detail.object_list(request, |
23 | request=request, | 37 | extra_context={'project_name': project.name }, |
24 | queryset=iterations, | 38 | queryset=project.iteration_set.all()) |
25 | extra_context={'project_name': project}, | ||
26 | allow_empty=True | ||
27 | ) | ||
28 | 39 | ||
29 | 40 | ||
30 | def create_project(request): | 41 | def create_project(request): |
31 | post_save_redirect = '/project/%(id)s/' | 42 | return create_update.create_object(request, model=Project, |
32 | return create_update.create_object(request, | 43 | post_save_redirect=reverse('project-list')) |
33 | form_class=ProjectForm, | 44 | |
34 | post_save_redirect=post_save_redirect) | 45 | |
46 | def update_project(request, project_id): | ||
47 | return create_update.update_object(request, model=Project, | ||
48 | object_id=project_id, | ||
49 | post_save_redirect=reverse('project-list')) | ||
diff --git a/snakeplan/templates/base.html b/snakeplan/templates/base.html index 4506d5f..9ab9cac 100644 --- a/snakeplan/templates/base.html +++ b/snakeplan/templates/base.html | |||
@@ -3,6 +3,7 @@ | |||
3 | <head> | 3 | <head> |
4 | <title>{% block title %}{% endblock %} - SnakePlan</title> | 4 | <title>{% block title %}{% endblock %} - SnakePlan</title> |
5 | <link rel="stylesheet" href="{{MEDIA_URL}}/css/screen.css" type="text/css" media="screen, projection" /> | 5 | <link rel="stylesheet" href="{{MEDIA_URL}}/css/screen.css" type="text/css" media="screen, projection" /> |
6 | <!-- Enough is enough! I have had it with these motherfucking snakes on this motherfucking plan! --> | ||
6 | </head> | 7 | </head> |
7 | 8 | ||
8 | <body> | 9 | <body> |
@@ -15,4 +16,6 @@ | |||
15 | 16 | ||
16 | {% block content %}{% endblock %} | 17 | {% block content %}{% endblock %} |
17 | </body> | 18 | </body> |
19 | |||
20 | <p class="copyright">SnakePlan is open-source under the Apache License. You can play with the snake, he won't bite.</p> | ||
18 | </html> | 21 | </html> |
diff --git a/snakeplan/templates/media/css/screen.css b/snakeplan/templates/media/css/screen.css index c133323..fe141c5 100644 --- a/snakeplan/templates/media/css/screen.css +++ b/snakeplan/templates/media/css/screen.css | |||
@@ -16,6 +16,11 @@ a { | |||
16 | color: #00F; | 16 | color: #00F; |
17 | } | 17 | } |
18 | 18 | ||
19 | form, table, .action-bar { | ||
20 | width: 75%; | ||
21 | margin: auto; | ||
22 | } | ||
23 | |||
19 | table { | 24 | table { |
20 | margin: auto; | 25 | margin: auto; |
21 | border: 1px solid #CCC; | 26 | border: 1px solid #CCC; |
@@ -33,12 +38,17 @@ th { | |||
33 | border-bottom: 1px solid black; | 38 | border-bottom: 1px solid black; |
34 | } | 39 | } |
35 | 40 | ||
41 | .copyright { | ||
42 | text-align: center; | ||
43 | font-size: 0.8em; | ||
44 | color: #999; | ||
45 | } | ||
46 | |||
36 | .row-actions { | 47 | .row-actions { |
37 | text-align: center; | 48 | text-align: center; |
38 | } | 49 | } |
39 | 50 | ||
40 | .action-bar { | 51 | .action-bar { |
41 | width: 75%; | ||
42 | margin: 10px auto; | 52 | margin: 10px auto; |
43 | padding: 0px; | 53 | padding: 0px; |
44 | list-style: none; | 54 | list-style: none; |
@@ -60,6 +70,10 @@ a.action img { | |||
60 | vertical-align: middle; | 70 | vertical-align: middle; |
61 | } | 71 | } |
62 | 72 | ||
73 | |||
74 | /********************************************************************* | ||
75 | * Messages * | ||
76 | *********************************************************************/ | ||
63 | div.warning { | 77 | div.warning { |
64 | border-color: #FC3; | 78 | border-color: #FC3; |
65 | background: #FF9 url('../images/warning.png'); | 79 | background: #FF9 url('../images/warning.png'); |
@@ -84,7 +98,42 @@ div.user-notice { | |||
84 | background-repeat: no-repeat; | 98 | background-repeat: no-repeat; |
85 | background-position: 20px; | 99 | background-position: 20px; |
86 | } | 100 | } |
87 | 101 | ||
102 | |||
103 | /********************************************************************* | ||
104 | * Forms * | ||
105 | *********************************************************************/ | ||
106 | fieldset ol { | ||
107 | padding: 0; | ||
108 | list-style: none; | ||
109 | } | ||
110 | |||
111 | fieldset ol li { | ||
112 | float: left; | ||
113 | clear: left; | ||
114 | width: 100%; | ||
115 | padding-bottom: 1em; | ||
116 | } | ||
117 | |||
118 | fieldset label { | ||
119 | float: left; | ||
120 | width: 10em; | ||
121 | margin-right: 1em; | ||
122 | text-align: right; | ||
123 | } | ||
124 | |||
125 | fieldset { | ||
126 | border: 0; | ||
127 | } | ||
128 | |||
129 | fieldset.submit { | ||
130 | padding-left: 10em; | ||
131 | } | ||
132 | |||
133 | fieldset legend { | ||
134 | display: none; | ||
135 | } | ||
136 | |||
88 | 137 | ||
89 | /********************************************************************* | 138 | /********************************************************************* |
90 | * Projects * | 139 | * Projects * |
diff --git a/snakeplan/templates/projects/iteration_list.html b/snakeplan/templates/projects/iteration_list.html index 4e42b52..be01bf4 100644 --- a/snakeplan/templates/projects/iteration_list.html +++ b/snakeplan/templates/projects/iteration_list.html | |||
@@ -19,7 +19,7 @@ | |||
19 | </tr> | 19 | </tr> |
20 | {% for iteration in object_list %} | 20 | {% for iteration in object_list %} |
21 | <tr> | 21 | <tr> |
22 | <td><a href="/p/iteration/{{iteration.id}}/stories/">{{iteration.name}}</a></td> | 22 | <td><a href="{% url iteration-stories iteration.project.id iteration.id %}">{{iteration.name}}</a></td> |
23 | <td>{{iteration.description}}</td> | 23 | <td>{{iteration.description}}</td> |
24 | <td>{{iteration.start_date}}</td> | 24 | <td>{{iteration.start_date}}</td> |
25 | <td>{{iteration.end_date}}</td> | 25 | <td>{{iteration.end_date}}</td> |
diff --git a/snakeplan/templates/projects/project_form.html b/snakeplan/templates/projects/project_form.html index 0e6a574..ca18ced 100644 --- a/snakeplan/templates/projects/project_form.html +++ b/snakeplan/templates/projects/project_form.html | |||
@@ -5,9 +5,15 @@ | |||
5 | 5 | ||
6 | {% block content %} | 6 | {% block content %} |
7 | <form action="" method="POST"> | 7 | <form action="" method="POST"> |
8 | <ul> | 8 | <fieldset> |
9 | {{ form.as_ul }} | 9 | <legend>Create Project</legend> |
10 | </ul> | 10 | <ol> |
11 | <input type="submit" value="Save"/> | 11 | {{ form.as_ul }} |
12 | </ol> | ||
13 | </fieldset> | ||
14 | |||
15 | <fieldset class="submit"> | ||
16 | <input type="submit" value="Create Project"/> | ||
17 | </fieldset> | ||
12 | </form> | 18 | </form> |
13 | {% endblock %} | 19 | {% endblock %} |
diff --git a/snakeplan/templates/projects/project_list.html b/snakeplan/templates/projects/project_list.html index 8572bc6..85b2bb5 100644 --- a/snakeplan/templates/projects/project_list.html +++ b/snakeplan/templates/projects/project_list.html | |||
@@ -27,8 +27,7 @@ | |||
27 | <td>some, tags, go, here</td> | 27 | <td>some, tags, go, here</td> |
28 | <td><a href="#">Some Iteration</a></td> | 28 | <td><a href="#">Some Iteration</a></td> |
29 | <td class="row-actions"> | 29 | <td class="row-actions"> |
30 | <a href="#"><img src="{{MEDIA_URL}}/images/pencil.png" title="Edit" alt="Edit" /></a> | 30 | <a href="{% url edit-project project.id %}"><img src="{{MEDIA_URL}}/images/pencil.png" title="Edit" alt="Edit" /></a> |
31 | <a href="#"><img src="{{MEDIA_URL}}/images/delete.png" title="Delete" alt="Delete" /></a> | ||
32 | 31 | ||
33 | {% if not project.active %} | 32 | {% if not project.active %} |
34 | <a href="#"><img src="{{MEDIA_URL}}/images/connect.png" title="Activate" alt="Activate" /></a> | 33 | <a href="#"><img src="{{MEDIA_URL}}/images/connect.png" title="Activate" alt="Activate" /></a> |