Skip to content

Commit 70e9421

Browse files
committed
Button to Display Map
Button labled Floor Map will display map of HackRU. Clicking on it will save the position in terms of x and y coordinates in the program and will allow the user to confirm. Things to be fixed/added: Sometimes the Help me! button doesn't become more saturated but is still clickable after dealing with the map UI. Also, I cannot get the pin image to show up. Finally, the locations need to be stored somehow (array?) such that both x and y positions are relayed.
1 parent 34fda31 commit 70e9421

File tree

18 files changed

+106
-35
lines changed

18 files changed

+106
-35
lines changed

.DS_Store

18 KB
Binary file not shown.

client/.DS_Store

16 KB
Binary file not shown.

client/components/.DS_Store

18 KB
Binary file not shown.
Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,2 @@
11
<template name="floormap">
2-
<div class="one column row">
3-
<div class="column ui segment">
4-
<a href="{{floorplan}}" >
5-
<img style="width: 100%"
6-
src="{{floorplan}}">
7-
</a>
8-
<center><a href="{{floorplan}}" >floorplan</a></center>
9-
</div>
10-
</div>
112
</template>
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Template.floormap.helpers({
2-
floorplan: function(){
2+
/*floorplan: function(){
33
return Meteor.settings.public.MISC+"/floorplan.jpg";
4-
}
4+
}*/
55
})

client/components/ticketPanel/ticketPanel.html

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,24 @@
4545
{{#if unratedTicket}}
4646

4747
{{#with unratedTicket }}
48-
{{> ticketPanelRating }}
48+
> ticketPanelRating }}
4949
{{/with}}
5050

5151
{{else}}
52+
<div class="map">
53+
<input id="map"
54+
type="image"
55+
name ="location"
56+
src= "{{floorplan}}"
57+
class="btTxt submit"
58+
>
59+
<button id="map_cancel" class="primary push fluid button">
60+
Cancel
61+
</button>
62+
<button id="map_confirm" class="disabled primary push fluid button">
63+
Confirm
64+
</button>
65+
</div>
5266
<div class="title">
5367
<p>
5468
<strong>
@@ -67,15 +81,11 @@
6781
placeholder="{{constant 'TICKET_PANEL_TOPIC_PLACEHOLDER'}}">
6882
<br>
6983
{{constant 'TICKET_PANEL_LOCATION'}}
84+
<button id="location" class="primary push fluid button">
85+
{{constant 'TICKET_PANEL_FLOORMAP'}}
86+
</button>
7087
<br>
71-
<select id="location"
72-
name="location"
73-
class="clean">
74-
{{#each rooms}}
75-
<option value="{{name}}">{{name}}</option>
76-
{{/each}}
77-
</select>
78-
<br>
88+
7989
{{constant 'TICKET_PANEL_CONTACT'}}
8090
<br>
8191
<input id="contact"

client/components/ticketPanel/ticketPanel.js

Lines changed: 38 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@ Template.ticketPanel.helpers({
1212
}
1313
})
1414
},
15-
rooms: function(){
16-
return Meteor.settings.public.rooms;
17-
},
1815
statusIs: function(status){
1916
return this.status === status;
2017
},
@@ -69,14 +66,40 @@ Template.ticketPanel.helpers({
6966
}
7067

7168
return moment(ticket.expiresAt).from(ReactiveNow.get());
72-
}
69+
},
70+
floorplan: function(){
71+
console.log("Call me maybe");
72+
return Meteor.settings.public.MISC+"/floorplan.jpg";
73+
},
7374
});
7475

7576
Template.ticketPanel.rendered = function(){
7677
$(this.find('.ticketPanel')).addClass('animated bounceIn')
7778
};
7879

7980
Template.ticketPanel.events({
81+
'click #location': function(event){ //Displays Map UI
82+
//$('#location').val("LOL"); //Temporary for Testing
83+
document.getElementsByClassName('map')[0].style.display = 'block';
84+
},
85+
'click #map': function(){ //Pins user's click location
86+
var $map_confirm = $('#map_confirm');
87+
$('#location').val(event.clientX, event.clientY);
88+
$map_confirm.removeClass('disabled');
89+
createPin(event.clientX, event.clientY);
90+
console.log("clientX: " + event.clientX + " - clientY: " + event.clientY);
91+
},
92+
'click #map_cancel': function(){ //Exit Map UI
93+
$('#location').val(null);
94+
document.getElementsByClassName('map')[0].style.display = 'none';
95+
console.log("EXIT");
96+
},
97+
'click #map_confirm': function(){ //Confirm Location
98+
if($('#location').val().length > 0){
99+
document.getElementsByClassName('map')[0].style.display = 'none';
100+
console.log("CONFIRM");
101+
}
102+
},
80103
'click #submit': function(){
81104
return createTicket();
82105
},
@@ -100,6 +123,17 @@ Template.ticketPanel.events({
100123
}
101124
});
102125

126+
function createPin(x, y){
127+
console.log("Pinned by a pin");
128+
var nPin = document.createElement("pin");
129+
nPin.setAttribute('src', "/public/assets/images/pin.png");
130+
nPin.style.position = "absolute";
131+
nPin.style.zIndex = 5;
132+
nPin.style.left = x+'px';
133+
nPin.style.top = y+'px';
134+
document.body.appendChild(nPin);
135+
}
136+
103137
function isValid(){
104138
return $('#topic').val().length > 0 &&
105139
$('#location').val().length > 0 &&

client/stylesheets/.DS_Store

8 KB
Binary file not shown.

client/stylesheets/scss/.DS_Store

10 KB
Binary file not shown.

client/stylesheets/scss/components/_ticketPanel.scss

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,20 @@
11
.ticketPanel {
22
text-align: center;
3+
position: relative;
4+
z-index: 100;
5+
.map {
6+
display: none;
7+
position: absolute;
8+
z-index: 2;
9+
width: 200%;
10+
margin-left: auto;
11+
margin-right: auto;
12+
text-align: center;
13+
}
14+
.cancel {
15+
padding-bottom: 20px;
16+
color: red;
17+
}
318
.title {
419
font-size: 1.8em;
520
line-height: 1.8em;

0 commit comments

Comments
 (0)