diff options
author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2018-07-04 14:42:21 -0400 |
---|---|---|
committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2018-07-04 14:42:21 -0400 |
commit | a70494be4e1767e0cb7ff4218e7f266ece56089c (patch) | |
tree | 9e9c93272e8ed4d55091ba4a61f2787e1229a958 /app/views | |
parent | 006cf8cebfb4e2d2dcfc537b6d3ccaaa14e28cfc (diff) | |
download | pokeviewer-a70494be4e1767e0cb7ff4218e7f266ece56089c.tar.gz pokeviewer-a70494be4e1767e0cb7ff4218e7f266ece56089c.tar.bz2 pokeviewer-a70494be4e1767e0cb7ff4218e7f266ece56089c.zip |
Made pokemon embeddable
Diffstat (limited to 'app/views')
-rw-r--r-- | app/views/pokeviewer/pokemon/_embed_code.html.haml | 1 | ||||
-rw-r--r-- | app/views/pokeviewer/pokemon/_pokemon.html.haml | 135 | ||||
-rw-r--r-- | app/views/pokeviewer/pokemon/embed.html.haml | 15 | ||||
-rw-r--r-- | app/views/pokeviewer/pokemon/show.html.haml | 139 |
4 files changed, 155 insertions, 135 deletions
diff --git a/app/views/pokeviewer/pokemon/_embed_code.html.haml b/app/views/pokeviewer/pokemon/_embed_code.html.haml new file mode 100644 index 0000000..6bbff69 --- /dev/null +++ b/app/views/pokeviewer/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/pokeviewer/pokemon/_pokemon.html.haml b/app/views/pokeviewer/pokemon/_pokemon.html.haml new file mode 100644 index 0000000..573e7eb --- /dev/null +++ b/app/views/pokeviewer/pokemon/_pokemon.html.haml | |||
@@ -0,0 +1,135 @@ | |||
1 | .pokemon{ class: (not @pokemon.trainer.nil?) && "in-#{@pokemon.trainer.game}" } | ||
2 | .pokemon-basics | ||
3 | .pokemon-nameline | ||
4 | = image_tag(@pokemon.pokeball_icon_path, class: "pokemon-ball") | ||
5 | %span.pokemon-name= link_to_unless_current @pokemon.current.nickname, @pokemon | ||
6 | %span.pokemon-gender{ class: @pokemon.gender }= @pokemon.gender_symbol | ||
7 | .pokemon-level= "Lv. #{@pokemon.current.level}" | ||
8 | .pokemon-image | ||
9 | .pokemon-image-wrap | ||
10 | = image_tag @pokemon.current.sprite_path, class: "pokemon-sprite" | ||
11 | - if @pokemon.shiny? | ||
12 | = image_tag "pokeviewer/ShinyIVStar.png", class: "pkv-shiny-star" | ||
13 | - if @pokemon.current.item.nil? | ||
14 | .pokemon-item-label Item | ||
15 | .pokemon-item None | ||
16 | - else | ||
17 | .pokemon-item-label.with-item Item | ||
18 | .pokemon-item.pkv-has-hover | ||
19 | = image_tag(@pokemon.current.item.icon_path) | ||
20 | = @pokemon.current.item.name | ||
21 | .pkv-hover | ||
22 | .pc-data-name= @pokemon.current.item.name | ||
23 | - if @pokemon.current.item.tm? | ||
24 | .pc-move-name= @pokemon.current.item.move.name | ||
25 | = @pokemon.current.item.description(@pokemon.trainer.game) | ||
26 | .pokemon-tab.pokemon-details | ||
27 | %table | ||
28 | %tr | ||
29 | %th Pokédex No. | ||
30 | %td | ||
31 | .table-bubble.tb-top= @pokemon.current.species_id | ||
32 | %tr | ||
33 | %th Name | ||
34 | %td | ||
35 | .table-bubble= @pokemon.current.species.name | ||
36 | %tr | ||
37 | %th Type | ||
38 | %td | ||
39 | .table-bubble | ||
40 | = image_for_type @pokemon.current.species.type_1 | ||
41 | - if @pokemon.current.species.type_2 | ||
42 | = image_for_type @pokemon.current.species.type_2 | ||
43 | %tr | ||
44 | %th OT | ||
45 | %td.ot-gender{ class: @pokemon.ot_gender } | ||
46 | .table-bubble= @pokemon.ot_name | ||
47 | %tr | ||
48 | %th ID No. | ||
49 | %td | ||
50 | .table-bubble.tb-bottom= @pokemon.display_ot_number | ||
51 | %tr | ||
52 | %th | ||
53 | %td | ||
54 | .pokemon-met-label Trainer Memo | ||
55 | .pokemon-description= display_met @pokemon | ||
56 | .pokemon-tab.pokemon-stats | ||
57 | %table | ||
58 | %tr | ||
59 | %th HP | ||
60 | %td | ||
61 | .table-bubble.tb-top= @pokemon.current.hp | ||
62 | %tr | ||
63 | %th | ||
64 | Attack | ||
65 | - if @pokemon.nature_benefits?(:attack) | ||
66 | %span.nature-benefit + | ||
67 | - if @pokemon.nature_hinders?(:attack) | ||
68 | %span.nature-hinder - | ||
69 | %td | ||
70 | .table-bubble= @pokemon.current.attack | ||
71 | %tr | ||
72 | %th | ||
73 | Defense | ||
74 | - if @pokemon.nature_benefits?(:defense) | ||
75 | %span.nature-benefit + | ||
76 | - if @pokemon.nature_hinders?(:defense) | ||
77 | %span.nature-hinder - | ||
78 | %td | ||
79 | .table-bubble= @pokemon.current.defense | ||
80 | %tr | ||
81 | %th | ||
82 | Sp. Atk | ||
83 | - if @pokemon.nature_benefits?(:special_attack) | ||
84 | %span.nature-benefit + | ||
85 | - if @pokemon.nature_hinders?(:special_attack) | ||
86 | %span.nature-hinder - | ||
87 | %td | ||
88 | .table-bubble= @pokemon.current.special_attack | ||
89 | %tr | ||
90 | %th | ||
91 | Sp. Def | ||
92 | - if @pokemon.nature_benefits?(:special_defense) | ||
93 | %span.nature-benefit + | ||
94 | - if @pokemon.nature_hinders?(:special_defense) | ||
95 | %span.nature-hinder - | ||
96 | %td | ||
97 | .table-bubble= @pokemon.current.special_defense | ||
98 | %tr | ||
99 | %th | ||
100 | Speed | ||
101 | - if @pokemon.nature_benefits?(:speed) | ||
102 | %span.nature-benefit + | ||
103 | - if @pokemon.nature_hinders?(:speed) | ||
104 | %span.nature-hinder - | ||
105 | %td | ||
106 | .table-bubble.tb-bottom= @pokemon.current.speed | ||
107 | %tr.pokemon-nature-label | ||
108 | %th{ colspan: 2 } Nature | ||
109 | %tr | ||
110 | %th | ||
111 | %td | ||
112 | .tb-only= @pokemon.nature_text | ||
113 | %tr | ||
114 | %th{ colspan: 2 } Ability | ||
115 | %tr | ||
116 | %th | ||
117 | %td | ||
118 | .tb-only.pkv-has-hover | ||
119 | = @pokemon.current.ability.name | ||
120 | .pkv-hover | ||
121 | .pc-data-name= @pokemon.current.ability.name | ||
122 | = @pokemon.current.ability.description | ||
123 | .pokemon-tab.pokemon-moves | ||
124 | %table | ||
125 | - (1..4).each do |i| | ||
126 | = move_details @pokemon.current, i | ||
127 | .pokemon-tab.pokemon-contest= condition_diagram @pokemon.current | ||
128 | .pokemon-tab.pokemon-ribbons | ||
129 | %ul | ||
130 | - @pokemon.current.ribbons.each do |ribbon| | ||
131 | %li.pkv-has-hover | ||
132 | = image_tag("pokeviewer/ribbons/#{ribbon[:filename]}") | ||
133 | .pkv-hover | ||
134 | .pc-data-name= ribbon[:name] | ||
135 | = ribbon[:description] | ||
diff --git a/app/views/pokeviewer/pokemon/embed.html.haml b/app/views/pokeviewer/pokemon/embed.html.haml new file mode 100644 index 0000000..f4848de --- /dev/null +++ b/app/views/pokeviewer/pokemon/embed.html.haml | |||
@@ -0,0 +1,15 @@ | |||
1 | !!! 5 | ||
2 | %html | ||
3 | %head | ||
4 | %title Pokeviewer | ||
5 | = stylesheet_link_tag "pokeviewer/application", media: "all" | ||
6 | = javascript_include_tag "pokeviewer/application" | ||
7 | = csrf_meta_tags | ||
8 | %body#pokemon-embed | ||
9 | %ul#pokemon-embed-tabs | ||
10 | %li.ptabe-button.ptabe-details= link_to "Details", "\#", data: {tab: "details"} | ||
11 | %li.ptabe-button.ptabe-stats= link_to "Stats", "\#", data: {tab: "stats"} | ||
12 | %li.ptabe-button.ptabe-moves= link_to "Moves", "\#", data: {tab: "moves"} | ||
13 | %li.ptabe-button.ptabe-contest= link_to "Contest", "\#", data: {tab: "contest"} | ||
14 | %li.ptabe-button.ptabe-ribbons= link_to "Ribbons", "\#", data: {tab: "ribbons"} | ||
15 | = render @pokemon | ||
diff --git a/app/views/pokeviewer/pokemon/show.html.haml b/app/views/pokeviewer/pokemon/show.html.haml index 3f2750c..f35f9ed 100644 --- a/app/views/pokeviewer/pokemon/show.html.haml +++ b/app/views/pokeviewer/pokemon/show.html.haml | |||
@@ -1,135 +1,4 @@ | |||
1 | .pokemon{ class: (not @pokemon.trainer.nil?) && "in-#{@pokemon.trainer.game}" } | 1 | = render @pokemon |
2 | .pokemon-basics | 2 | %details#pk-embed-code |
3 | .pokemon-nameline | 3 | %summary Embed code |
4 | = image_tag(@pokemon.pokeball_icon_path, class: "pokemon-ball") | 4 | %textarea{ readonly: true }= CGI.escapeHTML(render partial: "embed_code").html_safe |
5 | %span.pokemon-name= @pokemon.current.nickname | ||
6 | %span.pokemon-gender{ class: @pokemon.gender }= @pokemon.gender_symbol | ||
7 | .pokemon-level= "Lv. #{@pokemon.current.level}" | ||
8 | .pokemon-image | ||
9 | .pokemon-image-wrap | ||
10 | = image_tag @pokemon.current.sprite_path, class: "pokemon-sprite" | ||
11 | - if @pokemon.shiny? | ||
12 | = image_tag "pokeviewer/ShinyIVStar.png", class: "pkv-shiny-star" | ||
13 | - if @pokemon.current.item.nil? | ||
14 | .pokemon-item-label Item | ||
15 | .pokemon-item None | ||
16 | - else | ||
17 | .pokemon-item-label.with-item Item | ||
18 | .pokemon-item.pkv-has-hover | ||
19 | = image_tag(@pokemon.current.item.icon_path) | ||
20 | = @pokemon.current.item.name | ||
21 | .pkv-hover | ||
22 | .pc-data-name= @pokemon.current.item.name | ||
23 | - if @pokemon.current.item.tm? | ||
24 | .pc-move-name= @pokemon.current.item.move.name | ||
25 | = @pokemon.current.item.description(@pokemon.trainer.game) | ||
26 | .pokemon-tab.pokemon-details | ||
27 | %table | ||
28 | %tr | ||
29 | %th Pokédex No. | ||
30 | %td | ||
31 | .table-bubble.tb-top= @pokemon.current.species_id | ||
32 | %tr | ||
33 | %th Name | ||
34 | %td | ||
35 | .table-bubble= @pokemon.current.species.name | ||
36 | %tr | ||
37 | %th Type | ||
38 | %td | ||
39 | .table-bubble | ||
40 | = image_for_type @pokemon.current.species.type_1 | ||
41 | - if @pokemon.current.species.type_2 | ||
42 | = image_for_type @pokemon.current.species.type_2 | ||
43 | %tr | ||
44 | %th OT | ||
45 | %td.ot-gender{ class: @pokemon.ot_gender } | ||
46 | .table-bubble= @pokemon.ot_name | ||
47 | %tr | ||
48 | %th ID No. | ||
49 | %td | ||
50 | .table-bubble.tb-bottom= @pokemon.display_ot_number | ||
51 | %tr | ||
52 | %th | ||
53 | %td | ||
54 | .pokemon-met-label Trainer Memo | ||
55 | .pokemon-description= display_met @pokemon | ||
56 | .pokemon-tab.pokemon-stats | ||
57 | %table | ||
58 | %tr | ||
59 | %th HP | ||
60 | %td | ||
61 | .table-bubble.tb-top= @pokemon.current.hp | ||
62 | %tr | ||
63 | %th | ||
64 | Attack | ||
65 | - if @pokemon.nature_benefits?(:attack) | ||
66 | %span.nature-benefit + | ||
67 | - if @pokemon.nature_hinders?(:attack) | ||
68 | %span.nature-hinder - | ||
69 | %td | ||
70 | .table-bubble= @pokemon.current.attack | ||
71 | %tr | ||
72 | %th | ||
73 | Defense | ||
74 | - if @pokemon.nature_benefits?(:defense) | ||
75 | %span.nature-benefit + | ||
76 | - if @pokemon.nature_hinders?(:defense) | ||
77 | %span.nature-hinder - | ||
78 | %td | ||
79 | .table-bubble= @pokemon.current.defense | ||
80 | %tr | ||
81 | %th | ||
82 | Sp. Atk | ||
83 | - if @pokemon.nature_benefits?(:special_attack) | ||
84 | %span.nature-benefit + | ||
85 | - if @pokemon.nature_hinders?(:special_attack) | ||
86 | %span.nature-hinder - | ||
87 | %td | ||
88 | .table-bubble= @pokemon.current.special_attack | ||
89 | %tr | ||
90 | %th | ||
91 | Sp. Def | ||
92 | - if @pokemon.nature_benefits?(:special_defense) | ||
93 | %span.nature-benefit + | ||
94 | - if @pokemon.nature_hinders?(:special_defense) | ||
95 | %span.nature-hinder - | ||
96 | %td | ||
97 | .table-bubble= @pokemon.current.special_defense | ||
98 | %tr | ||
99 | %th | ||
100 | Speed | ||
101 | - if @pokemon.nature_benefits?(:speed) | ||
102 | %span.nature-benefit + | ||
103 | - if @pokemon.nature_hinders?(:speed) | ||
104 | %span.nature-hinder - | ||
105 | %td | ||
106 | .table-bubble.tb-bottom= @pokemon.current.speed | ||
107 | %tr.pokemon-nature-label | ||
108 | %th{ colspan: 2 } Nature | ||
109 | %tr | ||
110 | %th | ||
111 | %td | ||
112 | .tb-only= @pokemon.nature_text | ||
113 | %tr | ||
114 | %th{ colspan: 2 } Ability | ||
115 | %tr | ||
116 | %th | ||
117 | %td | ||
118 | .tb-only.pkv-has-hover | ||
119 | = @pokemon.current.ability.name | ||
120 | .pkv-hover | ||
121 | .pc-data-name= @pokemon.current.ability.name | ||
122 | = @pokemon.current.ability.description | ||
123 | .pokemon-tab.pokemon-moves | ||
124 | %table | ||
125 | - (1..4).each do |i| | ||
126 | = move_details @pokemon.current, i | ||
127 | .pokemon-tab.pokemon-contest= condition_diagram @pokemon.current | ||
128 | .pokemon-tab.pokemon-ribbons | ||
129 | %ul | ||
130 | - @pokemon.current.ribbons.each do |ribbon| | ||
131 | %li.pkv-has-hover | ||
132 | = image_tag("pokeviewer/ribbons/#{ribbon[:filename]}") | ||
133 | .pkv-hover | ||
134 | .pc-data-name= ribbon[:name] | ||
135 | = ribbon[:description] | ||