muck-engine 0.1.7 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +3 -0
- data/VERSION +1 -1
- data/app/helpers/muck_engine_helper.rb +4 -0
- data/app/models/language.rb +6 -0
- data/app/views/layouts/email_default.text.html.erb +21 -0
- data/app/views/layouts/email_default.text.plain.erb +13 -0
- data/lib/action_controller/muck_application.rb +1 -2
- data/locales/en.yml +2 -1
- data/muck-engine.gemspec +7 -2
- data/pkg/muck-engine-0.1.7.gem +0 -0
- data/rdoc/classes/ActionController/MuckApplication.html +7 -8
- data/rdoc/created.rid +1 -1
- data/rdoc/files/README_rdoc.html +30 -1
- data/rdoc/files/lib/action_controller/muck_application_rb.html +1 -1
- metadata +5 -2
data/README.rdoc
CHANGED
@@ -54,6 +54,9 @@ If you build your own layout be sure to include the following script in your lay
|
|
54
54
|
<%= yield :javascript %>
|
55
55
|
</script>
|
56
56
|
|
57
|
+
You can customize your email template by overriding the existing layouts. Simply add email_default.text.html.erb and email_default.text.plain.erb
|
58
|
+
views/layouts. This will build templates for html and plain text emails. For an example of each look at the views/layouts directory in this project.
|
59
|
+
|
57
60
|
== CSS
|
58
61
|
|
59
62
|
The css provided by the muck engine comes from blueprint:
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.8
|
@@ -43,6 +43,10 @@ module MuckEngineHelper
|
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
46
|
+
# Render a photo for the given object. Note that the object will need a 'photo' method
|
47
|
+
# provided by paperclip.
|
48
|
+
# size is commonly one of:
|
49
|
+
# :medium, :thumb or :icon but can be any value provided by the photo object
|
46
50
|
def icon(object, size = :icon)
|
47
51
|
return "" if object.blank? || object.photo.blank?
|
48
52
|
link_to(image_tag(object.photo.url(size), :class => size), object, { :title => object.full_name })
|
data/app/models/language.rb
CHANGED
@@ -1,3 +1,9 @@
|
|
1
1
|
class Language < ActiveRecord::Base
|
2
|
+
|
3
|
+
def self.locale_id
|
4
|
+
languages = Language.find(:all, :select => 'id, locale', :conditions => 'muck_raker_supported = true')
|
5
|
+
@@locale_ids ||= Hash[*languages.collect {|v|[v.locale.to_sym, v.id]}.flatten]
|
6
|
+
@@locale_ids[I18n.locale]
|
7
|
+
end
|
2
8
|
|
3
9
|
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
|
5
|
+
</head>
|
6
|
+
<body>
|
7
|
+
<%= yield %>
|
8
|
+
|
9
|
+
<p>Thanks very much,<br />
|
10
|
+
|
11
|
+
The <%=GlobalConfig.application_name%> Team</p>
|
12
|
+
|
13
|
+
<hr />
|
14
|
+
<p>Please add <%=GlobalConfig.support_email%> to your email address book and “safe domain” lists.</p>
|
15
|
+
|
16
|
+
<p>
|
17
|
+
We respect your privacy; please view our privacy policy here:
|
18
|
+
<a href="http://<%=GlobalConfig.application_url%>/privacy"><%=GlobalConfig.application_url%>/privacy</a>
|
19
|
+
</p>
|
20
|
+
</body>
|
21
|
+
</html>
|
@@ -0,0 +1,13 @@
|
|
1
|
+
<%= yield %>
|
2
|
+
|
3
|
+
Thanks very much,
|
4
|
+
|
5
|
+
The <%=GlobalConfig.application_name%> Team
|
6
|
+
|
7
|
+
_______________________________________________________________________
|
8
|
+
|
9
|
+
|
10
|
+
Please add <%=GlobalConfig.support_email%> to your email address book and “safe domain” lists.
|
11
|
+
|
12
|
+
We respect your privacy; please view our privacy policy here:
|
13
|
+
http://<%=GlobalConfig.application_url%>/privacy
|
@@ -13,7 +13,7 @@ module ActionController
|
|
13
13
|
# http://guides.rubyonrails.org/i18n.html
|
14
14
|
# http://zargony.com/2009/01/09/selecting-the-locale-for-a-request
|
15
15
|
def discover_locale
|
16
|
-
I18n.locale = extract_locale_from_tld || extract_locale_from_subdomain || extract_locale_from_headers ||
|
16
|
+
I18n.locale = extract_locale_from_user_selection || extract_locale_from_tld || extract_locale_from_subdomain || extract_locale_from_headers || extract_locale_from_browser || I18n.default_locale
|
17
17
|
end
|
18
18
|
|
19
19
|
def extract_locale_from_browser
|
@@ -31,7 +31,6 @@ module ActionController
|
|
31
31
|
elsif cookies['locale'] && I18n.available_locales.include?(cookies['locale'].to_sym)
|
32
32
|
cookies['locale'].to_sym
|
33
33
|
end
|
34
|
-
nil
|
35
34
|
end
|
36
35
|
|
37
36
|
def extract_locale_from_headers
|
data/locales/en.yml
CHANGED
data/muck-engine.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{muck-engine}
|
5
|
-
s.version = "0.1.
|
5
|
+
s.version = "0.1.8"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Justin Ball"]
|
9
|
-
s.date = %q{2009-06-
|
9
|
+
s.date = %q{2009-06-24}
|
10
10
|
s.description = %q{The base engine for the muck system. Contains common tables, custom for, css and javascript.}
|
11
11
|
s.email = %q{justinball@gmail.com}
|
12
12
|
s.extra_rdoc_files = [
|
@@ -49,6 +49,10 @@ Gem::Specification.new do |s|
|
|
49
49
|
"app/views/layouts/admin.html.erb",
|
50
50
|
"app/views/layouts/default.html.erb",
|
51
51
|
"app/views/layouts/default.html.erb",
|
52
|
+
"app/views/layouts/email_default.text.html.erb",
|
53
|
+
"app/views/layouts/email_default.text.html.erb",
|
54
|
+
"app/views/layouts/email_default.text.plain.erb",
|
55
|
+
"app/views/layouts/email_default.text.plain.erb",
|
52
56
|
"app/views/shared/_error_box.html.erb",
|
53
57
|
"app/views/shared/_error_box.html.erb",
|
54
58
|
"app/views/shared/_field_error.html.erb",
|
@@ -143,6 +147,7 @@ Gem::Specification.new do |s|
|
|
143
147
|
"locales/zh.yml",
|
144
148
|
"locales/zh.yml",
|
145
149
|
"muck-engine.gemspec",
|
150
|
+
"pkg/muck-engine-0.1.7.gem",
|
146
151
|
"public/images/arrow_down.gif",
|
147
152
|
"public/images/arrow_left.gif",
|
148
153
|
"public/images/arrow_right.gif",
|
Binary file
|
@@ -130,14 +130,13 @@ Module <a href="MuckApplication/InstanceMethods.html" class="link">ActionControl
|
|
130
130
|
onclick="toggleCode('M000002-source');return false;">[Source]</a></p>
|
131
131
|
<div class="method-source-code" id="M000002-source">
|
132
132
|
<pre>
|
133
|
-
<span class="ruby-comment cmt"># File lib/action_controller/muck_application.rb, line
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
70: <span class="ruby-keyword kw">end</span>
|
133
|
+
<span class="ruby-comment cmt"># File lib/action_controller/muck_application.rb, line 83</span>
|
134
|
+
83: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">included</span>(<span class="ruby-identifier">receiver</span>)
|
135
|
+
84: <span class="ruby-identifier">receiver</span>.<span class="ruby-identifier">extend</span> <span class="ruby-constant">ClassMethods</span>
|
136
|
+
85: <span class="ruby-identifier">receiver</span>.<span class="ruby-identifier">class_eval</span> <span class="ruby-keyword kw">do</span>
|
137
|
+
86: <span class="ruby-identifier">include</span> <span class="ruby-constant">InstanceMethods</span>
|
138
|
+
87: <span class="ruby-keyword kw">end</span>
|
139
|
+
88: <span class="ruby-keyword kw">end</span>
|
141
140
|
</pre>
|
142
141
|
</div>
|
143
142
|
</div>
|
data/rdoc/created.rid
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
Fri, 19 Jun 2009 00:51:04 -0600
|
data/rdoc/files/README_rdoc.html
CHANGED
@@ -56,7 +56,7 @@
|
|
56
56
|
</tr>
|
57
57
|
<tr class="top-aligned-row">
|
58
58
|
<td><strong>Last Update:</strong></td>
|
59
|
-
<td>Thu Jun 18
|
59
|
+
<td>Thu Jun 18 18:52:57 -0600 2009</td>
|
60
60
|
</tr>
|
61
61
|
</table>
|
62
62
|
</div>
|
@@ -112,6 +112,35 @@ have access to the admin section of the website
|
|
112
112
|
admin?
|
113
113
|
end
|
114
114
|
</pre>
|
115
|
+
<p>
|
116
|
+
Muck provides a number of methods that can set the current locale. Add a
|
117
|
+
before filter and method to application_controller.rb
|
118
|
+
</p>
|
119
|
+
<pre>
|
120
|
+
before_filter :set_locale
|
121
|
+
</pre>
|
122
|
+
<p>
|
123
|
+
Add a set_locale method:
|
124
|
+
</p>
|
125
|
+
<pre>
|
126
|
+
def set_locale
|
127
|
+
discover_locale
|
128
|
+
end
|
129
|
+
</pre>
|
130
|
+
<p>
|
131
|
+
The set_locale method can use discover_locale to try various methods of
|
132
|
+
finding the proper locale or it can call any of the methods individually:
|
133
|
+
</p>
|
134
|
+
<pre>
|
135
|
+
def discover_locale
|
136
|
+
I18n.locale = extract_locale_from_tld || extract_locale_from_subdomain || extract_locale_from_headers || extract_locale_from_user_selection || extract_locale_from_browser || I18n.default_locale
|
137
|
+
end
|
138
|
+
</pre>
|
139
|
+
<h2>Usage</h2>
|
140
|
+
<pre>
|
141
|
+
If your application includes a locale switching menu, you would then have something like this in it:
|
142
|
+
link_to("Deutsch", "#{APP_CONFIG[:deutsch_website_url]}#{request.env['REQUEST_URI']}")
|
143
|
+
</pre>
|
115
144
|
<h2>Layout</h2>
|
116
145
|
<p>
|
117
146
|
The muck template will build your basic application and construct all the
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: muck-engine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin Ball
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-06-
|
12
|
+
date: 2009-06-24 00:00:00 -06:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -51,6 +51,8 @@ files:
|
|
51
51
|
- app/views/forms/_tips.html.erb
|
52
52
|
- app/views/layouts/admin.html.erb
|
53
53
|
- app/views/layouts/default.html.erb
|
54
|
+
- app/views/layouts/email_default.text.html.erb
|
55
|
+
- app/views/layouts/email_default.text.plain.erb
|
54
56
|
- app/views/shared/_error_box.html.erb
|
55
57
|
- app/views/shared/_field_error.html.erb
|
56
58
|
- app/views/shared/_flash_error_box.html.erb
|
@@ -99,6 +101,7 @@ files:
|
|
99
101
|
- locales/zh-TW.yml
|
100
102
|
- locales/zh.yml
|
101
103
|
- muck-engine.gemspec
|
104
|
+
- pkg/muck-engine-0.1.7.gem
|
102
105
|
- public/images/arrow_down.gif
|
103
106
|
- public/images/arrow_left.gif
|
104
107
|
- public/images/arrow_right.gif
|