mongoid_paperclip_mobile 0.0.1 → 0.0.2

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.
File without changes
data/config/routes.rb CHANGED
@@ -1,2 +1,2 @@
1
- MongoidPaperclipMobile::Engine.routes.draw do
1
+ Mongoid::Paperclip::Mobile::Engine.routes.draw do
2
2
  end
@@ -1,5 +1,9 @@
1
- module MongoidPaperclipMobile
2
- class Engine < ::Rails::Engine
3
- isolate_namespace MongoidPaperclipMobile
1
+ module Mongoid
2
+ module Paperclip
3
+ module Mobile
4
+ class Engine < ::Rails::Engine
5
+ isolate_namespace Mongoid::Paperclip::Mobile
6
+ end
7
+ end
4
8
  end
5
9
  end
@@ -0,0 +1,72 @@
1
+ module Mongoid
2
+ module Paperclip
3
+ module Mobile
4
+ module Helper
5
+ extend ActiveSupport::Concern
6
+
7
+ def mobile_app_helper(icon,splash,*args)
8
+ content = String.new
9
+ content.concat(content_tag(:meta,'',
10
+ :name => "apple-mobile-web-app-capable",
11
+ :content => "yes"))
12
+ content.concat(content_tag(:meta,'',
13
+ :name => "apple-touch-fullscreen",
14
+ :content => "yes"))
15
+ content.concat(content_tag(:meta,'',
16
+ :name => "viewport",
17
+ :content => "width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no"))
18
+ content.concat(content_tag(:meta,'',
19
+ :name => "apple-mobile-web-app-status-bar-style",
20
+ :content => "black"))
21
+
22
+ content.concat("<!-- Mobile Web App Icons -->\n")
23
+
24
+ content.concat(link_tag(:rel => "apple-touch-icon-precomposed",
25
+ :sizes => "72x72",
26
+ :href => icon.url(:ipad)))
27
+
28
+
29
+ content.concat(link_tag(:rel => "apple-touch-icon-precomposed",
30
+ :sizes => "114x114",
31
+ :href => icon.url(:iphone_retina)))
32
+ content.concat(link_tag(:rel => "apple-touch-icon-precomposed",
33
+ :href => icon.url(:iphone)))
34
+ content.concat(link_tag(:rel => "apple-touch-icon-precomposed",
35
+ :sizes => "144x144",
36
+ :href => icon.url(:ipad_retina)))
37
+ content.concat("\n<!-- END Mobile Web App Icons -->")
38
+
39
+ content.concat("\n<!-- Mobile Web App Splash Screen -->")
40
+
41
+ content.concat("\n\t\t<!-- iPhone 3g/3gs -->")
42
+ content.concat(link_tag(:rel => "apple-touch-startup-image",
43
+ :href => splash[:portrait].url(:iphone)))
44
+ #
45
+ #content.concat("\n\t\t<!-- iPhone 4/4s -->")
46
+ #content.concat(link_tag(:rel => "apple-touch-startup-image",
47
+ # :href => splash[:portrait].url(:iphone_retina),
48
+ # :media => "(max-device-width: 480px) and (-webkit-min-device-pixel-ratio: 2)"))
49
+
50
+ content.concat("\n\t\t<!-- iPad-->")
51
+ content.concat(link_tag(:rel => "apple-touch-startup-image",
52
+ :href => splash[:portrait].url(:ipad),
53
+ :media => "screen and (min-device-width: 481px) and (max-device-width: 768px) and (orientation:portrait)",
54
+ ))
55
+ content.concat(link_tag(:rel => "apple-touch-startup-image",
56
+ :href => splash[:landscape].url(:ipad),
57
+ :media => "screen and (min-device-width: 481px) and (max-device-width: 1024px) and (orientation:landscape)",
58
+ ))
59
+ #<link rel="apple-touch-startup-image" href="touch-splash-ipad-land.png" media="screen and (min-device-width: 481px) and (max-device-width: 1024px) and (orientation:landscape)" />
60
+ #<link rel="apple-touch-startup-image" href="touch-splash-ipad-port.png" media="screen and (min-device-width: 481px) and (max-device-width: 1024px) and (orientation:portrait)" />
61
+ content.concat("\n<!-- END Mobile Web App Splash Screen -->")
62
+ content.html_safe
63
+ end
64
+
65
+ private
66
+ def link_tag(options={})
67
+ content_tag(:link,'',options)
68
+ end
69
+ end
70
+ end
71
+ end
72
+ end
@@ -3,35 +3,35 @@ module Mongoid::Paperclip::Mobile::Icon
3
3
 
4
4
 
5
5
  module ClassMethods
6
- def has_mobile_web_icon(field,options={})
7
- if options[:styles]
8
- Rails.logger.warn ":style option for has_mobile_web_icon :#{field} will be ignored."
9
- end
6
+ def has_mobile_web_icon(field, options={ })
7
+ if options[:styles]
8
+ Rails.logger.warn ":style option for has_mobile_web_icon :#{field} will be ignored."
9
+ end
10
10
 
11
- opts = mobile_styles.merge(options)
11
+ opts = options.merge(:styles => mobile_styles)
12
12
 
13
- #make sure that mongoid paperclip is included
14
- unless self.ancestors.include?(::Mongoid::Paperclip)
15
- include ::Mongoid::Paperclip
16
- end
17
13
 
18
- has_mongoid_attached_file(field,opts)
14
+ #make sure that mongoid paperclip is included
15
+ unless self.ancestors.include?(::Mongoid::Paperclip)
16
+ include ::Mongoid::Paperclip
17
+ end
18
+
19
+ has_mongoid_attached_file(field, opts)
20
+
19
21
  end
20
22
 
21
23
  private
22
24
  def mobile_styles
23
25
  {
24
- :android_ldpi => ['36x36#', :png],
25
- :android_mdpi => ['48x48#', :png],
26
- :android_hdpi => ['72x72#', :png],
27
- :android_xhdpi => ['96x96#', :png],
28
-
29
- :iphone_3g => ['57x57#', :png],
30
- :iphone_retina => ['114x114#', :png],
31
- :ipad => ['72x72#', :png],
32
- :ipad_retina => ['144x144#', :png],
33
-
34
- :windows_mobile => ['']
26
+ :android_ldpi => ['36x36#', :png],
27
+ :android_mdpi => ['48x48#', :png],
28
+ :android_hdpi => ['72x72#', :png],
29
+ :android_xhdpi => ['96x96#', :png],
30
+
31
+ :iphone => ['57x57#', :png],
32
+ :iphone_retina => ['114x114#', :png],
33
+ :ipad => ['72x72#', :png],
34
+ :ipad_retina => ['144x144#', :png]
35
35
  }
36
36
  end
37
37
  end
@@ -8,8 +8,10 @@ module Mongoid::Paperclip::Mobile::SplashScreen
8
8
  Rails.logger.warn ":style option for has_mobile_web_splash_screen :#{field} will be ignored."
9
9
  end
10
10
 
11
- l_opts = landscape_styles.merge(options)
12
- p_opts = portrait_styles.merge(options)
11
+ l_opts = options.merge(:styles => landscape_styles)
12
+ p_opts = options.merge(:styles => portrait_styles)
13
+
14
+
13
15
 
14
16
  #make sure that mongoid paperclip is included
15
17
  unless self.ancestors.include?(::Mongoid::Paperclip)
@@ -23,32 +25,31 @@ module Mongoid::Paperclip::Mobile::SplashScreen
23
25
  private
24
26
  def landscape_styles
25
27
  {
26
- :ipad => ['1024x748#', :png],
27
- :ipad_retina => ['2048x1496#', :png],
28
+ :ipad => ['1024x748#', :png],
29
+ :ipad_retina => ['2048x1496#', :png],
28
30
 
29
- :android_rect_hdpi=> ['800x480#', :png],
30
- :android_rect_ldpi=> ['400x240#', :png],
31
+ :android_rect_hdpi => ['800x480#', :png],
32
+ :android_rect_ldpi => ['400x240#', :png],
31
33
 
32
- :android_square_hdpi=> ['800x480#', :png],
33
- :android_square_mdpi=> ['480x320#', :png],
34
- :android_square_ldpi=> ['320x240#', :png],
34
+ :android_square_hdpi => ['800x480#', :png],
35
+ :android_square_mdpi => ['480x320#', :png],
36
+ :android_square_ldpi => ['320x240#', :png],
35
37
  }
36
38
  end
37
39
 
38
40
  def portrait_styles
39
41
  {
40
- :iphone => ['320x460#', :png],
41
- :iphone_retina => ['640x960#', :png],
42
- :ipad => ['1024x748#', :png],
43
- :ipad_retina => ['1536x2008#', :png],
44
-
45
- :android_rect_hdpi=> ['480x800#', :png],
46
- :android_rect_ldpi=> ['240x400#', :png],
42
+ :iphone => ['320x460#', :png],
43
+ :iphone_retina => ['640x960#', :png],
44
+ :ipad => ['768x1004#', :png],
45
+ :ipad_retina => ['1536x2008#', :png],
47
46
 
48
- :android_square_hdpi=> ['480x800#', :png],
49
- :android_square_mdpi=> ['320x480#', :png],
50
- :android_square_ldpi=> ['240x320#', :png],
47
+ :android_rect_hdpi => ['480x800#', :png],
48
+ :android_rect_ldpi => ['240x400#', :png],
51
49
 
50
+ :android_square_hdpi => ['480x800#', :png],
51
+ :android_square_mdpi => ['320x480#', :png],
52
+ :android_square_ldpi => ['240x320#', :png],
52
53
  }
53
54
  end
54
55
  end
@@ -1,7 +1,7 @@
1
1
  module Mongoid
2
2
  module Paperclip
3
3
  module Mobile
4
- VERSION = "0.0.1"
4
+ VERSION = "0.0.2"
5
5
  end
6
6
  end
7
7
  end
@@ -1,3 +1,10 @@
1
+ require "mongoid/paperclip/mobile/icon"
2
+ require "mongoid/paperclip/mobile/splash_screen"
3
+ require "mongoid/paperclip/mobile/helper"
1
4
  module Mongoid::Paperclip::Mobile
5
+ include Mongoid::Paperclip::Mobile::Icon
6
+ include Mongoid::Paperclip::Mobile::SplashScreen
2
7
 
3
- end
8
+ end
9
+
10
+ ActionView::Base.send :include, Mongoid::Paperclip::Mobile::Helper
@@ -1,4 +1,3 @@
1
1
  require "mongoid/paperclip/mobile/engine"
2
2
 
3
- module Mongoid::Paperclip::Mobile
4
- end
3
+ require "mongoid/paperclip/mobile"
@@ -0,0 +1,23 @@
1
+ require 'rbconfig'
2
+ source 'http://rubygems.org'
3
+ gem 'rails', '3.2.2'
4
+
5
+
6
+ group :assets do
7
+ gem 'sass-rails'
8
+ gem 'coffee-rails'
9
+ gem 'uglifier'
10
+ end
11
+
12
+ gem 'jquery-rails'
13
+ gem 'twitter-bootstrap-rails'
14
+
15
+ gem 'joyride-rails', '~> 0.0.10', :require => 'joyride'
16
+
17
+ gem 'haml'
18
+
19
+ gem 'bson_ext'
20
+ gem 'mongoid'
21
+
22
+ gem 'mongoid-paperclip', :require => 'mongoid_paperclip'
23
+ gem 'aws-s3', :require => 'aws/s3'
@@ -0,0 +1,159 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ actionmailer (3.2.2)
5
+ actionpack (= 3.2.2)
6
+ mail (~> 2.4.0)
7
+ actionpack (3.2.2)
8
+ activemodel (= 3.2.2)
9
+ activesupport (= 3.2.2)
10
+ builder (~> 3.0.0)
11
+ erubis (~> 2.7.0)
12
+ journey (~> 1.0.1)
13
+ rack (~> 1.4.0)
14
+ rack-cache (~> 1.1)
15
+ rack-test (~> 0.6.1)
16
+ sprockets (~> 2.1.2)
17
+ activemodel (3.2.2)
18
+ activesupport (= 3.2.2)
19
+ builder (~> 3.0.0)
20
+ activerecord (3.2.2)
21
+ activemodel (= 3.2.2)
22
+ activesupport (= 3.2.2)
23
+ arel (~> 3.0.2)
24
+ tzinfo (~> 0.3.29)
25
+ activeresource (3.2.2)
26
+ activemodel (= 3.2.2)
27
+ activesupport (= 3.2.2)
28
+ activesupport (3.2.2)
29
+ i18n (~> 0.6)
30
+ multi_json (~> 1.0)
31
+ arel (3.0.2)
32
+ aws-s3 (0.6.3)
33
+ builder
34
+ mime-types
35
+ xml-simple
36
+ bson (1.6.4)
37
+ bson_ext (1.6.4)
38
+ bson (~> 1.6.4)
39
+ builder (3.0.0)
40
+ cocaine (0.2.1)
41
+ coffee-rails (3.2.2)
42
+ coffee-script (>= 2.2.0)
43
+ railties (~> 3.2.0)
44
+ coffee-script (2.2.0)
45
+ coffee-script-source
46
+ execjs
47
+ coffee-script-source (1.3.3)
48
+ commonjs (0.2.6)
49
+ erubis (2.7.0)
50
+ execjs (1.4.0)
51
+ multi_json (~> 1.0)
52
+ haml (3.1.6)
53
+ hike (1.2.1)
54
+ i18n (0.6.0)
55
+ journey (1.0.3)
56
+ joyride-rails (0.0.10)
57
+ haml (~> 3.1.4)
58
+ jquery-rails
59
+ rails (~> 3.2.2)
60
+ sass (~> 3.1.16)
61
+ jquery-rails (2.0.2)
62
+ railties (>= 3.2.0, < 5.0)
63
+ thor (~> 0.14)
64
+ json (1.7.3)
65
+ less (2.2.1)
66
+ commonjs (~> 0.2.6)
67
+ less-rails (2.2.3)
68
+ actionpack (>= 3.1)
69
+ less (~> 2.2.0)
70
+ libv8 (3.3.10.4)
71
+ mail (2.4.4)
72
+ i18n (>= 0.4.0)
73
+ mime-types (~> 1.16)
74
+ treetop (~> 1.4.8)
75
+ mime-types (1.18)
76
+ mongo (1.6.2)
77
+ bson (~> 1.6.2)
78
+ mongoid (2.4.11)
79
+ activemodel (~> 3.1)
80
+ mongo (<= 1.6.2)
81
+ tzinfo (~> 0.3.22)
82
+ mongoid-paperclip (0.0.7)
83
+ paperclip (>= 2.3.6)
84
+ multi_json (1.3.6)
85
+ paperclip (3.0.4)
86
+ activemodel (>= 3.0.0)
87
+ activerecord (>= 3.0.0)
88
+ activesupport (>= 3.0.0)
89
+ cocaine (>= 0.0.2)
90
+ mime-types
91
+ polyglot (0.3.3)
92
+ rack (1.4.1)
93
+ rack-cache (1.2)
94
+ rack (>= 0.4)
95
+ rack-ssl (1.3.2)
96
+ rack
97
+ rack-test (0.6.1)
98
+ rack (>= 1.0)
99
+ rails (3.2.2)
100
+ actionmailer (= 3.2.2)
101
+ actionpack (= 3.2.2)
102
+ activerecord (= 3.2.2)
103
+ activeresource (= 3.2.2)
104
+ activesupport (= 3.2.2)
105
+ bundler (~> 1.0)
106
+ railties (= 3.2.2)
107
+ railties (3.2.2)
108
+ actionpack (= 3.2.2)
109
+ activesupport (= 3.2.2)
110
+ rack-ssl (~> 1.3.2)
111
+ rake (>= 0.8.7)
112
+ rdoc (~> 3.4)
113
+ thor (~> 0.14.6)
114
+ rake (0.9.2.2)
115
+ rdoc (3.12)
116
+ json (~> 1.4)
117
+ sass (3.1.19)
118
+ sass-rails (3.2.5)
119
+ railties (~> 3.2.0)
120
+ sass (>= 3.1.10)
121
+ tilt (~> 1.3)
122
+ sprockets (2.1.3)
123
+ hike (~> 1.2)
124
+ rack (~> 1.0)
125
+ tilt (~> 1.1, != 1.3.0)
126
+ therubyracer (0.10.1)
127
+ libv8 (~> 3.3.10)
128
+ thor (0.14.6)
129
+ tilt (1.3.3)
130
+ treetop (1.4.10)
131
+ polyglot
132
+ polyglot (>= 0.3.1)
133
+ twitter-bootstrap-rails (2.0.9)
134
+ actionpack (>= 3.1)
135
+ less-rails (~> 2.2.2)
136
+ railties (>= 3.1)
137
+ therubyracer (~> 0.10.1)
138
+ tzinfo (0.3.33)
139
+ uglifier (1.2.4)
140
+ execjs (>= 0.3.0)
141
+ multi_json (>= 1.0.2)
142
+ xml-simple (1.1.1)
143
+
144
+ PLATFORMS
145
+ ruby
146
+
147
+ DEPENDENCIES
148
+ aws-s3
149
+ bson_ext
150
+ coffee-rails
151
+ haml
152
+ joyride-rails (~> 0.0.10)
153
+ jquery-rails
154
+ mongoid
155
+ mongoid-paperclip
156
+ rails (= 3.2.2)
157
+ sass-rails
158
+ twitter-bootstrap-rails
159
+ uglifier
@@ -1,4 +1,3 @@
1
1
  Rails.application.routes.draw do
2
2
 
3
- mount MongoidPaperclipMobile::Engine => "/mongoid_paperclip_mobile"
4
3
  end
File without changes
File without changes
@@ -1,7 +1,7 @@
1
1
  require 'test_helper'
2
2
 
3
- class MongoidPaperclipMobileTest < ActiveSupport::TestCase
3
+ class Mongoid::Paperclip::Mobile::Test < ActiveSupport::TestCase
4
4
  test "truth" do
5
- assert_kind_of Module, MongoidPaperclipMobile
5
+ assert_kind_of Module, Mongoid::Paperclip::Mobile
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongoid_paperclip_mobile
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
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-05-20 00:00:00.000000000 Z
12
+ date: 2012-06-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -66,13 +66,15 @@ executables: []
66
66
  extensions: []
67
67
  extra_rdoc_files: []
68
68
  files:
69
+ - app/assets/images/mongoid_paperclip_mobile/icon/default_ipad.png
70
+ - app/assets/images/mongoid_paperclip_mobile/icon/default_ipad_retina.png
71
+ - app/assets/images/mongoid_paperclip_mobile/icon/default_iphone_3g.png
72
+ - app/assets/images/mongoid_paperclip_mobile/icon/default_iphone_retina.png
69
73
  - app/assets/javascripts/mongoid_paperclip_mobile/application.js
70
74
  - app/assets/stylesheets/mongoid_paperclip_mobile/application.css
71
- - app/controllers/mongoid_paperclip_mobile/application_controller.rb
72
- - app/helpers/mongoid_paperclip_mobile/application_helper.rb
73
- - app/views/layouts/mongoid_paperclip_mobile/application.html.erb
74
75
  - config/routes.rb
75
76
  - lib/mongoid/paperclip/mobile/engine.rb
77
+ - lib/mongoid/paperclip/mobile/helper.rb
76
78
  - lib/mongoid/paperclip/mobile/icon.rb
77
79
  - lib/mongoid/paperclip/mobile/splash_screen.rb
78
80
  - lib/mongoid/paperclip/mobile/version.rb
@@ -81,7 +83,7 @@ files:
81
83
  - lib/tasks/mongoid_paperclip_mobile_tasks.rake
82
84
  - MIT-LICENSE
83
85
  - Rakefile
84
- - README.rdoc
86
+ - README.markdown
85
87
  - test/dummy/app/assets/javascripts/application.js
86
88
  - test/dummy/app/assets/stylesheets/application.css
87
89
  - test/dummy/app/controllers/application_controller.rb
@@ -103,6 +105,10 @@ files:
103
105
  - test/dummy/config/locales/en.yml
104
106
  - test/dummy/config/routes.rb
105
107
  - test/dummy/config.ru
108
+ - test/dummy/Gemfile
109
+ - test/dummy/Gemfile.lock
110
+ - test/dummy/log/development.log
111
+ - test/dummy/log/test.log
106
112
  - test/dummy/public/404.html
107
113
  - test/dummy/public/422.html
108
114
  - test/dummy/public/500.html
@@ -127,7 +133,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
127
133
  version: '0'
128
134
  segments:
129
135
  - 0
130
- hash: -3886269182147222459
136
+ hash: 1077523904554630928
131
137
  required_rubygems_version: !ruby/object:Gem::Requirement
132
138
  none: false
133
139
  requirements:
@@ -136,7 +142,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
136
142
  version: '0'
137
143
  segments:
138
144
  - 0
139
- hash: -3886269182147222459
145
+ hash: 1077523904554630928
140
146
  requirements: []
141
147
  rubyforge_project:
142
148
  rubygems_version: 1.8.24
@@ -165,6 +171,10 @@ test_files:
165
171
  - test/dummy/config/locales/en.yml
166
172
  - test/dummy/config/routes.rb
167
173
  - test/dummy/config.ru
174
+ - test/dummy/Gemfile
175
+ - test/dummy/Gemfile.lock
176
+ - test/dummy/log/development.log
177
+ - test/dummy/log/test.log
168
178
  - test/dummy/public/404.html
169
179
  - test/dummy/public/422.html
170
180
  - test/dummy/public/500.html
@@ -1,4 +0,0 @@
1
- module MongoidPaperclipMobile
2
- class ApplicationController < ActionController::Base
3
- end
4
- end
@@ -1,4 +0,0 @@
1
- module MongoidPaperclipMobile
2
- module ApplicationHelper
3
- end
4
- end
@@ -1,14 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>MongoidPaperclipMobile</title>
5
- <%= stylesheet_link_tag "mongoid_paperclip_mobile/application", :media => "all" %>
6
- <%= javascript_include_tag "mongoid_paperclip_mobile/application" %>
7
- <%= csrf_meta_tags %>
8
- </head>
9
- <body>
10
-
11
- <%= yield %>
12
-
13
- </body>
14
- </html>