Commit a8821f12 authored by Greg Gard's avatar Greg Gard

boostrap/js: turning off turbolinks/rails-ujs; fixing bootstrap viewport

parent 26a1c35f
......@@ -22,7 +22,7 @@ gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.2'
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
gem 'turbolinks', '~> 5'
#gem 'turbolinks', '~> 5'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.5'
# Use Redis adapter to run Action Cable in production
......@@ -43,7 +43,9 @@ gem 'bootsnap', '>= 1.1.0', require: false
# emt gems
#
# bootstrap 3 sass - https://github.com/twbs/bootstrap-sass
# also brings in jquery_-ujs
gem 'jquery-rails'
# gem 'sass-rails', '>= 3.2' # already included above
gem 'bootstrap-sass', '~> 3.3.7'
......
......@@ -193,9 +193,6 @@ GEM
thor (0.20.0)
thread_safe (0.3.6)
tilt (2.0.8)
turbolinks (5.1.1)
turbolinks-source (~> 5.1)
turbolinks-source (5.1.0)
tzinfo (1.2.5)
thread_safe (~> 0.1)
uglifier (4.1.10)
......@@ -233,7 +230,6 @@ DEPENDENCIES
spring
spring-watcher-listen (~> 2.0.0)
sqlite3
turbolinks (~> 5)
tzinfo-data
uglifier (>= 1.3.0)
web-console (>= 3.3.0)
......
......@@ -10,7 +10,14 @@
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
// about supported directives.
//
//= require rails-ujs
// ***********************************
// turning off turbolinks and rails-flavored ujs
//
// # require turbolinks
// # require rails-ujs -- new with 5.1 dropped jquery dependency
//
//= require jquery
//= require jquery_ujs
//= require bootstrap
//= require activestorage
//= require turbolinks
//= require_tree .
......@@ -88,6 +88,10 @@
margin: 0;
}
}
.save_button {
min-width: 50px;
}
}
&-page-notifications {
......
......@@ -5,6 +5,7 @@ class FacilitiesController < ApplicationController
def index
@facilities = Facility.kept.order(:name).page params[:page]
# json.array! @products, partial: 'products/product', as: :product
end
def new
......@@ -39,15 +40,35 @@ class FacilitiesController < ApplicationController
def update
@facility.update! resource_params
redirect_to facilities_path, notice: "Facility updated"
rescue *user_errors => e
render :edit
rescue => e
log_stack_error e
stack_error_message(:now)
render :edit
# json = Jbuilder.new
# json.extract! @facility, :id, :name, :description, :created_at, :updated_at
# json.status :ok
# json.location "/facilities/3/edit" #, format: :json)
#
json = {
status: 'ok',
location: facilities_path,
notice: "hi"
}
logger.debug "**********************:#{json.inspect}"
render json: json.to_json
#flash[:notice] = "Good job!"
#render js: "window.location = #{facilities_path.to_json}"
#render :edit, status: :created, location: @facility
# rescue *user_errors => e
# render :edit
#
# rescue => e
# log_stack_error e
# stack_error_message(:now)
# render :edit
end
# TODO: undiscard
......
......@@ -51,7 +51,6 @@ module ApplicationHelper
return if messages.empty?
%Q[<div class='emt-page-notifications'>
<h5>Notifications:</h5>
<ul>#{messages.map{|m| tag.li m}.join}</ul>
</div>].html_safe
end
......@@ -68,7 +67,7 @@ module ApplicationHelper
end
def emt_form_button(resource)
submit_tag "Save", class: 'emt-btn emt-brand'
submit_tag "Save", class: 'emt-btn emt-brand save_button', data: 'disable'
end
def emt_delete_button(resource)
......
<ul id='tabs' class='nav nav-tabs'>
<li><a href='#form' data-toggle='tab'>Form</a></li>
<li><a href='#test' data-toggle='tab'>Test</a></li>
</ul>
<div class='tab-content'>
<div id='form' class='tab-pane active'>
<%= form_with model: facility, class: 'emt-facilities-form emt-form' do |f| %>
<%= emt_form_errors(facility) %>
......@@ -13,4 +21,13 @@
<%= emt_form_button(facility) %>
<%= emt_delete_button(facility) %>
<% end %>
</div>
<div id='test' class='tab-pane'>
Foo
</div>
</div>
<!DOCTYPE html>
<html>
<html lang='en'>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<title><%= EMT::APP_NAME %></title>
<%= csrf_meta_tags %>
<%= csp_meta_tag %>
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
<%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
<%= stylesheet_link_tag 'application', media: 'all' %>
<%= javascript_include_tag 'application' %>
</head>
<body>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment