From 56f5841d4b9c12296cdfcaeff174b2627d59afc8 Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Sat, 7 Dec 2024 11:49:49 -0500 Subject: Migrate to full rails app --- app/views/layouts/application.html.haml | 11 ++ app/views/layouts/mailer.html.erb | 13 ++ app/views/layouts/mailer.text.erb | 1 + app/views/layouts/pokeviewer/application.html.haml | 9 -- app/views/pokedex/index.html.haml | 4 + app/views/pokemon/_embed_code.html.haml | 1 + app/views/pokemon/embed.html.haml | 17 +++ app/views/pokemon/index.html.haml | 42 +++++++ app/views/pokemon/show.html.haml | 4 + app/views/pokeviewer/pokedex/index.html.haml | 4 - app/views/pokeviewer/pokemon/_embed_code.html.haml | 1 - app/views/pokeviewer/pokemon/embed.html.haml | 15 --- app/views/pokeviewer/pokemon/index.html.haml | 42 ------- app/views/pokeviewer/pokemon/show.html.haml | 4 - app/views/pokeviewer/revisions/_revision.html.haml | 135 --------------------- app/views/revisions/_revision.html.haml | 135 +++++++++++++++++++++ 16 files changed, 228 insertions(+), 210 deletions(-) create mode 100644 app/views/layouts/application.html.haml create mode 100644 app/views/layouts/mailer.html.erb create mode 100644 app/views/layouts/mailer.text.erb delete mode 100644 app/views/layouts/pokeviewer/application.html.haml create mode 100644 app/views/pokedex/index.html.haml create mode 100644 app/views/pokemon/_embed_code.html.haml create mode 100644 app/views/pokemon/embed.html.haml create mode 100644 app/views/pokemon/index.html.haml create mode 100644 app/views/pokemon/show.html.haml delete mode 100644 app/views/pokeviewer/pokedex/index.html.haml delete mode 100644 app/views/pokeviewer/pokemon/_embed_code.html.haml delete mode 100644 app/views/pokeviewer/pokemon/embed.html.haml delete mode 100644 app/views/pokeviewer/pokemon/index.html.haml delete mode 100644 app/views/pokeviewer/pokemon/show.html.haml delete mode 100644 app/views/pokeviewer/revisions/_revision.html.haml create mode 100644 app/views/revisions/_revision.html.haml (limited to 'app/views') diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml new file mode 100644 index 0000000..668b6cd --- /dev/null +++ b/app/views/layouts/application.html.haml @@ -0,0 +1,11 @@ +!!! 5 +%html + %head + %title Pokeviewer + %meta{ name: "viewport", content: "width=device-width,initial-scale=1" } + = stylesheet_link_tag "application", media: "all" + = javascript_include_tag "application" + = csrf_meta_tags + = csp_meta_tag + %body + #content= yield diff --git a/app/views/layouts/mailer.html.erb b/app/views/layouts/mailer.html.erb new file mode 100644 index 0000000..3aac900 --- /dev/null +++ b/app/views/layouts/mailer.html.erb @@ -0,0 +1,13 @@ + + + + + + + + + <%= yield %> + + diff --git a/app/views/layouts/mailer.text.erb b/app/views/layouts/mailer.text.erb new file mode 100644 index 0000000..37f0bdd --- /dev/null +++ b/app/views/layouts/mailer.text.erb @@ -0,0 +1 @@ +<%= yield %> diff --git a/app/views/layouts/pokeviewer/application.html.haml b/app/views/layouts/pokeviewer/application.html.haml deleted file mode 100644 index 4fa0d19..0000000 --- a/app/views/layouts/pokeviewer/application.html.haml +++ /dev/null @@ -1,9 +0,0 @@ -!!! 5 -%html - %head - %title Pokeviewer - = stylesheet_link_tag "pokeviewer/application", media: "all" - = javascript_include_tag "pokeviewer/application" - = csrf_meta_tags - %body - #content= yield diff --git a/app/views/pokedex/index.html.haml b/app/views/pokedex/index.html.haml new file mode 100644 index 0000000..676cd9f --- /dev/null +++ b/app/views/pokedex/index.html.haml @@ -0,0 +1,4 @@ +%h3 Fef's Pokédex +%p The following table shows my progress toward completing the Pokémon National Pokédex in generation III. Because I am playing multiple games, the progress is shown for each specific game. The columns are colored based on what game they are for: dark red for Ruby, dark blue for Sapphire, dark green for Emerald, light red for FireRed, and light green for LeafGreen. The cells also contain the trainer ID for that game. +%p If a cell is grayed out, that means that game has not encountered that Pokémon species yet. If a cell has a colored border but is not filled in, that means that game has seen the given species but not caught it. A filled in cell means that the game has recorded data on that species. If a species has not been seen in any of the save files, the name and image of the species is not shown. += pokedex_table @species, @trainers diff --git a/app/views/pokemon/_embed_code.html.haml b/app/views/pokemon/_embed_code.html.haml new file mode 100644 index 0000000..6bbff69 --- /dev/null +++ b/app/views/pokemon/_embed_code.html.haml @@ -0,0 +1 @@ +%iframe{ src: embed_pokemon_url(@pokemon), frameborder: 0, width: 382, height: 298 } \ No newline at end of file diff --git a/app/views/pokemon/embed.html.haml b/app/views/pokemon/embed.html.haml new file mode 100644 index 0000000..17fc7ba --- /dev/null +++ b/app/views/pokemon/embed.html.haml @@ -0,0 +1,17 @@ +!!! 5 +%html + %head + %title Pokeviewer + %meta{ name: "viewport", content: "width=device-width,initial-scale=1" } + = stylesheet_link_tag "application", media: "all" + = javascript_include_tag "application" + = csrf_meta_tags + = csp_meta_tag + %body#pokemon-embed + %ul#pokemon-embed-tabs + %li.ptabe-button.ptabe-details= link_to "Details", "\#", data: {tab: "details"} + %li.ptabe-button.ptabe-stats= link_to "Stats", "\#", data: {tab: "stats"} + %li.ptabe-button.ptabe-moves= link_to "Moves", "\#", data: {tab: "moves"} + %li.ptabe-button.ptabe-contest= link_to "Contest", "\#", data: {tab: "contest"} + %li.ptabe-button.ptabe-ribbons= link_to "Ribbons", "\#", data: {tab: "ribbons"} + = render @revision diff --git a/app/views/pokemon/index.html.haml b/app/views/pokemon/index.html.haml new file mode 100644 index 0000000..67ea2cf --- /dev/null +++ b/app/views/pokemon/index.html.haml @@ -0,0 +1,42 @@ +- @trainers.each do |trainer, party, boxes| + .trainer + .trainer-info{ class: trainer.game } + %h2= trainer.name + %span.tid= trainer.display_number + .pc-boxes + %ul.party.pc-box + %h3 Party + - party.each do |p| + %li + %span.party-icon= image_tag p.current.icon_path + %span.party-name= link_to p.current.nickname, p + - boxes.each do |box| + .pc-box + %h3= box[:name] + %table.pc-contents + - box[:pokemon].each_slice(6) do |row| + %tr + - row.each do |p| + %td.pc-pokemon.pkv-has-hover + - if p.nil? + .spacer + - else + = link_to image_tag(p.current.icon_path), p + .pc-data.pkv-hover + .pc-data-name= p.current.nickname + .pc-data-ot + OT/ + %span{ class: p.ot_gender }>= p.ot_name +- if @unaccounted.any? + .trainer + .trainer-info.unaccounted + %h2 Pokémon Not In Any Game + %ul.pokemon-list + - @unaccounted.each do |p| + %li.pc-pokemon.pkv-has-hover + = link_to image_tag(p.current.icon_path), p + .pc-data.pkv-hover + .pc-data-name= p.current.nickname + .pc-data-ot + OT/ + %span{ class: p.ot_gender }>= p.ot_name diff --git a/app/views/pokemon/show.html.haml b/app/views/pokemon/show.html.haml new file mode 100644 index 0000000..cbd879b --- /dev/null +++ b/app/views/pokemon/show.html.haml @@ -0,0 +1,4 @@ += render @revision +%details#pk-embed-code + %summary Embed code + %textarea{ readonly: true }= CGI.escapeHTML(render partial: "embed_code").html_safe diff --git a/app/views/pokeviewer/pokedex/index.html.haml b/app/views/pokeviewer/pokedex/index.html.haml deleted file mode 100644 index 676cd9f..0000000 --- a/app/views/pokeviewer/pokedex/index.html.haml +++ /dev/null @@ -1,4 +0,0 @@ -%h3 Fef's Pokédex -%p The following table shows my progress toward completing the Pokémon National Pokédex in generation III. Because I am playing multiple games, the progress is shown for each specific game. The columns are colored based on what game they are for: dark red for Ruby, dark blue for Sapphire, dark green for Emerald, light red for FireRed, and light green for LeafGreen. The cells also contain the trainer ID for that game. -%p If a cell is grayed out, that means that game has not encountered that Pokémon species yet. If a cell has a colored border but is not filled in, that means that game has seen the given species but not caught it. A filled in cell means that the game has recorded data on that species. If a species has not been seen in any of the save files, the name and image of the species is not shown. -= pokedex_table @species, @trainers diff --git a/app/views/pokeviewer/pokemon/_embed_code.html.haml b/app/views/pokeviewer/pokemon/_embed_code.html.haml deleted file mode 100644 index 6bbff69..0000000 --- a/app/views/pokeviewer/pokemon/_embed_code.html.haml +++ /dev/null @@ -1 +0,0 @@ -%iframe{ src: embed_pokemon_url(@pokemon), frameborder: 0, width: 382, height: 298 } \ No newline at end of file diff --git a/app/views/pokeviewer/pokemon/embed.html.haml b/app/views/pokeviewer/pokemon/embed.html.haml deleted file mode 100644 index 3c82052..0000000 --- a/app/views/pokeviewer/pokemon/embed.html.haml +++ /dev/null @@ -1,15 +0,0 @@ -!!! 5 -%html - %head - %title Pokeviewer - = stylesheet_link_tag "pokeviewer/application", media: "all" - = javascript_include_tag "pokeviewer/application" - = csrf_meta_tags - %body#pokemon-embed - %ul#pokemon-embed-tabs - %li.ptabe-button.ptabe-details= link_to "Details", "\#", data: {tab: "details"} - %li.ptabe-button.ptabe-stats= link_to "Stats", "\#", data: {tab: "stats"} - %li.ptabe-button.ptabe-moves= link_to "Moves", "\#", data: {tab: "moves"} - %li.ptabe-button.ptabe-contest= link_to "Contest", "\#", data: {tab: "contest"} - %li.ptabe-button.ptabe-ribbons= link_to "Ribbons", "\#", data: {tab: "ribbons"} - = render @revision diff --git a/app/views/pokeviewer/pokemon/index.html.haml b/app/views/pokeviewer/pokemon/index.html.haml deleted file mode 100644 index 67ea2cf..0000000 --- a/app/views/pokeviewer/pokemon/index.html.haml +++ /dev/null @@ -1,42 +0,0 @@ -- @trainers.each do |trainer, party, boxes| - .trainer - .trainer-info{ class: trainer.game } - %h2= trainer.name - %span.tid= trainer.display_number - .pc-boxes - %ul.party.pc-box - %h3 Party - - party.each do |p| - %li - %span.party-icon= image_tag p.current.icon_path - %span.party-name= link_to p.current.nickname, p - - boxes.each do |box| - .pc-box - %h3= box[:name] - %table.pc-contents - - box[:pokemon].each_slice(6) do |row| - %tr - - row.each do |p| - %td.pc-pokemon.pkv-has-hover - - if p.nil? - .spacer - - else - = link_to image_tag(p.current.icon_path), p - .pc-data.pkv-hover - .pc-data-name= p.current.nickname - .pc-data-ot - OT/ - %span{ class: p.ot_gender }>= p.ot_name -- if @unaccounted.any? - .trainer - .trainer-info.unaccounted - %h2 Pokémon Not In Any Game - %ul.pokemon-list - - @unaccounted.each do |p| - %li.pc-pokemon.pkv-has-hover - = link_to image_tag(p.current.icon_path), p - .pc-data.pkv-hover - .pc-data-name= p.current.nickname - .pc-data-ot - OT/ - %span{ class: p.ot_gender }>= p.ot_name diff --git a/app/views/pokeviewer/pokemon/show.html.haml b/app/views/pokeviewer/pokemon/show.html.haml deleted file mode 100644 index cbd879b..0000000 --- a/app/views/pokeviewer/pokemon/show.html.haml +++ /dev/null @@ -1,4 +0,0 @@ -= render @revision -%details#pk-embed-code - %summary Embed code - %textarea{ readonly: true }= CGI.escapeHTML(render partial: "embed_code").html_safe diff --git a/app/views/pokeviewer/revisions/_revision.html.haml b/app/views/pokeviewer/revisions/_revision.html.haml deleted file mode 100644 index 63ba22c..0000000 --- a/app/views/pokeviewer/revisions/_revision.html.haml +++ /dev/null @@ -1,135 +0,0 @@ -.pokemon{ class: (not @revision.pokemon.trainer.nil?) && "in-#{@revision.pokemon.trainer.game}" } - .pokemon-basics - .pokemon-nameline - = image_tag(@revision.pokemon.pokeball_icon_path, class: "pokemon-ball") - %span.pokemon-name= link_to_unless_current @revision.nickname, @revision.pokemon, target: "_blank" - %span.pokemon-gender{ class: @revision.pokemon.gender }= @revision.pokemon.gender_symbol - .pokemon-level= "Lv. #{@revision.level}" - .pokemon-image - .pokemon-image-wrap - = image_tag @revision.sprite_path, class: "pokemon-sprite" - - if @revision.pokemon.shiny? - = image_tag "pokeviewer/ShinyIVStar.png", class: "pkv-shiny-star" - - if @revision.item.nil? - .pokemon-item-label Item - .pokemon-item None - - else - .pokemon-item-label.with-item Item - .pokemon-item.pkv-has-hover - = image_tag(@revision.item.icon_path) - = @revision.item.name - .pkv-hover - .pc-data-name= @revision.item.name - - if @revision.item.tm? - .pc-move-name= @revision.item.move.name - = @revision.item.description(@revision.pokemon.trainer.game) - .pokemon-tab.pokemon-details - %table - %tr - %th Pokédex No. - %td - .table-bubble.tb-top= @revision.species_id - %tr - %th Name - %td - .table-bubble= @revision.species.name - %tr - %th Type - %td - .table-bubble - = image_for_type @revision.species.type_1 - - if @revision.species.type_2 - = image_for_type @revision.species.type_2 - %tr - %th OT - %td.ot-gender{ class: @revision.pokemon.ot_gender } - .table-bubble= @revision.pokemon.ot_name - %tr - %th ID No. - %td - .table-bubble.tb-bottom= @revision.pokemon.display_ot_number - %tr - %th   - %td - .pokemon-met-label Trainer Memo - .pokemon-description= display_met @revision.pokemon - .pokemon-tab.pokemon-stats - %table - %tr - %th HP - %td - .table-bubble.tb-top= @revision.hp - %tr - %th - Attack - - if @revision.pokemon.nature_benefits?(:attack) - %span.nature-benefit + - - if @revision.pokemon.nature_hinders?(:attack) - %span.nature-hinder - - %td - .table-bubble= @revision.attack - %tr - %th - Defense - - if @revision.pokemon.nature_benefits?(:defense) - %span.nature-benefit + - - if @revision.pokemon.nature_hinders?(:defense) - %span.nature-hinder - - %td - .table-bubble= @revision.defense - %tr - %th - Sp. Atk - - if @revision.pokemon.nature_benefits?(:special_attack) - %span.nature-benefit + - - if @revision.pokemon.nature_hinders?(:special_attack) - %span.nature-hinder - - %td - .table-bubble= @revision.special_attack - %tr - %th - Sp. Def - - if @revision.pokemon.nature_benefits?(:special_defense) - %span.nature-benefit + - - if @revision.pokemon.nature_hinders?(:special_defense) - %span.nature-hinder - - %td - .table-bubble= @revision.special_defense - %tr - %th - Speed - - if @revision.pokemon.nature_benefits?(:speed) - %span.nature-benefit + - - if @revision.pokemon.nature_hinders?(:speed) - %span.nature-hinder - - %td - .table-bubble.tb-bottom= @revision.speed - %tr.pokemon-nature-label - %th{ colspan: 2 } Nature - %tr - %th - %td - .tb-only= @revision.pokemon.nature_text - %tr - %th{ colspan: 2 } Ability - %tr - %th - %td - .tb-only.pkv-has-hover - = @revision.ability.name - .pkv-hover - .pc-data-name= @revision.ability.name - = @revision.ability.description - .pokemon-tab.pokemon-moves - %table - - (1..4).each do |i| - = move_details @revision, i - .pokemon-tab.pokemon-contest= condition_diagram @revision - .pokemon-tab.pokemon-ribbons - %ul - - @revision.ribbons.each do |ribbon| - %li.pkv-has-hover - = image_tag("pokeviewer/ribbons/#{ribbon[:filename]}") - .pkv-hover - .pc-data-name= ribbon[:name] - = ribbon[:description] diff --git a/app/views/revisions/_revision.html.haml b/app/views/revisions/_revision.html.haml new file mode 100644 index 0000000..747c746 --- /dev/null +++ b/app/views/revisions/_revision.html.haml @@ -0,0 +1,135 @@ +.pokemon{ class: (not @revision.pokemon.trainer.nil?) && "in-#{@revision.pokemon.trainer.game}" } + .pokemon-basics + .pokemon-nameline + = image_tag(@revision.pokemon.pokeball_icon_path, class: "pokemon-ball") + %span.pokemon-name= link_to_unless_current @revision.nickname, @revision.pokemon, target: "_blank" + %span.pokemon-gender{ class: @revision.pokemon.gender }= @revision.pokemon.gender_symbol + .pokemon-level= "Lv. #{@revision.level}" + .pokemon-image + .pokemon-image-wrap + = image_tag @revision.sprite_path, class: "pokemon-sprite" + - if @revision.pokemon.shiny? + = image_tag "ShinyIVStar.png", class: "pkv-shiny-star" + - if @revision.item.nil? + .pokemon-item-label Item + .pokemon-item None + - else + .pokemon-item-label.with-item Item + .pokemon-item.pkv-has-hover + = image_tag(@revision.item.icon_path) + = @revision.item.name + .pkv-hover + .pc-data-name= @revision.item.name + - if @revision.item.tm? + .pc-move-name= @revision.item.move.name + = @revision.item.description(@revision.pokemon.trainer.game) + .pokemon-tab.pokemon-details + %table + %tr + %th Pokédex No. + %td + .table-bubble.tb-top= @revision.species_id + %tr + %th Name + %td + .table-bubble= @revision.species.name + %tr + %th Type + %td + .table-bubble + = image_for_type @revision.species.type_1 + - if @revision.species.type_2 + = image_for_type @revision.species.type_2 + %tr + %th OT + %td.ot-gender{ class: @revision.pokemon.ot_gender } + .table-bubble= @revision.pokemon.ot_name + %tr + %th ID No. + %td + .table-bubble.tb-bottom= @revision.pokemon.display_ot_number + %tr + %th   + %td + .pokemon-met-label Trainer Memo + .pokemon-description= display_met @revision.pokemon + .pokemon-tab.pokemon-stats + %table + %tr + %th HP + %td + .table-bubble.tb-top= @revision.hp + %tr + %th + Attack + - if @revision.pokemon.nature_benefits?(:attack) + %span.nature-benefit + + - if @revision.pokemon.nature_hinders?(:attack) + %span.nature-hinder - + %td + .table-bubble= @revision.attack + %tr + %th + Defense + - if @revision.pokemon.nature_benefits?(:defense) + %span.nature-benefit + + - if @revision.pokemon.nature_hinders?(:defense) + %span.nature-hinder - + %td + .table-bubble= @revision.defense + %tr + %th + Sp. Atk + - if @revision.pokemon.nature_benefits?(:special_attack) + %span.nature-benefit + + - if @revision.pokemon.nature_hinders?(:special_attack) + %span.nature-hinder - + %td + .table-bubble= @revision.special_attack + %tr + %th + Sp. Def + - if @revision.pokemon.nature_benefits?(:special_defense) + %span.nature-benefit + + - if @revision.pokemon.nature_hinders?(:special_defense) + %span.nature-hinder - + %td + .table-bubble= @revision.special_defense + %tr + %th + Speed + - if @revision.pokemon.nature_benefits?(:speed) + %span.nature-benefit + + - if @revision.pokemon.nature_hinders?(:speed) + %span.nature-hinder - + %td + .table-bubble.tb-bottom= @revision.speed + %tr.pokemon-nature-label + %th{ colspan: 2 } Nature + %tr + %th + %td + .tb-only= @revision.pokemon.nature_text + %tr + %th{ colspan: 2 } Ability + %tr + %th + %td + .tb-only.pkv-has-hover + = @revision.ability.name + .pkv-hover + .pc-data-name= @revision.ability.name + = @revision.ability.description + .pokemon-tab.pokemon-moves + %table + - (1..4).each do |i| + = move_details @revision, i + .pokemon-tab.pokemon-contest= condition_diagram @revision + .pokemon-tab.pokemon-ribbons + %ul + - @revision.ribbons.each do |ribbon| + %li.pkv-has-hover + = image_tag("ribbons/#{ribbon[:filename]}") + .pkv-hover + .pc-data-name= ribbon[:name] + = ribbon[:description] -- cgit 1.4.1