Sha256: 6e9cd22428b585ce920bd3c91e07910efe532be4a645775dcb38bdc971636b6d

Contents?: true

Size: 1.28 KB

Versions: 2

Compression:

Stored size: 1.28 KB

Contents

require 'glimmer-dsl-libui'

require_relative '../model/rails_command'

module RailsGui
  module View
    class MainWindow
      include Glimmer::LibUI::Application
      
      before_body do
        @rails_command = Model::RailsCommand.instance
      end
      
      body {
        menu('Routes') {
          menu_item('Refresh') {
            on_clicked do
              @rails_routes_table.model_array = @rails_command.refresh_routes
            end
          }
          quit_menu_item
        }
        
        window('Rails GUI', 1024, 640) {
          margined true
          
          vertical_box {
            @rails_routes_table = refined_table(
              model_array: @rails_command.routes,
              table_columns: {
                'Prefix'  => :text,
                'Verb' => :text,
                'URI Pattern' => :text,
                'Controller#Action'  => :text,
                'Format' => :text,
              },
              per_page: 1_000_000_000, # do not paginate
            )
            
            button('Refresh Rails Routes') {
              stretchy false
              
              on_clicked do
                @rails_routes_table.model_array = @rails_command.refresh_routes
              end
            }
          }
        }
      }
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rails-gui-0.0.3 app/rails_gui/view/main_window.rb
rails-gui-0.0.2 app/rails_gui/view/main_window.rb