glib-web 0.5.5 → 0.5.12
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/controllers/concerns/glib/json/ui.rb +7 -0
 - data/app/helpers/glib/json_ui/abstract_builder.rb +9 -3
 - data/app/helpers/glib/json_ui/action_builder.rb +36 -6
 - data/app/helpers/glib/json_ui/action_builder/windows.rb +1 -0
 - data/app/helpers/glib/json_ui/page_helper.rb +13 -5
 - data/app/helpers/glib/json_ui/response_helper.rb +1 -1
 - data/app/helpers/glib/json_ui/styling_helper.rb +22 -0
 - data/app/helpers/glib/json_ui/view_builder.rb +16 -16
 - data/app/helpers/glib/json_ui/view_builder/fields.rb +7 -2
 - data/app/helpers/glib/urls_helper.rb +7 -0
 - data/app/policies/glib/application_policy.rb +27 -30
 - data/app/views/json_ui/garage/actions/index.json.jbuilder +2 -2
 - data/app/views/json_ui/garage/forms/show_hide.json.jbuilder +20 -3
 - data/app/views/json_ui/garage/forms/styled_boxes.json.jbuilder +4 -1
 - data/app/views/json_ui/garage/forms/text_validation.json.jbuilder +1 -1
 - data/app/views/json_ui/garage/pages/index.json.jbuilder +11 -0
 - data/app/views/json_ui/garage/pages/layout.json.jbuilder +12 -13
 - data/app/views/json_ui/garage/pages/nav_buttons.json.jbuilder +28 -16
 - data/app/views/json_ui/garage/pages/nested_scroll.json.jbuilder +40 -0
 - data/app/views/json_ui/garage/panels/carousel.json.jbuilder +24 -3
 - data/app/views/json_ui/garage/tables/_autoload_section.json.jbuilder +1 -2
 - data/app/views/json_ui/garage/tables/autoload_as_needed.json.jbuilder +19 -19
 - data/app/views/json_ui/garage/views/icons.json.jbuilder +22 -0
 - data/app/views/json_ui/garage/views/images.json.jbuilder +4 -4
 - data/app/views/json_ui/garage/views/index.json.jbuilder +3 -3
 - data/lib/glib/json_crawler.rb +1 -0
 - data/lib/glib/json_crawler/action_crawler.rb +4 -1
 - data/lib/glib/json_crawler/action_crawlers/action_http.rb +2 -5
 - data/lib/glib/json_crawler/action_crawlers/forms_submit.rb +2 -2
 - data/lib/glib/json_crawler/action_crawlers/nav_initiate.rb +2 -0
 - data/lib/glib/json_crawler/action_crawlers/run_multiple.rb +13 -0
 - data/lib/glib/json_crawler/action_crawlers/windows_open.rb +3 -0
 - data/lib/glib/json_crawler/router.rb +35 -29
 - data/lib/glib/test_helpers.rb +4 -4
 - metadata +5 -2
 - data/app/views/json_ui/garage/views/carousels.json.jbuilder +0 -37
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 811686b2291bc31023b9d5980a6cb54cc2a97a26
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 8f6ed8e3d277ca3c29190bcfe07d99c687c9e90c
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 79af3fc3c2d8bb48ce3913735bcaac0722a515a588cba5373c80dd41f9cdef0963fcf64f58c28c84ccd81c0fe0e158d83c4476dec7b9b9bc7703952770b8cb26
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 9738ce65f40301d15622da0617cb94795fdf90ceacb1e32066cfaa372ba7f7b1b45eb1e7b1494c6a25d2d68b43637f28cc96e46c2621aab80cbea827930e889e
         
     | 
| 
         @@ -31,6 +31,13 @@ module Glib::Json::Ui 
     | 
|
| 
       31 
31 
     | 
    
         
             
                @__json_ui_activated
         
     | 
| 
       32 
32 
     | 
    
         
             
              end
         
     | 
| 
       33 
33 
     | 
    
         | 
| 
      
 34 
     | 
    
         
            +
              def json_ui_page_lifecycle_prop(name)
         
     | 
| 
      
 35 
     | 
    
         
            +
                if (hash = json_transformation_start).is_a?(Hash) && hash['body']  # A valid page
         
     | 
| 
      
 36 
     | 
    
         
            +
                  hash[name] ||= { 'action' => 'runMultiple', 'childActions' => [] }
         
     | 
| 
      
 37 
     | 
    
         
            +
                  hash[name]['childActions']
         
     | 
| 
      
 38 
     | 
    
         
            +
                end
         
     | 
| 
      
 39 
     | 
    
         
            +
              end
         
     | 
| 
      
 40 
     | 
    
         
            +
             
     | 
| 
       34 
41 
     | 
    
         
             
              def __json_ui_start(options)
         
     | 
| 
       35 
42 
     | 
    
         
             
                @__json_ui_activated = false
         
     | 
| 
       36 
43 
     | 
    
         
             
                @__json_ui_rendering = nil
         
     | 
| 
         @@ -13,7 +13,7 @@ module Glib 
     | 
|
| 
       13 
13 
     | 
    
         
             
                      str.slice(0,1).capitalize + str.slice(1..-1)
         
     | 
| 
       14 
14 
     | 
    
         
             
                    end
         
     | 
| 
       15 
15 
     | 
    
         | 
| 
       16 
     | 
    
         
            -
                    def add_singleton_element 
     | 
| 
      
 16 
     | 
    
         
            +
                    def add_singleton_element(type, name, *args)
         
     | 
| 
       17 
17 
     | 
    
         
             
                      name_components = name.to_s.split('_')
         
     | 
| 
       18 
18 
     | 
    
         
             
                      json.set! type, "#{name_components.join('/')}" if type
         
     | 
| 
       19 
19 
     | 
    
         
             
                      args = [yield] if block_given?
         
     | 
| 
         @@ -22,7 +22,7 @@ module Glib 
     | 
|
| 
       22 
22 
     | 
    
         
             
                      "#{self.class.name}::#{name_components.map{ |str| capitalize_first_letter_and_leave_others_alone(str) }.join('::')}".constantize.new(json, @page).props(*args)
         
     | 
| 
       23 
23 
     | 
    
         
             
                    end
         
     | 
| 
       24 
24 
     | 
    
         | 
| 
       25 
     | 
    
         
            -
                    def add_element_to_array 
     | 
| 
      
 25 
     | 
    
         
            +
                    def add_element_to_array(type, name, *args)
         
     | 
| 
       26 
26 
     | 
    
         
             
                      json.child! do
         
     | 
| 
       27 
27 
     | 
    
         
             
                        add_singleton_element type, name, *args
         
     | 
| 
       28 
28 
     | 
    
         
             
                      end
         
     | 
| 
         @@ -69,6 +69,12 @@ module Glib 
     | 
|
| 
       69 
69 
     | 
    
         | 
| 
       70 
70 
     | 
    
         
             
                  private
         
     | 
| 
       71 
71 
     | 
    
         | 
| 
      
 72 
     | 
    
         
            +
                  def self.any(propName)
         
     | 
| 
      
 73 
     | 
    
         
            +
                    define_method(propName) do |value|
         
     | 
| 
      
 74 
     | 
    
         
            +
                      json.set! propName, value
         
     | 
| 
      
 75 
     | 
    
         
            +
                    end
         
     | 
| 
      
 76 
     | 
    
         
            +
                  end
         
     | 
| 
      
 77 
     | 
    
         
            +
             
     | 
| 
       72 
78 
     | 
    
         
             
                  def self.date(propName)
         
     | 
| 
       73 
79 
     | 
    
         
             
                    define_method(propName) do |value|
         
     | 
| 
       74 
80 
     | 
    
         
             
                      json.set! propName, value&.to_date
         
     | 
| 
         @@ -191,7 +197,7 @@ module Glib 
     | 
|
| 
       191 
197 
     | 
    
         
             
                      json.set!(propName) do
         
     | 
| 
       192 
198 
     | 
    
         
             
                        if name
         
     | 
| 
       193 
199 
     | 
    
         
             
                          data[:material] ||= {}
         
     | 
| 
       194 
     | 
    
         
            -
                          data[:material][:name] = name 
     | 
| 
      
 200 
     | 
    
         
            +
                          data[:material][:name] = name
         
     | 
| 
       195 
201 
     | 
    
         
             
                        end
         
     | 
| 
       196 
202 
     | 
    
         | 
| 
       197 
203 
     | 
    
         
             
                        if (material = data[:material])
         
     | 
| 
         @@ -1,8 +1,18 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            module Glib
         
     | 
| 
       2 
2 
     | 
    
         
             
              module JsonUi
         
     | 
| 
       3 
3 
     | 
    
         
             
                class ActionBuilder < AbstractBuilder
         
     | 
| 
       4 
     | 
    
         
            -
                  def  
     | 
| 
       5 
     | 
    
         
            -
                     
     | 
| 
      
 4 
     | 
    
         
            +
                  def initialize(json, page, multiple)
         
     | 
| 
      
 5 
     | 
    
         
            +
                    super(json, page)
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
                    @multiple = multiple
         
     | 
| 
      
 8 
     | 
    
         
            +
                  end
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
                  def method_missing(m, *args)
         
     | 
| 
      
 11 
     | 
    
         
            +
                    if @multiple
         
     | 
| 
      
 12 
     | 
    
         
            +
                      add_element_to_array_v1 'action', m, *args
         
     | 
| 
      
 13 
     | 
    
         
            +
                    else
         
     | 
| 
      
 14 
     | 
    
         
            +
                      add_singleton_element_v1 'action', m, *args
         
     | 
| 
      
 15 
     | 
    
         
            +
                    end
         
     | 
| 
       6 
16 
     | 
    
         
             
                  end
         
     | 
| 
       7 
17 
     | 
    
         | 
| 
       8 
18 
     | 
    
         
             
                  class Action < JsonUiElement
         
     | 
| 
         @@ -38,19 +48,31 @@ module Glib 
     | 
|
| 
       38 
48 
     | 
    
         | 
| 
       39 
49 
     | 
    
         
             
                  ### Action definitions
         
     | 
| 
       40 
50 
     | 
    
         | 
| 
      
 51 
     | 
    
         
            +
                  class RunMultiple < Action
         
     | 
| 
      
 52 
     | 
    
         
            +
                    def childActions(block)
         
     | 
| 
      
 53 
     | 
    
         
            +
                      json.childActions do
         
     | 
| 
      
 54 
     | 
    
         
            +
                        block.call ActionBuilder.new(json, page, true)
         
     | 
| 
      
 55 
     | 
    
         
            +
                      end
         
     | 
| 
      
 56 
     | 
    
         
            +
                    end
         
     | 
| 
      
 57 
     | 
    
         
            +
                  end
         
     | 
| 
      
 58 
     | 
    
         
            +
             
     | 
| 
       41 
59 
     | 
    
         
             
                  module Forms
         
     | 
| 
       42 
60 
     | 
    
         
             
                    class Submit < Action
         
     | 
| 
       43 
61 
     | 
    
         
             
                    end
         
     | 
| 
       44 
     | 
    
         
            -
             
     | 
| 
       45 
62 
     | 
    
         
             
                  end
         
     | 
| 
       46 
63 
     | 
    
         | 
| 
       47 
     | 
    
         
            -
                  # Consider deprecating this. See Data
         
     | 
| 
       48 
64 
     | 
    
         
             
                  module Auth
         
     | 
| 
       49 
65 
     | 
    
         
             
                    class SaveCsrfToken < Action
         
     | 
| 
       50 
66 
     | 
    
         
             
                      string :token
         
     | 
| 
       51 
67 
     | 
    
         
             
                      action :onSave
         
     | 
| 
       52 
68 
     | 
    
         
             
                    end
         
     | 
| 
      
 69 
     | 
    
         
            +
                  end
         
     | 
| 
       53 
70 
     | 
    
         | 
| 
      
 71 
     | 
    
         
            +
                  module Analytics
         
     | 
| 
      
 72 
     | 
    
         
            +
                    class LogEvent < Action
         
     | 
| 
      
 73 
     | 
    
         
            +
                      string :name
         
     | 
| 
      
 74 
     | 
    
         
            +
                      hash :params
         
     | 
| 
      
 75 
     | 
    
         
            +
                    end
         
     | 
| 
       54 
76 
     | 
    
         
             
                  end
         
     | 
| 
       55 
77 
     | 
    
         | 
| 
       56 
78 
     | 
    
         
             
                  module Timeouts
         
     | 
| 
         @@ -59,6 +81,10 @@ module Glib 
     | 
|
| 
       59 
81 
     | 
    
         
             
                      action :onTimeout
         
     | 
| 
       60 
82 
     | 
    
         
             
                    end
         
     | 
| 
       61 
83 
     | 
    
         | 
| 
      
 84 
     | 
    
         
            +
                    # FUTURE
         
     | 
| 
      
 85 
     | 
    
         
            +
                    class Remove < Action
         
     | 
| 
      
 86 
     | 
    
         
            +
                    end
         
     | 
| 
      
 87 
     | 
    
         
            +
             
     | 
| 
       62 
88 
     | 
    
         
             
                    # FUTURE
         
     | 
| 
       63 
89 
     | 
    
         
             
                    class Clear < Action
         
     | 
| 
       64 
90 
     | 
    
         
             
                    end
         
     | 
| 
         @@ -66,11 +92,15 @@ module Glib 
     | 
|
| 
       66 
92 
     | 
    
         | 
| 
       67 
93 
     | 
    
         
             
                  # FUTURE
         
     | 
| 
       68 
94 
     | 
    
         
             
                  module Data
         
     | 
| 
       69 
     | 
    
         
            -
                    class  
     | 
| 
       70 
     | 
    
         
            -
                      string : 
     | 
| 
      
 95 
     | 
    
         
            +
                    class Save < Action
         
     | 
| 
      
 96 
     | 
    
         
            +
                      string :key
         
     | 
| 
      
 97 
     | 
    
         
            +
                      string :value
         
     | 
| 
       71 
98 
     | 
    
         
             
                      action :onSave
         
     | 
| 
       72 
99 
     | 
    
         
             
                    end
         
     | 
| 
       73 
100 
     | 
    
         | 
| 
      
 101 
     | 
    
         
            +
                    class Remove < Action
         
     | 
| 
      
 102 
     | 
    
         
            +
                    end
         
     | 
| 
      
 103 
     | 
    
         
            +
             
     | 
| 
       74 
104 
     | 
    
         
             
                    class Clear < Action
         
     | 
| 
       75 
105 
     | 
    
         
             
                    end
         
     | 
| 
       76 
106 
     | 
    
         
             
                  end
         
     | 
| 
         @@ -35,11 +35,16 @@ module Glib 
     | 
|
| 
       35 
35 
     | 
    
         
             
                  #   json.attributes!
         
     | 
| 
       36 
36 
     | 
    
         
             
                  # end
         
     | 
| 
       37 
37 
     | 
    
         | 
| 
       38 
     | 
    
         
            -
                  def json_ui_section(json 
     | 
| 
      
 38 
     | 
    
         
            +
                  def json_ui_section(json)
         
     | 
| 
       39 
39 
     | 
    
         
             
                    @__json_ui_section ||= Page.new(json, self)
         
     | 
| 
       40 
40 
     | 
    
         
             
                    @__json_ui_section.list_section_builder
         
     | 
| 
       41 
41 
     | 
    
         
             
                  end
         
     | 
| 
       42 
42 
     | 
    
         | 
| 
      
 43 
     | 
    
         
            +
                  def json_ui_action(json)
         
     | 
| 
      
 44 
     | 
    
         
            +
                    @__json_ui_section ||= Page.new(json, self)
         
     | 
| 
      
 45 
     | 
    
         
            +
                    @__json_ui_section.action_builder
         
     | 
| 
      
 46 
     | 
    
         
            +
                  end
         
     | 
| 
      
 47 
     | 
    
         
            +
             
     | 
| 
       43 
48 
     | 
    
         
             
                  class Page
         
     | 
| 
       44 
49 
     | 
    
         
             
                    attr_reader :json, :context, :view_builder, :action_builder, :menu_builder
         
     | 
| 
       45 
50 
     | 
    
         
             
                    attr_reader :list_section_builder, :table_section_builder, :drawer_content_builder, :split_content_builder
         
     | 
| 
         @@ -52,7 +57,7 @@ module Glib 
     | 
|
| 
       52 
57 
     | 
    
         
             
                      @context = context
         
     | 
| 
       53 
58 
     | 
    
         | 
| 
       54 
59 
     | 
    
         
             
                      @view_builder = ViewBuilder.new(json, self, true)
         
     | 
| 
       55 
     | 
    
         
            -
                      @action_builder = ActionBuilder.new(json, self)
         
     | 
| 
      
 60 
     | 
    
         
            +
                      @action_builder = ActionBuilder.new(json, self, false)
         
     | 
| 
       56 
61 
     | 
    
         
             
                      @menu_builder = MenuBuilder.new(json, self)
         
     | 
| 
       57 
62 
     | 
    
         | 
| 
       58 
63 
     | 
    
         
             
                      @list_section_builder = ListBuilders::Section.new(json, self, ListBuilders::Template.new(json, self))
         
     | 
| 
         @@ -99,9 +104,12 @@ module Glib 
     | 
|
| 
       99 
104 
     | 
    
         
             
                        #   options[:leftItems]&.call @menu_builder
         
     | 
| 
       100 
105 
     | 
    
         
             
                        # end
         
     | 
| 
       101 
106 
     | 
    
         
             
                        # json.logoUrl "http://localhost:3000/assets/logo_dark-02d9b6a91fdbf22515da7b921d31367b70696214415f6789d2f90232e4a287b7.svg"
         
     | 
| 
       102 
     | 
    
         
            -
             
     | 
| 
       103 
     | 
    
         
            -
             
     | 
| 
       104 
     | 
    
         
            -
                         
     | 
| 
      
 107 
     | 
    
         
            +
             
     | 
| 
      
 108 
     | 
    
         
            +
                        # json.rightItems do
         
     | 
| 
      
 109 
     | 
    
         
            +
                        #   options[:rightItems]&.call @menu_builder
         
     | 
| 
      
 110 
     | 
    
         
            +
                        # end
         
     | 
| 
      
 111 
     | 
    
         
            +
             
     | 
| 
      
 112 
     | 
    
         
            +
                        @view_builder.add_singleton_view('appBar', options)
         
     | 
| 
       105 
113 
     | 
    
         
             
                      end
         
     | 
| 
       106 
114 
     | 
    
         
             
                    end
         
     | 
| 
       107 
115 
     | 
    
         | 
| 
         @@ -1,6 +1,9 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            module Glib
         
     | 
| 
       2 
2 
     | 
    
         
             
              module JsonUi
         
     | 
| 
       3 
3 
     | 
    
         
             
                module StylingHelper
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
                  ### Padding
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
       4 
7 
     | 
    
         
             
                  def glib_json_padding_body
         
     | 
| 
       5 
8 
     | 
    
         
             
                    { top: 12, left: 20, right: 20, bottom: 12 }
         
     | 
| 
       6 
9 
     | 
    
         
             
                  end
         
     | 
| 
         @@ -9,6 +12,12 @@ module Glib 
     | 
|
| 
       9 
12 
     | 
    
         
             
                    { top: 12, bottom: 12, left: 16, right: 16 }
         
     | 
| 
       10 
13 
     | 
    
         
             
                  end
         
     | 
| 
       11 
14 
     | 
    
         | 
| 
      
 15 
     | 
    
         
            +
                  ###
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
                  ### Image
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
       12 
21 
     | 
    
         
             
                  def glib_json_image_standard_url
         
     | 
| 
       13 
22 
     | 
    
         
             
                    'https://cdn-images-1.medium.com/max/1200/1*Qc0XxYm-qAZL-7tjjlNfrg.png'
         
     | 
| 
       14 
23 
     | 
    
         
             
                  end
         
     | 
| 
         @@ -20,6 +29,19 @@ module Glib 
     | 
|
| 
       20 
29 
     | 
    
         
             
                  def glib_json_image_blob_key
         
     | 
| 
       21 
30 
     | 
    
         
             
                    'o6CKzNt67PWnkPdUEnWMt7pr'
         
     | 
| 
       22 
31 
     | 
    
         
             
                  end
         
     | 
| 
      
 32 
     | 
    
         
            +
             
     | 
| 
      
 33 
     | 
    
         
            +
                  ###
         
     | 
| 
      
 34 
     | 
    
         
            +
             
     | 
| 
      
 35 
     | 
    
         
            +
             
     | 
| 
      
 36 
     | 
    
         
            +
             
     | 
| 
      
 37 
     | 
    
         
            +
                  ### Color
         
     | 
| 
      
 38 
     | 
    
         
            +
             
     | 
| 
      
 39 
     | 
    
         
            +
                  def glib_color_panel_background
         
     | 
| 
      
 40 
     | 
    
         
            +
                    '#b3bac2'
         
     | 
| 
      
 41 
     | 
    
         
            +
                  end
         
     | 
| 
      
 42 
     | 
    
         
            +
             
     | 
| 
      
 43 
     | 
    
         
            +
                  ###
         
     | 
| 
      
 44 
     | 
    
         
            +
             
     | 
| 
       23 
45 
     | 
    
         
             
                end
         
     | 
| 
       24 
46 
     | 
    
         
             
              end
         
     | 
| 
       25 
47 
     | 
    
         
             
            end
         
     | 
| 
         @@ -15,6 +15,10 @@ module Glib 
     | 
|
| 
       15 
15 
     | 
    
         
             
                    end
         
     | 
| 
       16 
16 
     | 
    
         
             
                  end
         
     | 
| 
       17 
17 
     | 
    
         | 
| 
      
 18 
     | 
    
         
            +
                  def add_singleton_view(name, *args)
         
     | 
| 
      
 19 
     | 
    
         
            +
                    add_singleton_element 'view', name, *args
         
     | 
| 
      
 20 
     | 
    
         
            +
                  end
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
       18 
22 
     | 
    
         
             
                  def method_missing(m, *args)
         
     | 
| 
       19 
23 
     | 
    
         
             
                    add_view m, *args
         
     | 
| 
       20 
24 
     | 
    
         
             
                  end
         
     | 
| 
         @@ -152,26 +156,22 @@ module Glib 
     | 
|
| 
       152 
156 
     | 
    
         
             
                        block.call page.menu_builder
         
     | 
| 
       153 
157 
     | 
    
         
             
                      end
         
     | 
| 
       154 
158 
     | 
    
         
             
                    end
         
     | 
| 
      
 159 
     | 
    
         
            +
                  end
         
     | 
| 
       155 
160 
     | 
    
         | 
| 
       156 
     | 
    
         
            -
             
     | 
| 
       157 
     | 
    
         
            -
                     
     | 
| 
       158 
     | 
    
         
            -
                    #   json.tabButtons do
         
     | 
| 
       159 
     | 
    
         
            -
                    #     block.call page.menu_builder
         
     | 
| 
       160 
     | 
    
         
            -
                    #   end
         
     | 
| 
       161 
     | 
    
         
            -
                    # end
         
     | 
| 
       162 
     | 
    
         
            -
             
     | 
| 
       163 
     | 
    
         
            -
                    # def options(options)
         
     | 
| 
       164 
     | 
    
         
            -
                    #   current_url = page.context.request.base_url + page.context.request.fullpath
         
     | 
| 
      
 161 
     | 
    
         
            +
                  class AppBar < View
         
     | 
| 
      
 162 
     | 
    
         
            +
                    color :color
         
     | 
| 
       165 
163 
     | 
    
         | 
| 
       166 
     | 
    
         
            -
                    # 
     | 
| 
       167 
     | 
    
         
            -
                    # 
     | 
| 
       168 
     | 
    
         
            -
                    # 
     | 
| 
       169 
     | 
    
         
            -
                    #         action.windows_reload url: tab[:url]
         
     | 
| 
       170 
     | 
    
         
            -
                    #       end
         
     | 
| 
       171 
     | 
    
         
            -
                    #     end
         
     | 
| 
      
 164 
     | 
    
         
            +
                    # def leftButtons(block)
         
     | 
| 
      
 165 
     | 
    
         
            +
                    #   json.leftButtons do
         
     | 
| 
      
 166 
     | 
    
         
            +
                    #     block.call page.menu_builder
         
     | 
| 
       172 
167 
     | 
    
         
             
                    #   end
         
     | 
| 
       173 
168 
     | 
    
         
             
                    # end
         
     | 
| 
       174 
169 
     | 
    
         | 
| 
      
 170 
     | 
    
         
            +
                    def rightButtons(block)
         
     | 
| 
      
 171 
     | 
    
         
            +
                      json.rightButtons do
         
     | 
| 
      
 172 
     | 
    
         
            +
                        block.call page.menu_builder
         
     | 
| 
      
 173 
     | 
    
         
            +
                      end
         
     | 
| 
      
 174 
     | 
    
         
            +
                    end
         
     | 
| 
       175 
175 
     | 
    
         
             
                  end
         
     | 
| 
       176 
176 
     | 
    
         | 
| 
       177 
177 
     | 
    
         
             
                  class Datetime < View
         
     | 
| 
         @@ -182,4 +182,4 @@ module Glib 
     | 
|
| 
       182 
182 
     | 
    
         | 
| 
       183 
183 
     | 
    
         
             
                end
         
     | 
| 
       184 
184 
     | 
    
         
             
              end
         
     | 
| 
       185 
     | 
    
         
            -
            end
         
     | 
| 
      
 185 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -103,8 +103,13 @@ class Glib::JsonUi::ViewBuilder 
     | 
|
| 
       103 
103 
     | 
    
         
             
                end
         
     | 
| 
       104 
104 
     | 
    
         | 
| 
       105 
105 
     | 
    
         
             
                class Check < Text
         
     | 
| 
       106 
     | 
    
         
            -
                   
     | 
| 
       107 
     | 
    
         
            -
                   
     | 
| 
      
 106 
     | 
    
         
            +
                  any :uncheckValue
         
     | 
| 
      
 107 
     | 
    
         
            +
                  any :checkValue
         
     | 
| 
      
 108 
     | 
    
         
            +
             
     | 
| 
      
 109 
     | 
    
         
            +
             
     | 
| 
      
 110 
     | 
    
         
            +
                  def value(value)
         
     | 
| 
      
 111 
     | 
    
         
            +
                    @value = value if value != Glib::Value::DEFAULT
         
     | 
| 
      
 112 
     | 
    
         
            +
                  end
         
     | 
| 
       108 
113 
     | 
    
         | 
| 
       109 
114 
     | 
    
         
             
                  # Where possible, use value instead of this
         
     | 
| 
       110 
115 
     | 
    
         
             
                  bool :checked
         
     | 
| 
         @@ -113,41 +113,17 @@ module Glib 
     | 
|
| 
       113 
113 
     | 
    
         
             
                  controller.policy_scope(record.class, policy_scope_class: policy_scope_class)
         
     | 
| 
       114 
114 
     | 
    
         
             
                end
         
     | 
| 
       115 
115 
     | 
    
         | 
| 
       116 
     | 
    
         
            -
                # TODO: Remove. Deprecated
         
     | 
| 
       117 
     | 
    
         
            -
                private  # Used by child
         
     | 
| 
       118 
     | 
    
         
            -
                def public?
         
     | 
| 
       119 
     | 
    
         
            -
                  true
         
     | 
| 
       120 
     | 
    
         
            -
                end
         
     | 
| 
       121 
     | 
    
         
            -
             
     | 
| 
       122 
     | 
    
         
            -
                private  # Used by child
         
     | 
| 
       123 
     | 
    
         
            -
                def everyone
         
     | 
| 
       124 
     | 
    
         
            -
                  true
         
     | 
| 
       125 
     | 
    
         
            -
                end
         
     | 
| 
       126 
     | 
    
         
            -
             
     | 
| 
       127 
     | 
    
         
            -
                # TODO: Deprecate `user()`
         
     | 
| 
       128 
     | 
    
         
            -
                private  # Used by child
         
     | 
| 
       129 
     | 
    
         
            -
                def current_user
         
     | 
| 
       130 
     | 
    
         
            -
                  user
         
     | 
| 
       131 
     | 
    
         
            -
                end
         
     | 
| 
       132 
     | 
    
         
            -
             
     | 
| 
       133 
     | 
    
         
            -
                # # TODO: Revise because it seems there is no justification for allowing owner to see any of the deleted entities, which include User, Guild, and Post
         
     | 
| 
       134 
     | 
    
         
            -
                # private  # Used by child
         
     | 
| 
       135 
     | 
    
         
            -
                # def not_deleted_unless_owner_or_moderator?(&block)
         
     | 
| 
       136 
     | 
    
         
            -
                #   block ||= lambda { |unused_arg| @user.moderator? }
         
     | 
| 
       137 
     | 
    
         
            -
                #   !@record.deleted? || (@user && (@user.id == @record.user_owner_id || block.call(@record)))
         
     | 
| 
       138 
     | 
    
         
            -
                # end
         
     | 
| 
       139 
     | 
    
         
            -
             
     | 
| 
       140 
     | 
    
         
            -
                # private  # Used by child
         
     | 
| 
       141 
     | 
    
         
            -
                # def not_deleted_unless_moderator?(&block)
         
     | 
| 
       142 
     | 
    
         
            -
                #   block ||= lambda { |unused_arg| @user.moderator? }
         
     | 
| 
       143 
     | 
    
         
            -
                #   !@record.deleted? || (@user && block.call(@record))
         
     | 
| 
       144 
     | 
    
         
            -
                # end
         
     | 
| 
       145 
     | 
    
         
            -
             
     | 
| 
       146 
116 
     | 
    
         
             
                public
         
     | 
| 
       147 
117 
     | 
    
         
             
                def self.args_builder
         
     | 
| 
       148 
118 
     | 
    
         
             
                  Proc.new { |controller| [] }
         
     | 
| 
       149 
119 
     | 
    
         
             
                end
         
     | 
| 
       150 
120 
     | 
    
         | 
| 
      
 121 
     | 
    
         
            +
                # TODO: Remove. Deprecated
         
     | 
| 
      
 122 
     | 
    
         
            +
                # private  # Used by child
         
     | 
| 
      
 123 
     | 
    
         
            +
                # def public?
         
     | 
| 
      
 124 
     | 
    
         
            +
                #   true
         
     | 
| 
      
 125 
     | 
    
         
            +
                # end
         
     | 
| 
      
 126 
     | 
    
         
            +
             
     | 
| 
       151 
127 
     | 
    
         
             
                class Scope
         
     | 
| 
       152 
128 
     | 
    
         
             
                  attr_reader :user, :scope
         
     | 
| 
       153 
129 
     | 
    
         | 
| 
         @@ -156,9 +132,30 @@ module Glib 
     | 
|
| 
       156 
132 
     | 
    
         
             
                    @scope = scope
         
     | 
| 
       157 
133 
     | 
    
         
             
                  end
         
     | 
| 
       158 
134 
     | 
    
         | 
| 
      
 135 
     | 
    
         
            +
                  # def current_user
         
     | 
| 
      
 136 
     | 
    
         
            +
                  #   user
         
     | 
| 
      
 137 
     | 
    
         
            +
                  # end
         
     | 
| 
      
 138 
     | 
    
         
            +
             
     | 
| 
      
 139 
     | 
    
         
            +
                  # To be overridden
         
     | 
| 
       159 
140 
     | 
    
         
             
                  def resolve
         
     | 
| 
       160 
141 
     | 
    
         
             
                    scope.none
         
     | 
| 
       161 
142 
     | 
    
         
             
                  end
         
     | 
| 
       162 
143 
     | 
    
         
             
                end
         
     | 
| 
      
 144 
     | 
    
         
            +
             
     | 
| 
      
 145 
     | 
    
         
            +
                private  # Used by child
         
     | 
| 
      
 146 
     | 
    
         
            +
                  def everyone
         
     | 
| 
      
 147 
     | 
    
         
            +
                    true
         
     | 
| 
      
 148 
     | 
    
         
            +
                  end
         
     | 
| 
      
 149 
     | 
    
         
            +
             
     | 
| 
      
 150 
     | 
    
         
            +
                  # def current_user
         
     | 
| 
      
 151 
     | 
    
         
            +
                  #   user
         
     | 
| 
      
 152 
     | 
    
         
            +
                  # end
         
     | 
| 
      
 153 
     | 
    
         
            +
             
     | 
| 
      
 154 
     | 
    
         
            +
                  # TODO: Bad pattern. Implement explicit policy parameter instead.
         
     | 
| 
      
 155 
     | 
    
         
            +
                  # - E.g. can? :destroy, :service_subscription_auto_renewal, { service_subscription: @service_subscription }
         
     | 
| 
      
 156 
     | 
    
         
            +
                  # - E.g. super class: :service_subscription_auto_renewal, { service_subscription: @service_subscription }
         
     | 
| 
      
 157 
     | 
    
         
            +
                  def controller_var(name)
         
     | 
| 
      
 158 
     | 
    
         
            +
                    controller.instance_variable_get(:"@#{name}")
         
     | 
| 
      
 159 
     | 
    
         
            +
                  end
         
     | 
| 
       163 
160 
     | 
    
         
             
              end
         
     | 
| 
       164 
161 
     | 
    
         
             
            end
         
     | 
| 
         @@ -5,6 +5,8 @@ json_ui_page json do |page| 
     | 
|
| 
       5 
5 
     | 
    
         | 
| 
       6 
6 
     | 
    
         
             
              page.list sections: [
         
     | 
| 
       7 
7 
     | 
    
         
             
                ->(section) do
         
     | 
| 
      
 8 
     | 
    
         
            +
                  render "#{@path_prefix}/actions/reload", section: section
         
     | 
| 
      
 9 
     | 
    
         
            +
                end, ->(section) do
         
     | 
| 
       8 
10 
     | 
    
         
             
                  render "#{@path_prefix}/actions/dialogs", section: section
         
     | 
| 
       9 
11 
     | 
    
         
             
                end, ->(section) do
         
     | 
| 
       10 
12 
     | 
    
         
             
                  render "#{@path_prefix}/actions/snackbars", section: section
         
     | 
| 
         @@ -16,8 +18,6 @@ json_ui_page json do |page| 
     | 
|
| 
       16 
18 
     | 
    
         
             
                  render "#{@path_prefix}/actions/timeouts", section: section
         
     | 
| 
       17 
19 
     | 
    
         
             
                end, ->(section) do
         
     | 
| 
       18 
20 
     | 
    
         
             
                  render "#{@path_prefix}/actions/http", section: section
         
     | 
| 
       19 
     | 
    
         
            -
                end, ->(section) do
         
     | 
| 
       20 
     | 
    
         
            -
                  render "#{@path_prefix}/actions/reload", section: section
         
     | 
| 
       21 
21 
     | 
    
         
             
                end
         
     | 
| 
       22 
22 
     | 
    
         
             
              ]
         
     | 
| 
       23 
23 
     | 
    
         
             
            end
         
     | 
| 
         @@ -3,7 +3,7 @@ json.title 'Forms' 
     | 
|
| 
       3 
3 
     | 
    
         
             
            page = json_ui_page json
         
     | 
| 
       4 
4 
     | 
    
         
             
            render "#{@path_prefix}/nav_menu", json: json, page: page
         
     | 
| 
       5 
5 
     | 
    
         | 
| 
       6 
     | 
    
         
            -
            page.form url: json_ui_garage_url(path: 'forms/ 
     | 
| 
      
 6 
     | 
    
         
            +
            page.form url: json_ui_garage_url(path: 'forms/generic_post'), method: 'post', padding: glib_json_padding_body, childViews: ->(form) do
         
     | 
| 
       7 
7 
     | 
    
         
             
              form.h1 text: 'Text'
         
     | 
| 
       8 
8 
     | 
    
         
             
              form.fields_password name: 'user[text1]', width: 'matchParent', label: 'Type "show"'
         
     | 
| 
       9 
9 
     | 
    
         
             
              form.label text: 'Typed', showIf: {
         
     | 
| 
         @@ -29,7 +29,7 @@ page.form url: json_ui_garage_url(path: 'forms/basic_post'), method: 'post', pad 
     | 
|
| 
       29 
29 
     | 
    
         | 
| 
       30 
30 
     | 
    
         
             
              form.spacer height: 20
         
     | 
| 
       31 
31 
     | 
    
         
             
              form.h1 text: 'Check'
         
     | 
| 
       32 
     | 
    
         
            -
              form.fields_check name: 'user[check1]',  
     | 
| 
      
 32 
     | 
    
         
            +
              form.fields_check name: 'user[check1]', checkValue: 'on', label: 'Show text'
         
     | 
| 
       33 
33 
     | 
    
         
             
              form.spacer height: 10
         
     | 
| 
       34 
34 
     | 
    
         
             
              form.label text: 'Checked', showIf: {
         
     | 
| 
       35 
35 
     | 
    
         
             
                "==": [
         
     | 
| 
         @@ -70,7 +70,7 @@ page.form url: json_ui_garage_url(path: 'forms/basic_post'), method: 'post', pad 
     | 
|
| 
       70 
70 
     | 
    
         
             
              }
         
     | 
| 
       71 
71 
     | 
    
         | 
| 
       72 
72 
     | 
    
         
             
              form.spacer height: 20
         
     | 
| 
       73 
     | 
    
         
            -
              form.h1 text: ' 
     | 
| 
      
 73 
     | 
    
         
            +
              form.h1 text: 'Combined conditions'
         
     | 
| 
       74 
74 
     | 
    
         
             
              form.label text: 'Select the same option on both the radio and select fields above'
         
     | 
| 
       75 
75 
     | 
    
         
             
              form.spacer height: 10
         
     | 
| 
       76 
76 
     | 
    
         
             
              form.h3 text: 'Same!', showIf: {
         
     | 
| 
         @@ -84,5 +84,22 @@ page.form url: json_ui_garage_url(path: 'forms/basic_post'), method: 'post', pad 
     | 
|
| 
       84 
84 
     | 
    
         
             
                ]
         
     | 
| 
       85 
85 
     | 
    
         
             
              }
         
     | 
| 
       86 
86 
     | 
    
         | 
| 
      
 87 
     | 
    
         
            +
              form.spacer height: 20
         
     | 
| 
      
 88 
     | 
    
         
            +
              form.h1 text: 'Show/hide another field'
         
     | 
| 
      
 89 
     | 
    
         
            +
              form.label text: ''
         
     | 
| 
      
 90 
     | 
    
         
            +
              form.spacer height: 10
         
     | 
| 
      
 91 
     | 
    
         
            +
              form.fields_check name: 'user[check2]', checkValue: 'on', label: 'Show field'
         
     | 
| 
      
 92 
     | 
    
         
            +
              form.spacer height: 10
         
     | 
| 
      
 93 
     | 
    
         
            +
              form.fields_text width: 'matchParent', label: 'Comment (optional)', name: 'user[comment]', value: 'This field can be submitted when it is hidden, but it is not necessary (i.e. up to the app)', showIf: {
         
     | 
| 
      
 94 
     | 
    
         
            +
                "==": [
         
     | 
| 
      
 95 
     | 
    
         
            +
                  {
         
     | 
| 
      
 96 
     | 
    
         
            +
                    "var": 'user[check2]'
         
     | 
| 
      
 97 
     | 
    
         
            +
                  },
         
     | 
| 
      
 98 
     | 
    
         
            +
                  'on'
         
     | 
| 
      
 99 
     | 
    
         
            +
                ]
         
     | 
| 
      
 100 
     | 
    
         
            +
              }
         
     | 
| 
      
 101 
     | 
    
         
            +
             
     | 
| 
      
 102 
     | 
    
         
            +
              form.spacer height: 20
         
     | 
| 
      
 103 
     | 
    
         
            +
              form.fields_submit text: 'Submit'
         
     | 
| 
       87 
104 
     | 
    
         
             
              form.spacer height: 40
         
     | 
| 
       88 
105 
     | 
    
         
             
            end
         
     | 
| 
         @@ -4,11 +4,14 @@ json_ui_page json do |page| 
     | 
|
| 
       4 
4 
     | 
    
         
             
              render "#{@path_prefix}/nav_menu", json: json, page: page
         
     | 
| 
       5 
5 
     | 
    
         | 
| 
       6 
6 
     | 
    
         
             
              page.form url: json_ui_garage_url(path: 'forms/basic_post'), method: 'post', padding: glib_json_padding_body, childViews: ->(form) do
         
     | 
| 
       7 
     | 
    
         
            -
                form.fields_text name: 'user[name]', width: 'matchParent', label: 'Search', styleClasses: ['outlined', 'rounded']
         
     | 
| 
      
 7 
     | 
    
         
            +
                form.fields_text name: 'user[name]', width: 'matchParent', label: 'Search', placeholder: 'Enter a keyword', styleClasses: ['outlined', 'rounded']
         
     | 
| 
       8 
8 
     | 
    
         | 
| 
       9 
9 
     | 
    
         
             
                form.spacer height: 14
         
     | 
| 
       10 
10 
     | 
    
         
             
                form.fields_password name: 'user[password]', width: 'matchParent', label: 'Password', placeholder: 'Type your password', styleClass: 'outlined'
         
     | 
| 
       11 
11 
     | 
    
         | 
| 
      
 12 
     | 
    
         
            +
                form.spacer height: 14
         
     | 
| 
      
 13 
     | 
    
         
            +
                form.fields_textarea name: 'user[bio]', width: 'matchParent', label: 'Bio', placeholder: 'Enter your bio', styleClasses: ['outlined']
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
       12 
15 
     | 
    
         
             
                form.spacer height: 14
         
     | 
| 
       13 
16 
     | 
    
         
             
                form.fields_stripeToken name: 'user[stripe_token_outlined]', width: 'matchParent', publicKey: 'pk_test_TYooMQauvdEDq54NiTphI7jx', styleClass: 'outlined'
         
     | 
| 
       14 
17 
     | 
    
         | 
| 
         @@ -7,7 +7,7 @@ json_ui_page json do |page| 
     | 
|
| 
       7 
7 
     | 
    
         
             
                form.fields_email name: 'user[email]', width: 'matchParent', label: 'Email'
         
     | 
| 
       8 
8 
     | 
    
         
             
                form.fields_url name: 'user[url]', width: 'matchParent', label: 'URL'
         
     | 
| 
       9 
9 
     | 
    
         
             
                form.fields_number name: 'user[number]', width: 'matchParent', label: 'Number', validation: { required: { message: 'Required' } }
         
     | 
| 
       10 
     | 
    
         
            -
                form.fields_password name: 'user[password]', width: 'matchParent', label: 'Password'
         
     | 
| 
      
 10 
     | 
    
         
            +
                form.fields_password name: 'user[password]', width: 'matchParent', label: 'Password', hint: 'Should contain at least 6 characters'
         
     | 
| 
       11 
11 
     | 
    
         
             
                form.fields_textarea name: 'user[textarea]', width: 'matchParent', label: 'Textarea with maxLength', maxLength: 50, validation: { required: { message: 'Required' } }
         
     | 
| 
       12 
12 
     | 
    
         | 
| 
       13 
13 
     | 
    
         
             
                options = ['male', 'female'].map { |i| { text: i.humanize, value: i } }
         
     | 
| 
         @@ -41,6 +41,17 @@ json_ui_page json do |page| 
     | 
|
| 
       41 
41 
     | 
    
         
             
                      action.windows_open url: json_ui_garage_url(path: 'pages/full_width')
         
     | 
| 
       42 
42 
     | 
    
         
             
                    end
         
     | 
| 
       43 
43 
     | 
    
         
             
                  end
         
     | 
| 
      
 44 
     | 
    
         
            +
                end,
         
     | 
| 
      
 45 
     | 
    
         
            +
                ->(section) do
         
     | 
| 
      
 46 
     | 
    
         
            +
                  section.header padding: glib_json_padding_list, childViews: ->(header) do
         
     | 
| 
      
 47 
     | 
    
         
            +
                    header.h2 text: 'Misc (Web Only)'
         
     | 
| 
      
 48 
     | 
    
         
            +
                  end
         
     | 
| 
      
 49 
     | 
    
         
            +
             
     | 
| 
      
 50 
     | 
    
         
            +
                  section.rows builder: ->(template) do
         
     | 
| 
      
 51 
     | 
    
         
            +
                    template.thumbnail title: 'Nested Scroll', onClick: ->(action) do
         
     | 
| 
      
 52 
     | 
    
         
            +
                      action.windows_open url: json_ui_garage_url(path: 'pages/nested_scroll')
         
     | 
| 
      
 53 
     | 
    
         
            +
                    end
         
     | 
| 
      
 54 
     | 
    
         
            +
                  end
         
     | 
| 
       44 
55 
     | 
    
         
             
                end
         
     | 
| 
       45 
56 
     | 
    
         
             
              ]
         
     | 
| 
       46 
57 
     | 
    
         | 
| 
         @@ -1,19 +1,18 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            json.title 'Pages'
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
     | 
    
         
            -
            json_ui_page json 
     | 
| 
       4 
     | 
    
         
            -
             
     | 
| 
       5 
     | 
    
         
            -
              
         
     | 
| 
       6 
     | 
    
         
            -
              page.header padding: glib_json_padding_body, backgroundColor: '#b3bac2', childViews: ->(header) do
         
     | 
| 
       7 
     | 
    
         
            -
                header.h1 text: 'Header'
         
     | 
| 
       8 
     | 
    
         
            -
              end
         
     | 
| 
      
 3 
     | 
    
         
            +
            page = json_ui_page json
         
     | 
| 
      
 4 
     | 
    
         
            +
            render "#{@path_prefix}/nav_menu", json: json, page: page
         
     | 
| 
       9 
5 
     | 
    
         | 
| 
       10 
     | 
    
         
            -
             
     | 
| 
       11 
     | 
    
         
            -
             
     | 
| 
       12 
     | 
    
         
            -
             
     | 
| 
      
 6 
     | 
    
         
            +
            page.header padding: glib_json_padding_body, backgroundColor: '#b3bac2', childViews: ->(header) do
         
     | 
| 
      
 7 
     | 
    
         
            +
              header.h1 text: 'Header'
         
     | 
| 
      
 8 
     | 
    
         
            +
            end
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
            page.footer padding: glib_json_padding_body, backgroundColor: '#b3bac2', childViews: ->(footer) do
         
     | 
| 
      
 11 
     | 
    
         
            +
              footer.h1 text: 'Footer'
         
     | 
| 
      
 12 
     | 
    
         
            +
            end
         
     | 
| 
       13 
13 
     | 
    
         | 
| 
       14 
     | 
    
         
            -
             
     | 
| 
       15 
     | 
    
         
            -
             
     | 
| 
       16 
     | 
    
         
            -
             
     | 
| 
       17 
     | 
    
         
            -
                end
         
     | 
| 
      
 14 
     | 
    
         
            +
            page.scroll padding: glib_json_padding_body, childViews: ->(scroll) do
         
     | 
| 
      
 15 
     | 
    
         
            +
              (1..100).each do |index|
         
     | 
| 
      
 16 
     | 
    
         
            +
                scroll.label text: 'Content'
         
     | 
| 
       18 
17 
     | 
    
         
             
              end
         
     | 
| 
       19 
18 
     | 
    
         
             
            end
         
     | 
| 
         @@ -1,21 +1,33 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            json.title 'Pages'
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
     | 
    
         
            -
            json_ui_page json 
     | 
| 
       4 
     | 
    
         
            -
             
     | 
| 
       5 
     | 
    
         
            -
             
     | 
| 
       6 
     | 
    
         
            -
              page.rightNavButtons do |menu|
         
     | 
| 
       7 
     | 
    
         
            -
                menu.button icon: 'search', onClick: ->(action) do 
         
     | 
| 
       8 
     | 
    
         
            -
                  action.dialogs_alert message: 'Perform some action'
         
     | 
| 
       9 
     | 
    
         
            -
                end
         
     | 
| 
       10 
     | 
    
         
            -
                menu.button icon: { name: 'star', badge: { text: '1', backgroundColor: '#ff0000' } }, onClick: ->(action) do 
         
     | 
| 
       11 
     | 
    
         
            -
                  action.dialogs_alert message: 'Perform some action'
         
     | 
| 
       12 
     | 
    
         
            -
                end
         
     | 
| 
       13 
     | 
    
         
            -
                menu.button icon: { name: 'map', badge: '2' }, onClick: ->(action) do 
         
     | 
| 
       14 
     | 
    
         
            -
                  action.dialogs_alert message: 'Perform some action'
         
     | 
| 
       15 
     | 
    
         
            -
                end
         
     | 
| 
       16 
     | 
    
         
            -
              end
         
     | 
| 
      
 3 
     | 
    
         
            +
            page = json_ui_page json
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            render "#{@path_prefix}/nav_menu", json: json, page: page
         
     | 
| 
       17 
6 
     | 
    
         | 
| 
       18 
     | 
    
         
            -
             
     | 
| 
       19 
     | 
    
         
            -
             
     | 
| 
      
 7 
     | 
    
         
            +
            page.navBar backgroundColor: '#a8c4e3', rightButtons: ->(menu) do
         
     | 
| 
      
 8 
     | 
    
         
            +
              menu.button icon: 'search', onClick: ->(action) do 
         
     | 
| 
      
 9 
     | 
    
         
            +
                action.dialogs_alert message: 'Perform some action'
         
     | 
| 
      
 10 
     | 
    
         
            +
              end
         
     | 
| 
      
 11 
     | 
    
         
            +
              menu.button icon: { name: 'star', badge: { text: '1', backgroundColor: '#ff0000' } }, onClick: ->(action) do 
         
     | 
| 
      
 12 
     | 
    
         
            +
                action.dialogs_alert message: 'Perform some action'
         
     | 
| 
      
 13 
     | 
    
         
            +
              end
         
     | 
| 
      
 14 
     | 
    
         
            +
              menu.button icon: { name: 'map', badge: '2' }, onClick: ->(action) do 
         
     | 
| 
      
 15 
     | 
    
         
            +
                action.dialogs_alert message: 'Perform some action'
         
     | 
| 
       20 
16 
     | 
    
         
             
              end
         
     | 
| 
       21 
17 
     | 
    
         
             
            end
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
            # page.rightNavButtons do |menu|
         
     | 
| 
      
 20 
     | 
    
         
            +
            #   menu.button icon: 'search', onClick: ->(action) do 
         
     | 
| 
      
 21 
     | 
    
         
            +
            #     action.dialogs_alert message: 'Perform some action'
         
     | 
| 
      
 22 
     | 
    
         
            +
            #   end
         
     | 
| 
      
 23 
     | 
    
         
            +
            #   menu.button icon: { name: 'star', badge: { text: '1', backgroundColor: '#ff0000' } }, onClick: ->(action) do 
         
     | 
| 
      
 24 
     | 
    
         
            +
            #     action.dialogs_alert message: 'Perform some action'
         
     | 
| 
      
 25 
     | 
    
         
            +
            #   end
         
     | 
| 
      
 26 
     | 
    
         
            +
            #   menu.button icon: { name: 'map', badge: '2' }, onClick: ->(action) do 
         
     | 
| 
      
 27 
     | 
    
         
            +
            #     action.dialogs_alert message: 'Perform some action'
         
     | 
| 
      
 28 
     | 
    
         
            +
            #   end
         
     | 
| 
      
 29 
     | 
    
         
            +
            # end
         
     | 
| 
      
 30 
     | 
    
         
            +
             
     | 
| 
      
 31 
     | 
    
         
            +
            page.scroll padding: glib_json_padding_body, childViews: ->(scroll) do
         
     | 
| 
      
 32 
     | 
    
         
            +
              scroll.label text: 'See the right menu buttons on the nav bar'
         
     | 
| 
      
 33 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,40 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            json.title 'Pages'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            page = json_ui_page json
         
     | 
| 
      
 4 
     | 
    
         
            +
            render "#{@path_prefix}/nav_menu", json: json, page: page
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            # page.template 'fullWidth'
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
            page.header childViews: ->(header) do
         
     | 
| 
      
 9 
     | 
    
         
            +
              header.panels_vertical width: 'matchParent', styleClass: 'card', padding: glib_json_padding_body, childViews: ->(vertical) do
         
     | 
| 
      
 10 
     | 
    
         
            +
                vertical.h1 text: 'Header'
         
     | 
| 
      
 11 
     | 
    
         
            +
              end
         
     | 
| 
      
 12 
     | 
    
         
            +
              header.spacer height: 10
         
     | 
| 
      
 13 
     | 
    
         
            +
            end
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
            page.footer childViews: ->(footer) do
         
     | 
| 
      
 16 
     | 
    
         
            +
              footer.spacer height: 10
         
     | 
| 
      
 17 
     | 
    
         
            +
              footer.panels_vertical width: 'matchParent', styleClass: 'card', padding: glib_json_padding_body, childViews: ->(vertical) do
         
     | 
| 
      
 18 
     | 
    
         
            +
                vertical.h1 text: 'Footer'
         
     | 
| 
      
 19 
     | 
    
         
            +
              end
         
     | 
| 
      
 20 
     | 
    
         
            +
            end
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
            page.scroll padding: glib_json_padding_body, childViews: ->(scroll) do
         
     | 
| 
      
 23 
     | 
    
         
            +
              scroll.label text: 'Inner Header'
         
     | 
| 
      
 24 
     | 
    
         
            +
              scroll.label text: 'Inner Header'
         
     | 
| 
      
 25 
     | 
    
         
            +
              scroll.label text: 'Inner Header'
         
     | 
| 
      
 26 
     | 
    
         
            +
              scroll.spacer height: 20
         
     | 
| 
      
 27 
     | 
    
         
            +
             
     | 
| 
      
 28 
     | 
    
         
            +
              scroll.panels_vertical width: 'matchParent', styleClass: 'card', backgroundColor: glib_color_panel_background, padding: glib_json_padding_body.merge(right: nil), childViews: ->(padder) do
         
     | 
| 
      
 29 
     | 
    
         
            +
                padder.panels_scroll width: 'matchParent', height: 300, childViews: ->(inner_scroll) do
         
     | 
| 
      
 30 
     | 
    
         
            +
                  (1..100).each do |index|
         
     | 
| 
      
 31 
     | 
    
         
            +
                    inner_scroll.label text: 'Content'
         
     | 
| 
      
 32 
     | 
    
         
            +
                  end
         
     | 
| 
      
 33 
     | 
    
         
            +
                end
         
     | 
| 
      
 34 
     | 
    
         
            +
              end
         
     | 
| 
      
 35 
     | 
    
         
            +
             
     | 
| 
      
 36 
     | 
    
         
            +
              scroll.spacer height: 20
         
     | 
| 
      
 37 
     | 
    
         
            +
              scroll.label text: 'Inner Footer'
         
     | 
| 
      
 38 
     | 
    
         
            +
              scroll.label text: 'Inner Footer'
         
     | 
| 
      
 39 
     | 
    
         
            +
              scroll.label text: 'Inner Footer'
         
     | 
| 
      
 40 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -1,16 +1,37 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            json.title 'Panels'
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
     | 
    
         
            -
            image_url1 = ' 
     | 
| 
      
 3 
     | 
    
         
            +
            image_url1 = 'https://ichef.bbci.co.uk/news/976/cpsprodpb/18106/production/_97266589_gettyimages-474547165.jpg'
         
     | 
| 
       4 
4 
     | 
    
         
             
            image_url2 = 'https://s.abcnews.com/images/International/Guam03-gty-jrl-170809_16x9_992.jpg'
         
     | 
| 
       5 
5 
     | 
    
         | 
| 
       6 
6 
     | 
    
         
             
            json_ui_page json do |page|
         
     | 
| 
       7 
7 
     | 
    
         
             
              render "#{@path_prefix}/nav_menu", json: json, page: page
         
     | 
| 
       8 
     | 
    
         
            -
             
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
       9 
9 
     | 
    
         
             
              page.scroll padding: glib_json_padding_body, childViews: ->(scroll) do
         
     | 
| 
       10 
     | 
    
         
            -
                scroll. 
     | 
| 
      
 10 
     | 
    
         
            +
                scroll.label text: "\n"
         
     | 
| 
      
 11 
     | 
    
         
            +
                scroll.h1 text: 'Carousel with labels'
         
     | 
| 
      
 12 
     | 
    
         
            +
                scroll.panels_carousel width: 'matchParent', childViews: ->(carousel) do
         
     | 
| 
      
 13 
     | 
    
         
            +
                  carousel.label text: 'Item 1'
         
     | 
| 
      
 14 
     | 
    
         
            +
                  carousel.label text: 'Item 2'
         
     | 
| 
      
 15 
     | 
    
         
            +
                end
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
                scroll.label text: "\n"
         
     | 
| 
      
 18 
     | 
    
         
            +
                scroll.h1 text: 'Carousel with images'
         
     | 
| 
       11 
19 
     | 
    
         
             
                scroll.panels_carousel width: 'matchParent', childViews: ->(carousel) do
         
     | 
| 
       12 
20 
     | 
    
         
             
                  carousel.image url: image_url1, width: 'matchParent'
         
     | 
| 
       13 
21 
     | 
    
         
             
                  carousel.image url: image_url2, width: 'matchParent'
         
     | 
| 
       14 
22 
     | 
    
         
             
                end
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
                scroll.label text: "\n"
         
     | 
| 
      
 25 
     | 
    
         
            +
                scroll.h1 text: 'Carousel with complex layout'
         
     | 
| 
      
 26 
     | 
    
         
            +
                scroll.panels_carousel width: 'matchParent', childViews: ->(carousel) do
         
     | 
| 
      
 27 
     | 
    
         
            +
                  carousel.panels_vertical childViews: ->(panel) do
         
     | 
| 
      
 28 
     | 
    
         
            +
                    panel.h3 text: 'Item 1'
         
     | 
| 
      
 29 
     | 
    
         
            +
                    panel.image url: image_url1, width: 'matchParent'
         
     | 
| 
      
 30 
     | 
    
         
            +
                  end
         
     | 
| 
      
 31 
     | 
    
         
            +
                  carousel.panels_vertical childViews: ->(panel) do
         
     | 
| 
      
 32 
     | 
    
         
            +
                    panel.h3 text: 'Item 2'
         
     | 
| 
      
 33 
     | 
    
         
            +
                    panel.image url: image_url2, width: 'matchParent'
         
     | 
| 
      
 34 
     | 
    
         
            +
                  end
         
     | 
| 
      
 35 
     | 
    
         
            +
                end
         
     | 
| 
       15 
36 
     | 
    
         
             
              end
         
     | 
| 
       16 
37 
     | 
    
         
             
            end
         
     | 
| 
         @@ -1,4 +1,3 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
             
     | 
| 
       2 
1 
     | 
    
         
             
            batch_count = 30
         
     | 
| 
       3 
2 
     | 
    
         
             
            items = (1..batch_count)
         
     | 
| 
       4 
3 
     | 
    
         
             
            section = page.table_section_builder
         
     | 
| 
         @@ -10,4 +9,4 @@ section.rows objects: items, builder: ->(row, item, index) do 
     | 
|
| 
       10 
9 
     | 
    
         
             
              end, onClick: ->(action) do
         
     | 
| 
       11 
10 
     | 
    
         
             
                action.windows_open url: json_ui_garage_url(path: 'home/blank')
         
     | 
| 
       12 
11 
     | 
    
         
             
              end
         
     | 
| 
       13 
     | 
    
         
            -
            end
         
     | 
| 
      
 12 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -1,39 +1,39 @@ 
     | 
|
| 
       1 
1 
     | 
    
         | 
| 
       2 
2 
     | 
    
         
             
            page_index = params[:page].to_i
         
     | 
| 
       3 
3 
     | 
    
         
             
            next_page = {
         
     | 
| 
       4 
     | 
    
         
            -
              url: json_ui_garage_url(path: 'tables/ 
     | 
| 
      
 4 
     | 
    
         
            +
              url: json_ui_garage_url(path: 'tables/autoload_as_needed', page: page_index + 1, section_only: 'v1'),
         
     | 
| 
       5 
5 
     | 
    
         
             
              autoload: 'asNeeded'
         
     | 
| 
       6 
6 
     | 
    
         
             
            }
         
     | 
| 
       7 
7 
     | 
    
         | 
| 
      
 8 
     | 
    
         
            +
            page = json_ui_page json
         
     | 
| 
       8 
9 
     | 
    
         
             
            column_indexes = (1..3)
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
       9 
11 
     | 
    
         
             
            if params[:section_only].present?
         
     | 
| 
      
 12 
     | 
    
         
            +
              sleep 1
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
       10 
14 
     | 
    
         
             
              json.nextPage next_page if page_index < 3
         
     | 
| 
       11 
     | 
    
         
            -
               
     | 
| 
       12 
     | 
    
         
            -
                json. 
     | 
| 
       13 
     | 
    
         
            -
                   
     | 
| 
       14 
     | 
    
         
            -
                    render 'json_ui/garage/tables/autoload_section', page: page, page_index: page_index, column_indexes: column_indexes
         
     | 
| 
       15 
     | 
    
         
            -
                  end
         
     | 
| 
      
 15 
     | 
    
         
            +
              json.sections do
         
     | 
| 
      
 16 
     | 
    
         
            +
                json.child! do
         
     | 
| 
      
 17 
     | 
    
         
            +
                  render 'json_ui/garage/tables/autoload_section', page: page, page_index: page_index, column_indexes: column_indexes
         
     | 
| 
       16 
18 
     | 
    
         
             
                end
         
     | 
| 
       17 
19 
     | 
    
         
             
              end
         
     | 
| 
       18 
20 
     | 
    
         
             
            else
         
     | 
| 
       19 
21 
     | 
    
         
             
              json.title 'Tables'
         
     | 
| 
       20 
22 
     | 
    
         | 
| 
       21 
     | 
    
         
            -
               
     | 
| 
       22 
     | 
    
         
            -
                render "#{@path_prefix}/nav_menu", json: json, page: page
         
     | 
| 
      
 23 
     | 
    
         
            +
              render "#{@path_prefix}/nav_menu", json: json, page: page
         
     | 
| 
       23 
24 
     | 
    
         | 
| 
       24 
     | 
    
         
            -
             
     | 
| 
       25 
     | 
    
         
            -
             
     | 
| 
       26 
     | 
    
         
            -
             
     | 
| 
       27 
     | 
    
         
            -
             
     | 
| 
       28 
     | 
    
         
            -
                    end
         
     | 
| 
      
 25 
     | 
    
         
            +
              page.table nextPage: next_page, firstSection: ->(section) do
         
     | 
| 
      
 26 
     | 
    
         
            +
                section.header cellViews: ->(header) do
         
     | 
| 
      
 27 
     | 
    
         
            +
                  column_indexes.each do |i|
         
     | 
| 
      
 28 
     | 
    
         
            +
                    header.label text: "Heading#{i}"
         
     | 
| 
       29 
29 
     | 
    
         
             
                  end
         
     | 
| 
       30 
     | 
    
         
            -
             
     | 
| 
       31 
     | 
    
         
            -
                  render "#{@path_prefix}/tables/autoload_section", page: page, page_index: page_index, column_indexes: column_indexes
         
     | 
| 
       32 
     | 
    
         
            -
                end, onScrollToBottom: ->(action) do
         
     | 
| 
       33 
     | 
    
         
            -
                  action.snackbars_alert message: 'Scrolled to Bottom'
         
     | 
| 
       34 
     | 
    
         
            -
                end, onScrollToTop: ->(action) do
         
     | 
| 
       35 
     | 
    
         
            -
                  action.snackbars_alert message: 'Scrolled to Top'
         
     | 
| 
       36 
30 
     | 
    
         
             
                end
         
     | 
| 
      
 31 
     | 
    
         
            +
             
     | 
| 
      
 32 
     | 
    
         
            +
                render "#{@path_prefix}/tables/autoload_section", page: page, page_index: page_index, column_indexes: column_indexes
         
     | 
| 
      
 33 
     | 
    
         
            +
              end, onScrollToBottom: ->(action) do
         
     | 
| 
      
 34 
     | 
    
         
            +
                action.snackbars_alert message: 'Scrolled to Bottom'
         
     | 
| 
      
 35 
     | 
    
         
            +
              end, onScrollToTop: ->(action) do
         
     | 
| 
      
 36 
     | 
    
         
            +
                action.snackbars_alert message: 'Scrolled to Top'
         
     | 
| 
       37 
37 
     | 
    
         
             
              end
         
     | 
| 
       38 
38 
     | 
    
         | 
| 
       39 
39 
     | 
    
         
             
            end
         
     | 
| 
         @@ -0,0 +1,22 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            json.title 'Views'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            page = json_ui_page json
         
     | 
| 
      
 4 
     | 
    
         
            +
            render "#{@path_prefix}/nav_menu", json: json, page: page
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            page.scroll padding: glib_json_padding_body, childViews: ->(scroll) do
         
     | 
| 
      
 7 
     | 
    
         
            +
              # TODO: Scrape all names from https://material.io/resources/icons
         
     | 
| 
      
 8 
     | 
    
         
            +
              icon_names = [
         
     | 
| 
      
 9 
     | 
    
         
            +
                'info', 'info', 'info', 'info', 'info', 'info', 'info', 'info',
         
     | 
| 
      
 10 
     | 
    
         
            +
                'info', 'info', 'info', 'info', 'info', 'info', 'info', 'info',
         
     | 
| 
      
 11 
     | 
    
         
            +
                'info', 'info', 'info', 'info', 'info', 'info', 'info', 'info',
         
     | 
| 
      
 12 
     | 
    
         
            +
              ]
         
     | 
| 
      
 13 
     | 
    
         
            +
              icon_names.each do |icon_name|
         
     | 
| 
      
 14 
     | 
    
         
            +
                scroll.panels_column lg: { cols: 2 }, childViews: ->(column) do
         
     | 
| 
      
 15 
     | 
    
         
            +
                  column.panels_horizontal align: 'middle', childViews: ->(horizontal) do
         
     | 
| 
      
 16 
     | 
    
         
            +
                    horizontal.icon spec: icon_name
         
     | 
| 
      
 17 
     | 
    
         
            +
                    horizontal.spacer width: 6
         
     | 
| 
      
 18 
     | 
    
         
            +
                    horizontal.label text: icon_name
         
     | 
| 
      
 19 
     | 
    
         
            +
                  end
         
     | 
| 
      
 20 
     | 
    
         
            +
                end
         
     | 
| 
      
 21 
     | 
    
         
            +
              end
         
     | 
| 
      
 22 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -11,10 +11,10 @@ page.scroll padding: glib_json_padding_body, childViews: ->(scroll) do 
     | 
|
| 
       11 
11 
     | 
    
         
             
              scroll.spacer height: 6
         
     | 
| 
       12 
12 
     | 
    
         
             
              scroll.avatar url: glib_json_image_avatar_url
         
     | 
| 
       13 
13 
     | 
    
         | 
| 
       14 
     | 
    
         
            -
              scroll.spacer height: 20
         
     | 
| 
       15 
     | 
    
         
            -
              scroll.h2 text: 'Icon'
         
     | 
| 
       16 
     | 
    
         
            -
              scroll.spacer height: 6
         
     | 
| 
       17 
     | 
    
         
            -
              scroll.icon spec: 'info'
         
     | 
| 
      
 14 
     | 
    
         
            +
              # scroll.spacer height: 20
         
     | 
| 
      
 15 
     | 
    
         
            +
              # scroll.h2 text: 'Icon'
         
     | 
| 
      
 16 
     | 
    
         
            +
              # scroll.spacer height: 6
         
     | 
| 
      
 17 
     | 
    
         
            +
              # scroll.icon spec: 'info'
         
     | 
| 
       18 
18 
     | 
    
         | 
| 
       19 
19 
     | 
    
         
             
              scroll.spacer height: 20
         
     | 
| 
       20 
20 
     | 
    
         
             
              scroll.h2 text: 'Image with base64 data'
         
     | 
| 
         @@ -16,15 +16,15 @@ json_ui_page json do |page| 
     | 
|
| 
       16 
16 
     | 
    
         
             
                    template.thumbnail title: 'Images', onClick: ->(action) do
         
     | 
| 
       17 
17 
     | 
    
         
             
                      action.windows_open url: json_ui_garage_url(path: 'views/images')
         
     | 
| 
       18 
18 
     | 
    
         
             
                    end
         
     | 
| 
       19 
     | 
    
         
            -
                    template.thumbnail title: 'Carousels', onClick: ->(action) do
         
     | 
| 
       20 
     | 
    
         
            -
                      action.windows_open url: json_ui_garage_url(path: 'views/carousels')
         
     | 
| 
       21 
     | 
    
         
            -
                    end
         
     | 
| 
       22 
19 
     | 
    
         
             
                    template.thumbnail title: 'Charts', onClick: ->(action) do
         
     | 
| 
       23 
20 
     | 
    
         
             
                      action.windows_open url: json_ui_garage_url(path: 'views/charts')
         
     | 
| 
       24 
21 
     | 
    
         
             
                    end
         
     | 
| 
       25 
22 
     | 
    
         
             
                    template.thumbnail title: 'Banners', onClick: ->(action) do
         
     | 
| 
       26 
23 
     | 
    
         
             
                      action.windows_open url: json_ui_garage_url(path: 'views/banners')
         
     | 
| 
       27 
24 
     | 
    
         
             
                    end
         
     | 
| 
      
 25 
     | 
    
         
            +
                    template.thumbnail title: 'Icons', onClick: ->(action) do
         
     | 
| 
      
 26 
     | 
    
         
            +
                      action.windows_open url: json_ui_garage_url(path: 'views/icons')
         
     | 
| 
      
 27 
     | 
    
         
            +
                    end
         
     | 
| 
       28 
28 
     | 
    
         
             
                    template.thumbnail title: 'Misc', onClick: ->(action) do
         
     | 
| 
       29 
29 
     | 
    
         
             
                      action.windows_open url: json_ui_garage_url(path: 'views/misc')
         
     | 
| 
       30 
30 
     | 
    
         
             
                    end
         
     | 
    
        data/lib/glib/json_crawler.rb
    CHANGED
    
    | 
         @@ -8,3 +8,4 @@ require_relative './json_crawler/action_crawlers/windows_open' 
     | 
|
| 
       8 
8 
     | 
    
         
             
            require_relative './json_crawler/action_crawlers/action_http'
         
     | 
| 
       9 
9 
     | 
    
         
             
            require_relative './json_crawler/action_crawlers/forms_submit'
         
     | 
| 
       10 
10 
     | 
    
         
             
            require_relative './json_crawler/action_crawlers/menu'
         
     | 
| 
      
 11 
     | 
    
         
            +
            require_relative './json_crawler/action_crawlers/run_multiple'
         
     | 
| 
         @@ -4,11 +4,8 @@ module Glib 
     | 
|
| 
       4 
4 
     | 
    
         
             
                  def initialize(method, http, args, controller)
         
     | 
| 
       5 
5 
     | 
    
         
             
                    @http = http
         
     | 
| 
       6 
6 
     | 
    
         
             
                    json = @http.send(method, args['url'], controller, args.fetch('formData', {}))
         
     | 
| 
       7 
     | 
    
         
            -
             
     | 
| 
       8 
     | 
    
         
            -
                    unless json.nil?
         
     | 
| 
       9 
     | 
    
         
            -
                      click(json)
         
     | 
| 
       10 
     | 
    
         
            -
                    end
         
     | 
| 
      
 7 
     | 
    
         
            +
                    perform(json['onResponse'])
         
     | 
| 
       11 
8 
     | 
    
         
             
                  end
         
     | 
| 
       12 
9 
     | 
    
         
             
                end
         
     | 
| 
       13 
10 
     | 
    
         
             
              end
         
     | 
| 
       14 
     | 
    
         
            -
            end
         
     | 
| 
      
 11 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -31,7 +31,7 @@ module Glib 
     | 
|
| 
       31 
31 
     | 
    
         | 
| 
       32 
32 
     | 
    
         
             
                        include_params = case name
         
     | 
| 
       33 
33 
     | 
    
         
             
                        when 'fields/check', 'fields/check-v1'
         
     | 
| 
       34 
     | 
    
         
            -
                          child[' 
     | 
| 
      
 34 
     | 
    
         
            +
                          child['checkValue'] == child['value']
         
     | 
| 
       35 
35 
     | 
    
         
             
                        else
         
     | 
| 
       36 
36 
     | 
    
         
             
                          true
         
     | 
| 
       37 
37 
     | 
    
         
             
                        end
         
     | 
| 
         @@ -41,7 +41,7 @@ module Glib 
     | 
|
| 
       41 
41 
     | 
    
         
             
                    end
         
     | 
| 
       42 
42 
     | 
    
         | 
| 
       43 
43 
     | 
    
         
             
                    json = @http.patch url, action, params
         
     | 
| 
       44 
     | 
    
         
            -
                     
     | 
| 
      
 44 
     | 
    
         
            +
                    perform(json['onResponse'])
         
     | 
| 
       45 
45 
     | 
    
         
             
                  end
         
     | 
| 
       46 
46 
     | 
    
         
             
                end
         
     | 
| 
       47 
47 
     | 
    
         
             
              end
         
     | 
| 
         @@ -3,6 +3,7 @@ module Glib 
     | 
|
| 
       3 
3 
     | 
    
         
             
                class WindowsOpen < ActionCrawler
         
     | 
| 
       4 
4 
     | 
    
         
             
                  def initialize(http, args, action)
         
     | 
| 
       5 
5 
     | 
    
         
             
                    @http = http
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
       6 
7 
     | 
    
         
             
                    if (url = args['url'])
         
     | 
| 
       7 
8 
     | 
    
         
             
                      json = @http.get(url, action, args.except('url'))
         
     | 
| 
       8 
9 
     | 
    
         | 
| 
         @@ -20,6 +21,8 @@ module Glib 
     | 
|
| 
       20 
21 
     | 
    
         
             
                            click button
         
     | 
| 
       21 
22 
     | 
    
         
             
                          end
         
     | 
| 
       22 
23 
     | 
    
         
             
                        end
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
                        perform(json['onLoad'])
         
     | 
| 
       23 
26 
     | 
    
         
             
                      end
         
     | 
| 
       24 
27 
     | 
    
         
             
                    end
         
     | 
| 
       25 
28 
     | 
    
         
             
                  end
         
     | 
| 
         @@ -19,6 +19,7 @@ module Glib 
     | 
|
| 
       19 
19 
     | 
    
         
             
                  end
         
     | 
| 
       20 
20 
     | 
    
         | 
| 
       21 
21 
     | 
    
         
             
                  def step(http, args)
         
     | 
| 
      
 22 
     | 
    
         
            +
                    # TODO: Refactor
         
     | 
| 
       22 
23 
     | 
    
         
             
                    case args['view']
         
     | 
| 
       23 
24 
     | 
    
         
             
                    when 'fields/submit-v1', 'fields/submit'
         
     | 
| 
       24 
25 
     | 
    
         
             
                      @depth += 1
         
     | 
| 
         @@ -29,40 +30,45 @@ module Glib 
     | 
|
| 
       29 
30 
     | 
    
         
             
                    end
         
     | 
| 
       30 
31 
     | 
    
         | 
| 
       31 
32 
     | 
    
         
             
                    if args.is_a?(Hash) && args['rel'] != 'nofollow'
         
     | 
| 
       32 
     | 
    
         
            -
                      if (onClick = (args.fetch('onClick', nil) 
     | 
| 
       33 
     | 
    
         
            -
                         
     | 
| 
       34 
     | 
    
         
            -
                        params = onClick
         
     | 
| 
      
 33 
     | 
    
         
            +
                      if (onClick = (args.fetch('onClick', nil)))
         
     | 
| 
      
 34 
     | 
    
         
            +
                        process_action(http, onClick)
         
     | 
| 
       35 
35 
     | 
    
         
             
                      end
         
     | 
| 
      
 36 
     | 
    
         
            +
                    end
         
     | 
| 
      
 37 
     | 
    
         
            +
                  end
         
     | 
| 
       36 
38 
     | 
    
         | 
| 
       37 
     | 
    
         
            -
             
     | 
| 
       38 
     | 
    
         
            -
             
     | 
| 
       39 
     | 
    
         
            -
             
     | 
| 
       40 
     | 
    
         
            -
             
     | 
| 
       41 
     | 
    
         
            -
             
     | 
| 
       42 
     | 
    
         
            -
             
     | 
| 
       43 
     | 
    
         
            -
             
     | 
| 
      
 39 
     | 
    
         
            +
                  def process_action(http, spec)
         
     | 
| 
      
 40 
     | 
    
         
            +
                    action = spec['action']
         
     | 
| 
      
 41 
     | 
    
         
            +
                    params = spec
         
     | 
| 
      
 42 
     | 
    
         
            +
             
     | 
| 
      
 43 
     | 
    
         
            +
                    if action.present?
         
     | 
| 
      
 44 
     | 
    
         
            +
                      @depth += 1
         
     | 
| 
      
 45 
     | 
    
         
            +
                      case action
         
     | 
| 
      
 46 
     | 
    
         
            +
                      when 'initiate_navigation'
         
     | 
| 
      
 47 
     | 
    
         
            +
                        @read_only_actions.add([action, params['url']])
         
     | 
| 
      
 48 
     | 
    
         
            +
                        JsonCrawler::NavInitiate.new(http, params, action)
         
     | 
| 
      
 49 
     | 
    
         
            +
                      when 'runMultiple-v1', 'runMultiple'
         
     | 
| 
      
 50 
     | 
    
         
            +
                        JsonCrawler::RunMultiple.new(http, params, action)
         
     | 
| 
      
 51 
     | 
    
         
            +
                      when 'windows/open-v1', 'dialogs/open-v1', 'windows/reload-v1', 'windows/open', 'dialogs/open', 'windows/reload'
         
     | 
| 
      
 52 
     | 
    
         
            +
                        @read_only_actions.add([action, params['url']])
         
     | 
| 
      
 53 
     | 
    
         
            +
                        JsonCrawler::WindowsOpen.new(http, params, action)
         
     | 
| 
      
 54 
     | 
    
         
            +
                      when 'sheets/select-v1', 'sheets/select'
         
     | 
| 
      
 55 
     | 
    
         
            +
                        JsonCrawler::Menu.new(http, params, action)
         
     | 
| 
      
 56 
     | 
    
         
            +
                      when 'http/post-v1', 'http/post'
         
     | 
| 
      
 57 
     | 
    
         
            +
                        JsonCrawler::ActionHttp.new(:post, http, params, action)
         
     | 
| 
      
 58 
     | 
    
         
            +
                      when 'forms/submit-v1', 'forms/submit'
         
     | 
| 
      
 59 
     | 
    
         
            +
                        forms = @visitor.forms
         
     | 
| 
      
 60 
     | 
    
         
            +
                        # raise 'Submit action needs to be inside a form' if forms.size < 1
         
     | 
| 
      
 61 
     | 
    
         
            +
                        JsonCrawler::FormsSubmit.new(http, forms.last)
         
     | 
| 
      
 62 
     | 
    
         
            +
                      else
         
     | 
| 
      
 63 
     | 
    
         
            +
                        unless [
         
     | 
| 
      
 64 
     | 
    
         
            +
                          'http/delete-v1', 'dialogs/oauth-v1', 'windows/openWeb-v1',
         
     | 
| 
      
 65 
     | 
    
         
            +
                          'http/delete', 'dialogs/oauth', 'windows/openWeb'
         
     | 
| 
      
 66 
     | 
    
         
            +
                        ].include?(action)
         
     | 
| 
       44 
67 
     | 
    
         
             
                          @read_only_actions.add([action, params['url']])
         
     | 
| 
       45 
     | 
    
         
            -
                          JsonCrawler::WindowsOpen.new(http, params, action)
         
     | 
| 
       46 
     | 
    
         
            -
                        when 'sheets/select-v1', 'sheets/select'
         
     | 
| 
       47 
     | 
    
         
            -
                          JsonCrawler::Menu.new(http, params, action)
         
     | 
| 
       48 
     | 
    
         
            -
                        when 'http/post-v1', 'http/post'
         
     | 
| 
       49 
     | 
    
         
            -
                          JsonCrawler::ActionHttp.new(:post, http, params, action)
         
     | 
| 
       50 
     | 
    
         
            -
                        when 'forms/submit-v1', 'forms/submit'
         
     | 
| 
       51 
     | 
    
         
            -
                          forms = @visitor.forms
         
     | 
| 
       52 
     | 
    
         
            -
                          # raise 'Submit action needs to be inside a form' if forms.size < 1
         
     | 
| 
       53 
     | 
    
         
            -
                          JsonCrawler::FormsSubmit.new(http, forms.last)
         
     | 
| 
       54 
     | 
    
         
            -
                        else
         
     | 
| 
       55 
     | 
    
         
            -
                          unless [
         
     | 
| 
       56 
     | 
    
         
            -
                            'http/delete-v1', 'dialogs/oauth-v1', 'windows/openWeb-v1',
         
     | 
| 
       57 
     | 
    
         
            -
                            'http/delete', 'dialogs/oauth', 'windows/openWeb'
         
     | 
| 
       58 
     | 
    
         
            -
                          ].include?(action)
         
     | 
| 
       59 
     | 
    
         
            -
                            @read_only_actions.add([action, params['url']])
         
     | 
| 
       60 
     | 
    
         
            -
                          end
         
     | 
| 
       61 
     | 
    
         
            -
                          self.log action, params['url']
         
     | 
| 
       62 
68 
     | 
    
         
             
                        end
         
     | 
| 
       63 
     | 
    
         
            -
                         
     | 
| 
       64 
     | 
    
         
            -
                        # child
         
     | 
| 
      
 69 
     | 
    
         
            +
                        self.log action, params['url']
         
     | 
| 
       65 
70 
     | 
    
         
             
                      end
         
     | 
| 
      
 71 
     | 
    
         
            +
                      @depth -= 1
         
     | 
| 
       66 
72 
     | 
    
         
             
                    end
         
     | 
| 
       67 
73 
     | 
    
         
             
                  end
         
     | 
| 
       68 
74 
     | 
    
         | 
    
        data/lib/glib/test_helpers.rb
    CHANGED
    
    | 
         @@ -20,21 +20,21 @@ module Glib 
     | 
|
| 
       20 
20 
     | 
    
         
             
                    end
         
     | 
| 
       21 
21 
     | 
    
         
             
                    @__log_dir
         
     | 
| 
       22 
22 
     | 
    
         
             
                  end
         
     | 
| 
       23 
     | 
    
         
            -
             
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
       24 
24 
     | 
    
         
             
                  def __log_file
         
     | 
| 
       25 
25 
     | 
    
         
             
                    @__log_file ||= "#{self.method_name}.json"
         
     | 
| 
       26 
26 
     | 
    
         
             
                  end
         
     | 
| 
       27 
     | 
    
         
            -
             
     | 
| 
      
 27 
     | 
    
         
            +
             
     | 
| 
       28 
28 
     | 
    
         
             
                  def __log json
         
     | 
| 
       29 
29 
     | 
    
         
             
                    File.open("#{File.join(__log_dir, __log_file)}", "w") do |f|
         
     | 
| 
       30 
30 
     | 
    
         
             
                      f << JSON.pretty_generate( JSON.parse(json) )
         
     | 
| 
       31 
31 
     | 
    
         
             
                    end
         
     | 
| 
       32 
32 
     | 
    
         
             
                    json
         
     | 
| 
       33 
33 
     | 
    
         
             
                  end
         
     | 
| 
       34 
     | 
    
         
            -
             
     | 
| 
      
 34 
     | 
    
         
            +
             
     | 
| 
       35 
35 
     | 
    
         
             
                  def __get_previous_result_from_git
         
     | 
| 
       36 
36 
     | 
    
         
             
                    `git checkout -- "#{File.join(__log_dir, __log_file)}" > /dev/null 2>&1` if __git_is_available?
         
     | 
| 
       37 
     | 
    
         
            -
                    File. 
     | 
| 
      
 37 
     | 
    
         
            +
                    File.exist?(File.join(__log_dir, __log_file)) ? File.open(File.join(__log_dir, __log_file)).read : "\{\}"
         
     | 
| 
       38 
38 
     | 
    
         
             
                  end
         
     | 
| 
       39 
39 
     | 
    
         
             
              end
         
     | 
| 
       40 
40 
     | 
    
         
             
            end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: glib-web
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0.5. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.5.12
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - ''
         
     | 
| 
         @@ -98,6 +98,7 @@ files: 
     | 
|
| 
       98 
98 
     | 
    
         
             
            - app/helpers/glib/json_ui/view_builder/charts.rb
         
     | 
| 
       99 
99 
     | 
    
         
             
            - app/helpers/glib/json_ui/view_builder/fields.rb
         
     | 
| 
       100 
100 
     | 
    
         
             
            - app/helpers/glib/json_ui/view_builder/panels.rb
         
     | 
| 
      
 101 
     | 
    
         
            +
            - app/helpers/glib/urls_helper.rb
         
     | 
| 
       101 
102 
     | 
    
         
             
            - app/models/glib/active_storage/attachment.rb
         
     | 
| 
       102 
103 
     | 
    
         
             
            - app/models/glib/active_storage/blob.rb
         
     | 
| 
       103 
104 
     | 
    
         
             
            - app/models/glib/dynamic_text_record.rb
         
     | 
| 
         @@ -157,6 +158,7 @@ files: 
     | 
|
| 
       157 
158 
     | 
    
         
             
            - app/views/json_ui/garage/pages/layout.json.jbuilder
         
     | 
| 
       158 
159 
     | 
    
         
             
            - app/views/json_ui/garage/pages/loading_indicator.json.jbuilder
         
     | 
| 
       159 
160 
     | 
    
         
             
            - app/views/json_ui/garage/pages/nav_buttons.json.jbuilder
         
     | 
| 
      
 161 
     | 
    
         
            +
            - app/views/json_ui/garage/pages/nested_scroll.json.jbuilder
         
     | 
| 
       160 
162 
     | 
    
         
             
            - app/views/json_ui/garage/pages/tab_bar.json.jbuilder
         
     | 
| 
       161 
163 
     | 
    
         
             
            - app/views/json_ui/garage/panels/_styled.json.jbuilder
         
     | 
| 
       162 
164 
     | 
    
         
             
            - app/views/json_ui/garage/panels/card.json.jbuilder
         
     | 
| 
         @@ -182,8 +184,8 @@ files: 
     | 
|
| 
       182 
184 
     | 
    
         
             
            - app/views/json_ui/garage/views/_chart_data.json.jbuilder
         
     | 
| 
       183 
185 
     | 
    
         
             
            - app/views/json_ui/garage/views/banners.json.jbuilder
         
     | 
| 
       184 
186 
     | 
    
         
             
            - app/views/json_ui/garage/views/calendar_data.json.jbuilder
         
     | 
| 
       185 
     | 
    
         
            -
            - app/views/json_ui/garage/views/carousels.json.jbuilder
         
     | 
| 
       186 
187 
     | 
    
         
             
            - app/views/json_ui/garage/views/charts.json.jbuilder
         
     | 
| 
      
 188 
     | 
    
         
            +
            - app/views/json_ui/garage/views/icons.json.jbuilder
         
     | 
| 
       187 
189 
     | 
    
         
             
            - app/views/json_ui/garage/views/images.json.jbuilder
         
     | 
| 
       188 
190 
     | 
    
         
             
            - app/views/json_ui/garage/views/index.json.jbuilder
         
     | 
| 
       189 
191 
     | 
    
         
             
            - app/views/json_ui/garage/views/links.json.jbuilder
         
     | 
| 
         @@ -212,6 +214,7 @@ files: 
     | 
|
| 
       212 
214 
     | 
    
         
             
            - lib/glib/json_crawler/action_crawlers/forms_submit.rb
         
     | 
| 
       213 
215 
     | 
    
         
             
            - lib/glib/json_crawler/action_crawlers/menu.rb
         
     | 
| 
       214 
216 
     | 
    
         
             
            - lib/glib/json_crawler/action_crawlers/nav_initiate.rb
         
     | 
| 
      
 217 
     | 
    
         
            +
            - lib/glib/json_crawler/action_crawlers/run_multiple.rb
         
     | 
| 
       215 
218 
     | 
    
         
             
            - lib/glib/json_crawler/action_crawlers/windows_open.rb
         
     | 
| 
       216 
219 
     | 
    
         
             
            - lib/glib/json_crawler/coverage.rb
         
     | 
| 
       217 
220 
     | 
    
         
             
            - lib/glib/json_crawler/http.rb
         
     | 
| 
         @@ -1,37 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            json.title 'Views'
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
     | 
    
         
            -
            image_url1 = 'http://ichef.bbci.co.uk/news/976/cpsprodpb/18106/production/_97266589_gettyimages-474547165.jpg'
         
     | 
| 
       4 
     | 
    
         
            -
            image_url2 = 'https://s.abcnews.com/images/International/Guam03-gty-jrl-170809_16x9_992.jpg'
         
     | 
| 
       5 
     | 
    
         
            -
             
     | 
| 
       6 
     | 
    
         
            -
            json_ui_page json do |page|
         
     | 
| 
       7 
     | 
    
         
            -
              render "#{@path_prefix}/nav_menu", json: json, page: page
         
     | 
| 
       8 
     | 
    
         
            -
              
         
     | 
| 
       9 
     | 
    
         
            -
              page.scroll childViews: ->(scroll) do
         
     | 
| 
       10 
     | 
    
         
            -
                scroll.label text: "\n"
         
     | 
| 
       11 
     | 
    
         
            -
                scroll.h1 text: 'Carousel with labels'
         
     | 
| 
       12 
     | 
    
         
            -
                scroll.panels_carousel width: 'matchParent', childViews: ->(carousel) do
         
     | 
| 
       13 
     | 
    
         
            -
                  carousel.label text: 'Item 1'
         
     | 
| 
       14 
     | 
    
         
            -
                  carousel.label text: 'Item 2'
         
     | 
| 
       15 
     | 
    
         
            -
                end
         
     | 
| 
       16 
     | 
    
         
            -
             
     | 
| 
       17 
     | 
    
         
            -
                scroll.label text: "\n"
         
     | 
| 
       18 
     | 
    
         
            -
                scroll.h1 text: 'Carousel with images'
         
     | 
| 
       19 
     | 
    
         
            -
                scroll.panels_carousel width: 'matchParent', childViews: ->(carousel) do
         
     | 
| 
       20 
     | 
    
         
            -
                  carousel.image url: image_url1, width: 'matchParent'
         
     | 
| 
       21 
     | 
    
         
            -
                  carousel.image url: image_url2, width: 'matchParent'
         
     | 
| 
       22 
     | 
    
         
            -
                end
         
     | 
| 
       23 
     | 
    
         
            -
             
     | 
| 
       24 
     | 
    
         
            -
                scroll.label text: "\n"
         
     | 
| 
       25 
     | 
    
         
            -
                scroll.h1 text: 'Carousel with complex layout'
         
     | 
| 
       26 
     | 
    
         
            -
                scroll.panels_carousel width: 'matchParent', childViews: ->(carousel) do
         
     | 
| 
       27 
     | 
    
         
            -
                  carousel.panels_vertical childViews: ->(panel) do
         
     | 
| 
       28 
     | 
    
         
            -
                    panel.h3 text: 'Item 1'
         
     | 
| 
       29 
     | 
    
         
            -
                    panel.image url: image_url1, width: 'matchParent'
         
     | 
| 
       30 
     | 
    
         
            -
                  end
         
     | 
| 
       31 
     | 
    
         
            -
                  carousel.panels_vertical childViews: ->(panel) do
         
     | 
| 
       32 
     | 
    
         
            -
                    panel.h3 text: 'Item 2'
         
     | 
| 
       33 
     | 
    
         
            -
                    panel.image url: image_url2, width: 'matchParent'
         
     | 
| 
       34 
     | 
    
         
            -
                  end
         
     | 
| 
       35 
     | 
    
         
            -
                end
         
     | 
| 
       36 
     | 
    
         
            -
              end
         
     | 
| 
       37 
     | 
    
         
            -
            end
         
     |