From e47e83cf6bded3d1924b4d500193e7876833ef83 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Sun, 2 Jul 2017 13:03:43 -0400 Subject: Created admin panel Currently allows you to create and edit blogs, including associated records. Uses a WYSIWYG editor that allows uploading images. Also included jQuery :( --- config/initializers/assets.rb | 3 ++- config/initializers/ckeditor.rb | 58 +++++++++++++++++++++++++++++++++++++++++ config/routes.rb | 14 +++++----- 3 files changed, 67 insertions(+), 8 deletions(-) create mode 100644 config/initializers/ckeditor.rb (limited to 'config') diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb index 361538d..adbe234 100644 --- a/config/initializers/assets.rb +++ b/config/initializers/assets.rb @@ -12,4 +12,5 @@ Rails.application.config.assets.paths << Rails.root.join('node_modules') # application.js, application.css, and all non-JS/CSS in the app/assets # folder are already added. # Rails.application.config.assets.precompile += %w( admin.js admin.css ) -Rails.application.config.assets.precompile += %w( main userdata ) +Rails.application.config.assets.precompile += %w( ckeditor/* ) +Rails.application.config.assets.precompile += %w( main userdata admin ) diff --git a/config/initializers/ckeditor.rb b/config/initializers/ckeditor.rb new file mode 100644 index 0000000..8f80a43 --- /dev/null +++ b/config/initializers/ckeditor.rb @@ -0,0 +1,58 @@ +# Use this hook to configure ckeditor +Ckeditor.setup do |config| + # ==> ORM configuration + # Load and configure the ORM. Supports :active_record (default), :mongo_mapper and + # :mongoid (bson_ext recommended) by default. Other ORMs may be + # available as additional gems. + require 'ckeditor/orm/active_record' + + # Allowed image file types for upload. + # Set to nil or [] (empty array) for all file types + # By default: %w(jpg jpeg png gif tiff) + # config.image_file_types = %w(jpg jpeg png gif tiff) + + # Allowed flash file types for upload. + # Set to nil or [] (empty array) for all file types + # By default: %w(jpg jpeg png gif tiff) + # config.flash_file_types = %w(swf) + + # Allowed attachment file types for upload. + # Set to nil or [] (empty array) for all file types + # By default: %w(doc docx xls odt ods pdf rar zip tar tar.gz swf) + # config.attachment_file_types = %w(doc docx xls odt ods pdf rar zip tar tar.gz swf) + + # Setup authorization to be run as a before filter + # By default: there is no authorization. + # config.authorize_with :cancan + + # Override parent controller CKEditor inherits from + # By default: 'ApplicationController' + # config.parent_controller = 'MyController' + + # Asset model classes + # config.picture_model { Ckeditor::Picture } + # config.attachment_file_model { Ckeditor::AttachmentFile } + + # Paginate assets + # By default: 24 + # config.default_per_page = 24 + + # Customize ckeditor assets path + # By default: nil + # config.asset_path = 'http://www.example.com/assets/ckeditor/' + + # To reduce the asset precompilation time, you can limit plugins and/or languages to those you need: + # By default: nil (no limit) + # config.assets_languages = ['en', 'uk'] + # config.assets_plugins = ['image', 'smiley'] + + # CKEditor CDN + # More info here http://cdn.ckeditor.com/ + # By default: nil (CDN disabled) + # config.cdn_url = '//cdn.ckeditor.com/4.7.1/standard/ckeditor.js' + + # JS config url + # Used when CKEditor CDN enabled + # By default: "ckeditor/config.js" + # config.js_config_url = 'ckeditor/config.js' +end diff --git a/config/routes.rb b/config/routes.rb index e409840..449cda1 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,14 +1,14 @@ Rails.application.routes.draw do + namespace :admin do + get '/', to: 'dashboard#index' + + resources :blogs, except: [:show] + end + + mount Ckeditor::Engine => '/ckeditor' devise_for :users, controllers: { sessions: 'users/sessions' } root "records#index" get 'says/:slug', to: 'entries#show' - get 'says/:slug/edit', to: 'entries#edit' - put 'says/:slug', to: 'entries#update' - patch 'says/:slug', to: 'entries#update' - - # get ':directory/:slug', to: 'entries#show', constraints: lambda { |request| - # Entry::DIRECTORIES.include? request.path_parameters['directory'] - # } end -- cgit 1.4.1