Skip to content
This repository was archived by the owner on Jan 8, 2022. It is now read-only.

Commit 666def7

Browse files
committed
updated content system to work with themes
1 parent eb91a12 commit 666def7

File tree

6 files changed

+89
-86
lines changed

6 files changed

+89
-86
lines changed

app/controllers/content_controller.rb

+5-5
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ def show_protected_page
1010
render_page('protected-pages')
1111
end
1212

13-
1413
protected
15-
14+
1615
def render_page page_path
17-
page_locale = locale || params[:locale] || params[:language] || "en_US"
1816
url_key = params[:content_page].join('/')
19-
content_page = "#{RAILS_ROOT}/content/#{page_path}/#{page_locale}/#{url_key}.html"
17+
path = File.join(RAILS_ROOT, 'themes', current_theme, 'content', page_path, url_key)
18+
content_page = Dir.glob("#{path}.*").first
19+
raise Exceptions::MissingTemplateError, "Could not find template for: '#{path}'" if content_page.nil?
2020
render :file => content_page, :layout => true
21-
rescue
21+
rescue Exceptions::MissingTemplateError => ex
2222
render :file => "#{RAILS_ROOT}/public/404.html", :status => 404
2323
end
2424

lib/exceptions.rb

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module Exceptions
2+
class MissingTemplateError < StandardError; end
3+
end
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Created by:
2-
<a href="http://www.justinball.com">Justin</a>
3-
and
1+
Created by:
2+
<a href="http://www.justinball.com">Justin</a>
3+
and
44
<a href="http://www.joelduffin.com/blog/">Joel</a>
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,56 @@
1-
<div>
2-
<h2 class="getting_started"><%= _('How to Get Started') %></h2>
3-
4-
<div class="half left">
5-
6-
<div class="blurp">
7-
<img src="/images/blurp_profile.png" class="left png" title="<%= _('Profile Icon') %>" alt="<%= _('Profile Icon') %>" />
8-
<strong><%= link_to _('Setup Your Profile'), edit_user_path(current_user) %></strong>
9-
<%= _('Your public profile is the way your friends will learn about you and keep up-to-date on your life. Upload a profile photo, add an "about me" connect with new and old friends.') %>
10-
<div class="clear"></div>
11-
</div>
12-
13-
<div class="blurp">
14-
<img src="/images/blurp_photos.png" class="png left" title="<%= _('Share Icon') %>" alt="<%= _('Share Icon') %>" />
15-
<strong><%= link_to _('Share Photos'), user_photos_path(current_user) %></strong>
16-
<%= _("%{application_name} allows users to upload images with captions to their profile.") % {:application_name => GlobalConfig.application_name} %>
17-
<%= _('We would love someone to build albums, tagging and commenting on photos for this open source project!') %>
18-
<div class="clear"></div>
19-
</div>
20-
21-
<div class="blurp">
22-
<img src="/images/blurp_friends.png" class="png left" title="<%= _('Friend Icon') %>" alt="<%= _('Friend Icon') %>" />
23-
<strong><%= link_to _('Groups'), groups_path -%></strong>
24-
<%= _('Search for others with common interests.') %>
25-
<div class="clear"></div>
26-
</div>
27-
<div class="clear"></div>
28-
</div>
29-
30-
<div class="half right">
31-
<div class="blurp">
32-
<img src="/images/blurp_friends.png" class="png left" title="<%= _('Friend Icon') %>" alt="<%= _('Friend Icon') %>" />
33-
<strong><%= link_to _('Find Friends'), profiles_path %></strong>
34-
<%= _('Search for others with common interests.') %>
35-
<div class="clear"></div>
36-
</div>
37-
38-
<div class="blurp">
39-
<img src="/images/blurp_message.png" class="png left" title="<%= _('Message Icon') %>" alt="<%= _('Message Icon') %>" />
40-
<strong><%= link_to _('Message Friends'), user_messages_path(current_user) %></strong>
41-
<%= _("%{application_name} allows you to send messages to your friends.") % {:application_name => GlobalConfig.application_name} %>
42-
<div class="clear"></div>
43-
</div>
44-
45-
<div class="blurp">
46-
<img src="/images/blurp_comment.png" class="left png" title="<%= _('Comment Icon') %>" alt="<%= _('Comment Icon') %>" />
47-
<strong><%= link_to _('Start Blogging!'), user_blogs_path(current_user) %></strong>
48-
<%= _('Add thoughts and stories to your blog.') %>
49-
<div class="clear"></div>
50-
</div>
51-
52-
<div class="clear"></div>
53-
</div>
54-
55-
<div class="clear"></div>
56-
</div>
1+
<div>
2+
<h2 class="getting_started"><%= _('How to Get Started') %></h2>
3+
4+
<div class="half left">
5+
6+
<div class="blurp">
7+
<img src="/images/blurp_profile.png" class="left png" title="<%= _('Profile Icon') %>" alt="<%= _('Profile Icon') %>" />
8+
<strong><%= link_to _('Setup Your Profile'), edit_user_path(current_user) %></strong>
9+
<%= _('Your public profile is the way your friends will learn about you and keep up-to-date on your life. Upload a profile photo, add an "about me" connect with new and old friends.') %>
10+
<div class="clear"></div>
11+
</div>
12+
13+
<div class="blurp">
14+
<img src="/images/blurp_photos.png" class="png left" title="<%= _('Share Icon') %>" alt="<%= _('Share Icon') %>" />
15+
<strong><%= link_to _('Share Photos'), user_photos_path(current_user) %></strong>
16+
<%= _("%{application_name} allows users to upload images with captions to their profile.") % {:application_name => GlobalConfig.application_name} %>
17+
<%= _('We would love someone to build albums, tagging and commenting on photos for this open source project!') %>
18+
<div class="clear"></div>
19+
</div>
20+
21+
<div class="blurp">
22+
<img src="/images/blurp_friends.png" class="png left" title="<%= _('Friend Icon') %>" alt="<%= _('Friend Icon') %>" />
23+
<strong><%= link_to _('Groups'), groups_path -%></strong>
24+
<%= _('Search for others with common interests.') %>
25+
<div class="clear"></div>
26+
</div>
27+
<div class="clear"></div>
28+
</div>
29+
30+
<div class="half right">
31+
<div class="blurp">
32+
<img src="/images/blurp_friends.png" class="png left" title="<%= _('Friend Icon') %>" alt="<%= _('Friend Icon') %>" />
33+
<strong><%= link_to _('Find Friends'), profiles_path %></strong>
34+
<%= _('Search for others with common interests.') %>
35+
<div class="clear"></div>
36+
</div>
37+
38+
<div class="blurp">
39+
<img src="/images/blurp_message.png" class="png left" title="<%= _('Message Icon') %>" alt="<%= _('Message Icon') %>" />
40+
<strong><%= link_to _('Message Friends'), user_messages_path(current_user) %></strong>
41+
<%= _("%{application_name} allows you to send messages to your friends.") % {:application_name => GlobalConfig.application_name} %>
42+
<div class="clear"></div>
43+
</div>
44+
45+
<div class="blurp">
46+
<img src="/images/blurp_comment.png" class="left png" title="<%= _('Comment Icon') %>" alt="<%= _('Comment Icon') %>" />
47+
<strong><%= link_to _('Start Blogging!'), user_blogs_path(current_user) %></strong>
48+
<%= _('Add thoughts and stories to your blog.') %>
49+
<div class="clear"></div>
50+
</div>
51+
52+
<div class="clear"></div>
53+
</div>
54+
55+
<div class="clear"></div>
56+
</div>
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Created by:
2-
<a href="http://www.justinball.com">Justin</a>
3-
and
1+
Created by:
2+
<a href="http://www.justinball.com">Justin</a>
3+
and
44
<a href="http://www.joelduffin.com/blog/">Joel</a>
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
<div id="get-bookmarklet" class="clear normal-text">
2-
<h1>Get a Bookmark for Sharing Web Pages and Google Documents</h1>
3-
<p><strong>Bookmark:</strong> <span class='link-button'><a href="javascript:e=encodeURIComponent;w=window;gs=w.getSelection;d=document;dgs=d.getSelection;l=location;s='http://<%= GlobalConfig.application_url -%>/share?u=';w.onerror=function(){l.href=s+e(l.href)+'&t='+e(d.title);};c=gs?gs():dgs?dgs():d.selection?d.selection.createRange().text:'';if(c==''){de=d.getElementsByName('Description');c=de&&de[0]?c=de[0].content:''}l.href=s+e(l.href)+'&t='+e(d.title)+'&c='+e(c);">Share</a></span></p>
4-
<p>Add the bookmark to your web browser to make it easy to share web pages with friends and groups!</p>
5-
<ol>
6-
<script type="text/javascript">
7-
if (document.all) document.write("<li>Add the bookmark to your <i>Links</i> toolbar by right clicking on it and choosing <i>Add to favorites...</i>. Then choose the <i>Links</i> folder from the <i>Favorites</i> list.</li>");
8-
else document.write("<li>Drag the bookmark button to your <i>Links</i> toolbar.</li>");
9-
</script>
10-
<li>Now, browse to a web page or Google document and click the bookmark to share the page or document.</li>
11-
</ol>
12-
13-
<p>&nbsp;</p>
14-
15-
<script type="text/javascript">
16-
if (document.all) document.write("<p>If you can't see your <i>Links</i> toolbar, make sure it is displayed by checking the View, Toolbars, Links menu item.</p>");
17-
else document.write("<p>Note: If you can't see your <i>Links</i> toolbar, make sure the <i>View, Toolbars, Bookmarks Toolbar</i> menu item is checked.</p>");
18-
</script>
19-
1+
<div id="get-bookmarklet" class="clear normal-text">
2+
<h1>Get a Bookmark for Sharing Web Pages and Google Documents</h1>
3+
<p><strong>Bookmark:</strong> <span class='link-button'><a href="javascript:e=encodeURIComponent;w=window;gs=w.getSelection;d=document;dgs=d.getSelection;l=location;s='http://<%= GlobalConfig.application_url -%>/share?u=';w.onerror=function(){l.href=s+e(l.href)+'&t='+e(d.title);};c=gs?gs():dgs?dgs():d.selection?d.selection.createRange().text:'';if(c==''){de=d.getElementsByName('Description');c=de&&de[0]?c=de[0].content:''}l.href=s+e(l.href)+'&t='+e(d.title)+'&c='+e(c);">Share</a></span></p>
4+
<p>Add the bookmark to your web browser to make it easy to share web pages with friends and groups!</p>
5+
<ol>
6+
<script type="text/javascript">
7+
if (document.all) document.write("<li>Add the bookmark to your <i>Links</i> toolbar by right clicking on it and choosing <i>Add to favorites...</i>. Then choose the <i>Links</i> folder from the <i>Favorites</i> list.</li>");
8+
else document.write("<li>Drag the bookmark button to your <i>Links</i> toolbar.</li>");
9+
</script>
10+
<li>Now, browse to a web page or Google document and click the bookmark to share the page or document.</li>
11+
</ol>
12+
13+
<p>&nbsp;</p>
14+
15+
<script type="text/javascript">
16+
if (document.all) document.write("<p>If you can't see your <i>Links</i> toolbar, make sure it is displayed by checking the View, Toolbars, Links menu item.</p>");
17+
else document.write("<p>Note: If you can't see your <i>Links</i> toolbar, make sure the <i>View, Toolbars, Bookmarks Toolbar</i> menu item is checked.</p>");
18+
</script>
19+
2020
</div>

0 commit comments

Comments
 (0)