diff --git a/.gitignore b/.gitignore index 5fff1d9..dff137a 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ +.idea pkg diff --git a/app/controllers/podcasts_controller.rb b/app/controllers/podcasts_controller.rb index 5e5d6df..9668685 100644 --- a/app/controllers/podcasts_controller.rb +++ b/app/controllers/podcasts_controller.rb @@ -2,7 +2,6 @@ class PodcastsController < ApplicationController before_filter :find_all_podcasts before_filter :find_page - before_filter :set_content_permissions, :only => [:show] def index respond_to do |format| @@ -16,7 +15,6 @@ def index def show @podcast = Podcast.find(params[:id]) - check_content_availability(@podcast) end protected diff --git a/app/models/podcast.rb b/app/models/podcast.rb index 74092a2..580a970 100644 --- a/app/models/podcast.rb +++ b/app/models/podcast.rb @@ -1,16 +1,22 @@ class Podcast < ActiveRecord::Base - acts_as_indexed :fields => [:title, :author, :subtitle, :duration, :keywords, :summary, :content_type_tags, :genre_tags, :topic_tags] + acts_as_indexed :fields => [:title, :author, :subtitle, :duration, :keywords, :summary, :content_types, :genres, :topics] validates :title, :presence => true, :uniqueness => true belongs_to :file, :class_name => 'Resource' + #TODO: setup some js to take care of the tags + acts_as_taggable_on :genres, :content_types, :topics + belongs_to :photo, :class_name => 'Image' + #not sure what these are has_many :author_resources, :as => :favoriteable, :dependent => :destroy - default_scope :order => "published DESC" + FEED_FIELDS = %w(podcast_title podcast_author podcast_explicit_flag podcast_description podcast_owner_name podcast_owner_email podcast_category podcast_subcategory) + def episode_number + #TODO: make the starting episode configurable episode = 0 Podcast.find(:all, :order => "published ASC").each do |p| @@ -20,5 +26,5 @@ def episode_number episode end - + end diff --git a/app/views/admin/podcasts/_form.html.erb b/app/views/admin/podcasts/_form.html.erb index 9e84a93..cd13043 100644 --- a/app/views/admin/podcasts/_form.html.erb +++ b/app/views/admin/podcasts/_form.html.erb @@ -3,55 +3,84 @@ :object => @podcast, :include_object_name => true } %> + +
+ <%= f.label :title -%> + <%= f.text_field :title, :class => 'larger widest' -%> +
+ +
+ <%= f.label :subtitle -%> + <%= f.text_field :subtitle, :size => 100 -%> +
+ +
+ <%= f.label :content_type_list, "Content Type Tags" %> + <%= f.text_field :content_type_list, :class => 'ui-autocomplete-input' %>
+ + Separate with commas, e.g. "How To, Information" + +
+ +
+ <%= f.label :genre_list, "Genre Tags" %> + <%= f.text_field :genre_list, :class => 'ui-autocomplete-input' %>
+ + Separate with commas, e.g. "90's, Alternative, Rock" + +
-
- <%= f.label :title -%> - <%= f.text_field :title, :class => 'larger widest' -%> -
- -
- <%= f.label :subtitle -%> - <%= f.text_field :subtitle, :size => 100 -%> -
- -
- - <%= f.label :file, 'Podcast file' -%> - <%= refinery_help_tag "Supported file formats include .m4a, .mp3, .mov, .mp4, .m4v, and .pdf" %> - - <%= render :partial => "/shared/admin/resource_picker", :locals => { - :f => f, - :field => :file_id, - :resource => @podcast.file, - :description => "podcast" - } %> -
- <%= render '/shared/alc_special_attrs', :f => f %> -
- <%= f.label :published -%> - <%= f.date_select :published -%> -
- -
- <%= f.label :author -%> - <%= f.text_field :author -%> -
- -
- - <%= f.label :duration -%> - <%= refinery_help_tag "In HH:MM:SS format. E.g. \"10:22\" for 10 minutes 22 seconds" %> - - <%= f.text_field :duration, :size => 6 -%> -
- -
- - <%= f.label :keywords -%> - <%= refinery_help_tag "Up to 12 keywords separated by commas.

E.g. rails, ruby on rails, refinerycms, refinery.

According to iTunes, the best use for keywords is to include common misspellings of your name or title, to ensure your podcast is still searchable despite a misspelling. To prevent keyword abuse, iTunes indexes only the first 12 keywords found in this tag." %> -
- <%= f.text_field :keywords, :size => 100 -%>
-
- - <%= render :partial => "/shared/admin/form_actions", :locals => {:f => f, :continue_editing => false} %> - <% end -%> +
+ <%= f.label :topic_list, "Topic Tags" %> + <%= f.text_field :topic_list, :class => 'ui-autocomplete-input' %>
+ + Separate with commas, e.g. "RefineryCMS, Rails, Models, Validation" + +
+ +
+ + <%= f.label :file, 'Podcast file' -%> + <%= refinery_help_tag "Supported file formats include .m4a, .mp3, .mov, .mp4, .m4v, and .pdf" %> + + <%= render :partial => "/shared/admin/resource_picker", :locals => { + :f => f, + :field => :file_id, + :resource => @podcast.file, + :description => "podcast" + } %> +
+ +
+ <%= f.label :published -%> + <%= f.date_select :published -%> +
+ +
+ <%= f.label :author -%> + <%= f.text_field :author -%> +
+ +
+ + <%= f.label :duration -%> + <%= refinery_help_tag "In HH:MM:SS format. E.g. \"10:22\" for 10 minutes 22 seconds" %> + + <%= f.text_field :duration, :size => 6 -%> +
+ +
+ + <%= f.label :keywords -%> + <%= refinery_help_tag "Up to 12 keywords separated by commas.

E.g. rails, ruby on rails, refinerycms, refinery.

According to iTunes, the best use for keywords is to include common misspellings of your name or title, to ensure your podcast is still searchable despite a misspelling. To prevent keyword abuse, iTunes indexes only the first 12 keywords found in this tag." %> +
+ <%= f.text_field :keywords, :size => 100 -%>
+
+ +
+ <%= f.label :summary -%> + <%= f.text_area :summary, :rows => 5, :class => 'widest' -%> +
+ + <%= render :partial => "/shared/admin/form_actions", :locals => {:f => f, :continue_editing => false} %> +<% end -%> diff --git a/app/views/admin/podcasts/index.html.erb b/app/views/admin/podcasts/index.html.erb index 6cb518f..c17a6a5 100644 --- a/app/views/admin/podcasts/index.html.erb +++ b/app/views/admin/podcasts/index.html.erb @@ -54,3 +54,9 @@ :locals => { :tree => false } if !searching? and Podcast.count > 1 %> + +

+ + NOTE: Please update Refinery Settings prefixed with podcast to properly build your podcast feed. + +

diff --git a/app/views/admin/podcasts/new.html.erb b/app/views/admin/podcasts/new.html.erb index 2872e82..42509a2 100644 --- a/app/views/admin/podcasts/new.html.erb +++ b/app/views/admin/podcasts/new.html.erb @@ -1 +1 @@ -<%= render :partial => "form" %> +<%= render :partial => "form" %> \ No newline at end of file diff --git a/app/views/podcasts/index.rss.builder b/app/views/podcasts/index.rss.builder index 229f675..5c43032 100644 --- a/app/views/podcasts/index.rss.builder +++ b/app/views/podcasts/index.rss.builder @@ -3,31 +3,31 @@ xml.instruct! xml.rss 'xmlns:itunes' => 'http://www.itunes.com/dtds/podcast-1.0.dtd', :version => '2.0', 'xmlns:atom' => 'http://www.w3.org/2005/Atom' do xml.channel do # NOTE: Fill in everything with your own data down to the categories. - xml.title 'Your Podcast Title' + xml.title RefinerySetting.get('podcast_title') # Points to your website (e.g. http://yoursite.com/) xml.link root_url # Points to your podcast feed (e.g. http://yoursite.com/podcast.rss) - xml.tag!('atom:link', :href => podcast_url, :rel => 'self', :type => 'application/rss+xml') + xml.tag!('atom:link', :href => podcasts_url(:format => 'rss'), :rel => 'self', :type => 'application/rss+xml') # Accepted values are those in the ISO 639-1 Alpha-2 list (two-letter language codes, some with possible modifiers, such as 'en-us'). xml.language 'en-us' - xml.copyright "© #{Time.now.year} Jack & Jill" - xml.tag!('itunes:subtitle', 'A show about everything') + xml.copyright "© #{Time.now.year} #{RefinerySetting.get('site_name')}" + xml.tag!('itunes:subtitle', RefinerySetting.get('motto')) # The content of this tag is shown in the Artist column in iTunes. - xml.tag!('itunes:author', 'John Doe') + xml.tag!('itunes:author', RefinerySetting.get('podcast_author')) # This tag should be used to indicate whether or not your podcast contains # explicit material. The three values for this tag are "yes", "no", and "clean". - xml.tag!('itunes:explicit', 'no') + xml.tag!('itunes:explicit', [false,'false',0,''].include?(RefinerySetting.get('podcast_explicit_flag')) ) # The contents of this tag are shown in a separate window that appears when the # "circled i" in the Description column is clicked. It also appears on the iTunes # page for your podcast. This field can be up to 4000 characters. - description = "All About Everything is a show about everything. Each week we dive into any subject known to man and talk about it as much as we can. Look for our Podcast in the iTunes Store" + description = RefinerySetting.get('podcast_description') xml.tag!('itunes:summary', description) xml.description description @@ -35,8 +35,8 @@ xml.rss 'xmlns:itunes' => 'http://www.itunes.com/dtds/podcast-1.0.dtd', :version # This tag contains information that will be used to contact the owner of the podcast # for communication specifically about their podcast. It will not be publicly displayed. xml.tag!('itunes:owner') do |owner| - xml.tag!('itunes:name', 'John Doe') - xml.tag!('itunes:email', 'john.doe@example.com') + xml.tag!('itunes:name', RefinerySetting.get('podcast_owner_name')) + xml.tag!('itunes:email', RefinerySetting.get('podcast_owner_email')) end # upload an image to your resources tab and link it in here @@ -45,11 +45,11 @@ xml.rss 'xmlns:itunes' => 'http://www.itunes.com/dtds/podcast-1.0.dtd', :version # select from the list of categories here: # http://www.apple.com/itunes/podcasts/specs.html#categories - xml.tag!('itunes:category', :text => "Technology") do |category| - xml.tag!('itunes:category', :text => "Software How-To") + xml.tag!('itunes:category', :text => RefinerySetting.get('podcast_category')) do |category| + xml.tag!('itunes:category', :text => RefinerySetting.get('podcast_subcategory')) end - @items.each do |item| + @items.select{|item| item.file}.each do |item| xml.item do xml.title item.title xml.tag!('itunes:author', item.author) diff --git a/config/locales/bg.yml b/config/locales/bg.yml new file mode 100644 index 0000000..3c232c7 --- /dev/null +++ b/config/locales/bg.yml @@ -0,0 +1,24 @@ +bg: + shared: + admin: + image_picker: + image: изображение + plugins: + podcasts: + title: Подкасти + admin: + podcasts: + index: + title: Подкасти + create_new: Добавяне на нов подкаст + reorder: Пренареждане на подкастите + reorder_done: Запис на текущото подреждане на подкастите + sorry_no_results: За съжаление нищо не бе намерено. + no_items_yet: Все още няма подкасти. Натиснете "Добавяне на нов подкаст", за да въведете нов. + podcast: + view_live_html: Преглед на този подкаст
(ще се отвори се в нов прозорец) + edit: Редактиране на този подкаст + delete: Изтриване на този подкаст завинаги + podcasts: + show: + other: Други подкасти diff --git a/db/seeds/podcasts.rb b/db/seeds/podcasts.rb index 2c33945..c95df00 100644 --- a/db/seeds/podcasts.rb +++ b/db/seeds/podcasts.rb @@ -1,6 +1,6 @@ User.find(:all).each do |user| user.plugins.create(:name => "podcasts", - :position => (user.plugins.maximum(:position) || -1) +1) + :position => (user.plugins.maximum(:position) || -1) +1) rescue nil end page = Page.create( diff --git a/lib/generators/refinerycms_podcasts_generator.rb b/lib/generators/refinerycms_podcasts_generator.rb index 6f4cf26..6135146 100644 --- a/lib/generators/refinerycms_podcasts_generator.rb +++ b/lib/generators/refinerycms_podcasts_generator.rb @@ -1,6 +1,6 @@ class RefinerycmsPodcasts < Refinery::Generators::EngineInstaller - source_root File.expand_path('../../', __FILE__) + source_root File.expand_path('../../../', __FILE__) engine_name "podcasts" end diff --git a/lib/refinerycms-podcasts.rb b/lib/refinerycms-podcasts.rb index 2bedfdd..2a2652d 100644 --- a/lib/refinerycms-podcasts.rb +++ b/lib/refinerycms-podcasts.rb @@ -13,6 +13,10 @@ class Engine < Rails::Engine plugin.directory = "podcasts" plugin.activity = {:class => Podcast} end + #check/set require parameters + ::Podcast::FEED_FIELDS.each do |field| + RefinerySetting.find_or_set(field,'') + end end end end diff --git a/readme.md b/readme.md index 48e4a63..6dd1fee 100644 --- a/readme.md +++ b/readme.md @@ -7,4 +7,7 @@ gem install refinerycms-podcasts.gem # Sign up for a http://rubygems.org/ account and publish the gem - gem push refinerycms-podcasts.gem \ No newline at end of file + gem push refinerycms-podcasts.gem + +## After install + rails generate acts_as_taggable_on:migration \ No newline at end of file diff --git a/refinerycms-podcasts.gemspec b/refinerycms-podcasts.gemspec index 38af29c..1d7d31f 100644 --- a/refinerycms-podcasts.gemspec +++ b/refinerycms-podcasts.gemspec @@ -8,4 +8,7 @@ Gem::Specification.new do |s| s.authors = ["David Jones"] s.require_paths = %w(lib) s.files = Dir['lib/**/*', 'config/**/*', 'app/**/*'] + + #dependencies + s.add_dependency('acts-as-taggable-on', '~>2.1.0') end