Top Level Namespace

Defined Under Namespace

Modules: CmsUtils, Kernel, Padrino Classes: Uploader

Constant Summary collapse

TEMPLATE_FILE_PATHS =
%w( lib/cms_utils.rb 
  lib/uploader.rb
  app/views/layouts/application.erb 
  app/views/main.erb
  app/views/sitemap.erb
  app/views/sitemap.xml.erb
  app/views/contents/show.erb
  app/views/contents/index.erb
  admin/views/layouts/application.erb
  admin/controllers/images.rb
  public/stylesheets/application.css
  public/admin/stylesheets/base.css
  public/admin/javascripts
  public/admin/images
)
PADRINO_ROOT =
File.dirname(__FILE__)
SESSION_KEY_SETTING =
"set :session_id, :_padrino_cms_session_id"
APP_INIT =

Set up the session key, the cms filter and a couple of basic routes

TODO: Might be simpler to copy the whole app.rb into place.

"\n  \#{SESSION_KEY_SETTING}\n\n  before do\n    @current_account = CmsUtils.current_account(session[settings.session_id])\n    @contents = Content.where(:path => CmsUtils.default_path(request))\n  end\n\n  get \"/sitemap\", :provides => [:html, :xml] do\n    @title = \"Sitemap\"\n    @pages = Content.where(\"path LIKE '/%'\")\n    render \"sitemap\"\n  end\n  \n  # IMPORTANT That this route is the last in the app as :priority => :low does not seem to do what I expected.\n  # Maybe I just need to RTFM again.\n  #\n  get \"/*path\", :priority => :low do\n    render \"main\"\n  end\n\n"
DATE_FORMAT =

Set a default date format

"  Time::DATE_FORMATS.merge!(:default => \"%Y-%m-%d %H:%M\")\n"
LOREM_IPSUM =
"<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed mauris diam, vulputate ac vulputate non, iaculis ut dui. Aliquam consequat posuere tincidunt. Nunc tincidunt varius velit eu egestas. Ut sagittis nulla ac arcu fringilla vitae congue est tincidunt. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Vivamus id purus in eros adipiscing lacinia. Morbi sed justo dui, viverra pretium nunc. Morbi tristique leo in urna lacinia ac gravida eros tincidunt. Vivamus lobortis facilisis elit in tristique. Vivamus laoreet euismod dui quis iaculis.</p>\n<p>This is default text generated by the cms project template, you probably want to start by <a href=\"/admin/contens/edit/1\">editing this</a>.</p>\n"
DEFAULT_CONTENT =
"    Content.create(\n      :path => '/', :title => 'Lorem Ipsum',\n      :body => '\#{LOREM_IPSUM}'\n    )\n\n"
CONTENT_INDEX_ROUTE =
"      @contents = Content.all(:order => 'created_at desc')\n      render 'contents/index'\n"
CONTENT_SHOW_ROUTE =
"      @content = Content.find_by_id(params[:id])\n      render 'contents/show'\n"
CONTENT_MODEL =
"  belongs_to :account\n  validates_presence_of :path\n  validates_presence_of :title\n  validates_presence_of :body\n"
IMAGE_UPLOAD_GEMS =
"\n# Gems needed for image upload\ngem 'carrierwave'\ngem 'mini_magick'\ngem 'fog'\n\n"
HELPER_METHODS =
" include CmsUtils\n"