jbasdf-disguise 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. data/.document +5 -0
  2. data/.gitignore +5 -0
  3. data/LICENSE +20 -0
  4. data/README.rdoc +43 -0
  5. data/Rakefile +93 -0
  6. data/VERSION +1 -0
  7. data/app/controllers/admin/disguise/themes_controller.rb +32 -0
  8. data/app/models/theme.rb +37 -0
  9. data/app/views/admin/themes/_theme.html.erb +7 -0
  10. data/app/views/admin/themes/edit.html.erb +10 -0
  11. data/app/views/admin/themes/no_themes.html.erb +4 -0
  12. data/config/disguise_routes.rb +6 -0
  13. data/db/migrate/20090530170040_create_themes.rb +11 -0
  14. data/disguise.gemspec +163 -0
  15. data/generators/theme/USAGE +13 -0
  16. data/generators/theme/templates/INSTALL +5 -0
  17. data/generators/theme/templates/description.txt +1 -0
  18. data/generators/theme/templates/locales/en.yml +2 -0
  19. data/generators/theme/templates/preview.gif +0 -0
  20. data/generators/theme/templates/stylesheets/styles.css +1 -0
  21. data/generators/theme/templates/views/_footer.html.erb +7 -0
  22. data/generators/theme/templates/views/_head.html.erb +9 -0
  23. data/generators/theme/templates/views/_header.html.erb +28 -0
  24. data/generators/theme/templates/views/application.html.erb +18 -0
  25. data/generators/theme/templates/views/home.html.erb +14 -0
  26. data/generators/theme/theme_generator.rb +43 -0
  27. data/lib/action_controller/disguise_application.rb +50 -0
  28. data/lib/disguise.rb +8 -0
  29. data/lib/disguise/initialize_routes.rb +8 -0
  30. data/lib/disguise/tasks.rb +34 -0
  31. data/locales/ar.yml +8 -0
  32. data/locales/bg.yml +8 -0
  33. data/locales/ca.yml +8 -0
  34. data/locales/cs.yml +8 -0
  35. data/locales/da.yml +8 -0
  36. data/locales/de.yml +8 -0
  37. data/locales/el.yml +8 -0
  38. data/locales/en.yml +7 -0
  39. data/locales/es.yml +8 -0
  40. data/locales/fr.yml +8 -0
  41. data/locales/it.yml +8 -0
  42. data/locales/iw.yml +8 -0
  43. data/locales/ja.yml +8 -0
  44. data/locales/ko.yml +8 -0
  45. data/locales/lt.yml +8 -0
  46. data/locales/lv.yml +8 -0
  47. data/locales/nl.yml +8 -0
  48. data/locales/no.yml +9 -0
  49. data/locales/pl.yml +8 -0
  50. data/locales/pt.yml +8 -0
  51. data/locales/ro.yml +8 -0
  52. data/locales/ru.yml +8 -0
  53. data/locales/sk.yml +8 -0
  54. data/locales/sl.yml +8 -0
  55. data/locales/sr.yml +8 -0
  56. data/locales/sv.yml +8 -0
  57. data/locales/tl.yml +8 -0
  58. data/locales/uk.yml +8 -0
  59. data/locales/vi.yml +8 -0
  60. data/locales/zh-CN.yml +8 -0
  61. data/locales/zh-TW.yml +8 -0
  62. data/locales/zh.yml +8 -0
  63. data/rails/init.rb +3 -0
  64. data/tasks/rails.rake +2 -0
  65. data/test/disguise_test.rb +7 -0
  66. data/test/test_helper.rb +18 -0
  67. metadata +120 -0
@@ -0,0 +1,13 @@
1
+ NAME
2
+ theme - Creates the folder structure for a new theme
3
+
4
+ SYNOPSIS
5
+ theme [theme_name]
6
+
7
+ DESCRIPTION
8
+ This generator creates the folder structure for a new theme and copies over the appropriate files.
9
+
10
+ EXAMPLE
11
+ ./script/generate theme theme_name
12
+
13
+ This will generate the file structure for a theme named 'theme_name'.
@@ -0,0 +1,5 @@
1
+ To complete the theme you will need to modify the strings in the en.yml file that can be found in /themes/{theme_name}/locale/en.yml.
2
+ You can change most of the text in the site by changing that file.
3
+ We've created a directory in the images folder with your theme name. Place all theme specific images into that folder.
4
+ We also added a file called public/stylesheets/themes/{theme_name}.css where you can put theme specific css.
5
+ Add a description for your new theme to description.txt and a preview image named preview.gif. (You can also use a png or jpg).
@@ -0,0 +1 @@
1
+ Put information about your theme here
@@ -0,0 +1,2 @@
1
+ en:
2
+ start: 'put strings to be translated in this file'
@@ -0,0 +1 @@
1
+ /*Add styles specific to your theme here*/
@@ -0,0 +1,7 @@
1
+ <div id="footer">
2
+ <%= link_to _('Contact Us'), contact_path %>
3
+ <%= link_to _('News'), news_index_path %> |
4
+ <%= link_to _('Privacy Policy'), page_path('privacy-policy') %> |
5
+ <%= link_to _('Terms of Use'), page_path('terms') %> |
6
+ <%= link_to _('Code of Conduct'), page_path('code_of_conduct') %>
7
+ </div>
@@ -0,0 +1,9 @@
1
+ <meta http-equiv="content-type" content="text/html; charset=utf-8" />
2
+ <meta name="description" content="Luvfoo - communities with purpose" />
3
+ <title><%= @title || _(GlobalConfig.application_name) -%></title>
4
+ <%= stylesheet_link_tag 'reset', 'ie', 'application', 'beast', 'standard', :cache=>true -%>
5
+ <%= javascript_include_tag 'jquery', 'jquery-ui', 'jrails', 'thickbox', 'jquery-plugins/jquery.jgrowl_minimized.js', 'application' -%>
6
+ <%= theme_stylesheet_link_tag %>
7
+ <%= javascript_tag %[const AUTH_TOKEN = #{form_authenticity_token.inspect};] if protect_against_forgery? -%>
8
+ <%= yield :head -%>
9
+ <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon">
@@ -0,0 +1,28 @@
1
+ <div id="top-navigation">
2
+ <form action="/search" style='margin:0px;padding:0px;'>
3
+ <ul class="top-nav">
4
+ <li class="first"><a href="http://<%= GlobalConfig.application_url %>/home"><%= _('Home') %></a></li>
5
+ <li><a href="<%= groups_path %>"><%= _('Groups') %></a></li>
6
+ <li><a href="<%= profiles_path %>"><%= _('People') %></a></li>
7
+ <li><a href="<%= news_index_path %>"><%= _('News') %></a></li>
8
+ <li><a href="http://courses.<%= GlobalConfig.application_base_url %>"><%= _('Courses') %></a></li>
9
+ <li><a href="/pages/support-us"><%= _('Donate') %></a></li>
10
+ </ul>
11
+ <div id="log-out" class="right">
12
+ <span id='search'>
13
+ <script type='text/javascript'>function searchClicked(){sb=document.getElementById('search_box');sb.style.color='black';if (sb.value == 'Search') sb.value='';}</script>
14
+ <input id='search_box' type='text' name='q' value='<%= _('Search') %>' onclick='searchClicked();'/>
15
+ <button style='height:22px;'><span style='line-height:13px;vertical-align:middle;'><%= _('Go') %></span></button>
16
+ </span>
17
+ <% if logged_in? -%>
18
+ <%= link_to _('My Dashboard'), user_path(current_user) %>
19
+ <%= link_to current_user.login, profile_path(current_user) %>
20
+ <%= link_to _('Logout'), logout_path %>
21
+ <% else -%>
22
+ <%= _("%{login_link} %{signup_link}") % {:login_link => link_to(_('Login'), login_path), :signup_link => link_to(_('Sign-up'), signup_path)} %>
23
+ <% end -%>
24
+ </div>
25
+ </form>
26
+ </div>
27
+
28
+ <div class="clear"></div>
@@ -0,0 +1,18 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
3
+ <head>
4
+ <%= render :partial => 'layouts/global/head' %>
5
+ </head>
6
+ <body>
7
+ <div id="header">
8
+ <%= render :partial => 'layouts/global/header' %>
9
+ </div>
10
+ <div id="main">
11
+ <div id="content">
12
+ <%= display_standard_flashes %>
13
+ <%= yield %>
14
+ </div>
15
+ </div>
16
+ <%= render :partial => 'layouts/global/footer' %>
17
+ </body>
18
+ </html>
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
2
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
3
+ <head>
4
+ <%= render :partial => 'layouts/global/head' %>
5
+ </head>
6
+ <body>
7
+ <div id="home">
8
+ <%= render :partial => 'layouts/global/header' %>
9
+ Your home page can be different than the rest of your site. Build out your custom home layout here.
10
+ <%= yield %>
11
+ <%= render :partial => 'layouts/global/footer' %>
12
+ </div>
13
+ </body>
14
+ </html>
@@ -0,0 +1,43 @@
1
+ class ThemeGenerator < Rails::Generator::NamedBase
2
+ def manifest
3
+ record do |m|
4
+
5
+ # Theme directory
6
+ m.directory "themes/#{file_name}"
7
+ m.directory "themes/#{file_name}/content"
8
+ m.directory "themes/#{file_name}/content/pages"
9
+ m.directory "themes/#{file_name}/content/protected-pages"
10
+ m.directory "themes/#{file_name}/locale"
11
+ m.directory "themes/#{file_name}/views"
12
+ m.directory "themes/#{file_name}/views/layouts"
13
+
14
+ # basic theme files
15
+ m.file "views/_head.html.erb", "themes/#{file_name}/views/layouts/_head.html.erb"
16
+ m.file "views/_header.html.erb", "themes/#{file_name}/views/layouts/_header.html.erb"
17
+ m.file "views/_footer.html.erb", "themes/#{file_name}/views/layouts/_footer.html.erb"
18
+ m.file "views/application.html.erb", "themes/#{file_name}/views/layouts/application.html.erb"
19
+ m.file "views/home.html.erb", "themes/#{file_name}/views/layouts/home.html.erb"
20
+
21
+ # description
22
+ m.file "description.txt", "themes/#{file_name}/description.txt"
23
+
24
+ # images
25
+ m.directory "public/images/#{file_name}"
26
+ m.file "preview.gif", "public/images/#{file_name}/preview.gif"
27
+
28
+ #stylesheets
29
+ m.directory "public/stylesheets/themes"
30
+ m.directory "public/stylesheets/themes/#{file_name}"
31
+ m.file "stylesheets/styles.css", "public/stylesheets/themes/#{file_name}/styles.css"
32
+
33
+ # localization
34
+ m.file "locale/en.yml", "themes/#{file_name}/locale/en.yml"
35
+
36
+ m.readme "INSTALL"
37
+ end
38
+ end
39
+
40
+ end
41
+
42
+
43
+
@@ -0,0 +1,50 @@
1
+ module ActionController
2
+ module DisguiseApplication
3
+
4
+ # Module automatically mixed into the all controllers
5
+ def self.included(base)
6
+ base.class_eval do
7
+ include InstanceMethods
8
+ before_filter :setup_theme
9
+ end
10
+ base.send :helper_method, :current_theme
11
+ end
12
+
13
+ module InstanceMethods
14
+
15
+ def current_theme
16
+ @theme ||= Theme.first
17
+ end
18
+
19
+ protected
20
+
21
+ def setup_theme
22
+ return if current_theme.blank? || current_theme.current.blank?
23
+ theme_view_path = File.join(Disguise::THEME_FULL_BASE_PATH, current_theme.current, 'views')
24
+ if self.view_paths.first == theme_view_path
25
+ return
26
+ else
27
+ clean_theme_view_path
28
+ self.prepend_view_path(theme_view_path)
29
+ clean_theme_locale
30
+ set_theme_locale
31
+ I18n.reload!
32
+ end
33
+ end
34
+
35
+ def clean_theme_view_path
36
+ self.view_paths.delete_if {|view_path| view_path.to_s.index(Disguise::THEME_PATH) == 0}
37
+ end
38
+
39
+ def clean_theme_locale
40
+ I18n.load_path.delete_if {|localization_path| localization_path.index(Disguise::THEME_FULL_BASE_PATH) == 0}
41
+ end
42
+
43
+ def set_theme_locale
44
+ I18n.load_path += current_theme.locales
45
+ end
46
+
47
+ end
48
+
49
+ end
50
+ end
data/lib/disguise.rb ADDED
@@ -0,0 +1,8 @@
1
+ ActionController::Base.send :include, ActionController::DisguiseApplication
2
+
3
+ I18n.load_path += Dir[ File.join(File.dirname(__FILE__), '..', 'locales', '*.{rb,yml}') ]
4
+
5
+ module Disguise
6
+ THEME_PATH = 'themes'
7
+ THEME_FULL_BASE_PATH = File.join(RAILS_ROOT, THEME_PATH)
8
+ end
@@ -0,0 +1,8 @@
1
+ class ActionController::Routing::RouteSet
2
+ def load_routes_with_disguise!
3
+ disguise_routes = File.join(File.dirname(__FILE__), *%w[.. .. config disguise_routes.rb])
4
+ add_configuration_file(disguise_routes) unless configuration_files.include? disguise_routes
5
+ load_routes_without_disguise!
6
+ end
7
+ alias_method_chain :load_routes!, :disguise
8
+ end
@@ -0,0 +1,34 @@
1
+ require 'rake'
2
+ require 'rake/tasklib'
3
+ require 'fileutils'
4
+
5
+ module Disguise
6
+ class Tasks < ::Rake::TaskLib
7
+ def initialize
8
+ define
9
+ end
10
+
11
+ private
12
+ def define
13
+ namespace :disguise do
14
+
15
+ task :app_env do
16
+ Rake::Task[:environment].invoke if defined?(RAILS_ROOT)
17
+ end
18
+
19
+ desc "Setup disguise"
20
+ task :setup => :sync do
21
+
22
+ end
23
+
24
+ desc "Sync required files from disguise."
25
+ task :sync do
26
+ path = File.join(File.dirname(__FILE__), *%w[.. ..])
27
+ system "rsync -ruv #{path}/db ."
28
+ end
29
+
30
+ end
31
+ end
32
+ end
33
+ end
34
+ Disguise::Tasks.new
data/locales/ar.yml ADDED
@@ -0,0 +1,8 @@
1
+ ---
2
+ ar:
3
+ disguise:
4
+ activate_theme_message: "انقر على موضوع لتفعيلها"
5
+ current_theme: "الموضوع الحالي"
6
+ no_themes_message: "أنت لم تكن قد أنشأت أي مواضيع طلبك. إذا كنت ترغب في إنشاء لجنة جديدة لمجرد موضوع لموضوع تشغيل المولدات واتبع التعليمات :"
7
+ set_theme: "حدد الموضوع"
8
+ theme_updated: "وكان موضوع تحديث بنجاح."
data/locales/bg.yml ADDED
@@ -0,0 +1,8 @@
1
+ ---
2
+ bg:
3
+ disguise:
4
+ activate_theme_message: "Щракнете върху някоя тема, за да го активирате"
5
+ current_theme: "Текущи Тема"
6
+ no_themes_message: "Все още не сте създали нито теми за вашата заявка. Ако искате да създадете нова тема просто стартирайте тема генератора и следвайте инструкциите:"
7
+ set_theme: "Задайте Тема"
8
+ theme_updated: "Тема бе успешно обновен."
data/locales/ca.yml ADDED
@@ -0,0 +1,8 @@
1
+ ---
2
+ ca:
3
+ disguise:
4
+ activate_theme_message: "Feu clic a un tema per activar"
5
+ current_theme: "Tema actual"
6
+ no_themes_message: "Vostè encara no ha creat cap temes per a la seva aplicació. Si voleu crear un nou tema simplement executeu el tema generador i seguiu les instruccions:"
7
+ set_theme: "Establir Tema"
8
+ theme_updated: "Tema s&#39;ha actualitzat."
data/locales/cs.yml ADDED
@@ -0,0 +1,8 @@
1
+ ---
2
+ cs:
3
+ disguise:
4
+ activate_theme_message: "Klikněte na téma pro jeho aktivaci"
5
+ current_theme: "Aktuální téma"
6
+ no_themes_message: "Vy ještě nemáte vytvořen jakékoliv témata pro vaše aplikace. Pokud chcete vytvořit nové téma jednoduše spustit generátor téma a postupujte podle návodu:"
7
+ set_theme: "Nastavit Témata"
8
+ theme_updated: "Téma bylo úspěšně aktualizováno."
data/locales/da.yml ADDED
@@ -0,0 +1,8 @@
1
+ ---
2
+ da:
3
+ disguise:
4
+ activate_theme_message: "Klik på et tema for at aktivere den"
5
+ current_theme: "Nuværende tema"
6
+ no_themes_message: "Du har endnu ikke oprettet nogen temaer for din ansøgning. Hvis du vil oprette et nyt emne, skal du blot køre den tema-generator, og følg vejledningen:"
7
+ set_theme: "Indstil Theme"
8
+ theme_updated: "Tema var blevet opdateret."
data/locales/de.yml ADDED
@@ -0,0 +1,8 @@
1
+ ---
2
+ de:
3
+ disguise:
4
+ activate_theme_message: "Klicken Sie auf ein Thema, um es zu aktivieren"
5
+ current_theme: "Aktuelle Themen"
6
+ no_themes_message: "Sie haben noch nicht alle Themen, die für Ihre Anwendung. Wenn Sie möchten, erstellen Sie ein neues Thema starten Sie das Thema Generator und folgen Sie den Anweisungen:"
7
+ set_theme: "Set Thema"
8
+ theme_updated: "Thema wurde erfolgreich aktualisiert."
data/locales/el.yml ADDED
@@ -0,0 +1,8 @@
1
+ ---
2
+ el:
3
+ disguise:
4
+ activate_theme_message: "Κάντε κλικ σε ένα θέμα για να ενεργοποιήσετε"
5
+ current_theme: "Τρέχον Θέμα"
6
+ no_themes_message: "Εσείς δεν έχετε δημιουργήσει οποιαδήποτε θέματα για την εφαρμογή σας. Αν θέλετε να δημιουργήσετε ένα νέο θέμα απλά εκτελέστε το θέμα γεννήτριας και ακολουθήστε τις οδηγίες:"
7
+ set_theme: "Ορισμός Θέμα"
8
+ theme_updated: "Το θέμα είχε ενημερωθεί με επιτυχία."
data/locales/en.yml ADDED
@@ -0,0 +1,7 @@
1
+ en:
2
+ disguise:
3
+ theme_updated: 'Theme was successfully updated.'
4
+ no_themes_message: 'You have not yet created any themes for your application. If you would like to create a new theme simply run the theme generator and follow the instructions:'
5
+ set_theme: Set Theme
6
+ current_theme: Current Theme
7
+ activate_theme_message: Click on a theme to activate it
data/locales/es.yml ADDED
@@ -0,0 +1,8 @@
1
+ ---
2
+ es:
3
+ disguise:
4
+ activate_theme_message: "Haga clic en un tema para activarlo"
5
+ current_theme: "Tema actual"
6
+ no_themes_message: "Usted aún no ha creado ninguna temas para su aplicación. Si desea crear un nuevo tema simplemente ejecute el tema generador y siga las instrucciones:"
7
+ set_theme: "Establecer Tema"
8
+ theme_updated: "Tema se ha actualizado."
data/locales/fr.yml ADDED
@@ -0,0 +1,8 @@
1
+ ---
2
+ fr:
3
+ disguise:
4
+ activate_theme_message: "Cliquez sur un thème pour l&#39;activer"
5
+ current_theme: "Thème actuel"
6
+ no_themes_message: "Vous n&#39;avez pas encore créé de thèmes pour votre application. Si vous souhaitez créer un nouveau thème, exécutez simplement le thème générateur et suivez les instructions:"
7
+ set_theme: "Set Thème"
8
+ theme_updated: "Thème a été mis à jour."
data/locales/it.yml ADDED
@@ -0,0 +1,8 @@
1
+ ---
2
+ it:
3
+ disguise:
4
+ activate_theme_message: "Fare clic su un tema per attivarla"
5
+ current_theme: "Tema attuale"
6
+ no_themes_message: "Non hai ancora creato alcun temi per la vostra applicazione. Se si desidera creare un nuovo tema basta eseguire il tema generatore e seguire le istruzioni:"
7
+ set_theme: "Imposta Tema"
8
+ theme_updated: "Tema è stato aggiornato con successo."
data/locales/iw.yml ADDED
@@ -0,0 +1,8 @@
1
+ ---
2
+ iw:
3
+ disguise:
4
+ activate_theme_message: "לחץ על נושא כדי להפעיל אותה"
5
+ current_theme: "נושאים נוכחיים"
6
+ no_themes_message: "עדיין לא נוצר שום נושאים עבור היישום שלך. אם אתה רוצה ליצור ערכת נושא פשוט להפעיל את הגנרטור נושא אחר ההוראות:"
7
+ set_theme: "בחר ערכת נושא"
8
+ theme_updated: "נושאים היה עודכנו בהצלחה."
data/locales/ja.yml ADDED
@@ -0,0 +1,8 @@
1
+ ---
2
+ ja:
3
+ disguise:
4
+ activate_theme_message: をクリックして起動をテーマに
5
+ current_theme: 現在のテーマ
6
+ no_themes_message: あなたは、お使いのアプリケーションに任意のテーマを作成していません。場合は、新しいテーマがテーマだけを実行し、指示に従ってくださいジェネレータを作成したいと思います:
7
+ set_theme: 設定テーマ
8
+ theme_updated: テーマは正常に更新されました。
data/locales/ko.yml ADDED
@@ -0,0 +1,8 @@
1
+ ---
2
+ ko:
3
+ disguise:
4
+ activate_theme_message: "테마를 클릭하여 활성화"
5
+ current_theme: "현재 테마"
6
+ no_themes_message: "당신이 아직 귀하의 응용 프로그램에 대한 모든 주제를 작성하지 않았습니다. 만약 당신이 새로운 테마를 단순히 테마 발전기를 실행하고 지침에 따라 작성하고 싶습니다 :"
7
+ set_theme: "테마 설정"
8
+ theme_updated: "테마가 성공적으로 업데이 트했습니다."
data/locales/lt.yml ADDED
@@ -0,0 +1,8 @@
1
+ ---
2
+ lt:
3
+ disguise:
4
+ activate_theme_message: "Paspauskite ant temos aktyvuoti"
5
+ current_theme: "Aktualios temos"
6
+ no_themes_message: "Jūs dar neturite susikūrę jokių temų jūsų paraišką. Jei norite sukurti naują temą tiesiog paleiskite tema generatorius ir sekite instrukcijas:"
7
+ set_theme: "Nustatykite temą"
8
+ theme_updated: "Tema buvo sėkmingai atnaujintas."
data/locales/lv.yml ADDED
@@ -0,0 +1,8 @@
1
+ ---
2
+ lv:
3
+ disguise:
4
+ activate_theme_message: "Klikšķiniet uz tēmas, lai aktivizētu"
5
+ current_theme: "Current Theme"
6
+ no_themes_message: "Jūs vēl neesat izveidojis nevienu tēmas savu pieteikumu. Ja vēlaties izveidot jaunu tēmu vienkārši palaist tēmu ģenerators un izpildiet instrukcijas:"
7
+ set_theme: "Set Theme"
8
+ theme_updated: "Tēma ir veiksmīgi atjaunināts."
data/locales/nl.yml ADDED
@@ -0,0 +1,8 @@
1
+ ---
2
+ nl:
3
+ disguise:
4
+ activate_theme_message: "Klik op een thema te activeren"
5
+ current_theme: "Huidig Thema"
6
+ no_themes_message: "U nog geen thema&#39;s voor uw toepassing. Wilt u een nieuw thema als u het thema generator en volg de instructies:"
7
+ set_theme: "Stel Thema"
8
+ theme_updated: "Thema is bijgewerkt."