honkster-honkster-jelly 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.markdown CHANGED
@@ -26,9 +26,8 @@ Then install the required JavaScript files by running this command in your Rails
26
26
 
27
27
  Then, in your layout, add the following:
28
28
 
29
- <%= javascript_include_tag :jelly %>
30
- <%= javascript_include_tag *page_specific_javascript_files %>
31
- <%= init_specific_javascript %>
29
+ <%= javascript_include_tag :jelly, *application_jelly_files %>
30
+ <%= spread_jelly %>
32
31
 
33
32
  This will include the required JavaScripts for jelly and activate the current page. The `:jelly` javascript expansion
34
33
  includes jQuery. If you already have jQuery included in the page, use the `:only_jelly` expansion instead.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.0
1
+ 0.3.0
@@ -5,13 +5,15 @@
5
5
 
6
6
  $.ajaxWithJelly.params = function(otherParams) {
7
7
  otherParams = otherParams || {};
8
- otherParams['data'] = $.extend(otherParams['data'], {
9
- authenticity_token: _token
10
- });
8
+
9
+ if (otherParams.type && otherParams.type != "GET") {
10
+ otherParams['data'] = $.extend(otherParams['data'], {
11
+ authenticity_token: window._token
12
+ });
13
+ }
11
14
  return $.extend({
12
15
  dataType: 'json',
13
16
  cache: false,
14
- type: 'POST',
15
17
  success : $.ajaxWithJelly.onSuccess
16
18
  }, otherParams);
17
19
  };
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{honkster-jelly}
8
- s.version = "0.2.0"
8
+ s.version = "0.3.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Pivotal Labs, Inc"]
@@ -1,12 +1,12 @@
1
1
  module JellyHelper
2
2
 
3
- def page_specific_javascript_files(jelly_files_path_from_javascripts = '', rails_root = RAILS_ROOT)
3
+ def application_jelly_files(jelly_files_path_from_javascripts = '', rails_root = RAILS_ROOT)
4
4
  Dir["#{rails_root}/public/javascripts/#{jelly_files_path_from_javascripts}/pages/**/*.js"].map do |path|
5
5
  path.gsub("#{rails_root}/public/javascripts/", "").gsub(/\.js$/, "")
6
6
  end
7
7
  end
8
8
 
9
- def init_specific_javascript
9
+ def spread_jelly
10
10
  javascript_tag <<-JS
11
11
  window._token = '#{form_authenticity_token}'
12
12
  Jelly.activatePage('#{controller.controller_path.camelcase}', '#{controller.action_name}');
@@ -7,16 +7,16 @@ describe "JellyHelper" do
7
7
  stub_controller = mock(Object, :controller_path => 'my_fun_controller', :action_name => 'super_good_action')
8
8
  helper.should_receive(:controller).any_number_of_times.and_return(stub_controller)
9
9
  helper.should_receive(:form_authenticity_token).and_return('areallysecuretoken')
10
- output = helper.init_specific_javascript
10
+ output = helper.spread_jelly
11
11
  output.should include('<script type="text/javascript">')
12
12
  output.should include("Jelly.activatePage('MyFunController', 'super_good_action');")
13
13
  end
14
14
  end
15
15
 
16
- describe "#page_specific_javascript_files" do
16
+ describe "#application_jelly_files" do
17
17
  it "returns the javascript files in the given path" do
18
18
  my_rails_root = File.join(File.dirname(__FILE__), '/../fixtures')
19
- files = helper.page_specific_javascript_files("foo", my_rails_root)
19
+ files = helper.application_jelly_files("foo", my_rails_root)
20
20
  files.should_not be_empty
21
21
  files.should =~ ['foo/pages/lions', 'foo/pages/tigers', 'foo/pages/bears']
22
22
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: honkster-honkster-jelly
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pivotal Labs, Inc