sunrise-core 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -33,6 +33,7 @@ class Ability
33
33
  can :manage, :all
34
34
  can :manage, :all, :context => :manage
35
35
 
36
- # TODO
36
+ # User cannot destroy self account
37
+ cannot :destroy, User, :id => @user.id, :context => :manage
37
38
  end
38
39
  end
@@ -473,7 +473,7 @@ input.text {
473
473
  font-size: 1.1em;
474
474
  }
475
475
  .controls {
476
- padding: 20px 0px 10px 20px;
476
+ padding: 0px 0px 10px 20px;
477
477
  }
478
478
  .sort {
479
479
  display: block;
@@ -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) }
@@ -1,3 +1,3 @@
1
1
  module Sunrise
2
- VERSION = "0.1.2".freeze
2
+ VERSION = "0.1.3".freeze
3
3
  end
@@ -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 && !asset.new_record?) ? asset.url(asset_type) : image_full
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
- #@builder.send(:"#{input_type}_select", attribute_name, input_options, input_html_options)
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: 31
4
+ hash: 29
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 2
10
- version: 0.1.2
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-05-23 00:00:00 +03:00
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: 9
29
+ hash: 23
30
30
  segments:
31
31
  - 3
32
32
  - 0
33
- - 7
34
- version: 3.0.7
33
+ - 8
34
+ version: 3.0.8
35
35
  name: rails
36
36
  version_requirements: *id001
37
37
  prerelease: false