module Teamster module Core module GeneralHelper def title App.title end def current_user session[:current_user] end def logged_in? !!current_user end def use_included_bootstrap_css? true end def use_included_bootstrap_js? true end def login_required halt(403, erb(:login_required)) unless session[:current_user] end def include_bootstrap_css %q~ ~ end def include_bootstrap_js %q~ ~ end CORE_JS = ['bootstrap.min.js', 'jquery-2.1.0.min.js', 'site.js'] def add_other_js_files all_js = Dir.glob('public/js/*.js') other_js = all_js.delete_if {|js| CORE_JS.include?(File.basename(js))} other_js.map {|js| js.gsub('public', '')} [].tap do |arr| other_js.each do |js| arr << "" end end.join('\n') end def navbar erb :navbar end def footer erb :footer end def available_adapters(shuffle = false) available_adapters = [].tap do |arr| App.adapters.each do |mod| adapter_name = mod.to_s.split("::").last arr << ['/' + adapter_name.downcase, adapter_name] unless mod.under_development? end end shuffle ? available_adapters.shuffle : available_adapters end def developing_adapters [].tap do |arr| App.adapters.each do |mod| adapter_name = mod.to_s.split("::").last arr << ['/' + adapter_name.downcase, adapter_name] if mod.under_development? end end end def all_adapters(shuffle = false) all_adapters = [].tap do |arr| App.adapters.each do |mod| adapter_name = mod.to_s.split("::").last arr << ['/' + adapter_name.downcase, adapter_name] end end shuffle ? all_adapters.shuffle : all_adapters end def find_template(views, *args, &block) App.views.each {|v| super(v, *args, &block)} end end end end