Skip to content

Instantly share code, notes, and snippets.

View shwoodard's full-sized avatar

Sam Woodard shwoodard

View GitHub Profile
(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');
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!
(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);
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' %>
$.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);
});
});
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)"]}
}
(function ($) {
$.fn.prototypeList = function (records, map) {
if (!records || !records.length) {
return this;
}
return $(this).each(function () {
var list = $(this);
var prototypeEl = list.find('.prototype');
module Preferences
def self.included(base)
base.extend(ClassMethods)
end
def preferences=(hash)
self.preferences.merge!(hash)
end
def preferences
module ZipCodes
def self.included(base)
base.extend(ClassMethods)
end
module ClassMethods
def find_zip_codes_by_radius(zip, radius)
zip_code = ZipCode.find_by_zip_code(zip)
return [] unless zip_code
class ZipCode < ActiveRecord::Base
def ==(other)
self.zip_code == other.zip_code
end
end