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
$.currActive; | |
$.imageCount; | |
$.fn.preCacheImageFromThumb = function () { | |
return $(this).each(function () { | |
var img = new Image(); | |
img.src = $(this).attr('href'); | |
}); | |
}; |
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
def adjust_wac(time = Time.zone.now) | |
adjustment_date = time.beginning_of_day | |
qty = value = '0'.to_d | |
transaction do | |
# Compute WAC as of specified time.....then adjust future inventory adjustment entries | |
first_entry = true | |
(inv_adj_entries = inventory_adjustment_entries.find_all).each do |entry| | |
if entry.posted_date >= adjustment_date and !first_entry | |
# Adjust future entries |
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
def qty_available_for_sale(as_of = Time.zone.new) | |
qty = wac_and_qty(as_of)[1] | |
inventory_adjustment_entries.find_after(as_of).each do |entry| | |
qty = qty + (entry.debit_credit_flag == 'Debit' ? entry.item_qty : -entry.item_qty) | |
min_qty = [qty, min_qty].min | |
end | |
qty | |
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
(function (){ | |
$.fn.disableUserMoreInfoFields = function() { | |
return $(this).each(function () { | |
var fields = $(this).closest('.member').find('.more_info_field'); | |
if(!!$(this).get(0).checked) { | |
fields.removeAttr('disabled'); | |
fields.removeClass('disabled'); | |
} else { | |
fields.attr('disabled', 'disabled'); | |
fields.addClass('disabled'); |
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
def public | |
@is_public = true | |
show | |
if current_user | |
if current_user.subscriber.community_subscriber.profile_accessibility == 1 | |
redirect_to '/home' and return | |
end | |
if current_user.subscriber != current_subscriber | |
current_subscriber.community_subscriber.increment_internal_visits! |
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
(function ($) { | |
$.extend(jQuery ,{ | |
// keep the old one | |
_ajax: jQuery.ajax, | |
ajax: function (options) { | |
var cloneOptions = $.extend({}, options); | |
this._ajax($.extend(options, { | |
complete: function (res, status) { | |
$(document).trigger('ajaxcomplete', arguments); |
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
diff --git a/app/views/messages/_inbox.html.erb b/app/views/messages/_inbox.html.erb | |
index 3c6f499..17d9c5e 100644 | |
--- a/app/views/messages/_inbox.html.erb | |
+++ b/app/views/messages/_inbox.html.erb | |
@@ -21,7 +21,7 @@ | |
<td class="msgcol"><%= link_to(h(message.subject), message_path(message, :from => 'inbox'), :class => 'message_link') %></td> | |
<td class="msgcol"><%= time_ago_in_words(message.created_at) %> ago</td> | |
<td class="msgcol"> | |
- <%= link_to "", message_path(message), :class => 'delete' %> | |
+ <%= link_to "", message_path(message), :class => 'trashcan delete trash_link' %> |
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
$.flashMessage = function(msg, status) { | |
status = status || 'ok'; | |
$(document).one('reveal.facebox', function () { | |
var tOut = setTimeout(function () { | |
$(document).trigger('close.facebox'); | |
}, 3000); | |
$(document).one('loading.facebox', function () { | |
clearTimeout(tOut); | |
}); | |
}); |
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
class Message < ActiveRecord::Base | |
belongs_to :reply_of, :class_name => 'Message', :foreign_key => 'parent_id' | |
belongs_to :replies, :class_name => 'Message', :foreign_key => 'parent_id' | |
belongs_to :sender, :class_name => 'CommunityUser', :foreign_key => 'sender_id' | |
belongs_to :recipient, :class_name => 'CommunityUser', :foreign_key => 'recipient_id' | |
belongs_to :conversation | |
named_scope :deleted, lambda { |user| | |
{:conditions => ["(sender_deleted_at IS NOT NULL AND sender_id = #{user.id} AND sender_deleted_permanently != 1) OR (recipient_deleted_at IS NOT NULL AND recipient_id = #{user.id} AND recipient_deleted_permanently != 1)"]} | |
} |
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
(function ($) { | |
$.fn.prototypeList = function (records, map) { | |
if (!records || !records.length) { | |
return this; | |
} | |
return $(this).each(function () { | |
var list = $(this); | |
var prototypeEl = list.find('.prototype'); | |