sferik-merb-admin 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
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.0", :require_as => "merb-admin"
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.0"
15
+ GEM_VERSION = "0.2.1"
16
16
 
17
17
  spec = Gem::Specification.new do |s|
18
18
  s.rubyforge_project = "merb"
@@ -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 slice_url(:admin_edit, :model_name => @model_name.snake_case, :id => @instance.id), :message => {:notice => "#{@model_name} was successfully created"}
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 slice_url(:admin_new, :model_name => @model_name.snake_case), :message => {:notice => "#{@model_name} was successfully created"}
76
+ redirect(slice_url(:admin_new, :model_name => @model_name.snake_case), :message => {:notice => "#{@model_name} was successfully created"})
77
77
  else
78
- redirect slice_url(:admin_list, :model_name => @model_name.snake_case), :message => {:notice => "#{@model_name} was successfully created"}
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 slice_url(:admin_edit, :model_name => @model_name.snake_case, :id => @instance.id), :message => {:notice => "#{@model_name} was successfully updated"}
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 slice_url(:admin_new, :model_name => @model_name.snake_case), :message => {:notice => "#{@model_name} was successfully updated"}
94
+ redirect(slice_url(:admin_new, :model_name => @model_name.snake_case), :message => {:notice => "#{@model_name} was successfully updated"})
95
95
  else
96
- redirect slice_url(:admin_list, :model_name => @model_name.snake_case), :message => {:notice => "#{@model_name} was successfully updated"}
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 slice_url(:admin_list, :model_name => @model_name.snake_case), :message => {:notice => "#{@model_name} was successfully destroyed"}
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 => eval("@instance.#{property.field}").strftime("%Y-%m-%d")) %>
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 => eval("@instance.#{property.field}").strftime("%Y-%m-%d %H:%M:%S")) %>
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 => eval("@instance.#{property.field}").strftime("%H:%M:%S")) %>
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
- <%= eval("instance.#{property.field}").strftime("%b. %d, %Y, %I:%M%p") %>
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
- <%= eval("instance.#{property.field}").strftime("%b. %d, %Y") %>
85
+ <% value = eval("instance.#{property.field}") %>
86
+ <%= value.respond_to?(:strftime) ? value.strftime("%b. %d, %Y") : nil %>
85
87
  <% when "Time" %>
86
- <%= eval("instance.#{property.field}").strftime("%I:%M%p") %>
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.0"
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sferik-merb-admin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Erik Michaels-Ober