@@ -9,7 +9,7 @@ class ArticlesController < ApplicationController
9
9
include WatchersHelper
10
10
11
11
before_filter :find_project_by_project_id , :authorize
12
- before_filter :get_article , :only => [ :add_attachment , :show , :edit , :update , :add_comment , :destroy , :destroy_comment , :diff , :revert , :version ]
12
+ before_filter :get_article , :except => [ :index , :new , :create , :preview , :comment , :tagged , :rate ]
13
13
14
14
rescue_from ActionView ::MissingTemplate , :with => :force_404
15
15
rescue_from ActiveRecord ::RecordNotFound , :with => :force_404
@@ -53,7 +53,7 @@ def create
53
53
@article = KbArticle . new ( params [ :article ] )
54
54
@article . category_id = params [ :category_id ]
55
55
@article . author_id = User . current . id
56
- @article . project_id = KbCategory . find ( params [ :category_id ] ) . project_id
56
+ @article . project_id = KbCategory . find ( params [ :category_id ] ) . project_id
57
57
@categories = @project . categories . find ( :all )
58
58
# don't keep previous comment
59
59
@article . version_comments = params [ :article ] [ :version_comments ]
@@ -116,14 +116,14 @@ def add_comment
116
116
show
117
117
render :action => 'show'
118
118
end
119
- end
119
+ end
120
120
end
121
121
122
122
def destroy_comment
123
123
@article . without_locking do
124
124
@article . comments . find ( params [ :comment_id ] ) . destroy
125
125
redirect_to :action => 'show' , :id => @article , :project_id => @project
126
- end
126
+ end
127
127
end
128
128
129
129
def destroy
@@ -140,13 +140,10 @@ def add_attachment
140
140
141
141
def tagged
142
142
@tag = params [ :id ]
143
- my_direction = params [ :direction ]
144
- my_sort = params [ :sort ]
145
- if my_sort && my_direction
146
- my_order = "#{ my_sort } #{ my_direction } "
147
- @list = @project . articles . order ( my_order ) . tagged_with ( @tag )
143
+ @list = if params [ :sort ] && params [ :direction ]
144
+ @project . articles . order ( "#{ params [ :sort ] } #{ params [ :direction ] } " ) . tagged_with ( @tag )
148
145
else
149
- @list = @ project. articles . tagged_with ( @tag )
146
+ @project . articles . tagged_with ( @tag )
150
147
end
151
148
end
152
149
0 commit comments