Module: Cmtool::Includes::Page::ClassMethods
- Defined in:
- lib/cmtool/includes/page.rb
Instance Method Summary collapse
- #active(*args) ⇒ Object
- #default_locale ⇒ Object
- #flag_locales ⇒ Object
- #for_sitemap ⇒ Object
- #generate_name(name) ⇒ Object
- #layouts ⇒ Object
- #locales ⇒ Object
- #menu_roots ⇒ Object
- #top_menu ⇒ Object
Instance Method Details
#active(*args) ⇒ Object
56 57 58 |
# File 'lib/cmtool/includes/page.rb', line 56 def active(*args) all(*args) end |
#default_locale ⇒ Object
70 71 72 |
# File 'lib/cmtool/includes/page.rb', line 70 def default_locale :en end |
#flag_locales ⇒ Object
64 65 66 |
# File 'lib/cmtool/includes/page.rb', line 64 def flag_locales [:ad, :ae, :af, :ag, :ai, :al, :am, :an, :ao, :aq, :ar, :as, :at, :au, :aw, :az, :ba, :bb, :bd, :be, :bf, :bg, :bh, :bi, :bj, :bm, :bn, :bo, :br, :bs, :bt, :bw, :by, :bz, :ca, :cd, :cf, :cg, :ch, :ci, :ck, :cl, :cm, :cn, :co, :cr, :cu, :cv, :cy, :cz, :de, :dj, :dk, :dm, :do, :dz, :ec, :ee, :eg, :eh, :en, :er, :es, :et, :fi, :fj, :fm, :fo, :fr, :ga, :gb, :gd, :ge, :gg, :gh, :gi, :gl, :gm, :gn, :gp, :gq, :gr, :gt, :gu, :gw, :gy, :hk, :hn, :hr, :ht, :hu, :id, :ie, :il, :im, :in, :iq, :ir, :is, :it, :je, :jm, :jo, :jp, :ke, :kg, :kh, :ki, :km, :kn, :kp, :kr, :kw, :ky, :kz, :la, :lb, :lc, :li, :lk, :lr, :ls, :lt, :lu, :lv, :ly, :ma, :mc, :md, :me, :mg, :mh, :mk, :ml, :mm, :mn, :mo, :mq, :mr, :ms, :mt, :mu, :mv, :mw, :mx, :my, :mz, :na, :nc, :ne, :ng, :ni, :nl, :no, :np, :nr, :nz, :om, :pa, :pe, :pf, :pg, :ph, :pk, :pl, :pr, :ps, :pt, :pw, :py, :qa, :re, :ro, :rs, :ru, :rw, :sa, :sb, :sc, :sd, :se, :sg, :si, :sk, :sl, :sm, :sn, :so, :sr, :st, :sv, :sy, :sz, :tc, :td, :tg, :th, :tj, :tl, :tm, :tn, :to, :tr, :tt, :tv, :tw, :tz, :ua, :ug, :us, :uy, :uz, :va, :vc, :ve, :vg, :vi, :vn, :vu, :ws, :ye, :za, :zm, :zw] end |
#for_sitemap ⇒ Object
74 75 76 |
# File 'lib/cmtool/includes/page.rb', line 74 def for_sitemap all end |
#generate_name(name) ⇒ Object
53 54 55 |
# File 'lib/cmtool/includes/page.rb', line 53 def generate_name(name) name.to_s.downcase.gsub(/^\W+/, '').gsub(/\W+$/,'').gsub(/\W+/, '-') end |
#layouts ⇒ Object
60 61 62 |
# File 'lib/cmtool/includes/page.rb', line 60 def layouts [:application, :home, :contact] end |
#locales ⇒ Object
67 68 69 |
# File 'lib/cmtool/includes/page.rb', line 67 def locales Rails.configuration.i18n.available_locales.presence || [] end |
#menu_roots ⇒ Object
83 84 85 |
# File 'lib/cmtool/includes/page.rb', line 83 def ::Page.roots(I18n.locale.to_s).select(&:in_menu?) end |
#top_menu ⇒ Object
78 79 80 81 |
# File 'lib/cmtool/includes/page.rb', line 78 def ActiveSupport::Deprecation.warn("Page.top_menu is a stupid name. Use Page.menu_roots instead") end |