diff --git a/.gitignore b/.gitignore index 6189d65..dd122f5 100644 --- a/.gitignore +++ b/.gitignore @@ -8,9 +8,16 @@ # Ignore all logfiles, tempfiles, public assets, /log/*.log /tmp -public/system/* -public/assets/* + +# Ignore public subdirectories public/apidocs/* +public/assets/* +public/fonts/* +public/images/* +public/javascripts/* +public/stylesheets/* +public/system/* +public/videos/* # Ignore branded content app/views/branded/* @@ -42,6 +49,7 @@ config/initializers/recaptcha.rb config/initializers/devise.rb config/initializers/wicked_pdf.rb +config/initializers/fingerprint.rb # Ignore enviroments settings #config/environments/development.rb @@ -67,6 +75,7 @@ config/locale/*/app.edit.po config/locale/*/app.po.time_stamp -# ignore front-end dependencies -vendor/package-lock.json -vendor/node_modules +# Front-end related +lib/assets/node_modules +lib/assets/npm-debug.log +!.keep diff --git a/.travis.yml b/.travis.yml index 0beeb02..aae912b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,7 +4,7 @@ before_install: - curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash - && sudo apt-get install -y nodejs before_script: - - cd vendor && npm install && cd - + - cd lib/assets && npm install && npm run bundle && cd - - cp config/database_example.yml config/database.yml - cp config/secrets_example.yml config/secrets.yml - cp config/branding_example.yml config/branding.yml diff --git a/Gemfile b/Gemfile index f131cc1..2c1c8c1 100644 --- a/Gemfile +++ b/Gemfile @@ -56,9 +56,6 @@ # ------------------------------------------------ # VIEWS -gem 'sass-rails', '~> 5.0.6' -gem 'less-rails', '~> 2.8.0' # WE SHOULD PROBABLY USE SASS OR LESS NOT BOTH -gem 'font-awesome-rails', '~> 4.7.0' gem 'contact_us', '~> 1.2.0' # COULD BE EASILY REPLACED WITH OUR OWN CODE gem 'recaptcha', '~> 4.1.0' gem 'dragonfly', '~> 1.0.12' # LOGO UPLOAD @@ -75,7 +72,6 @@ # ------------------------------------------------ # INTERNATIONALIZATION -gem "i18n-js", ">= 3.0.0.rc11" #damodar added TODO: explain gem 'gettext_i18n_rails', '~> 1.8' gem "gettext_i18n_rails_js", "~> 1.2.0" gem 'gettext', '>=3.0.2', :require => false, :group => :development @@ -114,10 +110,6 @@ #gem 'flamegraph' end -group :production do - gem 'uglifier', '~> 3.0.2' # JS minifier -end - # ------------------------------------------------ # GEMS THAT ARE NO LONGER IN USE # diff --git a/Gemfile.lock b/Gemfile.lock index 3eea93f..0b1f7b0 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -84,7 +84,6 @@ rack-test (>= 0.5.4) xpath (~> 2.0) coderay (1.1.1) - commonjs (0.2.7) concurrent-ruby (1.0.2) contact_us (1.2.0) rails (>= 4.2.0) @@ -122,8 +121,6 @@ loofah (~> 2.0) sax-machine (~> 1.0) flag_shih_tzu (0.3.15) - font-awesome-rails (4.7.0.1) - railties (>= 3.2, < 5.1) formtastic (3.1.4) actionpack (>= 3.2.13) friendly_id (5.1.0) @@ -147,8 +144,6 @@ nokogiri rubyzip (>= 1.0) i18n (0.7.0) - i18n-js (3.0.0.rc14) - i18n (~> 0.6, >= 0.6.6) jbuilder (2.6.0) activesupport (>= 3.0.0, < 5.1) multi_json (~> 1.2) @@ -172,13 +167,6 @@ kaminari-core (1.0.1) ledermann-rails-settings (2.4.2) activerecord (>= 3.1) - less (2.6.0) - commonjs (~> 0.2.7) - less-rails (2.8.0) - actionpack (>= 4.0) - less (~> 2.6.0) - sprockets (> 2, < 4) - tilt libv8 (3.16.14.15) locale (2.1.2) loofah (2.0.3) @@ -322,8 +310,6 @@ tilt (2.0.5) tzinfo (1.2.2) thread_safe (~> 0.1) - uglifier (3.0.2) - execjs (>= 0.3.0, < 3) warden (1.2.6) rack (>= 1.0) web-console (2.3.0) @@ -355,17 +341,14 @@ dragonfly (~> 1.0.12) feedjira (~> 2.0.0) flag_shih_tzu (~> 0.3) - font-awesome-rails (~> 4.7.0) formtastic (~> 3.1.4) friendly_id (~> 5.1.0) gettext (>= 3.0.2) gettext_i18n_rails (~> 1.8) gettext_i18n_rails_js (~> 1.2.0) htmltoword (~> 0.5.1) - i18n-js (>= 3.0.0.rc11) jbuilder (~> 2.6.0) ledermann-rails-settings (~> 2.4.2) - less-rails (~> 2.8.0) libv8 (~> 3.16) minitest-rails-capybara (~> 2.1.2) minitest-reporters (~> 1.1.11) @@ -384,13 +367,11 @@ redcarpet (>= 3.3.4) responders (~> 2.0) rolify (~> 5.1.0) - sass-rails (~> 5.0.6) simplecov (~> 0.12) sqlite3 (~> 1.3.12) swagger-docs (>= 0.2.9) therubyracer (>= 0.11.4) thin (~> 1.7) - uglifier (~> 3.0.2) web-console (~> 2.3.0) webmock (~> 2.1.0) wicked_pdf (~> 1.1.0) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 80eb17a..8c8ca84 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -15,11 +15,6 @@ end # --------------------------------------------------------------------------- - def javascript(*files) - content_for(:head) { javascript_include_tag(*files) } - end - - # --------------------------------------------------------------------------- def hash_to_js_json_variable(obj_name, hash) "".html_safe end @@ -31,4 +26,7 @@ return request.fullpath() == path end + def fingerprinted_asset(name) + Rails.env.production? ? "#{name}-#{ASSET_FINGERPRINT}" : name + end end diff --git a/app/views/devise/passwords/new.html.erb b/app/views/devise/passwords/new.html.erb index b6718cc..ef24836 100644 --- a/app/views/devise/passwords/new.html.erb +++ b/app/views/devise/passwords/new.html.erb @@ -1,5 +1,3 @@ -<% javascript "views/devise/passwords/new.js" %> -
<% unless @user.errors[:email].empty? %> diff --git a/app/views/devise/registrations/edit.html.erb b/app/views/devise/registrations/edit.html.erb index 8d301df..219bee5 100644 --- a/app/views/devise/registrations/edit.html.erb +++ b/app/views/devise/registrations/edit.html.erb @@ -1,4 +1,3 @@ -<% javascript "views/devise/registrations/edit.js" %>

<%= _('Edit profile') %>

diff --git a/app/views/guidance_groups/admin_edit.html.erb b/app/views/guidance_groups/admin_edit.html.erb index c3f2604..9b9d7b4 100644 --- a/app/views/guidance_groups/admin_edit.html.erb +++ b/app/views/guidance_groups/admin_edit.html.erb @@ -1,5 +1,3 @@ -<% javascript 'admin.js' %> -

<%= _('Guidance group') %>

diff --git a/app/views/guidance_groups/admin_new.html.erb b/app/views/guidance_groups/admin_new.html.erb index 721ed63..7b625fd 100644 --- a/app/views/guidance_groups/admin_new.html.erb +++ b/app/views/guidance_groups/admin_new.html.erb @@ -1,5 +1,3 @@ -<% javascript 'admin.js' %> -

<%= _('Guidance group') %>

diff --git a/app/views/guidances/admin_index.html.erb b/app/views/guidances/admin_index.html.erb index 32fb87b..3f1ae3b 100644 --- a/app/views/guidances/admin_index.html.erb +++ b/app/views/guidances/admin_index.html.erb @@ -1,5 +1,3 @@ -<% javascript "admin.js" %> -

<%= _('Guidance') %>

diff --git a/app/views/guidances/admin_new.html.erb b/app/views/guidances/admin_new.html.erb index 42240e7..9a97d4c 100644 --- a/app/views/guidances/admin_new.html.erb +++ b/app/views/guidances/admin_new.html.erb @@ -1,6 +1,3 @@ - -<% javascript 'views/guidances/admin_edit.js' %> -

<%= _('New guidance') %>

diff --git a/app/views/home/index.html.erb b/app/views/home/index.html.erb index d66a5a5..bce2ad2 100644 --- a/app/views/home/index.html.erb +++ b/app/views/home/index.html.erb @@ -1,4 +1,3 @@ -<%= javascript 'views/home/index.js' %>

<%= _('Welcome.')%>

@@ -11,16 +10,16 @@

<%= _('Screencast on how to use %{application_name}') % {:application_name => Rails.configuration.branding[:application][:name]} %>

-