diff options
-rw-r--r-- | CUSTOM.md | 13 | ||||
-rw-r--r-- | Rakefile | 2 | ||||
-rw-r--r-- | config/application.rb | 8 | ||||
-rw-r--r-- | config/customization/README.md | 27 | ||||
-rw-r--r-- | config/initializers/customization.rb | 36 | ||||
-rw-r--r-- | core/app/helpers/download_helper.rb | 2 | ||||
-rw-r--r-- | core/app/views/common/_download_for_os.html.haml | 4 | ||||
-rw-r--r-- | core/app/views/common/_home_page_buttons.html.haml | 10 | ||||
-rw-r--r-- | core/config/locales/en.yml | 4 | ||||
-rw-r--r-- | public/leap-img/128/mask.png | bin | 10080 -> 3654 bytes |
10 files changed, 92 insertions, 14 deletions
@@ -1,11 +1,14 @@ -# Customization # +Customization +============================== -Leap Web is based on Engines. All things in `app` will overwrite the default behaviour. You can either create a new rails app and include the leap_web gem or clone the leap web repository and add your customizations to the `app` directory. +Customization directory +--------------------------------------- -## CSS Customization ## +See config/customization/README.md -We use scss. It's a superset of css3. Add your customizations to `app/assets/stylesheets`. +Engines +--------------------- -## Disabling an Engine ## +Leap Web is based on Engines. All things in `app` will overwrite the default behaviour. You can either create a new rails app and include the leap_web gem or clone the leap web repository and add your customizations to the `app` directory. If you have no use for one of the engines you can remove it from the Gemfile. Not however that your app might still need to provide some functionality for the other engines to work. For example the users engine provides `current_user` and other methods. @@ -2,6 +2,8 @@ # Add your own tasks in files placed in lib/tasks ending in .rake, # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. +RAKE=true # let environment initialization code know if we are running via rake or not. + require 'rake/packagetask' require 'rubygems/package_task' diff --git a/config/application.rb b/config/application.rb index 8587ffc..2c9c55a 100644 --- a/config/application.rb +++ b/config/application.rb @@ -78,12 +78,18 @@ module LeapWeb # Enable the asset pipeline config.assets.enabled = true - config.assets.initialize_on_precompile = false + config.assets.initialize_on_precompile = true # don't change this (see customization.rb) # Version of your assets, change this if you want to expire all your assets config.assets.version = '1.0' # Set to false in order to see asset requests in the log config.quiet_assets = true + + ## + ## CUSTOMIZATION + ## see initializers/customization.rb + ## + config.paths['app/views'].unshift "config/customization/views" end end diff --git a/config/customization/README.md b/config/customization/README.md new file mode 100644 index 0000000..9c3e434 --- /dev/null +++ b/config/customization/README.md @@ -0,0 +1,27 @@ +Customizing LEAP Webapp +============================================ + +By default, this directory is empty. Any file you place here will override the default files for the application. + +For example: + + stylesheets/ -- overrides files Rails.root/app/assets/stylesheets + tail.scss -- included before all others + head.scss -- included after all others + + public/ -- overrides files in Rails.root/public + favicon.ico -- custom favicon + img/ -- customary directory to put images in + + views/ -- overrides files Rails.root/app/views + home/ + index.html.haml -- this file is what shows up on the home page + + locales/ -- overrides files in Rails.root/config/locales + en.yml -- overrides for English + de.yml -- overrides for German + and so on... + +For most changes, the web application must be restarted after any changes are made to the customization directory. + +Sometimes a `rake tmp:clear` and a rails restart is required to pick up a new stylesheet. diff --git a/config/initializers/customization.rb b/config/initializers/customization.rb new file mode 100644 index 0000000..bc9c834 --- /dev/null +++ b/config/initializers/customization.rb @@ -0,0 +1,36 @@ +# +# When deploying, common customizations can be dropped in config/customizations. This initializer makes this work. +# +customization_directory = "#{Rails.root}/config/customization" + +# +# Set customization views as the first view path +# +# Rails.application.config.paths['app/views'].unshift "config/customization/views" +# (For some reason, this does not work here. See application.rb for where this is actually called.) + +# +# Set customization stylesheets as the first asset path +# +# Some notes: +# +# * This cannot go in application.rb, as far as I can tell. In application.rb, the default paths +# haven't been loaded yet, so the path we add will always end up at the end unless we add it here. +# +# * For this to work, config.assets.initialize_on_precompile MUST be set to true, otherwise +# this initializer will never get called in production mode when the assets are precompiled. +# +Rails.application.config.assets.paths.unshift "#{customization_directory}/stylesheets" + +# +# Copy files to public +# +if !defined?(RAKE) && Dir.exists?("#{customization_directory}/public") + require 'fileutils' + FileUtils.cp_r("#{customization_directory}/public/.", "#{Rails.root}/public") +end + +# +# Add I18n path +# +Rails.application.config.i18n.load_path += Dir["#{customization_directory}/locales/*.{rb,yml,yaml}"] diff --git a/core/app/helpers/download_helper.rb b/core/app/helpers/download_helper.rb index f9c6c40..ee0fe73 100644 --- a/core/app/helpers/download_helper.rb +++ b/core/app/helpers/download_helper.rb @@ -2,7 +2,7 @@ module DownloadHelper def alternative_client_links(os = nil) alternative_clients(os).map do |client| - link_to(client.capitalize, client_download_url(client)) + link_to(I18n.t("os."+client), client_download_url(client)) end end diff --git a/core/app/views/common/_download_for_os.html.haml b/core/app/views/common/_download_for_os.html.haml index b7c88ba..4c096ce 100644 --- a/core/app/views/common/_download_for_os.html.haml +++ b/core/app/views/common/_download_for_os.html.haml @@ -8,8 +8,8 @@ %br/ %small= I18n.t("os.#{os}") %span.info - = t(:client_info, :provider => content_tag(:b,APP_CONFIG[:domain])).html_safe - %br/ + %div= t(:client_info, :provider => content_tag(:b,APP_CONFIG[:domain])).html_safe + %div - if os == "other" = t(:all_downloads_info, :clients => alternative_client_links(os).to_sentence).html_safe - else diff --git a/core/app/views/common/_home_page_buttons.html.haml b/core/app/views/common/_home_page_buttons.html.haml index e10fd38..3be12e2 100644 --- a/core/app/views/common/_home_page_buttons.html.haml +++ b/core/app/views/common/_home_page_buttons.html.haml @@ -2,10 +2,14 @@ .home-buttons .row-fluid.first - .span3 - .download.span6 + .span2 + .download.span8 = render partial: 'common/download_for_os', collection: available_clients + ['other'] - .span3 + .span2 + - if local_assigns[:divider] + .row-fluid + .span12 + = render local_assigns[:divider] .row-fluid.second .login.span4 %span.link= link_to(icon('ok-sign', icon_color) + t(:login), login_path, :class => 'btn') diff --git a/core/config/locales/en.yml b/core/config/locales/en.yml index 4710a16..4abf4e8 100644 --- a/core/config/locales/en.yml +++ b/core/config/locales/en.yml @@ -23,7 +23,7 @@ en: download_client: "Download Bitmask" client_info: "The Bitmask application allows you to use %{provider} services." all_downloads_info: "It is available for %{clients}." - other_downloads_info: "It is also available for %{clients}." + other_downloads_info: "Bitmask is also available for %{clients}." login_info: "Log in to change your account settings, create support tickets, and manage payments." signup_info: "Sign up for a new user account via this website (it is better if you use the Bitmask application to sign up, but this website works too)." welcome: "Welcome to %{provider}." @@ -35,6 +35,6 @@ en: linux64: "Linux (64 bit)" windows: "Windows" android: "Android" - osx: "Mac OSX" + osx: "Mac OS" other: "(not available for your OS.)" diff --git a/public/leap-img/128/mask.png b/public/leap-img/128/mask.png Binary files differindex c7390eb..444a62c 100644 --- a/public/leap-img/128/mask.png +++ b/public/leap-img/128/mask.png |