Skip to content

Commit

Permalink
should be fixing issues with card stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
TangentFoxy committed Feb 2, 2017
1 parent 184c405 commit 55e9d13
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 4 additions & 1 deletion 1000cards.moon
Expand Up @@ -21,7 +21,7 @@ class extends lapis.Application
div class: "pure-u-1 pure-u-sm-1-2 pure-u-md-1-3 pure-u-lg-1-4 pure-u-xl-1-6", ->
-- id, user_id, title, artwork, description, point_value, rating
h2 card.title
img src: card.artwork
img src: card.artwork, width: 400, height: 400
div card.description
div class: "card_bottom", ->
div class: "left", card.point_value
Expand Down Expand Up @@ -63,6 +63,7 @@ class extends lapis.Application

--TODO turn this kind of code into a utility thing for verifying images
-- (and just check MIME types already ?)
-- this code should also be in the model, not here
if @params.artwork\len! > 0
if @params.artwork\sub(1, 7) == "http://"
@params.artwork = "https://#{@params.artwork\sub 8}"
Expand All @@ -86,6 +87,8 @@ class extends lapis.Application
if http_status == 404 or http_status == 403 or http_status == 500 or http_status == 301 or http_status == 302
@session.info = "Card submission failed: Artwork URL is invalid."
return redirect_to: @url_for "cards_1000_create"
else
@params.artwork = "https://guard13007.com/static/img/aaa-1x1.png"

card, errMsg = Cards\create {
user_id: @session.id
Expand Down
3 changes: 3 additions & 0 deletions migrations.moon
Expand Up @@ -169,4 +169,7 @@ import create_table, types, drop_table, add_column, rename_column from require "
{"created_at", types.time}
{"updated_at", types.time}
}
[22]: =>
-- no idea if it will work, here goes! :D
db.query "UPDATE cards SET artwork = 'https://guard13007.com/static/img/aaa-1x1.png' WHERE artwork = ''"
}

0 comments on commit 55e9d13

Please sign in to comment.