abraham 2.4.0 → 2.5.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/README.md +26 -0
- data/app/views/application/_abraham.html.erb +15 -9
- data/lib/abraham/version.rb +1 -1
- metadata +2 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 025f51bb1380ebbd7c172d43d66b79ca4b68fdb4eb4af6940364fff44b282176
         | 
| 4 | 
            +
              data.tar.gz: a791c10896b5f002e1aa5daa8edccd2ec810a4479aeccac4a5d8b28a52795c5d
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 4e6f5e3fae2acca16748c5ace7c7fde3436e3aab72604c3e35030d5488ec389fd4903ff53a63dbdc4fe473a554853860a6d6f05e8a126bd49d7ae15f71c573b4
         | 
| 7 | 
            +
              data.tar.gz: 816fb772c290eb0504885b2e93f21d952e7322bf87c05ca3332d57c6ff81fb1e5062a93824d5d087b142c05e4efab6af2f01fdbbc12623b9b3740acb82cc4a7d
         | 
    
        data/README.md
    CHANGED
    
    | @@ -17,6 +17,7 @@ Abraham makes it easy to show guided tours to users of your Rails application. W | |
| 17 17 | 
             
            ## Requirements
         | 
| 18 18 |  | 
| 19 19 | 
             
            * Abraham needs to know the current user to track tour views, e.g. `current_user` from Devise.
         | 
| 20 | 
            +
              * If you are using a different method to identify who is currently logged in, you can, for example, add an alias to make it work. Assuming you have a method `current_foo` to identify your currenly logged-in user, you can add `alias_method 'current_user', 'current_foo'` in the place you define `current_foo`.
         | 
| 20 21 | 
             
            * Abraham is tested on Rails 5.2, 6.0, and 6.1
         | 
| 21 22 |  | 
| 22 23 | 
             
            ## Installation
         | 
| @@ -131,6 +132,8 @@ Abraham takes care of which buttons should appear with each step: | |
| 131 132 | 
             
            * "Exit" and "Next" buttons on intermediate steps
         | 
| 132 133 | 
             
            * "Done" button on the last step
         | 
| 133 134 |  | 
| 135 | 
            +
            See below for how to define custom buttons.
         | 
| 136 | 
            +
             | 
| 134 137 | 
             
            When you specify an `attachTo` element, use the `placement` option to choose where the callout should appear relative to that element:
         | 
| 135 138 |  | 
| 136 139 | 
             
            * `bottom` / `bottom center`
         | 
| @@ -181,6 +184,29 @@ This tour will not start automatically; instead, use the `Abraham.startTour` met | |
| 181 184 | 
             
            </script>
         | 
| 182 185 | 
             
            ```
         | 
| 183 186 |  | 
| 187 | 
            +
            ### Custom buttons
         | 
| 188 | 
            +
             | 
| 189 | 
            +
            You can define custom buttons in a step like so:
         | 
| 190 | 
            +
             | 
| 191 | 
            +
            ```
         | 
| 192 | 
            +
            my_tour:
         | 
| 193 | 
            +
              steps:
         | 
| 194 | 
            +
                1:
         | 
| 195 | 
            +
                  text: "Welcome to my custom button tour"
         | 
| 196 | 
            +
                  buttons:
         | 
| 197 | 
            +
                    1:
         | 
| 198 | 
            +
                      text: 'Show this to me later'
         | 
| 199 | 
            +
                      action: 'cancel'
         | 
| 200 | 
            +
                      classes: 'custom-button shepherd-button-secondary'
         | 
| 201 | 
            +
                    2:
         | 
| 202 | 
            +
                      text: 'Finish now'
         | 
| 203 | 
            +
                      action: 'complete'
         | 
| 204 | 
            +
                      classes: 'custom-button'
         | 
| 205 | 
            +
            ```
         | 
| 206 | 
            +
             | 
| 207 | 
            +
            * `action` is one of the Shepherd tour method names, i.e. `cancel`, `next`, or `complete`
         | 
| 208 | 
            +
            * `classes` are the CSS class names you want applied to the button
         | 
| 209 | 
            +
             | 
| 184 210 | 
             
            ### Testing your tours
         | 
| 185 211 |  | 
| 186 212 | 
             
            Abraham loads tour definitions once when you start your server. Restart your server to see tour changes.
         | 
| @@ -29,22 +29,28 @@ | |
| 29 29 | 
             
                <% end %>
         | 
| 30 30 | 
             
                text: "<%= step['text'] %>",
         | 
| 31 31 | 
             
                <% if step.key?('attachTo') %>
         | 
| 32 | 
            -
                attachTo: { element: "<%= step['attachTo']['element'] %>", on: "<%= step['attachTo']['placement'] %>" },
         | 
| 32 | 
            +
                attachTo: { element: "<%= escape_javascript(step['attachTo']['element'].html_safe) %>", on: "<%= step['attachTo']['placement'] %>" },
         | 
| 33 33 | 
             
                showOn: function() {
         | 
| 34 34 | 
             
                  // Only display this step if its selector is present
         | 
| 35 | 
            -
                  return document.querySelector("<%= step['attachTo']['element'] %>") ? true : false
         | 
| 35 | 
            +
                  return document.querySelector("<%= escape_javascript(step['attachTo']['element'].html_safe) %>") ? true : false
         | 
| 36 36 | 
             
                },
         | 
| 37 37 | 
             
                <% end %>
         | 
| 38 38 | 
             
                buttons: [
         | 
| 39 | 
            -
                <% if  | 
| 40 | 
            -
                   | 
| 39 | 
            +
                <% if step.key?('buttons') %>
         | 
| 40 | 
            +
                  <% step['buttons'].each do |button| %>
         | 
| 41 | 
            +
                    { text: '<%= button[1]['text']  %>', action: Abraham.tours["<%= tour_name %>"].<%= button[1]['action'] %>, classes: '<%= button[1]['classes'] %>' },
         | 
| 42 | 
            +
                  <% end %>
         | 
| 41 43 | 
             
                <% else %>
         | 
| 42 | 
            -
                  <% if index ==  | 
| 43 | 
            -
                    { text: '<%= t('abraham. | 
| 44 | 
            -
                    { text: '<%= t('abraham.continue') %>', action: Abraham.tours["<%= tour_name %>"].next }
         | 
| 44 | 
            +
                  <% if index == steps.size - 1 %>
         | 
| 45 | 
            +
                    { text: '<%= t('abraham.done') %>', action: Abraham.tours["<%= tour_name %>"].complete }
         | 
| 45 46 | 
             
                  <% else %>
         | 
| 46 | 
            -
             | 
| 47 | 
            -
             | 
| 47 | 
            +
                    <% if index == 0 %>
         | 
| 48 | 
            +
                      { text: '<%= t('abraham.later') %>', action: Abraham.tours["<%= tour_name %>"].cancel, classes: 'shepherd-button-secondary' },
         | 
| 49 | 
            +
                      { text: '<%= t('abraham.continue') %>', action: Abraham.tours["<%= tour_name %>"].next }
         | 
| 50 | 
            +
                    <% else %>
         | 
| 51 | 
            +
                    { text: '<%= t('abraham.exit') %>', action: Abraham.tours["<%= tour_name %>"].cancel, classes: 'shepherd-button-secondary' },
         | 
| 52 | 
            +
                    { text: '<%= t('abraham.next') %>', action: Abraham.tours["<%= tour_name %>"].next }
         | 
| 53 | 
            +
                    <% end %>
         | 
| 48 54 | 
             
                  <% end %>
         | 
| 49 55 | 
             
                <% end %>
         | 
| 50 56 | 
             
                ]
         | 
    
        data/lib/abraham/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: abraham
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 2. | 
| 4 | 
            +
              version: 2.5.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Jonathan Abbett
         | 
| 8 8 | 
             
            autorequire:
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date:  | 
| 11 | 
            +
            date: 2022-02-17 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: sassc-rails
         |