loft 0.1.2 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -5,18 +5,22 @@ module Loft
5
5
 
6
6
  include CarrierWave::MiniMagick
7
7
 
8
+
8
9
  def store_dir
9
10
  "loft/#{ model._number }"
10
11
  end
11
12
 
13
+
12
14
  version :_200x150_2x, if: :is_image? do
13
15
  process :resize_to_fill => [400, 300]
14
16
  end
15
17
 
18
+
16
19
  version :_40x40_2x, if: :is_image? do
17
20
  process :resize_to_fill => [80, 80]
18
21
  end
19
22
 
23
+
20
24
  def is_image? new_file
21
25
  model.is_image?
22
26
  end
data/lib/loft/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Loft
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.5"
3
3
  end
@@ -7,6 +7,8 @@ module Mongoid
7
7
 
8
8
  included do
9
9
 
10
+ include Mongoid::Timestamps
11
+ include Mongoid::SerializableId
10
12
  include Mongoid::Autoinc
11
13
  include Mongoid::Search
12
14
  include ActionView::Helpers::DateHelper
@@ -54,8 +56,13 @@ module Mongoid
54
56
  end
55
57
 
56
58
 
59
+ def content_type
60
+ @content_type ||= file.content_type
61
+ end
62
+
63
+
57
64
  def item_thumbnail
58
- if is_image? and file?
65
+ if is_image?
59
66
  { medium: file._200x150_2x.url, small: file._40x40_2x.url }
60
67
  else
61
68
  {}
@@ -63,32 +70,31 @@ module Mongoid
63
70
  end
64
71
 
65
72
 
66
- def content_type
67
- @content_type ||= file.content_type
68
- end
69
-
70
-
71
73
  def is_image?
72
74
  return false unless file?
73
75
  content_type.match(/image\//) ? true : false
74
76
  end
75
77
 
78
+
76
79
  def is_text?
77
80
  return false unless file?
78
81
  content_type.match(/text\//) ? true : false
79
82
  end
80
83
 
84
+
81
85
  def is_archive?
82
86
  return false unless file?
83
87
  # need to add more archive types: rar, gz, bz2, gzip
84
88
  content_type.match(/zip/) ? true : false
85
89
  end
86
90
 
91
+
87
92
  def is_audio?
88
93
  return false unless file?
89
94
  content_type.match(/audio\//) ? true : false
90
95
  end
91
96
 
97
+
92
98
  def is_video?
93
99
  return false unless file?
94
100
  content_type.match(/video\//) ? true : false
data/package.json ADDED
@@ -0,0 +1,10 @@
1
+ {
2
+ "name": "loft",
3
+ "version": "0.1.5",
4
+ "devDependencies": {
5
+ "grunt": "^0.4.5",
6
+ "grunt-contrib-clean": "^0.6.0",
7
+ "grunt-contrib-coffee": "^0.13.0",
8
+ "grunt-contrib-concat": "^0.5.1"
9
+ }
10
+ }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: loft
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Kravets
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-05 00:00:00.000000000 Z
11
+ date: 2015-04-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mongoid_search
@@ -91,26 +91,30 @@ files:
91
91
  - ".gitignore"
92
92
  - CONTRIBUTING.md
93
93
  - Gemfile
94
+ - Gruntfile.coffee
94
95
  - LICENSE.md
95
96
  - README.md
96
97
  - Rakefile
97
98
  - app/assets/images/loft/library@3x.png
98
- - app/assets/javascripts/input-loft-image.coffee
99
99
  - app/assets/javascripts/loft.coffee
100
100
  - app/assets/javascripts/loft/asset-item.coffee
101
101
  - app/assets/javascripts/loft/group-actions.coffee
102
+ - app/assets/javascripts/loft/input-loft-asset.coffee
103
+ - app/assets/javascripts/loft/input-loft-image.coffee
102
104
  - app/assets/javascripts/loft/module.coffee
103
- - app/assets/javascripts/loft/type-item.coffee
104
- - app/assets/javascripts/redactor-loft.coffee
105
+ - app/assets/javascripts/loft/redactor-loft.coffee
105
106
  - app/assets/stylesheets/_loft.scss
106
107
  - app/assets/stylesheets/chr/form/_input-loft-image.scss
107
108
  - app/uploaders/asset_file_uploader.rb
109
+ - bower.json
110
+ - dist/loft.js
108
111
  - lib/concerns/asset_file_uploader.rb
109
112
  - lib/loft.rb
110
113
  - lib/loft/engine.rb
111
114
  - lib/loft/version.rb
112
115
  - lib/mongoid/loft_asset.rb
113
116
  - loft.gemspec
117
+ - package.json
114
118
  homepage: http://slatestudio.com
115
119
  licenses:
116
120
  - MIT
@@ -1,36 +0,0 @@
1
- # -----------------------------------------------------------------------------
2
- # Author: Alexander Kravets <alex@slatestudio.com>,
3
- # Slate Studio (http://www.slatestudio.com)
4
- #
5
- # Coding Guide:
6
- # https://github.com/thoughtbot/guides/tree/master/style/coffeescript
7
- # -----------------------------------------------------------------------------
8
-
9
- # -----------------------------------------------------------------------------
10
- # Loft Asset Item
11
- # -----------------------------------------------------------------------------
12
- class @LoftTypeItem extends Item
13
- onClick: (e) ->
14
- if @.$el.hasClass('active') then e.preventDefault() ; return
15
-
16
- if ! @module.$el.hasClass 'module-modal'
17
- hash = $(e.currentTarget).attr('href')
18
- chr.updateHash(hash, true)
19
-
20
- crumbs = hash.split('/')
21
- @module.showNestedList(_last(crumbs), true)
22
-
23
- else
24
- e.preventDefault()
25
-
26
- $item = $(e.currentTarget)
27
-
28
- $item.parent().children('.active').removeClass('active')
29
- $item.addClass('active')
30
-
31
- listName = $item.attr('href').split('/')[2]
32
- @module.showNestedList(listName, true)
33
-
34
-
35
-
36
-