Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
89 changed files
with
1,524 additions
and
236 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
1.9.3-p551 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
$(document).ready -> | ||
issue = new (google.maps.LatLng)(svLongNew, svLatNew) | ||
svs = new google.maps.StreetViewService() | ||
panorama = null | ||
|
||
processSVData = (data, status) -> | ||
if (status == google.maps.StreetViewStatus.OK) | ||
panorama.setPano(data.location.pano) | ||
panorama.setPov({ | ||
heading: 270, | ||
pitch: 0 | ||
}) | ||
updateLocation() | ||
updatePov() | ||
|
||
panorama.setVisible(true) | ||
else | ||
pano = $("#newStreetViewPano").text('') | ||
warningList = $('<ul>').addClass('bullets') | ||
warningList.append $('<li>').text('Within 200m of the issue no Street View has been found') | ||
pano.prepend warningList | ||
pano.prepend $('<br>') | ||
return | ||
|
||
updateLocation = -> | ||
$("#street_view_message_location_string").val panorama.getPosition() | ||
return | ||
updatePov = -> | ||
$("#street_view_message_heading").val panorama.getPov().heading | ||
$("#street_view_message_pitch").val panorama.getPov().pitch | ||
return | ||
|
||
addStreetView = (sv) -> | ||
issue = new (google.maps.LatLng)(sv.long, sv.lat) | ||
|
||
panoramaOptions = { | ||
position: issue, | ||
pov: { | ||
heading: sv.head, | ||
pitch: sv.pitch | ||
}, | ||
visible: true | ||
} | ||
new google.maps.StreetViewPanorama(document.getElementById("streetViewPano#{sv.id}"), panoramaOptions) | ||
return | ||
|
||
initialize = -> | ||
panorama = new google.maps.StreetViewPanorama(document.getElementById("newStreetViewPano")) | ||
|
||
svs.getPanoramaByLocation(issue, 200, processSVData) | ||
|
||
google.maps.event.addListener panorama, 'position_changed', -> | ||
updateLocation() | ||
google.maps.event.addListener panorama, 'pov_changed', -> | ||
updatePov() | ||
|
||
# http://stackoverflow.com/questions/14861975/resize-google-maps-when-tabs-are-triggered | ||
$("a[href$='#new-street-view-message']").click( (e)-> | ||
google.maps.event.trigger(panorama, 'resize') ) | ||
|
||
addStreetView(streetView) for streetView in streetViews | ||
|
||
return | ||
|
||
google.maps.event.addDomListener window, 'load', initialize |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
$(document).ready(function() { | ||
if(!window.location.hash) { | ||
offset = $(".thread-view-from-here").offset() | ||
if(!window.location.hash && offset) { | ||
$('html, body').animate({ | ||
scrollTop: $(".thread-view-from-here").offset().top | ||
scrollTop: offset.top | ||
}, 2000); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,38 @@ | ||
class Message::BaseController < ApplicationController | ||
before_filter :load_thread | ||
before_filter :thread | ||
before_filter :build_message, only: :create | ||
|
||
def create | ||
if message.save | ||
thread.add_subscriber(current_user) unless current_user.ever_subscribed_to_thread?(thread) | ||
ThreadNotifier.notify_subscribers(thread, notification_name, message) | ||
set_flash_message(:success) | ||
else | ||
set_flash_message(:failure) | ||
end | ||
redirect_to thread_path(@thread) | ||
end | ||
|
||
protected | ||
|
||
def load_thread | ||
def thread | ||
# Need to check if user has access? | ||
@thread = MessageThread.find(params[:thread_id]) | ||
@thread ||= MessageThread.find(params[:thread_id]) | ||
end | ||
|
||
def message | ||
@message ||= thread.messages.build | ||
end | ||
|
||
def build_message | ||
message.created_by = current_user | ||
message.component = populate_component | ||
end | ||
|
||
def populate_component | ||
component.thread = thread | ||
component.message = message | ||
component.created_by = current_user | ||
component | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,11 @@ | ||
class Message::DeadlinesController < Message::BaseController | ||
def create | ||
@message = @thread.messages.build | ||
@message.created_by = current_user | ||
protected | ||
|
||
@deadline = DeadlineMessage.new(params[:deadline_message]) | ||
@deadline.thread = @thread | ||
@deadline.message = @message | ||
@deadline.created_by = current_user | ||
|
||
@message.component = @deadline | ||
def component | ||
@deadline ||= DeadlineMessage.new(params[:deadline_message]) | ||
end | ||
|
||
if @message.save | ||
@thread.add_subscriber(current_user) unless current_user.ever_subscribed_to_thread?(@thread) | ||
ThreadNotifier.notify_subscribers(@thread, :new_deadline_message, @message) | ||
set_flash_message(:success) | ||
else | ||
set_flash_message(:failure) | ||
end | ||
redirect_to thread_path(@thread) | ||
def notification_name | ||
:new_deadline_message | ||
end | ||
end |
Oops, something went wrong.