Skip to content

Instantly share code, notes, and snippets.

@rbaty-barr
rbaty-barr / resetAdmin.txt
Last active April 21, 2017 17:38
If you get stuck type resources and references
The situation is this... you can no longer get into the umbraco backoffice for one reason or another... trust me it happens!
So, there is a package you can download and it works in most cases:
https://our.umbraco.org/projects/developer-tools/umbraco-admin-reset/
With this package you simply upload the dll to the server via ftp and place it in the .bin folder and you can login in with Admin and Admin1234!
===================================================
however, if you are doing local dev with a compact SQL DB you will have to open the db in web matrix or similar then you can use this command:
UPDATE umbracoUser set userdisabled=0, userLogin='admin', userPassword='bnWxWyFdCueCcKrqniYK9iAS+7E=' where id=0
@rbaty-barr
rbaty-barr / rewriteRule.xml
Last active July 19, 2017 17:02
Rewrite rules example for web.config
<rewrite>
<rules>
<rule name="orgRewrite" stopProcessing="true">
<match url="(.*)" ignoreCase="true" />
<conditions logicalGrouping="MatchAll">
<add input="{HTTP_HOST}" pattern="^www\.(.+)$" />
</conditions>
<action type="Redirect" url="http://{C:1}/{R:0}" appendQueryString="true" redirectType="Permanent" />
</rule>
<rule name="Redirects umbraco.io to actual domain" stopProcessing="true">
@rbaty-barr
rbaty-barr / calltoactionbutton.cshtml
Created June 30, 2017 16:54
Call to Action Button for salted template in umbraco grid
@inherits UmbracoViewPage<Lecoati.LeBlender.Extension.Models.LeBlenderModel>
@if (Model.Items.Any())
{
var isFrontEnd = Lecoati.LeBlender.Extension.Helper.IsFrontEnd();
foreach (var item in Model.Items)
@rbaty-barr
rbaty-barr / emailgrid.cshtml
Created June 30, 2017 16:57
here is my complete custom grid based on salted
@inherits UmbracoViewPage<dynamic>
@using Umbraco.Web.Templates
@using Newtonsoft.Json.Linq
@*
Razor helpers located at the bottom of this file
*@
@if (Model != null && Model.sections != null)
{
@rbaty-barr
rbaty-barr / search.cshtml
Last active July 24, 2017 12:57
This is a first pass at some search scripting for us to use - note, there are some config file updates, but this is just for quick storage
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage
@using System.Text
@using System.Text.RegularExpressions
@using Examine;
@using Examine.LuceneEngine.SearchCriteria;
@{
Layout = "InsideMain.cshtml";
}
@rbaty-barr
rbaty-barr / bstrap4MainNav.cshtml
Last active August 24, 2017 18:25
bootstrap v4 basic navigation script for umbraco
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage
@{
var homeActive = "active";
var homeUrl = @Model.Content.AncestorOrSelf(1);
}
<nav class="navbar navbar-expand-lg navbar-light bg-light" id="mainNav">
<button type="button" class="navbar-toggler w-100 border-0 text-left" data-toggle="collapse" data-target="#ba-nav" aria-controls="ba-nav" aria-expanded="false" aria-label="Toggle navigation">
@rbaty-barr
rbaty-barr / grid.config
Created September 6, 2017 14:50
This is a sample of a custom pre-vaule editor that is a checkbox property for the grid
[
{
"label": "Show by state",
"description": "Show this row for the following states.",
"key": "state",
"view": "/App_Plugins/StatePicker/state-picker-list.html",
"applyTo": "row",
"defaultConfig": {
"selectMultiple": true,
"displaySelectInversed": true,
@rbaty-barr
rbaty-barr / custom.js
Last active September 29, 2017 13:28
A class of helpers i am using for an intranet project
function getDateInfo(info) {
var test = info.toString();
$.ajax({
type: 'POST',
url: "/umbraco/surface/rendercalendar/listevents",
//contentType: "application/json; charset=utf-8",
data: {'matchThis': test},
datatype: "json",
success: function (data) {
console.log(data);
@rbaty-barr
rbaty-barr / gridContent.json
Last active October 17, 2017 14:20
indexing the grid
contentGrid:{
"name":"Main Layout",
"sections":[
{
"grid":12,
"rows":[
{
"name":"Single Cell Row",
"areas":[
{
@rbaty-barr
rbaty-barr / formsDocsMedia2.cshtml
Created December 1, 2017 19:43
forms and docs with mediapicker2
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage
@{
var mediaRoot = Model.Content.GetPropertyValue<IPublishedContent>("formsAndDocs");
}
<div id="formsDocsArea">
@if(mediaRoot != null && Model.Content.GetPropertyValue<string>("asHideShow") == "True"){
foreach( var item in mediaRoot.Children()){