glib-web 0.4.62 → 0.4.63
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/libs.rb +3 -1
- data/app/controllers/concerns/glib/json/ui.rb +10 -12
- data/app/helpers/glib/json_ui/abstract_builder.rb +16 -6
- data/app/helpers/glib/json_ui/view_builder.rb +1 -0
- data/app/views/json_ui/garage/views/markdowns.json.jbuilder +13 -2
- data/lib/glib/json_crawler/router.rb +1 -10
- metadata +1 -1
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 476424036977faf25b0358602efe85377258d2f6
         | 
| 4 | 
            +
              data.tar.gz: d0e7c51ee8a6bc550d91251fd0a178821d5b15b9
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: b81e49f36b5c37d4cd0b5058b8047c956f7d253a15e436aa514d1b10084a1aa4e7e61dfc3384f3abdac0d08dc756986d3ee3a815b2c448e48153ef618932e8db
         | 
| 7 | 
            +
              data.tar.gz: 740a4c70fdb8d48f9ce39c4109f71cd75dd132bc7731fe8abd454d816dd7a77df389a5d20f56ca106196636afc06ea591565d9c3e70dfc7220c257d3f447fc03
         | 
| @@ -58,7 +58,9 @@ module Glib::Json::Libs | |
| 58 58 | 
             
                  include Glib::Json::Traversal
         | 
| 59 59 | 
             
                  include Glib::Json::NewDynamicText
         | 
| 60 60 |  | 
| 61 | 
            -
                  before_action  | 
| 61 | 
            +
                  before_action do
         | 
| 62 | 
            +
                    __json_ui_start(options)
         | 
| 63 | 
            +
                  end
         | 
| 62 64 |  | 
| 63 65 | 
             
                  # Note that after_action gets executed in reverse
         | 
| 64 66 | 
             
                  after_action do
         | 
| @@ -31,15 +31,15 @@ module Glib::Json::Ui | |
| 31 31 | 
             
                @__json_ui_activated
         | 
| 32 32 | 
             
              end
         | 
| 33 33 |  | 
| 34 | 
            -
              def __json_ui_start
         | 
| 34 | 
            +
              def __json_ui_start(options)
         | 
| 35 35 | 
             
                @__json_ui_activated = false
         | 
| 36 | 
            -
                @__json_ui_rendering =  | 
| 37 | 
            -
                if params[:_render] | 
| 36 | 
            +
                @__json_ui_rendering = nil
         | 
| 37 | 
            +
                if options[:when] == :always || params[:_render] == 'v1'
         | 
| 38 38 | 
             
                  @__json_ui_activated = true
         | 
| 39 39 | 
             
                  request.variant = :ui
         | 
| 40 40 |  | 
| 41 41 | 
             
                  if request.format.html? && params[:_skip_render] != 'true'
         | 
| 42 | 
            -
                    @__json_ui_rendering =  | 
| 42 | 
            +
                    @__json_ui_rendering = :vue
         | 
| 43 43 | 
             
                    request.format = 'json'
         | 
| 44 44 | 
             
                  end
         | 
| 45 45 | 
             
                end
         | 
| @@ -48,14 +48,12 @@ module Glib::Json::Ui | |
| 48 48 | 
             
              def __json_ui_commit(options)
         | 
| 49 49 | 
             
                return if response.status >= 300
         | 
| 50 50 |  | 
| 51 | 
            -
                 | 
| 52 | 
            -
             | 
| 53 | 
            -
                   | 
| 54 | 
            -
                     | 
| 55 | 
            -
             | 
| 56 | 
            -
                     | 
| 57 | 
            -
                      raise "Invalid JSON UI payload: #{hash}"
         | 
| 58 | 
            -
                    end
         | 
| 51 | 
            +
                case @__json_ui_rendering
         | 
| 52 | 
            +
                when :vue
         | 
| 53 | 
            +
                  if (hash = json_transformation_start).is_a?(Hash)
         | 
| 54 | 
            +
                    __json_ui_vue(hash, options)
         | 
| 55 | 
            +
                  else
         | 
| 56 | 
            +
                    raise "Invalid JSON UI payload: #{hash}"
         | 
| 59 57 | 
             
                  end
         | 
| 60 58 | 
             
                end
         | 
| 61 59 | 
             
              end
         | 
| @@ -189,13 +189,23 @@ module Glib | |
| 189 189 | 
             
                      end
         | 
| 190 190 |  | 
| 191 191 | 
             
                      json.set!(propName) do
         | 
| 192 | 
            -
                         | 
| 193 | 
            -
             | 
| 192 | 
            +
                        if name
         | 
| 193 | 
            +
                          data[:material] ||= {}
         | 
| 194 | 
            +
                          data[:material][:name] = name 
         | 
| 195 | 
            +
                        end
         | 
| 194 196 |  | 
| 195 | 
            -
                        material = data[:material]
         | 
| 196 | 
            -
             | 
| 197 | 
            -
             | 
| 198 | 
            -
             | 
| 197 | 
            +
                        if (material = data[:material])
         | 
| 198 | 
            +
                          json.material do
         | 
| 199 | 
            +
                            json.name material[:name]
         | 
| 200 | 
            +
                            json.size material[:size] if material[:size]
         | 
| 201 | 
            +
                          end
         | 
| 202 | 
            +
                        end
         | 
| 203 | 
            +
             | 
| 204 | 
            +
                        if (fa = data[:fa])
         | 
| 205 | 
            +
                          json.fa do
         | 
| 206 | 
            +
                            json.name fa[:name]
         | 
| 207 | 
            +
                            json.size fa[:size] if fa[:size]
         | 
| 208 | 
            +
                          end
         | 
| 199 209 | 
             
                        end
         | 
| 200 210 |  | 
| 201 211 | 
             
                        if (custom = data[:custom])
         | 
| @@ -5,7 +5,7 @@ json_ui_page json do |page| | |
| 5 5 |  | 
| 6 6 | 
             
              page.scroll padding: glib_json_padding_body, childViews: ->(scroll) do
         | 
| 7 7 | 
             
                scroll.spacer height: 20
         | 
| 8 | 
            -
                scroll.h2 text: ' | 
| 8 | 
            +
                scroll.h2 text: 'Markdown'
         | 
| 9 9 | 
             
                scroll.spacer height: 6
         | 
| 10 10 | 
             
                scroll.markdown text:
         | 
| 11 11 | 
             
                  '# h1 Heading' + "\n" +
         | 
| @@ -25,6 +25,17 @@ json_ui_page json do |page| | |
| 25 25 | 
             
                  "\n" +
         | 
| 26 26 | 
             
                  '_This is italic text_' + "\n" +
         | 
| 27 27 | 
             
                  "\n" +
         | 
| 28 | 
            -
                  '~~Strikethrough~~' + "\n"
         | 
| 28 | 
            +
                  '~~Strikethrough~~' + "\n" +
         | 
| 29 | 
            +
                  "\n" +
         | 
| 30 | 
            +
                  'https://www.google.com' + "\n"
         | 
| 31 | 
            +
             | 
| 32 | 
            +
                scroll.spacer height: 20
         | 
| 33 | 
            +
                scroll.h2 text: 'Markdown with preview (Web Only)'
         | 
| 34 | 
            +
                scroll.spacer height: 6
         | 
| 35 | 
            +
                scroll.markdown text: 'Here is the video: https://www.youtube.com/watch?v=947op8yKJRY', previewVideo: true
         | 
| 36 | 
            +
             | 
| 37 | 
            +
                scroll.spacer height: 10
         | 
| 38 | 
            +
                scroll.markdown text: 'Some videos: https://youtu.be/ATnpEOo3GJA, https://www.youtube.com/watch?v=947op8yKJRY', previewVideo: true
         | 
| 39 | 
            +
             | 
| 29 40 | 
             
              end
         | 
| 30 41 | 
             
            end
         | 
| @@ -15,9 +15,6 @@ module Glib | |
| 15 15 | 
             
                    @depth = -1
         | 
| 16 16 | 
             
                    @logger = logger
         | 
| 17 17 | 
             
                    @visitor = Glib::Json::Traversal::Visitor.new
         | 
| 18 | 
            -
             | 
| 19 | 
            -
                    # @store_action = store_action
         | 
| 20 | 
            -
             | 
| 21 18 | 
             
                    @read_only_actions = Set.new
         | 
| 22 19 | 
             
                  end
         | 
| 23 20 |  | 
| @@ -36,15 +33,10 @@ module Glib | |
| 36 33 | 
             
                        @depth += 1
         | 
| 37 34 | 
             
                        child = case action
         | 
| 38 35 | 
             
                        when 'initiate_navigation'
         | 
| 39 | 
            -
                          # @@crawler_actions.add([action, params['url']]) if @@store_action
         | 
| 40 36 | 
             
                          @read_only_actions.add([action, params['url']])
         | 
| 41 37 | 
             
                          JsonCrawler::NavInitiate.new(http, params, action)
         | 
| 42 38 | 
             
                        when 'windows/open-v1', 'dialogs/open-v1', 'windows/reload-v1'
         | 
| 43 | 
            -
                           | 
| 44 | 
            -
                          # unless action == 'dialogs/open-v1'
         | 
| 45 | 
            -
                            # @@crawler_actions.add([action, params['url']]) if @@store_action
         | 
| 46 | 
            -
                            @read_only_actions.add([action, params['url']])
         | 
| 47 | 
            -
                          # end
         | 
| 39 | 
            +
                          @read_only_actions.add([action, params['url']])
         | 
| 48 40 | 
             
                          JsonCrawler::WindowsOpen.new(http, params, action)
         | 
| 49 41 | 
             
                        when 'http/post-v1'
         | 
| 50 42 | 
             
                          JsonCrawler::ActionHttp.new(:post, http, params, action)
         | 
| @@ -54,7 +46,6 @@ module Glib | |
| 54 46 | 
             
                          JsonCrawler::FormsSubmit.new(http, params, action, forms.last)
         | 
| 55 47 | 
             
                        else
         | 
| 56 48 | 
             
                          unless ['http/delete-v1', 'dialogs/oauth-v1', 'windows/openWeb-v1'].include?(action)
         | 
| 57 | 
            -
                            # @@crawler_actions.add([action, params['url']]) if @@store_action
         | 
| 58 49 | 
             
                            @read_only_actions.add([action, params['url']])
         | 
| 59 50 | 
             
                          end
         | 
| 60 51 | 
             
                          self.log action, params['url']
         |