add a podname app config var, and use it throughout the app

This commit is contained in:
Maxwell Salzberg 2012-05-30 11:17:03 -07:00
parent bc41ed839b
commit 82c4e0d577
10 changed files with 35 additions and 15 deletions

View file

@ -36,7 +36,7 @@
<a href="/" id="home-button"> <a href="/" id="home-button">
<span class="label label-inverse"> <span class="label label-inverse">
<span> <span>
DIASPORA {{t "pod_name"}}
</span> </span>
</span> </span>
</a> </a>
@ -44,7 +44,9 @@
</div> </div>
<h1> <h1>
<a href='/stream?ex=true' class='logo'>DIASPORA</a> <a href='/stream?ex=true' class='logo'>
{{t "pod_name"}}
</a>
</h1> </h1>
</div> </div>
</div> </div>

View file

@ -3,6 +3,10 @@
# the COPYRIGHT file. # the COPYRIGHT file.
module ApplicationHelper module ApplicationHelper
def pod_name
AppConfig[:pod_name].present? ? AppConfig[:pod_name] : "DIASPORA*"
end
def how_long_ago(obj) def how_long_ago(obj)
timeago(obj.created_at) timeago(obj.created_at)
end end

View file

@ -15,8 +15,8 @@ module LanguageHelper
defaults.deep_merge!(translations) defaults.deep_merge!(translations)
end end
defaults['pluralization_rule'] = I18n.t 'i18n.plural.js_rule', :locale => language defaults['pluralization_rule'] = I18n.t('i18n.plural.js_rule', :locale => language)
defaults['pod_name'] = pod_name
defaults defaults
end end
@ -26,6 +26,6 @@ module LanguageHelper
end end
def rtl? def rtl?
@rtl ||= RTL_LANGUAGES.include? I18n.locale.to_s @rtl ||= RTL_LANGUAGES.include?(I18n.locale.to_s)
end end
end end

View file

@ -7,6 +7,8 @@
# to do so you may need to add this line to your ApplicationController # to do so you may need to add this line to your ApplicationController
# helper :layout # helper :layout
module LayoutHelper module LayoutHelper
include ApplicationHelper
def title(page_title, show_title = true) def title(page_title, show_title = true)
content_for(:title) { page_title.to_s } content_for(:title) { page_title.to_s }
@show_title = show_title @show_title = show_title
@ -14,7 +16,7 @@ module LayoutHelper
def page_title(text=nil) def page_title(text=nil)
return text unless text.blank? return text unless text.blank?
"Diaspora*" pod_name
end end
def set_asset_host def set_asset_host

View file

@ -4,7 +4,7 @@
- content_for :page_title do - content_for :page_title do
Diaspora* = pod_name
- begin - begin
= render :partial => 'home/show' = render :partial => 'home/show'

View file

@ -6,7 +6,7 @@
%html{:lang => I18n.locale.to_s, :dir => (rtl?) ? 'rtl' : 'ltr'} %html{:lang => I18n.locale.to_s, :dir => (rtl?) ? 'rtl' : 'ltr'}
%head %head
%title %title
DIASPORA* = pod_name
%meta{:name => "description", :content => "Diaspora* Mobile"} %meta{:name => "description", :content => "Diaspora* Mobile"}
%meta{:name => "author", :content => "Diaspora, Inc."} %meta{:name => "author", :content => "Diaspora, Inc."}

View file

@ -3,7 +3,7 @@
-# the COPYRIGHT file. -# the COPYRIGHT file.
= content_for :page_title do = content_for :page_title do
= "Diaspora* / #{t('devise.sessions.new.sign_in')}" = "#{pod_name} / #{t('devise.sessions.new.sign_in')}"
= content_for :head do = content_for :head do
= javascript_include_tag :login = javascript_include_tag :login

View file

@ -89,6 +89,9 @@ defaults: &defaults
# General Pod Settings # General Pod Settings
###################################################### ######################################################
## Name of your pod
pod_name: "Diaspora*"
## Set this to true to prevent people from signing up for your pod ## Set this to true to prevent people from signing up for your pod
## without an invitation. Note that this needs to be true even for ## without an invitation. Note that this needs to be true even for
## the first registration (you). ## the first registration (you).
@ -104,11 +107,6 @@ defaults: &defaults
#the 'admin' account for your pod... ie for jd.com, this is diasporahq #the 'admin' account for your pod... ie for jd.com, this is diasporahq
admin_account: '' admin_account: ''
## Here, you can turn specific users into admins
admins:
#- 'admin'
#- 'me'
## Settings about invitations ## Settings about invitations
# Set this to true if you want users to invite as many people as they want # Set this to true if you want users to invite as many people as they want

View file

@ -83,4 +83,17 @@ describe ApplicationHelper do
jquery_include_tag.should match(/jQuery\.ajaxSetup/) jquery_include_tag.should match(/jQuery\.ajaxSetup/)
end end
end end
describe '#pod_name' do
it 'defaults to Diaspora*' do
pod_name.should == 'DIASPORA*'
end
it 'displays the supplied AppConfig[:pod_name] if it is set' do
old_name = AppConfig[:pod_name]
AppConfig[:pod_name] = "Catspora"
pod_name.should == "Catspora"
AppConfig[:pod_name] = old_name
end
end
end end

View file

@ -5,6 +5,7 @@
require 'spec_helper' require 'spec_helper'
describe LayoutHelper do describe LayoutHelper do
include ApplicationHelper
before do before do
@user = alice @user = alice
end end
@ -18,7 +19,7 @@ describe LayoutHelper do
context "passed blank text" do context "passed blank text" do
it "returns Diaspora*" do it "returns Diaspora*" do
page_title.should == "Diaspora*" page_title.should == pod_name
end end
end end