Permalink
Browse files

json

  • Loading branch information...
1 parent 9ad2540 commit d802db101d06e112a28bd576aa89fe1efffc7306 @ryanmcgary committed Feb 7, 2012
@@ -28,8 +28,6 @@ def embed
@site = Site.find_by_permalink(params[:site_id])
@remoteurl = @site.remoteurls.find_or_create_by_permalink(@pathref, :include => [:recordings => :user ])
-
-
# maybe change to find by or create? How about I use a single query in the recording.model?
# maybe use whole url for "remoteurl" and then prevent duplicates?
@@ -71,30 +71,30 @@ if (remoteurl_id == undefined) {
$('.toggle-synopsis').click(function() {
$.getJSON("http://localhost:3000/sites/" + site_id +"/lanyard/embed?callback=?", function(json) {
- // render html
- $('.comments').html(json);
- // create audiojs
- var as = audiojs.createAll();
- // rezise
- $('.audiojs').width(widget_width - 78);
- $('.audiojs .loaded').width(widget_width - 232);
- $('.audiojs .scrubber').width(widget_width - 232);
- $('.comments .comments-header').width(widget_width);
- $('.comments .review-each').width(widget_width - 78);
- // popup links
- var profiles = {window100:{center:1,status:1}};
- $(function(){$(".auth_popup").popupwindow(profiles);});
- // synopsis toggle
- $('.bold').click(function() {
- $('.review-each div:hover .bold').toggleClass('toggle');
- $('.comments-each div:hover .trans').slideToggle('fast');
- return false;
- });
- console.log(json);
- })
- .success(function() { console.log("second success"); })
- .error(function() { console.log("error"); })
- .complete(function() { console.log("complete"); });
+ // render html
+ $('.comments').html(json);
+ // create audiojs
+ var as = audiojs.createAll();
+ // rezise
+ $('.audiojs').width(widget_width - 78);
+ $('.audiojs .loaded').width(widget_width - 232);
+ $('.audiojs .scrubber').width(widget_width - 232);
+ $('.comments .comments-header').width(widget_width);
+ $('.comments .review-each').width(widget_width - 78);
+ // popup links
+ var profiles = {window100:{center:1,status:1}};
+ $(function(){$(".auth_popup").popupwindow(profiles);});
+ // synopsis toggle
+ $('.bold').click(function() {
+ $('.review-each div:hover .bold').toggleClass('toggle');
+ $('.comments-each div:hover .trans').slideToggle('fast');
+ return false;
+ });
+ console.log(json);
+ })
+ .success(function() { console.log("second success"); })
+ .error(function() { console.log("error"); })
+ .complete(function() { console.log("complete"); });
});
@@ -104,7 +104,10 @@ if (remoteurl_id == undefined) {
$('.audiojs').width(widget_width - 78);
$('.audiojs .loaded').width(widget_width - 232);
$('.audiojs .scrubber').width(widget_width - 232);
- });
+ });
+
+ $.getScript("<%= root_url %>" + 'javascripts/bootstrap-modal.js', function()
+ { });
$.getScript("<%= root_url %>" + 'javascripts/jquery.popupwindow.js', function()
@@ -27,6 +27,7 @@
<!-- end each recording -->
</div>
<div style="clear:both"></div>
+ <div class="modal-container" ></div>
</div>
<!-- <#% if user_signed_in? %>
@@ -0,0 +1,4 @@
+<div class="modal" >
+ <div class="text">First line of text</div>
+ <div class="text2">Second line of text</div>
+</div>
@@ -0,0 +1,27 @@
+<% if !recording.audio_file.nil? %>
+ <div class="recording-divider">
+ <div class="clear"></div>
+ <%= link_to approve_link_text(recording), toggle_approve_admin_site_path(recording.recordid), :remote => true, :id => "approve_link_#{recording.recordid}", :class => "approve-toggle-link" %>
+ <div class="clear"></div>
+ <div class="comments-each">
+ <table class="review-container">
+ <tr>
+ <td width="64 !important"> <%# # TODO: delete this line and handle in DB %>
+ <img class="profile_pic" src="<%= recording.profile_pic.nil? ? "/images/blankprofilepic.png" : recording.profile_pic %>" width="54 !important" height="54 !important">
+ </td>
+ <td class="table-rightside">
+ <p><%= recording.full_name %> / <%= recording.title %> @ <%= recording.company %> </p>
+ <div class="review-each">
+ <audio src="<%= recording.audio_file + ".mp3" %>" preload="none"></audio>
+ <div class="review-left">posted <%= time_ago_in_words(recording.created_at) %> ago. <%= recording.recordid %> </div>
+ <div class="review-right"><b class="bold toggle">site: #<%= recording.site_id %> | <%= recording.site_permalink %><%= url_unescape(recording.permalink) %> </b></div>
+ <div class="clear"></div>
+ <div class="trans">
+ <%= recording.synopsis.empty? ? recording.transcription : recording.synopsis %>
+ </div>
+ </div>
+ </tr>
+ </table>
+ </div>
+ </div>
+<% end %>
@@ -0,0 +1,209 @@
+/* =========================================================
+ * bootstrap-modal.js v2.0.0
+ * http://twitter.github.com/bootstrap/javascript.html#modals
+ * =========================================================
+ * Copyright 2012 Twitter, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ========================================================= */
+
+
+!function( $ ){
+
+ "use strict"
+
+ /* MODAL CLASS DEFINITION
+ * ====================== */
+
+ var Modal = function ( content, options ) {
+ this.options = $.extend({}, $.fn.modal.defaults, options)
+ this.$element = $(content)
+ .delegate('[data-dismiss="modal"]', 'click.dismiss.modal', $.proxy(this.hide, this))
+ }
+
+ Modal.prototype = {
+
+ constructor: Modal
+
+ , toggle: function () {
+ return this[!this.isShown ? 'show' : 'hide']()
+ }
+
+ , show: function () {
+ var that = this
+
+ if (this.isShown) return
+
+ $('body').addClass('modal-open')
+
+ this.isShown = true
+ this.$element.trigger('show')
+
+ escape.call(this)
+ backdrop.call(this, function () {
+ var transition = $.support.transition && that.$element.hasClass('fade')
+
+ !that.$element.parent().length && that.$element.appendTo(document.body) //don't move modals dom position
+
+ that.$element
+ .show()
+
+ if (transition) {
+ that.$element[0].offsetWidth // force reflow
+ }
+
+ that.$element.addClass('in')
+
+ transition ?
+ that.$element.one($.support.transition.end, function () { that.$element.trigger('shown') }) :
+ that.$element.trigger('shown')
+
+ })
+ }
+
+ , hide: function ( e ) {
+ e && e.preventDefault()
+
+ if (!this.isShown) return
+
+ var that = this
+ this.isShown = false
+
+ $('body').removeClass('modal-open')
+
+ escape.call(this)
+
+ this.$element
+ .trigger('hide')
+ .removeClass('in')
+
+ $.support.transition && this.$element.hasClass('fade') ?
+ hideWithTransition.call(this) :
+ hideModal.call(this)
+ }
+
+ }
+
+
+ /* MODAL PRIVATE METHODS
+ * ===================== */
+
+ function hideWithTransition() {
+ var that = this
+ , timeout = setTimeout(function () {
+ that.$element.off($.support.transition.end)
+ hideModal.call(that)
+ }, 500)
+
+ this.$element.one($.support.transition.end, function () {
+ clearTimeout(timeout)
+ hideModal.call(that)
+ })
+ }
+
+ function hideModal( that ) {
+ this.$element
+ .hide()
+ .trigger('hidden')
+
+ backdrop.call(this)
+ }
+
+ function backdrop( callback ) {
+ var that = this
+ , animate = this.$element.hasClass('fade') ? 'fade' : ''
+
+ if (this.isShown && this.options.backdrop) {
+ var doAnimate = $.support.transition && animate
+
+ this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />')
+ .appendTo(document.body)
+
+ if (this.options.backdrop != 'static') {
+ this.$backdrop.click($.proxy(this.hide, this))
+ }
+
+ if (doAnimate) this.$backdrop[0].offsetWidth // force reflow
+
+ this.$backdrop.addClass('in')
+
+ doAnimate ?
+ this.$backdrop.one($.support.transition.end, callback) :
+ callback()
+
+ } else if (!this.isShown && this.$backdrop) {
+ this.$backdrop.removeClass('in')
+
+ $.support.transition && this.$element.hasClass('fade')?
+ this.$backdrop.one($.support.transition.end, $.proxy(removeBackdrop, this)) :
+ removeBackdrop.call(this)
+
+ } else if (callback) {
+ callback()
+ }
+ }
+
+ function removeBackdrop() {
+ this.$backdrop.remove()
+ this.$backdrop = null
+ }
+
+ function escape() {
+ var that = this
+ if (this.isShown && this.options.keyboard) {
+ $(document).on('keyup.dismiss.modal', function ( e ) {
+ e.which == 27 && that.hide()
+ })
+ } else if (!this.isShown) {
+ $(document).off('keyup.dismiss.modal')
+ }
+ }
+
+
+ /* MODAL PLUGIN DEFINITION
+ * ======================= */
+
+ $.fn.modal = function ( option ) {
+ return this.each(function () {
+ var $this = $(this)
+ , data = $this.data('modal')
+ , options = typeof option == 'object' && option
+ if (!data) $this.data('modal', (data = new Modal(this, options)))
+ if (typeof option == 'string') data[option]()
+ else data.show()
+ })
+ }
+
+ $.fn.modal.defaults = {
+ backdrop: true
+ , keyboard: true
+ }
+
+ $.fn.modal.Constructor = Modal
+
+
+ /* MODAL DATA-API
+ * ============== */
+
+ $(function () {
+ $('body').on('click.modal.data-api', '[data-toggle="modal"]', function ( e ) {
+ var $this = $(this), href
+ , $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
+ , option = $target.data('modal') ? 'toggle' : $.extend({}, $target.data(), $this.data())
+
+ e.preventDefault()
+ $target.modal(option)
+ })
+ })
+
+}( window.jQuery )

0 comments on commit d802db1

Please sign in to comment.