Commit a39d179 1 parent 886011d commit a39d179 Copy full SHA for a39d179
File tree 3 files changed +4
-9
lines changed
3 files changed +4
-9
lines changed Original file line number Diff line number Diff line change @@ -249,9 +249,7 @@ def update
249
249
250
250
# Limiting the conditions under which you can update the tag type
251
251
types = logged_in_as_admin? ? Tag ::TYPES : Tag ::USER_DEFINED
252
- if @tag . can_change_type? && ( types + %w( UnsortedTag ) ) . include? ( new_tag_type )
253
- @tag = @tag . recategorize ( new_tag_type )
254
- end
252
+ @tag = @tag . recategorize ( new_tag_type ) if @tag . can_change_type? && ( types + %w[ UnsortedTag ] ) . include? ( new_tag_type )
255
253
256
254
unless params [ :tag ] . empty?
257
255
@tag . attributes = tag_params
Original file line number Diff line number Diff line change @@ -19,11 +19,8 @@ def mass_update
19
19
tags = UnsortedTag . where ( id : params [ :tags ] . keys )
20
20
tags . each do |tag |
21
21
new_type = params [ :tags ] [ tag . id . to_s ]
22
- if Tag ::USER_DEFINED . include? ( new_type )
23
- tag . update_attribute ( :type , new_type )
24
- else
25
- raise ts ( "#{ new_type } is not a valid tag type" )
26
- end
22
+ raise "#{ new_type } is not a valid tag type" unless Tag ::USER_DEFINED . include? ( new_type )
23
+ tag . update_attribute ( :type , new_type )
27
24
end
28
25
flash [ :notice ] = ts ( "Tags were successfully sorted." )
29
26
end
Original file line number Diff line number Diff line change 50
50
<% types = logged_in_as_admin? ? Tag ::TYPES : Tag ::USER_DEFINED %>
51
51
<% if @tag . can_change_type? %>
52
52
<%= f . select :type ,
53
- options_for_select ( types + %w( UnsortedTag ) ,
53
+ options_for_select ( types + %w[ UnsortedTag ] ,
54
54
@tag . type . to_s ) %>
55
55
<% else %>
56
56
< strong > <%= ts ( "%{tag_type}" , tag_type : tag_type_label_name ( @tag . type . tableize ) ) %> </ strong >
You can’t perform that action at this time.
0 commit comments