scaffolding_extensions 1.5.5 → 1.6.0

Sign up to get free protection for your applications and to get access to all the features.
data/README CHANGED
@@ -21,14 +21,14 @@ to better suit your needs.
21
21
  Scaffolding Extensions currently supports:
22
22
 
23
23
  * Web Frameworks
24
- * Rails 3.2.3
24
+ * Rails 3.2.9
25
25
  * Ramaze 2011.12.28
26
26
  * Camping 2.1
27
- * Sinatra 1.3.1
28
- * Rack 1.4.0
27
+ * Sinatra 1.3.2
28
+ * Rack 1.4.1
29
29
  * Object Relational Mappers
30
- * ActiveRecord 3.2.3
31
- * Sequel 3.34.0
30
+ * ActiveRecord 3.2.9
31
+ * Sequel 3.39.0
32
32
  * DataMapper 1.0.2 (see doc/datamapper.txt for details)
33
33
  * Javascript Libaries (used for Ajax/Autocompleting, default is now JQuery)
34
34
  * Prototype 1.6.0.3
@@ -55,15 +55,17 @@ Support for other web frameworks and ORMs can be added, see the
55
55
  controller_spec.txt and model_spec.txt files for the methods that need to be
56
56
  defined.
57
57
 
58
+ The Scaffolding Extensions UI is now tab-based and requires Twitter Bootstrap
59
+ to be fully functional (though the UI is still usable without it).
60
+
58
61
  You can get Scaffolding Extensions via git or as a gem:
59
62
 
60
63
  * git: git://github.com/jeremyevans/scaffolding_extensions.git
61
64
  * gem: sudo gem install scaffolding_extensions
62
65
  * demo: http://se-demo.heroku.com
63
- * github: http://github.com/jeremyevans/scaffolding_extensions
66
+ * GitHub: http://github.com/jeremyevans/scaffolding_extensions
64
67
  * RDoc: http://scaffolding-ext.rubyforge.org
65
- * Bug Tracker: http://rubyforge.org/tracker/?atid=22169&group_id=5726&func=browse
66
- * Forum: http://rubyforge.org/forum/forum.php?forum_id=22403
68
+ * Issues: http://github.com/jeremyevans/scaffolding_extensions/issues
67
69
 
68
70
  == Quick Start
69
71
 
@@ -74,12 +76,13 @@ The recommended use of the plugin is to execute:
74
76
  inside of a controller. We'll assume the path to the controller is /admin.
75
77
 
76
78
  Then go to the index page for the controller (e.g. http://website/admin).
77
- You'll see a link to a management page for each of your models. Each
78
- management page has links to browse, create, delete, edit, show, search, and
79
- merge pages for the model. The pages are usable right away, but you'll want to
80
- add some configuration code to your models to specify the default names to
81
- display in select boxes, attributes to show on the forms, associations to show,
82
- whether to use select boxes or autocompleting text boxes, etc..
79
+ You'll see a link to pages for each of your models. Clicking on those links
80
+ takes you to the model's browse page, with tabs to access the create, delete,
81
+ edit, show, search, and merge pages for the model. The pages are usable right
82
+ away, but you'll want to add some configuration code to your models to specify
83
+ the default names to display in select boxes, attributes to show on the forms,
84
+ associations to show, whether to use select boxes or autocompleting text boxes,
85
+ etc..
83
86
 
84
87
  == Customization
85
88
 
@@ -113,7 +116,7 @@ to edit).
113
116
 
114
117
  @scaffold_use_auto_complete turns on autocompleting for the model, instead
115
118
  of using select boxes (necessary for a decent response time if you have a large
116
- number of records). See the advanced.txt for more autocompleting options.
119
+ number of records). See doc/advanced.txt for more autocompleting options.
117
120
 
118
121
  scaffold_name is an instance method that determines the name to use for each
119
122
  album inside those select boxes.
@@ -145,15 +148,19 @@ There are a ton of other customization options:
145
148
  * Control access to the model via a session variable (e.g. so a user can only
146
149
  see objects with a matching user_id)
147
150
 
148
- Consult advanced.txt and/or the RDoc if you would like more information on
151
+ Consult doc/advanced.txt and/or the RDoc if you would like more information on
149
152
  these (and many other options).
150
153
 
151
154
  == Testing
152
155
 
153
- See the testing.txt file for details on the plugin's automated test suite and
156
+ See doc/testing.txt for details on the plugin's automated test suite and
154
157
  Rails functional testing support.
155
158
 
156
159
  == Questions?
157
160
 
158
- Please post on the RubyForge forum if you have any questions about Scaffolding
159
- Extensions.
161
+ Please post an issue in the GitHub issue tracker if you have questions that
162
+ the existing documentation does not answer.
163
+
164
+ == Author
165
+
166
+ Jeremy Evans <code@jeremyevans.net>
@@ -9,7 +9,7 @@ function makeTreesC() {
9
9
  uls = document.getElementsByTagName("ul");
10
10
  for (uli=0;uli<uls.length;uli++) {
11
11
  ul = uls[uli];
12
- if (ul.nodeName == "UL" && ul.className == "scaffold_associations_tree") {
12
+ if (ul.nodeName == "UL" && ul.className.split(" ").indexOf("scaffold_associations_tree") != -1) {
13
13
  processULELC(ul);
14
14
  }
15
15
  }
@@ -11,15 +11,17 @@ module ScaffoldingExtensions
11
11
  show_edit = read_only ? :show : :edit
12
12
  so = @scaffold_object
13
13
  soid = so.scaffold_id
14
+ default_action = @scaffold_options[:default_action]
14
15
  singular_name = @scaffold_options[:singular_name]
16
+ return '' unless klass.scaffold_associations.any?{|a| klass.scaffold_show_association_links?(a)}
15
17
  content = '<h3 class="scaffold_associated_records_header">Associated Records</h3>'
16
- content << "<ul id='scaffolded_associations_#{singular_name}_#{soid}' class='#{klass.scaffold_association_list_class}'>\n"
18
+ content << "<ul id='scaffolded_associations_#{singular_name}_#{soid}' class='association_links #{klass.scaffold_association_list_class}'>\n"
17
19
  klass.scaffold_associations.each do |association|
18
20
  next unless klass.scaffold_show_association_links?(association)
19
21
  class_name = klass.scaffold_associated_name(association)
20
22
  human_name = klass.scaffold_associated_human_name(association)
21
23
  content << "<li>"
22
- content << scaffold_check_link(human_name, read_only, "manage_#{class_name}")
24
+ content << scaffold_check_link(human_name, read_only, "#{default_action}_#{class_name}")
23
25
  content << "\n "
24
26
  case klass.scaffold_association_type(association)
25
27
  when :one
@@ -217,10 +219,10 @@ module ScaffoldingExtensions
217
219
  "<label for='#{id}'>#{h text}</label>"
218
220
  end
219
221
 
220
- # 'a' tag with the content text. action and options are passed to
222
+ # 'a' tag with the content text. action and url_options are passed to
221
223
  # scaffold_url to get the href.
222
- def scaffold_link(text, action, options={})
223
- "<a href='#{scaffold_url(action, options)}'>#{h text}</a>"
224
+ def scaffold_link(text, action, url_options={}, tag_options={})
225
+ "<a #{"class=\"#{tag_options[:class]}\" " if tag_options[:class]}href='#{scaffold_url(action, url_options)}'>#{h text}</a>"
224
226
  end
225
227
 
226
228
  # Returns link to the scaffolded management page for the model if it was created by the scaffolding.
@@ -269,7 +271,7 @@ module ScaffoldingExtensions
269
271
  #{scaffold_form(scaffold_url("#{action}#{@scaffold_suffix}", options), :attributes=>scaffold_form_enctype(fields))}
270
272
  #{scaffold_model_field_tags(fields)}
271
273
  #{(yield content; content) if block_given?}
272
- <input class='btn btn-primary' type='submit' value="#{@scaffold_submit_value || "#{action.capitalize} #{@scaffold_options[:singular_lc_human_name]}"}" />
274
+ <input class='btn btn-primary' type='submit' value="#{@scaffold_submit_value || "#{action.capitalize} #{@scaffold_options[:singular_human_name]}"}" />
273
275
  </form>
274
276
  END
275
277
  end
@@ -296,6 +298,19 @@ module ScaffoldingExtensions
296
298
  "<select name='#{name}#{scaffold_param_list_suffix if multiple}' id='#{name}' #{"multiple='multiple'" if multiple}>#{'<option></option>' unless multiple}#{collection.collect{|obj| "<option value='#{i = obj.scaffold_id}' id='#{name}_#{i}'>#{h obj.scaffold_name}</option>"}.join("\n")}</select>"
297
299
  end
298
300
 
301
+ def scaffold_tabs
302
+ content = '<ul class="nav nav-tabs">'
303
+ [["#{@scaffold_options[:plural_human_name]}", :browse], ["New", :new], ["Show", :show], ["Edit", :edit], ["Delete", :delete], ["Merge", :merge], ["Search", :search]].each do |text, action|
304
+ link = scaffold_check_link(text, true, "#{action}#{@scaffold_suffix}")
305
+ action = :destroy if action == :delete
306
+ content << '<li'
307
+ content << ' class="active"' if action == @scaffold_action
308
+ content << ">#{scaffold_raw(link)}</li>"
309
+ end
310
+ content << '</ul>'
311
+ scaffold_raw(content)
312
+ end
313
+
299
314
  # Text field with scaffold autocompleting. The id is the html id, and the model name and association
300
315
  # are passed to scaffold_javascript_autocompleter. The options are passed to scaffold_field_tag.
301
316
  def scaffold_text_field_tag_with_auto_complete(id, model_name, association = nil, options = {})
@@ -50,7 +50,7 @@ module ScaffoldingExtensions
50
50
  def scaffold_load_associations_with_ajax_link
51
51
  soid = @scaffold_object.scaffold_id
52
52
  divid = "scaffold_ajax_content_#{soid}"
53
- "<div id='#{divid}'><a href='#{scaffold_url("edit#{@scaffold_suffix}", :id=>soid, :associations=>:show)}' onclick=\"$('##{divid}').load('#{scaffold_url("associations#{@scaffold_suffix}", :id=>soid)}'); return false;\">Modify Associations</a></div>"
53
+ "<div class='scaffold_ajax_content' id='#{divid}'><a href='#{scaffold_url("edit#{@scaffold_suffix}", :id=>soid, :associations=>:show)}' onclick=\"$('##{divid}').load('#{scaffold_url("associations#{@scaffold_suffix}", :id=>soid)}'); return false;\">Modify Associations</a></div>"
54
54
  end
55
55
 
56
56
  # Javascript that removes @remove_element_id from the page and inserts
@@ -3,6 +3,10 @@ module ScaffoldingExtensions
3
3
  module MetaController
4
4
  attr_accessor :scaffolded_methods, :scaffolded_nonidempotent_methods, :scaffolded_auto_complete_associations
5
5
 
6
+ def scaffold_default_action
7
+ @scaffold_default_action ||= DEFAULT_ACTION
8
+ end
9
+
6
10
  # The location of the scaffold templates
7
11
  def scaffold_template_dir
8
12
  @scaffold_template_dir ||= TEMPLATE_DIR
@@ -16,6 +20,7 @@ module ScaffoldingExtensions
16
20
  #
17
21
  # - :except: symbol or array of method symbols not to define
18
22
  # - :only: symbol or array of method symbols to define instead of the default
23
+ # - :default: method symbol to use as default landing page
19
24
  #
20
25
  # The following method symbols are used to control the methods that get
21
26
  # added by the scaffold function:
@@ -39,7 +44,7 @@ module ScaffoldingExtensions
39
44
  # an object, which then shows the attribute name and value for scaffolded fields.
40
45
  # Also shows associations specified in the model's scaffold_associations.
41
46
  def scaffold(klass, options = {})
42
- scaffold_setup
47
+ scaffold_setup
43
48
  singular_name = klass.scaffold_name
44
49
  singular_human_name = klass.scaffold_human_name
45
50
  plural_name = singular_name.pluralize
@@ -48,7 +53,8 @@ module ScaffoldingExtensions
48
53
  render_meth = :"render#{suffix}"
49
54
  add_methods = options[:only] ? Array(options[:only]) : scaffold_default_methods
50
55
  add_methods -= Array(options[:except])
51
- scaffold_options = {:singular_name=>singular_name, :plural_name=>plural_name, :singular_human_name=>singular_human_name, :plural_human_name=>plural_human_name, :class=>klass, :suffix=>suffix, :singular_lc_human_name=>singular_human_name.downcase, :plural_lc_human_name=>plural_human_name.downcase}
56
+ default_action = options[:default] || scaffold_default_action
57
+ scaffold_options = {:default_action=>default_action, :singular_name=>singular_name, :plural_name=>plural_name, :singular_human_name=>singular_human_name, :plural_human_name=>plural_human_name, :class=>klass, :suffix=>suffix, :singular_lc_human_name=>singular_human_name.downcase, :plural_lc_human_name=>plural_human_name.downcase}
52
58
 
53
59
  scaffold_auto_complete_for(klass) if klass.scaffold_use_auto_complete
54
60
  klass.scaffold_auto_complete_associations.each{|association| scaffold_auto_complete_for(klass, association)}
@@ -60,7 +66,7 @@ module ScaffoldingExtensions
60
66
 
61
67
  if add_methods.include?(:manage)
62
68
  scaffold_define_method("manage#{suffix}") do
63
- send(render_meth, :manage)
69
+ scaffold_redirect(default_action, suffix)
64
70
  end
65
71
  end
66
72
 
@@ -73,12 +79,12 @@ module ScaffoldingExtensions
73
79
 
74
80
  if add_methods.include?(:show)
75
81
  scaffold_define_method("show#{suffix}") do
82
+ @scaffold_action = :show
76
83
  if scaffold_request_id
77
84
  @scaffold_object ||= klass.scaffold_find_object(:show, scaffold_request_id, :session=>scaffold_session)
78
85
  @scaffold_associations_readonly = true
79
- send(render_meth, :show)
86
+ send(render_meth, :show)
80
87
  else
81
- @scaffold_action = :show
82
88
  send("list#{suffix}")
83
89
  end
84
90
  end
@@ -101,12 +107,12 @@ module ScaffoldingExtensions
101
107
  klass.scaffold_habtm_associations.each{|association| scaffold_habtm(klass, association)}
102
108
 
103
109
  scaffold_define_method("edit#{suffix}") do
110
+ @scaffold_action = :edit
104
111
  if scaffold_request_id
105
112
  @scaffold_show_associations = true if scaffold_request_param(:associations) == 'show'
106
113
  @scaffold_object ||= klass.scaffold_find_object(:edit, scaffold_request_id, :session=>scaffold_session)
107
114
  send(render_meth, :edit)
108
115
  else
109
- @scaffold_action = :edit
110
116
  send("list#{suffix}")
111
117
  end
112
118
  end
@@ -132,6 +138,7 @@ module ScaffoldingExtensions
132
138
  if add_methods.include?(:new)
133
139
  scaffold_define_method("new#{suffix}") do
134
140
  @scaffold_object ||= klass.scaffold_new_object(scaffold_request_param(singular_name), :session=>scaffold_session)
141
+ @scaffold_action = :new
135
142
  send(render_meth, :new)
136
143
  end
137
144
 
@@ -148,6 +155,7 @@ module ScaffoldingExtensions
148
155
  if add_methods.include?(:search)
149
156
  scaffold_define_method("search#{suffix}") do
150
157
  @scaffold_object ||= klass.scaffold_search_object
158
+ @scaffold_action = :search
151
159
  send(render_meth, :search)
152
160
  end
153
161
 
@@ -156,7 +164,7 @@ module ScaffoldingExtensions
156
164
  page -= 1 if scaffold_request_param(:page_previous)
157
165
  page += 1 if scaffold_request_param(:page_next)
158
166
  @scaffold_search_results_form_params, @scaffold_objects = klass.scaffold_search(:model=>scaffold_request_param(singular_name), :notnull=>Array(scaffold_request_param(:notnull)), :null=>Array(scaffold_request_param(:null)), :page=>page, :session=>scaffold_session)
159
- @scaffold_listtable_type = :search
167
+ @scaffold_action = :search
160
168
  send(render_meth, :listtable)
161
169
  end
162
170
  end
@@ -164,6 +172,7 @@ module ScaffoldingExtensions
164
172
  if add_methods.include?(:merge)
165
173
  scaffold_define_method("merge#{suffix}") do
166
174
  @scaffold_objects ||= klass.scaffold_find_objects(:merge, :session=>scaffold_session) unless klass.scaffold_use_auto_complete
175
+ @scaffold_action = :merge
167
176
  send(render_meth, :merge)
168
177
  end
169
178
 
@@ -183,7 +192,7 @@ module ScaffoldingExtensions
183
192
  unless @scaffold_objects
184
193
  @next_page, @scaffold_objects = klass.scaffold_browse_find_objects(:session=>scaffold_session, :page=>@page)
185
194
  end
186
- @scaffold_listtable_type = :browse
195
+ @scaffold_action = :browse
187
196
  send(render_meth, :listtable)
188
197
  end
189
198
  end
@@ -199,7 +208,7 @@ module ScaffoldingExtensions
199
208
  scaffold_setup
200
209
  links = scaffold_all_models_parse_options(options).collect do |model, options|
201
210
  scaffold(model, options)
202
- ["manage_#{model.scaffold_name}", model.scaffold_human_name]
211
+ ["#{scaffold_default_action}_#{model.scaffold_name}", model.scaffold_human_name]
203
212
  end
204
213
  scaffold_define_method('index') do
205
214
  @links = links
@@ -258,6 +267,7 @@ module ScaffoldingExtensions
258
267
  def scaffold_habtm(klass, association)
259
268
  scaffold_setup
260
269
  sn = klass.scaffold_name
270
+ shn = klass.scaffold_human_name
261
271
  scaffold_auto_complete_for(klass, association) if auto_complete = klass.scaffold_association_use_auto_complete(association)
262
272
 
263
273
  if klass.scaffold_habtm_with_ajax
@@ -299,9 +309,12 @@ module ScaffoldingExtensions
299
309
  end
300
310
  else
301
311
  suffix = "_#{sn}_#{association}"
312
+ scaffold_options={:aph_name=>association.to_s.humanize, :singular_name=>sn, :singular_human_name=>shn, :association=>association, :class=>klass, :suffix=>suffix}
313
+ # ash_name = association singular human name
314
+ scaffold_options[:ash_name] = scaffold_options[:aph_name].downcase
302
315
  # aplch_name = association plural lower case human name
303
- scaffold_options={:aplch_name=>association.to_s.humanize.downcase, :singular_name=>sn, :association=>association, :class=>klass, :suffix=>suffix}
304
- # aslch_name = association singular lower case human name
316
+ scaffold_options[:aplch_name] = scaffold_options[:aph_name].downcase
317
+ # aslhc_name = association singular lower case human name (typo!)
305
318
  scaffold_options[:aslhc_name] = scaffold_options[:aplch_name].singularize
306
319
 
307
320
  scaffold_define_method("edit#{suffix}") do
@@ -72,7 +72,7 @@ module ScaffoldingExtensions::MetaModel
72
72
  # - :auto_complete: Hash containing the default options to use for the scaffold
73
73
  # autocompleter (iv: @scaffold_auto_complete_options)
74
74
  SCAFFOLD_OPTIONS = {:text_to_string=>false,
75
- :table_classes=>{:form=>'table formtable', :list=>'table table-bordered table-condensed sortable', :show=>'table sortable'},
75
+ :table_classes=>{:form=>'table formtable', :list=>'table table-condensed table-striped sortable', :show=>'table sortable'},
76
76
  :column_type_options=>{},
77
77
  :column_types=>{},
78
78
  :column_options=>{},
@@ -434,7 +434,7 @@ module ScaffoldingExtensions::MetaModel
434
434
 
435
435
  # Don't set any fields left blank by the user
436
436
  h = {}
437
- attributes.each{|k,v| h[k] = v unless v.blank?}
437
+ attributes.each {|k,v| h[k] = v unless v.to_s.strip.empty?}
438
438
 
439
439
  scaffold_set_attributes(object, h)
440
440
  object
@@ -566,7 +566,7 @@ module ScaffoldingExtensions::MetaModel
566
566
  if allowed_attributes.include?(k)
567
567
  h[k] = v
568
568
  elsif convert_attributes.include?(k)
569
- h[k] = v.blank? ? '' : v.to_i.to_s
569
+ h[k] = v.to_s.strip.empty? ? '' : v.to_i.to_s
570
570
  end
571
571
  end
572
572
  h
@@ -54,7 +54,7 @@ module ScaffoldingExtensions
54
54
  def scaffold_load_associations_with_ajax_link
55
55
  soid = @scaffold_object.scaffold_id
56
56
  divid = "scaffold_ajax_content_#{soid}"
57
- "<div id='#{divid}'><a href='#{scaffold_url("edit#{@scaffold_suffix}", :id=>soid, :associations=>:show)}' onclick=\"new Ajax.Updater('#{divid}', '#{scaffold_url("associations#{@scaffold_suffix}", :id=>soid)}', {method:'get', asynchronous:true, evalScripts:true}); return false;\">Modify Associations</a></div>"
57
+ "<div class='scaffold_ajax_content' id='#{divid}'><a href='#{scaffold_url("edit#{@scaffold_suffix}", :id=>soid, :associations=>:show)}' onclick=\"new Ajax.Updater('#{divid}', '#{scaffold_url("associations#{@scaffold_suffix}", :id=>soid)}', {method:'get', asynchronous:true, evalScripts:true}); return false;\">Modify Associations</a></div>"
58
58
  end
59
59
 
60
60
  # Javascript that removes @remove_element_id from the page and inserts
@@ -42,11 +42,12 @@ module ScaffoldingExtensions
42
42
  END
43
43
  ROOT = File.dirname(File.dirname(__FILE__))
44
44
  TEMPLATE_DIR = File.join(ROOT, "scaffolds")
45
+ DEFAULT_ACTION = :browse
45
46
  DEFAULT_METHODS = [:manage, :show, :delete, :edit, :new, :search, :merge, :browse]
46
47
  MODEL_SUPERCLASSES = []
47
48
 
48
49
  @auto_complete_skip_style = false
49
-
50
+
50
51
  class << self
51
52
  attr_accessor :auto_complete_skip_style
52
53
  attr_writer :all_models, :model_files
data/scaffolds/edit.rhtml CHANGED
@@ -1,6 +1,13 @@
1
- <% @scaffold_title = "Editing #{@scaffold_options[:singular_lc_human_name]}" %>
1
+ <% @scaffold_title = "#{plural_name = @scaffold_options[:plural_human_name]} - Edit" %>
2
+
3
+ <%= scaffold_tabs %>
4
+
5
+ <h1>Editing <%= @scaffold_options[:singular_human_name] %>: <%= @scaffold_object.scaffold_name %></h1>
2
6
 
3
7
  <%=scaffold_raw scaffold_model_form('update', @scaffold_class.scaffold_fields(:edit)) %>
8
+ <% if delete = scaffolded_method?(ds = "destroy#{@scaffold_suffix}") %>
9
+ <%=scaffold_raw scaffold_button_to("Delete #{@scaffold_options[:singular_human_name]}", scaffold_url(ds, :id=>@scaffold_object.id), :class=>'btn-danger') %>
10
+ <% end %>
4
11
 
5
12
  <% if @scaffold_class.scaffold_load_associations_with_ajax && !@scaffold_show_associations %>
6
13
  <%=scaffold_raw scaffold_load_associations_with_ajax_link %>
@@ -9,4 +16,4 @@
9
16
  <%=scaffold_raw scaffold_association_links %>
10
17
  <% end %>
11
18
 
12
- <%=scaffold_raw scaffold_manage_link %>
19
+ <%=scaffold_raw scaffold_check_link('Manage Models', true, 'index') %>
@@ -1,24 +1,29 @@
1
- <% @scaffold_title = "Update #{sn = h(@scaffold_object.scaffold_name)}'s #{mpn = (so = @scaffold_options )[:aplch_name]}" %>
1
+ <% @scaffold_title = "#{sn = h((so = @scaffold_options)[:singular_human_name])} - Update #{mpn = so[:aph_name]}" %>
2
+ <h1>Update <%= mpn %> for <%= sn %>: <%=scaffold_raw @scaffold_object.scaffold_name %></h1>
2
3
 
3
4
  <%=scaffold_raw scaffold_form(scaffold_url("update#{@scaffold_suffix}", :id=>(soid=@scaffold_object.scaffold_id))) %>
4
5
 
5
6
  <% if @scaffold_class.scaffold_association_use_auto_complete(assoc = so[:association]) %>
6
- <h4>Add this <%= so[:aslhc_name] %></h4>
7
+ <h4>Add This <%= so[:ash_name] %></h4>
7
8
  <%=scaffold_raw scaffold_text_field_tag_with_auto_complete('add', so[:singular_name], assoc) %>
8
9
  <% elsif @items_to_add.length > 0 %>
9
- <h4>Add these <%= mpn %></h4>
10
+ <h4>Add These <%= mpn %></h4>
10
11
  <%=scaffold_raw scaffold_select_tag('add', @items_to_add, true) %>
11
12
  <% end %>
12
13
 
13
14
  <% if @items_to_remove.length > 0 %>
14
- <h4>Remove these <%= mpn %></h4>
15
+ <h4>Remove These <%= mpn %></h4>
15
16
  <%=scaffold_raw scaffold_select_tag('remove', @items_to_remove, true) %>
16
17
  <% end %>
17
18
 
18
19
  <br /><br />
19
- <input class="btn btn-primary" type='submit' value="Update <%= sn %>'s <%= mpn %>" />
20
+ <input class="btn btn-primary" type='submit' value="Update" />
20
21
  </form>
21
22
 
22
- <% if '' != (edit_link = scaffold_check_link("Edit #{sn}", true, "edit_#{@scaffold_options[:singular_name]}", :id=>soid)) %>
23
- <h2><%=scaffold_raw edit_link %></h2>
23
+ <% if '' != (edit_link = scaffold_check_link("Edit #{sn}: #{@scaffold_object.scaffold_name}", true, "edit_#{@scaffold_options[:singular_name]}", :id=>soid)) %>
24
+ <ul class="edit">
25
+ <li><%=scaffold_raw edit_link %></li>
26
+ </ul>
24
27
  <% end %>
28
+
29
+ <%=scaffold_raw scaffold_check_link('Manage Models', true, 'index') %>
@@ -1,5 +1,7 @@
1
- <% @scaffold_title = 'Manage Models' %>
2
- <ul>
1
+ <% @scaffold_title = 'Dashboard' %>
2
+ <h1>Dashboard</h1>
3
+
4
+ <ul class="models">
3
5
  <% @links.each do |link, human_name| %>
4
6
  <li><a href="<%= scaffold_url(link) %>"><%= human_name %></a></li>
5
7
  <% end %>
@@ -4,27 +4,20 @@
4
4
  <title>Scaffolding Extensions<%= " - #{@scaffold_title}" if @scaffold_title %></title>
5
5
  <link rel="stylesheet" type="text/css" href="/css/bootstrap.min.css" />
6
6
  <style type="text/css">
7
- body { background-color: #fff; color: #333; }
8
-
9
- body, p, ol, ul, td {
10
- font-family: verdana, arial, helvetica, sans-serif;
11
- font-size: 13px;
12
- line-height: 18px;
13
- }
14
-
15
7
  h1, h4 { margin-bottom: 10px; }
16
- h4 { font-size: 16px; }
17
8
 
18
9
  pre {
19
10
  background-color: #eee;
20
11
  padding: 10px;
21
12
  font-size: 11px;
22
13
  }
23
-
24
- a { color: #000; }
25
- a:visited { color: #666; }
26
- a:hover { color: #fff; background-color:#000; }
27
14
 
15
+ .navbar-inner {
16
+ -webkit-border-radius: 0;
17
+ -moz-border-radius: 0;
18
+ border-radius: 0;
19
+ }
20
+
28
21
  div.habtm_ajax_remove_associations form { display: inline; }
29
22
 
30
23
  div.auto_complete {
@@ -76,14 +69,23 @@
76
69
  </style>
77
70
  </head>
78
71
  <body>
79
- <% if @scaffold_title %>
80
- <h1><%= @scaffold_title %></h1>
81
- <% end %>
72
+ <div class="navbar">
73
+ <div class="navbar-inner">
74
+ <div class="container">
75
+ <a href="/admin" class="brand">Company Name</a>
76
+
77
+ <ul class="nav">
78
+ <li><a href="/admin">Dashboard</a></li>
79
+ </ul>
80
+ </div>
81
+ </div>
82
+ </div>
83
+ <div class="container-fluid">
82
84
  <% if scaffold_get_flash %>
83
85
  <h4><%= scaffold_get_flash %></h4>
84
86
  <% end %>
85
87
 
86
88
  <%= @content %>
87
-
89
+ </div>
88
90
  </body>
89
91
  </html>
data/scaffolds/list.rhtml CHANGED
@@ -1,13 +1,18 @@
1
- <% @scaffold_title = "Choose #{hn = @scaffold_options[:singular_lc_human_name]} to #{(haction = (action = @scaffold_action).to_s.humanize).downcase}" %>
1
+ <% (haction = (action = @scaffold_action).to_s.humanize).downcase %>
2
+ <% haction = 'Delete' if haction == 'Destroy' %>
3
+ <% @scaffold_title = "#{plural_name = @scaffold_options[:plural_human_name]} - #{haction}" %>
4
+
5
+ <%= scaffold_tabs %>
2
6
 
3
7
  <%=scaffold_raw scaffold_form(scaffold_url("#{action}#{@scaffold_suffix}"), :method=>scaffold_idempotent_action?(action) ? :get : :post) %>
8
+ <%= haction %> <%= @scaffold_options[:singular_human_name]%>:
4
9
  <% if @scaffold_class.scaffold_use_auto_complete %>
5
10
  <%=scaffold_raw scaffold_text_field_tag_with_auto_complete('id', @scaffold_options[:singular_name]) %>
6
11
  <% else %>
7
12
  <%=scaffold_raw scaffold_select_tag('id', @scaffold_objects) %>
8
13
  <% end %>
9
14
  <br /><br />
10
- <input class="btn btn-<%= scaffold_idempotent_action?(action) ? 'primary' : 'danger' %>" type="submit" value="<%= haction %> <%= hn %>" />
15
+ <input class="btn btn-<%= scaffold_idempotent_action?(action) ? 'primary' : 'danger' %>" type="submit" value="<%= haction %> <%= @scaffold_options[:singular_human_name] %>" />
11
16
  </form>
12
17
 
13
- <%=scaffold_raw scaffold_manage_link %>
18
+ <%=scaffold_raw scaffold_check_link('Manage Models', true, 'index') %>
@@ -1,48 +1,61 @@
1
- <% @scaffold_title = "Listing #{@scaffold_options[:plural_lc_human_name]}" %>
1
+ <% @scaffold_title = "#{plural_name = @scaffold_options[:plural_human_name]} - Browse" %>
2
+
3
+ <%= scaffold_tabs %>
2
4
 
3
5
  <table id="scaffolded" class="<%= @scaffold_class.scaffold_table_class(:list) %>">
4
- <thead><tr>
5
- <% @scaffold_class.scaffold_fields(@scaffold_listtable_type).each do |column| %>
6
+ <thead>
7
+ <tr>
8
+ <% @scaffold_class.scaffold_fields(@scaffold_action).each do |column| %>
6
9
  <th><%=h @scaffold_class.scaffold_column_name(column) %></th>
7
10
  <% end %>
8
11
  <% if show = scaffolded_method?(ss = "show#{@scaffold_suffix}") %>
9
- <th><%= s = 'Show' %></th>
12
+ <th>Show</th>
10
13
  <% end %>
11
14
  <% if edit = scaffolded_method?(es = "edit#{@scaffold_suffix}") %>
12
- <th><%= e = 'Edit' %></th>
15
+ <th>Edit</th>
13
16
  <% end %>
14
17
  <% if delete = scaffolded_method?(ds = "destroy#{@scaffold_suffix}") %>
15
- <th><%= d = 'Delete' %></th>
18
+ <th>Delete</th>
16
19
  <% end %>
17
- </tr></thead><tbody>
20
+ </tr>
21
+ </thead>
22
+ <tbody>
18
23
  <% @scaffold_objects.each do |entry| eid = entry.scaffold_id %>
19
24
  <tr>
20
- <% @scaffold_class.scaffold_fields(@scaffold_listtable_type).each do |column| %>
25
+ <% @scaffold_class.scaffold_fields(@scaffold_action).each do |column| %>
21
26
  <td><%=h entry.scaffold_value(column).to_s %></td>
22
27
  <% end %>
23
28
  <% if show %>
24
- <td><%=scaffold_raw scaffold_button_to(s, scaffold_url(ss, :id=>eid), :method=>:get, :class=>'btn-info') %></td>
29
+ <td><%=scaffold_raw scaffold_link('Show', ss, {:id=>eid}, :class=>'btn btn-info btn-mini') %></td>
25
30
  <% end %>
26
31
  <% if edit %>
27
- <td><%=scaffold_raw scaffold_button_to(e, scaffold_url(es, :id=>eid), :method=>:get, :class=>'btn-primary') %></td>
32
+ <td><%=scaffold_raw scaffold_link('Edit', es, {:id=>eid}, :class=>'btn btn-primary btn-mini') %></td>
28
33
  <% end %>
29
34
  <% if delete %>
30
- <td><%=scaffold_raw scaffold_button_to(d, scaffold_url(ds, :id=>eid), :class=>'btn-danger') %></td>
35
+ <td><%=scaffold_raw scaffold_button_to('Delete', scaffold_url(ds, :id=>eid), :class=>'btn btn-mini btn-danger') %></td>
31
36
  <% end %>
32
37
  </tr>
33
38
  <% end %>
34
- </tbody></table>
39
+ </tbody>
40
+ </table>
35
41
 
36
- <% if @scaffold_listtable_type == :browse %>
42
+ <% if @scaffold_action == :browse %>
43
+ <ul class="pager">
37
44
  <% if @page > 1 %>
38
- <a href="<%= scaffold_url("browse#{@scaffold_suffix}", :page=>(@page-1)) %>">Previous Page</a>
45
+ <li><a href="<%= scaffold_url("browse#{@scaffold_suffix}", :page=>(@page-1)) %>">Previous</a></li>
46
+ <% else %>
47
+ <li class="disabled"><a href="#">Previous</a></li>
39
48
  <% end %>
49
+
40
50
  <% if @next_page %>
41
- <a href="<%= scaffold_url("browse#{@scaffold_suffix}", :page=>(@page+1)) %>">Next Page</a>
51
+ <li><a href="<%= scaffold_url("browse#{@scaffold_suffix}", :page=>(@next_page ? @page+1 : @page)) %>">Next</a></li>
52
+ <% else %>
53
+ <li class="disabled"><a href="#">Next</a></li>
42
54
  <% end %>
55
+ </ul>
43
56
  <% end %>
44
57
 
45
- <% if @scaffold_listtable_type == :search && @scaffold_search_results_form_params && (@scaffold_search_results_form_params[:page] > 1 || @scaffold_search_results_form_params[:next_page]) %>
58
+ <% if @scaffold_action == :search && @scaffold_search_results_form_params && (@scaffold_search_results_form_params[:page] > 1 || @scaffold_search_results_form_params[:next_page]) %>
46
59
  <%=scaffold_raw scaffold_form(scaffold_url("results#{@scaffold_suffix}")) %>
47
60
  <%=scaffold_raw scaffold_field_tag(:hidden, :value=>@scaffold_search_results_form_params[:page], :id=>'page') %>
48
61
  <% @scaffold_search_results_form_params[:model].each do |key, value| %>
@@ -63,4 +76,4 @@
63
76
  </form>
64
77
  <% end %>
65
78
 
66
- <%=scaffold_raw scaffold_manage_link %>
79
+ <%=scaffold_raw scaffold_check_link('Manage Models', true, 'index') %>
@@ -1,7 +1,9 @@
1
- <% @scaffold_title = "Merge two #{@scaffold_options[:plural_lc_human_name]}" %>
1
+ <% @scaffold_title = "#{plural_name = @scaffold_options[:plural_human_name]} - Merge" %>
2
+
3
+ <%= scaffold_tabs %>
2
4
 
3
5
  <%=scaffold_raw scaffold_form(scaffold_url("merge_update#{@scaffold_suffix}")) %>
4
- <p>Merge:
6
+ <p>Merge <%= @scaffold_options[:singular_human_name] %>:
5
7
  <% if @scaffold_class.scaffold_use_auto_complete %>
6
8
  <%=scaffold_raw scaffold_text_field_tag_with_auto_complete('from', @scaffold_options[:singular_name]) %>
7
9
  <% else %>
@@ -9,7 +11,7 @@
9
11
  <% end %>
10
12
  </p>
11
13
 
12
- <p>into:
14
+ <p>Into <%= @scaffold_options[:singular_human_name] %>:
13
15
  <% if @scaffold_class.scaffold_use_auto_complete %>
14
16
  <%=scaffold_raw scaffold_text_field_tag_with_auto_complete('to', @scaffold_options[:singular_name]) %>
15
17
  <% else %>
@@ -17,7 +19,7 @@
17
19
  <% end %>
18
20
  </p>
19
21
 
20
- <input class="btn btn-danger" type="submit" value="Merge <%= @scaffold_options[:plural_lc_human_name] %>" />
22
+ <input class="btn btn-danger" type="submit" value="Merge <%= @scaffold_options[:plural_human_name] %>" />
21
23
  </form>
22
24
 
23
- <%=scaffold_raw scaffold_manage_link %>
25
+ <%=scaffold_raw scaffold_check_link('Manage Models', true, 'index') %>
data/scaffolds/new.rhtml CHANGED
@@ -1,5 +1,9 @@
1
- <% @scaffold_title = "Create new #{@scaffold_options[:singular_lc_human_name]}" %>
1
+ <% @scaffold_title = "#{plural_name = @scaffold_options[:plural_human_name]} - New" %>
2
+
3
+ <%= scaffold_tabs %>
4
+
5
+ <h1>Create New <%= @scaffold_options[:singular_human_name] %></h1>
2
6
 
3
7
  <%=scaffold_raw scaffold_model_form('create', @scaffold_class.scaffold_fields(:new)) %>
4
8
 
5
- <%=scaffold_raw scaffold_manage_link %>
9
+ <%=scaffold_raw scaffold_check_link('Manage Models', true, 'index') %>
@@ -1,11 +1,14 @@
1
- <% @scaffold_title = "Search #{@scaffold_options[:plural_lc_human_name]}" %>
1
+ <% @scaffold_title = "#{plural_name = @scaffold_options[:plural_human_name]} - Search" %>
2
2
 
3
- <%=scaffold_raw(scaffold_model_form('results', @scaffold_class.scaffold_fields(:search)) do |form|
3
+ <%= scaffold_tabs %>
4
+ <h1>Search <%= @scaffold_options[:plural_human_name] %></h1>
5
+
6
+ <%= scaffold_raw(scaffold_model_form('results', @scaffold_class.scaffold_fields(:search)) do |form|
4
7
  form << "<table class='#{@scaffold_class.scaffold_table_class(:form)}'><tbody>"
5
8
  form << "<tr><td><label for='null'>Null Fields</label></td><td><select name='null#{scaffold_param_list_suffix}' id='null' multiple='multiple'>#{@scaffold_class.scaffold_search_null_options.collect{|name, i| "<option value='#{i}'>#{name}</option>"}.join("\n")}</select></td></tr>\n"
6
9
  form << "<tr><td><label for='notnull'>Not Null Fields</label></td><td><select name='notnull#{scaffold_param_list_suffix}' id='notnull' multiple='multiple'>#{@scaffold_class.scaffold_search_null_options.collect{|name, i| "<option value='#{i}'>#{name}</option>"}.join("\n")}</select></td></tr>\n"
7
10
  form << '</tbody></table>'
8
- @scaffold_submit_value = @scaffold_title
9
- end)%>
11
+ @scaffold_submit_value = "Search #{@scaffold_options[:plural_human_name]}"
12
+ end) %>
10
13
 
11
- <%=scaffold_raw scaffold_manage_link %>
14
+ <%=scaffold_raw scaffold_check_link('Manage Models', true, 'index') %>
data/scaffolds/show.rhtml CHANGED
@@ -1,7 +1,8 @@
1
- <% @scaffold_title = "Showing #{@scaffold_options[:singular_lc_human_name]}" %>
2
- <% if '' != (edit_link = scaffold_check_link('Edit', true, "edit_#{@scaffold_options[:singular_name]}", :id=>@scaffold_object.scaffold_id)) %>
3
- <h2><%=scaffold_raw edit_link %></h2>
4
- <% end %>
1
+ <% @scaffold_title = "#{plural_name = @scaffold_options[:plural_human_name]} - Show" %>
2
+
3
+ <%= scaffold_tabs %>
4
+
5
+ <h1>Showing <%= @scaffold_options[:singular_human_name] %>: <%= @scaffold_object.scaffold_name %></h1>
5
6
 
6
7
  <table id="scaffolded" class="<%= @scaffold_class.scaffold_table_class(:show) %>">
7
8
  <thead><tr><th>Attribute</th><th>Value</th></tr></thead>
@@ -14,6 +15,12 @@
14
15
  <% end %>
15
16
  </tbody></table>
16
17
 
17
- <%=scaffold_raw scaffold_association_links %>
18
+ <% if edit = scaffolded_method?(es = "edit#{@scaffold_suffix}") %>
19
+ <ul class="edit">
20
+ <li><%=scaffold_raw scaffold_link("Edit #{@scaffold_options[:singular_human_name]}", es, :id=>@scaffold_object.id) %></li>
21
+ </ul>
22
+ <% end %>
23
+
24
+ <%= scaffold_raw scaffold_association_links %>
18
25
 
19
- <%=scaffold_raw scaffold_manage_link %>
26
+ <%=scaffold_raw scaffold_check_link('Manage Models', true, 'index') %>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scaffolding_extensions
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.5
4
+ version: 1.6.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-04-05 00:00:00.000000000 Z
12
+ date: 2012-12-11 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description:
15
15
  email: code@jeremyevans.net
@@ -69,11 +69,10 @@ files:
69
69
  - scaffolds/layout.rhtml
70
70
  - scaffolds/list.rhtml
71
71
  - scaffolds/listtable.rhtml
72
- - scaffolds/manage.rhtml
72
+ - scaffolds/edit.rhtml
73
73
  - scaffolds/merge.rhtml
74
74
  - scaffolds/new.rhtml
75
75
  - scaffolds/search.rhtml
76
- - scaffolds/edit.rhtml
77
76
  homepage: http://scaffolding-ext.rubyforge.org/
78
77
  licenses: []
79
78
  post_install_message:
@@ -111,7 +110,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
111
110
  version: '0'
112
111
  requirements: []
113
112
  rubyforge_project: scaffolding-ext
114
- rubygems_version: 1.8.11
113
+ rubygems_version: 1.8.23
115
114
  signing_key:
116
115
  specification_version: 3
117
116
  summary: Administrative database front-end for multiple web-frameworks and ORMs
@@ -1,17 +0,0 @@
1
- <% @scaffold_title = "Manage #{plural_name = @scaffold_options[:plural_lc_human_name]}" %>
2
- <ul>
3
- <% [["Browse #{plural_name}", :browse],
4
- ["Create #{singular_name = @scaffold_options[:singular_lc_human_name]}", :new],
5
- ["Delete #{singular_name}", :delete],
6
- ["Edit #{singular_name}", :edit],
7
- ["Merge #{plural_name}", :merge],
8
- ["Search #{plural_name}", :search],
9
- ["Show #{singular_name}", :show]].each do |text, action| %>
10
- <% link = scaffold_check_link(text, true, "#{action}#{@scaffold_suffix}")
11
- unless link == '' %>
12
- <li><%=scaffold_raw link %></li>
13
- <% end %>
14
- <% end %>
15
- </ul>
16
-
17
- <%=scaffold_raw scaffold_check_link('Manage Models', true, 'index') %>