benhoskings-hammock 0.3.0 → 0.3.1

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.
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.0"
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-25}
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
@@ -4,7 +4,7 @@ require 'ambition'
4
4
  require 'ambition/adapters/active_record'
5
5
 
6
6
  module Hammock
7
- VERSION = '0.3.0'
7
+ VERSION = '0.3.1'
8
8
 
9
9
  def self.included base # :nodoc:
10
10
  puts "Loading Hammock from #{loaded_from_gem? ? 'gem' : 'plugin'}"
@@ -84,8 +84,10 @@ module Hammock
84
84
  ),
85
85
  function(response, textStatus) {
86
86
  #{response_action}
87
- if (obj) obj.children('.spinner').hide();
88
- #{"if ('success' == textStatus) obj.children('.success').show().fadeOut(4000);" if opts[:spinner] != :pending}
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.0
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-25 00:00:00 -07:00
12
+ date: 2009-05-26 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency