refinerycms-vimeo-videos 0.1.8.1 → 0.1.9.rc1

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,8 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- refinerycms-vimeo-videos (0.1.4)
5
- httparty (~> 0.6.1)
4
+ refinerycms-vimeo-videos (0.1.8.1)
6
5
  vimeo (~> 1.3.0)
7
6
 
8
7
  GEM
@@ -12,11 +11,10 @@ GEM
12
11
  fakeweb (1.2.8)
13
12
  httparty (0.6.1)
14
13
  crack (= 0.1.8)
15
- httpclient (2.2.0.1)
16
- json (1.5.1)
17
- mocha (0.9.12)
18
- multipart-post (1.1.0)
19
- oauth (0.4.4)
14
+ httpclient (2.2.1)
15
+ json (1.5.3)
16
+ multipart-post (1.1.2)
17
+ oauth (0.4.5)
20
18
  vimeo (1.3.0)
21
19
  httparty (>= 0.4.5)
22
20
  httpclient (>= 2.1.5.2)
@@ -29,5 +27,4 @@ PLATFORMS
29
27
 
30
28
  DEPENDENCIES
31
29
  fakeweb (~> 1.2.6)
32
- mocha (~> 0.9.12)
33
30
  refinerycms-vimeo-videos!
@@ -1,18 +1,14 @@
1
+ class VimeoAuthorizationError < StandardError; end
1
2
  module Admin
2
3
  class VimeoVideosController < Admin::BaseController
3
4
 
4
5
  include ::Refinery::VimeoVideos::Account
5
6
 
7
+ before_filter :ensure_authorized!
6
8
  before_filter :init_dialog
7
9
 
8
10
  def index
9
- if authorized?
10
- get_videos_on_vimeo_account
11
- elsif request.xhr?
12
- render :text => 'You have not authorized this application to use your vimeo account.'
13
- else
14
- raise ArgumentError, 'You have not authorized this application to use your vimeo account.'
15
- end
11
+ get_videos_on_vimeo_account
16
12
  end
17
13
 
18
14
  def new
@@ -72,5 +68,20 @@ module Admin
72
68
  :order => 'created_at DESC',
73
69
  :per_page => VimeoVideo.per_page(from_dialog?)
74
70
  end
71
+
72
+ def ensure_authorized!
73
+ begin
74
+
75
+ raise VimeoAuthorizationError unless authorized?
76
+
77
+ rescue VimeoAuthorizationError => exception
78
+
79
+ message = 'You have not authorized your vimeo account with this application.'
80
+ render :partial => 'error_message', :locals => {
81
+ :message => message
82
+ }
83
+
84
+ end
85
+ end
75
86
  end
76
87
  end
@@ -0,0 +1,3 @@
1
+ <div class="errorExplanation" id="errorExplanation">
2
+ <p><%= message %></p>
3
+ </div>
@@ -0,0 +1,15 @@
1
+ de:
2
+ shared:
3
+ admin:
4
+ vimeo_video_picker:
5
+ vimeo_video: vimeo_video
6
+ vimeo_picker:
7
+ no_vimeo_video_selected: Es ist kein Video ausgewählt, klicken Sie hier um eines hinzuzufügen.
8
+ name: Fügen Sie ein Video von Ihrem Vimeo Account hinzu.
9
+ vimeo_video: vimeo_video
10
+ none_selected: Es ist kein Video ausgewählt, klicken Sie hier um eines hinzuzufügen.
11
+ remove_current: Video entfernen.
12
+ change: Video ändern.
13
+ plugins:
14
+ vimeo_videos:
15
+ title: Vimeo Videos
@@ -16,10 +16,10 @@ en:
16
16
  admin:
17
17
  vimeo_videos:
18
18
  form:
19
- maximum_file_size: Maximale Dateigröße ist %{megabytes} Megabytes.
19
+ maximum_file_size: Maximum file size is %{megabytes} Megabytes.
20
20
  insert:
21
- existing: Von account
22
- new: Neues Video
21
+ existing: Vimeo account
22
+ new: Uplaad video
23
23
  actions:
24
24
  create_new: Add New Vimeo Video
25
25
  reorder: Reorder Vimeo Videos
@@ -36,5 +36,4 @@ en:
36
36
  button_text: Save
37
37
  vimeo_videos:
38
38
  show:
39
- other: Other Vimeo Videos
40
- i18n: en.admin.vimeo_videos.existing_vimeo_video.button_text
39
+ other: Other Vimeo Videos
@@ -0,0 +1,30 @@
1
+ module Refinery
2
+ module VimeoVideos
3
+ module ActiveRecord
4
+
5
+ def vimeo_video field
6
+ class_eval <<-EOV
7
+
8
+ def #{field}
9
+ if self.new_record?
10
+ self.#{field}_id
11
+ else
12
+ self.#{field}_id? ? VimeoMetaCache.find_or_create_by_vid(self.#{field}_id) : nil
13
+ end
14
+ end
15
+
16
+ before_save :cache_vimeo_meta_for_#{field}
17
+
18
+ def cache_vimeo_meta_for_#{field}
19
+ if self.#{field}_id? and self.#{field}_id_changed?
20
+ VimeoMetaCache.find_or_create_by_vid(self.#{field}_id)
21
+ end
22
+ end
23
+ protected :cache_vimeo_meta_for_#{field}
24
+
25
+ EOV
26
+ end
27
+
28
+ end
29
+ end
30
+ end
@@ -1,5 +1,5 @@
1
1
  module Refinery
2
2
  module VimeoVideos
3
- VERSION = "0.1.8.1"
3
+ VERSION = "0.1.9.rc1"
4
4
  end
5
5
  end
@@ -1,5 +1,3 @@
1
- require 'refinerycms-base'
2
- require 'vimeo'
3
1
  require 'refinerycms-vimeo-videos/version'
4
2
 
5
3
  module Refinery
@@ -7,19 +5,15 @@ module Refinery
7
5
 
8
6
  autoload :URLTempfile, 'refinerycms-vimeo-videos/url_tempfile.rb'
9
7
  autoload :Account, 'refinerycms-vimeo-videos/account.rb'
10
- autoload :ActiveRecordExtension, 'refinerycms-vimeo-videos/active_record_extension.rb'
11
8
 
12
9
  class Engine < Rails::Engine
13
10
  initializer "static assets" do |app|
14
11
  app.middleware.insert_after ::ActionDispatch::Static, ::ActionDispatch::Static, "#{root}/public"
15
12
  end
16
-
17
- initializer "add active record extensions" do |app|
18
- ActiveRecord::Base.class_eval { include Refinery::VimeoVideos::ActiveRecordExtension }
19
- end
20
-
13
+
21
14
  config.after_initialize do
22
15
  Refinery::Plugin.register do |plugin|
16
+ plugin.pathname = root
23
17
  plugin.version = Refinery::VimeoVideos::VERSION
24
18
  plugin.name = "vimeo_videos"
25
19
  plugin.hide_from_menu = true
@@ -27,4 +21,12 @@ module Refinery
27
21
  end
28
22
  end
29
23
  end
24
+ end
25
+
26
+ require 'refinerycms-vimeo-videos/active_record.rb'
27
+
28
+ module ActiveRecord
29
+ class Base
30
+ extend Refinery::VimeoVideos::ActiveRecord
31
+ end
30
32
  end
metadata CHANGED
@@ -1,49 +1,44 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: refinerycms-vimeo-videos
3
- version: !ruby/object:Gem::Version
4
- prerelease:
5
- version: 0.1.8.1
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.9.rc1
5
+ prerelease: 6
6
6
  platform: ruby
7
- authors:
7
+ authors:
8
8
  - Marian Andre
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
-
13
- date: 2011-04-29 00:00:00 +02:00
14
- default_executable:
15
- dependencies:
16
- - !ruby/object:Gem::Dependency
12
+ date: 2011-06-30 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
17
15
  name: vimeo
18
- prerelease: false
19
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: &2160941200 !ruby/object:Gem::Requirement
20
17
  none: false
21
- requirements:
18
+ requirements:
22
19
  - - ~>
23
- - !ruby/object:Gem::Version
20
+ - !ruby/object:Gem::Version
24
21
  version: 1.3.0
25
22
  type: :runtime
26
- version_requirements: *id001
27
- - !ruby/object:Gem::Dependency
28
- name: fakeweb
29
23
  prerelease: false
30
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ version_requirements: *2160941200
25
+ - !ruby/object:Gem::Dependency
26
+ name: fakeweb
27
+ requirement: &2160940640 !ruby/object:Gem::Requirement
31
28
  none: false
32
- requirements:
29
+ requirements:
33
30
  - - ~>
34
- - !ruby/object:Gem::Version
31
+ - !ruby/object:Gem::Version
35
32
  version: 1.2.6
36
33
  type: :development
37
- version_requirements: *id002
34
+ prerelease: false
35
+ version_requirements: *2160940640
38
36
  description: Ruby on Rails Vimeo Videos engine for Refinery CMS
39
37
  email: mail@bitflut.com
40
38
  executables: []
41
-
42
39
  extensions: []
43
-
44
40
  extra_rdoc_files: []
45
-
46
- files:
41
+ files:
47
42
  - .gitignore
48
43
  - Gemfile
49
44
  - Gemfile.lock
@@ -54,12 +49,14 @@ files:
54
49
  - app/models/vimeo_embed_cache.rb
55
50
  - app/models/vimeo_meta_cache.rb
56
51
  - app/models/vimeo_video.rb
52
+ - app/views/admin/vimeo_videos/_error_message.html.erb
57
53
  - app/views/admin/vimeo_videos/_existing_vimeo_video.html.erb
58
54
  - app/views/admin/vimeo_videos/_form.html.erb
59
55
  - app/views/admin/vimeo_videos/_vimeo_video.html.haml
60
56
  - app/views/admin/vimeo_videos/index.js.erb
61
57
  - app/views/admin/vimeo_videos/insert.html.erb
62
58
  - app/views/shared/admin/_vimeo_picker.html.erb
59
+ - config/locales/de.yml
63
60
  - config/locales/en.yml
64
61
  - config/locales/lolcat.yml
65
62
  - config/locales/nb.yml
@@ -72,7 +69,7 @@ files:
72
69
  - lib/generators/refinerycms_vimeo_videos_generator.rb
73
70
  - lib/refinerycms-vimeo-videos.rb
74
71
  - lib/refinerycms-vimeo-videos/account.rb
75
- - lib/refinerycms-vimeo-videos/active_record_extension.rb
72
+ - lib/refinerycms-vimeo-videos/active_record.rb
76
73
  - lib/refinerycms-vimeo-videos/url_tempfile.rb
77
74
  - lib/refinerycms-vimeo-videos/version.rb
78
75
  - lib/tasks/vimeo_videos.rake
@@ -197,38 +194,35 @@ files:
197
194
  - spec/models/vimeo_video_spec.rb
198
195
  - spec/samples/taj.jpg
199
196
  - spec/vimeo_helper.rb
200
- has_rdoc: true
201
197
  homepage: http://bitflut.com
202
- licenses:
198
+ licenses:
203
199
  - MIT
204
200
  post_install_message:
205
201
  rdoc_options: []
206
-
207
- require_paths:
202
+ require_paths:
208
203
  - lib
209
204
  - config
210
205
  - app
211
206
  - public
212
- required_ruby_version: !ruby/object:Gem::Requirement
207
+ required_ruby_version: !ruby/object:Gem::Requirement
213
208
  none: false
214
- requirements:
215
- - - ">="
216
- - !ruby/object:Gem::Version
217
- version: "0"
218
- required_rubygems_version: !ruby/object:Gem::Requirement
209
+ requirements:
210
+ - - ! '>='
211
+ - !ruby/object:Gem::Version
212
+ version: '0'
213
+ required_rubygems_version: !ruby/object:Gem::Requirement
219
214
  none: false
220
- requirements:
221
- - - ">="
222
- - !ruby/object:Gem::Version
223
- version: "0"
215
+ requirements:
216
+ - - ! '>'
217
+ - !ruby/object:Gem::Version
218
+ version: 1.3.1
224
219
  requirements: []
225
-
226
220
  rubyforge_project:
227
- rubygems_version: 1.5.2
221
+ rubygems_version: 1.7.2
228
222
  signing_key:
229
223
  specification_version: 3
230
224
  summary: Vimeo Videos engine for Refinery CMS
231
- test_files:
225
+ test_files:
232
226
  - spec/controllers/admin/vimeo_account_controller_spec.rb
233
227
  - spec/fixtures/advanced/album/add_video.json
234
228
  - spec/fixtures/advanced/album/create.json
@@ -1,38 +0,0 @@
1
- module Refinery
2
- module VimeoVideos
3
- module ActiveRecordExtension
4
-
5
- def self.included(base)
6
- base.extend(ClassMethods)
7
- end
8
-
9
- module ClassMethods
10
-
11
- def vimeo_video field
12
- class_eval <<-EOV
13
-
14
- def #{field}
15
- if self.new_record?
16
- self.#{field}_id
17
- else
18
- self.#{field}_id? ? VimeoMetaCache.find_or_create_by_vid(self.#{field}_id) : nil
19
- end
20
- end
21
-
22
- before_save :cache_vimeo_meta_for_#{field}
23
-
24
- def cache_vimeo_meta_for_#{field}
25
- if self.#{field}_id? and self.#{field}_id_changed?
26
- VimeoMetaCache.find_or_create_by_vid(self.#{field}_id)
27
- end
28
- end
29
- protected :cache_vimeo_meta_for_#{field}
30
-
31
- EOV
32
- end
33
-
34
- end
35
-
36
- end
37
- end
38
- end