ajaxcrud 0.9.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,80 @@
1
+ {twitter.com/vikonava}[http://www.twitter.com/vikonava]
2
+
3
+ = AjaxCRUD
4
+
5
+ Gem for Rails that creates a convenient scaffold using Ajax in an unobtrusive way usign jQuery and jQueryUI.
6
+
7
+ This gem has been tested working on Rails 3.
8
+
9
+ == Requirements
10
+
11
+ * jQuery
12
+ * jQuery_ujs
13
+ * jQueryUI (including stylesheet and images)
14
+
15
+ == Setup
16
+
17
+ Add the gem to your Gemfile then run +bundle+ to install it.
18
+
19
+ gem 'ajaxcrud'
20
+
21
+ Install jQuery and jQueryUI(js and css) using assets on Rails 3.1 by adding the next line to app/assets/javascripts/application.js
22
+
23
+ # app/assets/javascripts/application.js
24
+ //= require jquery
25
+ //= require jquery_ujs
26
+ //= require jquery-ui
27
+
28
+ And remember to also add the stylesheet and images included on jQueryUI to the app/assets/stylesheets/ folder.
29
+
30
+ == Usage
31
+
32
+ Theres only one command to run the generator and create a scaffold, and goes as follows:
33
+
34
+ rails g ajaxcrud NAME [field:type:boolean field:type:boolean]
35
+
36
+ Where <tt>NAME</tt> is the name of the model you are going to create. Additional to that <tt>field</tt> is the name of the attribute you are going to add and <tt>type</tt> is the type of field, just as a regular scaffold. The extra <tt>boolean</tt> in there is to indicate if that attribute is going to be indexed in the search field, it can be <tt>true</tt>, <tt>false</tt> or <tt>blank</tt> being false as default.
37
+
38
+ For example, if we are going to create a scaffold for <tt>Person</tt> which will include attributes <tt>name</tt>, <tt>address</tt>, <tt>website</tt> and <tt>phone_number</tt> being <tt>name</tt> and <tt>website</tt> the only attributes that are going to be indexed in the search field, we should run the following command:
39
+
40
+ rails g ajaxcrud Person name:string:true address:text website:string:true phone_number:string
41
+
42
+ This will create the Ajax scaffold and additional to that a general stylesheet to give some default color to the index table, an ajaxcrud helper to make <tt>index.html.erb</tt> more self-explanatory.
43
+
44
+ == Additional Configurations
45
+
46
+ You can configurate the default table to show more attributes that the one's indexed, just edit the <tt>show.html.erb</tt> file.
47
+
48
+ == Helpers
49
+
50
+ Helpers that are going to be added on <tt>index.html.erb</tt> are:
51
+
52
+ * ajaxcrud_js(name, new_text, info_text)
53
+ post a javascript required code inside your index file. Where <tt>name</tt> is the name of your model which in our example is <tt>person</tt>, <tt>new_text</tt> would be the text to show in the dialog box when a user is going to be created and also <tt>info_text</tt> works in a similar way but for the show dialog.
54
+
55
+ * ajaxcrud_dialogbox(name)
56
+ is used to post the code that build the dialog boxes on the file. Where <tt>name</tt> is the name of your model which in our example is <tt>person</tt>.
57
+
58
+ * ajaxcrud_notices(name)
59
+ is included in the place where notices will be shown in a <tt>flash[:notice]</tt> style but with some different finish. Where <tt>name</tt> is the name of your model which in our example is <tt>person</tt>.
60
+
61
+ * ajaxcrud_search(name)
62
+ is the search field used to look for in the table records. Where <tt>name</tt> is the name of your model which in our example is <tt>person</tt>.
63
+
64
+ * ajaxcrud_new_link(name)
65
+ creates the link to enable the New Record dialog. Where <tt>name</tt> is the name of your model which in our example is <tt>person</tt>.
66
+
67
+ * ajaxcrud_show_link(path)
68
+ creates the link to render the <tt>show.html.erb</tt> file of the selected record inside a dialog. Where <tt>path</tt> is the original way to access the show file.
69
+
70
+ == Known Bugs
71
+
72
+ * When creating the same ajaxcrud twice the <tt>migration</tt> file is going to be created more than once.
73
+ * If generator <tt>destroy</tt> is used everything is deleted (including the helper, <tt>ajaxcrud.css</tt>,...) of the model you indicate EXCEPT the migration file which needs to be removed manually.
74
+ * When destroying a model the <tt>ajaxcrud.css</tt> and <tt>ajaxcrud_helper.rb</tt> are also deleted. Since they are being used for all the scaffolds generated you can add them manually and remember to add +include AjaxcrudHelper+ to your app/helpers/application_helper.rb file.
75
+
76
+ == Special Thanks
77
+
78
+ This gem was made based on some of the tutorial made by 'Nikunj' at the {Tech Journey}[http://codefundas.blogspot.com/2010/12/create-ajax-based-curd-using-rails-3.html]'s website and being adapted to change or add some functionalities to that.
79
+
80
+ Also thanks to {Ryan Bates}[http://www.twitter.com/rbates] who helped me find out how to create my first generator and gem, and whose {website}[http://www.railscast.com] is awesome and has helped me a lot learning how to code in Ruby on Rails. Highly Recomended.
@@ -1,3 +1,3 @@
1
1
  module Ajaxcrud
2
- VERSION = "0.9.0"
2
+ VERSION = "1.0.0"
3
3
  end
@@ -1,8 +1,36 @@
1
1
  Description:
2
- Explain the generator
2
+ Creates a very nice ajax-based scaffold for a model.
3
3
 
4
4
  Example:
5
- rails generate ajaxcrud Thing
5
+ rails g ajaxcrud NAME [field:type:boolean field:type:boolean]
6
+
7
+ NAME - is the name of the model that is going to be built
8
+
9
+ FIELD - the name of the attribute
10
+ TYPE - the type of the attribute (string, integer, date, float, text, etc)
11
+ BOOLEAN - true if it's going to be indexed in the search field (default = false)
12
+
13
+ Creating table Person with attributes name, address, website and phone number indexing only name and website on the search field:
14
+
15
+ rails g ajaxcrud Person name:string:true address:text website:string:true phone_number:string
6
16
 
7
17
  This will create:
8
- what/will/it/create
18
+ db/migrate/{timestamp}_create_{name}.rb
19
+ app/models/{name}.rb
20
+ test/unit/{name}_test.rb
21
+ test/fixtures/{name}.yml
22
+ app/views/{name}/create.js.erb
23
+ app/views/{name}/destroy.js.erb
24
+ app/views/{name}/edit.js.erb
25
+ app/views/{name}/_form.html.erb
26
+ app/views/{name}/index.html.erb
27
+ app/views/{name}/_{name}.html.erb
28
+ app/views/{name}/search.js.erb
29
+ app/views/{name}/show.html.erb
30
+ app/views/{name}/update.js.erb
31
+ app/controllers/{name}/create.js.erb
32
+ test/unit/helpers/{name}_helper_test.rb
33
+ app/helpers/{name}_helper.rb
34
+ app/helpers/ajaxcrud_helper.rb
35
+ app/assets/stylesheets/ajaxcrud.css.scss
36
+ app/assets/stylesheets/images/success.png
metadata CHANGED
@@ -1,35 +1,27 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: ajaxcrud
3
- version: !ruby/object:Gem::Version
4
- hash: 59
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 9
9
- - 0
10
- version: 0.9.0
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Viko Nava
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2011-10-22 00:00:00 Z
12
+ date: 2011-10-22 00:00:00.000000000Z
19
13
  dependencies: []
20
-
21
- description: Creates complete scaffolds using ajax to create, edit and destroy on the same page. Also includes a real-time search field.
22
- email:
14
+ description: Creates complete scaffolds using ajax to create, edit and destroy on
15
+ the same page. Also includes a real-time search field.
16
+ email:
23
17
  - viko.nava@gmail.com
24
18
  executables: []
25
-
26
19
  extensions: []
27
-
28
20
  extra_rdoc_files: []
29
-
30
- files:
21
+ files:
31
22
  - .gitignore
32
23
  - Gemfile
24
+ - README.rdoc
33
25
  - Rakefile
34
26
  - ajaxcrud.gemspec
35
27
  - lib/ajaxcrud.rb
@@ -60,38 +52,28 @@ files:
60
52
  - lib/generators/ajaxcrud/templates/views/search.js.erb
61
53
  - lib/generators/ajaxcrud/templates/views/show.html.erb
62
54
  - lib/generators/ajaxcrud/templates/views/update.js.erb
63
- homepage: ""
55
+ homepage: ''
64
56
  licenses: []
65
-
66
57
  post_install_message:
67
58
  rdoc_options: []
68
-
69
- require_paths:
59
+ require_paths:
70
60
  - lib
71
- required_ruby_version: !ruby/object:Gem::Requirement
61
+ required_ruby_version: !ruby/object:Gem::Requirement
72
62
  none: false
73
- requirements:
74
- - - ">="
75
- - !ruby/object:Gem::Version
76
- hash: 3
77
- segments:
78
- - 0
79
- version: "0"
80
- required_rubygems_version: !ruby/object:Gem::Requirement
63
+ requirements:
64
+ - - ! '>='
65
+ - !ruby/object:Gem::Version
66
+ version: '0'
67
+ required_rubygems_version: !ruby/object:Gem::Requirement
81
68
  none: false
82
- requirements:
83
- - - ">="
84
- - !ruby/object:Gem::Version
85
- hash: 3
86
- segments:
87
- - 0
88
- version: "0"
69
+ requirements:
70
+ - - ! '>='
71
+ - !ruby/object:Gem::Version
72
+ version: '0'
89
73
  requirements: []
90
-
91
74
  rubyforge_project: ajaxcrud
92
75
  rubygems_version: 1.8.10
93
76
  signing_key:
94
77
  specification_version: 3
95
78
  summary: Scaffolding with Ajax
96
79
  test_files: []
97
-