* adding 'extra_js' block to web layout
This commit is contained in:
parent
a25ccf5ced
commit
fe0c4a374d
|
|
@ -284,7 +284,7 @@
|
|||
|
||||
app.bindDialog('inviteUsers', dialogBindings);
|
||||
|
||||
callFB(fbAppID);
|
||||
//callFB(fbAppID);
|
||||
};
|
||||
|
||||
this.initialize = initialize;
|
||||
|
|
|
|||
|
|
@ -153,7 +153,7 @@
|
|||
registerEvents(false);
|
||||
}
|
||||
|
||||
function initialize(){
|
||||
function initialize(facebookHelper){
|
||||
var dialogBindings = {
|
||||
'beforeShow' : beforeShow,
|
||||
'afterHide': afterHide
|
||||
|
|
|
|||
|
|
@ -31,7 +31,6 @@
|
|||
|
||||
app.bindDialog('signup-dialog', dialogBindings);
|
||||
|
||||
console.log("honuth")
|
||||
events();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
//= require AAA_Log
|
||||
//= require AAC_underscore
|
||||
//= require globals
|
||||
//= require facebook_helper
|
||||
//= require web/signupDialog
|
||||
//= require invitationDialog
|
||||
//= require shareDialog
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
<td valign="top" width="48%">
|
||||
<div class="ml10">
|
||||
<h3>Share a Link:</h3><br />
|
||||
<% unless share_token.blank? %>
|
||||
<% unless true # share_token.blank? %>
|
||||
<%= "#{root_url}#{share_token}" %>
|
||||
<% end %>
|
||||
<div class="right"><a class="button-orange">COPY LINK</a></div>
|
||||
|
|
|
|||
|
|
@ -95,11 +95,14 @@
|
|||
|
||||
var recordingManager = new JK.RecordingManager();
|
||||
|
||||
var facebookHelper = new JK.FacebookHelper(JK.app);
|
||||
facebookHelper.initialize('<%= SampleApp::Application.config.facebook_key %>');
|
||||
|
||||
var invitationDialog = new JK.InvitationDialog(JK.app);
|
||||
invitationDialog.initialize('<%= SampleApp::Application.config.facebook_key %>');
|
||||
|
||||
var shareDialog = new JK.ShareDialog(JK.app);
|
||||
shareDialog.initialize();
|
||||
shareDialog.initialize(facebookHelper);
|
||||
|
||||
var localRecordingsDialog = new JK.LocalRecordingsDialog(JK.app);
|
||||
localRecordingsDialog.initialize();
|
||||
|
|
|
|||
|
|
@ -65,17 +65,24 @@
|
|||
JK.app = JK.JamKazam();
|
||||
JK.app.initialize({inClient: false, layoutOpts: {layoutFooter: false}});
|
||||
|
||||
var facebookHelper = new JK.FacebookHelper(JK.app);
|
||||
JK.FacebookHelperInstance = facebookHelper;
|
||||
facebookHelper.initialize('<%= SampleApp::Application.config.facebook_key %>');
|
||||
|
||||
var invitationDialog = new JK.InvitationDialog(JK.app);
|
||||
invitationDialog.initialize();
|
||||
invitationDialog.initialize(facebookHelper);
|
||||
|
||||
var userDropdown = new JK.UserDropdown(JK.app);
|
||||
userDropdown.initialize(invitationDialog);
|
||||
|
||||
var signupDialog = new JK.SignupDialog(JK.app);
|
||||
signupDialog.initialize();
|
||||
|
||||
})
|
||||
</script>
|
||||
|
||||
<%= yield(:extra_js) %>
|
||||
|
||||
<%= render "shared/ga" %>
|
||||
<!-- version info: <%= version %> -->
|
||||
</body>
|
||||
|
|
|
|||
|
|
@ -80,62 +80,56 @@
|
|||
|
||||
<%= render :partial => "clients/shareDialog", :locals => {:session => @music_session, :share_token => @music_session.share_token} %>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
<% content_for :extra_js do %>
|
||||
|
||||
JK = JK || {};
|
||||
<script type="text/javascript">
|
||||
var context = window;
|
||||
$(function () {
|
||||
if (context.JK.currentUserId) {
|
||||
|
||||
<% if current_user %>
|
||||
JK.currentUserId = '<%= current_user.id %>';
|
||||
<% else %>
|
||||
JK.currentUserId = null;
|
||||
<% end %>
|
||||
var shareDialog = new JK.ShareDialog(context.JK.app, "<%= @music_session.id %>", "session");
|
||||
shareDialog.initialize(context.JK.FacebookHelperInstance);
|
||||
|
||||
if (JK.currentUserId) {
|
||||
JK.app = JK.JamKazam();
|
||||
JK.app.initialize({inClient: false, layoutOpts: {layoutFooter: false}});
|
||||
$("#btnShare").click(function(e) {
|
||||
shareDialog.showDialog();
|
||||
});
|
||||
|
||||
var shareDialog = new JK.ShareDialog(JK.app, "<%= @music_session.id %>", "session");
|
||||
shareDialog.initialize();
|
||||
|
||||
$("#btnShare").click(function(e) {
|
||||
shareDialog.showDialog();
|
||||
});
|
||||
|
||||
$("#txtSessionComment").keypress(function(e) {
|
||||
if (e.which === 13) {
|
||||
addComment();
|
||||
$("#txtSessionComment").keypress(function(e) {
|
||||
if (e.which === 13) {
|
||||
addComment();
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
$("#txtSessionComment").attr("disabled", "disabled");
|
||||
$("#txtSessionComment").val("You must be logged in to add a comment.");
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
$("#txtSessionComment").attr("disabled", "disabled");
|
||||
$("#txtSessionComment").val("You must be logged in to add a comment.");
|
||||
}
|
||||
|
||||
JK.sessionId = "<%= @music_session.music_session_id %>";
|
||||
JK.sessionId = "<%= @music_session.music_session_id %>";
|
||||
|
||||
var rest = new JK.Rest();
|
||||
var rest = new JK.Rest();
|
||||
|
||||
$("#btnLike").click(like);
|
||||
$("#btnLike").click(like);
|
||||
|
||||
function like() {
|
||||
rest.addSessionLike(JK.sessionId, JK.currentUserId)
|
||||
.done(function(response) {
|
||||
$("#spnLikeCount").html(parseInt($("#spnLikeCount").text()) + 1);
|
||||
$("#btnLike").unbind("click");
|
||||
});
|
||||
}
|
||||
function like() {
|
||||
rest.addSessionLike(JK.sessionId, JK.currentUserId)
|
||||
.done(function(response) {
|
||||
$("#spnLikeCount").html(parseInt($("#spnLikeCount").text()) + 1);
|
||||
$("#btnLike").unbind("click");
|
||||
});
|
||||
}
|
||||
|
||||
function addComment() {
|
||||
var comment = $("#txtSessionComment").val();
|
||||
if ($.trim(comment).length > 0) {
|
||||
rest.addSessionComment(JK.sessionId, JK.currentUserId, comment)
|
||||
.done(function(response) {
|
||||
$("#spnCommentCount").html(parseInt($("#spnCommentCount").text()) + 1);
|
||||
$(".landing-comment-scroller").prepend(comment);
|
||||
});
|
||||
}
|
||||
}
|
||||
})
|
||||
</script>
|
||||
function addComment() {
|
||||
var comment = $("#txtSessionComment").val();
|
||||
if ($.trim(comment).length > 0) {
|
||||
rest.addSessionComment(JK.sessionId, JK.currentUserId, comment)
|
||||
.done(function(response) {
|
||||
$("#spnCommentCount").html(parseInt($("#spnCommentCount").text()) + 1);
|
||||
$(".landing-comment-scroller").prepend(comment);
|
||||
});
|
||||
}
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<% end %>
|
||||
|
|
|
|||
Loading…
Reference in New Issue