diff --git a/app/helpers/videos_helper.rb b/app/helpers/videos_helper.rb index a6d9366..e8655ad 100644 --- a/app/helpers/videos_helper.rb +++ b/app/helpers/videos_helper.rb @@ -23,6 +23,15 @@ def video_embed_code(video, size = :standard) "\n" end + def link_to_video_macro_markup(video) + "{{video_link(#{video.permalink})}}" + end + + def link_to_video(video) + return "[Video not provided]" unless video.instance_of?(Video) + "#{video.title}" + end + private def swf_object_file_url "/plugin_assets/chili_videos/swfobject.js" diff --git a/app/views/videos/show.html.erb b/app/views/videos/show.html.erb index b5190fa..c5c7241 100644 --- a/app/views/videos/show.html.erb +++ b/app/views/videos/show.html.erb @@ -32,8 +32,10 @@
<%= link_to @video.version, project_version_path(@project, @video.version) %>
<%- end %> -
+
+
+
diff --git a/assets/stylesheets/videos.css b/assets/stylesheets/videos.css index bbf8328..c6aa31c 100644 --- a/assets/stylesheets/videos.css +++ b/assets/stylesheets/videos.css @@ -28,6 +28,7 @@ ul.videos li { .video.single dt { font-weight: bold; display: block; + width: 100px; } .video input { diff --git a/init.rb b/init.rb index 51f0b41..e1bf165 100644 --- a/init.rb +++ b/init.rb @@ -61,3 +61,14 @@ 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