From 891db0d7cc2ad802c785ec8c945ffe8c8923b9e3 Mon Sep 17 00:00:00 2001 From: Kev Zettler Date: Fri, 3 Jun 2011 15:05:55 -0700 Subject: [PATCH 01/29] added mixpanel.js and updated th emiddle ware to include it --- lib/locomotive/hosting/bushido/middleware.rb | 3 +- public/javascripts/mixpanel.js | 89 ++++++++++++++++++++ 2 files changed, 91 insertions(+), 1 deletion(-) create mode 100644 public/javascripts/mixpanel.js diff --git a/lib/locomotive/hosting/bushido/middleware.rb b/lib/locomotive/hosting/bushido/middleware.rb index 10df1bf7..d9896dd4 100644 --- a/lib/locomotive/hosting/bushido/middleware.rb +++ b/lib/locomotive/hosting/bushido/middleware.rb @@ -34,7 +34,8 @@ module Locomotive bushido.src = '#{BUSHIDO_JS_URL}?#{::Bushido::VERSION.gsub('.', '')}'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(bushido, s); })(); - + + STR ) diff --git a/public/javascripts/mixpanel.js b/public/javascripts/mixpanel.js new file mode 100644 index 00000000..db505a1d --- /dev/null +++ b/public/javascripts/mixpanel.js @@ -0,0 +1,89 @@ +var mpq = []; +mpq.push(["init", "YOUR TOKEN"]); +(function() { +var mp = document.createElement("script"); mp.type = "text/javascript"; mp.async = true; +mp.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') + "//api.mixpanel.com/site_media/js/api/mixpanel.js"; +var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(mp, s); +})(); + +$(function(){ + console.log('doc ready event'); + var section = $('body')[0].className; + + var props = { + app: window._bushido_app + ,claimed: window._bushido_claimed + }; + + mpq.push(["track_links", $('div#header h1 a.single'), 'big site name header click', props]); + mpq.push(["track_links", $('li.contents a'), "Contents", props]); + mpq.push(["track_links", $('li.assets a'), "Assets", props]); + mpq.push(["track_links", $('li.settings a'), "Settings", props]); + + + $('body.contents div#submenu li:first').each(function(){ + var $this = $(this); + $this.bind('mouseover', function(){ + //mpmetrics.track("pages hover"); + mpq.push(["track", "pages hover", props]); + }); + + // mpmetrics.track_links($this.find('div.header a'), "pages popup new item"); + // mpmetrics.track_links($this.find('div.inner a'), "pages popup inner links"); + }); + + $('body.contents div#submenu li:not(:first)').each(function(){ + var $this = $(this); + $this.bind('mouseover', function(){ + //mpmetrics.track("model hover"); + mpq.push(["track", "model hover", props]); + }); + + // mpmetrics.track_links($this.find('div.header a'), "model popup new item"); + // mpmetrics.track_links($this.find('div.inner a'), "model popup inner links"); + }); + + $('img.toggler').each(function(){ + var $this = $(this); + $this.bind('click', function(){ + mpq.push(["track", "hiearchy toggler click", props]); + }); + }) + + $('body.contents a.remove').each(function(){ + var $this = $(this); + $this.bind('click', function(){ + mpq.push(["track", "page trash click", props]); + }); + }); + + $('body.assets button span:contains(Create)').bind('click', function(){ + mpq.push(["track", "asset create", props]); + }); + + $('body.contents button span:contains(Create)').bind('click', function(){ + mpq.push(["track", "content create", props]); + }); + + $('fieldset span').each(function(){ + var $this = $(this); + + $this.bind('click', function(){ + var $content = $this.parent().next('ol') + ,state = ($content.is(':visible') === true) ? 'close' : 'open'; + mpq.push(["track", section+ " - "+$this.text()+" click to "+state, props]); + }); + }); + + $('input[type="text"]').each(function(){ + var $this = $(this); + $this.bind('change', function(){ + mpq.push(["track", section+ ' input '+$this.attr('name')+ " change" ,props]); + }); + }); + + $('h2 a.editable').bind('click', function(){ + mpq.push(["track", "editable title click" ,props]); + }); + +}); \ No newline at end of file From c39115f5aef3f9d59e54c5875f0018a8be73dc8c Mon Sep 17 00:00:00 2001 From: Kev Zettler Date: Fri, 3 Jun 2011 17:01:54 -0700 Subject: [PATCH 02/29] removed one off mixpanel stuff --- lib/locomotive/hosting/bushido/middleware.rb | 1 - public/javascripts/mixpanel.js | 89 -------------------- 2 files changed, 90 deletions(-) delete mode 100644 public/javascripts/mixpanel.js diff --git a/lib/locomotive/hosting/bushido/middleware.rb b/lib/locomotive/hosting/bushido/middleware.rb index d9896dd4..53fc27aa 100644 --- a/lib/locomotive/hosting/bushido/middleware.rb +++ b/lib/locomotive/hosting/bushido/middleware.rb @@ -35,7 +35,6 @@ module Locomotive var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(bushido, s); })(); - STR ) diff --git a/public/javascripts/mixpanel.js b/public/javascripts/mixpanel.js deleted file mode 100644 index db505a1d..00000000 --- a/public/javascripts/mixpanel.js +++ /dev/null @@ -1,89 +0,0 @@ -var mpq = []; -mpq.push(["init", "YOUR TOKEN"]); -(function() { -var mp = document.createElement("script"); mp.type = "text/javascript"; mp.async = true; -mp.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') + "//api.mixpanel.com/site_media/js/api/mixpanel.js"; -var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(mp, s); -})(); - -$(function(){ - console.log('doc ready event'); - var section = $('body')[0].className; - - var props = { - app: window._bushido_app - ,claimed: window._bushido_claimed - }; - - mpq.push(["track_links", $('div#header h1 a.single'), 'big site name header click', props]); - mpq.push(["track_links", $('li.contents a'), "Contents", props]); - mpq.push(["track_links", $('li.assets a'), "Assets", props]); - mpq.push(["track_links", $('li.settings a'), "Settings", props]); - - - $('body.contents div#submenu li:first').each(function(){ - var $this = $(this); - $this.bind('mouseover', function(){ - //mpmetrics.track("pages hover"); - mpq.push(["track", "pages hover", props]); - }); - - // mpmetrics.track_links($this.find('div.header a'), "pages popup new item"); - // mpmetrics.track_links($this.find('div.inner a'), "pages popup inner links"); - }); - - $('body.contents div#submenu li:not(:first)').each(function(){ - var $this = $(this); - $this.bind('mouseover', function(){ - //mpmetrics.track("model hover"); - mpq.push(["track", "model hover", props]); - }); - - // mpmetrics.track_links($this.find('div.header a'), "model popup new item"); - // mpmetrics.track_links($this.find('div.inner a'), "model popup inner links"); - }); - - $('img.toggler').each(function(){ - var $this = $(this); - $this.bind('click', function(){ - mpq.push(["track", "hiearchy toggler click", props]); - }); - }) - - $('body.contents a.remove').each(function(){ - var $this = $(this); - $this.bind('click', function(){ - mpq.push(["track", "page trash click", props]); - }); - }); - - $('body.assets button span:contains(Create)').bind('click', function(){ - mpq.push(["track", "asset create", props]); - }); - - $('body.contents button span:contains(Create)').bind('click', function(){ - mpq.push(["track", "content create", props]); - }); - - $('fieldset span').each(function(){ - var $this = $(this); - - $this.bind('click', function(){ - var $content = $this.parent().next('ol') - ,state = ($content.is(':visible') === true) ? 'close' : 'open'; - mpq.push(["track", section+ " - "+$this.text()+" click to "+state, props]); - }); - }); - - $('input[type="text"]').each(function(){ - var $this = $(this); - $this.bind('change', function(){ - mpq.push(["track", section+ ' input '+$this.attr('name')+ " change" ,props]); - }); - }); - - $('h2 a.editable').bind('click', function(){ - mpq.push(["track", "editable title click" ,props]); - }); - -}); \ No newline at end of file From 308fcd665adbcebec9443b1c8c034dd8719df4e4 Mon Sep 17 00:00:00 2001 From: Kev Zettler Date: Fri, 3 Jun 2011 21:27:19 -0700 Subject: [PATCH 03/29] re added mixpanel stuff --- lib/locomotive/hosting/bushido/middleware.rb | 1 + public/javascripts/mixpanel.js | 89 ++++++++++++++++++++ 2 files changed, 90 insertions(+) create mode 100644 public/javascripts/mixpanel.js diff --git a/lib/locomotive/hosting/bushido/middleware.rb b/lib/locomotive/hosting/bushido/middleware.rb index 53fc27aa..d9896dd4 100644 --- a/lib/locomotive/hosting/bushido/middleware.rb +++ b/lib/locomotive/hosting/bushido/middleware.rb @@ -35,6 +35,7 @@ module Locomotive var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(bushido, s); })(); + STR ) diff --git a/public/javascripts/mixpanel.js b/public/javascripts/mixpanel.js new file mode 100644 index 00000000..db505a1d --- /dev/null +++ b/public/javascripts/mixpanel.js @@ -0,0 +1,89 @@ +var mpq = []; +mpq.push(["init", "YOUR TOKEN"]); +(function() { +var mp = document.createElement("script"); mp.type = "text/javascript"; mp.async = true; +mp.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') + "//api.mixpanel.com/site_media/js/api/mixpanel.js"; +var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(mp, s); +})(); + +$(function(){ + console.log('doc ready event'); + var section = $('body')[0].className; + + var props = { + app: window._bushido_app + ,claimed: window._bushido_claimed + }; + + mpq.push(["track_links", $('div#header h1 a.single'), 'big site name header click', props]); + mpq.push(["track_links", $('li.contents a'), "Contents", props]); + mpq.push(["track_links", $('li.assets a'), "Assets", props]); + mpq.push(["track_links", $('li.settings a'), "Settings", props]); + + + $('body.contents div#submenu li:first').each(function(){ + var $this = $(this); + $this.bind('mouseover', function(){ + //mpmetrics.track("pages hover"); + mpq.push(["track", "pages hover", props]); + }); + + // mpmetrics.track_links($this.find('div.header a'), "pages popup new item"); + // mpmetrics.track_links($this.find('div.inner a'), "pages popup inner links"); + }); + + $('body.contents div#submenu li:not(:first)').each(function(){ + var $this = $(this); + $this.bind('mouseover', function(){ + //mpmetrics.track("model hover"); + mpq.push(["track", "model hover", props]); + }); + + // mpmetrics.track_links($this.find('div.header a'), "model popup new item"); + // mpmetrics.track_links($this.find('div.inner a'), "model popup inner links"); + }); + + $('img.toggler').each(function(){ + var $this = $(this); + $this.bind('click', function(){ + mpq.push(["track", "hiearchy toggler click", props]); + }); + }) + + $('body.contents a.remove').each(function(){ + var $this = $(this); + $this.bind('click', function(){ + mpq.push(["track", "page trash click", props]); + }); + }); + + $('body.assets button span:contains(Create)').bind('click', function(){ + mpq.push(["track", "asset create", props]); + }); + + $('body.contents button span:contains(Create)').bind('click', function(){ + mpq.push(["track", "content create", props]); + }); + + $('fieldset span').each(function(){ + var $this = $(this); + + $this.bind('click', function(){ + var $content = $this.parent().next('ol') + ,state = ($content.is(':visible') === true) ? 'close' : 'open'; + mpq.push(["track", section+ " - "+$this.text()+" click to "+state, props]); + }); + }); + + $('input[type="text"]').each(function(){ + var $this = $(this); + $this.bind('change', function(){ + mpq.push(["track", section+ ' input '+$this.attr('name')+ " change" ,props]); + }); + }); + + $('h2 a.editable').bind('click', function(){ + mpq.push(["track", "editable title click" ,props]); + }); + +}); \ No newline at end of file From 2bc79b27037968dc8a58812c53326319fea6c9ad Mon Sep 17 00:00:00 2001 From: Kev Zettler Date: Fri, 3 Jun 2011 21:40:52 -0700 Subject: [PATCH 04/29] added metrics token --- public/javascripts/mixpanel.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/public/javascripts/mixpanel.js b/public/javascripts/mixpanel.js index db505a1d..c8f4a5bc 100644 --- a/public/javascripts/mixpanel.js +++ b/public/javascripts/mixpanel.js @@ -1,5 +1,5 @@ var mpq = []; -mpq.push(["init", "YOUR TOKEN"]); +mpq.push(["init", _bushido_metrics_token]); (function() { var mp = document.createElement("script"); mp.type = "text/javascript"; mp.async = true; mp.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') + "//api.mixpanel.com/site_media/js/api/mixpanel.js"; @@ -7,7 +7,6 @@ var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(mp })(); $(function(){ - console.log('doc ready event'); var section = $('body')[0].className; var props = { From 40dfa83fad6c02d45d87d727ca1ae030a2ce6e11 Mon Sep 17 00:00:00 2001 From: Kev Zettler Date: Fri, 3 Jun 2011 22:30:09 -0700 Subject: [PATCH 05/29] expanded the hooks --- public/javascripts/mixpanel.js | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/public/javascripts/mixpanel.js b/public/javascripts/mixpanel.js index c8f4a5bc..233f5f3e 100644 --- a/public/javascripts/mixpanel.js +++ b/public/javascripts/mixpanel.js @@ -14,12 +14,22 @@ $(function(){ ,claimed: window._bushido_claimed }; - mpq.push(["track_links", $('div#header h1 a.single'), 'big site name header click', props]); - mpq.push(["track_links", $('li.contents a'), "Contents", props]); - mpq.push(["track_links", $('li.assets a'), "Assets", props]); - mpq.push(["track_links", $('li.settings a'), "Settings", props]); - - + mpq.push(["track_links", $('div#header h1 a.single'), 'big site name header click', props ]); + mpq.push(["track_links", $('div#global-actions-bar a:first'), 'account settings click', props ]); + mpq.push(["track_links", $('div#global-actions-bar a:eq(1)'), "see website", props ]); + mpq.push(["track_links", $('div#global-actions-bar a:eq(2)'), "log out", props ]); + mpq.push(["track_links", $('li.contents a'), "Contents", props]); + mpq.push(["track_links", $('li.assets a'), "Assets", props ]); + mpq.push(["track_links", $('li.settings a'), "Settings", props ]); + mpq.push(["track_links", $('#local-actions-bar a.new'), "generic new page", props ]); + mpq.push(["track_links", $('div.action a'), $('div.action a span').text(), props ]); + mpq.push(["track_links", $('div.action a'), $('div.action a span'), props ]); + mpq.push(["track_links", $('body div.span-12 p a'), 'contents back without saving', props ]); + mpq.push(["track_links", $('div#content div.inner a'), "Page hiearchy title click", props ]); + mpq.push(["track_links", $('p.no-items a'), "no assets, click here", props ]); + + mpq.push(["track_links", $('#bushi_banner_claim'), "BUSHI CLAIM CLICK!!!!!", props ]); + $('body.contents div#submenu li:first').each(function(){ var $this = $(this); $this.bind('mouseover', function(){ From d954b752851a18d00812c86b6e64627889bb85bf Mon Sep 17 00:00:00 2001 From: Sean Grove Date: Sat, 4 Jun 2011 22:18:14 -0700 Subject: [PATCH 06/29] bump bushido version --- Gemfile.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index f588a42a..66b76712 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -65,7 +65,7 @@ GEM bson (1.3.1) bson_ext (1.3.1) builder (2.1.2) - bushido (0.0.16) + bushido (0.0.17) highline (>= 1.6.1) json (>= 1.4.6) rest-client (>= 1.6.1) @@ -209,7 +209,7 @@ GEM thor (~> 0.14.4) rake (0.8.7) responders (0.6.4) - rest-client (1.6.1) + rest-client (1.6.3) mime-types (>= 1.16) rmagick (2.12.2) rspec (2.3.0) From ecbb517215244630e6b4a4f5884e720e84e5d29c Mon Sep 17 00:00:00 2001 From: Kev Zettler Date: Wed, 8 Jun 2011 11:20:04 -0700 Subject: [PATCH 07/29] removed embbed mixpanel stuff --- lib/locomotive/hosting/bushido/middleware.rb | 1 - public/javascripts/mixpanel.js | 98 -------------------- 2 files changed, 99 deletions(-) delete mode 100644 public/javascripts/mixpanel.js diff --git a/lib/locomotive/hosting/bushido/middleware.rb b/lib/locomotive/hosting/bushido/middleware.rb index d9896dd4..53fc27aa 100644 --- a/lib/locomotive/hosting/bushido/middleware.rb +++ b/lib/locomotive/hosting/bushido/middleware.rb @@ -35,7 +35,6 @@ module Locomotive var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(bushido, s); })(); - STR ) diff --git a/public/javascripts/mixpanel.js b/public/javascripts/mixpanel.js deleted file mode 100644 index 233f5f3e..00000000 --- a/public/javascripts/mixpanel.js +++ /dev/null @@ -1,98 +0,0 @@ -var mpq = []; -mpq.push(["init", _bushido_metrics_token]); -(function() { -var mp = document.createElement("script"); mp.type = "text/javascript"; mp.async = true; -mp.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') + "//api.mixpanel.com/site_media/js/api/mixpanel.js"; -var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(mp, s); -})(); - -$(function(){ - var section = $('body')[0].className; - - var props = { - app: window._bushido_app - ,claimed: window._bushido_claimed - }; - - mpq.push(["track_links", $('div#header h1 a.single'), 'big site name header click', props ]); - mpq.push(["track_links", $('div#global-actions-bar a:first'), 'account settings click', props ]); - mpq.push(["track_links", $('div#global-actions-bar a:eq(1)'), "see website", props ]); - mpq.push(["track_links", $('div#global-actions-bar a:eq(2)'), "log out", props ]); - mpq.push(["track_links", $('li.contents a'), "Contents", props]); - mpq.push(["track_links", $('li.assets a'), "Assets", props ]); - mpq.push(["track_links", $('li.settings a'), "Settings", props ]); - mpq.push(["track_links", $('#local-actions-bar a.new'), "generic new page", props ]); - mpq.push(["track_links", $('div.action a'), $('div.action a span').text(), props ]); - mpq.push(["track_links", $('div.action a'), $('div.action a span'), props ]); - mpq.push(["track_links", $('body div.span-12 p a'), 'contents back without saving', props ]); - mpq.push(["track_links", $('div#content div.inner a'), "Page hiearchy title click", props ]); - mpq.push(["track_links", $('p.no-items a'), "no assets, click here", props ]); - - mpq.push(["track_links", $('#bushi_banner_claim'), "BUSHI CLAIM CLICK!!!!!", props ]); - - $('body.contents div#submenu li:first').each(function(){ - var $this = $(this); - $this.bind('mouseover', function(){ - //mpmetrics.track("pages hover"); - mpq.push(["track", "pages hover", props]); - }); - - // mpmetrics.track_links($this.find('div.header a'), "pages popup new item"); - // mpmetrics.track_links($this.find('div.inner a'), "pages popup inner links"); - }); - - $('body.contents div#submenu li:not(:first)').each(function(){ - var $this = $(this); - $this.bind('mouseover', function(){ - //mpmetrics.track("model hover"); - mpq.push(["track", "model hover", props]); - }); - - // mpmetrics.track_links($this.find('div.header a'), "model popup new item"); - // mpmetrics.track_links($this.find('div.inner a'), "model popup inner links"); - }); - - $('img.toggler').each(function(){ - var $this = $(this); - $this.bind('click', function(){ - mpq.push(["track", "hiearchy toggler click", props]); - }); - }) - - $('body.contents a.remove').each(function(){ - var $this = $(this); - $this.bind('click', function(){ - mpq.push(["track", "page trash click", props]); - }); - }); - - $('body.assets button span:contains(Create)').bind('click', function(){ - mpq.push(["track", "asset create", props]); - }); - - $('body.contents button span:contains(Create)').bind('click', function(){ - mpq.push(["track", "content create", props]); - }); - - $('fieldset span').each(function(){ - var $this = $(this); - - $this.bind('click', function(){ - var $content = $this.parent().next('ol') - ,state = ($content.is(':visible') === true) ? 'close' : 'open'; - mpq.push(["track", section+ " - "+$this.text()+" click to "+state, props]); - }); - }); - - $('input[type="text"]').each(function(){ - var $this = $(this); - $this.bind('change', function(){ - mpq.push(["track", section+ ' input '+$this.attr('name')+ " change" ,props]); - }); - }); - - $('h2 a.editable').bind('click', function(){ - mpq.push(["track", "editable title click" ,props]); - }); - -}); \ No newline at end of file From a342f7e6b14693a776b7f5f2205aba6a89f69224 Mon Sep 17 00:00:00 2001 From: Kev Zettler Date: Wed, 6 Jul 2011 22:35:15 -0700 Subject: [PATCH 08/29] added hooks and dependencies for tutorial flow --- app/views/admin/pages/index.html.haml | 2 +- app/views/admin/shared/_header.html.haml | 2 + public/javascripts/admin/guiders-1.1.0.js | 322 +++++++++++++++++++++ public/javascripts/admin/tutorial.js | 43 +++ public/stylesheets/admin/guiders-1.1.0.css | 118 ++++++++ 5 files changed, 486 insertions(+), 1 deletion(-) create mode 100644 public/javascripts/admin/guiders-1.1.0.js create mode 100644 public/javascripts/admin/tutorial.js create mode 100755 public/stylesheets/admin/guiders-1.1.0.css diff --git a/app/views/admin/pages/index.html.haml b/app/views/admin/pages/index.html.haml index 9ab7f8b2..96346207 100644 --- a/app/views/admin/pages/index.html.haml +++ b/app/views/admin/pages/index.html.haml @@ -11,7 +11,7 @@ - if can? :create, Page - content_for :buttons do - = admin_button_tag :new, new_admin_page_url, :class => 'new' + = admin_button_tag :new, new_admin_page_url, :class => 'new', :id => "newpage" %p!= t('.help') diff --git a/app/views/admin/shared/_header.html.haml b/app/views/admin/shared/_header.html.haml index 8cbf602f..809de770 100644 --- a/app/views/admin/shared/_header.html.haml +++ b/app/views/admin/shared/_header.html.haml @@ -9,6 +9,8 @@ %span= '|' = link_to t('.switch'), '#', :id => 'sites-picker-link' %span= '|' + = link_to 'Help', '#guider=help', :id => "tutorial" + %span= '|' = link_to t('.logout'), destroy_admin_session_url, :confirm => t('admin.messages.confirm') diff --git a/public/javascripts/admin/guiders-1.1.0.js b/public/javascripts/admin/guiders-1.1.0.js new file mode 100644 index 00000000..a4982756 --- /dev/null +++ b/public/javascripts/admin/guiders-1.1.0.js @@ -0,0 +1,322 @@ +/** + * guiders.js + * + * version 1.1.0 + * + * Developed at Optimizely. (www.optimizely.com) + * We make A/B testing you'll actually use. + * + * Released under the Apache License 2.0. + * www.apache.org/licenses/LICENSE-2.0.html + * + * Questions about Guiders or Optimizely? + * Email us at jeff+pickhardt@optimizely.com or hello@optimizely.com. + * + * Enjoy! + */ + +var guiders = (function($){ + var guiders = { + version: "1.1.0", + + _defaultSettings: { + attachTo: null, + buttons: [{name: "Close"}], + buttonCustomHTML: "", + description: "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.", + isHashable: true, + onShow: null, + overlay: false, + position: 0, // 1-12 follows an analog clock, 0 means centered + title: "Sample title goes here", + width: 400 + }, + + _htmlSkeleton: [ + "
", + "
", + "

", + "

", + "
", + "
", + "
", + "
", + "
", + "
" + ].join(""), + + _arrowSize: 42, // = arrow's width and height + _guiders: {}, + _currentGuiderID: null, + _lastCreatedGuiderID: null, + + _addButtons: function(myGuider) { + // Add buttons + var guiderButtonsContainer = myGuider.elem.find(".guider_buttons"); + for (var i = myGuider.buttons.length-1; i >= 0; i--) { + var thisButton = myGuider.buttons[i]; + var thisButtonElem = $("", { + "class" : "guider_button", + "text" : thisButton.name }); + if (typeof thisButton.classString !== "undefined" && thisButton.classString !== null) { + thisButtonElem.addClass(thisButton.classString); + } + + guiderButtonsContainer.append(thisButtonElem); + + if (thisButton.onclick) { + thisButtonElem.bind("click", thisButton.onclick); + } else if (!thisButton.onclick && thisButton.name.toLowerCase() === "close") { + thisButtonElem.bind("click", function() { guiders.hideAll(); }); + } else if (!thisButton.onclick && thisButton.name.toLowerCase() === "next") { + thisButtonElem.bind("click", function() { guiders.next(); }); + } + } + + if (myGuider.buttonCustomHTML !== "") { + var myCustomHTML = $(myGuider.buttonCustomHTML); + myGuider.elem.find(".guider_buttons").append(myCustomHTML); + } + }, + + _attach: function(myGuider) { + if (typeof myGuider.attachTo === "undefined" || myGuider === null) { + return; + } + + var myHeight = myGuider.elem.innerHeight(); + var myWidth = myGuider.elem.innerWidth(); + + if (myGuider.position === 0) { + myGuider.elem.css("position", "absolute"); + myGuider.elem.css("top", ($(window).height() - myHeight) / 3 + $(window).scrollTop() + "px"); + myGuider.elem.css("left", ($(window).width() - myWidth) / 2 + $(window).scrollLeft() + "px"); + return; + } + + myGuider.attachTo = $(myGuider.attachTo); + var base = myGuider.attachTo.offset(); + var attachToHeight = myGuider.attachTo.innerHeight(); + var attachToWidth = myGuider.attachTo.innerWidth(); + + var top = base.top; + var left = base.left; + + var bufferOffset = 0.9 * guiders._arrowSize; + + var offsetMap = { // Follows the form: [height, width] + 1: [-bufferOffset - myHeight, attachToWidth - myWidth], + 2: [0, bufferOffset + attachToWidth], + 3: [attachToHeight/2 - myHeight/2, bufferOffset + attachToWidth], + 4: [attachToHeight - myHeight, bufferOffset + attachToWidth], + 5: [bufferOffset + attachToHeight, attachToWidth - myWidth], + 6: [bufferOffset + attachToHeight, attachToWidth/2 - myWidth/2], + 7: [bufferOffset + attachToHeight, 0], + 8: [attachToHeight - myHeight, -myWidth - bufferOffset], + 9: [attachToHeight/2 - myHeight/2, -myWidth - bufferOffset], + 10: [0, -myWidth - bufferOffset], + 11: [-bufferOffset - myHeight, 0], + 12: [-bufferOffset - myHeight, attachToWidth/2 - myWidth/2] + }; + + offset = offsetMap[myGuider.position]; + top += offset[0]; + left += offset[1]; + + myGuider.elem.css({ + "position":"absolute", + "top": top, + "left": left + }); + }, + + _guiderById: function(id) { + if (typeof guiders._guiders[id] === "undefined") { + throw "Cannot find guider with id " + id; + } + return guiders._guiders[id]; + }, + + _showOverlay: function() { + $("#guider_overlay").fadeIn("fast"); + }, + + _hideOverlay: function() { + $("#guider_overlay").fadeOut("fast"); + }, + + _initializeOverlay: function() { + if ($("#guider_overlay").length === 0) { + $("
").hide().appendTo("body"); + } + }, + + _styleArrow: function(myGuider) { + var position = myGuider.position || 0; + if (!position) { + return; + } + var myGuiderArrow = $(myGuider.elem.find(".guider_arrow")); + var newClass = { + 1: "guider_arrow_down", + 2: "guider_arrow_left", + 3: "guider_arrow_left", + 4: "guider_arrow_left", + 5: "guider_arrow_up", + 6: "guider_arrow_up", + 7: "guider_arrow_up", + 8: "guider_arrow_right", + 9: "guider_arrow_right", + 10: "guider_arrow_right", + 11: "guider_arrow_down", + 12: "guider_arrow_down" + }; + myGuiderArrow.addClass(newClass[position]); + + var myHeight = myGuider.elem.innerHeight(); + var myWidth = myGuider.elem.innerWidth(); + var arrowOffset = guiders._arrowSize / 2; + var positionMap = { + 1: ["right", arrowOffset], + 2: ["top", arrowOffset], + 3: ["top", myHeight/2 - arrowOffset], + 4: ["bottom", arrowOffset], + 5: ["right", arrowOffset], + 6: ["left", myWidth/2 - arrowOffset], + 7: ["left", arrowOffset], + 8: ["bottom", arrowOffset], + 9: ["top", myHeight/2 - arrowOffset], + 10: ["top", arrowOffset], + 11: ["left", arrowOffset], + 12: ["left", myWidth/2 - arrowOffset] + }; + var position = positionMap[myGuider.position]; + myGuiderArrow.css(position[0], position[1] + "px"); + }, + + /** + * One way to show a guider to new users is to direct new users to a URL such as + * http://www.mysite.com/myapp#guider=welcome + * + * This can also be used to run guiders on multiple pages, by redirecting from + * one page to another, with the guider id in the hash tag. + * + * Alternatively, if you use a session variable or flash messages after sign up, + * you can add selectively add JavaScript to the page: "guiders.show('first');" + */ + _showIfHashed: function(myGuider) { + var GUIDER_HASH_TAG = "guider="; + var hashIndex = window.location.hash.indexOf(GUIDER_HASH_TAG); + if (hashIndex !== -1) { + var hashGuiderId = window.location.hash.substr(hashIndex + GUIDER_HASH_TAG.length); + if (myGuider.id.toLowerCase() === hashGuiderId.toLowerCase()) { + // Success! + guiders.show(myGuider.id); + } + } + }, + + next: function() { + var currentGuider = guiders._guiders[guiders._currentGuiderID]; + if (typeof currentGuider === "undefined") { + return; + } + var nextGuiderId = currentGuider.next || null; + if (nextGuiderId !== null && nextGuiderId !== "") { + var myGuider = guiders._guiderById(nextGuiderId); + var omitHidingOverlay = myGuider.overlay ? true : false; + guiders.hideAll(omitHidingOverlay); + guiders.show(nextGuiderId); + } + }, + + createGuider: function(passedSettings) { + if (passedSettings === null || passedSettings === undefined) { + passedSettings = {}; + } + + // Extend those settings with passedSettings + myGuider = $.extend({}, guiders._defaultSettings, passedSettings); + myGuider.id = myGuider.id || String(Math.floor(Math.random() * 1000)); + + var guiderElement = $(guiders._htmlSkeleton); + myGuider.elem = guiderElement; + myGuider.elem.css("width", myGuider.width + "px"); + guiderElement.find("h1.guider_title").html(myGuider.title); + guiderElement.find("p.guider_description").html(myGuider.description); + + guiders._addButtons(myGuider); + + guiderElement.hide(); + guiderElement.appendTo("body"); + guiderElement.attr("id", myGuider.id); + + // Ensure myGuider.attachTo is a jQuery element. + if (typeof myGuider.attachTo !== "undefined" && myGuider !== null) { + guiders._attach(myGuider); + guiders._styleArrow(myGuider); + } + + guiders._initializeOverlay(); + + guiders._guiders[myGuider.id] = myGuider; + guiders._lastCreatedGuiderID = myGuider.id; + + /** + * If the URL of the current window is of the form + * http://www.myurl.com/mypage.html#guider=id + * then show this guider. + */ + if (myGuider.isHashable) { + guiders._showIfHashed(myGuider); + } + + return guiders; + }, + + hideAll: function(omitHidingOverlay) { + $(".guider").fadeOut("fast"); + if (typeof omitHidingOverlay !== "undefined" && omitHidingOverlay === true) { + // do nothing for now + } else { + guiders._hideOverlay(); + } + return guiders; + }, + + show: function(id) { + if (!id && guiders._lastCreatedGuiderID) { + id = guiders._lastCreatedGuiderID; + } + + var myGuider = guiders._guiderById(id); + if (myGuider.overlay) { + guiders._showOverlay(); + } + + guiders._attach(myGuider); + + // You can use an onShow function to take some action before the guider is shown. + if (myGuider.onShow) { + myGuider.onShow(myGuider); + } + + myGuider.elem.fadeIn("fast"); + + var windowHeight = $(window).height(); + var scrollHeight = $(window).scrollTop(); + var guiderOffset = myGuider.elem.offset(); + var guiderElemHeight = myGuider.elem.height(); + + if (guiderOffset.top - scrollHeight < 0 || + guiderOffset.top + guiderElemHeight + 40 > scrollHeight + windowHeight) { + window.scrollTo(0, Math.max(guiderOffset.top + (guiderElemHeight / 2) - (windowHeight / 2), 0)); + } + + guiders._currentGuiderID = id; + return guiders; + } + }; + + return guiders; +}).call(this, jQuery); diff --git a/public/javascripts/admin/tutorial.js b/public/javascripts/admin/tutorial.js new file mode 100644 index 00000000..daffe709 --- /dev/null +++ b/public/javascripts/admin/tutorial.js @@ -0,0 +1,43 @@ +$(document).ready(function(){ + + guiders.createGuider({ + description: "Welcome to LocomotiveCMS,

This guide will help you get up and running with locomotive", + buttons: [{name: "Quit Guide", onclick: guiders.hideAll}, + {name: "Continue", onclick: guiders.next}], + id: "welcome", + next: "help", + overlay: true, + title: "Welcome to Locomotive CMS" + }); + + guiders.createGuider({ + attachTo: "#tutorial", + buttons: [{name: "Close", onclick: guiders.hideAll}], + description: "How To:", + id: "help", + position: 6, + width: 200, + title: "Locomotive Tutorials", + }); + + $('#new_page_tutorial').click(function(){ + guiders.hideAll(); + guiders.show('newpage'); + return false; + }); + + + guiders.createGuider({ + attachTo: "#newpage", + buttons: [{name: "Close", onclick: guiders.hideAll}], + description: "Click above to make a new page", + id: "newpage", + position: 6, + width: 200, + title: "Make a new page", + }); + + +}); \ No newline at end of file diff --git a/public/stylesheets/admin/guiders-1.1.0.css b/public/stylesheets/admin/guiders-1.1.0.css new file mode 100755 index 00000000..b3808cd4 --- /dev/null +++ b/public/stylesheets/admin/guiders-1.1.0.css @@ -0,0 +1,118 @@ +.guider { + background: #FFF; + border: 1px solid #666; + font-family: arial; + position: absolute; + outline: none; + z-index: 100000005 !important; + padding: 4px 12px; + width: 500px; + z-index: 100; + + /* Shadow */ + -moz-box-shadow: 0 0px 8px #111; + -webkit-box-shadow: 0 0px 8px #111; + box-shadow: 0 0px 8px #111; + /* End shadow */ + + /* Rounded corners */ + -moz-border-radius: 4px; + -webkit-border-radius: 4px; + border-radius: 4px; + /* End rounded corners */ +} + +.guider_buttons { + height: 36px; + position: relative; + width: 100%; +} + +.guider_content { + position: relative; +} + +.guider_content h1 { + color: #1054AA; + font-size: 21px; +} + +.guider_content p { + color: #333; + font-size: 13px; +} + +.guider_button { + background: -moz-linear-gradient(top, #5CA9FF 0%, #3D79C3 100%); + background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #5CA9FF), color-stop(100%, #3D79C3)); + background-color: #4A95E0; /* overruled by background gradient, in browsers where they exist */ + border: solid 1px #4B5D7E; + color: #FFF; + cursor: pointer; + display: inline-block; + float: right; + font-size: 75%; + font-weight: bold; + margin-left: 6px; + min-width: 40px; + padding: 3px 5px; + text-align: center; + text-decoration: none; + /* Rounded corners */ + -moz-border-radius: 2px; + -webkit-border-radius: 2px; + border-radius: 2px; + /* End rounded corners */ +} + +#guider_overlay { + background-color: #000; + width: 100%; + height: 100%; + position: fixed; + top: 0px; + left: 0px; + opacity: 0.5; + -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=50)"; + filter: alpha(opacity=50); + z-index: 10; +} + +.guider_arrow { + width: 42px; + height: 42px; + position: absolute; + display: none; + background-repeat: no-repeat; + z-index: 100000006 !important; + + /** + * For optimization, the arrows image is inlined in the css below. + * + * To use your own arrows image, replace this background-image with your own arrows. + * It should have four arrows, top, right, left, and down. + */ + background-image: url(data:image/png;base64,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); + *background-image: url('guider_arrows.png'); +} + +.guider_arrow_right { + display: block; + background-position: 0px 0px; + right: -42px; +} +.guider_arrow_down { + display: block; + background-position: 0px -42px; + bottom: -42px; +} +.guider_arrow_up { + display: block; + background-position: 0px -126px; + top: -42px; +} +.guider_arrow_left { + display: block; + background-position: 0px -84px; + left: -42px; +} From ca2fad461d300ba0c18cfcb07bd47353c60d9218 Mon Sep 17 00:00:00 2001 From: Kev Zettler Date: Fri, 8 Jul 2011 01:20:29 -0700 Subject: [PATCH 09/29] omg awesome guides --- app/views/admin/shared/_header.html.haml | 4 +- config/assets.yml | 5 + config/environments/production.rb | 6 +- config/mongoid.yml | 2 +- public/javascripts/admin/application.js | 1 + public/javascripts/admin/tutorial.js | 156 ++++++++++++++++++++--- 6 files changed, 151 insertions(+), 23 deletions(-) diff --git a/app/views/admin/shared/_header.html.haml b/app/views/admin/shared/_header.html.haml index 809de770..1f91a180 100644 --- a/app/views/admin/shared/_header.html.haml +++ b/app/views/admin/shared/_header.html.haml @@ -4,12 +4,12 @@ #global-actions-bar != t('.welcome', :name => link_to(current_admin.name, edit_admin_my_account_url)) %span= '|' - = link_to t('.see'), current_site_url + = link_to t('.see'), current_site_url, :id => "viewsite_ele" - if multi_sites? && current_admin.sites.size > 1 %span= '|' = link_to t('.switch'), '#', :id => 'sites-picker-link' %span= '|' - = link_to 'Help', '#guider=help', :id => "tutorial" + = link_to 'Help', '#guider=help', :id => "help_ele" %span= '|' = link_to t('.logout'), destroy_admin_session_url, :confirm => t('admin.messages.confirm') diff --git a/config/assets.yml b/config/assets.yml index 7cbe65d0..3c0e8845 100644 --- a/config/assets.yml +++ b/config/assets.yml @@ -3,6 +3,8 @@ embed_assets: off s3_bucket: <%= ENV['S3_BUCKET'] %> s3_access_key_id: <%= ENV['S3_KEY_ID'] %> s3_secret_access_key: <%= ENV['S3_SECRET_KEY'] %> +compress_assets: off +package_assets: off javascripts: box: @@ -26,6 +28,8 @@ javascripts: - public/javascripts/admin/locales/datepicker_pt-BR.js - public/javascripts/admin/locales/datepicker_it.js - public/javascripts/admin/application.js + - public/javascripts/admin/guiders-1.1.0.js + - public/javascripts/admin/tutorial.js custom_fields: - public/javascripts/admin/plugins/fancybox.js - public/javascripts/admin/plugins/mustache.js @@ -91,6 +95,7 @@ stylesheets: - public/stylesheets/admin/sites_picker.css - public/stylesheets/admin/application.css - public/stylesheets/admin/safari.css + - public/stylesheets/admin/guiders-1.1.0.css fancybox: - public/stylesheets/admin/plugins/fancybox.css - public/stylesheets/admin/fancybox_changes.css diff --git a/config/environments/production.rb b/config/environments/production.rb index 4235de2b..5a592d50 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -3,11 +3,11 @@ Locomotive::Application.configure do # The production environment is meant for finished, "live" apps. # Code is not reloaded between requests - config.cache_classes = true + config.cache_classes = false # Full error reports are disabled and caching is turned on config.consider_all_requests_local = false - config.action_controller.perform_caching = true + config.action_controller.perform_caching = false # Specifies the header that your server uses for sending files config.action_dispatch.x_sendfile_header = "X-Sendfile" @@ -29,7 +29,7 @@ Locomotive::Application.configure do # Disable Rails's static asset server # In production, Apache or nginx will already do this - config.serve_static_assets = false + config.serve_static_assets = true # Enable serving of images, stylesheets, and javascripts from an asset server # config.action_controller.asset_host = "http://assets.example.com" diff --git a/config/mongoid.yml b/config/mongoid.yml index 8b08b667..15b7e247 100644 --- a/config/mongoid.yml +++ b/config/mongoid.yml @@ -31,4 +31,4 @@ production: # uri: <%= ENV['MONGOHQ_URL'] %> # bushido (mongohq_url will also work) - uri: <%= ENV['MONGODB_URL'] %> + uri: <%= ENV['MONGODB_URL'] %> diff --git a/public/javascripts/admin/application.js b/public/javascripts/admin/application.js index 7137c620..c3b2a459 100644 --- a/public/javascripts/admin/application.js +++ b/public/javascripts/admin/application.js @@ -101,6 +101,7 @@ $(document).ready(function() { var newValue = prompt(hint, $(this).html()); if (newValue && newValue != '') { $(this).html(newValue); + try{guiders.next();}catch(ex){} target.val(newValue); } event.preventDefault(); diff --git a/public/javascripts/admin/tutorial.js b/public/javascripts/admin/tutorial.js index daffe709..7a513c96 100644 --- a/public/javascripts/admin/tutorial.js +++ b/public/javascripts/admin/tutorial.js @@ -1,37 +1,147 @@ $(document).ready(function(){ + /* + * + * /admin/pages + * + */ + if(window.location.pathname == "/admin/pages"){ + + guiders.createGuider({ + attachTo: "undefined", + description: "Thank you for choosing LocomotiveCMS!,

\ + This guide will help you get up and running.\ + We will walk you through some common tasks of LocomotiveCMS.\ + This guide can be reached at any time by clicking the \"Help\" link

\ + Lets start by editing a page.", + buttons: [{name: "Quit", onclick: guiders.hideAll}, + {name: "Next"}], + id: "welcome", + next: "pagewelcome", + overlay: true, + title: "Welcome to Locomotive CMS" + }); + + guiders.createGuider({ + attachTo: "#help_ele", + buttons: [], + description: "Click 'help' in the future to start these guides", + id: "welcome", + next: "pagewelcome", + position: 6, + width: 260, + height: 100, + title: "" + }); + + + guiders.createGuider({ + attachTo: "ul.folder:first li", + buttons: [], + description: "These are pages. You can click on the page name to edit it.", + id: "pagepointer", + next: "editpagewelcome", + width: 200, + position: 9, + title: "" + }); + + guiders.createGuider({ + attachTo: "undefined", + description: "A page is a collection of content on your site that can be reached at a web address

For this example we will edit the 'About Us' page. To do that you would click on the page name.", + buttons: [{name: "Quit", onclick: guiders.hideAll}, + {name: "Next", onclick: function(){ + window.location = $('ul.folder:first li a').attr('href') + "#guider=editpagewelcome" + } + }], + id: "pagewelcome", + next: "editpagewelcome", + overlay: true, + title: "What is a page?", + onShow: function(){ + guiders.show('pagepointer') + } + }); + + } + + + /* + * + * /admin/pages/edit + * + */ + if(window.location.pathname.indexOf('edit') !== -1){ + guiders.createGuider({ + attachTo: "undefined", + description: "You are now editing the '"+$('a.editable:first').text()+"' page. Lets start by changing the title of this page.", + buttons: [{name: "Quit", onclick: guiders.hideAll}, + {name: "Next"}], + id: "editpagewelcome", + next: "editpagetitle", + overlay: true, + title: "Editing A Page" + }); + + guiders.createGuider({ + attachTo: "a.editable:first", + buttons: [], + description: "", + id: "editpagetitle", + next: "help", + position: 6, + width: 250, + height: 100, + title: "Click here to edit the page title" + }); + + guiders.createGuider({ + description: "A page is a collection of content on your site that can be reached by an address", + buttons: [{name: "Quit", onclick: guiders.hideAll}, + {name: "Next"}], + id: "pagetitle", + next: "editpagecontent", + title: "How to Change a Page Title" + }); + + } + guiders.createGuider({ - description: "Welcome to LocomotiveCMS,

This guide will help you get up and running with locomotive", - buttons: [{name: "Quit Guide", onclick: guiders.hideAll}, - {name: "Continue", onclick: guiders.next}], - id: "welcome", - next: "help", - overlay: true, - title: "Welcome to Locomotive CMS" - }); - - guiders.createGuider({ - attachTo: "#tutorial", - buttons: [{name: "Close", onclick: guiders.hideAll}], + attachTo: "#help_ele", + buttons: [{name: "Quit", onclick: guiders.hideAll}], description: "How To:", +
  • Make a new Page
  • \ +
  • View Your Site
  • \ +
  • Edit A Page
  • \ +
  • Create Content
  • \ +
  • Save Your Site
  • \ +
  • Edit a a Content instance
  • \ +
  • Edit your site's settings
  • ", id: "help", position: 6, width: 200, title: "Locomotive Tutorials", }); - $('#new_page_tutorial').click(function(){ + $(".tutorial").click(function(){ guiders.hideAll(); - guiders.show('newpage'); + guiders.show($(this).attr('id')); return false; }); + $('#new_page_tutorial').click(function(){ + if($('#newpage').length > 0){ + guiders.hideAll(); + guiders.show('newpage'); + }else{ + window.location = "/admin/pages#guider=newpage" + } + return false; + }); guiders.createGuider({ attachTo: "#newpage", - buttons: [{name: "Close", onclick: guiders.hideAll}], + buttons: [{name: "Quit", onclick: guiders.hideAll}], description: "Click above to make a new page", id: "newpage", position: 6, @@ -39,5 +149,17 @@ $(document).ready(function(){ title: "Make a new page", }); + guiders.createGuider({ + attachTo: "#viewsite_ele", + buttons: [{name: "Quit", onclick: guiders.hideAll}], + description: "This will take you to the 'frontend' of your site. Where you can see what users visiting your site see.", + id: "viewsite", + position: 6, + width: 250, + title: "Click Here To View Your Site", + }); + + + }); \ No newline at end of file From 058e97d376bf048549050911e627035660d3e3e9 Mon Sep 17 00:00:00 2001 From: Kev Zettler Date: Sun, 10 Jul 2011 11:02:06 -0700 Subject: [PATCH 10/29] settings and model edit guides --- app/views/admin/shared/_header.html.haml | 4 +- public/images/admin/guider_arrows.png | Bin 0 -> 3875 bytes public/javascripts/admin/tutorial.js | 306 +++++++++++++++++++---- 3 files changed, 265 insertions(+), 45 deletions(-) create mode 100644 public/images/admin/guider_arrows.png diff --git a/app/views/admin/shared/_header.html.haml b/app/views/admin/shared/_header.html.haml index 1f91a180..779933a8 100644 --- a/app/views/admin/shared/_header.html.haml +++ b/app/views/admin/shared/_header.html.haml @@ -4,12 +4,12 @@ #global-actions-bar != t('.welcome', :name => link_to(current_admin.name, edit_admin_my_account_url)) %span= '|' - = link_to t('.see'), current_site_url, :id => "viewsite_ele" + = link_to t('.see'), current_site_url, :id => "viewsite_ele", :target => "_blank" - if multi_sites? && current_admin.sites.size > 1 %span= '|' = link_to t('.switch'), '#', :id => 'sites-picker-link' %span= '|' - = link_to 'Help', '#guider=help', :id => "help_ele" + = link_to 'Help', '#guider=help', :class => "tutorial", :id => "help" %span= '|' = link_to t('.logout'), destroy_admin_session_url, :confirm => t('admin.messages.confirm') diff --git a/public/images/admin/guider_arrows.png b/public/images/admin/guider_arrows.png new file mode 100644 index 0000000000000000000000000000000000000000..ed1d643f86531940bd4c59d93ca3b436388b82f5 GIT binary patch literal 3875 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 K?doiZiT?p>{j_TU literal 0 HcmV?d00001 diff --git a/public/javascripts/admin/tutorial.js b/public/javascripts/admin/tutorial.js index 7a513c96..644f23a9 100644 --- a/public/javascripts/admin/tutorial.js +++ b/public/javascripts/admin/tutorial.js @@ -7,6 +7,26 @@ $(document).ready(function(){ */ if(window.location.pathname == "/admin/pages"){ + $('#new_page_tutorial').click(function(){ + if($('#newpage').length > 0){ + guiders.hideAll(); + guiders.show('newpage'); + }else{ + window.location = "/admin/pages#guider=newpage" + } + return false; + }); + + guiders.createGuider({ + attachTo: "#newpage", + buttons: [{name: "Close", onclick: guiders.hideAll}], + description: "Click above to make a new page", + id: "newpage", + position: 6, + width: 200, + title: "Make a new page", + }); + guiders.createGuider({ attachTo: "undefined", description: "Thank you for choosing LocomotiveCMS!,

    \ @@ -23,7 +43,7 @@ $(document).ready(function(){ }); guiders.createGuider({ - attachTo: "#help_ele", + attachTo: "#help", buttons: [], description: "Click 'help' in the future to start these guides", id: "welcome", @@ -34,7 +54,6 @@ $(document).ready(function(){ title: "" }); - guiders.createGuider({ attachTo: "ul.folder:first li", buttons: [], @@ -48,10 +67,11 @@ $(document).ready(function(){ guiders.createGuider({ attachTo: "undefined", - description: "A page is a collection of content on your site that can be reached at a web address

    For this example we will edit the 'About Us' page. To do that you would click on the page name.", + description: "A page is a collection of content on your site that can be reached at a web address

    \ + For this example we will edit the '"+$('ul.folder:first li a:first').text()+"' page. To do that you would click on the page name.", buttons: [{name: "Quit", onclick: guiders.hideAll}, - {name: "Next", onclick: function(){ - window.location = $('ul.folder:first li a').attr('href') + "#guider=editpagewelcome" + {name: "Next - Edit "+$('ul.folder:first li a:first').text()+"", onclick: function(){ + window.location = $('ul.folder:first li a:first').attr('href') + "#guider=editpagewelcome" } }], id: "pagewelcome", @@ -62,6 +82,78 @@ $(document).ready(function(){ guiders.show('pagepointer') } }); + + guiders.createGuider({ + attachTo: 'li.hoverable:last', + buttons: [], + description: "These are models.
    You can hover over to edit them.", + id: "modelpointer", + next: "editpagewelcome", + width: 240, + position: 3, + title: "" + }); + + guiders.createGuider({ + attachTo: 'div.action span', + buttons: [], + description: "You can click here to make a new model", + id: "newmodelpointer", + next: "editpagewelcome", + position: 6, + width: 200, + title: "" + }); + + guiders.createGuider({ + attachTo: "undefined", + description: "What is a model?
    \ + The concept of a model within locomotiveCMS is a peice of content that you might reuse through out your site.\ + Some example models could be: Blog posts, Products, Events, Locations, Photos

    \ + For this next section of the guide. We will edit our event model", + buttons: [{name: "Quit", onclick: guiders.hideAll}, + {name: "Next - Edit an Event", onclick: function(){ + /* + * + * This is really britle + * + */ + window.location = $('.inner:eq(3) li:first a').attr('href'); + }}], + id: "modelwelcome", + next: "newmodel", + overlay: true, + title: "Lets talk about Models...", + onShow: function(){ + guiders.show("modelpointer"); + guiders.show('newmodelpointer'); + } + }); + + guiders.createGuider({ + attachTo: 'li.settings', + buttons: [], + description: "Click this tab to edit your settings.", + id: "settingspointer", + position: 3, + width: 200, + title: "" + }); + + guiders.createGuider({ + attachTo: "undefined", + description: "LocomotiveCMS has several features that you can adjust in the settings panel. Lets head there now!", + buttons: [{name: "Quit", onclick: guiders.hideAll}, + {name: "Next - Goto Settings", onclick: function(){ + window.location = $('li.settings').attr('href'); + }}], + id: "settingswelcome", + overlay: true, + title: "How To Change Your Settings", + onShow: function(){ + guiders.show("settingspointer"); + } + }); } @@ -71,7 +163,7 @@ $(document).ready(function(){ * /admin/pages/edit * */ - if(window.location.pathname.indexOf('edit') !== -1){ + if(window.location.pathname.match('admin/pages/.+\/edit') != null){ guiders.createGuider({ attachTo: "undefined", description: "You are now editing the '"+$('a.editable:first').text()+"' page. Lets start by changing the title of this page.", @@ -86,41 +178,179 @@ $(document).ready(function(){ guiders.createGuider({ attachTo: "a.editable:first", buttons: [], - description: "", + title: "", id: "editpagetitle", - next: "help", + next: "greatjob", position: 6, - width: 250, + width: 200, height: 100, - title: "Click here to edit the page title" + description: "Click here to edit the page title" }); - + guiders.createGuider({ - description: "A page is a collection of content on your site that can be reached by an address", + attachTo: "undefined", + description: "You just changed the title of this page. Lets continue by editing the page content.", buttons: [{name: "Quit", onclick: guiders.hideAll}, {name: "Next"}], - id: "pagetitle", - next: "editpagecontent", - title: "How to Change a Page Title" + id: "greatjob", + next: "savepageedit", + overlay: true, + title: "Great Job!" + }); + + // guiders.createGuider({ + // attachTo: "li.text:first label", + // description: "You can edit the content of your page in this text box", + // id: "pageeditcontent", + // next: "savepageedit", + // position: 6, + // title: "Edit the content of the page" + // }); + + guiders.createGuider({ + buttons: [], + attachTo: "button.light:last", + description: "Click this update button to save any changes you've made to the page.", + id: "savepageedit", + next: "help", + position: 12, + title: "Save Your Work", + onShow: function(){ + $('form.save-with-shortcut').attr('action', + $('form.save-with-shortcut').attr('action')+"#guider=editsavesuccess"); + } + }); + + guiders.createGuider({ + attachTo: "undefined", + description: "Great work! you've update this page. You can review your work by checking out the 'frontend' of the site.", + buttons: [{name: "Quit", onclick: guiders.hideAll}, + {name: "Next"}], + id: "editsavesuccess", + next: "viewsite2", + overlay: true, + title: "Page Saved Successfully!" + }); + + guiders.createGuider({ + attachTo: "#viewsite_ele", + buttons: [], + description: "This will open a new tab in your browser and take you to the 'frontend' of your site. The frontend is what other visitors to your sit will see. Come back to this tab in your browser to continue the guide.", + id: "viewsite2", + next: "editfinish", + position: 6, + width: 280, + title: "Click Here To View Your Site", + onShow: function(){ + console.log("binding click for view site", $('#viewsite_ele')); + $('#viewsite_ele').bind('click', function(){ + console.log("viewsite click!"); + guiders.next(); + //should probably unbind this to prevent double clicking + }); + } + }); + + guiders.createGuider({ + attachTo: "undefined", + description: "Congratulations. You've just edited a page using LocomotiveCMS! Moving on, we will now move onto models. Lets return to the admin home.", + buttons: [{name: "Quit", onclick: guiders.hideAll}, + {name: "Next - Goto Admin Home", onclick: function(){ + window.location = "/admin/pages#guider=modelwelcome" + }}], + id: "editfinish", + overlay: true, + title: "Done editing." }); } + /* + * + * Content edits + * + */ + if(window.location.pathname.match('admin/content_types/events/contents/.+/edit') != null){ + + } + + + /* + * + * Settings page + * + */ + if(window.location.pathname.match("admin/current_site/edit") != null){ + + guiders.createGuider({ + attachTo: "undefined", + description: "Welcome to the Settings page. Here you can create new user accounts to use LocomotiveCMS, Edit SEO options, and more. We will start by changing the subomain of our site.", + buttons: [{name: "Quit", onclick: guiders.hideAll}, + {name: "Next"}], + id: "settingseditwelcome", + next: "editsubdomain", + overlay: true, + title: "The Settings Page" + }); + + guiders.createGuider({ + attachTo: "#site_subdomain", + description: "Edit this field to change the subdomain of your site", + buttons: [], + id: "editsubdomain", + next: "settingssave", + position: 12, + onShow: function(){ + $('#site_subdomain').bind('change', function(){ + guiders.next(); + }); + } + }); + + guiders.createGuider({ + buttons: [], + attachTo: "button.light:last", + description: "Click this update button to save any changes you've made to the settings.", + id: "settingssave", + position: 12, + title: "Save Your Work", + onShow: function(){ + $('form.save-with-shortcut').attr('action', + $('form.save-with-shortcut').attr('action')+"#guider=settingssavesuccess"); + } + }); + + guiders.createGuider({ + attachTo: "undefined", + description: "You've Successfully updated your LocomotiveCMS settings", + buttons: [{name: "Quit", onclick: guiders.hideAll}, + {name: "Next"}], + id: "settingssavesuccess", + next: "editsubdomain", + overlay: true, + title: "Great Work!" + }); + } + + + /* + * + * Global + * + */ guiders.createGuider({ - attachTo: "#help_ele", + attachTo: "#help", buttons: [{name: "Quit", onclick: guiders.hideAll}], description: "How To:", id: "help", position: 6, width: 200, - title: "Locomotive Tutorials", + title: "Locomotive Guides", }); $(".tutorial").click(function(){ @@ -129,36 +359,26 @@ $(document).ready(function(){ return false; }); - $('#new_page_tutorial').click(function(){ - if($('#newpage').length > 0){ - guiders.hideAll(); - guiders.show('newpage'); - }else{ - window.location = "/admin/pages#guider=newpage" - } - return false; - }); - - guiders.createGuider({ - attachTo: "#newpage", - buttons: [{name: "Quit", onclick: guiders.hideAll}], - description: "Click above to make a new page", - id: "newpage", - position: 6, - width: 200, - title: "Make a new page", - }); - guiders.createGuider({ attachTo: "#viewsite_ele", - buttons: [{name: "Quit", onclick: guiders.hideAll}], + buttons: [{name: "Close", onclick: guiders.hideAll}], description: "This will take you to the 'frontend' of your site. Where you can see what users visiting your site see.", id: "viewsite", position: 6, - width: 250, + width: 280, title: "Click Here To View Your Site", }); + guiders.createGuider({ + attachTo: "undefined", + description: "You've gone through the LocomotiveCMS guide! For more info on LocomotiveCMS,\ + checkout out The LocomotiveCMS support pages", + buttons: [{name: "Quit", onclick: guiders.hideAll}, + {name: "Next"}], + id: "congratulations", + overlay: true, + title: "Congratulations!" + }); From d997741842d82a52955cb0fcee8d8665e1457f0a Mon Sep 17 00:00:00 2001 From: Kev Zettler Date: Sun, 10 Jul 2011 14:32:26 -0700 Subject: [PATCH 11/29] everythings hooked up --- public/javascripts/admin/tutorial.js | 55 ++++++++++++++++++++++++---- 1 file changed, 47 insertions(+), 8 deletions(-) diff --git a/public/javascripts/admin/tutorial.js b/public/javascripts/admin/tutorial.js index 644f23a9..1020069f 100644 --- a/public/javascripts/admin/tutorial.js +++ b/public/javascripts/admin/tutorial.js @@ -110,7 +110,7 @@ $(document).ready(function(){ description: "What is a model?
    \ The concept of a model within locomotiveCMS is a peice of content that you might reuse through out your site.\ Some example models could be: Blog posts, Products, Events, Locations, Photos

    \ - For this next section of the guide. We will edit our event model", + For this next section of the guide. We will edit our Event model. '"+$('.inner:eq(3) li:first a').text()+"' ", buttons: [{name: "Quit", onclick: guiders.hideAll}, {name: "Next - Edit an Event", onclick: function(){ /* @@ -118,7 +118,7 @@ $(document).ready(function(){ * This is really britle * */ - window.location = $('.inner:eq(3) li:first a').attr('href'); + window.location = $('.inner:eq(3) li:first a').attr('href') + "#guider=editmodelwelcome"; }}], id: "modelwelcome", next: "newmodel", @@ -131,7 +131,7 @@ $(document).ready(function(){ }); guiders.createGuider({ - attachTo: 'li.settings', + attachTo: 'li.settings a', buttons: [], description: "Click this tab to edit your settings.", id: "settingspointer", @@ -145,7 +145,7 @@ $(document).ready(function(){ description: "LocomotiveCMS has several features that you can adjust in the settings panel. Lets head there now!", buttons: [{name: "Quit", onclick: guiders.hideAll}, {name: "Next - Goto Settings", onclick: function(){ - window.location = $('li.settings').attr('href'); + window.location = $('li.settings a').attr('href') + "#guider=settingseditwelcome"; }}], id: "settingswelcome", overlay: true, @@ -256,7 +256,7 @@ $(document).ready(function(){ description: "Congratulations. You've just edited a page using LocomotiveCMS! Moving on, we will now move onto models. Lets return to the admin home.", buttons: [{name: "Quit", onclick: guiders.hideAll}, {name: "Next - Goto Admin Home", onclick: function(){ - window.location = "/admin/pages#guider=modelwelcome" + window.location = "/admin/pages#guider=modelwelcome"; }}], id: "editfinish", overlay: true, @@ -272,6 +272,43 @@ $(document).ready(function(){ */ if(window.location.pathname.match('admin/content_types/events/contents/.+/edit') != null){ + guiders.createGuider({ + attachTo: "undefined", + description: "You are now edting an instance of our event model.\ + Make some changes to this event model and it will be reflected everywhere the data is used throught the site.", + buttons: [{name: "Quit", onclick: guiders.hideAll}, + {name: "Next"}], + id: "editmodelwelcome", + next: "savemodel", + overlay: true, + title: "Editing an Event model" + }); + + guiders.createGuider({ + buttons: [], + attachTo: "button.light:last", + description: "Click this update button to save any changes you've made to the page.", + id: "savemodel", + position: 12, + title: "Save Your Work", + onShow: function(){ + $('form.save-with-shortcut').attr('action', + $('form.save-with-shortcut').attr('action')+"#guider=editsavesuccess"); + } + }); + + guiders.createGuider({ + attachTo: "undefined", + description: "You've Successfully updated this model", + buttons: [{name: "Quit", onclick: guiders.hideAll}, + {name: "Next - Goto Admin Home", onclick: function(){ + window.location = "/admin/pages#guider=settingswelcome"; + }}], + id: "modelsavesuccess", + overlay: true, + title: "Great Work!" + }); + } @@ -282,6 +319,8 @@ $(document).ready(function(){ */ if(window.location.pathname.match("admin/current_site/edit") != null){ + + guiders.createGuider({ attachTo: "undefined", description: "Welcome to the Settings page. Here you can create new user accounts to use LocomotiveCMS, Edit SEO options, and more. We will start by changing the subomain of our site.", @@ -299,6 +338,7 @@ $(document).ready(function(){ buttons: [], id: "editsubdomain", next: "settingssave", + title: '', position: 12, onShow: function(){ $('#site_subdomain').bind('change', function(){ @@ -316,7 +356,7 @@ $(document).ready(function(){ title: "Save Your Work", onShow: function(){ $('form.save-with-shortcut').attr('action', - $('form.save-with-shortcut').attr('action')+"#guider=settingssavesuccess"); + $('form.save-with-shortcut').attr('action')+"#guider=modelsavesuccess"); } }); @@ -373,8 +413,7 @@ $(document).ready(function(){ attachTo: "undefined", description: "You've gone through the LocomotiveCMS guide! For more info on LocomotiveCMS,\ checkout out The LocomotiveCMS support pages", - buttons: [{name: "Quit", onclick: guiders.hideAll}, - {name: "Next"}], + buttons: [{name: "Finished!", onclick: guiders.hideAll}], id: "congratulations", overlay: true, title: "Congratulations!" From 904bed1c10d05f37a4620d2282f6d4237ef6f336 Mon Sep 17 00:00:00 2001 From: Kev Zettler Date: Sun, 10 Jul 2011 14:46:03 -0700 Subject: [PATCH 12/29] hooked up the index menu to appropriate guides --- public/javascripts/admin/tutorial.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/javascripts/admin/tutorial.js b/public/javascripts/admin/tutorial.js index 1020069f..d1cdca4e 100644 --- a/public/javascripts/admin/tutorial.js +++ b/public/javascripts/admin/tutorial.js @@ -293,7 +293,7 @@ $(document).ready(function(){ title: "Save Your Work", onShow: function(){ $('form.save-with-shortcut').attr('action', - $('form.save-with-shortcut').attr('action')+"#guider=editsavesuccess"); + $('form.save-with-shortcut').attr('action')+"#guider=modelsavesuccess"); } }); @@ -386,7 +386,7 @@ $(document).ready(function(){
  • View Your Site
  • \
  • Edit A Page
  • \
  • Edit a a Content instance
  • \ -
  • Edit your site's settings
  • ", +
  • Edit your site's settings
  • ", id: "help", position: 6, width: 200, From 7ca3e7fec77e048dc34232be780c8a1a1dfaa345 Mon Sep 17 00:00:00 2001 From: Kev Zettler Date: Mon, 11 Jul 2011 15:55:16 -0700 Subject: [PATCH 13/29] adding some conditinal functions to tutorial.js to help with no datat off bushido locomotive installs --- public/javascripts/admin/tutorial.js | 63 +++++++++++++++++++++------- 1 file changed, 48 insertions(+), 15 deletions(-) diff --git a/public/javascripts/admin/tutorial.js b/public/javascripts/admin/tutorial.js index d1cdca4e..f4568bb1 100644 --- a/public/javascripts/admin/tutorial.js +++ b/public/javascripts/admin/tutorial.js @@ -53,9 +53,22 @@ $(document).ready(function(){ height: 100, title: "" }); + + var pagehook = (function(){ + var possibles = ['ul.folder:first li', + 'ul#pages-list li']; + for(var i = 0; i 0){ + return possibles[i]; + } + } + }()); + + console.log('lol page hook', pagehook); guiders.createGuider({ - attachTo: "ul.folder:first li", + attachTo: pagehook, buttons: [], description: "These are pages. You can click on the page name to edit it.", id: "pagepointer", @@ -68,10 +81,10 @@ $(document).ready(function(){ guiders.createGuider({ attachTo: "undefined", description: "A page is a collection of content on your site that can be reached at a web address

    \ - For this example we will edit the '"+$('ul.folder:first li a:first').text()+"' page. To do that you would click on the page name.", + For this example we will edit the '"+$(pagehook+' a:first').text()+"' page. To do that you would click on the page name.", buttons: [{name: "Quit", onclick: guiders.hideAll}, - {name: "Next - Edit "+$('ul.folder:first li a:first').text()+"", onclick: function(){ - window.location = $('ul.folder:first li a:first').attr('href') + "#guider=editpagewelcome" + {name: "Next - Edit "+$(pagehook+' a:first').text()+"", onclick: function(){ + window.location = $(pagehook+' a:first').attr('href') + "#guider=editpagewelcome" } }], id: "pagewelcome", @@ -105,27 +118,47 @@ $(document).ready(function(){ title: "" }); + + var modelhook = (function(){ + + }()); + guiders.createGuider({ attachTo: "undefined", - description: "What is a model?
    \ - The concept of a model within locomotiveCMS is a peice of content that you might reuse through out your site.\ - Some example models could be: Blog posts, Products, Events, Locations, Photos

    \ - For this next section of the guide. We will edit our Event model. '"+$('.inner:eq(3) li:first a').text()+"' ", + description: (function(){ + var ret = "What is a model?
    \ + The concept of a model within locomotiveCMS is a peice of content that you might reuse through out your site.\ + Some example models could be: Blog posts, Products, Events, Locations, Photos

    " + + if($('li.hoverable').length > 1){ + ret += "For this next section of the guide. We will edit our Event model. '"+$('.inner:eq(3) li:first a').text()+"' "; + }else{ + ret += "For this next section of the guide, lets make a new model"; + } + + return ret; + }()), buttons: [{name: "Quit", onclick: guiders.hideAll}, {name: "Next - Edit an Event", onclick: function(){ - /* - * - * This is really britle - * - */ - window.location = $('.inner:eq(3) li:first a').attr('href') + "#guider=editmodelwelcome"; + if($('li.hoverable').length < 1){ + guiders.next(); + }else{ + /* + * + * This is really britle + * + */ + window.location = $('.inner:eq(3) li:first a').attr('href') + "#guider=editmodelwelcome"; + } }}], id: "modelwelcome", next: "newmodel", overlay: true, title: "Lets talk about Models...", onShow: function(){ - guiders.show("modelpointer"); + if($('li.hoverable').length > 1){ + guiders.show("modelpointer"); + } guiders.show('newmodelpointer'); } }); From 3b5df5e8a893b6a7b5a2d1576962438bc0d278f5 Mon Sep 17 00:00:00 2001 From: Kev Zettler Date: Thu, 14 Jul 2011 21:38:02 -0700 Subject: [PATCH 14/29] more awesome tutorials, more helpful on sites that have no data --- app/views/admin/shared/_header.html.haml | 2 +- public/javascripts/admin/tutorial.js | 140 +++++++++++++++++++---- 2 files changed, 116 insertions(+), 26 deletions(-) diff --git a/app/views/admin/shared/_header.html.haml b/app/views/admin/shared/_header.html.haml index 779933a8..db946364 100644 --- a/app/views/admin/shared/_header.html.haml +++ b/app/views/admin/shared/_header.html.haml @@ -9,7 +9,7 @@ %span= '|' = link_to t('.switch'), '#', :id => 'sites-picker-link' %span= '|' - = link_to 'Help', '#guider=help', :class => "tutorial", :id => "help" + = link_to 'Help', '#', :class => "tutorial", :id => "help" %span= '|' = link_to t('.logout'), destroy_admin_session_url, :confirm => t('admin.messages.confirm') diff --git a/public/javascripts/admin/tutorial.js b/public/javascripts/admin/tutorial.js index f4568bb1..e04ad1e3 100644 --- a/public/javascripts/admin/tutorial.js +++ b/public/javascripts/admin/tutorial.js @@ -110,7 +110,7 @@ $(document).ready(function(){ guiders.createGuider({ attachTo: 'div.action span', buttons: [], - description: "You can click here to make a new model", + description: "Click here to make a new model", id: "newmodelpointer", next: "editpagewelcome", position: 6, @@ -118,11 +118,23 @@ $(document).ready(function(){ title: "" }); + guiders.createGuider({ + attachTo: 'div.action span', + buttons: [], + description: "Click here to make a new model", + id: "newmodelpointer-next", + next: "editpagewelcome", + position: 6, + width: 200, + title: "", + onShow: function(){ + console.log("updating new model url"); + $('div.action a').attr('href', + $('div.action a').attr('href') + "#guider=newmodelwelcome"); + } + }); - var modelhook = (function(){ - - }()); - + guiders.createGuider({ attachTo: "undefined", description: (function(){ @@ -139,18 +151,24 @@ $(document).ready(function(){ return ret; }()), buttons: [{name: "Quit", onclick: guiders.hideAll}, - {name: "Next - Edit an Event", onclick: function(){ - if($('li.hoverable').length < 1){ - guiders.next(); + (function(){ + if($('liv.hoverable').length < 1){ + return { + name: "Next - Create a Model", + onclick: function(){ + guiders.hideAll(); + guiders.show('newmodelpointer-next'); + } + }; }else{ - /* - * - * This is really britle - * - */ - window.location = $('.inner:eq(3) li:first a').attr('href') + "#guider=editmodelwelcome"; + return { + name: "Next - Edit an Event", + onclick: function(){ + window.location = $('.inner:eq(3) li:first a').attr('href') + "#guider=editmodelwelcome"; + } + }; } - }}], + }())], id: "modelwelcome", next: "newmodel", overlay: true, @@ -268,7 +286,7 @@ $(document).ready(function(){ guiders.createGuider({ attachTo: "#viewsite_ele", buttons: [], - description: "This will open a new tab in your browser and take you to the 'frontend' of your site. The frontend is what other visitors to your sit will see. Come back to this tab in your browser to continue the guide.", + description: "This will open a new tab in your browser and take you to the 'frontend' of your site. The frontend is what other visitors to your site will see. Come back to this tab in your browser to continue the guide.", id: "viewsite2", next: "editfinish", position: 6, @@ -298,6 +316,74 @@ $(document).ready(function(){ } + /* + * + * New model + * + */ + if(window.location.pathname.match('admin/content_types/new') != null || + window.location.pathname.match('admin/content_types/.+/edit')){ + + guiders.createGuider({ + attachTo: "undefined", + description: "A model is how you define the content on your site. Lots of sites have: Blog Posts, Products, Photo Albums, Events.\ + These are all differnt models.

    \ + Models have fields. Fields are properties of a model. For example a Blog Post, has fields of: Author, Title, Content.

    \ + Try creating your own model and saving it!", + buttons: [{name: "Quit", onclick: guiders.hideAll}, + {name: "Next"}], + id: "newmodelwelcome", + next: "createmodel", + overlay: true, + title: "Lets create a new model!" + }); + + guiders.createGuider({ + buttons: [], + attachTo: "button.light:first", + description: "Click this button to create your new model!", + id: "createmodel", + next: "help", + position: 9, + title: "Save Your Work", + onShow: function(){ + $('#new_content_type').attr('action', + $('#new_content_type').attr('action')+"#guider=newmodelsuccess"); + } + }); + + guiders.createGuider({ + attachTo: "undefined", + description: (function(){ + if($('.inline-errors').length > 0){ + return "Looks like you forgot something. Please Check out the errors and try again!"; + }else{ + return "You've Successfully created a model! Moving on. Lets adjust the settings of your LocomotiveCMS"; + } + }), + buttons: [{name: "Quit", onclick: guiders.hideAll}, + {name: "Next - Settings", onclick: function(){ + window.location = "/admin/pages#guider=settingswelcome"; + }}], + id: "newmodelsuccess", + next: "editsubdomain", + overlay: true, + title: (function(){ + if($('.inline-errors').length > 0){ + return "Uh oh."; + }else{ + return "Great Work! You Made A New Model."; + } + }), + onShow: (function(){ + if($('.inline-errors').length > 0){ + guiders.show('createmodel'); + } + }) + }); + + } + /* * * Content edits @@ -351,9 +437,7 @@ $(document).ready(function(){ * */ if(window.location.pathname.match("admin/current_site/edit") != null){ - - - + guiders.createGuider({ attachTo: "undefined", description: "Welcome to the Settings page. Here you can create new user accounts to use LocomotiveCMS, Edit SEO options, and more. We will start by changing the subomain of our site.", @@ -415,11 +499,11 @@ $(document).ready(function(){ attachTo: "#help", buttons: [{name: "Quit", onclick: guiders.hideAll}], description: "How To:", +
  • Make a new Page
  • \ +
  • View Your Site
  • \ +
  • Edit A Page
  • \ +
  • Edit a a Content instance
  • \ +
  • Edit your site's settings
  • ", id: "help", position: 6, width: 200, @@ -427,8 +511,14 @@ $(document).ready(function(){ }); $(".tutorial").click(function(){ + var $this = $(this); guiders.hideAll(); - guiders.show($(this).attr('id')); + if($this.attr('href') != '#'){ + window.location = $this.attr('href') + "#guider=" + $this.attr('id'); + window.location.refresh; + }else{ + guiders.show($this.attr('id')); + } return false; }); From 217465cfda30f117630a9a6fdbfe8cfed187a61c Mon Sep 17 00:00:00 2001 From: Kev Zettler Date: Mon, 18 Jul 2011 16:42:01 -0700 Subject: [PATCH 15/29] guide updates --- public/javascripts/admin/tutorial.js | 33 +++++++++++++++------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/public/javascripts/admin/tutorial.js b/public/javascripts/admin/tutorial.js index e04ad1e3..d4de5c7e 100644 --- a/public/javascripts/admin/tutorial.js +++ b/public/javascripts/admin/tutorial.js @@ -64,17 +64,20 @@ $(document).ready(function(){ } } }()); - - console.log('lol page hook', pagehook); - + guiders.createGuider({ attachTo: pagehook, - buttons: [], + buttons: [{name: "Quit", onclick: guiders.hideAll}, + {name: "Next - Edit "+$(pagehook+' a:first').text()+"", onclick: function(){ + window.location = $(pagehook+' a:first').attr('href') + "#guider=editpagewelcome" + } + }], description: "These are pages. You can click on the page name to edit it.", id: "pagepointer", next: "editpagewelcome", width: 200, position: 9, + overlay: true, title: "" }); @@ -83,17 +86,14 @@ $(document).ready(function(){ description: "A page is a collection of content on your site that can be reached at a web address

    \ For this example we will edit the '"+$(pagehook+' a:first').text()+"' page. To do that you would click on the page name.", buttons: [{name: "Quit", onclick: guiders.hideAll}, - {name: "Next - Edit "+$(pagehook+' a:first').text()+"", onclick: function(){ - window.location = $(pagehook+' a:first').attr('href') + "#guider=editpagewelcome" - } - }], + {name: "Next"}], id: "pagewelcome", - next: "editpagewelcome", + next: "pagepointer", overlay: true, - title: "What is a page?", - onShow: function(){ - guiders.show('pagepointer') - } + title: "What is a page?"// , + // onShow: function(){ + // guiders.show('pagepointer') + // } }); guiders.createGuider({ @@ -225,7 +225,10 @@ $(document).ready(function(){ overlay: true, title: "Editing A Page" }); - + + + var page_title = 'Guide Demo Page'; + guiders.createGuider({ attachTo: "a.editable:first", buttons: [], @@ -235,7 +238,7 @@ $(document).ready(function(){ position: 6, width: 200, height: 100, - description: "Click here to edit the page title" + description: "Click here to edit the page title.

    Change the title to '"+page_title+"'" }); guiders.createGuider({ From e22e7a5e46422a8e4ff4d5694600b17541a2bc95 Mon Sep 17 00:00:00 2001 From: Kev Zettler Date: Mon, 18 Jul 2011 20:55:55 -0700 Subject: [PATCH 16/29] changed the 'update' buttons to save save --- config/locales/admin_ui.en.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/config/locales/admin_ui.en.yml b/config/locales/admin_ui.en.yml index a0ab8da7..6db16514 100644 --- a/config/locales/admin_ui.en.yml +++ b/config/locales/admin_ui.en.yml @@ -31,7 +31,7 @@ en: form_actions: back: Back without saving create: Create - update: Update + update: Save send: Send errors: @@ -106,7 +106,7 @@ en: updated_at: updated at edit: show: show - help: "The page title can be updated by clicking it. To apply your changes, click on the \"Update\" button." + help: "The page title can be updated by clicking it. To apply your changes, click on the \"Save\" button." ask_for_title: "Please type the new page title" form: delete_file: Delete file @@ -144,7 +144,7 @@ en: export: export import: import new_membership: add account - help: "The site name can be updated by clicking it. To apply your changes, click on the \"Update\" button." + help: "The site name can be updated by clicking it. To apply your changes, click on the \"Save\" button." ask_for_name: "Please type the new site name" memberships: @@ -163,7 +163,7 @@ en: my_account: edit: - help: "Your name can be updated by clicking it. To apply your changes, click on the \"Update\" button." + help: "Your name can be updated by clicking it. To apply your changes, click on the \"Save\" button." new_site: new site en: English de: German From 4eabcdbaa89adef476f27dfaa044192e4d46ae9b Mon Sep 17 00:00:00 2001 From: Kev Zettler Date: Mon, 18 Jul 2011 20:56:26 -0700 Subject: [PATCH 17/29] added an onchange callback for tinyMCE --- public/javascripts/admin/application.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/public/javascripts/admin/application.js b/public/javascripts/admin/application.js index c3b2a459..bb99495a 100644 --- a/public/javascripts/admin/application.js +++ b/public/javascripts/admin/application.js @@ -62,6 +62,11 @@ var TinyMceDefaultSettings = { fullscreen_new_window : false, fullscreen_settings : { theme_advanced_path_location : "top" + }, + onchange_callback: function(){ + if($('#pageeditcontent:visible').length > 0){ + guiders.next(); + } } }; From 6db607cb1efbf33755088bfb233db8dcd5041f5b Mon Sep 17 00:00:00 2001 From: Kev Zettler Date: Mon, 18 Jul 2011 20:56:42 -0700 Subject: [PATCH 18/29] updated tutorial flow --- public/javascripts/admin/tutorial.js | 70 ++++++++++++++++++---------- 1 file changed, 46 insertions(+), 24 deletions(-) diff --git a/public/javascripts/admin/tutorial.js b/public/javascripts/admin/tutorial.js index d4de5c7e..d1506537 100644 --- a/public/javascripts/admin/tutorial.js +++ b/public/javascripts/admin/tutorial.js @@ -170,15 +170,20 @@ $(document).ready(function(){ } }())], id: "modelwelcome", - next: "newmodel", + next: (function(){ + if($('li.hoverable').length > 1){ + return "modelpointer"; + } + return 'newmodelpointer'; + }()), overlay: true, title: "Lets talk about Models...", - onShow: function(){ - if($('li.hoverable').length > 1){ - guiders.show("modelpointer"); - } - guiders.show('newmodelpointer'); - } + // onShow: function(){ + // if($('li.hoverable').length > 1){ + // guiders.show("modelpointer"); + // } + // //guiders.show('newmodelpointer'); + // } }); guiders.createGuider({ @@ -208,13 +213,32 @@ $(document).ready(function(){ } - /* * * /admin/pages/edit * */ if(window.location.pathname.match('admin/pages/.+\/edit') != null){ + + /* + * We have to delay the creation of this guider + * so TinyMCE can render it + */ + window.onload = function(){ + window.setTimeout(function(){ + guiders.createGuider({ + attachTo: '#page_editable_elements_attributes_1_content_ifr', + title: "Edit the content of the page", + description: "You can edit the content of your page in this text box. Go Ahead, add somethign like 'locomotiveCMS rocks!'. We'll wait for you.", + buttons: [], + id: "pageeditcontent", + next: "savepageedit", + position: 9, + width: 300 + }); + }, 2000); + }; + guiders.createGuider({ attachTo: "undefined", description: "You are now editing the '"+$('a.editable:first').text()+"' page. Lets start by changing the title of this page.", @@ -247,24 +271,15 @@ $(document).ready(function(){ buttons: [{name: "Quit", onclick: guiders.hideAll}, {name: "Next"}], id: "greatjob", - next: "savepageedit", + next: "pageeditcontent", overlay: true, title: "Great Job!" }); - // guiders.createGuider({ - // attachTo: "li.text:first label", - // description: "You can edit the content of your page in this text box", - // id: "pageeditcontent", - // next: "savepageedit", - // position: 6, - // title: "Edit the content of the page" - // }); - guiders.createGuider({ buttons: [], attachTo: "button.light:last", - description: "Click this update button to save any changes you've made to the page.", + description: "Click this save button to save any changes you've made to the page.", id: "savepageedit", next: "help", position: 12, @@ -286,6 +301,17 @@ $(document).ready(function(){ title: "Page Saved Successfully!" }); + function viewSiteClick(e){ + var $this = $(e.target); + e.preventDefault(); + window.open($this.attr('href'),"_blank"); + //console.log("viewsite click!"); + guiders.next(); + $this.unbind('click', viewSiteClick); + return false; + //should probably unbind this to prevent double clicking + } + guiders.createGuider({ attachTo: "#viewsite_ele", buttons: [], @@ -297,11 +323,7 @@ $(document).ready(function(){ title: "Click Here To View Your Site", onShow: function(){ console.log("binding click for view site", $('#viewsite_ele')); - $('#viewsite_ele').bind('click', function(){ - console.log("viewsite click!"); - guiders.next(); - //should probably unbind this to prevent double clicking - }); + $('#viewsite_ele').bind('click', viewSiteClick); } }); From 6fa003db5c5ef8eddb35e7066044128832c11b55 Mon Sep 17 00:00:00 2001 From: Kev Zettler Date: Tue, 19 Jul 2011 17:35:48 -0700 Subject: [PATCH 19/29] omg more tutorials awesome --- public/javascripts/admin/tutorial.js | 70 +++++++++++++++++----------- 1 file changed, 43 insertions(+), 27 deletions(-) diff --git a/public/javascripts/admin/tutorial.js b/public/javascripts/admin/tutorial.js index d1506537..e5e9be4c 100644 --- a/public/javascripts/admin/tutorial.js +++ b/public/javascripts/admin/tutorial.js @@ -97,13 +97,17 @@ $(document).ready(function(){ }); guiders.createGuider({ - attachTo: 'li.hoverable:last', - buttons: [], - description: "These are models.
    You can hover over to edit them.", + attachTo: 'li.hoverable:eq(2)', + buttons: [{name: "Quit", onclick: guiders.hideAll}, + {name: "Next - Edit an Event", + onclick: function(){ + window.location = $('li.hoverable:eq(2) li:first a').attr('href') + "#guider=editmodelwelcome"; + }}], + description: "These are models.
    You can hover over to edit them. For this next section of the guide. We will edit an Event model. '"+$('.inner:eq(3) li:first a').text()+"' ", id: "modelpointer", next: "editpagewelcome", width: 240, - position: 3, + position: 4, title: "" }); @@ -114,6 +118,7 @@ $(document).ready(function(){ id: "newmodelpointer", next: "editpagewelcome", position: 6, + overlay: true, width: 200, title: "" }); @@ -151,24 +156,25 @@ $(document).ready(function(){ return ret; }()), buttons: [{name: "Quit", onclick: guiders.hideAll}, - (function(){ - if($('liv.hoverable').length < 1){ - return { - name: "Next - Create a Model", - onclick: function(){ - guiders.hideAll(); - guiders.show('newmodelpointer-next'); - } - }; - }else{ - return { - name: "Next - Edit an Event", - onclick: function(){ - window.location = $('.inner:eq(3) li:first a').attr('href') + "#guider=editmodelwelcome"; - } - }; - } - }())], + {name: "Next"}], + // (function(){ + // if($('li.hoverable').length < 1){ + // return { + // name: "Next - Create a Model", + // onclick: function(){ + // guiders.hideAll(); + // guiders.show('newmodelpointer-next'); + // } + // }; + // }else{ + // return { + // name: "Next - Edit an Event", + // onclick: function(){ + // window.location = $('li.hoverable:eq(2) li:first a').attr('href') + "#guider=editmodelwelcome"; + // } + // }; + // } + // }())], id: "modelwelcome", next: (function(){ if($('li.hoverable').length > 1){ @@ -302,10 +308,11 @@ $(document).ready(function(){ }); function viewSiteClick(e){ + console.log("viewsite click!"); var $this = $(e.target); e.preventDefault(); window.open($this.attr('href'),"_blank"); - //console.log("viewsite click!"); + $this.attr('href', '#'); guiders.next(); $this.unbind('click', viewSiteClick); return false; @@ -462,7 +469,17 @@ $(document).ready(function(){ * */ if(window.location.pathname.match("admin/current_site/edit") != null){ + + /* + * We have to delay the creation of this guider + * so TinyMCE can render it + */ + window.onload = function(){ + window.setTimeout(function(){ + }, 2000); + }; + guiders.createGuider({ attachTo: "undefined", description: "Welcome to the Settings page. Here you can create new user accounts to use LocomotiveCMS, Edit SEO options, and more. We will start by changing the subomain of our site.", @@ -498,17 +515,17 @@ $(document).ready(function(){ title: "Save Your Work", onShow: function(){ $('form.save-with-shortcut').attr('action', - $('form.save-with-shortcut').attr('action')+"#guider=modelsavesuccess"); + $('form.save-with-shortcut').attr('action')+"#guider=settingssavesuccess"); } }); guiders.createGuider({ attachTo: "undefined", - description: "You've Successfully updated your LocomotiveCMS settings", + description: "You've Successfully updated your LocomotiveCMS settings. Dosen't that feel awesome?", buttons: [{name: "Quit", onclick: guiders.hideAll}, {name: "Next"}], id: "settingssavesuccess", - next: "editsubdomain", + next: "congratulations", overlay: true, title: "Great Work!" }); @@ -568,5 +585,4 @@ $(document).ready(function(){ }); - }); \ No newline at end of file From b9f59435850c519ccefe6c1f035250ca068d62c2 Mon Sep 17 00:00:00 2001 From: Kev Zettler Date: Wed, 20 Jul 2011 12:19:06 -0700 Subject: [PATCH 20/29] added init hook for tinyMCE dependent guiders --- public/javascripts/admin/application.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/public/javascripts/admin/application.js b/public/javascripts/admin/application.js index bb99495a..11ac3fb2 100644 --- a/public/javascripts/admin/application.js +++ b/public/javascripts/admin/application.js @@ -63,10 +63,30 @@ var TinyMceDefaultSettings = { fullscreen_settings : { theme_advanced_path_location : "top" }, + /* + * + * These are call backs aide in the guider creation + * + */ onchange_callback: function(){ if($('#pageeditcontent:visible').length > 0){ guiders.next(); } + }, + oninit: function(){ + if(typeof window.guiders !== 'undefined' && + window.location.pathname.match('admin/pages/.+\/edit') != null){ + guiders.createGuider({ + attachTo: '#page_editable_elements_attributes_1_content_ifr', + title: "Edit the content of the page", + description: "You can edit the content of your page in this text box. Go Ahead, add somethign like 'locomotiveCMS rocks!'. We'll wait for you.", + buttons: [], + id: "pageeditcontent", + next: "savepageedit", + position: 9, + width: 300 + }); + } } }; From 466cd99101c7d26a9d6555778d2e1e2463571707 Mon Sep 17 00:00:00 2001 From: Kev Zettler Date: Wed, 20 Jul 2011 12:19:20 -0700 Subject: [PATCH 21/29] updated flow and body copy for bushi_banner guider --- public/javascripts/admin/tutorial.js | 80 ++++++++++++++++------------ 1 file changed, 46 insertions(+), 34 deletions(-) diff --git a/public/javascripts/admin/tutorial.js b/public/javascripts/admin/tutorial.js index e5e9be4c..b829917e 100644 --- a/public/javascripts/admin/tutorial.js +++ b/public/javascripts/admin/tutorial.js @@ -226,24 +226,24 @@ $(document).ready(function(){ */ if(window.location.pathname.match('admin/pages/.+\/edit') != null){ - /* - * We have to delay the creation of this guider - * so TinyMCE can render it - */ - window.onload = function(){ - window.setTimeout(function(){ - guiders.createGuider({ - attachTo: '#page_editable_elements_attributes_1_content_ifr', - title: "Edit the content of the page", - description: "You can edit the content of your page in this text box. Go Ahead, add somethign like 'locomotiveCMS rocks!'. We'll wait for you.", - buttons: [], - id: "pageeditcontent", - next: "savepageedit", - position: 9, - width: 300 - }); - }, 2000); - }; + // /* + // * We have to delay the creation of this guider + // * so TinyMCE can render it + // */ + // window.onload = function(){ + // window.setTimeout(function(){ + // guiders.createGuider({ + // attachTo: '#page_editable_elements_attributes_1_content_ifr', + // title: "Edit the content of the page", + // description: "You can edit the content of your page in this text box. Go Ahead, add somethign like 'locomotiveCMS rocks!'. We'll wait for you.", + // buttons: [], + // id: "pageeditcontent", + // next: "savepageedit", + // position: 9, + // width: 300 + // }); + // }, 2000); + // }; guiders.createGuider({ attachTo: "undefined", @@ -287,7 +287,6 @@ $(document).ready(function(){ attachTo: "button.light:last", description: "Click this save button to save any changes you've made to the page.", id: "savepageedit", - next: "help", position: 12, title: "Save Your Work", onShow: function(){ @@ -470,16 +469,6 @@ $(document).ready(function(){ */ if(window.location.pathname.match("admin/current_site/edit") != null){ - /* - * We have to delay the creation of this guider - * so TinyMCE can render it - */ - window.onload = function(){ - window.setTimeout(function(){ - - }, 2000); - }; - guiders.createGuider({ attachTo: "undefined", description: "Welcome to the Settings page. Here you can create new user accounts to use LocomotiveCMS, Edit SEO options, and more. We will start by changing the subomain of our site.", @@ -521,13 +510,20 @@ $(document).ready(function(){ guiders.createGuider({ attachTo: "undefined", + title: "Great Work!", description: "You've Successfully updated your LocomotiveCMS settings. Dosen't that feel awesome?", buttons: [{name: "Quit", onclick: guiders.hideAll}, - {name: "Next"}], + {name: "Next", onclick: function(){ + if($('#bushi_banner').length > 0){ + guiders.hideAll(); + guiders.show("bushi_banner_guide"); + }else{ + guiders.hideAll(); + guiders.show("congratulations"); + } + }}], id: "settingssavesuccess", - next: "congratulations", - overlay: true, - title: "Great Work!" + overlay: true }); } @@ -578,11 +574,27 @@ $(document).ready(function(){ attachTo: "undefined", description: "You've gone through the LocomotiveCMS guide! For more info on LocomotiveCMS,\ checkout out The LocomotiveCMS support pages", - buttons: [{name: "Finished!", onclick: guiders.hideAll}], + buttons:[{name: "Finished!", onclick: guiders.hideAll}], id: "congratulations", + next: "bushi_banner", overlay: true, title: "Congratulations!" }); + window.onload = function(){ + window.setTimeout(function(){ + guiders.createGuider({ + attachTo: "#bushi_banner", + description: "You may have noticed the bar at the top of your site. Its provided by Bushido. Bushido are friends of LocomotiveCMS. They are our official hosting partner.\ +

    They will keep your LocomotiveCMS site up and running. If you want to keep your LocomotiveCMS site, they have a short signup processes above. Check it out!", + buttons: [{name: "Next"}], + id: "bushi_banner_guide", + overlay: true, + title: "One more Thing...", + next: "congratulations", + position: 6 + }); + }, 1000); + }; }); \ No newline at end of file From 55f95499ce2b5af9ea44fdcba6fa4c7b4dda73c6 Mon Sep 17 00:00:00 2001 From: Kev Zettler Date: Wed, 20 Jul 2011 12:24:04 -0700 Subject: [PATCH 22/29] commented out the compression disable dev stuff --- config/assets.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/assets.yml b/config/assets.yml index 3c0e8845..a0134b1c 100644 --- a/config/assets.yml +++ b/config/assets.yml @@ -3,8 +3,8 @@ embed_assets: off s3_bucket: <%= ENV['S3_BUCKET'] %> s3_access_key_id: <%= ENV['S3_KEY_ID'] %> s3_secret_access_key: <%= ENV['S3_SECRET_KEY'] %> -compress_assets: off -package_assets: off +# compress_assets: off +# package_assets: off javascripts: box: From e5549cc600a9625a7e3b7f89c00fdb40748ed67a Mon Sep 17 00:00:00 2001 From: Kev Zettler Date: Wed, 20 Jul 2011 22:02:12 -0700 Subject: [PATCH 23/29] bumped bushido gem --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index f2d2798d..b839cedc 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -58,7 +58,7 @@ GEM bson (1.3.1) bson_ext (1.3.1) builder (2.1.2) - bushido (0.0.29) + bushido (0.0.30) highline (>= 1.6.1) json (>= 1.4.6) rest-client (>= 1.6.1) From c1a1e720d32874c19f9ccd8ac2e8e77633921f03 Mon Sep 17 00:00:00 2001 From: Kev Zettler Date: Wed, 20 Jul 2011 22:19:21 -0700 Subject: [PATCH 24/29] added guider info to starter page --- config/bushido.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/bushido.json b/config/bushido.json index 2d34fae2..ce3aab1a 100644 --- a/config/bushido.json +++ b/config/bushido.json @@ -4,6 +4,6 @@ "ruby_version": "1.9.2", "sql": false, "mongodb": true, - "start_page": "admin/pages", + "start_page": "admin/pages#guider=welcome", "project_name": "locomotive" } From cf0b49932e65cda75cadf02d8afab90362ef3241 Mon Sep 17 00:00:00 2001 From: Kev Zettler Date: Wed, 20 Jul 2011 22:53:04 -0700 Subject: [PATCH 25/29] dropped bushido gem back to 29 --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index b839cedc..f2d2798d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -58,7 +58,7 @@ GEM bson (1.3.1) bson_ext (1.3.1) builder (2.1.2) - bushido (0.0.30) + bushido (0.0.29) highline (>= 1.6.1) json (>= 1.4.6) rest-client (>= 1.6.1) From 32f57cc43c23a10e04df7e07611116865c29cbba Mon Sep 17 00:00:00 2001 From: Sean Grove Date: Thu, 21 Jul 2011 18:21:47 -0700 Subject: [PATCH 26/29] Output some debug information --- lib/locomotive/hosting/bushido/devise.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/locomotive/hosting/bushido/devise.rb b/lib/locomotive/hosting/bushido/devise.rb index c58dfcca..aad66c26 100644 --- a/lib/locomotive/hosting/bushido/devise.rb +++ b/lib/locomotive/hosting/bushido/devise.rb @@ -6,15 +6,20 @@ module Locomotive extend ActiveSupport::Concern included do + puts "Including special bushido admin methods" alias_method_chain :require_admin, :bushido end module InstanceMethods def require_admin_with_bushido + puts "requiring admin with bushido.." + puts "App claimed?" if ::Locomotive.bushido_app_claimed? + require_admin_without_bushido else + puts "not claimed! signing in #{Account.order(:created_at).first.inspect}" # open back-office for everybody as long as the application is not claimed sign_in(Account.order_by(:created_at).first) end @@ -25,4 +30,4 @@ module Locomotive end end end -end \ No newline at end of file +end From 694ca19324026143354177351dba98ec0351ecfd Mon Sep 17 00:00:00 2001 From: Sean Grove Date: Thu, 21 Jul 2011 18:38:58 -0700 Subject: [PATCH 27/29] Le sigh... --- config/environments/production.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/environments/production.rb b/config/environments/production.rb index 5a592d50..f9003a2a 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -3,7 +3,7 @@ Locomotive::Application.configure do # The production environment is meant for finished, "live" apps. # Code is not reloaded between requests - config.cache_classes = false + config.cache_classes = true # Full error reports are disabled and caching is turned on config.consider_all_requests_local = false From 2a9a49f1b16801fe0756184634bf58333c4809ca Mon Sep 17 00:00:00 2001 From: Sean Grove Date: Thu, 21 Jul 2011 18:48:46 -0700 Subject: [PATCH 28/29] No more need for debug output --- lib/locomotive/hosting/bushido/devise.rb | 7 ------- 1 file changed, 7 deletions(-) diff --git a/lib/locomotive/hosting/bushido/devise.rb b/lib/locomotive/hosting/bushido/devise.rb index aad66c26..3243555b 100644 --- a/lib/locomotive/hosting/bushido/devise.rb +++ b/lib/locomotive/hosting/bushido/devise.rb @@ -6,27 +6,20 @@ module Locomotive extend ActiveSupport::Concern included do - puts "Including special bushido admin methods" alias_method_chain :require_admin, :bushido end module InstanceMethods def require_admin_with_bushido - puts "requiring admin with bushido.." - puts "App claimed?" if ::Locomotive.bushido_app_claimed? - require_admin_without_bushido else - puts "not claimed! signing in #{Account.order(:created_at).first.inspect}" # open back-office for everybody as long as the application is not claimed sign_in(Account.order_by(:created_at).first) end end - end - end end end From 1ce9c2a432b8a821cbb66c09b962dd952685e350 Mon Sep 17 00:00:00 2001 From: Kev Zettler Date: Thu, 21 Jul 2011 19:00:49 -0700 Subject: [PATCH 29/29] bumped gem to 30 --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index f2d2798d..b839cedc 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -58,7 +58,7 @@ GEM bson (1.3.1) bson_ext (1.3.1) builder (2.1.2) - bushido (0.0.29) + bushido (0.0.30) highline (>= 1.6.1) json (>= 1.4.6) rest-client (>= 1.6.1)