benhoskings-hammock 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +7 -0
- data/hammock.gemspec +2 -2
- data/lib/hammock.rb +1 -1
- data/lib/hammock/ajaxinate.rb +4 -2
- data/lib/hammock/restful_actions.rb +1 -8
- data/lib/hammock/restful_rendering.rb +9 -0
- data/lib/hammock/restful_support.rb +1 -1
- data/lib/hammock/scope.rb +2 -2
- metadata +2 -2
data/History.txt
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
== 0.3.1 2009-05-26
|
2
|
+
Check for a specific scope for the current action before checking for a default-named scope.
|
3
|
+
Commented ambition query logging.
|
4
|
+
Moved index rendering to restful_rendering.
|
5
|
+
Wrap pending -> success notification within obj null test.
|
6
|
+
|
7
|
+
|
1
8
|
== 0.3.0 2009-05-25
|
2
9
|
Updated ajax_link, ajaxinate and related methods to accept explicit args instead of a splatted list - this makes it a lot easier to handle different amounts of entities.
|
3
10
|
Only do obj replacement in jquery_xhr callback if it's set.
|
data/hammock.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{hammock}
|
5
|
-
s.version = "0.3.
|
5
|
+
s.version = "0.3.1"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Ben Hoskings"]
|
9
|
-
s.date = %q{2009-05-
|
9
|
+
s.date = %q{2009-05-26}
|
10
10
|
s.description = %q{Hammock is a Rails plugin that eliminates redundant code in a very RESTful manner. It does this in lots in lots of different places, but in one manner: it encourages specification in place of implementation.
|
11
11
|
|
12
12
|
|
data/lib/hammock.rb
CHANGED
data/lib/hammock/ajaxinate.rb
CHANGED
@@ -84,8 +84,10 @@ module Hammock
|
|
84
84
|
),
|
85
85
|
function(response, textStatus) {
|
86
86
|
#{response_action}
|
87
|
-
if (obj)
|
88
|
-
|
87
|
+
if (obj) {
|
88
|
+
obj.children('.spinner').hide();
|
89
|
+
#{"if ('success' == textStatus) obj.children('.success').show().fadeOut(4000);" if opts[:spinner] != :pending}
|
90
|
+
}
|
89
91
|
eval("#{clean_snippet opts[:after]}");
|
90
92
|
}
|
91
93
|
);
|
@@ -6,14 +6,7 @@ module Hammock
|
|
6
6
|
#
|
7
7
|
# Lists the current resource's records that are visible within the current index scope, defined by +index_scope+ and +index_scope_for+ on the current model.
|
8
8
|
def index
|
9
|
-
if tasks_for_index
|
10
|
-
respond_to do |format|
|
11
|
-
format.html
|
12
|
-
format.xml { render :xml => @records.kick }
|
13
|
-
format.json { render :json => @records.kick }
|
14
|
-
format.yaml { render :text => @records.kick.to_yaml }
|
15
|
-
end
|
16
|
-
end
|
9
|
+
render_for_index if tasks_for_index
|
17
10
|
end
|
18
11
|
|
19
12
|
# The +new+ action. (GET, safe, idempotent)
|
@@ -28,6 +28,15 @@ module Hammock
|
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
31
|
+
def render_for_index
|
32
|
+
respond_to do |format|
|
33
|
+
format.html
|
34
|
+
format.xml { render :xml => @records.kick }
|
35
|
+
format.json { render :json => @records.kick }
|
36
|
+
format.yaml { render :text => @records.kick.to_yaml }
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
31
40
|
def render_for_safe_actions result = true, opts = {}
|
32
41
|
if request.xhr?
|
33
42
|
if params[:attribute]
|
@@ -77,7 +77,7 @@ module Hammock
|
|
77
77
|
elsif record_or_records.is_a? ActiveRecord::Base
|
78
78
|
instance_variable_set "@#{mdl_name}", (@record = record_or_records)
|
79
79
|
elsif record_or_records.is_a? Ambition::Context
|
80
|
-
log "Unkicked query: #{record_or_records.to_hash.inspect}"
|
80
|
+
# log "Unkicked query: #{record_or_records.to_hash.inspect}"
|
81
81
|
instance_variable_set "@#{mdl_name.pluralize}", (@records = record_or_records)
|
82
82
|
elsif record_or_records.is_a? Array
|
83
83
|
instance_variable_set "@#{mdl_name.pluralize}", (@records = record_or_records)
|
data/lib/hammock/scope.rb
CHANGED
@@ -116,10 +116,10 @@ module Hammock
|
|
116
116
|
end
|
117
117
|
|
118
118
|
def account_verb_scope?
|
119
|
-
mdl.has_account_scope? scope_name_for_action
|
119
|
+
mdl.has_account_scope?(action_name) || mdl.has_account_scope?(scope_name_for_action)
|
120
120
|
end
|
121
121
|
def public_verb_scope?
|
122
|
-
mdl.has_public_scope? scope_name_for_action
|
122
|
+
mdl.has_public_scope?(action_name) || mdl.has_public_scope?(scope_name_for_action)
|
123
123
|
end
|
124
124
|
|
125
125
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: benhoskings-hammock
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Hoskings
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-05-
|
12
|
+
date: 2009-05-26 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|