rails8_db 0.0.12 → 0.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/app/javascript/rails_db/application.js +32 -44
 - data/app/views/layouts/rails_db/application.html.erb +18 -1
 - data/lib/rails_db/engine.rb +20 -37
 - data/lib/rails_db/version.rb +1 -1
 - data/test/dummy/log/test.log +2990 -0
 - metadata +1 -1
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 3795fec896fc97941c5cdadbad40c7a12b81471a41503ac58faab7351bdc4278
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 8c29d0fd0c72718d2b7768dff111f462330303c1350b03bbf2f89eb602969858
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 462c34d659e7b04ebc37df4bf2dfde3a023cf98752a9bfa9fd6e4d12eea3d662483351cd0f12e3ab6acc5fc554b75596bb79b84a02f9285b29a7043290f55739
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 80dfe544a5634004b4e5bc343d5ca6845c299f6f3590c7dc586e32da7131d7d8b41e63c63eb2fa71de51eb48a6fd7d4ce1b55b738eaf2d14102a612136fd9679
         
     | 
| 
         @@ -1,18 +1,31 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            // Import all required JavaScript files
         
     | 
| 
       2 
     | 
    
         
            -
            import "../codemirror/codemirror.js"
         
     | 
| 
       3 
     | 
    
         
            -
            import "../codemirror/modes/sql.js"
         
     | 
| 
       4 
     | 
    
         
            -
            import "../codemirror/addons/hint/show-hint.js"
         
     | 
| 
       5 
     | 
    
         
            -
            import "../codemirror/addons/hint/sql-hint.js"
         
     | 
| 
       6 
     | 
    
         
            -
            import "./jquery.js"
         
     | 
| 
       7 
     | 
    
         
            -
            import "./jquery.cookie.js"
         
     | 
| 
       8 
     | 
    
         
            -
            import "./foundation.min.js"
         
     | 
| 
       9 
     | 
    
         
            -
            import "./rails-ujs.js"
         
     | 
| 
       10 
     | 
    
         
            -
            import "./search.js"
         
     | 
| 
       11 
     | 
    
         
            -
            import "./show_hide_columns.js"
         
     | 
| 
       12 
     | 
    
         
            -
            import "./sticky.js"
         
     | 
| 
       13 
1 
     | 
    
         | 
| 
       14 
     | 
    
         
            -
             
     | 
| 
       15 
     | 
    
         
            -
             
     | 
| 
      
 2 
     | 
    
         
            +
            $(function(){
         
     | 
| 
      
 3 
     | 
    
         
            +
              $(document).foundation();
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
              jQuery.expr[":"].icontains = jQuery.expr.createPseudo(function (arg) {
         
     | 
| 
      
 6 
     | 
    
         
            +
                return function (elem) {
         
     | 
| 
      
 7 
     | 
    
         
            +
                  return jQuery(elem).text().toUpperCase().indexOf(arg.toUpperCase()) >= 0;
         
     | 
| 
      
 8 
     | 
    
         
            +
                };
         
     | 
| 
      
 9 
     | 
    
         
            +
              });
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
              $('body').on('change', '.per_page_pagination_select', function() {
         
     | 
| 
      
 12 
     | 
    
         
            +
                $(this).parents('form').submit();
         
     | 
| 
      
 13 
     | 
    
         
            +
              });
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
              $('body').on('keyup', '#rails_db_tables_input', function() {
         
     | 
| 
      
 16 
     | 
    
         
            +
                value = $(this).val();
         
     | 
| 
      
 17 
     | 
    
         
            +
                $("#rails_db_tables a").show();
         
     | 
| 
      
 18 
     | 
    
         
            +
                $("#rails_db_tables a:not(:icontains('" + value + "'))").hide();
         
     | 
| 
      
 19 
     | 
    
         
            +
              });
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
              $('body').on('click', '.expand, .collapse', function() {
         
     | 
| 
      
 22 
     | 
    
         
            +
                expand_collapse();
         
     | 
| 
      
 23 
     | 
    
         
            +
                save_expand_collapse();
         
     | 
| 
      
 24 
     | 
    
         
            +
                return false;
         
     | 
| 
      
 25 
     | 
    
         
            +
              });
         
     | 
| 
      
 26 
     | 
    
         
            +
            });
         
     | 
| 
      
 27 
     | 
    
         
            +
             
     | 
| 
      
 28 
     | 
    
         
            +
            function expand_collapse() {
         
     | 
| 
       16 
29 
     | 
    
         
             
              $('#main_content').toggleClass('push-3')
         
     | 
| 
       17 
30 
     | 
    
         
             
              $('#main_content').toggleClass('large-9')
         
     | 
| 
       18 
31 
     | 
    
         
             
              $('#main_content').toggleClass('large-12')
         
     | 
| 
         @@ -21,12 +34,13 @@ window.expand_collapse = function() { 
     | 
|
| 
       21 
34 
     | 
    
         
             
              $('.expand').toggle();
         
     | 
| 
       22 
35 
     | 
    
         
             
            };
         
     | 
| 
       23 
36 
     | 
    
         | 
| 
       24 
     | 
    
         
            -
             
     | 
| 
      
 37 
     | 
    
         
            +
            function save_expand_collapse() {
         
     | 
| 
       25 
38 
     | 
    
         
             
              $.removeCookie('sidebar_hidden');
         
     | 
| 
       26 
39 
     | 
    
         
             
              $.cookie('sidebar_hidden', !$('.expand').is(':visible'), { expires: 30, path: '/' });
         
     | 
| 
       27 
40 
     | 
    
         
             
            };
         
     | 
| 
       28 
41 
     | 
    
         | 
| 
       29 
     | 
    
         
            -
             
     | 
| 
      
 42 
     | 
    
         
            +
            // https://github.com/codemirror/CodeMirror/blob/master/mode/sql/index.html
         
     | 
| 
      
 43 
     | 
    
         
            +
            function init_sql_editor(mime, tables) {
         
     | 
| 
       30 
44 
     | 
    
         
             
              var editor = CodeMirror.fromTextArea($('#sql').get(0), {
         
     | 
| 
       31 
45 
     | 
    
         
             
                  mime: mime,
         
     | 
| 
       32 
46 
     | 
    
         
             
                  hint: CodeMirror.hint.sql,
         
     | 
| 
         @@ -54,37 +68,11 @@ window.init_sql_editor = function(mime, tables) { 
     | 
|
| 
       54 
68 
     | 
    
         
             
              editor.focus();
         
     | 
| 
       55 
69 
     | 
    
         
             
            };
         
     | 
| 
       56 
70 
     | 
    
         | 
| 
       57 
     | 
    
         
            -
             
     | 
| 
      
 71 
     | 
    
         
            +
            function set_browser_url(url) {
         
     | 
| 
       58 
72 
     | 
    
         
             
              if (typeof (history.pushState) != "undefined") {
         
     | 
| 
       59 
73 
     | 
    
         
             
                window.history.pushState({"path": url}, '', url);
         
     | 
| 
       60 
74 
     | 
    
         
             
              }
         
     | 
| 
       61 
     | 
    
         
            -
            } 
     | 
| 
       62 
     | 
    
         
            -
             
     | 
| 
       63 
     | 
    
         
            -
            $(function(){
         
     | 
| 
       64 
     | 
    
         
            -
              $(document).foundation();
         
     | 
| 
       65 
     | 
    
         
            -
             
     | 
| 
       66 
     | 
    
         
            -
              jQuery.expr[":"].icontains = jQuery.expr.createPseudo(function (arg) {
         
     | 
| 
       67 
     | 
    
         
            -
                return function (elem) {
         
     | 
| 
       68 
     | 
    
         
            -
                  return jQuery(elem).text().toUpperCase().indexOf(arg.toUpperCase()) >= 0;
         
     | 
| 
       69 
     | 
    
         
            -
                };
         
     | 
| 
       70 
     | 
    
         
            -
              });
         
     | 
| 
       71 
     | 
    
         
            -
             
     | 
| 
       72 
     | 
    
         
            -
              $('body').on('change', '.per_page_pagination_select', function() {
         
     | 
| 
       73 
     | 
    
         
            -
                $(this).parents('form').submit();
         
     | 
| 
       74 
     | 
    
         
            -
              });
         
     | 
| 
       75 
     | 
    
         
            -
             
     | 
| 
       76 
     | 
    
         
            -
              $('body').on('keyup', '#rails_db_tables_input', function() {
         
     | 
| 
       77 
     | 
    
         
            -
                value = $(this).val();
         
     | 
| 
       78 
     | 
    
         
            -
                $("#rails_db_tables a").show();
         
     | 
| 
       79 
     | 
    
         
            -
                $("#rails_db_tables a:not(:icontains('" + value + "'))").hide();
         
     | 
| 
       80 
     | 
    
         
            -
              });
         
     | 
| 
       81 
     | 
    
         
            -
             
     | 
| 
       82 
     | 
    
         
            -
              $('body').on('click', '.expand, .collapse', function() {
         
     | 
| 
       83 
     | 
    
         
            -
                expand_collapse();
         
     | 
| 
       84 
     | 
    
         
            -
                save_expand_collapse();
         
     | 
| 
       85 
     | 
    
         
            -
                return false;
         
     | 
| 
       86 
     | 
    
         
            -
              });
         
     | 
| 
       87 
     | 
    
         
            -
            });
         
     | 
| 
      
 75 
     | 
    
         
            +
            }
         
     | 
| 
       88 
76 
     | 
    
         | 
| 
       89 
77 
     | 
    
         
             
            $(window).bind('popstate', function(event) {
         
     | 
| 
       90 
78 
     | 
    
         
             
              if (typeof (history.pushState) != "undefined") {
         
     | 
| 
         @@ -4,7 +4,24 @@ 
     | 
|
| 
       4 
4 
     | 
    
         
             
              <title><%= [yield(:title), 'Rails DB'].reject(&:blank?).join(' - ') %></title>
         
     | 
| 
       5 
5 
     | 
    
         
             
              <%= stylesheet_link_tag "https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.5.0/css/font-awesome.min.css" %>
         
     | 
| 
       6 
6 
     | 
    
         
             
              <%= stylesheet_link_tag "rails_db/application" %>
         
     | 
| 
       7 
     | 
    
         
            -
              <%= javascript_include_tag "rails_db/application" 
     | 
| 
      
 7 
     | 
    
         
            +
              <%= javascript_include_tag "rails_db/application" %>
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
              <% unless ENV["RAILS_ENV"] == "test" %>
         
     | 
| 
      
 10 
     | 
    
         
            +
                <%= javascript_include_tag(
         
     | 
| 
      
 11 
     | 
    
         
            +
                      "codemirror/codemirror.js",
         
     | 
| 
      
 12 
     | 
    
         
            +
                      "codemirror/modes/sql.js",
         
     | 
| 
      
 13 
     | 
    
         
            +
                      "codemirror/addons/hint/show-hint.js",
         
     | 
| 
      
 14 
     | 
    
         
            +
                      "codemirror/addons/hint/sql-hint.js",
         
     | 
| 
      
 15 
     | 
    
         
            +
                      "rails_db/jquery.js",
         
     | 
| 
      
 16 
     | 
    
         
            +
                      "rails_db/jquery.cookie.js",
         
     | 
| 
      
 17 
     | 
    
         
            +
                      "rails_db/rails-ujs.js",
         
     | 
| 
      
 18 
     | 
    
         
            +
                      "rails_db/foundation.min.js",
         
     | 
| 
      
 19 
     | 
    
         
            +
                      "rails_db/sticky.js",
         
     | 
| 
      
 20 
     | 
    
         
            +
                      "rails_db/show_hide_columns.js",
         
     | 
| 
      
 21 
     | 
    
         
            +
                      "rails_db/search.js"
         
     | 
| 
      
 22 
     | 
    
         
            +
                    ) %>
         
     | 
| 
      
 23 
     | 
    
         
            +
                <%= javascript_include_tag "rails_db/application" %>
         
     | 
| 
      
 24 
     | 
    
         
            +
              <% end %>
         
     | 
| 
       8 
25 
     | 
    
         | 
| 
       9 
26 
     | 
    
         
             
              <%= csrf_meta_tags %>
         
     | 
| 
       10 
27 
     | 
    
         | 
    
        data/lib/rails_db/engine.rb
    CHANGED
    
    | 
         @@ -1,49 +1,32 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            module RailsDb
         
     | 
| 
       2 
2 
     | 
    
         
             
              class Engine < ::Rails::Engine
         
     | 
| 
       3 
3 
     | 
    
         
             
                isolate_namespace RailsDb
         
     | 
| 
       4 
     | 
    
         
            -
                config.autoload_paths += Dir["#{config.root}/lib"]
         
     | 
| 
      
 4 
     | 
    
         
            +
                config.autoload_paths += Dir["#{config.root}/lib"] # For Ruby code, keep this
         
     | 
| 
       5 
5 
     | 
    
         | 
| 
       6 
     | 
    
         
            -
                initializer  
     | 
| 
       7 
     | 
    
         
            -
                   
     | 
| 
       8 
     | 
    
         
            -
             
     | 
| 
       9 
     | 
    
         
            -
             
     | 
| 
       10 
     | 
    
         
            -
             
     | 
| 
       11 
     | 
    
         
            -
             
     | 
| 
       12 
     | 
    
         
            -
                # Configure assets for Propshaft
         
     | 
| 
       13 
     | 
    
         
            -
                initializer 'rails_db.assets.precompile' do |app|
         
     | 
| 
       14 
     | 
    
         
            -
                  # Add the app/javascript directory to the asset paths
         
     | 
| 
       15 
     | 
    
         
            -
                  app.config.assets.paths << root.join('app', 'javascript')
         
     | 
| 
       16 
     | 
    
         
            -
                  
         
     | 
| 
       17 
     | 
    
         
            -
                  # Configure Propshaft to handle JavaScript modules
         
     | 
| 
       18 
     | 
    
         
            -
                  if app.config.respond_to?(:assets) && app.config.assets.respond_to?(:js_compressor)
         
     | 
| 
       19 
     | 
    
         
            -
                    app.config.assets.js_compressor = nil if app.config.assets.js_compressor == :uglifier
         
     | 
| 
       20 
     | 
    
         
            -
                  end
         
     | 
| 
      
 6 
     | 
    
         
            +
                initializer "rails_db.assets" do |app|
         
     | 
| 
      
 7 
     | 
    
         
            +
                  # Check if the host app uses config.assets.paths (like Propshaft)
         
     | 
| 
      
 8 
     | 
    
         
            +
                  if app.config.respond_to?(:assets) && app.config.assets.respond_to?(:paths)
         
     | 
| 
      
 9 
     | 
    
         
            +
                    # Add the engine's app/javascript directory to the host app's asset paths
         
     | 
| 
      
 10 
     | 
    
         
            +
                    # 'config.root' here refers to the engine's root directory
         
     | 
| 
      
 11 
     | 
    
         
            +
                    app.config.assets.paths << config.root.join("app/javascript")
         
     | 
| 
       21 
12 
     | 
    
         | 
| 
       22 
     | 
    
         
            -
             
     | 
| 
       23 
     | 
    
         
            -
             
     | 
| 
       24 
     | 
    
         
            -
                     
     | 
| 
       25 
     | 
    
         
            -
                     
     | 
| 
       26 
     | 
    
         
            -
                    rails_db/jquery.cookie.js
         
     | 
| 
       27 
     | 
    
         
            -
                    rails_db/foundation.min.js
         
     | 
| 
       28 
     | 
    
         
            -
                    rails_db/rails-ujs.js
         
     | 
| 
       29 
     | 
    
         
            -
                    rails_db/search.js
         
     | 
| 
       30 
     | 
    
         
            -
                    rails_db/show_hide_columns.js
         
     | 
| 
       31 
     | 
    
         
            -
                    rails_db/sticky.js
         
     | 
| 
       32 
     | 
    
         
            -
                    codemirror/codemirror.js
         
     | 
| 
       33 
     | 
    
         
            -
                    codemirror/modes/sql.js
         
     | 
| 
       34 
     | 
    
         
            -
                    codemirror/addons/hint/show-hint.js
         
     | 
| 
       35 
     | 
    
         
            -
                    codemirror/addons/hint/sql-hint.js
         
     | 
| 
       36 
     | 
    
         
            -
                  )
         
     | 
| 
      
 13 
     | 
    
         
            +
                    # Optional: You might also explicitly add app/assets if needed,
         
     | 
| 
      
 14 
     | 
    
         
            +
                    # although Rails usually adds app/assets/** from engines automatically.
         
     | 
| 
      
 15 
     | 
    
         
            +
                    # Explicitly adding might help in some edge cases or ensure precedence.
         
     | 
| 
      
 16 
     | 
    
         
            +
                    # app.config.assets.paths << config.root.join("app/assets")
         
     | 
| 
       37 
17 
     | 
    
         | 
| 
       38 
     | 
    
         
            -
             
     | 
| 
       39 
     | 
    
         
            -
                   
     | 
| 
       40 
     | 
    
         
            -
                     
     | 
| 
      
 18 
     | 
    
         
            +
                    # Rails.logger.debug "[RailsDb Engine] Added #{config.root.join('app/javascript')} to asset paths"
         
     | 
| 
      
 19 
     | 
    
         
            +
                  else
         
     | 
| 
      
 20 
     | 
    
         
            +
                    # Log a warning if the expected configuration isn't found
         
     | 
| 
      
 21 
     | 
    
         
            +
                    Rails.logger.warn "[RailsDb Engine] Host application's config.assets.paths not found. Cannot automatically add engine's app/javascript path."
         
     | 
| 
       41 
22 
     | 
    
         
             
                  end
         
     | 
| 
      
 23 
     | 
    
         
            +
                end
         
     | 
| 
       42 
24 
     | 
    
         | 
| 
       43 
     | 
    
         
            -
             
     | 
| 
       44 
     | 
    
         
            -
                   
     | 
| 
       45 
     | 
    
         
            -
                     
     | 
| 
      
 25 
     | 
    
         
            +
                initializer 'rails_db.helpers' do
         
     | 
| 
      
 26 
     | 
    
         
            +
                  ActiveSupport.on_load :action_view do
         
     | 
| 
      
 27 
     | 
    
         
            +
                    include RailsDb::Helpers
         
     | 
| 
       46 
28 
     | 
    
         
             
                  end
         
     | 
| 
       47 
29 
     | 
    
         
             
                end
         
     | 
| 
      
 30 
     | 
    
         
            +
             
     | 
| 
       48 
31 
     | 
    
         
             
              end
         
     | 
| 
       49 
32 
     | 
    
         
             
            end
         
     | 
    
        data/lib/rails_db/version.rb
    CHANGED