dm_core 4.2.1.5
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.
- checksums.yaml +7 -0
- data/MIT-LICENSE +22 -0
- data/README.md +25 -0
- data/Rakefile +34 -0
- data/app/assets/images/dm_core/draft_menu_bg.png +0 -0
- data/app/assets/images/dm_core/expand.png +0 -0
- data/app/assets/images/dm_core/flags/ad.gif +0 -0
- data/app/assets/images/dm_core/flags/ae.gif +0 -0
- data/app/assets/images/dm_core/flags/af.gif +0 -0
- data/app/assets/images/dm_core/flags/ag.gif +0 -0
- data/app/assets/images/dm_core/flags/ai.gif +0 -0
- data/app/assets/images/dm_core/flags/al.gif +0 -0
- data/app/assets/images/dm_core/flags/am.gif +0 -0
- data/app/assets/images/dm_core/flags/an.gif +0 -0
- data/app/assets/images/dm_core/flags/ao.gif +0 -0
- data/app/assets/images/dm_core/flags/ar.gif +0 -0
- data/app/assets/images/dm_core/flags/as.gif +0 -0
- data/app/assets/images/dm_core/flags/at.gif +0 -0
- data/app/assets/images/dm_core/flags/au.gif +0 -0
- data/app/assets/images/dm_core/flags/aw.gif +0 -0
- data/app/assets/images/dm_core/flags/ax.gif +0 -0
- data/app/assets/images/dm_core/flags/az.gif +0 -0
- data/app/assets/images/dm_core/flags/ba.gif +0 -0
- data/app/assets/images/dm_core/flags/bb.gif +0 -0
- data/app/assets/images/dm_core/flags/bd.gif +0 -0
- data/app/assets/images/dm_core/flags/be.gif +0 -0
- data/app/assets/images/dm_core/flags/bf.gif +0 -0
- data/app/assets/images/dm_core/flags/bg.gif +0 -0
- data/app/assets/images/dm_core/flags/bh.gif +0 -0
- data/app/assets/images/dm_core/flags/bi.gif +0 -0
- data/app/assets/images/dm_core/flags/bj.gif +0 -0
- data/app/assets/images/dm_core/flags/bm.gif +0 -0
- data/app/assets/images/dm_core/flags/bn.gif +0 -0
- data/app/assets/images/dm_core/flags/bo.gif +0 -0
- data/app/assets/images/dm_core/flags/br.gif +0 -0
- data/app/assets/images/dm_core/flags/bs.gif +0 -0
- data/app/assets/images/dm_core/flags/bt.gif +0 -0
- data/app/assets/images/dm_core/flags/bv.gif +0 -0
- data/app/assets/images/dm_core/flags/bw.gif +0 -0
- data/app/assets/images/dm_core/flags/by.gif +0 -0
- data/app/assets/images/dm_core/flags/bz.gif +0 -0
- data/app/assets/images/dm_core/flags/ca.gif +0 -0
- data/app/assets/images/dm_core/flags/cc.gif +0 -0
- data/app/assets/images/dm_core/flags/cd.gif +0 -0
- data/app/assets/images/dm_core/flags/cf.gif +0 -0
- data/app/assets/images/dm_core/flags/cg.gif +0 -0
- data/app/assets/images/dm_core/flags/ch.gif +0 -0
- data/app/assets/images/dm_core/flags/ci.gif +0 -0
- data/app/assets/images/dm_core/flags/ck.gif +0 -0
- data/app/assets/images/dm_core/flags/cl.gif +0 -0
- data/app/assets/images/dm_core/flags/cm.gif +0 -0
- data/app/assets/images/dm_core/flags/cn.gif +0 -0
- data/app/assets/images/dm_core/flags/co.gif +0 -0
- data/app/assets/images/dm_core/flags/cr.gif +0 -0
- data/app/assets/images/dm_core/flags/cs.gif +0 -0
- data/app/assets/images/dm_core/flags/cu.gif +0 -0
- data/app/assets/images/dm_core/flags/cv.gif +0 -0
- data/app/assets/images/dm_core/flags/cx.gif +0 -0
- data/app/assets/images/dm_core/flags/cy.gif +0 -0
- data/app/assets/images/dm_core/flags/cz.gif +0 -0
- data/app/assets/images/dm_core/flags/de.gif +0 -0
- data/app/assets/images/dm_core/flags/dj.gif +0 -0
- data/app/assets/images/dm_core/flags/dk.gif +0 -0
- data/app/assets/images/dm_core/flags/dm.gif +0 -0
- data/app/assets/images/dm_core/flags/do.gif +0 -0
- data/app/assets/images/dm_core/flags/dz.gif +0 -0
- data/app/assets/images/dm_core/flags/ec.gif +0 -0
- data/app/assets/images/dm_core/flags/ee.gif +0 -0
- data/app/assets/images/dm_core/flags/eg.gif +0 -0
- data/app/assets/images/dm_core/flags/eh.gif +0 -0
- data/app/assets/images/dm_core/flags/en.gif +0 -0
- data/app/assets/images/dm_core/flags/england.gif +0 -0
- data/app/assets/images/dm_core/flags/er.gif +0 -0
- data/app/assets/images/dm_core/flags/es.gif +0 -0
- data/app/assets/images/dm_core/flags/et.gif +0 -0
- data/app/assets/images/dm_core/flags/fam.gif +0 -0
- data/app/assets/images/dm_core/flags/fi.gif +0 -0
- data/app/assets/images/dm_core/flags/fj.gif +0 -0
- data/app/assets/images/dm_core/flags/fk.gif +0 -0
- data/app/assets/images/dm_core/flags/fm.gif +0 -0
- data/app/assets/images/dm_core/flags/fo.gif +0 -0
- data/app/assets/images/dm_core/flags/fr.gif +0 -0
- data/app/assets/images/dm_core/flags/ga.gif +0 -0
- data/app/assets/images/dm_core/flags/gb.gif +0 -0
- data/app/assets/images/dm_core/flags/gd.gif +0 -0
- data/app/assets/images/dm_core/flags/ge.gif +0 -0
- data/app/assets/images/dm_core/flags/gh.gif +0 -0
- data/app/assets/images/dm_core/flags/gi.gif +0 -0
- data/app/assets/images/dm_core/flags/gl.gif +0 -0
- data/app/assets/images/dm_core/flags/gm.gif +0 -0
- data/app/assets/images/dm_core/flags/gn.gif +0 -0
- data/app/assets/images/dm_core/flags/gp.gif +0 -0
- data/app/assets/images/dm_core/flags/gq.gif +0 -0
- data/app/assets/images/dm_core/flags/gr.gif +0 -0
- data/app/assets/images/dm_core/flags/gs.gif +0 -0
- data/app/assets/images/dm_core/flags/gt.gif +0 -0
- data/app/assets/images/dm_core/flags/gu.gif +0 -0
- data/app/assets/images/dm_core/flags/gw.gif +0 -0
- data/app/assets/images/dm_core/flags/gy.gif +0 -0
- data/app/assets/images/dm_core/flags/hk.gif +0 -0
- data/app/assets/images/dm_core/flags/hn.gif +0 -0
- data/app/assets/images/dm_core/flags/hr.gif +0 -0
- data/app/assets/images/dm_core/flags/ht.gif +0 -0
- data/app/assets/images/dm_core/flags/hu.gif +0 -0
- data/app/assets/images/dm_core/flags/id.gif +0 -0
- data/app/assets/images/dm_core/flags/ie.gif +0 -0
- data/app/assets/images/dm_core/flags/il.gif +0 -0
- data/app/assets/images/dm_core/flags/in.gif +0 -0
- data/app/assets/images/dm_core/flags/io.gif +0 -0
- data/app/assets/images/dm_core/flags/iq.gif +0 -0
- data/app/assets/images/dm_core/flags/ir.gif +0 -0
- data/app/assets/images/dm_core/flags/is.gif +0 -0
- data/app/assets/images/dm_core/flags/it.gif +0 -0
- data/app/assets/images/dm_core/flags/ja.gif +0 -0
- data/app/assets/images/dm_core/flags/jm.gif +0 -0
- data/app/assets/images/dm_core/flags/jo.gif +0 -0
- data/app/assets/images/dm_core/flags/ke.gif +0 -0
- data/app/assets/images/dm_core/flags/kg.gif +0 -0
- data/app/assets/images/dm_core/flags/kh.gif +0 -0
- data/app/assets/images/dm_core/flags/ki.gif +0 -0
- data/app/assets/images/dm_core/flags/km.gif +0 -0
- data/app/assets/images/dm_core/flags/kn.gif +0 -0
- data/app/assets/images/dm_core/flags/kp.gif +0 -0
- data/app/assets/images/dm_core/flags/kr.gif +0 -0
- data/app/assets/images/dm_core/flags/kw.gif +0 -0
- data/app/assets/images/dm_core/flags/ky.gif +0 -0
- data/app/assets/images/dm_core/flags/kz.gif +0 -0
- data/app/assets/images/dm_core/flags/la.gif +0 -0
- data/app/assets/images/dm_core/flags/lb.gif +0 -0
- data/app/assets/images/dm_core/flags/lc.gif +0 -0
- data/app/assets/images/dm_core/flags/li.gif +0 -0
- data/app/assets/images/dm_core/flags/lk.gif +0 -0
- data/app/assets/images/dm_core/flags/lr.gif +0 -0
- data/app/assets/images/dm_core/flags/ls.gif +0 -0
- data/app/assets/images/dm_core/flags/lt.gif +0 -0
- data/app/assets/images/dm_core/flags/lu.gif +0 -0
- data/app/assets/images/dm_core/flags/lv.gif +0 -0
- data/app/assets/images/dm_core/flags/ly.gif +0 -0
- data/app/assets/images/dm_core/flags/ma.gif +0 -0
- data/app/assets/images/dm_core/flags/mc.gif +0 -0
- data/app/assets/images/dm_core/flags/md.gif +0 -0
- data/app/assets/images/dm_core/flags/mg.gif +0 -0
- data/app/assets/images/dm_core/flags/mh.gif +0 -0
- data/app/assets/images/dm_core/flags/mk.gif +0 -0
- data/app/assets/images/dm_core/flags/ml.gif +0 -0
- data/app/assets/images/dm_core/flags/mm.gif +0 -0
- data/app/assets/images/dm_core/flags/mn.gif +0 -0
- data/app/assets/images/dm_core/flags/mo.gif +0 -0
- data/app/assets/images/dm_core/flags/mp.gif +0 -0
- data/app/assets/images/dm_core/flags/mq.gif +0 -0
- data/app/assets/images/dm_core/flags/mr.gif +0 -0
- data/app/assets/images/dm_core/flags/ms.gif +0 -0
- data/app/assets/images/dm_core/flags/mt.gif +0 -0
- data/app/assets/images/dm_core/flags/mu.gif +0 -0
- data/app/assets/images/dm_core/flags/mv.gif +0 -0
- data/app/assets/images/dm_core/flags/mw.gif +0 -0
- data/app/assets/images/dm_core/flags/mx.gif +0 -0
- data/app/assets/images/dm_core/flags/my.gif +0 -0
- data/app/assets/images/dm_core/flags/mz.gif +0 -0
- data/app/assets/images/dm_core/flags/na.gif +0 -0
- data/app/assets/images/dm_core/flags/nc.gif +0 -0
- data/app/assets/images/dm_core/flags/ne.gif +0 -0
- data/app/assets/images/dm_core/flags/nf.gif +0 -0
- data/app/assets/images/dm_core/flags/ng.gif +0 -0
- data/app/assets/images/dm_core/flags/ni.gif +0 -0
- data/app/assets/images/dm_core/flags/nl.gif +0 -0
- data/app/assets/images/dm_core/flags/no.gif +0 -0
- data/app/assets/images/dm_core/flags/np.gif +0 -0
- data/app/assets/images/dm_core/flags/nr.gif +0 -0
- data/app/assets/images/dm_core/flags/nu.gif +0 -0
- data/app/assets/images/dm_core/flags/nz.gif +0 -0
- data/app/assets/images/dm_core/flags/om.gif +0 -0
- data/app/assets/images/dm_core/flags/pa.gif +0 -0
- data/app/assets/images/dm_core/flags/pe.gif +0 -0
- data/app/assets/images/dm_core/flags/pf.gif +0 -0
- data/app/assets/images/dm_core/flags/pg.gif +0 -0
- data/app/assets/images/dm_core/flags/ph.gif +0 -0
- data/app/assets/images/dm_core/flags/pk.gif +0 -0
- data/app/assets/images/dm_core/flags/pl.gif +0 -0
- data/app/assets/images/dm_core/flags/pm.gif +0 -0
- data/app/assets/images/dm_core/flags/pn.gif +0 -0
- data/app/assets/images/dm_core/flags/pr.gif +0 -0
- data/app/assets/images/dm_core/flags/ps.gif +0 -0
- data/app/assets/images/dm_core/flags/pt.gif +0 -0
- data/app/assets/images/dm_core/flags/pw.gif +0 -0
- data/app/assets/images/dm_core/flags/py.gif +0 -0
- data/app/assets/images/dm_core/flags/qa.gif +0 -0
- data/app/assets/images/dm_core/flags/ro.gif +0 -0
- data/app/assets/images/dm_core/flags/ru.gif +0 -0
- data/app/assets/images/dm_core/flags/rw.gif +0 -0
- data/app/assets/images/dm_core/flags/sa.gif +0 -0
- data/app/assets/images/dm_core/flags/sb.gif +0 -0
- data/app/assets/images/dm_core/flags/sc.gif +0 -0
- data/app/assets/images/dm_core/flags/scotland.gif +0 -0
- data/app/assets/images/dm_core/flags/sd.gif +0 -0
- data/app/assets/images/dm_core/flags/se.gif +0 -0
- data/app/assets/images/dm_core/flags/sg.gif +0 -0
- data/app/assets/images/dm_core/flags/sh.gif +0 -0
- data/app/assets/images/dm_core/flags/si.gif +0 -0
- data/app/assets/images/dm_core/flags/sk.gif +0 -0
- data/app/assets/images/dm_core/flags/sl.gif +0 -0
- data/app/assets/images/dm_core/flags/sm.gif +0 -0
- data/app/assets/images/dm_core/flags/sn.gif +0 -0
- data/app/assets/images/dm_core/flags/so.gif +0 -0
- data/app/assets/images/dm_core/flags/sr.gif +0 -0
- data/app/assets/images/dm_core/flags/st.gif +0 -0
- data/app/assets/images/dm_core/flags/sv.gif +0 -0
- data/app/assets/images/dm_core/flags/sy.gif +0 -0
- data/app/assets/images/dm_core/flags/sz.gif +0 -0
- data/app/assets/images/dm_core/flags/tc.gif +0 -0
- data/app/assets/images/dm_core/flags/td.gif +0 -0
- data/app/assets/images/dm_core/flags/tf.gif +0 -0
- data/app/assets/images/dm_core/flags/tg.gif +0 -0
- data/app/assets/images/dm_core/flags/th.gif +0 -0
- data/app/assets/images/dm_core/flags/tj.gif +0 -0
- data/app/assets/images/dm_core/flags/tk.gif +0 -0
- data/app/assets/images/dm_core/flags/tl.gif +0 -0
- data/app/assets/images/dm_core/flags/tm.gif +0 -0
- data/app/assets/images/dm_core/flags/tn.gif +0 -0
- data/app/assets/images/dm_core/flags/to.gif +0 -0
- data/app/assets/images/dm_core/flags/tr.gif +0 -0
- data/app/assets/images/dm_core/flags/tt.gif +0 -0
- data/app/assets/images/dm_core/flags/tv.gif +0 -0
- data/app/assets/images/dm_core/flags/tw.gif +0 -0
- data/app/assets/images/dm_core/flags/tz.gif +0 -0
- data/app/assets/images/dm_core/flags/ua.gif +0 -0
- data/app/assets/images/dm_core/flags/ug.gif +0 -0
- data/app/assets/images/dm_core/flags/um.gif +0 -0
- data/app/assets/images/dm_core/flags/us.gif +0 -0
- data/app/assets/images/dm_core/flags/uy.gif +0 -0
- data/app/assets/images/dm_core/flags/uz.gif +0 -0
- data/app/assets/images/dm_core/flags/va.gif +0 -0
- data/app/assets/images/dm_core/flags/vc.gif +0 -0
- data/app/assets/images/dm_core/flags/ve.gif +0 -0
- data/app/assets/images/dm_core/flags/vg.gif +0 -0
- data/app/assets/images/dm_core/flags/vi.gif +0 -0
- data/app/assets/images/dm_core/flags/vn.gif +0 -0
- data/app/assets/images/dm_core/flags/vu.gif +0 -0
- data/app/assets/images/dm_core/flags/wales.gif +0 -0
- data/app/assets/images/dm_core/flags/wf.gif +0 -0
- data/app/assets/images/dm_core/flags/ws.gif +0 -0
- data/app/assets/images/dm_core/flags/ye.gif +0 -0
- data/app/assets/images/dm_core/flags/yt.gif +0 -0
- data/app/assets/images/dm_core/flags/za.gif +0 -0
- data/app/assets/images/dm_core/flags/zm.gif +0 -0
- data/app/assets/images/dm_core/flags/zw.gif +0 -0
- data/app/assets/images/dm_core/user.gif +0 -0
- data/app/assets/javascripts/dm_core/admin.js +223 -0
- data/app/assets/javascripts/dm_core/admin_extra.js.coffee +118 -0
- data/app/assets/javascripts/dm_core/application.js +14 -0
- data/app/assets/javascripts/dm_core/common_js.js.coffee +61 -0
- data/app/assets/javascripts/dm_core/underscore-1.4.4-min.js +1 -0
- data/app/assets/javascripts/dm_core/underscore-1.4.4.js +1227 -0
- data/app/assets/stylesheets/dm_core/admin.css +250 -0
- data/app/assets/stylesheets/dm_core/application.css +31 -0
- data/app/assets/stylesheets/dm_core/font-awesome.css +1479 -0
- data/app/assets/stylesheets/dm_core/font/FontAwesome.otf +0 -0
- data/app/assets/stylesheets/dm_core/font/fontawesome-webfont.eot +0 -0
- data/app/assets/stylesheets/dm_core/font/fontawesome-webfont.svg +399 -0
- data/app/assets/stylesheets/dm_core/font/fontawesome-webfont.ttf +0 -0
- data/app/assets/stylesheets/dm_core/font/fontawesome-webfont.woff +0 -0
- data/app/controllers/dm_core/admin/accounts_controller.rb +125 -0
- data/app/controllers/dm_core/admin/admin_controller.rb +133 -0
- data/app/controllers/dm_core/admin/comments_controller.rb +70 -0
- data/app/controllers/dm_core/admin/dashboard_controller.rb +38 -0
- data/app/controllers/dm_core/admin/system_controller.rb +44 -0
- data/app/controllers/dm_core/admin/users_controller.rb +106 -0
- data/app/controllers/dm_core/application_controller.rb +253 -0
- data/app/controllers/dm_core/concerns/profile_controller.rb +41 -0
- data/app/controllers/dm_core/profile_controller.rb +8 -0
- data/app/datatables/user_datatable.rb +75 -0
- data/app/helpers/devise_helper.rb +25 -0
- data/app/helpers/dm_core/account_helper.rb +70 -0
- data/app/helpers/dm_core/admin/application_helper.rb +23 -0
- data/app/helpers/dm_core/application_helper.rb +58 -0
- data/app/helpers/dm_core/liquid_helper.rb +79 -0
- data/app/helpers/dm_core/params_helper.rb +19 -0
- data/app/helpers/dm_core/render_helper.rb +104 -0
- data/app/helpers/dm_core/url_helper.rb +189 -0
- data/app/helpers/dm_utilities/currency_helper.rb +24 -0
- data/app/helpers/dm_utilities/date_helper.rb +72 -0
- data/app/inputs/code_editor_input.rb +51 -0
- data/app/inputs/text_full_width_input.rb +9 -0
- data/app/inputs/toggle_checked_input.rb +9 -0
- data/app/inputs/toggle_input.rb +9 -0
- data/app/mailers/dm_core/site_mailer.rb +18 -0
- data/app/models/account.rb +241 -0
- data/app/models/activity.rb +10 -0
- data/app/models/address.rb +24 -0
- data/app/models/category.rb +18 -0
- data/app/models/comment.rb +24 -0
- data/app/models/custom_field.rb +99 -0
- data/app/models/custom_field_def.rb +61 -0
- data/app/models/dm_core/concerns/ability.rb +17 -0
- data/app/models/dm_core/concerns/defines_custom_fields.rb +17 -0
- data/app/models/dm_core/concerns/friendly_id.rb +57 -0
- data/app/models/dm_core/concerns/has_custom_fields.rb +28 -0
- data/app/models/dm_core/concerns/public_private.rb +151 -0
- data/app/models/dm_core/concerns/user.rb +144 -0
- data/app/models/dm_core/concerns/user_profile.rb +113 -0
- data/app/models/dm_core/concerns/user_site_profile.rb +65 -0
- data/app/models/dm_core/country.rb +8 -0
- data/app/models/dm_core/language.rb +59 -0
- data/app/models/dm_core/permitted_params.rb +52 -0
- data/app/models/follow.rb +13 -0
- data/app/models/liquid_validator.rb +26 -0
- data/app/models/payment_history.rb +57 -0
- data/app/models/presence_default_locale_validator.rb +12 -0
- data/app/models/role.rb +12 -0
- data/app/models/system_email.rb +15 -0
- data/app/models/ultracart/notification.rb +107 -0
- data/app/models/ultracart/payment_history.rb +55 -0
- data/app/models/user.rb +22 -0
- data/app/models/user_profile.rb +9 -0
- data/app/models/user_site_profile.rb +11 -0
- data/app/presenters/base_presenter.rb +30 -0
- data/app/presenters/comment_presenter.rb +20 -0
- data/app/presenters/user_presenter.rb +48 -0
- data/app/uploaders/avatar_uploader.rb +75 -0
- data/app/views/devise/mailer/confirmation_instructions.html.erb +7 -0
- data/app/views/devise/mailer/confirmation_instructions.text.erb +7 -0
- data/app/views/devise/mailer/reset_password_instructions.html.erb +9 -0
- data/app/views/devise/mailer/reset_password_instructions.text.erb +9 -0
- data/app/views/devise/mailer/unlock_instructions.html.erb +7 -0
- data/app/views/devise/mailer/unlock_instructions.text.erb +7 -0
- data/app/views/dm_core/admin/accounts/_settings_menu.html.erb +24 -0
- data/app/views/dm_core/admin/accounts/analytics.html.erb +38 -0
- data/app/views/dm_core/admin/accounts/email.html.erb +26 -0
- data/app/views/dm_core/admin/accounts/general.html.erb +22 -0
- data/app/views/dm_core/admin/accounts/media.html.erb +37 -0
- data/app/views/dm_core/admin/accounts/metadata.html.erb +22 -0
- data/app/views/dm_core/admin/comments/_comment.html.erb +14 -0
- data/app/views/dm_core/admin/comments/_comment_edit_form.html.erb +3 -0
- data/app/views/dm_core/admin/comments/_comment_form.html.erb +15 -0
- data/app/views/dm_core/admin/comments/_comment_list.html.erb +5 -0
- data/app/views/dm_core/admin/comments/_comment_section.html.erb +7 -0
- data/app/views/dm_core/admin/comments/create.js.erb +4 -0
- data/app/views/dm_core/admin/comments/destroy.js.erb +1 -0
- data/app/views/dm_core/admin/comments/edit.js.erb +2 -0
- data/app/views/dm_core/admin/comments/update.js.erb +2 -0
- data/app/views/dm_core/admin/custom_fields/_check_box_collection.html.erb +4 -0
- data/app/views/dm_core/admin/custom_fields/_custom_field_def_fields.html.erb +34 -0
- data/app/views/dm_core/admin/custom_fields/_divider.html.erb +1 -0
- data/app/views/dm_core/admin/custom_fields/_number_field.html.erb +4 -0
- data/app/views/dm_core/admin/custom_fields/_radio_buttons.html.erb +4 -0
- data/app/views/dm_core/admin/custom_fields/_select.html.erb +4 -0
- data/app/views/dm_core/admin/custom_fields/_text_area.html.erb +4 -0
- data/app/views/dm_core/admin/custom_fields/_text_field.html.erb +4 -0
- data/app/views/dm_core/admin/dashboard/_index_sidebar.html.erb +22 -0
- data/app/views/dm_core/admin/dashboard/_widget_recent_new_users.html.erb +23 -0
- data/app/views/dm_core/admin/dashboard/_widget_recent_user_activity.html.erb +21 -0
- data/app/views/dm_core/admin/dashboard/index.html.erb +7 -0
- data/app/views/dm_core/admin/dashboard/update_site_assets.html.erb +5 -0
- data/app/views/dm_core/admin/shared/_header_stats_new_users.html.erb +2 -0
- data/app/views/dm_core/admin/shared/_header_stats_user_activity.html.erb +2 -0
- data/app/views/dm_core/admin/system/show.html.erb +23 -0
- data/app/views/dm_core/admin/users/_form.html.erb +44 -0
- data/app/views/dm_core/admin/users/edit.html.erb +201 -0
- data/app/views/dm_core/admin/users/index.html.erb +30 -0
- data/app/views/dm_core/profile/_profile_sidebar.html.erb +6 -0
- data/app/views/dm_core/profile/account.html.erb +38 -0
- data/app/views/dm_core/profile/details.html.erb +38 -0
- data/app/views/layouts/dm_core/application.html.erb +14 -0
- data/app/views/layouts/dm_core/maintenance.html.erb +31 -0
- data/app/views/layouts/email_templates/default_email_layout.html.erb +289 -0
- data/config/initializers/_dm_core.rb +7 -0
- data/config/initializers/carrierwave.rb +33 -0
- data/config/initializers/devise.rb +252 -0
- data/config/initializers/friendly_id.rb +88 -0
- data/config/initializers/globalize_easy_accessors.rb +67 -0
- data/config/initializers/globalize_papertrail_fix.rb +20 -0
- data/config/initializers/globalize_reflections.rb +22 -0
- data/config/initializers/rolify.rb +8 -0
- data/config/initializers/simple_form.rb +161 -0
- data/config/initializers/simple_form_amsterdam.rb +31 -0
- data/config/initializers/simple_form_bootstrap.rb +87 -0
- data/config/initializers/simple_form_bootstrap3.rb +175 -0
- data/config/initializers/will_paginate.rb +87 -0
- data/config/locales/custom.cs.yml +82 -0
- data/config/locales/custom.de.yml +82 -0
- data/config/locales/custom.en.yml +84 -0
- data/config/locales/custom.fi.yml +84 -0
- data/config/locales/custom.ja.yml +84 -0
- data/config/locales/devise.cs.yml +70 -0
- data/config/locales/devise.de.yml +60 -0
- data/config/locales/devise.en.yml +59 -0
- data/config/locales/devise.fi.yml +57 -0
- data/config/locales/devise.ja.yml +102 -0
- data/config/locales/rails.cs.yml +211 -0
- data/config/locales/rails.de-AT.yml +203 -0
- data/config/locales/rails.de.yml +203 -0
- data/config/locales/rails.en-GB.yml +205 -0
- data/config/locales/rails.en-IN.yml +205 -0
- data/config/locales/rails.en.yml +205 -0
- data/config/locales/rails.fi.yml +199 -0
- data/config/locales/rails.fr-CH.yml +207 -0
- data/config/locales/rails.fr.yml +215 -0
- data/config/locales/rails.ja.yml +197 -0
- data/config/locales/simple_form.cs.yml +26 -0
- data/config/locales/simple_form.de.yml +26 -0
- data/config/locales/simple_form.en.yml +26 -0
- data/config/locales/simple_form.fi.yml +26 -0
- data/config/locales/simple_form.ja.yml +26 -0
- data/config/routes.rb +33 -0
- data/db/globalize_seed_data.sql +76 -0
- data/db/migrate/20121023202117_add_globalize_countries.rb +49 -0
- data/db/migrate/20121028125329_devise_create_users.rb +45 -0
- data/db/migrate/20121028125831_add_user_fields.rb +13 -0
- data/db/migrate/20121028153317_rolify_create_roles.rb +19 -0
- data/db/migrate/20121105205634_add_last_access.rb +9 -0
- data/db/migrate/20121110213512_create_versions.rb +18 -0
- data/db/migrate/20121110213513_add_object_changes_column_to_versions.rb +11 -0
- data/db/migrate/20130206121535_create_dm_core_accounts.rb +12 -0
- data/db/migrate/20130206223323_add_account_to_users.rb +8 -0
- data/db/migrate/20130207170247_create_preferences.rb +12 -0
- data/db/migrate/20130321144726_create_comments.rb +21 -0
- data/db/migrate/20130402203739_add_activity.rb +20 -0
- data/db/migrate/20130415095617_add_type_to_comments.rb +8 -0
- data/db/migrate/20130429191051_add_category.rb +27 -0
- data/db/migrate/20130513112751_create_email_table.rb +25 -0
- data/db/migrate/20130516143539_add_user_profile.rb +45 -0
- data/db/migrate/20130518155712_add_profile_email.rb +13 -0
- data/db/migrate/20130620145610_create_payment_history.rb +36 -0
- data/db/migrate/20130625091108_change_anchor_field.rb +9 -0
- data/db/migrate/20130628112848_create_user_site_profile.rb +26 -0
- data/db/migrate/20130708150236_add_avatar.rb +11 -0
- data/db/migrate/20130914132041_add_notify_to_payment_history.rb +7 -0
- data/db/migrate/20140105133446_acts_as_votable_migration.rb +27 -0
- data/db/migrate/20140107112418_add_user_site_profile_uuid.rb +18 -0
- data/db/migrate/20140129110547_add_invoice_id.rb +6 -0
- data/db/migrate/20140201092656_acts_as_follower_migration.rb +17 -0
- data/db/migrate/20140203131320_rename_invoice_id.rb +11 -0
- data/db/migrate/20140210195143_add_core_addresses.rb +17 -0
- data/db/migrate/20140411190454_papertrail_increase_column.rb +8 -0
- data/db/migrate/20140501160009_acts_as_taggable_on_migration.acts_as_taggable_on_engine.rb +31 -0
- data/db/migrate/20140501160010_add_missing_unique_indices.acts_as_taggable_on_engine.rb +22 -0
- data/db/migrate/20140501160011_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb +15 -0
- data/db/migrate/20140529164730_create_custom_fields.rb +39 -0
- data/db/migrate/20140709145503_add_missing_taggable_index.acts_as_taggable_on_engine.rb +10 -0
- data/db/migrate/20141216094639_add_favored_locale.rb +18 -0
- data/db/migrate/20160128094739_update_papertrail_v4.rb +73 -0
- data/db/migrate/20160630095745_create_delayed_jobs.rb +22 -0
- data/db/migrate/20160821150111_index_foreign_keys_in_core_accounts.rb +5 -0
- data/db/migrate/20160821150113_index_foreign_keys_in_core_addresses.rb +5 -0
- data/db/migrate/20160821150114_index_foreign_keys_in_core_categories.rb +5 -0
- data/db/migrate/20160821150115_index_foreign_keys_in_core_comments.rb +5 -0
- data/db/migrate/20160821150116_index_foreign_keys_in_core_custom_fields.rb +5 -0
- data/db/migrate/20160821150117_index_foreign_keys_in_core_payment_histories.rb +7 -0
- data/db/migrate/20160821150118_index_foreign_keys_in_core_system_email_translations.rb +5 -0
- data/db/migrate/20160821150119_index_foreign_keys_in_core_system_emails.rb +6 -0
- data/db/migrate/20160821150128_index_foreign_keys_in_preferences.rb +5 -0
- data/db/migrate/20160821150129_index_foreign_keys_in_roles.rb +5 -0
- data/db/migrate/20160821150130_index_foreign_keys_in_taggings.rb +5 -0
- data/db/migrate/20160821150131_index_foreign_keys_in_user_profiles.rb +7 -0
- data/db/migrate/20160821150132_index_foreign_keys_in_user_site_profiles.rb +6 -0
- data/db/migrate/20160821150133_index_foreign_keys_in_users_roles.rb +5 -0
- data/db/migrate/20160821150134_index_foreign_keys_in_version_associations.rb +5 -0
- data/db/migrate/20160821150135_index_foreign_keys_in_versions.rb +5 -0
- data/db/seeds.rb +433 -0
- data/db/seeds/globalize_countries.rb +239 -0
- data/db/seeds/globalize_languages.rb +186 -0
- data/lib/dm_core.rb +38 -0
- data/lib/dm_core/csv_exporter.rb +210 -0
- data/lib/dm_core/csv_importer.rb +16 -0
- data/lib/dm_core/engine.rb +51 -0
- data/lib/dm_core/liquid_extensions.rb +125 -0
- data/lib/dm_core/nls.rb +31 -0
- data/lib/dm_core/scio_excel.rb +501 -0
- data/lib/dm_core/state_select.rb +135 -0
- data/lib/dm_core/version.rb +3 -0
- data/lib/tasks/dm_core_tasks.rake +60 -0
- data/spec/dummy/README.rdoc +28 -0
- data/spec/dummy/Rakefile +6 -0
- data/spec/dummy/app/assets/javascripts/application.js +13 -0
- data/spec/dummy/app/assets/stylesheets/application.css +15 -0
- data/spec/dummy/app/controllers/application_controller.rb +5 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/models/ability.rb +10 -0
- data/spec/dummy/app/models/user.rb +6 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/bin/bundle +3 -0
- data/spec/dummy/bin/rails +4 -0
- data/spec/dummy/bin/rake +4 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/config/application.rb +27 -0
- data/spec/dummy/config/boot.rb +5 -0
- data/spec/dummy/config/database.yml +25 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +37 -0
- data/spec/dummy/config/environments/production.rb +82 -0
- data/spec/dummy/config/environments/test.rb +39 -0
- data/spec/dummy/config/initializers/assets.rb +8 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/cookies_serializer.rb +3 -0
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/dummy/config/initializers/inflections.rb +16 -0
- data/spec/dummy/config/initializers/mime_types.rb +4 -0
- data/spec/dummy/config/initializers/session_store.rb +3 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +23 -0
- data/spec/dummy/config/routes.rb +11 -0
- data/spec/dummy/config/secrets.yml +22 -0
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/db/schema.rb +399 -0
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/log/test.log +374 -0
- data/spec/dummy/public/404.html +67 -0
- data/spec/dummy/public/422.html +67 -0
- data/spec/dummy/public/500.html +66 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/factories/accounts.rb +9 -0
- data/spec/factories/user_profiles.rb +10 -0
- data/spec/factories/users.rb +19 -0
- data/spec/helpers/account_helper_spec.rb +50 -0
- data/spec/models/account_spec.rb +20 -0
- data/spec/models/user_spec.rb +99 -0
- data/spec/rails_helper.rb +70 -0
- data/spec/spec_helper.rb +85 -0
- data/spec/support/accounts.rb +19 -0
- data/spec/support/devise.rb +44 -0
- data/spec/support/fix_locale.rb +57 -0
- metadata +1124 -0
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
module DmCore
|
|
2
|
+
module UrlHelper
|
|
3
|
+
|
|
4
|
+
# Takes the full url path and converts to another locale
|
|
5
|
+
#------------------------------------------------------------------------------
|
|
6
|
+
def url_translate(locale)
|
|
7
|
+
DmCore::Language.translate_url(request.url, locale)
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
# # Usually don't care if a form submits a PUT or POST. Was something submitted?
|
|
11
|
+
# #------------------------------------------------------------------------------
|
|
12
|
+
# def put_or_post?
|
|
13
|
+
# request.put? || request.post? || request.patch?
|
|
14
|
+
# end
|
|
15
|
+
|
|
16
|
+
# Given a file name (relative or absolute), generate a full url path (usually
|
|
17
|
+
# will not include the protocol)
|
|
18
|
+
#------------------------------------------------------------------------------
|
|
19
|
+
def file_url(file_name, options = {})
|
|
20
|
+
options.reverse_merge! default_folder: 'media', account_site_assets: account_site_assets
|
|
21
|
+
if file_name.blank?
|
|
22
|
+
''
|
|
23
|
+
elsif file_name.start_with?('s3://', 's3s://')
|
|
24
|
+
# amazon S3 url - generate a signed expiring link
|
|
25
|
+
s3_generate_expiring_link(file_name)
|
|
26
|
+
elsif file_name.absolute_url?
|
|
27
|
+
# it's absolute, nothing to do
|
|
28
|
+
file_name
|
|
29
|
+
elsif options[:protected]
|
|
30
|
+
# a protected asset, append our protected asset name (which will trigger a
|
|
31
|
+
# special route to handle the file)
|
|
32
|
+
file_name.expand_url("/protected_asset/")
|
|
33
|
+
else
|
|
34
|
+
# append our site's asset folder and default folder
|
|
35
|
+
folder = options[:default_folder].blank? ? '' : "#{options[:default_folder]}/"
|
|
36
|
+
file_name.expand_url("#{options[:account_site_assets]}/#{folder}")
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# Generate an AWS S3 expiring link, using a special formatted url
|
|
41
|
+
# s3://bucket_name/object_name?expires=120 => non-SSL, expires in 120 minutes
|
|
42
|
+
# s3s://bucket_name/object_name?expires=20 => SSL, expires in 20 minutes
|
|
43
|
+
# s3s://bucket_name/object_name?expires=public => links directly to file (it must
|
|
44
|
+
# be a World readable file, and the link will never expire)
|
|
45
|
+
#------------------------------------------------------------------------------
|
|
46
|
+
def s3_generate_expiring_link(url)
|
|
47
|
+
access_key = Account.current.theme_data['AWS_ACCESS_KEY_ID']
|
|
48
|
+
secret_key = Account.current.theme_data['AWS_SECRET_ACCESS_KEY']
|
|
49
|
+
uri = URI.parse(url)
|
|
50
|
+
secure = (uri.scheme == 's3s')
|
|
51
|
+
bucket = uri.host
|
|
52
|
+
object_name = uri.path.gsub(/^\//, '')
|
|
53
|
+
expire_mins = (uri.query.blank? ? nil : CGI::parse(uri.query)['expires'][0]) || '10'
|
|
54
|
+
|
|
55
|
+
if expire_mins == "public"
|
|
56
|
+
"#{secure ? 'https' : 'http'}://#{bucket}.s3.amazonaws.com/#{object_name}"
|
|
57
|
+
else
|
|
58
|
+
s3 = ::AWS::S3.new(access_key_id: access_key, secret_access_key: secret_key)
|
|
59
|
+
object = s3.buckets[bucket].objects[object_name]
|
|
60
|
+
object.url_for(:get, {expires: expire_mins.to_i.minutes.from_now, secure: secure}).to_s
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
# if a relative url path is given, then expand it by prepending the supplied
|
|
65
|
+
# path.
|
|
66
|
+
#------------------------------------------------------------------------------
|
|
67
|
+
def expand_url(url, path)
|
|
68
|
+
url.expand_url(path)
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
# Returns an image tag, where the src defaults to the site_assets image folder
|
|
72
|
+
# Supports both relative paths and explicit url
|
|
73
|
+
#------------------------------------------------------------------------------
|
|
74
|
+
def site_media_image_tag(src, options = {})
|
|
75
|
+
image_tag(site_asset_media_path(src), options)
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
# Returns an image tag, where the src defaults to the site_assets image folder
|
|
79
|
+
# Supports both relative paths and explicit url
|
|
80
|
+
#------------------------------------------------------------------------------
|
|
81
|
+
def site_image_tag(src, options = {})
|
|
82
|
+
image_tag(site_image_path(src), options)
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
# Returns a path to a site image, relative to the site_assets folder
|
|
86
|
+
# Supports both relative paths and explicit url
|
|
87
|
+
#------------------------------------------------------------------------------
|
|
88
|
+
def site_image_path(src)
|
|
89
|
+
rewrite_asset_path(src.expand_url("#{account_site_assets}/images/"))
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
# Returns a url to a site image, relative to the site_assets folder
|
|
93
|
+
# Supports both relative paths and explicit url
|
|
94
|
+
#------------------------------------------------------------------------------
|
|
95
|
+
def site_image_url(src)
|
|
96
|
+
rewrite_asset_path(src.expand_url("#{account_site_assets_url}/images/"))
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
# Returns a path to a site assets, relative to the site_assets folder
|
|
100
|
+
# Supports both relative paths and explicit url
|
|
101
|
+
#------------------------------------------------------------------------------
|
|
102
|
+
def site_asset_path(src)
|
|
103
|
+
rewrite_asset_path(src.expand_url("#{account_site_assets}/"))
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
# Returns a path to a site assets, relative to the site_assets folder
|
|
107
|
+
# Supports both relative paths and explicit url
|
|
108
|
+
#------------------------------------------------------------------------------
|
|
109
|
+
def site_asset_url(src)
|
|
110
|
+
rewrite_asset_path(src.expand_url("#{account_site_assets_url}/"))
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
# Returns a path to a site assets, relative to the site_assets folder
|
|
114
|
+
# Supports both relative paths and explicit url
|
|
115
|
+
#------------------------------------------------------------------------------
|
|
116
|
+
def site_asset_media_path(src)
|
|
117
|
+
rewrite_asset_path(src.expand_url("#{account_site_assets_media}/"))
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
# Returns a path to a site assets, relative to the site_assets folder
|
|
121
|
+
# Supports both relative paths and explicit url
|
|
122
|
+
#------------------------------------------------------------------------------
|
|
123
|
+
def site_asset_media_url(src)
|
|
124
|
+
rewrite_asset_path(src.expand_url("#{account_site_assets_media_url}/"))
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
#------------------------------------------------------------------------------
|
|
128
|
+
# Following code pulled from the Rails 3.0 source.
|
|
129
|
+
# action_pack/lib/action_view/helpers/asset_tag_helper.rb
|
|
130
|
+
# Generates an asset id to be used for any assets we don't want in the asset
|
|
131
|
+
# pipeline. Asset id gets appeneded as a query string to url.
|
|
132
|
+
#
|
|
133
|
+
# Use case: all themes are precompiled, but a single stylesheet per
|
|
134
|
+
# theme lives outside the pipeline, so that it can be updated without having
|
|
135
|
+
# to recompile all assets of all sites/themes.
|
|
136
|
+
#
|
|
137
|
+
# Simplify the task: create the asset_id and append to the url - don't currently
|
|
138
|
+
# take into account asset hosts, etc.
|
|
139
|
+
#------------------------------------------------------------------------------
|
|
140
|
+
|
|
141
|
+
@@asset_timestamps_cache = {}
|
|
142
|
+
@@asset_timestamps_cache_guard = Mutex.new
|
|
143
|
+
@@cache_asset_timestamps = true
|
|
144
|
+
|
|
145
|
+
# Use the RAILS_ASSET_ID environment variable or the source's
|
|
146
|
+
# modification time as its cache-busting asset id.
|
|
147
|
+
#------------------------------------------------------------------------------
|
|
148
|
+
def rails_asset_id(source)
|
|
149
|
+
if asset_id = ENV["RAILS_ASSET_ID"]
|
|
150
|
+
asset_id
|
|
151
|
+
else
|
|
152
|
+
if @@cache_asset_timestamps && (asset_id = @@asset_timestamps_cache[source])
|
|
153
|
+
asset_id
|
|
154
|
+
else
|
|
155
|
+
path = File.join(Rails.root, 'public', source)
|
|
156
|
+
asset_id = File.exist?(path) ? File.mtime(path).to_i.to_s : ''
|
|
157
|
+
|
|
158
|
+
if @@cache_asset_timestamps
|
|
159
|
+
@@asset_timestamps_cache_guard.synchronize do
|
|
160
|
+
@@asset_timestamps_cache[source] = asset_id
|
|
161
|
+
end
|
|
162
|
+
end
|
|
163
|
+
|
|
164
|
+
asset_id
|
|
165
|
+
end
|
|
166
|
+
end
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
# Break out the asset path rewrite in case plugins wish to put the asset id
|
|
170
|
+
# someplace other than the query string.
|
|
171
|
+
#------------------------------------------------------------------------------
|
|
172
|
+
def rewrite_asset_path(source, path = nil)
|
|
173
|
+
if path && path.respond_to?(:call)
|
|
174
|
+
return path.call(source)
|
|
175
|
+
elsif path && path.is_a?(String)
|
|
176
|
+
return path % [source]
|
|
177
|
+
end
|
|
178
|
+
|
|
179
|
+
asset_id = rails_asset_id(source)
|
|
180
|
+
if asset_id.blank?
|
|
181
|
+
source
|
|
182
|
+
else
|
|
183
|
+
source + "?#{asset_id}"
|
|
184
|
+
end
|
|
185
|
+
end
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
end
|
|
189
|
+
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Currency helper routines
|
|
2
|
+
#------------------------------------------------------------------------------
|
|
3
|
+
module DmUtilities::CurrencyHelper
|
|
4
|
+
include ActionView::Helpers::NumberHelper
|
|
5
|
+
|
|
6
|
+
# Takes a number and a country code and formats it as a monetary value
|
|
7
|
+
# TODO see if there is a better way to hook in the Globalize::Currency object
|
|
8
|
+
# TODO we're not using the country object right now - I think this is a problem
|
|
9
|
+
#------------------------------------------------------------------------------
|
|
10
|
+
def ut_currency(amount, country, options = {})
|
|
11
|
+
return "—".html_safe if amount.blank?
|
|
12
|
+
precision = options[:precision] || 2
|
|
13
|
+
number_to_currency(amount, :locale => country.locale, :precision => precision)
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
# Takes a number and a country code and formats it as a monetary value
|
|
17
|
+
#------------------------------------------------------------------------------
|
|
18
|
+
def ut_currency_cents(cents, country, options = {})
|
|
19
|
+
return "—".html_safe if cents.blank?
|
|
20
|
+
ut_currency(cents/100, country, options)
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
end
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# Date/Time helper routines
|
|
2
|
+
#------------------------------------------------------------------------------
|
|
3
|
+
module DmUtilities::DateHelper
|
|
4
|
+
include ActionView::Helpers::NumberHelper
|
|
5
|
+
|
|
6
|
+
# format a date or date range, using the same format for each date
|
|
7
|
+
# Mar 3, 2012 -- Mar 5, 2012
|
|
8
|
+
# options
|
|
9
|
+
# :format => specifies the localize format to use, rather than the default
|
|
10
|
+
# :ignore_year => don't display the year
|
|
11
|
+
# :end_date => end date to display, creating a date range
|
|
12
|
+
#------------------------------------------------------------------------------
|
|
13
|
+
def format_date(start_date, full_date = false, options = {})
|
|
14
|
+
format = options[:format].nil? ? ((full_date ? :wwmmddyy : (options[:ignore_year] ? :mmdd : :mmddyy))) : options[:format]
|
|
15
|
+
date = (start_date.nil? or start_date.year < 1900) ? 'n/a' : start_date.localize(:count => start_date.day, :format => format)
|
|
16
|
+
date += " — #{options[:end_date].localize(:count => options[:end_date].day, :format => format)}".html_safe unless options[:end_date].blank?
|
|
17
|
+
return date.html_safe
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
# We check the start_date year in case it's a null date (set to a zero date, not just nil)
|
|
21
|
+
#------------------------------------------------------------------------------
|
|
22
|
+
def format_date_range(start_date, end_date, full_date = false, options = {})
|
|
23
|
+
return '' if start_date.nil? or start_date.year < 1900
|
|
24
|
+
end_date ||= start_date
|
|
25
|
+
options[:separator] ||= " — "
|
|
26
|
+
|
|
27
|
+
if start_date.month == end_date.month && start_date.day == end_date.day && start_date.year == end_date.year
|
|
28
|
+
event_date = start_date.localize(:count => start_date.day, :format => (options[:ignore_year] ? :mmdd : :mmddyy))
|
|
29
|
+
fullevent_date = start_date.localize(:count => start_date.day, :format => :wwmmddyy)
|
|
30
|
+
elsif start_date.month == end_date.month && start_date.year == end_date.year
|
|
31
|
+
event_date = start_date.localize(:count => start_date.day, :format => :mmdd) + options[:separator] + end_date.localize(:count => end_date.day, :format => (options[:ignore_year] ? "%d" : "%d, %Y"))
|
|
32
|
+
fullevent_date = start_date.localize(:count => start_date.day, :format => :wwmmdd) + options[:separator] + end_date.localize(:count => end_date.day, :format =>:wwmmddyy)
|
|
33
|
+
elsif start_date.year == end_date.year
|
|
34
|
+
event_date = start_date.localize(:count => start_date.day, :format => :mmdd) + options[:separator] + end_date.localize(:count => end_date.day, :format => (options[:ignore_year] ? :mmdd : :mmddyy))
|
|
35
|
+
fullevent_date = start_date.localize(:count => start_date.day, :format => :wwmmdd) + options[:separator] + end_date.localize(:count => end_date.day, :format => :wwmmddyy)
|
|
36
|
+
else
|
|
37
|
+
event_date = start_date.localize(:count => start_date.day, :format => (options[:ignore_year] ? :mmdd : :mmddyy)) + options[:separator] + end_date.localize(:count => end_date.day, :format => (options[:ignore_year] ? :mmdd : :mmddyy))
|
|
38
|
+
fullevent_date = start_date.localize(:count => start_date.day, :format => :wwmmddyy) + options[:separator] + end_date.localize(:count => end_date.day, :format => :wwmmddyy)
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
full_date ? fullevent_date.html_safe : event_date.html_safe
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
#------------------------------------------------------------------------------
|
|
45
|
+
def format_time_range(start_time, end_time, ignore_end_time = false)
|
|
46
|
+
return '' if start_time.nil?
|
|
47
|
+
ignore_end_time = true if end_time.nil?
|
|
48
|
+
|
|
49
|
+
eventTime = start_time.localize(:format => :hhmmpp)
|
|
50
|
+
|
|
51
|
+
ignore_end_time ? eventTime : "#{eventTime} — #{end_time.localize(:format => :hhmmpp)}".html_safe
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
#------------------------------------------------------------------------------
|
|
55
|
+
def format_time(start_time)
|
|
56
|
+
start_time.nil? ? 'n/a' : start_time.localize(:format => :hhmmpp)
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
# options
|
|
60
|
+
# :date_only => true only show the date
|
|
61
|
+
#------------------------------------------------------------------------------
|
|
62
|
+
def format_datetime(time, options = {})
|
|
63
|
+
time.nil? ? 'n/a' : (format_date(time, options[:full_date], options) + (options[:date_only] ? '' : " " + time.localize(:format => :hhmmpp)) )
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
# age / date
|
|
67
|
+
#------------------------------------------------------------------------------
|
|
68
|
+
def age_date(date)
|
|
69
|
+
date.nil? ? 'n/a' : (date.to_age.to_s + ' / ' + format_date(date))
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
end
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# Uses the CodeMirror editor
|
|
2
|
+
#------------------------------------------------------------------------------
|
|
3
|
+
class CodeEditorInput < SimpleForm::Inputs::TextInput
|
|
4
|
+
def input(wrapper_options)
|
|
5
|
+
options[:mode] = (options[:mode] || 'markdown').downcase
|
|
6
|
+
editor_mode = case options[:mode]
|
|
7
|
+
when 'textile'
|
|
8
|
+
:htmlmixed # no textile mode available
|
|
9
|
+
when 'markdown'
|
|
10
|
+
:markdown
|
|
11
|
+
when 'html'
|
|
12
|
+
:htmlmixed
|
|
13
|
+
else
|
|
14
|
+
:markdown
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
input_html_options['codemirror-editor'] = ""
|
|
18
|
+
input_html_options['data-mode'] = editor_mode
|
|
19
|
+
input_html_options['data-theme'] = options[:theme] || :default
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
editor_id = "codemirror_container_#{rand(1000)}"
|
|
23
|
+
out = ''
|
|
24
|
+
out << "<div class='cm_toolbar'>"
|
|
25
|
+
out << " <a class='cm_cmd_bold_#{options[:mode]}' href='javascript:void(0);' data-editor='\##{editor_id}'><i class='icon-bold'></i></a>"
|
|
26
|
+
out << " <a class='cm_cmd_italic_#{options[:mode]}' href='javascript:void(0);' data-editor='\##{editor_id}'><i class='icon-italic'></i></a>"
|
|
27
|
+
out << " <a class='cm_cmd_link_#{options[:mode]}' href='javascript:void(0);' data-editor='\##{editor_id}'><i class='icon-link5'></i></a>"
|
|
28
|
+
out << " <a class='cm_cmd_fullscreen' title='Fullscreen (Esc exits)' href='javascript:void(0);' data-editor='\##{editor_id}'><i class='icon-expand'></i></a>"
|
|
29
|
+
out << "</div>"
|
|
30
|
+
out << "<div id='#{editor_id}'>"
|
|
31
|
+
(out << @builder.text_area(attribute_name, input_html_options)).html_safe
|
|
32
|
+
out << "</div>"
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
# def input(wrapper_options)
|
|
38
|
+
# # :preview_version is a custom attribute from :input_html hash, so you can pick custom sizes
|
|
39
|
+
# version = input_html_options.delete(:preview_version)
|
|
40
|
+
# out = '' # the output string we're going to build
|
|
41
|
+
#
|
|
42
|
+
# # append file input. it will work accordingly with your simple_form wrappers
|
|
43
|
+
# (out << @builder.file_field(attribute_name, input_html_options)).html_safe
|
|
44
|
+
#
|
|
45
|
+
# # check if there's an uploaded file (eg: edit mode or form not saved)
|
|
46
|
+
# if object.send("#{attribute_name}?")
|
|
47
|
+
# # append preview image to output
|
|
48
|
+
# out << template.image_tag(object.send(attribute_name).tap {|o| break o.send(version) if version}.send('url'))
|
|
49
|
+
# end
|
|
50
|
+
# return out
|
|
51
|
+
# end
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
#------------------------------------------------------------------------------
|
|
2
|
+
class TextFullWidthInput < SimpleForm::Inputs::TextInput
|
|
3
|
+
def input(wrapper_options)
|
|
4
|
+
input_html_classes << 'input-block-level'
|
|
5
|
+
input_html_classes << ' monospaced' if options[:mono]
|
|
6
|
+
input_html_options[:rows] = options[:rows] if options[:rows]
|
|
7
|
+
super
|
|
8
|
+
end
|
|
9
|
+
end
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
#------------------------------------------------------------------------------
|
|
2
|
+
class ToggleCheckedInput < SimpleForm::Inputs::BooleanInput
|
|
3
|
+
def input(wrapper_options)
|
|
4
|
+
out = '<div class="on_off">'
|
|
5
|
+
out << @builder.check_box(attribute_name, input_html_options)
|
|
6
|
+
out << '</div>'
|
|
7
|
+
return out
|
|
8
|
+
end
|
|
9
|
+
end
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
#------------------------------------------------------------------------------
|
|
2
|
+
class ToggleInput < SimpleForm::Inputs::BooleanInput
|
|
3
|
+
def input(wrapper_options)
|
|
4
|
+
out = '<div class="yes_no">'
|
|
5
|
+
out << @builder.check_box(attribute_name, input_html_options)
|
|
6
|
+
out << '</div>'
|
|
7
|
+
return out
|
|
8
|
+
end
|
|
9
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Uses an interceptor hook to set the smtp_settings to values from the account
|
|
2
|
+
# All mailers should inherit from this class
|
|
3
|
+
#------------------------------------------------------------------------------
|
|
4
|
+
class DmCore::SiteMailer < ActionMailer::Base
|
|
5
|
+
|
|
6
|
+
layout 'email_templates/default_email_layout'
|
|
7
|
+
|
|
8
|
+
class DynamicSettingsInterceptor
|
|
9
|
+
def self.delivering_email(message)
|
|
10
|
+
unless Account.current.nil?
|
|
11
|
+
message.delivery_method.settings.merge!(Account.current.smtp_settings)
|
|
12
|
+
message.from = Account.current.preferred_smtp_from_email if message.from.blank?
|
|
13
|
+
message.reply_to = Account.current.preferred_smtp_from_email if message.reply_to.blank?
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
register_interceptor DynamicSettingsInterceptor
|
|
18
|
+
end
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
#------------------------------------------------------------------------------
|
|
2
|
+
class Account < ActiveRecord::Base
|
|
3
|
+
|
|
4
|
+
class DomainNotFound < StandardError
|
|
5
|
+
end
|
|
6
|
+
class LoginRequired < StandardError
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
CURRENCY_TYPES = { 'British Pound (£)'.html_safe => 'GBP',
|
|
10
|
+
'Czech Koruna (Kč)'.html_safe => 'CZK',
|
|
11
|
+
'Euro (€)'.html_safe => 'EUR',
|
|
12
|
+
'Indian Rupee (Rs)' => 'INR',
|
|
13
|
+
'Japanese Yen (¥)'.html_safe => 'JPY',
|
|
14
|
+
'Swiss Franc (Fr)' => 'CHF',
|
|
15
|
+
'US Dollar ($)' => 'USD' }
|
|
16
|
+
|
|
17
|
+
self.table_name = 'core_accounts'
|
|
18
|
+
|
|
19
|
+
attr_accessor :email_validation, :general_validation, :analytics_validation, :metadata_validation, :media_validation
|
|
20
|
+
attr_accessor :url_base, :url_host, :url_protocol #--- stores the current base site url for this request.
|
|
21
|
+
# useful to mailers where request object not available
|
|
22
|
+
|
|
23
|
+
validates_presence_of :domain, :if => Proc.new { |p| p.general_validation }
|
|
24
|
+
validates_presence_of :account_prefix, :if => Proc.new { |p| p.general_validation }
|
|
25
|
+
validates_presence_of :preferred_default_locale, :if => Proc.new { |p| p.general_validation }
|
|
26
|
+
validates_presence_of :preferred_locales, :if => Proc.new { |p| p.general_validation }
|
|
27
|
+
validates_presence_of :preferred_smtp_address, :if => Proc.new { |p| p.email_validation }
|
|
28
|
+
validates_presence_of :preferred_smtp_port, :if => Proc.new { |p| p.email_validation }
|
|
29
|
+
validates_presence_of :preferred_smtp_user_name, :if => Proc.new { |p| p.email_validation }
|
|
30
|
+
validates_presence_of :preferred_smtp_from_email, :if => Proc.new { |p| p.email_validation }
|
|
31
|
+
validates_presence_of :preferred_webmaster_email, :if => Proc.new { |p| p.email_validation }
|
|
32
|
+
validates_presence_of :preferred_site_title, :maximum => 255, :if => Proc.new { |p| p.metadata_validation }
|
|
33
|
+
validates_length_of :preferred_site_description, :maximum => 255, :if => Proc.new { |p| p.metadata_validation }
|
|
34
|
+
validates_length_of :preferred_site_keywords, :maximum => 255, :if => Proc.new { |p| p.metadata_validation }
|
|
35
|
+
|
|
36
|
+
after_create :create_default_roles
|
|
37
|
+
|
|
38
|
+
preference :ssl_enabled, :boolean, :default => false
|
|
39
|
+
preference :default_locale, :string, :default => 'en'
|
|
40
|
+
preference :locales, :string, :default => 'en, de'
|
|
41
|
+
preference :site_enabled, :boolean, :default => false
|
|
42
|
+
preference :site_maintenance, :boolean, :default => false
|
|
43
|
+
preference :google_analytics_tracker_id, :string
|
|
44
|
+
|
|
45
|
+
#--- Site wide page settings
|
|
46
|
+
preference :site_title, :string
|
|
47
|
+
preference :site_keywords, :string
|
|
48
|
+
preference :site_copyright, :string
|
|
49
|
+
preference :site_description, :string
|
|
50
|
+
preference :youtube_url, :string
|
|
51
|
+
preference :facebook_url, :string
|
|
52
|
+
preference :twitter_url, :string
|
|
53
|
+
preference :linkedin_url, :string
|
|
54
|
+
|
|
55
|
+
#--- Email / SMTP settings
|
|
56
|
+
preference :webmaster_email, :string
|
|
57
|
+
preference :support_email, :string
|
|
58
|
+
preference :archive_email, :string
|
|
59
|
+
preference :mailchimp_api_key, :string
|
|
60
|
+
preference :smtp_address, :string
|
|
61
|
+
preference :smtp_port, :string, :default => '587'
|
|
62
|
+
preference :smtp_domain, :string
|
|
63
|
+
preference :smtp_user_name, :string
|
|
64
|
+
preference :smtp_password, :string
|
|
65
|
+
preference :smtp_from_email, :string
|
|
66
|
+
preference :blog_from_email, :string
|
|
67
|
+
|
|
68
|
+
#--- PayPal
|
|
69
|
+
preference :paypal_merchant_id, :string
|
|
70
|
+
preference :paypal_cert_id, :string
|
|
71
|
+
|
|
72
|
+
#--- Sofort payment system sofort.com
|
|
73
|
+
preference :sofort_user_id, :string
|
|
74
|
+
preference :sofort_project_id, :string
|
|
75
|
+
preference :sofort_project_password, :string
|
|
76
|
+
preference :sofort_notification_password, :string
|
|
77
|
+
|
|
78
|
+
#--- Subscritpion Payments
|
|
79
|
+
preference :subscription_processor, :string
|
|
80
|
+
preference :default_currency, :string
|
|
81
|
+
preference :subscription_bcc_email, :string
|
|
82
|
+
|
|
83
|
+
#--- Newsletter
|
|
84
|
+
preference :nms_use_mailchimp, :boolean, :default => false
|
|
85
|
+
preference :nms_api_key, :string
|
|
86
|
+
preference :nms_lists_synced_on, :datetime
|
|
87
|
+
|
|
88
|
+
#--- status values (no UI)
|
|
89
|
+
preference :follower_notifications_sent_at, :datetime # when last follower notifications were sent
|
|
90
|
+
|
|
91
|
+
#--- Media libary preferences
|
|
92
|
+
preference :image_thumbnail_width, :integer, default: 200
|
|
93
|
+
preference :image_small_width, :integer, default: 300
|
|
94
|
+
preference :image_medium_width, :integer, default: 600
|
|
95
|
+
preference :image_large_width, :integer, default: 900
|
|
96
|
+
|
|
97
|
+
#--- eager load all preferences when an object is found
|
|
98
|
+
after_find :preferences
|
|
99
|
+
after_find :set_default_values
|
|
100
|
+
|
|
101
|
+
# Find the account using the specified host (usually from the request url).
|
|
102
|
+
# Check for certain special subdomains before lookup:
|
|
103
|
+
# dev, www, backoffice, staging, stg-
|
|
104
|
+
# Supports xip.io format for testing on local network
|
|
105
|
+
# dev.testapp.net.192.168.1.5.xip.io
|
|
106
|
+
# is a valid address. See http://xip.io for more info
|
|
107
|
+
#------------------------------------------------------------------------------
|
|
108
|
+
def self.find_account(host)
|
|
109
|
+
host ||= ""
|
|
110
|
+
separated = host.downcase.split('.')
|
|
111
|
+
separated = separated[0..-7] if host.end_with?('xip.io') # strip off xip.io and ip address
|
|
112
|
+
separated = separated.delete_if { |x| x == 'dev' || x == 'www' || x == 'backoffice' || x =~ /stg-/ || x == 'staging' }
|
|
113
|
+
self.find_by_domain(separated.join('.')) or raise Account::DomainNotFound.new("Invalid domain: #{host}")
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
# Since we need the current account for the default scope in models, we need
|
|
117
|
+
# this information easily available at the model level.
|
|
118
|
+
# This is thread safe, as opposed to using a simple cattr_accessor.
|
|
119
|
+
# But we must ensure the that thread info is nulled out after every request
|
|
120
|
+
# using an around_filter
|
|
121
|
+
#------------------------------------------------------------------------------
|
|
122
|
+
def self.current=(account)
|
|
123
|
+
Thread.current[:account] = account
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
def self.current
|
|
127
|
+
Thread.current[:account]
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
# Set the current account by looking up the account prefix. To be used when
|
|
131
|
+
# operating outside a request, such as from the console
|
|
132
|
+
#------------------------------------------------------------------------------
|
|
133
|
+
def self.current_by_prefix(account_prefix)
|
|
134
|
+
Account.current = Account.find_by_account_prefix(account_prefix)
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
# Once an account is found, setup the default url_ values.
|
|
138
|
+
#------------------------------------------------------------------------------
|
|
139
|
+
def set_default_values
|
|
140
|
+
set_url_parts(self.ssl_enabled? ? 'https://' : 'http://', self.domain)
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
# set the protocol and host for the account's url. During request processing,
|
|
144
|
+
# this is usually called with the request.protocol and request.host_with_port
|
|
145
|
+
#------------------------------------------------------------------------------
|
|
146
|
+
def set_url_parts(protocol, host)
|
|
147
|
+
self.url_protocol = protocol
|
|
148
|
+
self.url_host = host
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
#------------------------------------------------------------------------------
|
|
152
|
+
def url_base
|
|
153
|
+
self.url_protocol + self.url_host
|
|
154
|
+
end
|
|
155
|
+
|
|
156
|
+
#------------------------------------------------------------------------------
|
|
157
|
+
def create_default_roles
|
|
158
|
+
Role.unscoped.create!(name: 'admin', account_id: self.id)
|
|
159
|
+
Role.unscoped.create!(name: 'beta', account_id: self.id)
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
#------------------------------------------------------------------------------
|
|
163
|
+
def site_enabled?
|
|
164
|
+
preferred_site_enabled?
|
|
165
|
+
end
|
|
166
|
+
|
|
167
|
+
#------------------------------------------------------------------------------
|
|
168
|
+
def site_maintenance?
|
|
169
|
+
preferred_site_maintenance?
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
#------------------------------------------------------------------------------
|
|
173
|
+
def ssl_enabled?
|
|
174
|
+
preferred_ssl_enabled?
|
|
175
|
+
end
|
|
176
|
+
|
|
177
|
+
# check the local is a supported locale. If not, return site default
|
|
178
|
+
#------------------------------------------------------------------------------
|
|
179
|
+
def verify_locale(locale)
|
|
180
|
+
(site_locales.include? locale.to_s) ? locale : preferred_default_locale
|
|
181
|
+
end
|
|
182
|
+
|
|
183
|
+
# Reutrn an array of locales used for the site. Split on commas and whitespace
|
|
184
|
+
#------------------------------------------------------------------------------
|
|
185
|
+
def site_locales
|
|
186
|
+
preferred_locales.split(/,\s*/)
|
|
187
|
+
end
|
|
188
|
+
|
|
189
|
+
# take the root path and use the default locale
|
|
190
|
+
#------------------------------------------------------------------------------
|
|
191
|
+
def index_path
|
|
192
|
+
"/#{preferred_default_locale}/index"
|
|
193
|
+
end
|
|
194
|
+
|
|
195
|
+
#------------------------------------------------------------------------------
|
|
196
|
+
def smtp_settings
|
|
197
|
+
{
|
|
198
|
+
:address => preferred_smtp_address,
|
|
199
|
+
:port => preferred_smtp_port,
|
|
200
|
+
:domain => preferred_smtp_domain,
|
|
201
|
+
:user_name => preferred_smtp_user_name,
|
|
202
|
+
:password => preferred_smtp_password
|
|
203
|
+
}
|
|
204
|
+
end
|
|
205
|
+
|
|
206
|
+
# Return the current theme's data structure.
|
|
207
|
+
# parent: true will give the parent theme's data
|
|
208
|
+
# if no data exists, return an empty hash
|
|
209
|
+
#------------------------------------------------------------------------------
|
|
210
|
+
def theme_data(options = {})
|
|
211
|
+
if options[:parent]
|
|
212
|
+
ThemesForRails.config.themes_data(parent_theme) || {}
|
|
213
|
+
else
|
|
214
|
+
ThemesForRails.config.themes_data(current_theme) || {}
|
|
215
|
+
end
|
|
216
|
+
end
|
|
217
|
+
|
|
218
|
+
# Get the value of the specific theme option.
|
|
219
|
+
#------------------------------------------------------------------------------
|
|
220
|
+
def theme_option(option_name)
|
|
221
|
+
theme_data(parent: true).merge(theme_data)[option_name.to_s]
|
|
222
|
+
end
|
|
223
|
+
|
|
224
|
+
# get the account's theme filesystem path
|
|
225
|
+
#------------------------------------------------------------------------------
|
|
226
|
+
def theme_path
|
|
227
|
+
"#{ThemesForRails.config.themes_path}/#{current_theme}"
|
|
228
|
+
end
|
|
229
|
+
|
|
230
|
+
# Get the name of the current theme - which is simply the account prefix
|
|
231
|
+
#------------------------------------------------------------------------------
|
|
232
|
+
def current_theme
|
|
233
|
+
account_prefix
|
|
234
|
+
end
|
|
235
|
+
|
|
236
|
+
# Get the name of the parent theme
|
|
237
|
+
#------------------------------------------------------------------------------
|
|
238
|
+
def parent_theme
|
|
239
|
+
ThemesForRails.config.parent_theme(current_theme)
|
|
240
|
+
end
|
|
241
|
+
end
|