|
14 | 14 | </div> |
15 | 15 | <% end %> |
16 | 16 |
|
17 | | - <%= if @token == "" do %> |
18 | | - <div class="field"> |
19 | | - <%= label(f, :access, gettext("Access Token"), class: "label") %> |
20 | | - <div class="control has-icons-left"> |
21 | | - <%= text_input(f, :access, |
22 | | - class: "input is-rounded", |
23 | | - autocorrect: "off", |
24 | | - autocapitalize: "none", |
25 | | - spellcheck: "false", |
26 | | - disabled: !!@task |
27 | | - ) %> |
28 | | - <span class="icon is-small is-left"> |
29 | | - <i class="mdi mdi-api"></i> |
30 | | - </span> |
31 | | - </div> |
32 | | - </div> |
33 | | - |
34 | | - <div class="field"> |
35 | | - <%= label(f, :refresh, gettext("Refresh Token"), class: "label") %> |
36 | | - <div class="control has-icons-left"> |
37 | | - <%= text_input(f, :refresh, |
38 | | - class: "input is-rounded", |
39 | | - autocorrect: "off", |
40 | | - autocapitalize: "none", |
41 | | - spellcheck: "false", |
42 | | - disabled: !!@task |
43 | | - ) %> |
44 | | - <span class="icon is-small is-left"> |
45 | | - <i class="mdi mdi-cloud-refresh"></i> |
46 | | - </span> |
47 | | - </div> |
| 17 | + <div class="field"> |
| 18 | + <%= label(f, :access, gettext("Access Token"), class: "label") %> |
| 19 | + <div class="control has-icons-left"> |
| 20 | + <%= text_input(f, :access, |
| 21 | + class: "input is-rounded", |
| 22 | + autocorrect: "off", |
| 23 | + autocapitalize: "none", |
| 24 | + spellcheck: "false", |
| 25 | + disabled: !!@task |
| 26 | + ) %> |
| 27 | + <span class="icon is-small is-left"> |
| 28 | + <i class="mdi mdi-api"></i> |
| 29 | + </span> |
48 | 30 | </div> |
49 | | - <% else %> |
50 | | - <p class="is-size-7 has-text-centered is-italic has-text-weight-light"> |
51 | | - <% provider_link = |
52 | | - link(@provider, |
53 | | - to: @provider, |
54 | | - target: "_blank", |
55 | | - rel: "noopener noreferrer" |
56 | | - ) %> |
| 31 | + </div> |
57 | 32 |
|
58 | | - <%= raw( |
59 | | - gettext( |
60 | | - "You are using the API key (%{token}) provided by %{url}. It will allow your TeslaMate to access the official Tesla Fleet API and Tesla Telemetry streaming.", |
61 | | - token: @token, |
62 | | - url: safe_to_string(provider_link) |
63 | | - ) |
| 33 | + <div class="field"> |
| 34 | + <%= label(f, :refresh, gettext("Refresh Token"), class: "label") %> |
| 35 | + <div class="control has-icons-left"> |
| 36 | + <%= text_input(f, :refresh, |
| 37 | + class: "input is-rounded", |
| 38 | + autocorrect: "off", |
| 39 | + autocapitalize: "none", |
| 40 | + spellcheck: "false", |
| 41 | + disabled: !!@task |
64 | 42 | ) %> |
65 | | - </p> |
66 | | - <% end %> |
| 43 | + <span class="icon is-small is-left"> |
| 44 | + <i class="mdi mdi-cloud-refresh"></i> |
| 45 | + </span> |
| 46 | + </div> |
| 47 | + </div> |
67 | 48 |
|
68 | 49 | <div class="field mt-5"> |
69 | 50 | <div class="control"> |
|
75 | 56 | "is-link", |
76 | 57 | if(!!@task, do: "is-loading") |
77 | 58 | ], |
78 | | - disabled: |
79 | | - if @token == "" do |
80 | | - !@changeset.valid? |
81 | | - else |
82 | | - false |
83 | | - end, |
| 59 | + disabled: !@changeset.valid?, |
84 | 60 | phx_disable_with: gettext("Saving...") |
85 | 61 | ) %> |
86 | 62 | </div> |
87 | 63 | </div> |
88 | 64 |
|
89 | | - <%= if @token == "" do %> |
90 | | - <p class="is-size-7 has-text-centered is-italic has-text-weight-light"> |
91 | | - <% here_link = |
92 | | - link(gettext("here"), |
93 | | - to: "https://docs.teslamate.org/docs/faq#how-to-generate-your-own-tokens", |
94 | | - target: "_blank", |
95 | | - rel: "noopener noreferrer" |
96 | | - ) %> |
97 | | - |
98 | | - <%= raw( |
99 | | - gettext( |
100 | | - "Obtaining tokens through the Tesla API requires programming experience or a 3rd-party service. Information can be found %{here}.", |
101 | | - here: safe_to_string(here_link) |
102 | | - ) |
| 65 | + <p class="is-size-7 has-text-centered is-italic has-text-weight-light"> |
| 66 | + <% here_link = |
| 67 | + link(gettext("here"), |
| 68 | + to: "https://docs.teslamate.org/docs/faq#how-to-generate-your-own-tokens", |
| 69 | + target: "_blank", |
| 70 | + rel: "noopener noreferrer" |
103 | 71 | ) %> |
104 | | - </p> |
105 | | - <% end %> |
| 72 | + |
| 73 | + <%= raw( |
| 74 | + gettext( |
| 75 | + "Obtaining tokens through the Tesla API requires programming experience or a 3rd-party service. Information can be found %{here}.", |
| 76 | + here: safe_to_string(here_link) |
| 77 | + ) |
| 78 | + ) %> |
| 79 | + </p> |
106 | 80 | </.form> |
107 | 81 | </div> |
108 | 82 | </div> |
0 commit comments