fullstack-admin 0.1.42 → 0.1.43

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.42
1
+ 0.1.43
@@ -36,4 +36,8 @@ overflow: visible;
36
36
 
37
37
  .tabs-left .nav-list.nav-tabs {
38
38
  padding-right: 0;
39
+ }
40
+
41
+ .popover {
42
+ z-index: 18000;
39
43
  }
@@ -224,5 +224,7 @@ list-style-type: none;
224
224
  .file-input-attachment-filename {
225
225
  width: 200px;
226
226
  display: inline-block;
227
- overflow: hidden;
227
+ white-space: nowrap;
228
+ overflow: hidden;
229
+ text-overflow: ellipsis;
228
230
  }
@@ -78,17 +78,23 @@ module AdminFormHelper
78
78
  }.uniq
79
79
 
80
80
  belongs_to_associations = model.reflect_on_all_associations(:belongs_to).select {|a|
81
- !a.options[:polymorphic]
81
+ !a.options[:polymorphic] && !a.options[:autosave]
82
82
  }.map {|assoc| assoc.name.to_s}
83
-
83
+
84
84
  polymorphic_associations = model.reflect_on_all_associations(:belongs_to).select {|a|
85
- a.options[:polymorphic]
85
+ a.options[:polymorphic] && !a.options[:autosave]
86
86
  }.map {|assoc| assoc.name.to_s}
87
+
88
+ autosave_belongs_to = model.reflect_on_all_associations(:belongs_to).select {|a|
89
+ a.options[:autosave]
90
+ }.map {|assoc| assoc.name.to_s}.compact
87
91
 
88
92
  has_many_associations = model.reflect_on_all_associations(:has_many).select {|a|
89
93
  a.options[:autosave]
90
94
  }.map {|assoc| assoc.name.to_s}
91
95
 
96
+
97
+
92
98
  columns -= polymorphic_associations
93
99
  columns += has_many_associations
94
100
 
@@ -115,12 +121,14 @@ module AdminFormHelper
115
121
  field = model.schema.hierarchy_fields[sym]
116
122
  is_belongs_to_associaiton = belongs_to_associations.include?(column)
117
123
  is_has_many_association = has_many_associations.include?(column)
124
+ is_autosave_belongs_to = autosave_belongs_to.include?(column)
118
125
 
119
126
  buff << if is_belongs_to_associaiton
120
127
  @target.input(sym, :as => :select)
121
128
 
122
- elsif is_has_many_association
123
- association_inputs(sym)
129
+ elsif is_has_many_association || is_autosave_belongs_to
130
+ association_inputs(sym)
131
+
124
132
  else
125
133
  opts = {}
126
134
  args = [sym]
@@ -169,8 +177,31 @@ module AdminFormHelper
169
177
  end
170
178
 
171
179
  def association_inputs(association)
172
- @target.template.render :partial => "associated_resources_table", :locals => {
173
- :association => association, :f => self }
180
+ assoc_str = association.to_s
181
+ is_singular = assoc_str.pluralize != assoc_str and assoc_str.singularize == assoc_str
182
+
183
+ if is_singular
184
+ if @target.template.partial?("nested_belongs_to_#{assoc_str}_fields")
185
+ @target.template.render :partial => "nested_belongs_to_#{assoc_str}_fields", :locals => {
186
+ :association => association, :f => self }
187
+ else
188
+ @target.template.render :partial => "nested_belongs_to_fields", :locals => {
189
+ :association => association, :f => self }
190
+ end
191
+
192
+ else
193
+
194
+ if @target.template.partial?("associated_#{assoc_str}_table")
195
+ @target.template.render :partial => "associated_#{assoc_str}_table", :locals => {
196
+ :association => association, :f => self }
197
+ else
198
+ @target.template.render :partial => "associated_resources_table", :locals => {
199
+ :association => association, :f => self }
200
+ end
201
+
202
+
203
+ end
204
+
174
205
  end
175
206
 
176
207
  end # ~
@@ -21,7 +21,8 @@ module ScaffoldHelper
21
21
  end
22
22
 
23
23
  def labelize_attribute_name(method)
24
- I18n.t("helpers.label.#{method}", :default => method.to_s.humanize)
24
+ method ||= "id"
25
+ I18n.t("helpers.label.#{method}", :default => method.to_s.humanize)
25
26
  end
26
27
 
27
28
  def sort_link(method)
@@ -3,11 +3,29 @@ class FileInput < FormtasticBootstrap::Inputs::FileInput
3
3
  generic_input_wrapping do
4
4
  attachment = object.send(method)
5
5
 
6
+ info_popup = ""
7
+ with_geom = attachment.styles.values.select do |decl|
8
+ decl.geometry
9
+ end
10
+
11
+ if with_geom.any?
12
+ infos = "<table class='table table-striped'>"
13
+ with_geom.each do |s|
14
+ infos << "<tr><th>#{s.name}</th><td>#{s.geometry}</td></tr>"
15
+ end
16
+ infos << "</table>"
17
+ title = I18n.t('fullstack.admin.info', :default => "Info")
18
+ content = template.send :h, infos
19
+ info_popup << "&nbsp; <i class='icon icon-info-sign' title='#{title}' data-content='#{content}' data-toggle='popover'></i>"
20
+ end
21
+
22
+
6
23
  if !attachment.exists?
7
24
  <<-eos
8
25
  <span class="file-input-attachment-filename">
9
26
  <i class="icon icon-file"></i> (#{I18n.t('fullstack.admin.no_file_uploaded', :default => "No file uploaded")})
10
27
  </span>
28
+ <span>#{info_popup}</span>
11
29
 
12
30
  <a class="btn btn-small file-input-choose-file-button" href="javascript:void(0)">
13
31
  <i class="icon icon-upload"></i>
@@ -33,11 +51,12 @@ class FileInput < FormtasticBootstrap::Inputs::FileInput
33
51
  <<-eos
34
52
 
35
53
  <span class="file-input-attachment-filename"><i class="icon icon-file"></i> #{template.send(:html_escape, attachment.url.split("/").last.split("?").first)} </span>
54
+ <span>#{info_popup}</span>
55
+
36
56
  <a class="btn btn-small file-input-choose-file-button" href="javascript:void(0)">
37
57
  <i class="icon icon-upload"></i>
38
58
  #{I18n.t('fullstack.admin.change', :default => "Change")}
39
59
  </a>
40
-
41
60
  <span class="dropdown">
42
61
  <a class="btn dropdown-toggle btn-small" data-toggle="dropdown" href="#">
43
62
  <i class="icon icon-eye-open"></i>
@@ -0,0 +1,7 @@
1
+ <%= f.inputs t(association, :scope => 'fullstack.admin.resources', :default => association.to_s.humanize), :class => "associated-resource" do %>
2
+
3
+ <%= f.admin_fields_for( association ) do |f| %>
4
+ <%= f.resource_inputs %>
5
+ <% end %>
6
+
7
+ <% end %>
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "fullstack-admin"
8
- s.version = "0.1.42"
8
+ s.version = "0.1.43"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["mcasimir"]
12
- s.date = "2012-09-04"
12
+ s.date = "2012-09-09"
13
13
  s.description = "Administration interface framework for fullstack"
14
14
  s.email = "maurizio.cas@gmail.com"
15
15
  s.extra_rdoc_files = [
@@ -985,6 +985,7 @@ Gem::Specification.new do |s|
985
985
  "app/views/admin/base/_associated_resources_table.html.erb",
986
986
  "app/views/admin/base/_form.html.erb",
987
987
  "app/views/admin/base/_index.html.erb",
988
+ "app/views/admin/base/_nested_belongs_to_fields.html.erb",
988
989
  "app/views/admin/base/_nested_form.html.erb",
989
990
  "app/views/admin/base/destroy.js.coffee",
990
991
  "app/views/admin/base/edit.html.erb",
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fullstack-admin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.42
4
+ version: 0.1.43
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-09-04 00:00:00.000000000 Z
12
+ date: 2012-09-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -1227,6 +1227,7 @@ files:
1227
1227
  - app/views/admin/base/_associated_resources_table.html.erb
1228
1228
  - app/views/admin/base/_form.html.erb
1229
1229
  - app/views/admin/base/_index.html.erb
1230
+ - app/views/admin/base/_nested_belongs_to_fields.html.erb
1230
1231
  - app/views/admin/base/_nested_form.html.erb
1231
1232
  - app/views/admin/base/destroy.js.coffee
1232
1233
  - app/views/admin/base/edit.html.erb
@@ -1317,7 +1318,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
1317
1318
  version: '0'
1318
1319
  segments:
1319
1320
  - 0
1320
- hash: 1212990792026625462
1321
+ hash: 1840774875680029255
1321
1322
  required_rubygems_version: !ruby/object:Gem::Requirement
1322
1323
  none: false
1323
1324
  requirements: