fullstack-admin 0.1.35 → 0.1.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION +1 -1
- data/app/assets/javascripts/support/file_input.js.coffee +31 -0
- data/app/assets/javascripts/support/forms.js.coffee +2 -0
- data/app/assets/stylesheets/admin/base.css +15 -0
- data/app/assets/stylesheets/support/forms.css +14 -0
- data/app/controllers/admin/base_controller.rb +8 -1
- data/app/helpers/admin_form_helper.rb +9 -11
- data/app/helpers/scaffold_helper.rb +0 -6
- data/app/inputs/file_input.rb +67 -0
- data/app/views/admin/base/_associated_resources_table.html.erb +1 -1
- data/app/views/admin/base/_nested_form.html.erb +7 -1
- data/app/views/layouts/admin.html.erb +2 -1
- data/config/locales/it.yml +5 -0
- data/fullstack-admin.gemspec +4 -3
- metadata +5 -4
- data/app/inputs/image_input.rb +0 -11
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.36
|
@@ -0,0 +1,31 @@
|
|
1
|
+
$(document).ready ->
|
2
|
+
$(".file-input-choose-file-button").live "click", ->
|
3
|
+
self = $(@)
|
4
|
+
|
5
|
+
if self.hasClass("disabled")
|
6
|
+
return 0
|
7
|
+
|
8
|
+
file_input = self.find("~ input[type='file']")
|
9
|
+
file_name_span = self.closest(".input").find(".file-input-attachment-filename")
|
10
|
+
|
11
|
+
file_input.change ->
|
12
|
+
file_input_val = file_input.val()
|
13
|
+
file_name = file_input_val.substring(file_input_val.lastIndexOf('/') + 1).substring(file_input_val.lastIndexOf('\\') + 1)
|
14
|
+
file_name_span.text(file_name)
|
15
|
+
|
16
|
+
file_input.click()
|
17
|
+
|
18
|
+
$(".file-input-delete-attachment-button").live "click", ->
|
19
|
+
|
20
|
+
btn = $(@)
|
21
|
+
input_container = btn.closest(".input")
|
22
|
+
|
23
|
+
if btn.hasClass("active")
|
24
|
+
input_container.find(".btn:not(.file-input-delete-attachment-button)").addClass("disabled")
|
25
|
+
btn.siblings(".file-input-attachment-filename").css({"text-decoration": "line-through", opacity: 0.5})
|
26
|
+
btn.find("~ .file-input-delete-attachment-checkbox").attr('checked', true);
|
27
|
+
else
|
28
|
+
input_container.find(".btn:not(.file-input-delete-attachment-button)").removeClass("disabled")
|
29
|
+
btn.siblings(".file-input-attachment-filename").css({"text-decoration": "none", opacity: 1})
|
30
|
+
btn.find("~ .file-input-delete-attachment-checkbox").attr('checked', false);
|
31
|
+
|
@@ -17,6 +17,21 @@
|
|
17
17
|
padding-bottom: 180px;
|
18
18
|
}
|
19
19
|
|
20
|
+
.sidenav > li:first-child {
|
21
|
+
-webkit-border-radius: 6px 6px 0 0;
|
22
|
+
-moz-border-radius: 6px 6px 0 0;
|
23
|
+
border-radius: 6px 6px 0 0;
|
24
|
+
}
|
25
|
+
.sidenav > li {
|
26
|
+
display: block;
|
27
|
+
margin: 0 0 -1px;
|
28
|
+
padding: 8px 14px;
|
29
|
+
border: 1px solid #E5E5E5;
|
30
|
+
margin-left: -15px;
|
31
|
+
margin-right: -15px;
|
32
|
+
}
|
33
|
+
|
34
|
+
|
20
35
|
.thumbnails > li {
|
21
36
|
float: left;
|
22
37
|
margin-left: 0 !important;
|
@@ -215,4 +215,18 @@ select,
|
|
215
215
|
.boolean > .input label {
|
216
216
|
display: inline-block;
|
217
217
|
margin-left: 10px;
|
218
|
+
}
|
219
|
+
|
220
|
+
ul.choices-group {
|
221
|
+
list-style-type: none;
|
222
|
+
}
|
223
|
+
|
224
|
+
.radio {
|
225
|
+
padding-left: 0;
|
226
|
+
}
|
227
|
+
|
228
|
+
.file-input-attachment-filename {
|
229
|
+
width: 200px;
|
230
|
+
display: inline-block;
|
231
|
+
overflow: hidden;
|
218
232
|
}
|
@@ -26,7 +26,8 @@ class Admin::BaseController < ApplicationController
|
|
26
26
|
:collection_name,
|
27
27
|
:current_resource_class,
|
28
28
|
:current_resource,
|
29
|
-
:current_collection
|
29
|
+
:current_collection,
|
30
|
+
:title_column
|
30
31
|
|
31
32
|
|
32
33
|
def current_resource_class
|
@@ -53,4 +54,10 @@ class Admin::BaseController < ApplicationController
|
|
53
54
|
instance_variable_get("@#{collection_name}")
|
54
55
|
end
|
55
56
|
|
57
|
+
def title_column(model)
|
58
|
+
@_title_columns ||= {}
|
59
|
+
@_title_columns[model] ||= ( model.column_names.map{ |c| c.to_s } & %W(title name label browser_title seo_title seo_name key claim email) ).first
|
60
|
+
end
|
61
|
+
|
62
|
+
|
56
63
|
end
|
@@ -55,16 +55,7 @@ module AdminFormHelper
|
|
55
55
|
except_attributes.map! {|a| :"#{a}"}
|
56
56
|
|
57
57
|
columns = model.schema.hierarchy_field_names.map! {|a| :"#{a}"}
|
58
|
-
|
59
|
-
if only_attributes.any?
|
60
|
-
columns = columns.select {|k| only_attributes.include?(k)}
|
61
|
-
elsif except_attributes.any?
|
62
|
-
columns = columns.delete_if {|k| except_attributes.include?(k)}
|
63
|
-
end
|
64
|
-
|
65
|
-
|
66
|
-
buff = ""
|
67
|
-
|
58
|
+
|
68
59
|
attachment_definitions = (model.attachment_definitions || {}).keys
|
69
60
|
attachment_columns = attachment_definitions.map {|a|
|
70
61
|
[:"#{a}_file_name", :"#{a}_file_size", :"#{a}_content_type", :"#{a}_updated_at"]
|
@@ -72,8 +63,15 @@ module AdminFormHelper
|
|
72
63
|
|
73
64
|
columns -= attachment_columns
|
74
65
|
columns += attachment_definitions
|
75
|
-
|
76
66
|
|
67
|
+
if only_attributes.any?
|
68
|
+
columns = columns.select {|k| only_attributes.include?(k)}
|
69
|
+
elsif except_attributes.any?
|
70
|
+
columns = columns.delete_if {|k| except_attributes.include?(k)}
|
71
|
+
end
|
72
|
+
|
73
|
+
buff = ""
|
74
|
+
|
77
75
|
columns.each {|k|
|
78
76
|
k = "#{k}".gsub(/_ids?$/, "").gsub(/_type$/, "").to_sym
|
79
77
|
assoc = model.reflect_on_association(k)
|
@@ -42,12 +42,6 @@ module ScaffoldHelper
|
|
42
42
|
model.columns_hash["position"]
|
43
43
|
end
|
44
44
|
|
45
|
-
def title_column(model)
|
46
|
-
@_title_columns ||= {}
|
47
|
-
@_title_columns[model] ||= ( model.column_names.map{ |c| c.to_s } & %W(title name label browser_title seo_title seo_name key claim email) ).first
|
48
|
-
end
|
49
|
-
|
50
|
-
|
51
45
|
def skip_filter!
|
52
46
|
@skip_filter = true
|
53
47
|
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
class FileInput < FormtasticBootstrap::Inputs::FileInput
|
2
|
+
def to_html
|
3
|
+
generic_input_wrapping do
|
4
|
+
attachment = object.send(method)
|
5
|
+
|
6
|
+
if !attachment.exists?
|
7
|
+
<<-eos
|
8
|
+
<span class="file-input-attachment-filename">
|
9
|
+
<i class="icon icon-file"></i> (#{I18n.t('fullstack.admin.no_file_uploaded', :default => "No file uploaded")})
|
10
|
+
</span>
|
11
|
+
|
12
|
+
<a class="btn btn-small file-input-choose-file-button" href="javascript:void(0)">
|
13
|
+
<i class="icon icon-upload"></i>
|
14
|
+
#{I18n.t('fullstack.admin.choose_a_file', :default => "Choose a file")}
|
15
|
+
</a>
|
16
|
+
eos
|
17
|
+
|
18
|
+
else
|
19
|
+
preview_menu = ""
|
20
|
+
|
21
|
+
preview_menu << template.content_tag(:li, template.link_to(I18n.t('fullstack.admin.original', :default => "Original"),
|
22
|
+
attachment.url(:original),
|
23
|
+
:target => "_blank"
|
24
|
+
|
25
|
+
))
|
26
|
+
|
27
|
+
preview_menu << template.content_tag(:li, "", :class => :divider) if !attachment.styles.empty?
|
28
|
+
|
29
|
+
attachment.styles.map do |name, decl|
|
30
|
+
preview_menu << template.content_tag(:li, template.link_to(name.to_s.humanize, attachment.url(name), :target => "_blank"))
|
31
|
+
end
|
32
|
+
|
33
|
+
<<-eos
|
34
|
+
|
35
|
+
<span class="file-input-attachment-filename"><i class="icon icon-file"></i> #{template.send(:html_escape, attachment.url.split("/").last.split("?").first)} </span>
|
36
|
+
<a class="btn btn-small file-input-choose-file-button" href="javascript:void(0)">
|
37
|
+
<i class="icon icon-upload"></i>
|
38
|
+
#{I18n.t('fullstack.admin.change', :default => "Change")}
|
39
|
+
</a>
|
40
|
+
|
41
|
+
<span class="dropdown">
|
42
|
+
<a class="btn dropdown-toggle btn-small" data-toggle="dropdown" href="#">
|
43
|
+
<i class="icon icon-eye-open"></i>
|
44
|
+
#{I18n.t('fullstack.admin.preview', :default => "Preview")}
|
45
|
+
<span class="caret"></span>
|
46
|
+
</a>
|
47
|
+
<ul class="dropdown-menu">
|
48
|
+
#{preview_menu}
|
49
|
+
</ul>
|
50
|
+
|
51
|
+
</span>
|
52
|
+
|
53
|
+
#{template.button(
|
54
|
+
I18n.t('fullstack.admin.delete', :default => "Delete"),
|
55
|
+
"javascript:void(0)",
|
56
|
+
:type => :danger, :class => "file-input-delete-attachment-button btn-small", :"data-toggle" => :button
|
57
|
+
)}
|
58
|
+
|
59
|
+
eos
|
60
|
+
|
61
|
+
end.html_safe << builder.file_field(method, :style => "display:none;") << (builder.check_box("#{method}_delete", :class => "file-input-delete-attachment-checkbox", :style => "display:none;") if attachment.exists?)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
|
67
|
+
|
@@ -22,7 +22,7 @@
|
|
22
22
|
|
23
23
|
</table>
|
24
24
|
|
25
|
-
<script type="text/html"
|
25
|
+
<script type="text/html" class="resource-fields-template">
|
26
26
|
<%= f.admin_fields_for(association, association_class.new, :child_index => "___index___") do |f| %>
|
27
27
|
<%= render :partial => "nested_form", :locals => {:index => "___index___", :f => f, :resource_name => resource_name, :association => association} %>
|
28
28
|
<% end %>
|
@@ -36,7 +36,13 @@
|
|
36
36
|
</h3>
|
37
37
|
</div>
|
38
38
|
<div class="modal-body">
|
39
|
-
|
39
|
+
|
40
|
+
<% begin %>
|
41
|
+
<%= render :partial => "admin/#{association}/associated_fields", :locals => {:f => f} %>
|
42
|
+
<% rescue ActionView::MissingTemplate %>
|
43
|
+
<%= f.resource_inputs %>
|
44
|
+
<% end %>
|
45
|
+
|
40
46
|
<%= f.hidden_field(:_destroy, :class => "destroy-associated-resource") %>
|
41
47
|
<% if positionable?(f.object) %>
|
42
48
|
<%= f.hidden_field(:position, :class => "associated-resource-position") %>
|
data/config/locales/it.yml
CHANGED
@@ -21,9 +21,14 @@ it:
|
|
21
21
|
upload: "Carica"
|
22
22
|
ago: "fa"
|
23
23
|
ok: "Ok"
|
24
|
+
manual_entry: "Inserimento manuale"
|
24
25
|
this_record_contains_some_errors: "Questa linea contiene alcuni errori"
|
25
26
|
new_record: "nuovo"
|
26
27
|
drag_to_sort_items: "Trascina per ordinare gli elementi"
|
28
|
+
no_file_uploaded: "Nessun file caricato"
|
29
|
+
choose_a_file: "Carica"
|
30
|
+
change: "Cambia"
|
31
|
+
preview: "Anteprima"
|
27
32
|
|
28
33
|
form:
|
29
34
|
correct_these_errors_and_retry: "Correggi questi errori e riprova"
|
data/fullstack-admin.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "fullstack-admin"
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.36"
|
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-08-
|
12
|
+
s.date = "2012-08-30"
|
13
13
|
s.description = "Administration interface framework for fullstack"
|
14
14
|
s.email = "maurizio.cas@gmail.com"
|
15
15
|
s.extra_rdoc_files = [
|
@@ -931,6 +931,7 @@ Gem::Specification.new do |s|
|
|
931
931
|
"app/assets/javascripts/support/base.js.coffee",
|
932
932
|
"app/assets/javascripts/support/bootstrap.js.coffee",
|
933
933
|
"app/assets/javascripts/support/facebox.js.coffee",
|
934
|
+
"app/assets/javascripts/support/file_input.js.coffee",
|
934
935
|
"app/assets/javascripts/support/forms.js.coffee",
|
935
936
|
"app/assets/javascripts/support/gmap.js.coffee",
|
936
937
|
"app/assets/javascripts/support/nested_forms.js.coffee",
|
@@ -959,7 +960,7 @@ Gem::Specification.new do |s|
|
|
959
960
|
"app/inputs/country_input.rb",
|
960
961
|
"app/inputs/daterange_input.rb",
|
961
962
|
"app/inputs/datetime_input.rb",
|
962
|
-
"app/inputs/
|
963
|
+
"app/inputs/file_input.rb",
|
963
964
|
"app/inputs/iso3166.rb",
|
964
965
|
"app/inputs/markup_input.rb",
|
965
966
|
"app/inputs/simple_markup_input.rb",
|
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.
|
4
|
+
version: 0.1.36
|
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-08-
|
12
|
+
date: 2012-08-30 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -1189,6 +1189,7 @@ files:
|
|
1189
1189
|
- app/assets/javascripts/support/base.js.coffee
|
1190
1190
|
- app/assets/javascripts/support/bootstrap.js.coffee
|
1191
1191
|
- app/assets/javascripts/support/facebox.js.coffee
|
1192
|
+
- app/assets/javascripts/support/file_input.js.coffee
|
1192
1193
|
- app/assets/javascripts/support/forms.js.coffee
|
1193
1194
|
- app/assets/javascripts/support/gmap.js.coffee
|
1194
1195
|
- app/assets/javascripts/support/nested_forms.js.coffee
|
@@ -1217,7 +1218,7 @@ files:
|
|
1217
1218
|
- app/inputs/country_input.rb
|
1218
1219
|
- app/inputs/daterange_input.rb
|
1219
1220
|
- app/inputs/datetime_input.rb
|
1220
|
-
- app/inputs/
|
1221
|
+
- app/inputs/file_input.rb
|
1221
1222
|
- app/inputs/iso3166.rb
|
1222
1223
|
- app/inputs/markup_input.rb
|
1223
1224
|
- app/inputs/simple_markup_input.rb
|
@@ -1328,7 +1329,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
1328
1329
|
version: '0'
|
1329
1330
|
segments:
|
1330
1331
|
- 0
|
1331
|
-
hash: -
|
1332
|
+
hash: -2718455350685329463
|
1332
1333
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
1333
1334
|
none: false
|
1334
1335
|
requirements:
|