asf_scaffold_generator 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -58,7 +58,7 @@ class AsfScaffoldGenerator < ScaffoldGenerator
58
58
  # DCHASMAN TODO Remove this when the show, new and edit templates are ready
59
59
  def scaffold_views
60
60
  #%w(list show new edit)
61
- %w(list)
61
+ %w(list show)
62
62
  end
63
63
 
64
64
  # Override with your own usage banner.
@@ -0,0 +1,17 @@
1
+ # Filters added to this controller will be run for all controllers in the application.
2
+ # Likewise, all the methods added will be available for all controllers.
3
+ class ApplicationController < ActionController::Base
4
+ before_filter :asf_sid_authenticate
5
+
6
+ def asf_sid_authenticate
7
+ # Look to see if a SID was passed in the URL
8
+ sid = params[:sid]
9
+ if sid
10
+ api_server_url = params[:api_server_url]
11
+ api_server_url = 'http://na1-api.salesforce.com/services/Soap/u/7.0' unless api_server_url
12
+
13
+ puts "asf_sid_authenticate(:sid => '#{sid}', :url => '#{api_server_url}')"
14
+ Contact.establish_connection(:adapter => 'activesalesforce', :sid => sid, :url => api_server_url) if sid
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,39 @@
1
+ <% model = model_name.constantize
2
+ connection = model.connection
3
+ entity_name = connection.entity_name_from_table(model.table_name)
4
+ entity_def = connection.get_entity_def(entity_name)
5
+ layouts = entity_def.layouts
6
+ %>
7
+ <table>
8
+ <% layouts[:layouts][:detailLayoutSections].each do |section|
9
+ rows = section[:layoutRows]
10
+ rows = [ rows ] unless rows.is_a? Array
11
+ rows.each do | row |
12
+ %>
13
+ <tr>
14
+ <% items = row[:layoutItems]
15
+ items = [ items ] unless items.is_a? Array
16
+ items.each do | item |
17
+ %>
18
+ <td><%= item[:label] %></td>
19
+ <% components = item[:layoutComponents]
20
+ components = [ components ] unless components.is_a? Array
21
+ %>
22
+ <td>
23
+ <% components.each do |component|
24
+ next if component.nil?
25
+ if component[:type] == "Field"
26
+ field = component[:value]
27
+ column = entity_def.api_name_to_column[field]
28
+ %>
29
+ <%%= @<%= singular_name %>.<%= column.name %> %>
30
+ <% end
31
+ end
32
+ %>
33
+ </td>
34
+ <% end %>
35
+ </tr>
36
+ <% end
37
+ end
38
+ %>
39
+ </table>
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.11
3
3
  specification_version: 1
4
4
  name: asf_scaffold_generator
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.0.3
7
- date: 2006-02-25 00:00:00 -05:00
6
+ version: 0.0.4
7
+ date: 2006-02-26 00:00:00 -05:00
8
8
  summary: ActiveSalesforce Generator provides additional salesforce aware scaffolding support.
9
9
  require_paths:
10
10
  - lib
@@ -38,6 +38,7 @@ files:
38
38
  - ./templates/asf_view_edit.rhtml
39
39
  - ./templates/asf_view_new.rhtml
40
40
  - ./templates/asf_layout.rhtml
41
+ - ./templates/asf_application.rb
41
42
  - templates/asf_view_list.rhtml
42
43
  - templates/asf_common.css
43
44
  - templates/asf_view_show.rhtml
@@ -45,6 +46,7 @@ files:
45
46
  - templates/asf_view_edit.rhtml
46
47
  - templates/asf_view_new.rhtml
47
48
  - templates/asf_layout.rhtml
49
+ - templates/asf_application.rb
48
50
  - USAGE
49
51
  test_files: []
50
52