Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for generators #2

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
.idea
pkg
2 changes: 0 additions & 2 deletions app/controllers/podcasts_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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|
Expand All @@ -16,7 +15,6 @@ def index

def show
@podcast = Podcast.find(params[:id])
check_content_availability(@podcast)
end

protected
Expand Down
12 changes: 9 additions & 3 deletions app/models/podcast.rb
Original file line number Diff line number Diff line change
@@ -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|
Expand All @@ -20,5 +26,5 @@ def episode_number

episode
end

end
131 changes: 80 additions & 51 deletions app/views/admin/podcasts/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,55 +3,84 @@
:object => @podcast,
:include_object_name => true
} %>

<div class='field'>
<%= f.label :title -%>
<%= f.text_field :title, :class => 'larger widest' -%>
</div>

<div class='field'>
<%= f.label :subtitle -%>
<%= f.text_field :subtitle, :size => 100 -%>
</div>

<div class='field'>
<%= f.label :content_type_list, "Content Type Tags" %>
<%= f.text_field :content_type_list, :class => 'ui-autocomplete-input' %><br/>
<small>
Separate with commas, e.g. "How To, Information"
</small>
</div>

<div class='field'>
<%= f.label :genre_list, "Genre Tags" %>
<%= f.text_field :genre_list, :class => 'ui-autocomplete-input' %><br/>
<small>
Separate with commas, e.g. "90's, Alternative, Rock"
</small>
</div>

<div class='field'>
<%= f.label :title -%>
<%= f.text_field :title, :class => 'larger widest' -%>
</div>

<div class='field'>
<%= f.label :subtitle -%>
<%= f.text_field :subtitle, :size => 100 -%>
</div>

<div class='field'>
<span class='label_with_help'>
<%= f.label :file, 'Podcast file' -%>
<%= refinery_help_tag "Supported file formats include .m4a, .mp3, .mov, .mp4, .m4v, and .pdf" %>
</span>
<%= render :partial => "/shared/admin/resource_picker", :locals => {
:f => f,
:field => :file_id,
:resource => @podcast.file,
:description => "podcast"
} %>
</div>
<%= render '/shared/alc_special_attrs', :f => f %>
<div class='field'>
<%= f.label :published -%>
<%= f.date_select :published -%>
</div>

<div class='field'>
<%= f.label :author -%>
<%= f.text_field :author -%>
</div>

<div class='field'>
<span class='label_with_help'>
<%= f.label :duration -%>
<%= refinery_help_tag "In HH:MM:SS format. E.g. \"10:22\" for 10 minutes 22 seconds" %>
</span>
<%= f.text_field :duration, :size => 6 -%>
</div>

<div class='field'>
<span class='label_with_help'>
<%= f.label :keywords -%>
<%= refinery_help_tag "Up to 12 keywords separated by commas. <br/><br/>E.g. rails, ruby on rails, refinerycms, refinery. <br/><br/>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." %>
</span>
<%= f.text_field :keywords, :size => 100 -%><br/>
</div>

<%= render :partial => "/shared/admin/form_actions", :locals => {:f => f, :continue_editing => false} %>
<% end -%>
<div class='field'>
<%= f.label :topic_list, "Topic Tags" %>
<%= f.text_field :topic_list, :class => 'ui-autocomplete-input' %><br/>
<small>
Separate with commas, e.g. "RefineryCMS, Rails, Models, Validation"
</small>
</div>

<div class='field'>
<span class='label_with_help'>
<%= f.label :file, 'Podcast file' -%>
<%= refinery_help_tag "Supported file formats include .m4a, .mp3, .mov, .mp4, .m4v, and .pdf" %>
</span>
<%= render :partial => "/shared/admin/resource_picker", :locals => {
:f => f,
:field => :file_id,
:resource => @podcast.file,
:description => "podcast"
} %>
</div>

<div class='field'>
<%= f.label :published -%>
<%= f.date_select :published -%>
</div>

<div class='field'>
<%= f.label :author -%>
<%= f.text_field :author -%>
</div>

<div class='field'>
<span class='label_with_help'>
<%= f.label :duration -%>
<%= refinery_help_tag "In HH:MM:SS format. E.g. \"10:22\" for 10 minutes 22 seconds" %>
</span>
<%= f.text_field :duration, :size => 6 -%>
</div>

<div class='field'>
<span class='label_with_help'>
<%= f.label :keywords -%>
<%= refinery_help_tag "Up to 12 keywords separated by commas. <br/><br/>E.g. rails, ruby on rails, refinerycms, refinery. <br/><br/>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." %>
</span>
<%= f.text_field :keywords, :size => 100 -%><br/>
</div>

<div class='field'>
<%= f.label :summary -%>
<%= f.text_area :summary, :rows => 5, :class => 'widest' -%>
</div>

<%= render :partial => "/shared/admin/form_actions", :locals => {:f => f, :continue_editing => false} %>
<% end -%>
6 changes: 6 additions & 0 deletions app/views/admin/podcasts/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,9 @@
:locals => {
:tree => false
} if !searching? and Podcast.count > 1 %>

<p>
<strong>
NOTE: Please update Refinery Settings prefixed with podcast to properly build your podcast feed.
</strong>
</p>
2 changes: 1 addition & 1 deletion app/views/admin/podcasts/new.html.erb
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<%= render :partial => "form" %>
<%= render :partial => "form" %>
24 changes: 12 additions & 12 deletions app/views/podcasts/index.rss.builder
Original file line number Diff line number Diff line change
Expand Up @@ -3,40 +3,40 @@ 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 &amp; 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

# 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', '[email protected]')
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
Expand All @@ -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)
Expand Down
24 changes: 24 additions & 0 deletions config/locales/bg.yml
Original file line number Diff line number Diff line change
@@ -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: Преглед на този подкаст <br/><em>(ще се отвори се в нов прозорец)</em>
edit: Редактиране на този подкаст
delete: Изтриване на този подкаст завинаги
podcasts:
show:
other: Други подкасти
2 changes: 1 addition & 1 deletion db/seeds/podcasts.rb
Original file line number Diff line number Diff line change
@@ -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(
Expand Down
2 changes: 1 addition & 1 deletion lib/generators/refinerycms_podcasts_generator.rb
Original file line number Diff line number Diff line change
@@ -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
4 changes: 4 additions & 0 deletions lib/refinerycms-podcasts.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
gem push refinerycms-podcasts.gem

## After install
rails generate acts_as_taggable_on:migration
3 changes: 3 additions & 0 deletions refinerycms-podcasts.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -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