Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Categories can now be blog, podcast or calendar categories…or all of …

…them together
  • Loading branch information...
commit 779713a9175e48f46f4ea098cef4afc0403779fa 1 parent 1d19575
@bitboxer bitboxer authored
View
14 app/admin/category.rb
@@ -1,6 +1,8 @@
+# encoding: utf-8
ActiveAdmin.register Category do
menu priority: 8
config.sort_order = "title_asc"
+
index do
column :id
column :title do |p|
@@ -9,7 +11,17 @@
column :color do |p|
span p.color, style: "color: #{p.color}"
end
- column :podcast_category
+ column :blog_category do |p|
+ p.blog_category ? "" : "-"
+ end
+ column :calendar_category do |p|
+ p.calendar_category ? "" : "-"
+ end
+ column :podcast_category do |p|
+ p.podcast_category ? "" : "-"
+ end
default_actions
end
+
+
end
View
2  app/models/category.rb
@@ -1,6 +1,6 @@
class Category < ActiveRecord::Base
- scope :calendar, where(podcast_category: false)
+ scope :calendar, where(calendar_category: true)
has_many :blog_posts
View
2  app/views/admin/blog_posts/_post_form.html.haml
@@ -1,6 +1,6 @@
= semantic_form_for [:admin, @blog_post] do |f|
= f.inputs "Details" do
- = f.input :category
+ = f.input :category, collection: Category.where(blog_category: true).order("title")
= f.input :user, collection: User.where(admin: true)
= f.input :headline
= f.input :publishable_from
View
2  app/views/admin/events/_form.html.haml
@@ -5,7 +5,7 @@
= form.input :description, input_html: { class: 'autogrow preview-base', rows: 10 }, wrapper_html: { class: 'previewable' }
= form.input :venue
= form.input :venue_info
- = form.input :category
+ = form.input :category, collection: Category.where(calendar_category: true).order("title")
= form.input :picture
= form.input :url
= form.input :twitter
View
2  app/views/admin/single_events/_form.html.haml
@@ -22,7 +22,7 @@
Ort der Veranstaltungsreihe:
= @single_event.event.venue.location
= form.input :venue_info, placeholder: @single_event.event.venue_info
- = form.input :category
+ = form.input :category, collection: Category.where(calendar_category: true).order("title")
= form.input :picture
%li
%label.label &nbsp;
View
6 db/migrate/20121118100252_add_more_settings_to_categories.rb
@@ -0,0 +1,6 @@
+class AddMoreSettingsToCategories < ActiveRecord::Migration
+ def change
+ add_column :categories, :blog_category, :boolean, default: true
+ add_column :categories, :calendar_category, :boolean, default: true
+ end
+end
View
10 db/schema.rb
@@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20121101081556) do
+ActiveRecord::Schema.define(:version => 20121118100252) do
create_table "active_admin_comments", :force => true do |t|
t.string "resource_id", :null => false
@@ -111,9 +111,11 @@
create_table "categories", :force => true do |t|
t.string "title"
t.string "color"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- t.boolean "podcast_category", :default => false
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ t.boolean "podcast_category", :default => false
+ t.boolean "blog_category", :default => true
+ t.boolean "calendar_category", :default => true
end
create_table "comments", :force => true do |t|
Please sign in to comment.
Something went wrong with that request. Please try again.