rails_development_tools 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +31 -0
- data/Rakefile +36 -0
- data/app/assets/config/rails_development_tools_manifest.js +1 -0
- data/app/assets/javascripts/rails_development_tools/application.js +14 -0
- data/app/assets/javascripts/rails_development_tools/rails_development_tools.js +75 -0
- data/app/assets/javascripts/rails_development_tools/rails_development_tools_status.js +34 -0
- data/app/assets/stylesheets/rails_development_tools/application.css +15 -0
- data/app/controllers/rails_development_tools/application_controller.rb +5 -0
- data/app/helpers/rails_development_tools/application_helper.rb +12 -0
- data/app/models/rails_development_tools/screen.rb +23 -0
- data/app/views/layouts/rails_development_tools/application.html.erb +14 -0
- data/app/views/rails_development_tools/_message.html.erb +59 -0
- data/app/views/rails_development_tools/_panel.html.erb +156 -0
- data/app/views/rails_development_tools/_partials_info.html.erb +3 -0
- data/app/views/rails_development_tools/_routing_info.html.erb +15 -0
- data/config/routes.rb +2 -0
- data/lib/rails_development_tools.rb +61 -0
- data/lib/rails_development_tools/engine.rb +5 -0
- data/lib/rails_development_tools/version.rb +3 -0
- metadata +78 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: afb13043df6fb9251dd9c63837c49babf96d9822eefbcf16f7eaf11de8312acd
|
4
|
+
data.tar.gz: 60493b75d19a21594cc49c751fa303814490aa0cbb879d23bc9733dc8c430ed5
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 29e3fbcb5d1e7b88ebc9dc68c3c04a16db84fa085882fada1d98f887a98a94509001f9c8017237f2be37b13d4fb7b7ab0e1b59223ee4699591953f75d1d37c60
|
7
|
+
data.tar.gz: b53cde0549deead1487a93e2485f320d5ab638174abf16fa3fa3cd961e9b5ee0908ad4168003a4e2cda64fe4e0ac437a9f25df196dc2801eff4551413da02dbb
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2018 michele.lavezzi@gmail.com
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
# RailsDevelopmentTools
|
2
|
+
This gem is .
|
3
|
+
|
4
|
+
## Usage
|
5
|
+
The gem has 3 main feature: routing info, partials info and messages.
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
Add this line to your application's Gemfile:
|
9
|
+
|
10
|
+
```ruby
|
11
|
+
gem 'rails_development_tools'
|
12
|
+
```
|
13
|
+
|
14
|
+
And then execute:
|
15
|
+
```bash
|
16
|
+
$ bundle
|
17
|
+
```
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
```bash
|
21
|
+
$ gem install rails_development_tools
|
22
|
+
```
|
23
|
+
Add 'helper RailsDevelopmentTools::ApplicationHelper' and 'include RailsDevelopmentTools' into the 'ApplicationController' of your application.
|
24
|
+
|
25
|
+
In the 'application.html.erb' add '<%= rails_development_tools_panel %>'. This is where the main panel is shown. This partial include the javascripts.
|
26
|
+
|
27
|
+
## Contributing
|
28
|
+
Contribution directions go here.
|
29
|
+
|
30
|
+
## License
|
31
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
begin
|
2
|
+
require 'bundler/setup'
|
3
|
+
rescue LoadError
|
4
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
5
|
+
end
|
6
|
+
|
7
|
+
require 'rdoc/task'
|
8
|
+
|
9
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
10
|
+
rdoc.rdoc_dir = 'rdoc'
|
11
|
+
rdoc.title = 'RailsDevelopmentTools'
|
12
|
+
rdoc.options << '--line-numbers'
|
13
|
+
rdoc.rdoc_files.include('README.md')
|
14
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
15
|
+
end
|
16
|
+
|
17
|
+
APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
|
18
|
+
load 'rails/tasks/engine.rake'
|
19
|
+
|
20
|
+
|
21
|
+
load 'rails/tasks/statistics.rake'
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
require 'bundler/gem_tasks'
|
26
|
+
|
27
|
+
require 'rake/testtask'
|
28
|
+
|
29
|
+
Rake::TestTask.new(:test) do |t|
|
30
|
+
t.libs << 'test'
|
31
|
+
t.pattern = 'test/**/*_test.rb'
|
32
|
+
t.verbose = false
|
33
|
+
end
|
34
|
+
|
35
|
+
|
36
|
+
task default: :test
|
@@ -0,0 +1 @@
|
|
1
|
+
//= link_directory ../stylesheets/rails_development_tools .css
|
@@ -0,0 +1,14 @@
|
|
1
|
+
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
2
|
+
// listed below.
|
3
|
+
//
|
4
|
+
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
5
|
+
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
|
6
|
+
//
|
7
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
8
|
+
// the compiled file.
|
9
|
+
//
|
10
|
+
// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
|
11
|
+
// GO AFTER THE REQUIRES BELOW.
|
12
|
+
//
|
13
|
+
//= require rails_development_tools/rails_development_tools
|
14
|
+
//= require rails_development_tools/rails_development_tools_status
|
@@ -0,0 +1,75 @@
|
|
1
|
+
(function ($) {
|
2
|
+
|
3
|
+
|
4
|
+
var $container = $("<div/>")
|
5
|
+
$container.css('position','fixed');
|
6
|
+
|
7
|
+
$container.attr('id','partials-container');
|
8
|
+
|
9
|
+
var $title = $("<div/>").html('Partial views');
|
10
|
+
|
11
|
+
$title.attr('id','title');
|
12
|
+
|
13
|
+
$container.append($title);
|
14
|
+
|
15
|
+
var partials = [];
|
16
|
+
|
17
|
+
$(".development-tools-partials-info").each(function( index ) {
|
18
|
+
|
19
|
+
partial = $(this).attr('title');
|
20
|
+
if (partials.includes(partial)){
|
21
|
+
$(this).remove();
|
22
|
+
return true;
|
23
|
+
}
|
24
|
+
|
25
|
+
partials.push(partial);
|
26
|
+
|
27
|
+
$(this).prepend(partials.length + ')');
|
28
|
+
|
29
|
+
var $singlePartial = $("<div/>").html($(this).html() );
|
30
|
+
var y_offset = 50 + partials.length * 30;
|
31
|
+
|
32
|
+
$singlePartial.addClass('single-partial');
|
33
|
+
$singlePartial.css('top', y_offset + 'px');
|
34
|
+
$singlePartial.attr('id', 'partial-name-' + partials.length);
|
35
|
+
|
36
|
+
$singlePartial.mouseenter(function() {
|
37
|
+
$(this).addClass('single-selected');
|
38
|
+
|
39
|
+
var partial_number_selector = '#' + $(this).attr('id').replace('name','number');
|
40
|
+
$(partial_number_selector).addClass('single-selected');
|
41
|
+
});
|
42
|
+
|
43
|
+
$singlePartial.mouseleave(function() {
|
44
|
+
$(this).removeClass('single-selected');
|
45
|
+
|
46
|
+
var partial_number_selector = '#' + $(this).attr('id').replace('name','number');
|
47
|
+
$(partial_number_selector).removeClass('single-selected');
|
48
|
+
});
|
49
|
+
|
50
|
+
$container.append( $singlePartial );
|
51
|
+
$('body').prepend( $container );
|
52
|
+
|
53
|
+
var $circle = $("<div/>").html(partials.length);
|
54
|
+
|
55
|
+
$circle.attr('id', 'partial-number-' + partials.length);
|
56
|
+
$circle.addClass('single-circle');
|
57
|
+
|
58
|
+
$circle.mouseenter(function() {
|
59
|
+
$(this).addClass('single-selected');
|
60
|
+
|
61
|
+
var partial_name_selector = '#' + $(this).attr('id').replace('number','name');
|
62
|
+
$(partial_name_selector).addClass('single-selected');
|
63
|
+
});
|
64
|
+
|
65
|
+
$circle.mouseleave(function() {
|
66
|
+
$(this).removeClass('single-selected');
|
67
|
+
|
68
|
+
var partial_name_selector = '#' + $(this).attr('id').replace('number','name');
|
69
|
+
$(partial_name_selector).removeClass('single-selected');
|
70
|
+
});
|
71
|
+
|
72
|
+
$(this).html($circle);
|
73
|
+
});
|
74
|
+
|
75
|
+
})(jQuery);
|
@@ -0,0 +1,34 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
var rawCookies = '';
|
4
|
+
|
5
|
+
function set_development_tools_status(partials_checkbox, routing_checkbox) {
|
6
|
+
var partials_value = partials_checkbox ? '1':'0';
|
7
|
+
var routing_value = routing_checkbox ? '1':'0';
|
8
|
+
|
9
|
+
rawCookies.set('development_tools', partials_value + routing_value, {expires: 10 * 365, path: '/'});
|
10
|
+
|
11
|
+
location.reload();
|
12
|
+
}
|
13
|
+
|
14
|
+
function update_ui() {
|
15
|
+
var cookie_value = rawCookies.get('development_tools');
|
16
|
+
var cookie_bits = cookie_value.split("");
|
17
|
+
|
18
|
+
|
19
|
+
$('.development-tools-panel #partials_checkbox').prop('checked', cookie_bits[0] == '1');
|
20
|
+
$('.development-tools-panel #routing_checkbox').prop('checked', cookie_bits[1] == '1');
|
21
|
+
}
|
22
|
+
|
23
|
+
|
24
|
+
$(function () {
|
25
|
+
rawCookies = Cookies.withConverter(function (value) {
|
26
|
+
return value;
|
27
|
+
});
|
28
|
+
|
29
|
+
update_ui();
|
30
|
+
|
31
|
+
$('.development-tools-panel input').change(function () {
|
32
|
+
set_development_tools_status($('.development-tools-panel #partials_checkbox').is(':checked'), $('.development-tools-panel #routing_checkbox').is(':checked'));
|
33
|
+
});
|
34
|
+
});
|
@@ -0,0 +1,15 @@
|
|
1
|
+
/*
|
2
|
+
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
3
|
+
* listed below.
|
4
|
+
*
|
5
|
+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
6
|
+
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
|
7
|
+
*
|
8
|
+
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
9
|
+
* compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
|
10
|
+
* files in this directory. Styles in this file should be added after the last require_* statement.
|
11
|
+
* It is generally better to create a new file per style scope.
|
12
|
+
*
|
13
|
+
*= require_tree .
|
14
|
+
*= require_self
|
15
|
+
*/
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'singleton'
|
2
|
+
|
3
|
+
module RailsDevelopmentTools
|
4
|
+
class Screen
|
5
|
+
include Singleton
|
6
|
+
|
7
|
+
singleton_class.send(:alias_method, :logger, :instance)
|
8
|
+
|
9
|
+
@@message =[]
|
10
|
+
|
11
|
+
def clear
|
12
|
+
@@message.clear
|
13
|
+
end
|
14
|
+
|
15
|
+
def write(message)
|
16
|
+
@@message << message
|
17
|
+
end
|
18
|
+
|
19
|
+
def messages
|
20
|
+
@@message
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>Development tools</title>
|
5
|
+
<%= stylesheet_link_tag "rails_development_tools/application", media: "all" %>
|
6
|
+
<%= javascript_include_tag "rails_development_tools/application" %>
|
7
|
+
<%= csrf_meta_tags %>
|
8
|
+
</head>
|
9
|
+
<body>
|
10
|
+
|
11
|
+
<%= yield %>
|
12
|
+
|
13
|
+
</body>
|
14
|
+
</html>
|
@@ -0,0 +1,59 @@
|
|
1
|
+
<% messages = RailsDevelopmentTools::Screen.logger.messages %>
|
2
|
+
|
3
|
+
<% if messages.any? %>
|
4
|
+
<div id="development-tools-title">Messaggi Debug</div>
|
5
|
+
<% messages.each_with_index do |message, i| %>
|
6
|
+
<% css_class = i.odd? ? 'odd' :'' %>
|
7
|
+
|
8
|
+
<div class='message <%= css_class %>'>
|
9
|
+
<div class='single' title='<%=message %>'>
|
10
|
+
<b><%=i+1 %>.</b> <%= truncate message.squish, :length => 60, :separator => /\w/, :omission => "..." %>
|
11
|
+
</div>
|
12
|
+
</div>
|
13
|
+
<% end %>
|
14
|
+
|
15
|
+
<style>
|
16
|
+
div.development-tools-message{
|
17
|
+
overflow-y: auto;
|
18
|
+
max-height: 70%;
|
19
|
+
}
|
20
|
+
|
21
|
+
div.development-tools-message #development-tools-title {
|
22
|
+
background-color: #333;
|
23
|
+
color:white;
|
24
|
+
border-top-left-radius: 10px;
|
25
|
+
width: 100%;
|
26
|
+
text-align: center;
|
27
|
+
padding: 4px 0;
|
28
|
+
border-bottom: 1px solid #ccc;
|
29
|
+
}
|
30
|
+
|
31
|
+
div.development-tools-message .single {
|
32
|
+
padding-left: 7px;
|
33
|
+
padding-top: 3px;
|
34
|
+
padding-bottom: 3px;
|
35
|
+
font-size: 14px;
|
36
|
+
margin-left: 15px;
|
37
|
+
text-indent: -5px;
|
38
|
+
}
|
39
|
+
|
40
|
+
div.development-tools-message .message.odd {
|
41
|
+
background-color: #fff5f1;
|
42
|
+
}
|
43
|
+
|
44
|
+
div.development-tools-message {
|
45
|
+
position: fixed;
|
46
|
+
left: 100%;
|
47
|
+
top: 100%;
|
48
|
+
width: 250px;
|
49
|
+
border-top-left-radius: 10px;
|
50
|
+
padding-bottom: 5px;
|
51
|
+
transform: translate(-100%, -100%);
|
52
|
+
z-index: 999;
|
53
|
+
background-color: rgba(255, 255, 255, 100);
|
54
|
+
border: 1px solid #333;
|
55
|
+
border-bottom: 0;
|
56
|
+
border-right: 1px solid #ccc;
|
57
|
+
}
|
58
|
+
</style>
|
59
|
+
<% end %>
|
@@ -0,0 +1,156 @@
|
|
1
|
+
<div class="development-tools"></div>
|
2
|
+
<div class="development-tools-message"></div>
|
3
|
+
<div class="development-tools-panel">
|
4
|
+
<div>Development Tools</div>
|
5
|
+
<div><label for="partials_checkbox">Partials</label>
|
6
|
+
<input id="partials_checkbox" type="checkbox">
|
7
|
+
<input id="routing_checkbox" type="checkbox">
|
8
|
+
<label for="routing_checkbox">Routing</label>
|
9
|
+
</div>
|
10
|
+
</div>
|
11
|
+
|
12
|
+
<% content_for :js do %>
|
13
|
+
<%= javascript_include_tag 'rails_development_tools/rails_development_tools_status' %>
|
14
|
+
<%= javascript_include_tag 'rails_development_tools/rails_development_tools' %>
|
15
|
+
|
16
|
+
<% end %>
|
17
|
+
|
18
|
+
<!-- style for panel -->
|
19
|
+
<style>
|
20
|
+
.development-tools-panel {
|
21
|
+
position: fixed;
|
22
|
+
left: 50%;
|
23
|
+
transform: translateX(-50%);
|
24
|
+
z-index: 999;
|
25
|
+
border: 1px solid #333;
|
26
|
+
border-top: 0;
|
27
|
+
border-bottom-left-radius: 10px;
|
28
|
+
border-bottom-right-radius: 10px;
|
29
|
+
background-color: white;
|
30
|
+
box-shadow: 5px 5px 10px #888;
|
31
|
+
}
|
32
|
+
|
33
|
+
.development-tools-panel div {
|
34
|
+
padding: 5px 10px;
|
35
|
+
}
|
36
|
+
|
37
|
+
.development-tools-panel div:first-child {
|
38
|
+
color: white;
|
39
|
+
background-color: #333;
|
40
|
+
text-align: center;
|
41
|
+
}
|
42
|
+
</style>
|
43
|
+
|
44
|
+
<!-- style for routing info -->
|
45
|
+
<style>
|
46
|
+
div.development-tools table {
|
47
|
+
margin: 5px;
|
48
|
+
}
|
49
|
+
|
50
|
+
div.development-tools #title {
|
51
|
+
background-color: #333;
|
52
|
+
color: white;
|
53
|
+
padding: 4px 0;
|
54
|
+
text-align: center;
|
55
|
+
}
|
56
|
+
|
57
|
+
div.development-tools td.value {
|
58
|
+
text-align: center;
|
59
|
+
padding-left: 5px;
|
60
|
+
}
|
61
|
+
|
62
|
+
div.development-tools span.value {
|
63
|
+
font-size: 16px;
|
64
|
+
color: #333;
|
65
|
+
padding: 0 5px;
|
66
|
+
display: inline;
|
67
|
+
}
|
68
|
+
|
69
|
+
div.development-tools td.label {
|
70
|
+
text-align: right;
|
71
|
+
}
|
72
|
+
|
73
|
+
div.development-tools span.label {
|
74
|
+
background-color: #333;
|
75
|
+
color: #fff;
|
76
|
+
font-size: 12px;
|
77
|
+
padding: 0 5px;
|
78
|
+
}
|
79
|
+
|
80
|
+
div.development-tools {
|
81
|
+
position: fixed;
|
82
|
+
border-bottom-left-radius: 10px;
|
83
|
+
left: 100%;
|
84
|
+
transform: translateX(-100%);
|
85
|
+
z-index: 999;
|
86
|
+
background-color: rgba(255, 255, 255, 100);
|
87
|
+
border-left: 1px solid #333;
|
88
|
+
border-bottom: 1px solid #333;
|
89
|
+
border-right: 1px solid #ccc;
|
90
|
+
box-shadow: 5px 5px 10px #888;
|
91
|
+
}
|
92
|
+
</style>
|
93
|
+
|
94
|
+
<!-- style for partials -->
|
95
|
+
<style>
|
96
|
+
div#partials-container #title {
|
97
|
+
background-color: #333;
|
98
|
+
color: white;
|
99
|
+
|
100
|
+
border-top-right-radius: 10px;
|
101
|
+
margin-bottom: 5px;
|
102
|
+
text-align: center;
|
103
|
+
padding: 4px 0;
|
104
|
+
}
|
105
|
+
|
106
|
+
div#partials-container .single-partial {
|
107
|
+
left: 20px;
|
108
|
+
width: 100%;
|
109
|
+
text-align: left;
|
110
|
+
font-size: 12px;
|
111
|
+
padding: 3px;
|
112
|
+
padding-left: 10px;
|
113
|
+
z-index: 1000;
|
114
|
+
}
|
115
|
+
|
116
|
+
.single-partial.single-selected,
|
117
|
+
.single-circle.single-selected {
|
118
|
+
background-color: #333;
|
119
|
+
color: #fff;
|
120
|
+
}
|
121
|
+
|
122
|
+
div#partials-container {
|
123
|
+
top: 40%;
|
124
|
+
transform: translateY(-40%);
|
125
|
+
background-color: rgba(255, 255, 255, 100);
|
126
|
+
border: 1px solid #333;
|
127
|
+
|
128
|
+
border-top-right-radius: 10px;
|
129
|
+
border-bottom-right-radius: 10px;
|
130
|
+
z-index: 999;
|
131
|
+
|
132
|
+
padding-bottom: 15px;
|
133
|
+
|
134
|
+
box-shadow: 5px 5px 10px #888;
|
135
|
+
width: 190px;
|
136
|
+
|
137
|
+
line-height: 1.3em;
|
138
|
+
}
|
139
|
+
|
140
|
+
div.single-circle {
|
141
|
+
border-radius: 15px;
|
142
|
+
position: absolute;
|
143
|
+
z-index: 1000;
|
144
|
+
width: 25px;
|
145
|
+
height: 25px;
|
146
|
+
padding-top: 11px;
|
147
|
+
box-shadow: 5px 5px 10px #888;
|
148
|
+
color: #333;
|
149
|
+
text-align: center;
|
150
|
+
border: 1px solid #ccc;
|
151
|
+
background-color: white;
|
152
|
+
font-size: 16px;
|
153
|
+
font-weight: bold;
|
154
|
+
line-height: 0;
|
155
|
+
}
|
156
|
+
</style>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<div id="title">Routing info</div>
|
2
|
+
<table>
|
3
|
+
<tr>
|
4
|
+
<td class='label'><span class='label'>controller</span></td>
|
5
|
+
<td class='value'><span class='value'><%= controller_name %></span></td>
|
6
|
+
</tr>
|
7
|
+
<tr>
|
8
|
+
<td class='label'><span class='label'>action</span></td>
|
9
|
+
<td class='value'><span class='value'><%= action_name %></span></td>
|
10
|
+
</tr>
|
11
|
+
<tr>
|
12
|
+
<td class='label'><span class='label'>layout</span></td>
|
13
|
+
<td class='value'><span class='value'><%= controller.send('_layout', '') %></span></td>
|
14
|
+
</tr>
|
15
|
+
</table>
|
data/config/routes.rb
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
require "rails_development_tools/engine"
|
2
|
+
|
3
|
+
module RailsDevelopmentTools
|
4
|
+
extend ActiveSupport::Concern
|
5
|
+
|
6
|
+
if Rails.env.development?
|
7
|
+
included do
|
8
|
+
before_action :activate_development_tools
|
9
|
+
|
10
|
+
def activate_development_tools
|
11
|
+
views_path = Rails.root.join('app', 'views').to_s + '/'
|
12
|
+
|
13
|
+
cookies[:'development_tools'] = '00' unless cookies[:'development_tools']
|
14
|
+
partials_info_disabled = (cookies[:'development_tools'][0] == '0')
|
15
|
+
routing_info_disabled = (cookies[:'development_tools'][1] == '0')
|
16
|
+
|
17
|
+
Deface::Override.new(:virtual_path => 'rails_development_tools/_panel',
|
18
|
+
name: 'routing-info',
|
19
|
+
:insert_top => 'div.development-tools',
|
20
|
+
:partial => 'rails_development_tools/routing_info',
|
21
|
+
:disabled => routing_info_disabled)
|
22
|
+
|
23
|
+
Deface::Override.new(:virtual_path => 'rails_development_tools/_panel',
|
24
|
+
name: 'messages',
|
25
|
+
:insert_top => 'div.development-tools-message',
|
26
|
+
:partial => 'rails_development_tools/message',
|
27
|
+
:disabled => false)
|
28
|
+
|
29
|
+
#css_selectors = ':root > span:first-child,:root > div:first-child,:root > ul:first-child,div:first-child'
|
30
|
+
#css_selectors = 'div:first-child,span:first-child,ul:first-child,li:first-child'
|
31
|
+
css_selectors = 'div:first-child,span:first-child,ul:first-child,li:first-child'
|
32
|
+
|
33
|
+
Dir.glob(Rails.root.join('app', 'views', '**', '_*.html.erb')) do |file|
|
34
|
+
next if file == '.' or file == '..' or file.include?('rails_development_tools') or file.include?('.es.')
|
35
|
+
|
36
|
+
filename = File.path(file).sub('.it', '').sub('.html.erb', '').sub(views_path, '')
|
37
|
+
|
38
|
+
Deface::Override.new(:virtual_path => filename,
|
39
|
+
name: 'partials-info',
|
40
|
+
:insert_bottom => css_selectors,
|
41
|
+
:partial => 'rails_development_tools/partials_info',
|
42
|
+
:disabled => partials_info_disabled)
|
43
|
+
|
44
|
+
end
|
45
|
+
|
46
|
+
Dir.glob(Rails.root.join('app', 'views', '**', '**', '_*.html.erb')) do |file|
|
47
|
+
next if file == '.' or file == '..' or file.include?('rails_development_tools') or file.include?('.es.')
|
48
|
+
|
49
|
+
filename = File.path(file).sub('.it', '').sub('.html.erb', '').sub(views_path, '')
|
50
|
+
|
51
|
+
Deface::Override.new(:virtual_path => filename,
|
52
|
+
name: 'partials-info',
|
53
|
+
:insert_bottom => css_selectors,
|
54
|
+
:partial => 'rails_development_tools/partials_info',
|
55
|
+
:disabled => partials_info_disabled)
|
56
|
+
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
metadata
ADDED
@@ -0,0 +1,78 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rails_development_tools
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- michele-lavezzi
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-02-14 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rails
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 5.1.4
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 5.1.4
|
27
|
+
description: ''
|
28
|
+
email:
|
29
|
+
- michele.lavezzi@gmail.com
|
30
|
+
executables: []
|
31
|
+
extensions: []
|
32
|
+
extra_rdoc_files: []
|
33
|
+
files:
|
34
|
+
- MIT-LICENSE
|
35
|
+
- README.md
|
36
|
+
- Rakefile
|
37
|
+
- app/assets/config/rails_development_tools_manifest.js
|
38
|
+
- app/assets/javascripts/rails_development_tools/application.js
|
39
|
+
- app/assets/javascripts/rails_development_tools/rails_development_tools.js
|
40
|
+
- app/assets/javascripts/rails_development_tools/rails_development_tools_status.js
|
41
|
+
- app/assets/stylesheets/rails_development_tools/application.css
|
42
|
+
- app/controllers/rails_development_tools/application_controller.rb
|
43
|
+
- app/helpers/rails_development_tools/application_helper.rb
|
44
|
+
- app/models/rails_development_tools/screen.rb
|
45
|
+
- app/views/layouts/rails_development_tools/application.html.erb
|
46
|
+
- app/views/rails_development_tools/_message.html.erb
|
47
|
+
- app/views/rails_development_tools/_panel.html.erb
|
48
|
+
- app/views/rails_development_tools/_partials_info.html.erb
|
49
|
+
- app/views/rails_development_tools/_routing_info.html.erb
|
50
|
+
- config/routes.rb
|
51
|
+
- lib/rails_development_tools.rb
|
52
|
+
- lib/rails_development_tools/engine.rb
|
53
|
+
- lib/rails_development_tools/version.rb
|
54
|
+
homepage:
|
55
|
+
licenses:
|
56
|
+
- MIT
|
57
|
+
metadata: {}
|
58
|
+
post_install_message:
|
59
|
+
rdoc_options: []
|
60
|
+
require_paths:
|
61
|
+
- lib
|
62
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
63
|
+
requirements:
|
64
|
+
- - ">="
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: '0'
|
67
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
68
|
+
requirements:
|
69
|
+
- - ">="
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: '0'
|
72
|
+
requirements: []
|
73
|
+
rubyforge_project:
|
74
|
+
rubygems_version: 2.7.3
|
75
|
+
signing_key:
|
76
|
+
specification_version: 4
|
77
|
+
summary: Tools to speed up Rails applications development
|
78
|
+
test_files: []
|