edifice 0.10.3 → 1.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.
- data/lib/edifice/controller.rb +0 -6
- data/lib/edifice/version.rb +1 -1
- data/lib/edifice.rb +0 -2
- metadata +5 -7
- data/lib/edifice/form_model.rb +0 -46
- data/lib/edifice/responder.rb +0 -23
data/lib/edifice/controller.rb
CHANGED
@@ -8,12 +8,6 @@ module Edifice
|
|
8
8
|
unless (controller == ActionMailer::Base)
|
9
9
|
controller.after_filter(:write_edifice_headers)
|
10
10
|
end
|
11
|
-
|
12
|
-
controller.class_eval do
|
13
|
-
def self.responder
|
14
|
-
Edifice::Responder
|
15
|
-
end
|
16
|
-
end
|
17
11
|
end
|
18
12
|
|
19
13
|
# this will get called once per template. So we make sure it only writes for the first
|
data/lib/edifice/version.rb
CHANGED
data/lib/edifice.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: edifice
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 15
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
|
+
- 1
|
7
8
|
- 0
|
8
|
-
|
9
|
-
- 3
|
10
|
-
version: 0.10.3
|
9
|
+
version: "1.0"
|
11
10
|
platform: ruby
|
12
11
|
authors:
|
13
12
|
- Tom Coleman
|
@@ -17,7 +16,7 @@ autorequire:
|
|
17
16
|
bindir: bin
|
18
17
|
cert_chain: []
|
19
18
|
|
20
|
-
date:
|
19
|
+
date: 2012-01-17 00:00:00 Z
|
21
20
|
dependencies: []
|
22
21
|
|
23
22
|
description: The idea here is to communicate which view is rendering to the javascript so that we can call the correct javascript files in an automagical way.
|
@@ -46,10 +45,8 @@ files:
|
|
46
45
|
- lib/edifice.rb
|
47
46
|
- lib/edifice/controller.rb
|
48
47
|
- lib/edifice/engine.rb
|
49
|
-
- lib/edifice/form_model.rb
|
50
48
|
- lib/edifice/helper.rb
|
51
49
|
- lib/edifice/renderer.rb
|
52
|
-
- lib/edifice/responder.rb
|
53
50
|
- lib/edifice/version.rb
|
54
51
|
- lib/tasks/edifice.rake
|
55
52
|
- test/rails3/.gitignore
|
@@ -170,3 +167,4 @@ test_files:
|
|
170
167
|
- test/rails3/public/stylesheets/form.css
|
171
168
|
- test/rails3/script/rails
|
172
169
|
- test/rails3/vendor/plugins/.gitkeep
|
170
|
+
has_rdoc:
|
data/lib/edifice/form_model.rb
DELETED
@@ -1,46 +0,0 @@
|
|
1
|
-
# kind of the evolution of the FormStruct
|
2
|
-
|
3
|
-
module Edifice
|
4
|
-
class FormModel
|
5
|
-
include ActiveModel::Validations
|
6
|
-
include ActiveModel::Conversion
|
7
|
-
extend ActiveModel::Naming
|
8
|
-
extend ActiveModel::Callbacks
|
9
|
-
define_model_callbacks :save
|
10
|
-
|
11
|
-
# more or less the same as activerecord's one
|
12
|
-
class RecordInvalid < Exception
|
13
|
-
attr_reader :record
|
14
|
-
def initialize(record)
|
15
|
-
@record = record
|
16
|
-
errors = @record.errors.full_messages.join(", ")
|
17
|
-
super(errors)
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
def initialize(attributes = {})
|
22
|
-
attributes.each { |n, v| send("#{n}=", v) if respond_to?("#{n}=") }
|
23
|
-
end
|
24
|
-
|
25
|
-
# default implementation, override as necessary
|
26
|
-
def save
|
27
|
-
run_callbacks :save do
|
28
|
-
valid?
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
def save!
|
33
|
-
save || raise(RecordInvalid.new(self))
|
34
|
-
end
|
35
|
-
|
36
|
-
def self.create(attributes = {})
|
37
|
-
form = new(attributes)
|
38
|
-
form.save
|
39
|
-
form
|
40
|
-
end
|
41
|
-
|
42
|
-
def persisted?
|
43
|
-
false
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
data/lib/edifice/responder.rb
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
# Basically a standard responder, but if
|
2
|
-
module Edifice
|
3
|
-
class Responder < ActionController::Responder
|
4
|
-
protected
|
5
|
-
# add the :u_e header to xhr error requests
|
6
|
-
def to_html
|
7
|
-
if controller.request.xhr? && !get? and has_errors? && default_action
|
8
|
-
render :action => default_action, :status => :unprocessable_entity, :layout => nil
|
9
|
-
else
|
10
|
-
super
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
# actually render something on successful updates
|
15
|
-
def to_format
|
16
|
-
unless get? or has_errors? or post?
|
17
|
-
display resource, :status => :ok
|
18
|
-
else
|
19
|
-
super
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|