chili_videos 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data.tar.gz.sig CHANGED
Binary file
data/Gemfile CHANGED
@@ -6,6 +6,9 @@ gem 'hashie', '~> 1.0.0'
6
6
  gem 'friendly_id', '~> 3.2.1'
7
7
 
8
8
  group :development do
9
+ gem 'cucumber'
10
+ gem 'rspec-rails'
11
+ gem 'redmine_plugin_support'
9
12
  gem 'autotest-rails', '~> 4.1.0'
10
13
  gem 'fakeweb'
11
14
  gem 'hoe', '~> 2.8.0'
data/Gemfile.lock CHANGED
@@ -5,19 +5,44 @@ GEM
5
5
  autotest-rails (4.1.0)
6
6
  ZenTest
7
7
  babosa (0.3.2)
8
+ builder (3.0.0)
8
9
  crack (0.1.8)
10
+ cucumber (0.10.0)
11
+ builder (>= 2.1.2)
12
+ diff-lcs (~> 1.1.2)
13
+ gherkin (~> 2.3.2)
14
+ json (~> 1.4.6)
15
+ term-ansicolor (~> 1.0.5)
9
16
  daemons (1.1.0)
10
17
  delayed_job (2.0.4)
11
18
  daemons
19
+ diff-lcs (1.1.2)
12
20
  fakeweb (1.3.0)
13
21
  friendly_id (3.2.1.1)
14
22
  babosa (~> 0.3.0)
23
+ gherkin (2.3.3)
24
+ json (~> 1.4.6)
15
25
  hashie (1.0.0)
16
26
  hoe (2.8.0)
17
27
  rake (>= 0.8.7)
18
28
  httparty (0.7.4)
19
29
  crack (= 0.1.8)
30
+ json (1.4.6)
31
+ rack (1.1.2)
20
32
  rake (0.8.7)
33
+ redmine_plugin_support (0.0.4)
34
+ rspec (2.5.0)
35
+ rspec-core (~> 2.5.0)
36
+ rspec-expectations (~> 2.5.0)
37
+ rspec-mocks (~> 2.5.0)
38
+ rspec-core (2.5.1)
39
+ rspec-expectations (2.5.0)
40
+ diff-lcs (~> 1.1.2)
41
+ rspec-mocks (2.5.0)
42
+ rspec-rails (1.3.2)
43
+ rack (>= 1.0.0)
44
+ rspec (>= 1.3.0)
45
+ term-ansicolor (1.0.5)
21
46
 
22
47
  PLATFORMS
23
48
  ruby
@@ -25,9 +50,12 @@ PLATFORMS
25
50
  DEPENDENCIES
26
51
  ZenTest
27
52
  autotest-rails (~> 4.1.0)
53
+ cucumber
28
54
  delayed_job (~> 2.0.4)
29
55
  fakeweb
30
56
  friendly_id (~> 3.2.1)
31
57
  hashie (~> 1.0.0)
32
58
  hoe (~> 2.8.0)
33
59
  httparty (~> 0.7.4)
60
+ redmine_plugin_support
61
+ rspec-rails
data/History.txt CHANGED
@@ -1,3 +1,22 @@
1
+ == 0.2.0 2011-08-18
2
+
3
+ Minor enhancements:
4
+
5
+ * Removed 'Add one...' link on vidoes/index when you don't
6
+ have permissions to add a video (when no videos present)
7
+ * Updated default pemissions in plugin settings
8
+ * Set so non-members are not able to even be permitted to modify,
9
+ delete, or add videos to a project
10
+ * Added a 'video_link' wiki macro which can be used to generate a
11
+ hyperlink to a specific video.
12
+ * Added a 'version_video_thumbnails' wiki macro which accepts a version
13
+ name and will generate a list of videos associated with the version.
14
+
15
+ Bugfixes:
16
+
17
+ * Fixed bug which caused the "Edit" link for videos to be hidden
18
+ * Cleaned up a few CSS bugs
19
+
1
20
  == 0.1.0 2011-04-21
2
21
 
3
22
  * 1 major enhancement:
data/README.md CHANGED
@@ -7,7 +7,8 @@
7
7
  ChiliProject/Redmine plugin which integrates with [Transload.it](http://transload.it)
8
8
  to offer a private "YouTube-like" setup to your project site.
9
9
 
10
- Notable items to consider before installing:
10
+
11
+ ## NOTABLE ITEMS TO CONSIDER
11
12
 
12
13
  1. This plugin is distributed as a gem, but does
13
14
  ship with migrations and asset files (stylesheets, etc). Therefore,
@@ -87,7 +88,7 @@ In your 'Rakefile', add:
87
88
  ``` ruby
88
89
  require 'chili_videos'
89
90
  require 'tasks/chili_videos_tasks'
90
- ChiliVideosTasks.new"
91
+ ChiliVideosTasks.new
91
92
  ```
92
93
 
93
94
  Run the installation rake task (runs migrations & installs assets)
@@ -1,4 +1,7 @@
1
1
  module VideosHelper
2
+ include ActionView::Helpers::TextHelper
3
+ include ActionView::Helpers::UrlHelper
4
+ include ActionView::Helpers::TagHelper
2
5
  extend self
3
6
 
4
7
  def video_embed_macro_markup(video)
@@ -23,6 +26,32 @@ module VideosHelper
23
26
  "</script>\n"
24
27
  end
25
28
 
29
+ def link_to_video_macro_markup(video)
30
+ "{{video_link(#{video.permalink})}}"
31
+ end
32
+
33
+ def link_to_video(video)
34
+ return "[Video not provided]" unless video.instance_of?(Video)
35
+ "<a href='#{prjct_video_path(video.project, video)}' class='video-link'>#{video.title}</a>"
36
+ end
37
+
38
+ def video_thumbnail_list(videos)
39
+ "<ul class='videos' style='list-style-type: none; float: left; margin-right: 25px; width: 95%;'>\n" + \
40
+ videos.map do |video|
41
+ "<li class='video' id='#{video.to_param}' style='padding-bottom: 30px; display: inline-block;'>\n" + \
42
+ " <a href='#{prjct_video_path(video.project, video)}' class='video-cell small' style='float: left; margin-right: 20px; background-color:#000; text-align: right; display: block; width:128px; height:96px;'>\n" + \
43
+ " <span style='position:relative; top: 81px; padding-right: 3px; color: #CCC; display: block;'>#{video.length}</span>\n" + \
44
+ " </a>\n" + \
45
+ "<h3 style='border-bottom: none; font-size: 12px; width: 128px; padding: 5px 0 0 0; margin: 0;'>#{link_to(truncate(video.title, :length => 24), prjct_video_path(video.project, video), :title => video.title)}</h3>\n" + \
46
+ "<dl style='margin-top: 0;'>\n" + \
47
+ " <dt style='float: left; padding-right: 3px;'>by:</dt>\n" \
48
+ " <dd style='margin: 3px; clear: after; display: block;'>#{link_to(truncate(video.user.name, :length => 17), usr_path(video.user))}</dd>\n" + \
49
+ "</dl>\n" + \
50
+ "</li>\n"
51
+ end.join("\n") + \
52
+ "</ul><div style='clear:both;'></div>"
53
+ end
54
+
26
55
  private
27
56
  def swf_object_file_url
28
57
  "/plugin_assets/chili_videos/swfobject.js"
@@ -31,4 +60,12 @@ module VideosHelper
31
60
  def swf_player_file_url
32
61
  "/plugin_assets/chili_videos/player.swf"
33
62
  end
63
+
64
+ def prjct_video_path(project, video)
65
+ "/projects/#{project.to_param}/videos/#{video.to_param}"
66
+ end
67
+
68
+ def usr_path(user)
69
+ "/users/#{user.to_param}"
70
+ end
34
71
  end
@@ -11,27 +11,8 @@
11
11
  <%- if @videos.empty? %>
12
12
  <p class="nodata">
13
13
  No videos uploaded yet!
14
- <%= link_to "Add one...", new_project_video_path(@project) %>
14
+ <%= link_to "Add one...", new_project_video_path(@project) if User.current.allowed_to?(:add_video, nil, :global => true) %>
15
15
  <p>
16
16
  <%- else %>
17
- <ul class="videos">
18
- <%- @videos.each do |video| %>
19
- <li class="video" id="<%= video.to_param %>">
20
- <a href="<%= project_video_path(@project, video) %>" class="video-cell small">
21
- <span>
22
- <%= video.length %>
23
- </span>
24
- </a>
25
- <h3>
26
- <%= link_to(truncate(video.title, :length => 24), project_video_path(@project, video), :title => video.title) %>
27
- </h3>
28
- <dl>
29
- <dt>by:</dt>
30
- <dd>
31
- <%= link_to(truncate(video.user.name, :length => 17), user_path(video.user)) %>
32
- </dd>
33
- </dl>
34
- </li>
35
- <%- end %>
36
- </ul>
17
+ <%= video_thumbnail_list(@videos) %>
37
18
  <%- end %>
@@ -4,7 +4,7 @@
4
4
 
5
5
  <div class="contextual">
6
6
  <%= link_to(l(:new_video_label), new_project_video_path(@project), :class => 'icon icon-add') if User.current.allowed_to?(:add_video, nil, :global => true) %>
7
- <%= link_to(l(:edit_video_label), edit_project_video_path(@project), :class => 'icon icon-edit video-edit') if User.current.allowed_to?(:edit_video, nil, :global => true) %>
7
+ <%= link_to(l(:edit_video_label), edit_project_video_path(@project), :class => 'icon icon-edit video-edit') if User.current.allowed_to?(:modify_video, nil, :global => true) %>
8
8
  <%= link_to(l(:delete_video_label), project_video_path(@project), :class => 'icon icon-del video-del', :confirm => l(:confirm_video_deletion), :method => :delete) if User.current.allowed_to?(:delete_video, nil, :global => true) %>
9
9
  </div>
10
10
 
@@ -32,8 +32,10 @@
32
32
  <dd><%= link_to @video.version, project_version_path(@project, @video.version) %></dd>
33
33
  <%- end %>
34
34
 
35
- <dt><label for="<%= @video.title %>">Embed:</label></dt>
35
+ <dt><label for="<%= @video.title %>">Embed video:</label></dt>
36
36
  <dd><input type="text" id="<%= @video.title %>" class="embed standard" value="<%= video_embed_macro_markup(@video) %>" /></dd>
37
+ <dt><label for="<%= @video.title %>_link">Video Link:</label></dt>
38
+ <dd><input type="text" id="<%= @video.title %>_link" class="embed standard" value="<%= link_to_video_macro_markup(@video) %>" /></dd>
37
39
  </dl>
38
40
  </div>
39
41
 
@@ -28,6 +28,7 @@ ul.videos li {
28
28
  .video.single dt {
29
29
  font-weight: bold;
30
30
  display: block;
31
+ width: 100px;
31
32
  }
32
33
 
33
34
  .video input {
data/init.rb CHANGED
@@ -1,11 +1,12 @@
1
1
  require 'redmine'
2
2
  require 'chili_videos'
3
+ require 'action_view/helpers/text_helper'
3
4
 
4
5
  # Patches to the Redmine core.
5
6
  require 'dispatcher'
6
7
  require 'videos_helper'
7
8
 
8
- Dispatcher.to_prepare :question_plugin do
9
+ Dispatcher.to_prepare :chili_vidoes do
9
10
  require_dependency 'project'
10
11
  Project.send(:include, VideoProjectPatch) unless Project.included_modules.include? VideoProjectPatch
11
12
 
@@ -22,15 +23,15 @@ Redmine::Plugin.register :chili_videos do
22
23
  author 'Tom Kersten'
23
24
  description 'Adds support for using the Transload.it service to transcode videos and associate them with projects.'
24
25
  version ChiliVideos::VERSION
25
- url 'http://example.com/path/to/plugin'
26
+ url 'https://github.com/tomkersten/chili_videos'
26
27
  author_url 'http://tomkersten.com/'
27
28
 
28
29
  project_module :videos do
29
- permission :view_video_list, :videos => :index
30
- permission :view_specific_video, :videos => :show
31
- permission :modify_videos, :videos => [:edit,:update]
32
- permission :delete_video, :videos => :destroy
33
- permission :add_video, :videos => [:new, :create, :upload_complete]
30
+ permission :view_video_list, {:videos => [:index]}
31
+ permission :view_specific_video, {:videos => [:show]}
32
+ permission :modify_videos, {:videos => [:edit,:update]}, {:require => :member}
33
+ permission :delete_video, {:videos => [:destroy]}, {:require => :member}
34
+ permission :add_video, {:videos => [:new, :create, :upload_complete]}, {:require => :member}
34
35
  end
35
36
 
36
37
  settings :default => {:transloadit_api_key => '', :transloadit_workflow => ''}, :partial => 'settings/settings'
@@ -61,3 +62,29 @@ Redmine::WikiFormatting::Macros.register do
61
62
  END
62
63
  end
63
64
  end
65
+
66
+ Redmine::WikiFormatting::Macros.register do
67
+ desc "Provides a link to a video with the title of the video as the link text.\n" +
68
+ "Usage examples:\n\n" +
69
+ " !{{video_link(id)}}\n"
70
+ macro :video_link do |o, args|
71
+ video_id = args[0]
72
+ video = Video.find(video_id)
73
+ VideosHelper.link_to_video(video)
74
+ end
75
+ end
76
+
77
+ Redmine::WikiFormatting::Macros.register do
78
+ desc "Creates a horizontal list of videos associated with the specified verison.\n" +
79
+ "Usage examples:\n\n" +
80
+ " !{{version_video_thumbnails(version_id)}}\n"
81
+ macro :version_video_thumbnails do |o, args|
82
+ version_id = args[0]
83
+ version = Version.find_by_name(version_id) || Version.find_by_id(version_id)
84
+ if version.blank?
85
+ "'#{version_id}' version not found"
86
+ else
87
+ "#{VideosHelper.video_thumbnail_list(version.videos)}"
88
+ end
89
+ end
90
+ end
data/lib/chili_videos.rb CHANGED
@@ -10,7 +10,7 @@ require 'chili_videos/config'
10
10
  module ChiliVideos
11
11
  extend self
12
12
 
13
- VERSION = '0.1.0' unless defined?(ChiliVideos::VERSION)
13
+ VERSION = '0.2.0' unless defined?(ChiliVideos::VERSION)
14
14
 
15
15
  def configured?
16
16
  !Config.api_key.blank? && !Config.workflow.blank?
@@ -25,7 +25,7 @@ class ChiliVideosTasks < Rake::TaskLib
25
25
  end
26
26
 
27
27
  desc "Manage delayed_job...requires argument [ACTION=(#{VALID_DJ_ACTIONS.join('|')})]"
28
- task :delayed_job, :action, :needs => [:environment] do |task, args|
28
+ task :delayed_job, 'action' => [:environment] do |task, args|
29
29
  unless(args[:action] && VALID_DJ_ACTIONS.include?(args[:action]))
30
30
  puts "'ACTION' is a required parameter. Valid values are: #{VALID_DJ_ACTIONS.join(', ')}"
31
31
  exit(1)
@@ -110,3 +110,5 @@ class ChiliVideosTasks < Rake::TaskLib
110
110
  ].join("\n")
111
111
  end
112
112
  end
113
+
114
+ ChiliVideosTasks.new
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chili_videos
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
5
- prerelease: false
4
+ hash: 23
5
+ prerelease:
6
6
  segments:
7
7
  - 0
8
- - 1
8
+ - 2
9
9
  - 0
10
- version: 0.1.0
10
+ version: 0.2.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Tom Kersten
@@ -36,8 +36,7 @@ cert_chain:
36
36
  NVADJA==
37
37
  -----END CERTIFICATE-----
38
38
 
39
- date: 2011-04-21 00:00:00 -05:00
40
- default_executable:
39
+ date: 2011-08-18 00:00:00 Z
41
40
  dependencies:
42
41
  - !ruby/object:Gem::Dependency
43
42
  name: httparty
@@ -155,16 +154,6 @@ dependencies:
155
154
  description: |-
156
155
  ChiliProject/Redmine plugin which integrates with [Transload.it](http://transload.it)
157
156
  to offer a private "YouTube-like" setup to your project site.
158
-
159
- Notable items to consider before installing:
160
-
161
- 1. This plugin is distributed as a gem, but does
162
- ship with migrations and asset files (stylesheets, etc). Therefore,
163
- the installation procedure is not the standard process.
164
- 1. The processing of "Assemblies" from the Transload.it service is
165
- handled in the background (via `delayed_job`), so there is an
166
- additional daemon process which you will have to monitor and/or
167
- manage with your installation.
168
157
  email:
169
158
  - tom@whitespur.com
170
159
  executables:
@@ -240,7 +229,6 @@ files:
240
229
  - test/unit/chili_video_plugin/config_test.rb
241
230
  - test/unit/chili_video_plugin_test.rb
242
231
  - test/unit/video_test.rb
243
- has_rdoc: true
244
232
  homepage: http://github.com/tomkersten/chili_videos
245
233
  licenses: []
246
234
 
@@ -271,7 +259,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
271
259
  requirements: []
272
260
 
273
261
  rubyforge_project: chili_videos
274
- rubygems_version: 1.3.7
262
+ rubygems_version: 1.8.8
275
263
  signing_key:
276
264
  specification_version: 3
277
265
  summary: ChiliProject (/Redmine) plugin which adds self-hosted videos transcoded using the Transload.it service. The plugin a 'Video' tab to a project site which contains any associated videos.
metadata.gz.sig CHANGED
Binary file