hooch 0.11.0 → 0.12.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 54f4e899ce069ebb6f60defca61434660d7afe73
4
- data.tar.gz: 7e44a2f22f8325dc1135ad9523ef4e142fb1c5d6
3
+ metadata.gz: 4219db2afe00609209fcd143a2ef9c767a4daf56
4
+ data.tar.gz: 91012962eabd1a8cd051e5d51c24badef49b2e35
5
5
  SHA512:
6
- metadata.gz: 0d7ff3f114fb4fa0143fce2a2d1c9d51866c2d089b5b8b5f9d91e0b03b0c82c7a8a72d9cac5aa063b03be36dc1ea62e2cf4e95d183390bdc8de55b40ea7bd0a0
7
- data.tar.gz: 2ac05e37ff14c01f3f62b16fca3408f0f38d7b8a066637d37b372e85ed27ea5ff835dd768b1e35d50cb466d596bcc5de7e3aed83bc553bf9d2341e59aedc8df3
6
+ metadata.gz: b978c49ab05b43b548566ff4fb6eeacca47b5b07b521f2abff36e694b7bc6fd4ea8d770b328eeb846b6221882678286bc0593d7ceffce91edebbcb73280fe096
7
+ data.tar.gz: b353eab5ce5cbf82b4b9ba6ea3f6c05d73c73061f37b5535f079bcbf045fb382e7da895c4e86bf61601fbcdcb789d93fd38399bec8b1bc4fe15dfe7eb23fa6f1
@@ -560,6 +560,47 @@ var initHooch = function(){
560
560
  var new_state = {}
561
561
  new_state[key] = value
562
562
  this.state = $.extend(true, this.state, new_state);
563
+ },
564
+ addPath: function(new_path){
565
+ this.new_path = new_path
566
+ },
567
+ newPath: function(){
568
+ return [location.protocol, '//', location.host, this.new_path].join('');
569
+ },
570
+ addKeyValue: function(key,value){
571
+ this.addState(key,value)
572
+ history['replaceState'](this.state, null, this.toUrl());
573
+ },
574
+ replacePath: function(new_path){
575
+ this.addPath(new_path)
576
+ history['replaceState']({}, null, this.newPath());
577
+ }
578
+ }),
579
+ HistoryPusher: Class.extend({
580
+ init: function($history_pusher){
581
+ this.key = $history_pusher.data('key')
582
+ this.value = $history_pusher.data('value')
583
+ var history_pusher = this
584
+ $history_pusher.on('click', function(){
585
+ history_pusher.pushIt()
586
+ })
587
+ },
588
+ pushIt: function(){
589
+ this.current_state = new hooch.IhHistoryState(history.state)
590
+ this.current_state.addKeyValue(this.key,this.value)
591
+ }
592
+ }),
593
+ HistoryReplacer: Class.extend({
594
+ init: function($history_replacer){
595
+ this.new_path = $history_replacer.data('new-path')
596
+ var history_replacer = this
597
+ $history_replacer.on('click', function(){
598
+ history_replacer.replaceIt()
599
+ })
600
+ },
601
+ replaceIt: function(){
602
+ this.current_state = new hooch.IhHistoryState(history.state)
603
+ this.current_state.replacePath(this.new_path)
563
604
  }
564
605
  }),
565
606
  GoProxy: Class.extend({
@@ -1549,7 +1590,7 @@ var initHooch = function(){
1549
1590
  ['hover_overflow','hidey_button','submit-proxy','click-proxy','field-filler','revealer',
1550
1591
  'checkbox-hidden-proxy','prevent-double-submit','prevent-double-link-click', 'tab-group',
1551
1592
  'hover-reveal', 'emptier', 'remover', 'checkbox-proxy', 'fake-select', 'select-action-changer',
1552
- 'sorter','bind-key','modal-trigger'],'hooch');
1593
+ 'sorter','bind-key','modal-trigger','history-pusher', 'history-replacer'],'hooch');
1553
1594
  window.any_time_manager.load();
1554
1595
  };
1555
1596
  hooch.pauseEvent = function(e){
@@ -156,6 +156,36 @@ module Hooch
156
156
  end
157
157
  end
158
158
 
159
+ def history_pusher_attrs(key,value)
160
+ ''.tap do |attrs|
161
+ attrs.concat 'data-history-pusher=true'
162
+ attrs.concat " data-key=#{key}"
163
+ attrs.concat " data-value=\"#{value}\""
164
+ end.html_safe
165
+ end
166
+
167
+ def history_pusher(key,value)
168
+ {}.tap do |params|
169
+ params['data-history-pusher'] = true
170
+ params['data-key'] = key
171
+ params['data-value'] = value
172
+ end
173
+ end
174
+
175
+ def history_replacer_attrs(new_path)
176
+ ''.tap do |attrs|
177
+ attrs.concat 'data-history-replacer=true'
178
+ attrs.concat " data-new-path=#{new_path}"
179
+ end.html_safe
180
+ end
181
+
182
+ def history_replacer(new_path)
183
+ {}.tap do |params|
184
+ params['data-history-replacer'] = true
185
+ params['data-new-path'] = new_path
186
+ end
187
+ end
188
+
159
189
  def link
160
190
  "data-link=true"
161
191
  end
data/lib/hooch/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Hooch
2
- VERSION = "0.11.0"
2
+ VERSION = "0.12.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hooch
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.0
4
+ version: 0.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Draut
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-10 00:00:00.000000000 Z
11
+ date: 2016-09-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -168,7 +168,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
168
168
  version: '0'
169
169
  requirements: []
170
170
  rubyforge_project:
171
- rubygems_version: 2.4.5.1
171
+ rubygems_version: 2.5.1
172
172
  signing_key:
173
173
  specification_version: 4
174
174
  summary: Tools for building a browser UI. Get the good stuff.