sinatra-hexacta 0.5.1 → 0.6.0
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/lib/sinatra/helpers/inputs.rb +8 -0
- data/lib/sinatra/views/inputs/range.slim +16 -8
- metadata +1 -1
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: c11cd817a610d34a2776e3dee2c9f8f086004494537edb976d29d48208d175aa
         | 
| 4 | 
            +
              data.tar.gz: a53b0d29d408dd10d7a882fb67d456978b4002423d53cc7c1cad12a349ea3d8f
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: d2c1ff9d07238a097414c7d8fd11590d2523fd2a54fb4ee1847e063673d8df998a3d99a5e47074702e6ebaf5d28ee5e32fcb8fe13448d575a9bb11cfdc5e9d75
         | 
| 7 | 
            +
              data.tar.gz: a7685c6ce4c5c83af4b8544a682609ae0326b00cee246f95e4199c1512aa4ffe09a8df2a5c243e97e1ddbc7816cdd061bd57e8fc9b5d8d8e392e5a4d5d92857b
         | 
| @@ -39,6 +39,14 @@ module Sinatra | |
| 39 39 | 
             
                  slim "#{Hexacta::GEM_FILE_DIR}/inputs/year".to_sym, locals: option_hash
         | 
| 40 40 | 
             
                end
         | 
| 41 41 |  | 
| 42 | 
            +
                def paginator_input(option_hash)
         | 
| 43 | 
            +
                  slim "#{Hexacta::GEM_FILE_DIR}/inputs/paginator".to_sym, locals: option_hash
         | 
| 44 | 
            +
                end
         | 
| 45 | 
            +
             | 
| 46 | 
            +
                def range_input(option_hash)
         | 
| 47 | 
            +
                  slim "#{Hexacta::GEM_FILE_DIR}/inputs/range".to_sym, locals: option_hash
         | 
| 48 | 
            +
                end
         | 
| 49 | 
            +
             | 
| 42 50 | 
             
                setup_dir("/app/views/#{Hexacta::GEM_FILE_DIR}/inputs")
         | 
| 43 51 | 
             
                copy_all_files("/lib/sinatra/views/inputs","/app/views/#{Hexacta::GEM_FILE_DIR}/inputs")
         | 
| 44 52 | 
             
              end
         | 
| @@ -1,15 +1,23 @@ | |
| 1 | 
            -
            -if from.nil? || to.nil?
         | 
| 2 | 
            -
              -date_range = ""
         | 
| 3 | 
            -
            -else
         | 
| 4 | 
            -
              -date_range = "#{from.strftime('%d %Bb, %y')} - #{to.strftime('%d %Bb, %y')}"
         | 
| 1 | 
            +
            - if from.nil? || to.nil?
         | 
| 2 | 
            +
              - date_range = ""
         | 
| 3 | 
            +
            - else
         | 
| 4 | 
            +
              - date_range = "#{from.strftime('%d %Bb, %y')} - #{to.strftime('%d %Bb, %y')}"
         | 
| 5 | 
            +
            - unless defined? required
         | 
| 6 | 
            +
              - required = false
         | 
| 7 | 
            +
            - if !(defined? id) || id.blank? 
         | 
| 8 | 
            +
              - id = "#{name}_#{rand(1000)}"
         | 
| 9 | 
            +
            - unless defined? clazz
         | 
| 10 | 
            +
              - clazz = nil
         | 
| 11 | 
            +
            - unless defined? all_days
         | 
| 12 | 
            +
              - all_days = false
         | 
| 5 13 |  | 
| 6 14 | 
             
            .form-group.fg-float
         | 
| 7 15 | 
             
              label #{title}
         | 
| 8 16 | 
             
              .fg-line
         | 
| 9 | 
            -
                -if required
         | 
| 10 | 
            -
                  input.form-control.date-range.fg-input id="#{id}" type="text" name="#{name}" required="" value="#{date_range}"
         | 
| 11 | 
            -
                -else
         | 
| 12 | 
            -
                  input.form-control.date-range.fg-input id="#{id}" type="text" name="#{name}" value="#{date_range}"
         | 
| 17 | 
            +
                - if required
         | 
| 18 | 
            +
                  input.form-control.date-range.fg-input id="#{id}" type="text" name="#{name}" required="" value="#{date_range}" class="#{clazz}" all-days='#{all_days}'
         | 
| 19 | 
            +
                - else
         | 
| 20 | 
            +
                  input.form-control.date-range.fg-input id="#{id}" type="text" name="#{name}" value="#{date_range}" class="#{clazz}" all-days='#{all_days}'
         | 
| 13 21 | 
             
                input.hidden name="from" value="#{from}"
         | 
| 14 22 | 
             
                input.hidden name="to"  value="#{to}"
         | 
| 15 23 |  |