fixed hierarchy error
This commit is contained in:
parent
386cfee85a
commit
3e37a90153
4
app.moon
4
app.moon
@ -21,8 +21,8 @@ class extends lapis.Application
|
|||||||
return redirect_to: @url_for "tracks"
|
return redirect_to: @url_for "tracks"
|
||||||
POST: =>
|
POST: =>
|
||||||
if track = update_track(@params)
|
if track = update_track(@params)
|
||||||
-- return redirect_to: @url_for "track", id: track.id
|
return redirect_to: @url_for "track", id: track.id
|
||||||
return redirect_to: @url_for "track", id: @params.id
|
-- return redirect_to: @url_for "track", id: @params.id
|
||||||
else
|
else
|
||||||
return redirect_to: @url_for "tracks"
|
return redirect_to: @url_for "tracks"
|
||||||
}
|
}
|
||||||
|
12
helpers.moon
12
helpers.moon
@ -18,7 +18,7 @@ update_track = (user_input) ->
|
|||||||
updates = {}
|
updates = {}
|
||||||
-- automatic tags
|
-- automatic tags
|
||||||
for field in *{"artist", "mood", "link", "genre"}
|
for field in *{"artist", "mood", "link", "genre"}
|
||||||
if user_input[field] and #user_input[field] > 0 -- NOTE includes fix
|
if user_input[field] and #user_input[field] > 0
|
||||||
if user_input.tags
|
if user_input.tags
|
||||||
user_input.tags ..= " #{field}:#{user_input[field]\gsub "%s+", "_"}"
|
user_input.tags ..= " #{field}:#{user_input[field]\gsub "%s+", "_"}"
|
||||||
else
|
else
|
||||||
@ -38,11 +38,11 @@ update_track = (user_input) ->
|
|||||||
else
|
else
|
||||||
updates[field] = trim user_input[field]
|
updates[field] = trim user_input[field]
|
||||||
|
|
||||||
if user_input.id
|
if user_input.id
|
||||||
if track = Tracks\find id: tonumber user_input.id
|
if track = Tracks\find id: tonumber user_input.id
|
||||||
return track\update updates
|
return track\update updates
|
||||||
else
|
else
|
||||||
return Tracks\create updates
|
return Tracks\create updates
|
||||||
|
|
||||||
return {
|
return {
|
||||||
:process_tags
|
:process_tags
|
||||||
|
Reference in New Issue
Block a user