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
|
-
<%=
|
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.
|
1
|
+
0.3.0
|
@@ -5,13 +5,15 @@
|
|
5
5
|
|
6
6
|
$.ajaxWithJelly.params = function(otherParams) {
|
7
7
|
otherParams = otherParams || {};
|
8
|
-
|
9
|
-
|
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
|
};
|
data/honkster-jelly.gemspec
CHANGED
data/lib/jelly/jelly_helper.rb
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
module JellyHelper
|
2
2
|
|
3
|
-
def
|
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
|
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.
|
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 "#
|
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.
|
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
|