easy_admin_ui 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README +4 -15
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/{assets/icons → app/assets/images/easy_admin_ui}/classify.png +0 -0
- data/{assets/icons → app/assets/images/easy_admin_ui}/connect.png +0 -0
- data/{assets/icons → app/assets/images/easy_admin_ui}/delete.png +0 -0
- data/{assets/icons → app/assets/images/easy_admin_ui}/disconnect.png +0 -0
- data/{assets/icons → app/assets/images/easy_admin_ui}/pencil.png +0 -0
- data/{assets/icons → app/assets/images/easy_admin_ui}/show.png +0 -0
- data/app/assets/stylesheets/easy_admin_ui/easy_admin_ui.sass +47 -0
- data/app/views/easy_admin_ui/destroy.js.erb +1 -0
- data/{templates → app/views}/easy_admin_ui/edit.html.erb +0 -0
- data/{templates → app/views}/easy_admin_ui/index.html.erb +0 -0
- data/{templates → app/views}/easy_admin_ui/new.html.erb +0 -0
- data/{templates → app/views}/easy_admin_ui/show.html.erb +0 -0
- data/easy_admin_ui.gemspec +80 -21
- data/lib/easy_admin_ui/core_ext.rb +1 -3
- data/lib/easy_admin_ui/rails/engine.rb +10 -0
- data/lib/easy_admin_ui/tasks.rb +0 -10
- data/lib/easy_admin_ui/view_helpers.rb +3 -3
- data/lib/easy_admin_ui.rb +1 -9
- data/vendor/plugins/make_resourceful/.gitignore +1 -0
- data/vendor/plugins/make_resourceful/DEFAULTS +148 -0
- data/vendor/plugins/make_resourceful/LICENSE +7 -0
- data/vendor/plugins/make_resourceful/README.rdoc +239 -0
- data/vendor/plugins/make_resourceful/Rakefile +31 -0
- data/vendor/plugins/make_resourceful/VERSION +1 -0
- data/vendor/plugins/make_resourceful/generators/resourceful_scaffold/resourceful_scaffold_generator.rb +87 -0
- data/vendor/plugins/make_resourceful/generators/resourceful_scaffold/templates/controller.rb +5 -0
- data/vendor/plugins/make_resourceful/generators/resourceful_scaffold/templates/fixtures.yml +10 -0
- data/vendor/plugins/make_resourceful/generators/resourceful_scaffold/templates/functional_test.rb +50 -0
- data/vendor/plugins/make_resourceful/generators/resourceful_scaffold/templates/helper.rb +2 -0
- data/vendor/plugins/make_resourceful/generators/resourceful_scaffold/templates/migration.rb +13 -0
- data/vendor/plugins/make_resourceful/generators/resourceful_scaffold/templates/model.rb +2 -0
- data/vendor/plugins/make_resourceful/generators/resourceful_scaffold/templates/unit_test.rb +7 -0
- data/vendor/plugins/make_resourceful/generators/resourceful_scaffold/templates/view__form.haml +5 -0
- data/vendor/plugins/make_resourceful/generators/resourceful_scaffold/templates/view_edit.haml +11 -0
- data/vendor/plugins/make_resourceful/generators/resourceful_scaffold/templates/view_index.haml +5 -0
- data/vendor/plugins/make_resourceful/generators/resourceful_scaffold/templates/view_new.haml +9 -0
- data/vendor/plugins/make_resourceful/generators/resourceful_scaffold/templates/view_partial.haml +12 -0
- data/vendor/plugins/make_resourceful/generators/resourceful_scaffold/templates/view_show.haml +14 -0
- data/vendor/plugins/make_resourceful/init.rb +3 -0
- data/vendor/plugins/make_resourceful/lib/resourceful/base.rb +63 -0
- data/vendor/plugins/make_resourceful/lib/resourceful/builder.rb +385 -0
- data/vendor/plugins/make_resourceful/lib/resourceful/default/accessors.rb +402 -0
- data/vendor/plugins/make_resourceful/lib/resourceful/default/actions.rb +101 -0
- data/vendor/plugins/make_resourceful/lib/resourceful/default/callbacks.rb +51 -0
- data/vendor/plugins/make_resourceful/lib/resourceful/default/responses.rb +118 -0
- data/vendor/plugins/make_resourceful/lib/resourceful/default/urls.rb +137 -0
- data/vendor/plugins/make_resourceful/lib/resourceful/maker.rb +84 -0
- data/vendor/plugins/make_resourceful/lib/resourceful/response.rb +33 -0
- data/vendor/plugins/make_resourceful/lib/resourceful/serialize.rb +185 -0
- data/vendor/plugins/make_resourceful/spec/accessors_spec.rb +474 -0
- data/vendor/plugins/make_resourceful/spec/actions_spec.rb +310 -0
- data/vendor/plugins/make_resourceful/spec/base_spec.rb +12 -0
- data/vendor/plugins/make_resourceful/spec/builder_spec.rb +332 -0
- data/vendor/plugins/make_resourceful/spec/callbacks_spec.rb +71 -0
- data/vendor/plugins/make_resourceful/spec/integration_spec.rb +394 -0
- data/vendor/plugins/make_resourceful/spec/maker_spec.rb +91 -0
- data/vendor/plugins/make_resourceful/spec/response_spec.rb +37 -0
- data/vendor/plugins/make_resourceful/spec/responses_spec.rb +314 -0
- data/vendor/plugins/make_resourceful/spec/rspec-rails/LICENSE +37 -0
- data/vendor/plugins/make_resourceful/spec/rspec-rails/redirect_to.rb +113 -0
- data/vendor/plugins/make_resourceful/spec/rspec-rails/render_template.rb +90 -0
- data/vendor/plugins/make_resourceful/spec/serialize_spec.rb +133 -0
- data/vendor/plugins/make_resourceful/spec/spec_helper.rb +319 -0
- data/vendor/plugins/make_resourceful/spec/urls_spec.rb +282 -0
- data/vendor/plugins/make_resourceful/spec/views/things/create.rjs +1 -0
- data/vendor/plugins/make_resourceful/spec/views/things/destroy.rjs +1 -0
- data/vendor/plugins/make_resourceful/spec/views/things/edit.html.erb +4 -0
- data/vendor/plugins/make_resourceful/spec/views/things/edit.rjs +1 -0
- data/vendor/plugins/make_resourceful/spec/views/things/index.html.erb +4 -0
- data/vendor/plugins/make_resourceful/spec/views/things/index.rjs +1 -0
- data/vendor/plugins/make_resourceful/spec/views/things/new.html.erb +4 -0
- data/vendor/plugins/make_resourceful/spec/views/things/new.rjs +1 -0
- data/vendor/plugins/make_resourceful/spec/views/things/show.html.erb +4 -0
- data/vendor/plugins/make_resourceful/spec/views/things/show.rjs +1 -0
- data/vendor/plugins/make_resourceful/spec/views/things/update.rjs +1 -0
- metadata +75 -16
- data/assets/css/easy_admin_ui.css +0 -69
data/README
CHANGED
@@ -6,11 +6,12 @@ A very simple admin UI. If you need something more fancy look at ActiveScaffold.
|
|
6
6
|
Requirements
|
7
7
|
============
|
8
8
|
|
9
|
-
* make_resourceful
|
10
9
|
* formtastic
|
11
10
|
* kaminari
|
12
|
-
|
13
|
-
|
11
|
+
|
12
|
+
Rails 3.1 or later.
|
13
|
+
|
14
|
+
Requires jQuery.
|
14
15
|
|
15
16
|
To Do
|
16
17
|
=====
|
@@ -23,12 +24,6 @@ Installation
|
|
23
24
|
|
24
25
|
$ gem install easy_admin_ui
|
25
26
|
|
26
|
-
To use the rake tasks add:
|
27
|
-
|
28
|
-
require 'easy_admin_ui/tasks'
|
29
|
-
|
30
|
-
to your Rakefile.
|
31
|
-
|
32
27
|
How to use
|
33
28
|
==========
|
34
29
|
|
@@ -69,12 +64,6 @@ Then you need a partial below users/ named '_user.html.erb':
|
|
69
64
|
To add a class to your table cells just pass an array as done with the user.email
|
70
65
|
field in the above example.
|
71
66
|
|
72
|
-
Copy icons:
|
73
|
-
|
74
|
-
$ rake easy_admin_ui:copy_assets
|
75
|
-
|
76
|
-
Manually copy the sample CSS.
|
77
|
-
|
78
67
|
You need to provide the _form.html.erb partials yourself.
|
79
68
|
|
80
69
|
You can always override the default templates by providing templates yourself.
|
data/Rakefile
CHANGED
@@ -10,7 +10,7 @@ begin
|
|
10
10
|
gem.email = "martin@wulffeld.org"
|
11
11
|
gem.homepage = "http://github.com/wulffeld/easy_admin_ui"
|
12
12
|
gem.authors = ["Martin Moen Wulffeld"]
|
13
|
-
gem.add_dependency(%q<kaminari>,
|
13
|
+
gem.add_dependency(%q<kaminari>, ">= 0.12.4")
|
14
14
|
gem.add_dependency(%q<formtastic>, ">= 1.2.3")
|
15
15
|
end
|
16
16
|
Jeweler::GemcutterTasks.new
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.5.0
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,47 @@
|
|
1
|
+
table.easy
|
2
|
+
border-collapse: normal
|
3
|
+
margin-top: 4px
|
4
|
+
th
|
5
|
+
font-family: "Helvetica Neue", Arial, sans-serif
|
6
|
+
font-size: 12px
|
7
|
+
line-height: 14px
|
8
|
+
td
|
9
|
+
font-family: "Helvetica Neue", Arial, sans-serif
|
10
|
+
font-size: 12px
|
11
|
+
line-height: 14px
|
12
|
+
p
|
13
|
+
margin: 0 0 10px 0
|
14
|
+
th.wrap,
|
15
|
+
td.wrap
|
16
|
+
white-space: normal
|
17
|
+
thead
|
18
|
+
th
|
19
|
+
background-color: #E6E6E6
|
20
|
+
color: inherit
|
21
|
+
border: 1px solid #FFF
|
22
|
+
padding: 3px
|
23
|
+
td.textright
|
24
|
+
text-align: right
|
25
|
+
tbody
|
26
|
+
td
|
27
|
+
&.blank
|
28
|
+
background-color: inherit
|
29
|
+
color: inherit
|
30
|
+
border: none
|
31
|
+
background-color: #FFF
|
32
|
+
color: #333
|
33
|
+
width: auto
|
34
|
+
border-top: 1px dotted #DDD
|
35
|
+
padding: 4px 3px
|
36
|
+
&.act
|
37
|
+
margin: 0
|
38
|
+
padding-top: 2px
|
39
|
+
padding-bottom: 0
|
40
|
+
min-width: 150px
|
41
|
+
th.date,
|
42
|
+
td.date
|
43
|
+
width: 80px
|
44
|
+
th.datetime,
|
45
|
+
td.datetime
|
46
|
+
width: 110px
|
47
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
$('#tr_<%= current_model_name.underscore %>_<%= @item.id %>').remove();
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/easy_admin_ui.gemspec
CHANGED
@@ -4,14 +4,14 @@
|
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
|
-
s.name =
|
8
|
-
s.version = "0.
|
7
|
+
s.name = "easy_admin_ui"
|
8
|
+
s.version = "0.5.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
-
s.authors = [
|
12
|
-
s.date =
|
13
|
-
s.description =
|
14
|
-
s.email =
|
11
|
+
s.authors = ["Martin Moen Wulffeld"]
|
12
|
+
s.date = "2011-09-09"
|
13
|
+
s.description = "Very simple DRY admin UI."
|
14
|
+
s.email = "martin@wulffeld.org"
|
15
15
|
s.extra_rdoc_files = [
|
16
16
|
"README"
|
17
17
|
]
|
@@ -19,28 +19,87 @@ Gem::Specification.new do |s|
|
|
19
19
|
"README",
|
20
20
|
"Rakefile",
|
21
21
|
"VERSION",
|
22
|
-
"assets/
|
23
|
-
"assets/
|
24
|
-
"assets/
|
25
|
-
"assets/
|
26
|
-
"assets/
|
27
|
-
"assets/
|
28
|
-
"assets/
|
22
|
+
"app/assets/images/easy_admin_ui/classify.png",
|
23
|
+
"app/assets/images/easy_admin_ui/connect.png",
|
24
|
+
"app/assets/images/easy_admin_ui/delete.png",
|
25
|
+
"app/assets/images/easy_admin_ui/disconnect.png",
|
26
|
+
"app/assets/images/easy_admin_ui/pencil.png",
|
27
|
+
"app/assets/images/easy_admin_ui/show.png",
|
28
|
+
"app/assets/stylesheets/easy_admin_ui/easy_admin_ui.sass",
|
29
|
+
"app/views/easy_admin_ui/destroy.js.erb",
|
30
|
+
"app/views/easy_admin_ui/edit.html.erb",
|
31
|
+
"app/views/easy_admin_ui/index.html.erb",
|
32
|
+
"app/views/easy_admin_ui/new.html.erb",
|
33
|
+
"app/views/easy_admin_ui/show.html.erb",
|
29
34
|
"easy_admin_ui.gemspec",
|
30
35
|
"lib/easy_admin_ui.rb",
|
31
36
|
"lib/easy_admin_ui/core_ext.rb",
|
37
|
+
"lib/easy_admin_ui/rails/engine.rb",
|
32
38
|
"lib/easy_admin_ui/tasks.rb",
|
33
39
|
"lib/easy_admin_ui/view_helpers.rb",
|
34
40
|
"tasks/easy_admin_ui.rake",
|
35
|
-
"
|
36
|
-
"
|
37
|
-
"
|
38
|
-
"
|
41
|
+
"vendor/plugins/make_resourceful/.gitignore",
|
42
|
+
"vendor/plugins/make_resourceful/DEFAULTS",
|
43
|
+
"vendor/plugins/make_resourceful/LICENSE",
|
44
|
+
"vendor/plugins/make_resourceful/README.rdoc",
|
45
|
+
"vendor/plugins/make_resourceful/Rakefile",
|
46
|
+
"vendor/plugins/make_resourceful/VERSION",
|
47
|
+
"vendor/plugins/make_resourceful/generators/resourceful_scaffold/resourceful_scaffold_generator.rb",
|
48
|
+
"vendor/plugins/make_resourceful/generators/resourceful_scaffold/templates/controller.rb",
|
49
|
+
"vendor/plugins/make_resourceful/generators/resourceful_scaffold/templates/fixtures.yml",
|
50
|
+
"vendor/plugins/make_resourceful/generators/resourceful_scaffold/templates/functional_test.rb",
|
51
|
+
"vendor/plugins/make_resourceful/generators/resourceful_scaffold/templates/helper.rb",
|
52
|
+
"vendor/plugins/make_resourceful/generators/resourceful_scaffold/templates/migration.rb",
|
53
|
+
"vendor/plugins/make_resourceful/generators/resourceful_scaffold/templates/model.rb",
|
54
|
+
"vendor/plugins/make_resourceful/generators/resourceful_scaffold/templates/unit_test.rb",
|
55
|
+
"vendor/plugins/make_resourceful/generators/resourceful_scaffold/templates/view__form.haml",
|
56
|
+
"vendor/plugins/make_resourceful/generators/resourceful_scaffold/templates/view_edit.haml",
|
57
|
+
"vendor/plugins/make_resourceful/generators/resourceful_scaffold/templates/view_index.haml",
|
58
|
+
"vendor/plugins/make_resourceful/generators/resourceful_scaffold/templates/view_new.haml",
|
59
|
+
"vendor/plugins/make_resourceful/generators/resourceful_scaffold/templates/view_partial.haml",
|
60
|
+
"vendor/plugins/make_resourceful/generators/resourceful_scaffold/templates/view_show.haml",
|
61
|
+
"vendor/plugins/make_resourceful/init.rb",
|
62
|
+
"vendor/plugins/make_resourceful/lib/resourceful/base.rb",
|
63
|
+
"vendor/plugins/make_resourceful/lib/resourceful/builder.rb",
|
64
|
+
"vendor/plugins/make_resourceful/lib/resourceful/default/accessors.rb",
|
65
|
+
"vendor/plugins/make_resourceful/lib/resourceful/default/actions.rb",
|
66
|
+
"vendor/plugins/make_resourceful/lib/resourceful/default/callbacks.rb",
|
67
|
+
"vendor/plugins/make_resourceful/lib/resourceful/default/responses.rb",
|
68
|
+
"vendor/plugins/make_resourceful/lib/resourceful/default/urls.rb",
|
69
|
+
"vendor/plugins/make_resourceful/lib/resourceful/maker.rb",
|
70
|
+
"vendor/plugins/make_resourceful/lib/resourceful/response.rb",
|
71
|
+
"vendor/plugins/make_resourceful/lib/resourceful/serialize.rb",
|
72
|
+
"vendor/plugins/make_resourceful/spec/accessors_spec.rb",
|
73
|
+
"vendor/plugins/make_resourceful/spec/actions_spec.rb",
|
74
|
+
"vendor/plugins/make_resourceful/spec/base_spec.rb",
|
75
|
+
"vendor/plugins/make_resourceful/spec/builder_spec.rb",
|
76
|
+
"vendor/plugins/make_resourceful/spec/callbacks_spec.rb",
|
77
|
+
"vendor/plugins/make_resourceful/spec/integration_spec.rb",
|
78
|
+
"vendor/plugins/make_resourceful/spec/maker_spec.rb",
|
79
|
+
"vendor/plugins/make_resourceful/spec/response_spec.rb",
|
80
|
+
"vendor/plugins/make_resourceful/spec/responses_spec.rb",
|
81
|
+
"vendor/plugins/make_resourceful/spec/rspec-rails/LICENSE",
|
82
|
+
"vendor/plugins/make_resourceful/spec/rspec-rails/redirect_to.rb",
|
83
|
+
"vendor/plugins/make_resourceful/spec/rspec-rails/render_template.rb",
|
84
|
+
"vendor/plugins/make_resourceful/spec/serialize_spec.rb",
|
85
|
+
"vendor/plugins/make_resourceful/spec/spec_helper.rb",
|
86
|
+
"vendor/plugins/make_resourceful/spec/urls_spec.rb",
|
87
|
+
"vendor/plugins/make_resourceful/spec/views/things/create.rjs",
|
88
|
+
"vendor/plugins/make_resourceful/spec/views/things/destroy.rjs",
|
89
|
+
"vendor/plugins/make_resourceful/spec/views/things/edit.html.erb",
|
90
|
+
"vendor/plugins/make_resourceful/spec/views/things/edit.rjs",
|
91
|
+
"vendor/plugins/make_resourceful/spec/views/things/index.html.erb",
|
92
|
+
"vendor/plugins/make_resourceful/spec/views/things/index.rjs",
|
93
|
+
"vendor/plugins/make_resourceful/spec/views/things/new.html.erb",
|
94
|
+
"vendor/plugins/make_resourceful/spec/views/things/new.rjs",
|
95
|
+
"vendor/plugins/make_resourceful/spec/views/things/show.html.erb",
|
96
|
+
"vendor/plugins/make_resourceful/spec/views/things/show.rjs",
|
97
|
+
"vendor/plugins/make_resourceful/spec/views/things/update.rjs"
|
39
98
|
]
|
40
|
-
s.homepage =
|
41
|
-
s.require_paths = [
|
42
|
-
s.rubygems_version =
|
43
|
-
s.summary =
|
99
|
+
s.homepage = "http://github.com/wulffeld/easy_admin_ui"
|
100
|
+
s.require_paths = ["lib"]
|
101
|
+
s.rubygems_version = "1.8.10"
|
102
|
+
s.summary = "Easy Admin UI."
|
44
103
|
|
45
104
|
if s.respond_to? :specification_version then
|
46
105
|
s.specification_version = 3
|
data/lib/easy_admin_ui/tasks.rb
CHANGED
@@ -1,11 +1 @@
|
|
1
1
|
# require 'easy_admin_ui/tasks' in your Rakefile.
|
2
|
-
|
3
|
-
namespace :easy_admin_ui do
|
4
|
-
desc "Copies assets to public/images/icons/"
|
5
|
-
task :copy_assets do
|
6
|
-
FileUtils.mkdir_p "#{RAILS_ROOT}/public/images/icons/"
|
7
|
-
|
8
|
-
Dir.chdir(File.dirname(__FILE__) + '/../assets/')
|
9
|
-
FileUtils.cp_r(Dir.glob('icons/*.*'), "#{RAILS_ROOT}/public/images/icons/", :verbose => true)
|
10
|
-
end
|
11
|
-
end
|
@@ -67,7 +67,7 @@ module EasyAdminUi
|
|
67
67
|
end
|
68
68
|
|
69
69
|
def admin_show_link(item)
|
70
|
-
link_to(image_tag("/
|
70
|
+
link_to(image_tag("easy_admin_ui/show.png"), :action => 'show', :id => item)
|
71
71
|
end
|
72
72
|
|
73
73
|
def admin_new_link
|
@@ -75,7 +75,7 @@ module EasyAdminUi
|
|
75
75
|
end
|
76
76
|
|
77
77
|
def admin_edit_link(item)
|
78
|
-
link_to(image_tag("/
|
78
|
+
link_to(image_tag("easy_admin_ui/pencil.png"), :action => 'edit', :id => item)
|
79
79
|
end
|
80
80
|
|
81
81
|
# Use if below /admin/.
|
@@ -86,7 +86,7 @@ module EasyAdminUi
|
|
86
86
|
|
87
87
|
def delete_link_with_confirmation(obj, delete_path=nil)
|
88
88
|
delete_path ||= eval("#{obj.class.to_s.underscore.singularize}_path(obj)")
|
89
|
-
link_to_function(image_tag('/
|
89
|
+
link_to_function(image_tag('easy_admin_ui/delete.png'), "$('#cnf_#{obj.id}').show();") + ' ' +
|
90
90
|
raw('<span id="cnf_' + obj.id.to_s + '" class="conf_link" style="display: none;">Are you sure? ') +
|
91
91
|
link_to("Yes", delete_path, :method => :delete, :remote => true) + ' ' +
|
92
92
|
link_to_function("No", "$('#cnf_#{obj.id}').hide();") + raw('</span>')
|
data/lib/easy_admin_ui.rb
CHANGED
@@ -1,12 +1,4 @@
|
|
1
1
|
require 'easy_admin_ui/core_ext'
|
2
2
|
require 'easy_admin_ui/view_helpers'
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
ActionController::Base.class_eval do
|
7
|
-
include EasyAdminUi::CoreExt
|
8
|
-
end
|
9
|
-
|
10
|
-
ActionView::Base.class_eval do
|
11
|
-
include EasyAdminUi::ViewHelpers
|
12
|
-
end
|
4
|
+
require 'easy_admin_ui/rails/engine'
|
@@ -0,0 +1 @@
|
|
1
|
+
testapp
|
@@ -0,0 +1,148 @@
|
|
1
|
+
There's a rough equivalence between a basic @make_resourceful@ call
|
2
|
+
and a hand-made controller.
|
3
|
+
This:
|
4
|
+
|
5
|
+
class PostsController < ApplicationController
|
6
|
+
make_resourceful { actions :all }
|
7
|
+
end
|
8
|
+
|
9
|
+
Creates a controller that works more or less like the one that follows.
|
10
|
+
Note that the real code generated by make_resourceful
|
11
|
+
is more extensible in various ways.
|
12
|
+
Thus whenever possible, there are comments in the following controller
|
13
|
+
indicating how to customize various bits of the controller.
|
14
|
+
|
15
|
+
class PostsController < ApplicationController
|
16
|
+
def index
|
17
|
+
# Override #current_objects to change this
|
18
|
+
@posts = Post.all
|
19
|
+
|
20
|
+
# Use before :index to add something here
|
21
|
+
|
22
|
+
# Use response_for :index to change this
|
23
|
+
respond_to { |f| f.html; f.js }
|
24
|
+
end
|
25
|
+
|
26
|
+
def show
|
27
|
+
# Override #current_object to change this
|
28
|
+
@post = Post.find(params[:id])
|
29
|
+
|
30
|
+
# Use before :show to add something here
|
31
|
+
|
32
|
+
# Use response_for :show to change this
|
33
|
+
respond_to { |f| f.html; f.js }
|
34
|
+
end
|
35
|
+
|
36
|
+
def create
|
37
|
+
# Override #build_object to change this
|
38
|
+
@post = Post.new(params[:post])
|
39
|
+
|
40
|
+
# Use before :create to add something here
|
41
|
+
|
42
|
+
if @post.save
|
43
|
+
# Use after :create to add something here
|
44
|
+
|
45
|
+
# Use response_for :create to change this
|
46
|
+
respond_to do |f|
|
47
|
+
f.html do
|
48
|
+
flash[:notice] = "Create successful!"
|
49
|
+
redirect_to post_path(@post)
|
50
|
+
end
|
51
|
+
f.js
|
52
|
+
end
|
53
|
+
else
|
54
|
+
# Use after :create_fails to add something here
|
55
|
+
|
56
|
+
# Use response_for :create_fails to change this
|
57
|
+
respond_to do |f|
|
58
|
+
format.html
|
59
|
+
flash[:error] = "There was a problem!"
|
60
|
+
render :action => :new, :status => 422
|
61
|
+
end
|
62
|
+
format.js
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
def update
|
68
|
+
# Override #current_object to change this
|
69
|
+
@post = Post.find(params[:id])
|
70
|
+
|
71
|
+
# Use before :update to do something here
|
72
|
+
|
73
|
+
if @post.update_attributes params[:post]
|
74
|
+
# Use after :update to add something here
|
75
|
+
|
76
|
+
# Use response_for :update to change this
|
77
|
+
respond_to do |f|
|
78
|
+
f.html do
|
79
|
+
flash[:notice] = "Save successful!"
|
80
|
+
redirect_to post_path(@post)
|
81
|
+
end
|
82
|
+
f.js
|
83
|
+
end
|
84
|
+
else
|
85
|
+
# Use after :update_fails to add something here
|
86
|
+
|
87
|
+
# Use response_for :update_fails to change this
|
88
|
+
respond_to do |f|
|
89
|
+
format.html
|
90
|
+
flash[:error] = "There was a problem saving!"
|
91
|
+
render :action => :edit, :status => 422
|
92
|
+
end
|
93
|
+
format.js
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
def new
|
99
|
+
# Override #build_object to change this
|
100
|
+
@post = Post.new(params[:post])
|
101
|
+
|
102
|
+
# Use before :new to add something here
|
103
|
+
|
104
|
+
# Use response_for :new to change this
|
105
|
+
respond_to { |f| f.html; f.js }
|
106
|
+
end
|
107
|
+
|
108
|
+
def edit
|
109
|
+
# Override #current_object to change this
|
110
|
+
@post = Post.find(params[:id])
|
111
|
+
|
112
|
+
# Use before :edit to add something here
|
113
|
+
|
114
|
+
# Use response_for :edit to change this
|
115
|
+
respond_to { |f| f.html; f.js }
|
116
|
+
end
|
117
|
+
|
118
|
+
def destroy
|
119
|
+
# Override #current_object to change this
|
120
|
+
@post = Post.find(params[:id])
|
121
|
+
|
122
|
+
# Use before :destroy to do something here
|
123
|
+
|
124
|
+
if @post.destroy
|
125
|
+
# Use after :destroy to add something here
|
126
|
+
|
127
|
+
# Use response_for :destroy to change this
|
128
|
+
respond_to do |f|
|
129
|
+
f.html do
|
130
|
+
flash[:notice] = "Record deleted!"
|
131
|
+
redirect_to posts_path(@post)
|
132
|
+
end
|
133
|
+
f.js
|
134
|
+
end
|
135
|
+
else
|
136
|
+
# Use after :destroy_fails to add something here
|
137
|
+
|
138
|
+
# Use response_for :destroy_fails to change this
|
139
|
+
respond_to do |f|
|
140
|
+
format.html
|
141
|
+
flash[:error] = "There was a problem deleting!"
|
142
|
+
render :back
|
143
|
+
end
|
144
|
+
format.js
|
145
|
+
end
|
146
|
+
end
|
147
|
+
end
|
148
|
+
end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
Copyright (c) 2007-2010 Hampton Catlin
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
4
|
+
|
5
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
6
|
+
|
7
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|