thesilverspoon 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,6 @@
1
1
  def edit
2
2
  @<%= instance_name %> = <%= class_name %>.find(params[:id])
3
+ if !params[:get].nil?
3
4
  render :layout=>false
4
- end
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ def edit
2
+ @<%= instance_name %> = <%= class_name %>.find(params[:id])
3
+ if !params[:get].nil?
4
+ render :layout=>false
5
+ end
6
+ end
@@ -7,7 +7,14 @@
7
7
  <%%= csrf_meta_tags %>
8
8
  <script type="text/javascript">
9
9
  $(function() {
10
- $('a.activate_pageslide').pageslide({direction:"left"});
10
+ $(".edit_link").click(function(){
11
+ $.get("<%=params[:controller]%>"+"/"+$(this).attr("id")+"/edit?get=1",function(data){
12
+
13
+ $("#edit_form .modal-body").html(data);
14
+ $("#edit_form").modal('toggle');
15
+
16
+ }) ;
17
+ });
11
18
  });
12
19
  </script>
13
20
  <%%= yield(:head) %>
@@ -0,0 +1,87 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>BrandName</title>
5
+ <%%= stylesheet_link_tag "application" %>
6
+ <%%= javascript_include_tag "application" %>
7
+ <%%= csrf_meta_tags %>
8
+ <script type="text/javascript">
9
+ $(function() {
10
+ $(".edit_link").click(function(){
11
+ $.get("<%=params[:controller]%>"+"/"+$(this).attr("id")+"/edit?get=1",function(data){
12
+
13
+ $("#edit_form .modal-body").html(data);
14
+ $("#edit_form").modal('toggle');
15
+
16
+ }) ;
17
+ });
18
+ });
19
+ </script>
20
+ <%%= yield(:head) %>
21
+ <style>
22
+ table td {
23
+ border: none;
24
+ }
25
+
26
+ table tr {
27
+ border: none;
28
+ }
29
+ </style>
30
+ </head>
31
+ <body>
32
+ <div id="wrapper">
33
+ <div class="topbar" style="z-index: 999999999">
34
+ <div class="fill">
35
+ <div class="container">
36
+ <a class="brand" href="/">BrandName</a>
37
+ <ul class="nav">
38
+ <!--<li><a href="#about" style="color:white;">About</a></li>-->
39
+ <!--<li><a href="#contact" style="color:white;">Contact</a></li>-->
40
+ </ul>
41
+
42
+ <%% if !user_signed_in? %>
43
+ <%%= form_for(resource, :as => resource_name, :url => session_path(resource_name), :html => {:class => "pull-right"}) do |f| %>
44
+ <%%= f.email_field :email, :class=>"input-small", :placeholder=>"Email" %>
45
+ <%%= f.password_field :password, :class=>"input-small", :placeholder=>"Password" %>
46
+ <%%= f.submit "Sign In", :class=>"primary btn" %>
47
+ <%% end %>
48
+ <%% else %>
49
+ <div class="pull-right" style="margin-top: 10px;color:white;">
50
+ <%%= current_user.username %>
51
+ <span class="nav_link">
52
+ | <%%= link_to "Sign out", destroy_user_session_path, :method => :delete, :style=>"color:white;" %>
53
+ </span>
54
+ </div>
55
+ <%% end %>
56
+ </div>
57
+ </div>
58
+ </div>
59
+ <div class="container">
60
+
61
+ <div class="page-header" style="height:100px"></div>
62
+ <div style="position:absolute;margin-top: -110px;" class="span16">
63
+ <%%= yield(:page_header) %>
64
+ </div>
65
+
66
+ <div class="content">
67
+ <%%= js extend_gritter :position => :bottom_right %>
68
+ <%%= js add_gritter(flash[:notice], :image => :success, :title => "Notice", :sticky => false, :time => 2000) %>
69
+ <%%= js add_gritter(flash[:alert], :image => :warning, :title => "Alert!", :sticky => false, :time => 2000) %>
70
+ <%%= yield %>
71
+ </div>
72
+
73
+ <%% if request.fullpath=="/" %>
74
+
75
+ <footer>
76
+ <p>A <a href="http://www.ptotem.com">Ptotem Learning Projects</a> Initiative 2011</p>
77
+ </footer>
78
+
79
+ <%% end %>
80
+ </div>
81
+ </div>
82
+
83
+ <%%= javascript_include_tag "/assets/exclusions/jquery.pageslide" %>
84
+
85
+
86
+ </body>
87
+ </html>
@@ -50,7 +50,7 @@
50
50
 
51
51
  <div class="span4" style="text-align: center">
52
52
  <div class="pageslide_header">
53
- <h1 style="color:white">"<%= plural_name.titleize %>"</h1>
53
+ <h1>"<%= plural_name.titleize %>"</h1>
54
54
  </div>
55
55
  <br/>
56
56
  <br/>
@@ -88,38 +88,12 @@
88
88
  </div>
89
89
  </div>
90
90
 
91
- <table class="condensed-table">
92
- <%- for attribute in model_attributes -%>
93
- <tr>
94
- <td><%%= f.label :<%= attribute.name %> %></td>
95
-
96
- <%- if attribute.name.match('_id') %>
97
- <%% if ActiveRecord::Base.connection.table_exists? '<%=attribute.name.split('_')[0].pluralize %>' %>
98
- <td><%%= f.select :<%= attribute.name %>,<%= attribute.name.split('_')[0].capitalize %>.all.collect{|var|[var.name,var.id]} %></td>
99
- <%% else %>
100
- <td><%%= f.select :<%= attribute.name %>,[1,2,3,4,5] %></td>
101
- <%%end %>
102
-
103
-
104
- <%else %>
105
- <td><%%= f.<%= attribute.field_type %> :<%= attribute.name %> %></td>
106
- <% end %>
107
-
108
-
109
- </tr>
110
-
111
- <%- end -%>
112
- </table>
91
+
113
92
  <br>
114
93
  <br>
115
94
 
116
95
 
117
- <div class="modal-footer">
118
- <%%= f.submit "Submit", :style=>"margin:auto", :class=>"btn primary large" %>
119
- </div>
120
- </div>
121
-
122
- <%% end %>
96
+
123
97
  </td>
124
98
  </tr>
125
99
  <tr>
@@ -193,7 +167,7 @@
193
167
  <%- end %>
194
168
 
195
169
  <td class="options">
196
- <%%= link_to "Edit", <%= item_path :action => :edit %> %> |
170
+ <a href="#" id="<%%= attribute.id %> "class="edit_link" >Edit</a>| |
197
171
  <%%= link_to "Destroy", <%= item_path %>, :confirm => 'Are you sure?', :method => :delete %>
198
172
  </td>
199
173
  </tr>
@@ -0,0 +1,203 @@
1
+ <%%= content_for :head do %>
2
+ <%%= stylesheet_link_tag "/assets/exclusions/jquery_data_table" %>
3
+
4
+ <%# TODO: Move Script and CSS to unobtrusive files %>
5
+ <script type="text/javascript">
6
+ $(function() {
7
+ $('#example').dataTable({
8
+ "bJQueryUI": true,
9
+ "sPaginationType": "full_numbers"
10
+ });
11
+
12
+
13
+ })
14
+ </script>
15
+ <style>
16
+
17
+ tr.odd {
18
+ background-color: #e3f5ac;
19
+ }
20
+
21
+ tr.odd td.sorting_1 {
22
+ background-color: #d7e99f;
23
+ }
24
+
25
+ tr.even {
26
+ background-color: #ffffff;
27
+ }
28
+
29
+ tr.even td.sorting_1 {
30
+ background-color: #f2f2f2;
31
+ }
32
+
33
+ td.options {
34
+ width: 100px;
35
+ background: olive;
36
+ }
37
+
38
+ td.options a {
39
+ color: white;
40
+ }
41
+
42
+ </style>
43
+ <%% end %>
44
+
45
+ <%%= content_for :page_header do %>
46
+ <div class="pull-left" style="border: none;"><%%= image_tag('logo.png') %></div>
47
+ <%% end %>
48
+
49
+ <div class="row">
50
+
51
+ <div class="span4" style="text-align: center">
52
+ <div class="pageslide_header">
53
+ <h1>"<%= plural_name.titleize %>"</h1>
54
+ </div>
55
+ <br/>
56
+ <br/>
57
+ <table>
58
+ <tr>
59
+ <td>
60
+ <a href="#" data-controls-modal="new_form" data-backdrop="static">
61
+ <%%= image_tag('new.png', :size=>"32x32") %>
62
+ </a>
63
+ </td>
64
+ <td>
65
+ <a href="#" data-controls-modal="new_form" data-backdrop="static">
66
+ <h2>Create New</h2>
67
+ </a>
68
+
69
+ <div id="new_form" class="modal hide fade">
70
+ <div class="modal-header">
71
+ <a href="#" class="close"> &times; </a>
72
+
73
+ <h3>Create new record</h3>
74
+ </div>
75
+ <div class ="modal-body">
76
+ <%%= render 'form' %>
77
+ </div>
78
+
79
+
80
+ <div id="edit_form" class="modal hide fade">
81
+ <div class="modal-header">
82
+ <a href="#" class="close"> &times; </a>
83
+
84
+ <h3>Edit a record</h3>
85
+ </div>
86
+ <div class="modal-body">
87
+
88
+ </div>
89
+ </div>
90
+
91
+
92
+ <br>
93
+ <br>
94
+
95
+
96
+
97
+ </td>
98
+ </tr>
99
+ <tr>
100
+ <td>
101
+ <a href="#" data-controls-modal="upload_form" data-backdrop="static">
102
+ <%%= image_tag('upload.png', :size=>"32x32") %>
103
+ </a>
104
+ </td>
105
+ <td>
106
+ <a href="#" data-controls-modal="upload_form" data-backdrop="static">
107
+ <h2>Upload</h2>
108
+ </a>
109
+
110
+ <div id="upload_form" class="modal hide fade">
111
+ <div class="modal-header">
112
+ <a href="#" class="close"> &times; </a>
113
+
114
+ <h3>Upload Excel File</h3>
115
+ </div>
116
+ <%%= form_tag('/<%= instance_name %>/parse_save_from_excel', :multipart => true) do |f| %>
117
+ <div class="modal-body">
118
+ Select an Excel File :
119
+ <%%= file_field_tag :excel_file %>
120
+ </div>
121
+
122
+ <div class="modal-footer">
123
+ <%%= submit_tag 'Submit', :class=>"large btn primary pull-left" %>
124
+ </div>
125
+ <%% end -%>
126
+
127
+ </div>
128
+
129
+
130
+ </td>
131
+ </tr>
132
+ <tr>
133
+ <td>
134
+ <a href="<%%=<%= item_path :action => :new %> %>" class="add_new span3">
135
+ <%%= image_tag('download.png', :size=>"32x32") %>
136
+ </a>
137
+ </td>
138
+ <td>
139
+ <a href=" <%%=<%= item_path :action => :new %> %>" class="add_new span3">
140
+ <h2>Download</h2>
141
+ </a>
142
+ </td>
143
+ </tr>
144
+
145
+ </table>
146
+
147
+ </div>
148
+
149
+ <div class="span12">
150
+ <table class="jqueried_table display" cellpadding="0" cellspacing="0" border="0" id="example">
151
+ <thead>
152
+ <tr>
153
+ <%- for attribute in @model_attributes -%>
154
+ <th><%= attribute.human_name.titleize %></th>
155
+ <%- end -%>
156
+ <th>Manage</th>
157
+ </tr>
158
+ </thead>
159
+ <tbody>
160
+ <%% @<%= instances_name %>.each do |<%= instance_name %>| %>
161
+ <tr>
162
+ <%- for attribute in @model_attributes -%>
163
+ <td style="border-right: 1px solid #d3d3d3">
164
+ <a href="#" data-controls-modal="show_details" data-backdrop="static"><%%= <%= instance_name %>
165
+ .<%= attribute.name %> %></a>
166
+ </td>
167
+ <%- end %>
168
+
169
+ <td class="options">
170
+ <a href="#" id="<%%= attribute.id %> "class="edit_link" >Edit</a>| |
171
+ <%%= link_to "Destroy", <%= item_path %>, :confirm => 'Are you sure?', :method => :delete %>
172
+ </td>
173
+ </tr>
174
+
175
+
176
+ <div id="show_details" class="modal hide fade">
177
+ <div class="modal-header">
178
+ <a href="#" class="close"> &times; </a>
179
+
180
+ <h3><%%= "<%= singular_name.titleize %>" %></h3>
181
+ </div>
182
+ <div class="modal-body">
183
+ <%- for attribute in model_attributes -%>
184
+ <p>
185
+ <strong><%= attribute.human_name.titleize %>:</strong>
186
+ <%%= <%= instance_name %>.<%= attribute.name %> %>
187
+ </p>
188
+
189
+ <%- end -%>
190
+ </div>
191
+
192
+ <div class="modal-footer">
193
+ <a href="#" class="close"> Back </a>
194
+ </div>
195
+ </div>
196
+ <%%- end -%>
197
+ </tbody>
198
+ </table>
199
+
200
+ </div>
201
+
202
+ </div>
203
+ <br/>
@@ -302,11 +302,9 @@ module The_silver_spoon
302
302
  end
303
303
 
304
304
  def insert_devise_code
305
- inject_into_class "config/application.rb", :after=>"require 'rails/all'\n" do
306
-
307
- "require 'devise'"
308
- end
309
-
305
+ prepend_to_file "config/application.rb",'require "devise"'
306
+ inject_to_file "app/assets/stylesheets/application.css",'*=require_directory'
307
+ append_to_file "app/assets/javascripts/application.js",'//= require bootstrap'
310
308
  end
311
309
 
312
310
 
@@ -203,13 +203,13 @@ module Everything
203
203
 
204
204
 
205
205
  end
206
- #endd of class
206
+ #endd of class
207
207
 
208
208
  end
209
209
  module The_silver_spoon
210
210
  class Install < Rails::Generators::Base
211
211
 
212
- def self.source_root
212
+ def self.source_root
213
213
  File.expand_path("../templates", __FILE__)
214
214
  end
215
215
 
@@ -223,14 +223,11 @@ module The_silver_spoon
223
223
  Rails::Generators.invoke('devise', ["user"])
224
224
  Rails::Generators.invoke('devise:views')
225
225
  Rails::Generators.invoke('cancan:ability')
226
+ end
226
227
 
227
-
228
-
229
-
230
-
231
-
232
-
233
-
228
+ def create_appplication_helper
229
+ remove_file "app/helpers/application_helper.rb"
230
+ template 'application_helper.rb', "app/helpers/application_helper.rb"
234
231
  end
235
232
 
236
233
  def create_uploader
@@ -256,12 +253,21 @@ module The_silver_spoon
256
253
  def create_javascripts
257
254
 
258
255
  # copies the standard javascripts into the assets/javascripts folder - Currently hard-coded
259
- # TODO : Remove the hardcoding for the javascripts inclusion
256
+ # : Remove the hardcoding for the javascripts inclusion
260
257
 
261
258
  copy_file "#{Install.source_root}/assets/javascripts/jquery.dataTables.min.js", "app/assets/javascripts/jquery.dataTables.min.js"
262
259
 
263
260
  end
264
261
 
262
+ def create_stylesheet
263
+ template "#{Install.source_root}/assets/stylesheets/silverspoon.css.scss", "app/assets/stylesheets/silverspoon.css.scss"
264
+ template "#{Install.source_root}/assets/stylesheets/base_classes.css.scss", "app/assets/stylesheets/base_classes.css.scss"
265
+ template "#{Install.source_root}/assets/stylesheets/silverspoon.css.scss", "app/assets/stylesheets/information_page.css.scss"
266
+ template "#{Install.source_root}/assets/stylesheets/jquery-ui-1.8.17.custom.css", "app/assets/stylesheets/jquery-ui-1.8.17.custom.css"
267
+
268
+
269
+ end
270
+
265
271
  def create_stylesheets_exclusions
266
272
 
267
273
  # copies the sequenced css into the assets/stylesheets/exclusions folder
@@ -295,6 +301,12 @@ module The_silver_spoon
295
301
 
296
302
  end
297
303
 
304
+ def insert_devise_code
305
+ prepend_to_file "config/application.rb",'require "devise"'
306
+ append_to_file "app/assets/stylesheets/application.css",'*=require_directory'
307
+ append_to_file "app/assets/javascripts/application.js",'//= require bootstrap'
308
+ end
309
+
298
310
 
299
311
  end
300
312
 
@@ -1,3 +1,3 @@
1
1
  module Thesilverspoon
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
@@ -1,3 +1,3 @@
1
1
  module Thesilverspoon
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.5"
3
3
  end
@@ -29,5 +29,5 @@ s.add_dependency 'spreadsheet'
29
29
  s.add_dependency 'carrierwave'
30
30
  s.add_dependency 'devise'
31
31
  s.add_dependency 'cancan'
32
-
32
+ s.add_dependency 'bootstrap-sass'
33
33
  end
@@ -29,5 +29,5 @@ s.add_dependency 'spreadsheet'
29
29
  s.add_dependency 'carrierwave'
30
30
  s.add_dependency 'devise'
31
31
  s.add_dependency 'cancan'
32
-
32
+ s.add_dependency 'bootstrap-sass'
33
33
  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.4
4
+ version: 0.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-02-01 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: railties
16
- requirement: &80574660 !ruby/object:Gem::Requirement
16
+ requirement: &77153990 !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: *80574660
24
+ version_requirements: *77153990
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: bootstrap-sass
27
- requirement: &80574200 !ruby/object:Gem::Requirement
27
+ requirement: &77153570 !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: *80574200
35
+ version_requirements: *77153570
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: gritter
38
- requirement: &80573920 !ruby/object:Gem::Requirement
38
+ requirement: &77153260 !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: *80573920
46
+ version_requirements: *77153260
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: spreadsheet
49
- requirement: &80573590 !ruby/object:Gem::Requirement
49
+ requirement: &77152910 !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: *80573590
57
+ version_requirements: *77152910
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: carrierwave
60
- requirement: &80573180 !ruby/object:Gem::Requirement
60
+ requirement: &77152460 !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: *80573180
68
+ version_requirements: *77152460
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: devise
71
- requirement: &80572460 !ruby/object:Gem::Requirement
71
+ requirement: &77151750 !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: *80572460
79
+ version_requirements: *77151750
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: cancan
82
- requirement: &80572150 !ruby/object:Gem::Requirement
82
+ requirement: &77151500 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ! '>='
@@ -87,7 +87,18 @@ dependencies:
87
87
  version: '0'
88
88
  type: :runtime
89
89
  prerelease: false
90
- version_requirements: *80572150
90
+ version_requirements: *77151500
91
+ - !ruby/object:Gem::Dependency
92
+ name: bootstrap-sass
93
+ requirement: &77151190 !ruby/object:Gem::Requirement
94
+ none: false
95
+ requirements:
96
+ - - ! '>='
97
+ - !ruby/object:Gem::Version
98
+ version: '0'
99
+ type: :runtime
100
+ prerelease: false
101
+ version_requirements: *77151190
91
102
  description: This gem preps a new Rails app with some of the best Rails gems and Jquery
92
103
  sweetness available( Twitter-Bootstrap, Devise, CanCan, Rails Admin, Spreadsheet,
93
104
  ) Not only does it takes care of the installation of these gems, it also extends
@@ -111,6 +122,7 @@ files:
111
122
  - lib/templates/actions/create.rb
112
123
  - lib/templates/actions/destroy.rb
113
124
  - lib/templates/actions/edit.rb
125
+ - lib/templates/actions/edit.rb~
114
126
  - lib/templates/actions/index.rb
115
127
  - lib/templates/actions/integrated_view.rb
116
128
  - lib/templates/actions/new.rb
@@ -180,6 +192,7 @@ files:
180
192
  - lib/templates/helper.rb
181
193
  - lib/templates/layouts/application.html.erb
182
194
  - lib/templates/layouts/dummy_data.html.erb
195
+ - lib/templates/layouts/dummy_data.html.erb~
183
196
  - lib/templates/layouts/information_page.html.erb
184
197
  - lib/templates/layouts/pageslide_form_at.html.erb
185
198
  - lib/templates/layouts/welcome.html.erb
@@ -189,6 +202,7 @@ files:
189
202
  - lib/templates/views/erb/edit.html.erb
190
203
  - lib/templates/views/erb/index.html.erb
191
204
  - lib/templates/views/erb/integrated_view.html.erb
205
+ - lib/templates/views/erb/integrated_view.html.erb~
192
206
  - lib/templates/views/erb/new.html.erb
193
207
  - lib/templates/views/erb/show.html.erb
194
208
  - lib/thesilverspoon.rb