Skip to content

Instantly share code, notes, and snippets.

View colemanw's full-sized avatar
🎯
Focusing

colemanw

🎯
Focusing
View GitHub Profile
@colemanw
colemanw / activityPopup.js
Created April 17, 2014 15:52
Open civicrm activity view in popup
cj(function($) {
$('#crm-container').on('click', '.crm-contact-activity-links a.action-item-first', function(e) {
var url = $(this).attr('href');
$('<div class="crm-container" />').dialog({
title: 'View Activity',
open: function() {
$(this).load(url + '&snippet=1');
}
});
e.preventDefault();
@colemanw
colemanw / civicrm45examples.js
Created April 25, 2014 15:27
CiviCRM 4.5 Examples
// A closure is a function that provides scope for your variables
// and can provide an abbreviated alias of globals.
// In this case we are importing Civi's copy of jQuery and lo-dash.
// @see http://wiki.civicrm.org/confluence/display/CRMDOC/Javascript+Reference
function something($, _) {
// Code goes here
}
// Run the function
something(CRM.$, CRM._);
@colemanw
colemanw / gist:4f00dc8892e1ad449f81
Created November 3, 2014 22:52
Proposed structure for latest.civicrm.org
// Currently going to latest.civicrm.org/stable.php outputs:
4.5.2
// Proposed new output:
{
"stable": {"security": null, "latest": "4.5.2"},
"lts": {"security": "4.4.7", "latest": "4.4.8"},
"unstable": null, // we don't have any beta releases out currently, is this what that should look like?
}
// Currently going to latest.civicrm.org/stable.php outputs:
4.5.4
// Proposed new output
{
"4.2": {
"status": "lts", // one of "lts", "eol", "stable" or "testing"
"releases": [
{"version": "4.2.alpha1", "date": "2012-06-08"},
{"version": "4.2.alpha2", "date": "2012-06-20"},
@colemanw
colemanw / Fee.php
Created May 6, 2015 21:17
Change payment_processor field to use EntityRef
<?php
/*
+--------------------------------------------------------------------+
| CiviCRM version 4.6 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2015 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
| CiviCRM is free software; you can copy, modify, and distribute it |
diff --git a/js/Common.js b/js/Common.js
index 6fa4589..a882280 100644
--- a/js/Common.js
+++ b/js/Common.js
@@ -409,6 +409,15 @@ if (!CRM.vars) CRM.vars = {};
if (settings.ajax) {
$el.addClass('crm-ajax-select');
}
+
+ if (settings.placeholder || settings.placeholderOption || $el.data('placeholder') || $el.a
diff --git a/js/Common.js b/js/Common.js
index 6fa4589..abbea0c 100644
--- a/js/Common.js
+++ b/js/Common.js
@@ -401,9 +401,6 @@ if (!CRM.vars) CRM.vars = {};
// Defaults for single-selects
if ($el.is('select:not([multiple])')) {
settings.minimumResultsForSearch = 10;
- if ($('option:first', this).val() === '') {
- settings.placeholderOption = 'first';
diff --git a/CRM/Core/CodeGen/Specification.php b/CRM/Core/CodeGen/Specification.php
index 86c211a..a6f417b 100644
--- a/CRM/Core/CodeGen/Specification.php
+++ b/CRM/Core/CodeGen/Specification.php
@@ -416,6 +416,8 @@ class CRM_Core_CodeGen_Specification {
'callback',
// Path to options edit form
'optionEditPath',
+ // A simple list of options. I miss enum fields...
+ 'options',
diff --git a/CRM/Core/BAO/Note.php b/CRM/Core/BAO/Note.php
index ef7dff8..da06824 100644
--- a/CRM/Core/BAO/Note.php
+++ b/CRM/Core/BAO/Note.php
@@ -574,4 +574,19 @@ WHERE participant.contact_id = %1 AND note.entity_table = 'civicr
m_participant'
}
}
+ /**
@colemanw
colemanw / gitpr
Last active October 14, 2016 13:10
GitPR script
#!/bin/bash
# start at top directory if we're not already there
pushd "$(git rev-parse --show-toplevel)" > /dev/null
# run style checker
civilint
if [[ $? == 1 ]]
then
echo "PR aborted"