thesilverspoon 0.0.22 → 0.0.23

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,5 +1,4 @@
1
1
 
2
- #The Gem is still under development.We recommend please do not download it yet.
3
2
  # The Silver Spoon
4
3
 
5
4
  Let your Rails App be born with a silver spoon in its mouth.
@@ -9,12 +8,12 @@ This gem preps a new Rails app with some of the best Rails gems and Jquery sweet
9
8
  * <b>Rails Admin</b> for System Management : https://github.com/sferik/rails_admin
10
9
  * <b>Devise</b> for Authentication : https://github.com/plataformatec/devise
11
10
  * <b>Cancan</b> for Authorization : https://github.com/ryanb/cancan
12
- * <b>Bootstrapped</b> and <b>NiftyGenerators</b> for Interface Design : https://github.com/entropillc/bootstrapped and https://github.com/ryanb/nifty-generators
11
+ * <b>Bootstrapped</b> for Layout Design : https://github.com/entropillc/bootstrapped
12
+ * <b>NiftyGenerators</b> for Form Design : https://github.com/ryanb/nifty-generators
13
13
  * <b>Gritter</b> for Notifications : https://github.com/RobinBrouwer/gritter
14
14
  * <b>Carrierwave</b> for File Uploading : https://github.com/jnicklas/carrierwave
15
15
  * <b>Spreadsheet</b> for Excel File Handling : http://spreadsheet.rubyforge.org/
16
16
 
17
-
18
17
  The Silver Spoon takes care of the installation of these gems, and basic implementations of the functionalities. As long as you can live with the conventional defaults specified for these gems, you will be ready to go. If you need customization, you would need to understand the usage of each of these gems individually, which you will find at the respective gem homepages.
19
18
 
20
19
  Apart from this, The Silver Spoon also extends the scaffolding in your app.
@@ -24,39 +23,39 @@ Apart from this, The Silver Spoon also extends the scaffolding in your app.
24
23
 
25
24
  ## Installation
26
25
 
27
- *Please note:
28
- Before using this gem , please copy the following in your gem file and run 'bundle install'
29
-
30
- ```console
31
- gem 'rails_admin', :git => 'git://github.com/sferik/rails_admin.git'
32
- ```
33
-
34
26
 
35
27
  The Silver Spoon works best if you use it in a new empty Rails App. It requires anything Rails 3.1.3 onwards.
36
28
 
37
- You can install it by simply adding the following line to your Gemfile and running bundle install:
29
+ You can install it by simply adding the following lines to your Gemfile:
38
30
 
39
31
  ```console
32
+ gem 'rails_admin', :git => 'git://github.com/sferik/rails_admin.git'
40
33
  gem 'thesilverspoon'
41
-
42
34
  ```
43
35
 
44
- After you have installed The Silver Spoon, you need to run the generator:
36
+ Now run bundle install. After you have installed The Silver Spoon, you need to run the generator:
45
37
 
46
38
  ```console
47
- rails generate thesilverspoon:install
39
+ rails generate thesilverspoon:install
48
40
  ```
49
41
 
42
+ Rails Admin will ask two questions, just press Enter to accept the defaults.
43
+ Run <b>rake db:migrate</b> <u>and</u> <b>rake db:seed</b> to finish the installation.
44
+
45
+ <b>N.B.</b> The db/seeds.rb file contains the creation code for the admin user. You can edit this before 'rake db:seed' to create your own admin credentials instead.
46
+
50
47
  ## Setup
51
48
 
52
49
  Post installation, your app will have the following:
53
50
 
54
51
  * All the gems mentioned above with standard configurations initialized.
55
52
  * A model called _'User'_ and views (in the devise directory) for you to customize
56
- * An Ability model to enable *cancan* for your authorization. You also get a admin user (email:admin@tss.com | password: secret) with administrative rights to the system. Remember to change the password before you deploy the app.
57
- * An Uploader Model in a uploaders directory and an uploading repository in /public to enable CarrierWave. You might need to install ImageMagick on your system to use photo manipulation with this feature though.
58
- * A Rails Admin interface at /administration. Use the admin user credentials to use this section
59
- * A set of basic image assets which you can replace to quickly start off your app.
53
+ * An Ability model to enable *Cancan* for your authorization. You also get a admin user (email:admin@tss.com | password: secret) with administrative rights to the system. Remember to change the password before you deploy the app.
54
+ * An Uploader Model in a uploaders directory and an uploading repository in /public to enable CarrierWave.
55
+ * A Rails Admin interface at /admin. Login with the admin user credentials to use this section
56
+ * A set of basic image assets which you can use or replace to quickly start off your app.
57
+
58
+ The root location would have been mapped to welcome#index and the relevant controller-action would have been created. Delete public/index.html to access the root location.
60
59
 
61
60
  ## Usage
62
61
 
@@ -68,19 +67,19 @@ The app has been started off with the standard Rails layout. The Silver Spoon al
68
67
  * To use the Nifty Generators style layout
69
68
 
70
69
  ```console
71
- rails generate nifty:layout
70
+ rails generate nifty:layout
72
71
  ```
73
72
 
74
73
  * To use the the Bootstrapped layout
75
74
 
76
75
  ```console
77
- rails generate bootstrapped:layout
76
+ rails generate bootstrapped:layout
78
77
  ```
79
78
 
80
79
  * To revert back to the default Rails layout
81
80
 
82
81
  ```console
83
- rails generate revert:layout
82
+ rails generate revert:layout
84
83
  ```
85
84
 
86
85
  ### Scaffolds
@@ -90,25 +89,27 @@ The Silver Spoon gives you the option of four scaffold styles:
90
89
  * To use The Silver Spoon scaffold
91
90
 
92
91
  ```console
93
- rails generate everything:scaffold Model [parameters]
92
+ rails generate everything:scaffold Model [parameters]
94
93
  ```
95
94
 
95
+ This creates a special layout for the scaffold, over-riding your application layout. Besides the standard views, you can also use an integrated view at '/tablename_integrated_view'
96
+
96
97
  * To use the Nifty Generators scaffold
97
98
 
98
99
  ```console
99
- rails generate nifty:scaffold Model [parameters]
100
+ rails generate nifty:scaffold Model [parameters]
100
101
  ```
101
102
 
102
103
  * To use the the Bootstrapped scaffold
103
104
 
104
105
  ```console
105
- rails generate bootstrapped:scaffold Model [parameters]
106
+ rails generate bootstrapped:scaffold Model [parameters]
106
107
  ```
107
108
 
108
109
  * To use the default Rails scaffold
109
110
 
110
111
  ```console
111
- rails generate scaffold Model [parameters]
112
+ rails generate scaffold Model [parameters]
112
113
  ```
113
114
 
114
115
 
@@ -1,8 +1,12 @@
1
1
  def create
2
2
  @<%= instance_name %> = <%= class_name %>.new(params[:<%= instance_name %>])
3
3
  if @<%= instance_name %>.save
4
+ if !params[:integrated_view].nil?
5
+ redirect_to <%= item_resource.pluralize %>_integrated_view_path, :notice => "Successfully created <%= class_name.underscore.humanize.downcase %>."
6
+ else
4
7
  redirect_to <%= items_url %>, :notice => "Successfully created <%= class_name.underscore.humanize.downcase %>."
8
+ end
5
9
  else
6
10
  render :new
7
11
  end
8
- end
12
+ end
@@ -0,0 +1,12 @@
1
+ def create
2
+ @<%= instance_name %> = <%= class_name %>.new(params[:<%= instance_name %>])
3
+ if @<%= instance_name %>.save
4
+ if !params[:integrated_view].nil?
5
+ redirect_to <%= item_resource.pluralize %>_integrated_view_path, :notice => "Successfully created <%= class_name.underscore.humanize.downcase %>."
6
+ else
7
+ redirect_to <%= items_url %>, :notice => "Successfully created <%= class_name.underscore.humanize.downcase %>."
8
+ end
9
+ else
10
+ render :new
11
+ end
12
+ end
@@ -1,5 +1,10 @@
1
1
  def destroy
2
2
  @<%= instance_name %> = <%= class_name %>.find(params[:id])
3
3
  @<%= instance_name %>.destroy
4
+ if !params[:integrated_view].nil?
5
+
6
+ redirect_to <%= item_resource.pluralize %>_integrated_view_path, :notice => "Successfully destroyed <%= class_name.underscore.humanize.downcase %>."
7
+ else
4
8
  redirect_to <%= items_url %>, :notice => "Successfully destroyed <%= class_name.underscore.humanize.downcase %>."
5
- end
9
+ end
10
+ end
@@ -0,0 +1,10 @@
1
+ def destroy
2
+ @<%= instance_name %> = <%= class_name %>.find(params[:id])
3
+ @<%= instance_name %>.destroy
4
+ if !params[:integrated_view].nil?
5
+
6
+ redirect_to <%= item_resource.pluralize %>_integrated_view_path, :notice => "Successfully destroyed <%= class_name.underscore.humanize.downcase %>."
7
+ else
8
+ redirect_to <%= items_url %>, :notice => "Successfully destroyed <%= class_name.underscore.humanize.downcase %>."
9
+ end
10
+ end
@@ -1,8 +1,14 @@
1
1
  def update
2
2
  @<%= instance_name %> = <%= class_name %>.find(params[:id])
3
3
  if @<%= instance_name %>.update_attributes(params[:<%= instance_name %>])
4
- redirect_to <%= items_url %>, :notice => "Successfully updated <%= class_name.underscore.humanize.downcase %>."
4
+ if !params[:integrated_view].nil?
5
+ redirect_to <%= item_resource.pluralize %>_integrated_view_path, :notice => "Successfully created <%= class_name.underscore.humanize.downcase %>."
6
+ else
7
+ redirect_to <%= items_url %>, :notice => "Successfully created <%= class_name.underscore.humanize.downcase %>."
8
+ end
9
+
10
+
5
11
  else
6
12
  render :edit
7
13
  end
8
- end
14
+ end
@@ -0,0 +1,14 @@
1
+ def update
2
+ @<%= instance_name %> = <%= class_name %>.find(params[:id])
3
+ if @<%= instance_name %>.update_attributes(params[:<%= instance_name %>])
4
+ if !params[:integrated_view].nil?
5
+ redirect_to <%= item_resource.pluralize %>_integrated_view_path, :notice => "Successfully created <%= class_name.underscore.humanize.downcase %>."
6
+ else
7
+ redirect_to <%= items_url %>, :notice => "Successfully created <%= class_name.underscore.humanize.downcase %>."
8
+ end
9
+
10
+
11
+ else
12
+ render :edit
13
+ end
14
+ end
@@ -1,20 +1,54 @@
1
1
  class <%= class_name %> < ActiveRecord::Base
2
- <%= " set_table_name :#{table_name}\n" if table_name -%>
3
- attr_accessible <%= model_attributes.map { |a| ":#{a.name}" }.join(", ") %>
4
- <% model_attributes.each do |attribute| %>
5
- <%= "#validates_presence_of :#{attribute.name}" %>
6
- <% if attribute.type==:integer -%>
7
- <%="#validates_numericality_of :#{attribute.name}"%>
8
- <% end -%>
9
- <% if attribute.type==:string -%>
10
- <%= "#validates_length_of :#{attribute.name} ,:maximum=>255" %>
11
- <% end -%>
2
+
3
+ <%= " set_table_name :#{table_name}\n" if table_name -%>
4
+
5
+ # ---------------
6
+ # Accessible Attributes
7
+ # ---------------
8
+ # Only accessible attributes can be created or modified. In case, you add more attributes through a later migration,
9
+ # remember to add the attribute to the attr_accessible list. Otherwise, many an hour is lost in figuring out why data is not
10
+ # getting captured through forms...
11
+
12
+ attr_accessible <%= model_attributes.map { |a| ":#{a.name}" }.join(", ") %>
13
+
14
+ # ---------------
15
+ # Associations
16
+ # ---------------
17
+ # Uncomment, copy and add you associations here...
18
+ # belongs_to :parent
19
+ # has_many :children, :dependent=>:destroy
20
+ # has_and_belongs_to_many :friends
21
+ # has_one :life
22
+
23
+
24
+ # ---------------
25
+ # Validations
26
+ # ---------------
27
+ # These are the standard validations that you might need to use with the models. Please uncomment as required...
28
+
29
+ <% model_attributes.each do |attribute|%>
30
+ # validates_presence_of :<%="#{attribute.name}" %>
31
+ <% if attribute.type==:integer -%>
32
+ # validates_numericality_of :<%="#{attribute.name}"%>
33
+ <% elsif attribute.type==:string -%>
34
+ # validates_length_of :<%= "#{attribute.name}" %> ,:maximum=>255
35
+ <% end -%>
12
36
  <% end -%>
13
37
 
14
- #Schema Information
38
+ # ---------------
39
+ # Schema Information
40
+ # ---------------
41
+ # Just so that you do not have to open up the migration file to check this everytime...
42
+
15
43
  <% model_attributes.each do |attribute| %>
16
- #<%= attribute.name %>:<%=attribute.type %>
17
- <% end %>
18
- #scopes
19
- #default_scope order('created_at DESC')
20
- end
44
+ # <%= attribute.name %>:<%=attribute.type %>
45
+ <% end %>
46
+
47
+ # ---------------
48
+ # Scope
49
+ # ---------------
50
+ # Consider using a model scope if you find yourself having to use 'order' too frequently in your finds
51
+
52
+ # default_scope order('created_at DESC')
53
+
54
+ end
@@ -0,0 +1,54 @@
1
+ class <%= class_name %> < ActiveRecord::Base
2
+
3
+ <%= " set_table_name :#{table_name}\n" if table_name -%>
4
+
5
+ # ---------------
6
+ # Accessible Attributes
7
+ # ---------------
8
+ # Only accessible attributes can be created or modified. In case, you add more attributes through a later migration,
9
+ # remember to add the attribute to the attr_accessible list. Otherwise, many an hour is lost in figuring out why data is not
10
+ # getting captured through forms...
11
+
12
+ attr_accessible <%= model_attributes.map { |a| ":#{a.name}" }.join(", ") %>
13
+
14
+ # ---------------
15
+ # Associations
16
+ # ---------------
17
+ # Uncomment, copy and add you associations here...
18
+ # belongs_to :parent
19
+ # has_many :children, :dependent=>:destroy
20
+ # has_and_belongs_to_many :friends
21
+ # has_one :life
22
+
23
+
24
+ # ---------------
25
+ # Validations
26
+ # ---------------
27
+ # These are the standard validations that you might need to use with the models. Please uncomment as required...
28
+
29
+ <% model_attributes.each do |attribute|%>
30
+ # validates_presence_of :<%="#{attribute.name}" %>
31
+ <% if attribute.type==:integer -%>
32
+ # validates_numericality_of :<%="#{attribute.name}"%>
33
+ <% elsif attribute.type==:string -%>
34
+ # validates_length_of :<%= "#{attribute.name}" %> ,:maximum=>255
35
+ <% end -%>
36
+ <% end -%>
37
+
38
+ # ---------------
39
+ # Schema Information
40
+ # ---------------
41
+ # Just so that you do not have to open up the migration file to check this everytime...
42
+
43
+ <% model_attributes.each do |attribute| %>
44
+ # <%= attribute.name %>:<%=attribute.type %>
45
+ <% end %>
46
+
47
+ # ---------------
48
+ # Scope
49
+ # ---------------
50
+ # Consider using a model scope if you find yourself having to use 'order' too frequently in your finds
51
+
52
+ # default_scope order('created_at DESC')
53
+
54
+ end
@@ -9,6 +9,12 @@
9
9
  "sPaginationType": "full_numbers"
10
10
  });
11
11
 
12
+ $('form').submit(function() {
13
+
14
+ $('form').append("<input type='hidden' name='integrated_view' value='yes'> ");
15
+ return true;
16
+
17
+ });
12
18
 
13
19
  })
14
20
  </script>
@@ -141,7 +147,7 @@
141
147
 
142
148
  <td class="options">
143
149
  <a href="#" id="<%%= <%= instance_name %>.id %> "class="edit_link" >Edit</a>|
144
- <%%= link_to "Destroy", <%= item_path %>, :confirm => 'Are you sure?', :method => :delete %>
150
+ <%%= link_to "Destroy", <%= item_path %>_path(:id=><%= instance_name %>.id,:integrated_view=>"yes"),:confirm => 'Are you sure?', :method => :delete %>
145
151
  </td>
146
152
  </tr>
147
153
 
@@ -9,6 +9,12 @@
9
9
  "sPaginationType": "full_numbers"
10
10
  });
11
11
 
12
+ $('form').submit(function() {
13
+
14
+ $('form').append("<input type='hidden' name='integrated_view' value='yes'> ");
15
+ return true;
16
+
17
+ });
12
18
 
13
19
  })
14
20
  </script>
@@ -141,7 +147,7 @@
141
147
 
142
148
  <td class="options">
143
149
  <a href="#" id="<%%= <%= instance_name %>.id %> "class="edit_link" >Edit</a>|
144
- <%%= link_to "Destroy", <%= item_path %>, :confirm => 'Are you sure?', :method => :delete %>
150
+ <%%= link_to "Destroy", <%= item_path %>_path(:id=><%= instance_name %>.id,:integrated_view=>"yes"),:confirm => 'Are you sure?', :method => :delete %>
145
151
  </td>
146
152
  </tr>
147
153
 
@@ -1,3 +1,3 @@
1
1
  module Thesilverspoon
2
- VERSION = "0.0.22"
2
+ VERSION = "0.0.23"
3
3
  end
@@ -1,3 +1,3 @@
1
1
  module Thesilverspoon
2
- VERSION = "0.0.22
2
+ VERSION = "0.0.22"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: thesilverspoon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.22
4
+ version: 0.0.23
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-02-03 00:00:00.000000000Z
12
+ date: 2012-02-04 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: railties
16
- requirement: &80254880 !ruby/object:Gem::Requirement
16
+ requirement: &86304980 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - =
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 3.1.3
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *80254880
24
+ version_requirements: *86304980
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: bootstrapped
27
- requirement: &80242840 !ruby/object:Gem::Requirement
27
+ requirement: &86303680 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *80242840
35
+ version_requirements: *86303680
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: gritter
38
- requirement: &80242450 !ruby/object:Gem::Requirement
38
+ requirement: &86303160 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *80242450
46
+ version_requirements: *86303160
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: spreadsheet
49
- requirement: &80241630 !ruby/object:Gem::Requirement
49
+ requirement: &86292990 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *80241630
57
+ version_requirements: *86292990
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: carrierwave
60
- requirement: &80241170 !ruby/object:Gem::Requirement
60
+ requirement: &86292720 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '0'
66
66
  type: :runtime
67
67
  prerelease: false
68
- version_requirements: *80241170
68
+ version_requirements: *86292720
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: devise
71
- requirement: &80240630 !ruby/object:Gem::Requirement
71
+ requirement: &86292440 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: '0'
77
77
  type: :runtime
78
78
  prerelease: false
79
- version_requirements: *80240630
79
+ version_requirements: *86292440
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: cancan
82
- requirement: &80240360 !ruby/object:Gem::Requirement
82
+ requirement: &86291980 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ! '>='
@@ -87,10 +87,10 @@ dependencies:
87
87
  version: '0'
88
88
  type: :runtime
89
89
  prerelease: false
90
- version_requirements: *80240360
90
+ version_requirements: *86291980
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: nifty-generators
93
- requirement: &80240060 !ruby/object:Gem::Requirement
93
+ requirement: &86291500 !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
96
96
  - - ! '>='
@@ -98,7 +98,7 @@ dependencies:
98
98
  version: '0'
99
99
  type: :runtime
100
100
  prerelease: false
101
- version_requirements: *80240060
101
+ version_requirements: *86291500
102
102
  description: This gem preps a new Rails app with some of the best Rails gems and Jquery
103
103
  sweetness available( Twitter-Bootstrap, Devise, CanCan, Rails Admin, Spreadsheet,
104
104
  ) Not only does it takes care of the installation of these gems, it also extends
@@ -174,7 +174,9 @@ files:
174
174
  - lib/integratedscaffold.rb
175
175
  - lib/integratedscaffold.rb~
176
176
  - lib/templates/actions/create.rb
177
+ - lib/templates/actions/create.rb~
177
178
  - lib/templates/actions/destroy.rb
179
+ - lib/templates/actions/destroy.rb~
178
180
  - lib/templates/actions/edit.rb
179
181
  - lib/templates/actions/edit.rb~
180
182
  - lib/templates/actions/index.rb
@@ -184,6 +186,7 @@ files:
184
186
  - lib/templates/actions/parse_save_from_excel.rb
185
187
  - lib/templates/actions/show.rb
186
188
  - lib/templates/actions/update.rb
189
+ - lib/templates/actions/update.rb~
187
190
  - lib/templates/application_helper.rb
188
191
  - lib/templates/assets/images/background.jpg
189
192
  - lib/templates/assets/images/download.png
@@ -258,6 +261,7 @@ files:
258
261
  - lib/templates/layouts/welcome.html.erb
259
262
  - lib/templates/migration.rb
260
263
  - lib/templates/model.rb
264
+ - lib/templates/model.rb~
261
265
  - lib/templates/views/erb/_form.html.erb
262
266
  - lib/templates/views/erb/edit.html.erb
263
267
  - lib/templates/views/erb/edit.html.erb~