lalala 4.0.0.dev.114 → 4.0.0.dev.116
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/lalala/modules/grid.module.js +3 -2
- data/app/assets/stylesheets/lalala/modules/_grid.css.scss +32 -19
- data/app/models/lalala/abstract_asset.rb +2 -0
- data/lib/formtastic/inputs/grid_input.rb +4 -14
- data/lib/lalala/ext_i18n/input_helper.rb +0 -1
- data/lib/lalala/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 320e3ccbb7e876b90dfdedde5009021a5e19c93d
|
4
|
+
data.tar.gz: 83aa07124ba072c6f9013447d6a265adf2547ae0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e9adf760f8062960f9c26b970656843f1b5342efe518ebb46c0f8690843128f32d85969b073c0c237cc6756ee737f60110850fef88b52c1fddafc5c731872c80
|
7
|
+
data.tar.gz: a0b1f393209726a0cf501390dc9f920a9bd62513c8b312b54d3ab645e4153677a087e7c652e3e9a556fb567b9fdb26ff53867d06782620449a75a73e2e58c0d4
|
@@ -39,8 +39,9 @@ Grid = (function() {
|
|
39
39
|
fragment = document.createDocumentFragment();
|
40
40
|
|
41
41
|
// transform images html
|
42
|
-
$grid.find("li").not(":last-child").each(function() {
|
42
|
+
$grid.find("li.asset").not(":last-child").each(function() {
|
43
43
|
var grid_piece = document.createElement("li");
|
44
|
+
grid_piece.className = "asset";
|
44
45
|
grid_piece.innerHTML = this.innerHTML.replace("<a", "<a class=\"image\"");
|
45
46
|
var overlay = document.createElement("div");
|
46
47
|
overlay.className = "overlay";
|
@@ -177,7 +178,7 @@ Grid = (function() {
|
|
177
178
|
var grid = this;
|
178
179
|
|
179
180
|
this.$el.selectable({
|
180
|
-
filter: "li",
|
181
|
+
filter: "li.asset",
|
181
182
|
cancel: ".actions,.button,input,textarea,button",
|
182
183
|
selecting: function(e, ui) {
|
183
184
|
$row = $(ui.selecting);
|
@@ -21,7 +21,7 @@
|
|
21
21
|
}
|
22
22
|
|
23
23
|
// [row]
|
24
|
-
|
24
|
+
.asset {
|
25
25
|
float: left;
|
26
26
|
margin: 0 11px 11px 0;
|
27
27
|
position: relative;
|
@@ -34,36 +34,42 @@
|
|
34
34
|
&.move,
|
35
35
|
&.properties,
|
36
36
|
&.selected,
|
37
|
-
&.will-destroy {
|
37
|
+
&.will-destroy {
|
38
|
+
.overlay { display: block; }
|
39
|
+
}
|
40
|
+
|
41
|
+
&.edit-block .attributes {
|
42
|
+
display: block;
|
43
|
+
}
|
38
44
|
}
|
39
45
|
|
40
46
|
// [row]:types
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
47
|
+
.asset.move label { cursor: move; }
|
48
|
+
.asset.properties { cursor: pointer; }
|
49
|
+
.asset.selected .overlay { background: rgba($yellow, .5); }
|
50
|
+
.asset.will-destroy .overlay,
|
51
|
+
.asset.selected.will-destroy .overlay { background: rgba($red, .5); }
|
46
52
|
|
47
53
|
// image + overlay
|
48
|
-
|
49
|
-
|
54
|
+
.asset .image,
|
55
|
+
.asset .overlay {
|
50
56
|
left: 0;
|
51
57
|
position: absolute;
|
52
58
|
top: 0;
|
53
59
|
}
|
54
60
|
|
55
|
-
|
61
|
+
.asset .image {
|
56
62
|
z-index: 0;
|
57
63
|
}
|
58
64
|
|
59
|
-
|
65
|
+
.asset .overlay {
|
60
66
|
background: rgba(black, .5);
|
61
67
|
display: none;
|
62
68
|
z-index: 1;
|
63
69
|
}
|
64
70
|
|
65
71
|
// [row].edit-block
|
66
|
-
|
72
|
+
.asset.edit-block {
|
67
73
|
clear: both;
|
68
74
|
height: auto;
|
69
75
|
min-height: 100px;
|
@@ -71,7 +77,7 @@
|
|
71
77
|
}
|
72
78
|
|
73
79
|
// label
|
74
|
-
|
80
|
+
.asset label {
|
75
81
|
@include border-radius(2px);
|
76
82
|
background: #fff;
|
77
83
|
bottom: 6px;
|
@@ -90,22 +96,29 @@
|
|
90
96
|
}
|
91
97
|
|
92
98
|
// attributes
|
93
|
-
|
94
|
-
li.edit-block .attributes { display: block }
|
99
|
+
.asset .attributes { display: none; position: relative }
|
95
100
|
|
96
|
-
|
97
|
-
|
101
|
+
.asset .attributes input,
|
102
|
+
.asset .attributes textarea {
|
98
103
|
margin-bottom: 6px;
|
99
104
|
margin-left: 115px;
|
100
105
|
resize: none;
|
101
106
|
width: 300px;
|
102
107
|
}
|
103
108
|
|
104
|
-
|
109
|
+
.asset .attributes textarea {
|
105
110
|
height: 100px !important;
|
106
111
|
}
|
107
112
|
|
108
|
-
|
113
|
+
.asset .attributes li {
|
114
|
+
margin: 0;
|
115
|
+
}
|
116
|
+
|
117
|
+
.asset .attributes label {
|
118
|
+
display: none;
|
119
|
+
}
|
120
|
+
|
121
|
+
.asset .attributes .close-button {
|
109
122
|
color: #c5c5c5;
|
110
123
|
cursor: pointer;
|
111
124
|
display: inline-block;
|
@@ -2,6 +2,8 @@ class Lalala::AbstractAsset < ActiveRecord::Base
|
|
2
2
|
self.abstract_class = true
|
3
3
|
self.table_name = "assets"
|
4
4
|
|
5
|
+
include Lalala::ExtActiveRecord::I18nTranslationsWriter
|
6
|
+
|
5
7
|
attr_accessible :asset, :title, :caption
|
6
8
|
translates :title, :caption
|
7
9
|
Lalala::AbstractAsset::Translation.table_name = 'asset_translations'
|
@@ -7,30 +7,20 @@ class Formtastic::Inputs::GridInput
|
|
7
7
|
|
8
8
|
image_model_class = object.class.reflect_on_association(method).class_name.constantize
|
9
9
|
image_attributes = image_model_class.accessible_attributes.to_a
|
10
|
-
image_attributes.select! { |x| x.size > 0 and x
|
10
|
+
image_attributes.select! { |x| x.size > 0 and !%w(asset translations_writer).include?(x) }
|
11
11
|
|
12
12
|
ul = template.content_tag :ul do
|
13
13
|
html = template.raw("")
|
14
14
|
|
15
15
|
assets.each_with_index do |asset, idx|
|
16
|
-
html += template.content_tag :li do
|
16
|
+
html += template.content_tag :li, class: "asset" do
|
17
17
|
builder.fields_for(method, asset) do |f|
|
18
18
|
thumbnail_html = template.image_tag f.object.asset.lalala_thumb.url
|
19
19
|
asset_html = template.raw("")
|
20
20
|
asset_html << template.link_to(thumbnail_html, f.object.asset.url)
|
21
|
-
asset_html << template.content_tag(:
|
21
|
+
asset_html << template.content_tag(:ol, { class: "attributes" }) do
|
22
22
|
inputs = image_attributes.map do |ia|
|
23
|
-
|
24
|
-
column_type = image_model_class.columns_hash[ia].type
|
25
|
-
elsif image_model_class.translation_class.columns_hash[ia]
|
26
|
-
column_type = image_model_class.translation_class.columns_hash[ia].type
|
27
|
-
end
|
28
|
-
|
29
|
-
case column_type
|
30
|
-
when :string then f.text_field(ia.to_sym, placeholder: ia)
|
31
|
-
when :text then f.text_area(ia.to_sym, placeholder: ia)
|
32
|
-
when :boolean then f.check_box(ia.to_sym)
|
33
|
-
end
|
23
|
+
f.input ia.to_sym, placeholder: ia
|
34
24
|
end
|
35
25
|
|
36
26
|
template.raw(inputs.join) + template.content_tag(
|
data/lib/lalala/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lalala
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.0.0.dev.
|
4
|
+
version: 4.0.0.dev.116
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Simon Menke
|
@@ -13,7 +13,7 @@ authors:
|
|
13
13
|
autorequire:
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
|
-
date: 2013-05-
|
16
|
+
date: 2013-05-08 00:00:00.000000000 Z
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
19
19
|
name: carrierwave
|