From c97a47ffdaa6d3f31084b879979f16b01203e724 Mon Sep 17 00:00:00 2001 From: Ari Timonen Date: Wed, 18 Mar 2020 21:11:10 +0200 Subject: [PATCH] Fix tinymce Update docs Update dockerfile, fix js issue, cleanup env files --- DEVELOPMENT.md | 2 ++ Dockerfile | 1 + Gemfile | 1 + Gemfile.lock | 3 ++ INSTALL.md | 32 ++++++++++++-------- app/assets/javascripts/application.js.coffee | 1 - app/assets/javascripts/misc.js.coffee | 2 +- app/views/articles/_form.html.erb | 2 +- app/views/javascripts/_mce_full.html.erb | 17 ++--------- config/application.rb | 3 ++ config/environments/development.rb | 6 ++-- config/tinymce.yml | 23 ++++++++++++++ 12 files changed, 58 insertions(+), 35 deletions(-) create mode 100644 config/tinymce.yml diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index 01e52c6..d6e554d 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -1,5 +1,7 @@ # Development +Install instructions in INSTALL.md + This is just random tips for development. Not a full documentation. # Handy commands diff --git a/Dockerfile b/Dockerfile index faa6fb1..f9bc3d6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,6 +13,7 @@ RUN apt-get update && apt-get -y upgrade \ libxslt1-dev libxml2-dev \ imagemagick libmagickwand-dev \ nodejs \ + phantomjs \ firefox-esr # Separate Gemfile ADD so that `bundle install` can be cached more effectively diff --git a/Gemfile b/Gemfile index b97468b..9cab76e 100644 --- a/Gemfile +++ b/Gemfile @@ -113,5 +113,6 @@ group :test do end group :development, :test do + gem 'pry-rails' gem 'pry-byebug', '~> 1.3.2' end diff --git a/Gemfile.lock b/Gemfile.lock index d479133..c320b78 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -294,6 +294,8 @@ GEM pry-byebug (1.3.3) byebug (~> 2.7) pry (~> 0.10) + pry-rails (0.3.9) + pry (>= 0.10.4) public_suffix (4.0.3) puma (4.3.3) nio4r (~> 2.0) @@ -469,6 +471,7 @@ DEPENDENCIES phantomjs poltergeist pry-byebug (~> 1.3.2) + pry-rails public_suffix puma rails (~> 6.0.2.1) diff --git a/INSTALL.md b/INSTALL.md index f3a3c5f..c4fc082 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -1,16 +1,8 @@ -# Production Install (Ubuntu LTS) +# Install (Ubuntu LTS) ENSL Website is fairly easy to run. -## 1. Install reverse proxy - -Install apache, nginx etc. reverse proxy. It will take requests from the users and pass them to ENSL website. Sample configuration availble @ ext/nginx. - -https://www.nginx.com/resources/wiki/start/ - - sudo apt-get install nginx - -## 2. Install docker and docker-compose +## 1. Install docker and docker-compose https://docs.docker.com/install/ https://docs.docker.com/compose/install/ @@ -20,9 +12,13 @@ Install docker + docker-compose: wget -O - 'https://get.docker.com/'|bash sudo curl -L https://github.com/docker/compose/releases/download/1.18.0/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose -## 3. Install git +## 2. Install git -## 4. Download ENSL website and install it +https://git-scm.com/book/en/v2/Getting-Started-Installing-Git + + sudo apt-get install nginx + +## 3. Download ENSL website and install it Now create the required directories, e.g. `/srv/ensl.org` @@ -38,4 +34,14 @@ If the database does not exist, it will be created with settings from .env file Finally, Start the docker containers. docker-compose build - docker-compose --rm up \ No newline at end of file + docker-compose --rm up + +## 4. Install reverse proxy + +Install apache, nginx etc. reverse proxy. It will take requests from the users and pass them to ENSL website. Sample configuration availble @ ext/nginx. + +https://www.nginx.com/resources/wiki/start/ + + sudo apt-get install nginx + +*Skip this step if you are only doing development.* diff --git a/app/assets/javascripts/application.js.coffee b/app/assets/javascripts/application.js.coffee index 8cb6a1b..23550bd 100644 --- a/app/assets/javascripts/application.js.coffee +++ b/app/assets/javascripts/application.js.coffee @@ -3,7 +3,6 @@ //= require jquery.periodicalupdater //= require jquery.jplayer.min //= require flowplayer -//= require tinymce-jquery //= require yetii //= require local //= require shoutbox diff --git a/app/assets/javascripts/misc.js.coffee b/app/assets/javascripts/misc.js.coffee index 3a861c0..fb7f44e 100644 --- a/app/assets/javascripts/misc.js.coffee +++ b/app/assets/javascripts/misc.js.coffee @@ -17,7 +17,7 @@ $ -> $select.trigger 'DOMSubtreeModified' - $('a[href=#form_submit]').click -> + $('a[href=\\#form_submit]').click -> $(this).closest('form').submit() return false diff --git a/app/views/articles/_form.html.erb b/app/views/articles/_form.html.erb index 1e5078b..362cd39 100644 --- a/app/views/articles/_form.html.erb +++ b/app/views/articles/_form.html.erb @@ -27,7 +27,7 @@

Content

- <%= f.text_area :text, :rows => 30, :cols => 80 %> + <%= f.text_area :text, :class => "tinymce", :rows => 30, :cols => 80 %>
<%= f.submit %> diff --git a/app/views/javascripts/_mce_full.html.erb b/app/views/javascripts/_mce_full.html.erb index 7b80d58..4fa6488 100644 --- a/app/views/javascripts/_mce_full.html.erb +++ b/app/views/javascripts/_mce_full.html.erb @@ -1,15 +1,2 @@ - +<%= tinymce_assets %> +<%= tinymce :articles, :content_css => asset_path('application.scss') %> diff --git a/config/application.rb b/config/application.rb index f7ee99b..36ff9ca 100644 --- a/config/application.rb +++ b/config/application.rb @@ -44,5 +44,8 @@ module Ensl # Version of your assets, change this if you want to expire all your assets config.assets.version = '1.0' + + # Tiny mce + config.tinymce.install = :copy end end diff --git a/config/environments/development.rb b/config/environments/development.rb index 493594f..27551e3 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -35,10 +35,8 @@ Ensl::Application.configure do # config.threadsafe! config.eager_load = false - config.web_console.whitelisted_ips = '172.18.0.0/16' + config.web_console.whitelisted_ips = '172.0.0.0/8' config.web_console.whiny_requests = true - config.eager_load = false - - config.assets.debug = true + config.serve_static_assets = true end diff --git a/config/tinymce.yml b/config/tinymce.yml new file mode 100644 index 0000000..82127ca --- /dev/null +++ b/config/tinymce.yml @@ -0,0 +1,23 @@ +default: &default + toolbar: + - styleselect | bold italic | undo redo + - image | link + plugins: + - image + - link + +articles: + <<: *default +# mode: "textareas", + #theme: "modern" + plugins: + - inlinepopups + - contextmenu + - nonbreaking + - template +# theme_advanced_buttons1: "bold,italic,blockquote,|,bullist,numlist,|,formatselect,|,link,unlink,image,|,cleanup,code", +# theme_advanced_buttons2: "", +# theme_advanced_buttons3: "", +# theme_advanced_buttons4: "", + convert_urls: false, +# content_css: '<%= asset_path "application.css" \ No newline at end of file