sferik-merb-admin 0.2.0 → 0.2.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/README.markdown +1 -1
- data/Rakefile +1 -1
- data/app/controllers/forms.rb +7 -7
- data/app/views/forms/_date.html.erb +2 -1
- data/app/views/forms/_date_time.html.erb +2 -1
- data/app/views/forms/_time.html.erb +2 -1
- data/app/views/forms/list.html.erb +6 -3
- data/lib/merb-admin.rb +1 -1
- metadata +1 -1
data/README.markdown
CHANGED
@@ -14,7 +14,7 @@ At the command prompt, type:
|
|
14
14
|
|
15
15
|
In your app, add the following dependency to `config/dependencies.rb`:
|
16
16
|
|
17
|
-
dependency "sferik-merb-admin", "0.2.
|
17
|
+
dependency "sferik-merb-admin", "0.2.1", :require_as => "merb-admin"
|
18
18
|
|
19
19
|
Add the following route to `config/router.rb`:
|
20
20
|
|
data/Rakefile
CHANGED
@@ -12,7 +12,7 @@ AUTHOR = "Erik Michaels-Ober"
|
|
12
12
|
EMAIL = "sferik@gmail.com"
|
13
13
|
HOMEPAGE = "http://twitter.com/sferik"
|
14
14
|
SUMMARY = "MerbAdmin is a merb slice that provides an easy-to-use interface for managing your data."
|
15
|
-
GEM_VERSION = "0.2.
|
15
|
+
GEM_VERSION = "0.2.1"
|
16
16
|
|
17
17
|
spec = Gem::Specification.new do |s|
|
18
18
|
s.rubyforge_project = "merb"
|
data/app/controllers/forms.rb
CHANGED
@@ -71,11 +71,11 @@ class MerbAdmin::Forms < MerbAdmin::Application
|
|
71
71
|
@instance = @model.new(instance)
|
72
72
|
if @instance.save
|
73
73
|
if params[:_continue]
|
74
|
-
redirect
|
74
|
+
redirect(slice_url(:admin_edit, :model_name => @model_name.snake_case, :id => @instance.id), :message => {:notice => "#{@model_name} was successfully created"})
|
75
75
|
elsif params[:_add_another]
|
76
|
-
redirect
|
76
|
+
redirect(slice_url(:admin_new, :model_name => @model_name.snake_case), :message => {:notice => "#{@model_name} was successfully created"})
|
77
77
|
else
|
78
|
-
redirect
|
78
|
+
redirect(slice_url(:admin_list, :model_name => @model_name.snake_case), :message => {:notice => "#{@model_name} was successfully created"})
|
79
79
|
end
|
80
80
|
else
|
81
81
|
message[:error] = "#{@model_name} failed to be created"
|
@@ -89,11 +89,11 @@ class MerbAdmin::Forms < MerbAdmin::Application
|
|
89
89
|
raise NotFound unless @instance
|
90
90
|
if @instance.update_attributes(instance)
|
91
91
|
if params[:_continue]
|
92
|
-
redirect
|
92
|
+
redirect(slice_url(:admin_edit, :model_name => @model_name.snake_case, :id => @instance.id), :message => {:notice => "#{@model_name} was successfully updated"})
|
93
93
|
elsif params[:_add_another]
|
94
|
-
redirect
|
94
|
+
redirect(slice_url(:admin_new, :model_name => @model_name.snake_case), :message => {:notice => "#{@model_name} was successfully updated"})
|
95
95
|
else
|
96
|
-
redirect
|
96
|
+
redirect(slice_url(:admin_list, :model_name => @model_name.snake_case), :message => {:notice => "#{@model_name} was successfully updated"})
|
97
97
|
end
|
98
98
|
else
|
99
99
|
message[:error] = "#{@model_name} failed to be updated"
|
@@ -111,7 +111,7 @@ class MerbAdmin::Forms < MerbAdmin::Application
|
|
111
111
|
@instance = @model.get(id)
|
112
112
|
raise NotFound unless @instance
|
113
113
|
if @instance.destroy
|
114
|
-
redirect
|
114
|
+
redirect(slice_url(:admin_list, :model_name => @model_name.snake_case), :message => {:notice => "#{@model_name} was successfully destroyed"})
|
115
115
|
else
|
116
116
|
raise InternalServerError
|
117
117
|
end
|
@@ -1,6 +1,7 @@
|
|
1
|
+
<% value = eval("@instance.#{property.field}") %>
|
1
2
|
<div class="form-row page">
|
2
3
|
<div>
|
3
|
-
<%= text_field(property.name, :class => "vDateField", :label => property.field.capitalize.gsub('_', ' '), :value =>
|
4
|
+
<%= text_field(property.name, :class => "vDateField", :label => property.field.capitalize.gsub('_', ' '), :value => value.respond_to?(:strftime) ? value.strftime("%Y-%m-%d") : nil) %>
|
4
5
|
<p class="help">
|
5
6
|
<%= !property.nullable? ? "Required." : "Optional." %>
|
6
7
|
</p>
|
@@ -1,6 +1,7 @@
|
|
1
|
+
<% value = eval("@instance.#{property.field}") %>
|
1
2
|
<div class="form-row page">
|
2
3
|
<div>
|
3
|
-
<%= text_field(property.name, :class => "vDateField", :label => property.field.capitalize.gsub('_', ' '), :value =>
|
4
|
+
<%= text_field(property.name, :class => "vDateField", :label => property.field.capitalize.gsub('_', ' '), :value => value.respond_to?(:strftime) ? value.strftime("%Y-%m-%d %H:%M:%S") ? nil) %>
|
4
5
|
<p class="help">
|
5
6
|
<%= !property.nullable? ? "Required." : "Optional." %>
|
6
7
|
</p>
|
@@ -1,6 +1,7 @@
|
|
1
|
+
<% value = eval("@instance.#{property.field}") %>
|
1
2
|
<div class="form-row page">
|
2
3
|
<div>
|
3
|
-
<%= text_field(property.name, :class => "vTimeField", :label => property.field.capitalize.gsub('_', ' '), :value =>
|
4
|
+
<%= text_field(property.name, :class => "vTimeField", :label => property.field.capitalize.gsub('_', ' '), :value => value.respond_to?(:strftime) ? value.strftime("%H:%M:%S") : nil) %>
|
4
5
|
<p class="help">
|
5
6
|
<%= !property.nullable? ? "Required." : "Optional." %>
|
6
7
|
</p>
|
@@ -79,11 +79,14 @@
|
|
79
79
|
<img alt="False" src="<%= image_path("icon-no.gif") %>"/>
|
80
80
|
<% end %>
|
81
81
|
<% when "DateTime" %>
|
82
|
-
|
82
|
+
<% value = eval("instance.#{property.field}") %>
|
83
|
+
<%= value.respond_to?(:strftime) ? value.strftime("%b. %d, %Y, %I:%M%p") : nil %>
|
83
84
|
<% when "Date" %>
|
84
|
-
|
85
|
+
<% value = eval("instance.#{property.field}") %>
|
86
|
+
<%= value.respond_to?(:strftime) ? value.strftime("%b. %d, %Y") : nil %>
|
85
87
|
<% when "Time" %>
|
86
|
-
|
88
|
+
<% value = eval("instance.#{property.field}") %>
|
89
|
+
<%= value.respond_to?(:strftime) ? value.strftime("%I:%M%p") : nil %>
|
87
90
|
<% when "Integer" %>
|
88
91
|
<% if property.type.respond_to?(:flag_map) #Enum or Flag type %>
|
89
92
|
<%= eval("instance.#{property.field}").to_s.capitalize.gsub('_', ' ') %>
|
data/lib/merb-admin.rb
CHANGED
@@ -22,7 +22,7 @@ if defined?(Merb::Plugins)
|
|
22
22
|
|
23
23
|
# Slice metadata
|
24
24
|
self.description = "MerbAdmin is a merb slice that uses your DataMapper models to provide an easy-to-use, Django-style interface for content managers."
|
25
|
-
self.version = "0.2.
|
25
|
+
self.version = "0.2.1"
|
26
26
|
self.author = "Erik Michaels-Ober"
|
27
27
|
|
28
28
|
# Stub classes loaded hook - runs before LoadClasses BootLoader
|