glib-web 0.4.40 → 0.4.41
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/auth/policy.rb +2 -2
 - data/app/helpers/glib/json_ui/abstract_builder.rb +5 -3
 - data/app/helpers/glib/json_ui/view_builder.rb +2 -1
 - data/app/policies/glib/application_policy.rb +1 -1
 - data/app/views/json_ui/garage/forms/show_hide.json.jbuilder +41 -0
 - data/app/views/json_ui/garage/lists/templating.json.jbuilder +5 -0
 - data/app/views/json_ui/garage/views/images.json.jbuilder +1 -1
 - data/app/views/json_ui/garage/views/links.json.jbuilder +2 -2
 - data/lib/tasks/db.rake +6 -5
 - metadata +2 -1
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: b5e3c30b02e6f8f6a325e4b6e4629b4eb9ecd7de
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 97ba4424710d6af68995b1b3e8ccd0483eb9554b
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 96fadbbe94cb50c33662aa4ef5fa820692bb1099bed289fc1d719c122093087f3143befd394da4f89966736d818a07ecbb7762951f16f93705495b77a8b5aaf3
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 6fca6c1d9b07efa17a8c5078da7160b0b46a23cd6328e52ce498944e91ecc968f240935b35b6a8a507dc472f5dab8becc3abb4f1d0255b6926ed8220b36fd21d
         
     | 
| 
         @@ -96,14 +96,14 @@ module Glib::Auth 
     | 
|
| 
       96 
96 
     | 
    
         | 
| 
       97 
97 
     | 
    
         
             
                module ClassMethods
         
     | 
| 
       98 
98 
     | 
    
         
             
                  def glib_auth_init
         
     | 
| 
       99 
     | 
    
         
            -
                     
     | 
| 
      
 99 
     | 
    
         
            +
                    @@__glib_auth_init = true
         
     | 
| 
       100 
100 
     | 
    
         | 
| 
       101 
101 
     | 
    
         
             
                    before_action :glib_load_resource
         
     | 
| 
       102 
102 
     | 
    
         
             
                    before_action :glib_authorize_resource
         
     | 
| 
       103 
103 
     | 
    
         
             
                  end
         
     | 
| 
       104 
104 
     | 
    
         | 
| 
       105 
105 
     | 
    
         
             
                  def glib_auth_inited?
         
     | 
| 
       106 
     | 
    
         
            -
                     
     | 
| 
      
 106 
     | 
    
         
            +
                    @@__glib_auth_init ||= false
         
     | 
| 
       107 
107 
     | 
    
         
             
                  end
         
     | 
| 
       108 
108 
     | 
    
         | 
| 
       109 
109 
     | 
    
         
             
                  # TODO: Consider deprecating
         
     | 
| 
         @@ -19,7 +19,7 @@ module Glib 
     | 
|
| 
       19 
19 
     | 
    
         
             
                      args = [yield] if block_given?
         
     | 
| 
       20 
20 
     | 
    
         | 
| 
       21 
21 
     | 
    
         
             
                      # TODO: consider caching these instances
         
     | 
| 
       22 
     | 
    
         
            -
                      "#{self.class.name}::#{name_components.map{ |str| capitalize_first_letter_and_leave_others_alone(str) }.join('::')}".constantize.new(json, @page). 
     | 
| 
      
 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 
25 
     | 
    
         
             
                    def add_element_to_array type, name, *args
         
     | 
| 
         @@ -33,7 +33,7 @@ module Glib 
     | 
|
| 
       33 
33 
     | 
    
         
             
                      name_components = name.to_s.split('_')
         
     | 
| 
       34 
34 
     | 
    
         
             
                      json.set! type, "#{name_components.join('/')}-v1" if type
         
     | 
| 
       35 
35 
     | 
    
         
             
                      args = [yield] if block_given?
         
     | 
| 
       36 
     | 
    
         
            -
                      "#{self.class.name}::#{name_components.map{ |str| capitalize_first_letter_and_leave_others_alone(str) }.join('::')}".constantize.new(json, @page). 
     | 
| 
      
 36 
     | 
    
         
            +
                      "#{self.class.name}::#{name_components.map{ |str| capitalize_first_letter_and_leave_others_alone(str) }.join('::')}".constantize.new(json, @page).props(*args)
         
     | 
| 
       37 
37 
     | 
    
         
             
                    end
         
     | 
| 
       38 
38 
     | 
    
         | 
| 
       39 
39 
     | 
    
         
             
                    # TODO: Consider removing this in favour of non 'v1' suffix
         
     | 
| 
         @@ -53,13 +53,15 @@ module Glib 
     | 
|
| 
       53 
53 
     | 
    
         
             
                    @page = page
         
     | 
| 
       54 
54 
     | 
    
         
             
                  end
         
     | 
| 
       55 
55 
     | 
    
         | 
| 
       56 
     | 
    
         
            -
                  def  
     | 
| 
      
 56 
     | 
    
         
            +
                  def props(args = {})
         
     | 
| 
       57 
57 
     | 
    
         
             
                    @args = args
         
     | 
| 
       58 
58 
     | 
    
         | 
| 
       59 
59 
     | 
    
         
             
                    if args.is_a? Hash
         
     | 
| 
       60 
60 
     | 
    
         
             
                      args.each do |k, v|
         
     | 
| 
       61 
61 
     | 
    
         
             
                        send(k, v)
         
     | 
| 
       62 
62 
     | 
    
         
             
                      end
         
     | 
| 
      
 63 
     | 
    
         
            +
                    else
         
     | 
| 
      
 64 
     | 
    
         
            +
                      raise "Invalid properties: #{args}"
         
     | 
| 
       63 
65 
     | 
    
         
             
                    end
         
     | 
| 
       64 
66 
     | 
    
         | 
| 
       65 
67 
     | 
    
         
             
                    created
         
     | 
| 
         @@ -26,6 +26,7 @@ module Glib 
     | 
|
| 
       26 
26 
     | 
    
         
             
                    hash :padding
         
     | 
| 
       27 
27 
     | 
    
         
             
                    # array :styleClasses
         
     | 
| 
       28 
28 
     | 
    
         
             
                    singleton_array :styleClass, :styleClasses
         
     | 
| 
      
 29 
     | 
    
         
            +
                    hash :showIf
         
     | 
| 
       29 
30 
     | 
    
         | 
| 
       30 
31 
     | 
    
         
             
                    def analytics(value)
         
     | 
| 
       31 
32 
     | 
    
         
             
                      if value.is_a?(String)
         
     | 
| 
         @@ -100,7 +101,7 @@ module Glib 
     | 
|
| 
       100 
101 
     | 
    
         
             
                  end
         
     | 
| 
       101 
102 
     | 
    
         | 
| 
       102 
103 
     | 
    
         
             
                  class Icon < View
         
     | 
| 
       103 
     | 
    
         
            -
                     
     | 
| 
      
 104 
     | 
    
         
            +
                    icon :spec
         
     | 
| 
       104 
105 
     | 
    
         
             
                    action :onClick
         
     | 
| 
       105 
106 
     | 
    
         
             
                  end
         
     | 
| 
       106 
107 
     | 
    
         | 
| 
         @@ -24,7 +24,7 @@ module Glib 
     | 
|
| 
       24 
24 
     | 
    
         
             
                  private  # Used by child
         
     | 
| 
       25 
25 
     | 
    
         
             
                  def authorize(*actions, &block)
         
     | 
| 
       26 
26 
     | 
    
         
             
                    actions.each do |action|
         
     | 
| 
       27 
     | 
    
         
            -
                      if action == : 
     | 
| 
      
 27 
     | 
    
         
            +
                      if action == :glib_all
         
     | 
| 
       28 
28 
     | 
    
         
             
                        # Serve as a catch-all to all actions that have not been specified in the policy.
         
     | 
| 
       29 
29 
     | 
    
         
             
                        @catch_all = block
         
     | 
| 
       30 
30 
     | 
    
         
             
                      else
         
     | 
| 
         @@ -0,0 +1,41 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            json.title 'Forms'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            page = json_ui_page json
         
     | 
| 
      
 4 
     | 
    
         
            +
            render "#{@path_prefix}/nav_menu", json: json, page: page
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            page.form url: json_ui_garage_url(path: 'forms/basic_post'), method: 'post', padding: glib_json_padding_body, childViews: ->(form) do
         
     | 
| 
      
 7 
     | 
    
         
            +
              form.h1 text: 'Initially Off'
         
     | 
| 
      
 8 
     | 
    
         
            +
              form.fields_check name: 'switch_a', value: 'on', label: 'Switch A'
         
     | 
| 
      
 9 
     | 
    
         
            +
              form.spacer height: 10
         
     | 
| 
      
 10 
     | 
    
         
            +
              form.label text: 'Visible If', showIf: {
         
     | 
| 
      
 11 
     | 
    
         
            +
                "==": [
         
     | 
| 
      
 12 
     | 
    
         
            +
                  {
         
     | 
| 
      
 13 
     | 
    
         
            +
                    "var": "switch_a"
         
     | 
| 
      
 14 
     | 
    
         
            +
                  },
         
     | 
| 
      
 15 
     | 
    
         
            +
                  "on"
         
     | 
| 
      
 16 
     | 
    
         
            +
                ]
         
     | 
| 
      
 17 
     | 
    
         
            +
              }
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
              # form.fields_text name: 'user[name]', width: 'matchParent', label: 'Name'
         
     | 
| 
      
 20 
     | 
    
         
            +
              # form.fields_password name: 'user[password]', width: 'matchParent', label: 'Password'
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
              # # form.panels_split width: 'matchParent', leftViews: ->(split) do
         
     | 
| 
      
 23 
     | 
    
         
            +
              # #   if params[:mode] == 'dialog'
         
     | 
| 
      
 24 
     | 
    
         
            +
              # #     split.button styleClass: 'link', text: 'cancel', onClick: ->(action) { action.dialogs_close }
         
     | 
| 
      
 25 
     | 
    
         
            +
              # #   end
         
     | 
| 
      
 26 
     | 
    
         
            +
              # # end, rightViews: ->(split) do
         
     | 
| 
      
 27 
     | 
    
         
            +
              # #   split.button text: 'Submit', onClick: ->(action) { action.forms_submit }
         
     | 
| 
      
 28 
     | 
    
         
            +
              # # end
         
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
      
 30 
     | 
    
         
            +
              # form.panels_split width: 'matchParent', content: ->(split) do
         
     | 
| 
      
 31 
     | 
    
         
            +
              #   split.left childViews: ->(left) do
         
     | 
| 
      
 32 
     | 
    
         
            +
              #     if params[:mode] == 'dialog'
         
     | 
| 
      
 33 
     | 
    
         
            +
              #       left.button styleClass: 'link', text: 'cancel', onClick: ->(action) { action.dialogs_close }
         
     | 
| 
      
 34 
     | 
    
         
            +
              #     end
         
     | 
| 
      
 35 
     | 
    
         
            +
              #   end
         
     | 
| 
      
 36 
     | 
    
         
            +
              #   split.right childViews: ->(right) do
         
     | 
| 
      
 37 
     | 
    
         
            +
              #     right.button text: 'Submit', onClick: ->(action) { action.forms_submit }
         
     | 
| 
      
 38 
     | 
    
         
            +
              #   end
         
     | 
| 
      
 39 
     | 
    
         
            +
              # end
         
     | 
| 
      
 40 
     | 
    
         
            +
             
     | 
| 
      
 41 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -13,6 +13,11 @@ json_ui_page json do |page| 
     | 
|
| 
       13 
13 
     | 
    
         
             
                    action.windows_open url: json_ui_garage_url(path: 'home/blank')
         
     | 
| 
       14 
14 
     | 
    
         
             
                  end
         
     | 
| 
       15 
15 
     | 
    
         
             
                  template.thumbnail title: 'Item with subtitle', subtitle: 'Item subtitle'
         
     | 
| 
      
 16 
     | 
    
         
            +
                  template.thumbnail title: 'Item with chips', chips: ->(menu) do
         
     | 
| 
      
 17 
     | 
    
         
            +
                    menu.button text: 'FInished', styleClass: 'info'
         
     | 
| 
      
 18 
     | 
    
         
            +
                    menu.button props: { text: 'Succeeded', styleClass: 'success' }
         
     | 
| 
      
 19 
     | 
    
         
            +
                  end
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
       16 
21 
     | 
    
         
             
                  template.thumbnail title: 'Item with thumbnail image', subtitle: 'Item subtitle', imageUrl: glib_json_image_standard_url
         
     | 
| 
       17 
22 
     | 
    
         
             
                  template.featured title: 'Featured with featured image', subtitle: 'Item subtitle', imageUrl: glib_json_image_standard_url
         
     | 
| 
       18 
23 
     | 
    
         | 
| 
         @@ -14,7 +14,7 @@ page.scroll padding: glib_json_padding_body, childViews: ->(scroll) do 
     | 
|
| 
       14 
14 
     | 
    
         
             
              scroll.spacer height: 20
         
     | 
| 
       15 
15 
     | 
    
         
             
              scroll.h2 text: 'Icon'
         
     | 
| 
       16 
16 
     | 
    
         
             
              scroll.spacer height: 6
         
     | 
| 
       17 
     | 
    
         
            -
              scroll.icon  
     | 
| 
      
 17 
     | 
    
         
            +
              scroll.icon spec: 'info'
         
     | 
| 
       18 
18 
     | 
    
         | 
| 
       19 
19 
     | 
    
         
             
              scroll.spacer height: 20
         
     | 
| 
       20 
20 
     | 
    
         
             
              scroll.h2 text: 'Image with base64 data'
         
     | 
| 
         @@ -2,7 +2,7 @@ json.title 'Views' 
     | 
|
| 
       2 
2 
     | 
    
         | 
| 
       3 
3 
     | 
    
         
             
            json_ui_page json do |page|
         
     | 
| 
       4 
4 
     | 
    
         
             
              render "#{@path_prefix}/nav_menu", json: json, page: page
         
     | 
| 
       5 
     | 
    
         
            -
             
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
       6 
6 
     | 
    
         
             
              page.scroll padding: glib_json_padding_body, childViews: ->(scroll) do
         
     | 
| 
       7 
7 
     | 
    
         | 
| 
       8 
8 
     | 
    
         
             
                scroll.h2 text: 'Standard button'
         
     | 
| 
         @@ -58,7 +58,7 @@ json_ui_page json do |page| 
     | 
|
| 
       58 
58 
     | 
    
         
             
                scroll.spacer height: 20
         
     | 
| 
       59 
59 
     | 
    
         
             
                scroll.h2 text: 'Icon with onClick'
         
     | 
| 
       60 
60 
     | 
    
         
             
                scroll.spacer height: 6
         
     | 
| 
       61 
     | 
    
         
            -
                scroll.icon  
     | 
| 
      
 61 
     | 
    
         
            +
                scroll.icon spec: 'info', onClick: ->(action) do
         
     | 
| 
       62 
62 
     | 
    
         
             
                  action.windows_open url: json_ui_garage_url(path: 'home/blank')
         
     | 
| 
       63 
63 
     | 
    
         
             
                end
         
     | 
| 
       64 
64 
     | 
    
         | 
    
        data/lib/tasks/db.rake
    CHANGED
    
    | 
         @@ -63,11 +63,12 @@ namespace :db do 
     | 
|
| 
       63 
63 
     | 
    
         
             
                          [0]
         
     | 
| 
       64 
64 
     | 
    
         
             
                        end
         
     | 
| 
       65 
65 
     | 
    
         | 
| 
       66 
     | 
    
         
            -
                        attrs 
     | 
| 
       67 
     | 
    
         
            -
             
     | 
| 
       68 
     | 
    
         
            -
             
     | 
| 
       69 
     | 
    
         
            -
             
     | 
| 
       70 
     | 
    
         
            -
             
     | 
| 
      
 66 
     | 
    
         
            +
                        attrs.each do |key, value|
         
     | 
| 
      
 67 
     | 
    
         
            +
                          if value.is_a? ActiveSupport::TimeWithZone
         
     | 
| 
      
 68 
     | 
    
         
            +
                            # Time.at(id.compact.inject(:+) * 100000).utc
         
     | 
| 
      
 69 
     | 
    
         
            +
                            attrs[key] = value.utc
         
     | 
| 
      
 70 
     | 
    
         
            +
                          end
         
     | 
| 
      
 71 
     | 
    
         
            +
                        end
         
     | 
| 
       71 
72 
     | 
    
         | 
| 
       72 
73 
     | 
    
         
             
                        output["#{m}_#{id.join('_')}"] = attrs
         
     | 
| 
       73 
74 
     | 
    
         
             
                      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.4. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.4.41
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - ''
         
     | 
| 
         @@ -123,6 +123,7 @@ files: 
     | 
|
| 
       123 
123 
     | 
    
         
             
            - app/views/json_ui/garage/forms/pickers.json.jbuilder
         
     | 
| 
       124 
124 
     | 
    
         
             
            - app/views/json_ui/garage/forms/rich_text.json.jbuilder
         
     | 
| 
       125 
125 
     | 
    
         
             
            - app/views/json_ui/garage/forms/selects.json.jbuilder
         
     | 
| 
      
 126 
     | 
    
         
            +
            - app/views/json_ui/garage/forms/show_hide.json.jbuilder
         
     | 
| 
       126 
127 
     | 
    
         
             
            - app/views/json_ui/garage/forms/submission_flow.json.jbuilder
         
     | 
| 
       127 
128 
     | 
    
         
             
            - app/views/json_ui/garage/forms/submission_flow_post.json.jbuilder
         
     | 
| 
       128 
129 
     | 
    
         
             
            - app/views/json_ui/garage/forms/submission_indicator.json.jbuilder
         
     |