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_modules(shuffle = false) available_modules = [].tap do |arr| App.modules.each do |mod| module_name = mod.to_s.split("::").last arr << ['/' + module_name.downcase, module_name] unless mod.under_development? end end shuffle ? available_modules.shuffle : available_modules end def developing_modules [].tap do |arr| App.modules.each do |mod| module_name = mod.to_s.split("::").last arr << ['/' + module_name.downcase, module_name] if mod.under_development? end end end def all_modules(shuffle = false) all_modules = [].tap do |arr| App.modules.each do |mod| module_name = mod.to_s.split("::").last arr << ['/' + module_name.downcase, module_name] end end shuffle ? all_modules.shuffle : all_modules end def find_template(views, *args, &block) App.views.each {|v| super(v, *args, &block)} end end end end