init.rb in chili_videos-0.1.0 vs init.rb in chili_videos-0.2.0

- old
+ new

@@ -1,13 +1,14 @@ require 'redmine' require 'chili_videos' +require 'action_view/helpers/text_helper' # Patches to the Redmine core. require 'dispatcher' require 'videos_helper' -Dispatcher.to_prepare :question_plugin do +Dispatcher.to_prepare :chili_vidoes do require_dependency 'project' Project.send(:include, VideoProjectPatch) unless Project.included_modules.include? VideoProjectPatch require_dependency 'user' User.send(:include, VideoUserPatch) unless User.included_modules.include? VideoUserPatch @@ -20,19 +21,19 @@ Redmine::Plugin.register :chili_videos do name 'Chili Videos plugin' author 'Tom Kersten' description 'Adds support for using the Transload.it service to transcode videos and associate them with projects.' version ChiliVideos::VERSION - url 'http://example.com/path/to/plugin' + url 'https://github.com/tomkersten/chili_videos' author_url 'http://tomkersten.com/' project_module :videos do - permission :view_video_list, :videos => :index - permission :view_specific_video, :videos => :show - permission :modify_videos, :videos => [:edit,:update] - permission :delete_video, :videos => :destroy - permission :add_video, :videos => [:new, :create, :upload_complete] + permission :view_video_list, {:videos => [:index]} + permission :view_specific_video, {:videos => [:show]} + permission :modify_videos, {:videos => [:edit,:update]}, {:require => :member} + permission :delete_video, {:videos => [:destroy]}, {:require => :member} + permission :add_video, {:videos => [:new, :create, :upload_complete]}, {:require => :member} end settings :default => {:transloadit_api_key => '', :transloadit_workflow => ''}, :partial => 'settings/settings' menu :project_menu, :videos, { :controller => 'videos', :action => 'index' }, :caption => 'Videos', :param => :project_id @@ -57,7 +58,33 @@ <<END <div class="video-cell large" id="video_#{video.to_param}"></div> #{VideosHelper.video_embed_code(video, size)} END + end +end + +Redmine::WikiFormatting::Macros.register do + desc "Provides a link to a video with the title of the video as the link text.\n" + + "Usage examples:\n\n" + + " !{{video_link(id)}}\n" + macro :video_link do |o, args| + video_id = args[0] + video = Video.find(video_id) + VideosHelper.link_to_video(video) + end +end + +Redmine::WikiFormatting::Macros.register do + desc "Creates a horizontal list of videos associated with the specified verison.\n" + + "Usage examples:\n\n" + + " !{{version_video_thumbnails(version_id)}}\n" + macro :version_video_thumbnails do |o, args| + version_id = args[0] + version = Version.find_by_name(version_id) || Version.find_by_id(version_id) + if version.blank? + "'#{version_id}' version not found" + else + "#{VideosHelper.video_thumbnail_list(version.videos)}" + end end end