Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
PyBusMap
Manage
Activity
Members
Labels
Plan
Issues
10
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Anton Sarukhanov
PyBusMap
Commits
23352fc2
Commit
23352fc2
authored
8 years ago
by
Anton Sarukhanov
Browse files
Options
Downloads
Patches
Plain Diff
If a stop has been clicked on the map, default to that stop in the Embed dialog.
parent
0b9f9edb
No related branches found
Branches containing commit
No related tags found
1 merge request
!1
Implemented Embed-code generator interface
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
static/js/embed.js
+10
-5
10 additions, 5 deletions
static/js/embed.js
static/js/map.js
+9
-5
9 additions, 5 deletions
static/js/map.js
with
19 additions
and
10 deletions
static/js/embed.js
+
10
−
5
View file @
23352fc2
BusMap
.
Embed
=
function
(
opts
)
{
this
.
opts
=
opts
;
var
embedVars
=
{};
var
that
=
this
;
var
that
=
this
.
Embed
;
that
.
opts
=
opts
;
/* Constructor - initialize the embed form */
function
init
()
{
bindEventHandlers
();
populateOptions
();
}
var
updateEmbedCode
=
function
()
{
// Grab HTML representation of preview; trim whitespace.
var
code
=
$
(
"
#embed-preview
"
).
html
().
trim
();
...
...
@@ -33,8 +32,14 @@ BusMap.Embed = function(opts) {
opt
.
appendTo
(
"
#embed-stop
"
);
}
if
(
$
(
"
#embed-stop option
"
).
length
>
1
&&
!
$
(
"
#embed-stop
"
).
val
())
{
// We have stops. Select the first one.
$
(
"
#embed-stop option:nth-child(2)
"
).
prop
(
'
selected
'
,
true
);
// We have stops.
if
(
window
.
_busmap
.
selectedStop
)
{
// Select the last one clicked if available.
$
(
"
#embed-stop
"
).
val
(
window
.
_busmap
.
selectedStop
);
}
else
{
// Select the first one.
$
(
"
#embed-stop option:nth-child(2)
"
).
prop
(
'
selected
'
,
true
);
}
$
(
"
#embed-stop
"
).
change
();
// fire event to handle the change
}
}
...
...
This diff is collapsed.
Click to expand it.
static/js/map.js
+
9
−
5
View file @
23352fc2
...
...
@@ -13,7 +13,7 @@ var BusMap = {
BusMap
.
Map
=
function
(
opts
)
{
var
stops
=
{};
var
routes
=
{};
var
modal
_c
ache
=
{};
var
modal
C
ache
=
{};
var
that
=
this
.
Map
;
that
.
opts
=
opts
;
window
.
_busmap
=
this
.
Map
;
...
...
@@ -292,10 +292,14 @@ BusMap.Map = function(opts) {
title
:
stops
[
s
].
title
,
icon
:
markerIcon
,
opacity
:
1
,
stopId
:
s
};
that
.
stopMarkers
[
s
]
=
L
.
marker
(
[
stops
[
s
].
lat
,
stops
[
s
].
lon
],
markerOpts
).
bindPopup
(
text
,
popupOpts
);
markerOpts
).
bindPopup
(
text
,
popupOpts
)
.
on
(
'
click
'
,
function
(
e
)
{
that
.
selectedStop
=
this
.
options
.
stopId
;
});
that
.
stopMarkersClusterGroup
.
addLayer
(
that
.
stopMarkers
[
s
]);
}
// Add predictions to the marker popup, if available
...
...
@@ -399,12 +403,12 @@ BusMap.Map = function(opts) {
query
:
"
modal
"
,
modal_name
:
name
,
};
if
(
modal
_c
ache
[
name
])
{
modal
.
append
(
modal
_c
ache
[
name
]);
if
(
modal
C
ache
[
name
])
{
modal
.
append
(
modal
C
ache
[
name
]);
setUrlFromView
();
}
else
{
$
.
get
(
"
ajax
"
,
params
).
done
(
function
(
contents
)
{
modal
_c
ache
[
name
]
=
contents
;
modal
C
ache
[
name
]
=
contents
;
modal
.
append
(
contents
);
setUrlFromView
();
}).
fail
(
function
()
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment