Skip to content

Instantly share code, notes, and snippets.

@ronnieduke
ronnieduke / mura-custom-query-iterator.cfm
Created June 24, 2014 16:41
Use the Mura Iterator with a custom query
<cfquery name="rsExample">
SELECT content,siteID
FROM tcontent
WHERE .....
</cfquery>
<cfset it=application.serviceFactory.getBean("contentIterator")>
<cfset it.setQuery(rsExample)/>
<!--- Now Iterate and pull attributes that aren't in the query --->
<cfloop condition="it.hasNext()">
<cfset item=it.next()>
@ronnieduke
ronnieduke / mura-bulk-update.cfm
Last active August 29, 2015 14:03
Create bulk updates in Mura such as setting items to display, or show in nav
<!---
Place this file in your theme remote folder
--->
<cfscript>
// add the content ID of the folder you wish to loop through and turn on
itemID=''
content=$.getBean('content').loadBy(contentID=itemID);
// Only get the feed if it's a valid node
@ronnieduke
ronnieduke / config.xml.cfm
Last active August 29, 2015 14:05
Get Mura Site's Custom Image Sizes to use in a component or any other extended attribute
<theme>
<imagesizes>
<imagesize name="carouselimage" width="939" height="479" />
</imagesizes>
<extensions>
<extension type="Component" subType="Slider" hasBody="0">
<attributeset name="Slider Options" container="Basic">
<attribute
<cfscript>
feed=$.getBean('feed');
feed.setContentID($.getBean('content').loadBy(filename=$.content().getFilename() &'/slides').getContentID());
// pull items even if nav = 0
feed.setShowNavOnly(0);
// pull items even if display = 0
feed.setLiveOnly(0);
it=feed.getIterator();
</cfscript>
@ronnieduke
ronnieduke / fullCalendar.less
Last active August 29, 2015 14:07
Starter LESS code for Mura Full Calendar
//Full Calendar
.MuraCalendar{
// The Calendar header stuff
.fc-header{
.fc-button{
// Hover class added via js
&.fc-state-hover{
background-color: @primary;
background-image: none;
color: @white;
@ronnieduke
ronnieduke / geo.cfm
Created October 6, 2014 22:48
Free service for geo location
<cfif NOT StructKeyExists(cookie, "mylat") AND NOT StructKeyExists(cookie, "mylon")>
<cfparam name="country" default="US">
<cfparam name="results" default="">
<cftry>
<cfhttp url="http://freegeoip.net/xml/#cgi.remote_addr#" name="results" method="get" delimiter="#chr(10)#" timeout="10" />
<cfset colname = results.columnlist> <!--- there's only one column and its name isn't something we can reference it by --->
@ronnieduke
ronnieduke / placeholder.js
Last active July 11, 2017 15:11
jQuery Toggle Placeholder
// Placeholder Toggle jQuery Extension
$.fn.togglePlaceholder = function() {
return this.each(function() {
$(this)
.data("holder", $(this).attr("placeholder"))
.focusin(function(){
$(this).attr('placeholder','');
})
.focusout(function(){
$(this).attr('placeholder',$(this).data('holder'));
@ronnieduke
ronnieduke / form-builder-include
Created October 27, 2014 23:25
Mura Form Builder States List
Add this as the "custom object" source of your dropdown in form builder:
[m]$.siteConfig('themeAssetPath')[/m]/display_objects/states-list.cfm
@ronnieduke
ronnieduke / eventHandler.cfc
Last active August 29, 2015 14:08
Render Mura Extended Attributes yourself. This is useful when wanting to use custom javascript or design to enhance the UX of your extended attributes.
<!--- Drop this into your site or theme eventHandler.cfc --->
<cffunction name="onContentTabBasicBottomRender">
<cfset subType = application.configBean.getClassExtensionManager().getSubTypeByName("Folder","Blog", $.event('siteID'))>
<cfset extendSets = subType.getExtendSets(inherit=true,container='Custom',activeOnly=true)>
<cfoutput>
<!--- Loop through the extend sets --->
<cfloop from="1" to="#arrayLen(extendSets)#" index="s">
<cfset extendSetBean=extendSets[s]/>
@ronnieduke
ronnieduke / gist:c2231cda3f56e660549f
Created December 22, 2014 18:40
Get Sub Nav from a Mura Page by Content ID
<cfset bean=$.getBean('content').loadBy(contentID="whatever content ID")>
<cfset subNav=bean.getKidsIterator()>
<cfif subNav.hasNext()>
<ul>
<cfloop condition="subNav.hasNext()">
<cfset item=subNav.next()>
<li><a href="#item.getURL()#">#item.getMenuTitle()#</a></li>
</cfloop>
</ul>