-
Notifications
You must be signed in to change notification settings - Fork 0
/
applayout1.sh
executable file
·133 lines (102 loc) · 4.51 KB
/
applayout1.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
#!/usr/bin/env bash
echo ~----------~----------Startingd $HOSTNAME, pwd: `pwd`, dlr0: "$0", bashsource0: "${BASH_SOURCE[0]}", $(date +"%Y-%m-%d_%H.%M.%S")
### create new application.html.erb layout with disabled turbolinks .. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# comment out line with BBB .. sed -i '/![^#]/ s/\(^.*BBB.*$\)/#\ \1/' file
# noworky.. sed -i '/![^#]/ s/\(^.*turbolinks.*$\)/#\ \1/' Gemfile
sed -i -e '/turbolinks/ s/^#*/#/' Gemfile
file1='application.js'
cp -a app/assets/javascripts/$file1 backup/$file1$(date +"__%Y.%m.%d_%H.%M.%S").bak.txt
# delete line containing..
sed -i '/turbolinks/d' app/assets/javascripts/$file1
# originally...
# <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
# <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
# now using the heredoc below this stanza...
file2='application.html.erb'
cp -a app/views/layouts/$file2 backup/$file2$(date +"__%Y.%m.%d_%H.%M.%S").bak.txt
#remove turbolinks reference from $file2
patrn=", 'data-turbolinks-track' => true"
sed -i "s/$patrn/ /" app/views/layouts/$file2
file2='application.html.erb'
cp -a app/assets/javascripts/$file1 backup/$file1$(date +"__%Y.%m.%d_%H.%M.%S").bak.txt
#
cat << 'HEREDOC' > app/views/layouts/$file2
<!DOCTYPE html >
<html>
<head>
<meta charset="utf-8">
<meta content="IE=edge" http-equiv="X-UA-Compatible">
<meta content="width=device-width, initial-scale=1" name="viewport">
<title><%= Rails.application.class.parent_name %></title>
<%= stylesheet_link_tag 'application', media: 'all' %>
<%= javascript_include_tag 'application' %>
<%= csrf_meta_tags %>
</meta>
</meta>
</meta>
</head>
<body class="<%= controller.controller_name %>">
<nav class="navbar navbar-inverse navbar-static-top" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<button aria-controls="navbar" aria-expanded="false" class="navbar-toggle collapsed" data-target="#navbar" data-toggle="collapse" type="button">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<%= link_to 'Home', root_path, class: 'navbar-brand' %>
</div>
<div class="collapse navbar-collapse" id="navbar">
<ul class="nav navbar-nav">
<li>
<!-- <%# = link_to 'Products', products_path %> -->
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<%# views/devise/menu/_login_items.html.erb %>
<% if user_signed_in? %>
<li>
<%= link_to "Administer", rails_admin.dashboard_path, :class => "btn btn-secondary " %>
</li>
<li>
<%= link_to('Logout', destroy_user_session_path, :method => :delete) %>
</li>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#"><%= current_user.email %>,<%= current_user.name %>
<span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="#">This item to be used later</a></li>
<li> <%#= link_to 'Users', users_path %> </li>
<li> <%= link_to "Edit profile", edit_user_registration_path %> </li>
<li><%= link_to('Logout', destroy_user_session_path, :method => :delete) %></li>
</ul>
</li>
<% else %>
<li>
<%= link_to('Login', new_user_session_path) %>
</li>
<% end %>
</ul>
</div>
</div>
</nav>
<div class="container-fluid">
<% flash.each do |type, msg| %>
<div class="alert alert-<%= type == 'alert' ? 'danger' : 'success' %> alert-dismissable" role="alert">
<a href="#" class="close" data-dismiss="alert" aria-label="close"> × × </a>
<%= msg if msg.is_a?(String) %>
</div>
<% end %>
<%= yield %>
</div>
</body>
</html>
HEREDOC
### ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Copy files over..
path1='config/locales/en.yml'
cp -a $sfil2/$path1 $path1
### ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sleep 1
git add -A # Add all files and commit them
git commit -m "app layout with disabled turbolinks"