public
Description: A bug tracker that makes sense
Clone URL: git://github.com/esad/bbbbug.git
Search Repo:
fixes
oneup (author)
Wed Jun 18 23:38:31 -0700 2008
commit  0fc3e53e29902f949d477bdb83be066b76c3e084
tree    3b9d9d1116ebe29b372f604e4ec1947595055b52
parent  b129f2c9799527c1f1212139d77a40bbd1e03f9b
...
136
137
138
 
 
 
 
 
 
 
139
...
136
137
138
139
140
141
142
143
144
145
146
0
@@ -136,4 +136,11 @@ class EntriesController < ApplicationController
0
       @responsible_user = User.find_by_login for_tag["for:".size, for_tag.size]
0
     end
0
   end
0
+
0
+ def mark_done
0
+ @e = Entry.find params[:id]
0
+ @e.mark_as_done
0
+ @e.save
0
+ redirect_to @e
0
+ end
0
 end
...
8
9
10
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
12
13
14
15
16
 
17
18
19
...
61
62
63
 
 
 
 
 
 
64
65
66
67
 
68
69
70
...
98
99
100
 
 
 
 
 
101
102
...
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
 
31
32
33
34
...
76
77
78
79
80
81
82
83
84
85
86
87
 
88
89
90
91
...
119
120
121
122
123
124
125
126
127
128
0
@@ -8,12 +8,27 @@ class Entry < ActiveRecord::Base
0
   named_scope :projects, :conditions => {:parent_id => nil}
0
   named_scope :topics_for, lambda { |project| {:conditions => {:parent_id => project}, :order => "created_at desc" }}
0
 
0
+ after_save :check_for_commands
0
+
0
+ def check_for_commands
0
+ if is_comment?
0
+ if self.body.include? "#done"
0
+ self.parent.mark_as_done
0
+ self.parent.save!
0
+ end
0
+ end
0
+ end
0
+
0
+ def is_comment?
0
+ self.parent and self.parent.is_tagged_with?("ticket")
0
+ end
0
+
0
   # dubious stuff (aka: to be removed)
0
   def tags_flat
0
     self.tags.map &:name
0
   end
0
   
0
- after_save :uniq_tags
0
+ after_save :uniq_tags
0
   def uniq_tags
0
     self.tags= tags_flat.uniq
0
   end
0
@@ -61,10 +76,16 @@ class Entry < ActiveRecord::Base
0
   def add_tag(tag)
0
     self.tags << Tag.find_or_create_by_name(tag)
0
   end
0
+
0
+ def remove_tag name
0
+ # lol, this is the most horrible way to do this, but i'm drunk.
0
+ t = Tag.find_by_name name
0
+ self.tags.delete(t) if t
0
+ end
0
   
0
   def add_tags(*tags)
0
     Array(tags).flatten.each do |tag|
0
- self.tags << Tag.find_or_create_by_name(tag)
0
+ add_tag(tag)
0
     end
0
   end
0
   
0
@@ -98,4 +119,9 @@ class Entry < ActiveRecord::Base
0
   def is_project?
0
     self.parent.nil?
0
   end
0
+
0
+ def mark_as_done
0
+ remove_tag "open"
0
+ add_tag "done"
0
+ end
0
 end
0
\ No newline at end of file
...
1
2
3
4
 
5
...
 
 
 
 
1
2
0
@@ -1,4 +1 @@
0
-- form_for @e do |f|
0
- -# this validates the prinicple of keeping view and controller logic seperate. LOL!!!!
0
- = f.hidden_field :tags_for_form, :value => "#{@e.tags.map(&:name).reject{|t|t=="open"}.join(" ")} done"
0
- = f.submit "mark as done"
0
+= button_to "mark as done ", mark_done_entry_path(@e)
0
\ No newline at end of file
...
2
3
4
5
6
7
8
9
10
 
 
 
 
 
 
11
...
2
3
4
 
 
 
 
 
5
6
7
8
9
10
11
12
0
@@ -2,8 +2,9 @@
0
 
0
 - area("Projects", "this is a list of projects, very intriguing... right?")
0
 
0
-.list
0
- - for project in @projects
0
- .project{:class => cycle('odd', 'even')}
0
- = link_to project.body, :action => :topics, :id => project
0
- %span.small= reply_count_for(project)
0
\ No newline at end of file
0
+.padded
0
+ .list
0
+ - for project in @projects
0
+ .project{:class => cycle('odd', 'even')}
0
+ = link_to project.body, :action => :topics, :id => project
0
+ %span.small= reply_count_for(project)
0
\ No newline at end of file
...
1
2
3
 
4
5
6
...
1
2
 
3
4
5
6
0
@@ -1,6 +1,6 @@
0
 - area "Thanks!"
0
 
0
-.body
0
+.padded
0
   %h1
0
     Either go to the
0
     = link_to "project", project_path(@topic.parent)
...
3
4
5
6
 
 
7
8
9
...
3
4
5
 
6
7
8
9
10
0
@@ -3,7 +3,8 @@ ActionController::Routing::Routes.draw do |map|
0
                                           :done => :get,
0
                                           :new_project => :get,
0
                                           :assign_to => :put,
0
- :my_done => :get}
0
+ :my_done => :get},
0
+ :member => { :mark_done => :post }
0
 
0
   map.project '/project/:id', :controller => 'entries', :action => 'topics', :method => :get # unsauber und so
0
 

Comments

    No one has commented yet.