sunrise-core 0.1.2 → 0.1.3
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/lib/generators/sunrise/templates/models/defaults/ability.rb +2 -1
- data/lib/generators/sunrise/templates/stylesheets/manage/main.css +1 -1
- data/lib/sunrise/models/structure.rb +0 -1
- data/lib/sunrise/version.rb +1 -1
- data/lib/sunrise/views/helpers.rb +1 -1
- data/lib/sunrise/views/inputs/date_time_input.rb +15 -2
- metadata +7 -7
@@ -18,7 +18,6 @@ module Sunrise
|
|
18
18
|
validates_numericality_of :position, :only_integer => true
|
19
19
|
|
20
20
|
has_one :page, :dependent => :destroy
|
21
|
-
has_many :posts, :dependent => :destroy
|
22
21
|
|
23
22
|
scope :visible, where(:is_visible => true)
|
24
23
|
scope :with_kind, proc {|structure_type| where(:kind => structure_type.id) }
|
data/lib/sunrise/version.rb
CHANGED
@@ -174,7 +174,7 @@ module Sunrise
|
|
174
174
|
image_path = asset_type.nil? ? default_image : "#{File.basename(default_image, extname)}_#{asset_type}#{extname}"
|
175
175
|
image_full = default_image.gsub(File.basename(default_image), image_path)
|
176
176
|
|
177
|
-
path = (asset &&
|
177
|
+
path = (asset && (asset.respond_to?(:persisted?) ? asset.persisted? : true)) ? asset.url(asset_type) : image_full
|
178
178
|
|
179
179
|
image_tag(path, options)
|
180
180
|
end
|
@@ -2,7 +2,8 @@ module SimpleForm
|
|
2
2
|
module Inputs
|
3
3
|
class DateTimeInput < Base
|
4
4
|
def input
|
5
|
-
|
5
|
+
input_html_options[:value] ||= formated_value
|
6
|
+
|
6
7
|
html = [@builder.text_field(attribute_name, input_html_options)]
|
7
8
|
|
8
9
|
html << case input_type
|
@@ -27,7 +28,19 @@ module SimpleForm
|
|
27
28
|
end
|
28
29
|
|
29
30
|
private
|
30
|
-
|
31
|
+
|
32
|
+
def formated_value
|
33
|
+
object.send(attribute_name).try(:strftime, value_format)
|
34
|
+
end
|
35
|
+
|
36
|
+
def value_format
|
37
|
+
case input_type
|
38
|
+
when :date then "%d.%m.%Y"
|
39
|
+
when :datetime then "%d.%m.%Y %H:%M"
|
40
|
+
when :time then "%H:%M"
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
31
44
|
def has_required?
|
32
45
|
false
|
33
46
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sunrise-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 29
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 3
|
10
|
+
version: 0.1.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Igor Galeta
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2011-
|
19
|
+
date: 2011-06-08 00:00:00 +03:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
@@ -26,12 +26,12 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - ~>
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
hash:
|
29
|
+
hash: 23
|
30
30
|
segments:
|
31
31
|
- 3
|
32
32
|
- 0
|
33
|
-
-
|
34
|
-
version: 3.0.
|
33
|
+
- 8
|
34
|
+
version: 3.0.8
|
35
35
|
name: rails
|
36
36
|
version_requirements: *id001
|
37
37
|
prerelease: false
|