Skip to content

Commit e88585a

Browse files
committed
Fix URL helpers. Add additional URL section for old frontend
1 parent eff3cd9 commit e88585a

File tree

2 files changed

+7
-16
lines changed

2 files changed

+7
-16
lines changed

lib/magpie_web/templates/experiment/edit.html.eex

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ serverUrl: '<%= get_home_url() %>',
1111
socketUrl: '<%= get_socket_url() %>',</pre>
1212
</ul>
1313

14+
<p>
15+
(If you're basing your experiment on a frontend version that was before the <code>magpie-base</code> package, please note the full submission URL: <code><%= get_home_url() <> Magpie.Router.Helpers.experiment_path(Magpie.Endpoint, :submit, @experiment.id) %></code>)
16+
</p>
17+
1418
<%= form_for @changeset, experiment_path(@conn, :update, @experiment), fn f -> %>
1519
<%= if @changeset.action do %>
1620
<div class="alert alert-danger" >

lib/magpie_web/views/experiment_view.ex

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -107,33 +107,20 @@ defmodule Magpie.ExperimentView do
107107
end
108108

109109
def get_endpoint_url(type, id) do
110-
base_url =
111-
Application.get_env(
112-
:magpie,
113-
:canonical_url,
114-
Magpie.Router.Helpers.page_url(Magpie.Endpoint, :index)
115-
)
110+
base_url = Magpie.Router.Helpers.page_url(Magpie.Endpoint, :index)
116111

117112
path = Magpie.Router.Helpers.experiment_path(Magpie.Endpoint, type, id)
118113
base_url <> path
119114
end
120115

121116
def get_home_url() do
122-
base_url =
123-
Application.get_env(
124-
:magpie,
125-
:canonical_url,
126-
Magpie.Router.Helpers.page_url(Magpie.Endpoint, :index)
127-
)
128-
129-
home_path = Magpie.Router.Helpers.page_path(Magpie.Endpoint, :index)
130-
base_url <> home_path
117+
Magpie.Endpoint.url()
131118
end
132119

133120
def get_socket_url() do
134121
get_home_url()
135122
|> String.replace_leading("http", "ws")
136-
|> Kernel.<>("socket")
123+
|> Kernel.<>("/socket")
137124
end
138125

139126
def format_timestamp(timestamp, timezone) do

0 commit comments

Comments
 (0)